home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 December / Chip_2001-12_cd1.bin / zkuste / delphi / kompon / d3456 / LSPICEDT.ZIP / D6 / LsPicEditorRegD6.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2001-09-05  |  1.5 KB  |  71 lines

  1. {$IFNDEF VER90} //If not D2
  2.   {$DEFINE D3_OR_hIGHER}
  3.   {$IFNDEF VER100} //If not D3
  4.     {$DEFINE D4_OR_HIGHER}
  5.     {$IFNDEF VER120} //If not D4
  6.       {DEFINE D5_OR_HIGHER}        //2.4
  7.       {$IFNDEF VER130} //If not D5 //2.4
  8.         {$DEFINE D6_OR_HIGHER}
  9.       {$ENDIF}
  10.     {$ENDIF}
  11.   {$ENDIF}
  12. {$ENDIF}
  13.  
  14.  
  15. unit LsPicEditorRegD6;
  16.  
  17. interface
  18.  
  19. uses SysUtils, Controls, Graphics, TypInfo, LsPicEditorMainD6, LsPicEditorViewD6,
  20.      Forms,
  21. {$IFDEF D6_OR_HIGHER}
  22.    DesignIntf, DesignEditors   //2.4
  23. {$ELSE}
  24.    DsgnIntf
  25. {$ENDIF};
  26.  
  27. type
  28.  TLsPictureEditor = class(TClassProperty)
  29.  public
  30.   function GetAttributes: TPropertyAttributes; override;
  31.   procedure Edit; override;
  32.  end;
  33.  
  34. procedure Register;
  35.  
  36. implementation
  37.  
  38.  
  39.  
  40. function TLsPictureEditor.GetAttributes: TPropertyAttributes;
  41. begin
  42.  Result := [paDialog]
  43. end;
  44.  
  45. procedure TLsPictureEditor.Edit;
  46. begin
  47.   Application.CreateForm(TPEMainForm, PEMainForm);
  48.   Application.CreateForm(TPEViewForm, PEViewForm);
  49.   with PEMainForm do
  50.   try
  51.     Image1.Picture := TPicture(GetOrdValue);
  52.     Image2.Picture := Image1.Picture;
  53.  
  54.     if ShowModal = mrOk then
  55.       if (GetPropType^.Name = 'TPicture') then
  56.         SetOrdValue(LongInt(Image1.Picture))
  57.       else
  58.         SetOrdValue(LongInt(Image1.Picture.Bitmap));
  59.   finally
  60.      Close;
  61.   end; { finally }
  62.   PEViewForm.Close;
  63. end;
  64.  
  65. procedure Register;
  66. begin
  67.   RegisterPropertyEditor(TypeInfo(TPicture), nil, '', TLsPictureEditor);
  68.   RegisterPropertyEditor(TypeInfo(TBitmap), nil, '', TLsPictureEditor);
  69. end;
  70.  
  71. end.