mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 14:29:29 +02:00
layout fixes from Darius
git-svn-id: trunk@8538 -
This commit is contained in:
parent
22a5bb4f53
commit
c4ab570ba7
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -1145,6 +1145,9 @@ ideintf/formeditingintf.pas svneol=native#text/pascal
|
||||
ideintf/frmselectprops.lfm svneol=native#text/plain
|
||||
ideintf/frmselectprops.lrs svneol=native#text/plain
|
||||
ideintf/frmselectprops.pas svneol=native#text/plain
|
||||
ideintf/graphicpropedit.lfm svneol=native#text/plain
|
||||
ideintf/graphicpropedit.lrs svneol=native#text/plain
|
||||
ideintf/graphicpropedit.pas svneol=native#text/plain
|
||||
ideintf/graphpropedits.pas svneol=native#text/pascal
|
||||
ideintf/helpfpdoc.pas svneol=native#text/pascal
|
||||
ideintf/helphtml.pas svneol=native#text/pascal
|
||||
|
130
ideintf/graphicpropedit.lfm
Normal file
130
ideintf/graphicpropedit.lfm
Normal file
@ -0,0 +1,130 @@
|
||||
object GraphicPropertyEditorForm: TGraphicPropertyEditorForm
|
||||
ActiveControl = LoadButton
|
||||
Caption = 'Load Image Dialog'
|
||||
ClientHeight = 330
|
||||
ClientWidth = 370
|
||||
Constraints.MinHeight = 180
|
||||
Constraints.MinWidth = 200
|
||||
OnCreate = FormCreate
|
||||
PixelsPerInch = 96
|
||||
Position = poDesktopCenter
|
||||
HorzScrollBar.Page = 369
|
||||
VertScrollBar.Page = 329
|
||||
Left = 290
|
||||
Height = 330
|
||||
Top = 153
|
||||
Width = 370
|
||||
object GroupBox1: TGroupBox
|
||||
Align = alTop
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'Picture'
|
||||
ClientHeight = 271
|
||||
ClientWidth = 354
|
||||
TabOrder = 0
|
||||
Left = 6
|
||||
Height = 289
|
||||
Top = 6
|
||||
Width = 358
|
||||
object LoadButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Caption = 'Load'
|
||||
OnClick = LoadButtonClick
|
||||
TabOrder = 0
|
||||
Left = 275
|
||||
Height = 25
|
||||
Width = 75
|
||||
end
|
||||
object SaveButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Caption = 'Save'
|
||||
OnClick = SaveButtonClick
|
||||
TabOrder = 1
|
||||
Left = 275
|
||||
Height = 25
|
||||
Top = 31
|
||||
Width = 75
|
||||
end
|
||||
object ClearButton: TButton
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Caption = 'Clear'
|
||||
OnClick = ClearButtonClick
|
||||
TabOrder = 2
|
||||
Left = 275
|
||||
Height = 25
|
||||
Top = 62
|
||||
Width = 75
|
||||
end
|
||||
object ScrollBox: TScrollBox
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
ParentColor = False
|
||||
TabOrder = 3
|
||||
AutoScroll = True
|
||||
Left = 5
|
||||
Height = 261
|
||||
Top = 2
|
||||
Width = 261
|
||||
object ImagePreview: TImage
|
||||
AutoSize = True
|
||||
Center = True
|
||||
Transparent = True
|
||||
Height = 100
|
||||
Width = 100
|
||||
end
|
||||
end
|
||||
end
|
||||
object OKButton: TBitBtn
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Bottom = 6
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Caption = '&OK'
|
||||
Default = True
|
||||
Kind = bkOK
|
||||
ModalResult = 1
|
||||
NumGlyphs = 0
|
||||
TabOrder = 1
|
||||
Left = 207
|
||||
Height = 25
|
||||
Top = 301
|
||||
Width = 75
|
||||
end
|
||||
object CancelButton: TBitBtn
|
||||
Anchors = [akRight, akBottom]
|
||||
BorderSpacing.Around = 6
|
||||
BorderSpacing.InnerBorder = 2
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
Kind = bkCancel
|
||||
ModalResult = 2
|
||||
NumGlyphs = 0
|
||||
TabOrder = 2
|
||||
Left = 289
|
||||
Height = 25
|
||||
Top = 301
|
||||
Width = 75
|
||||
end
|
||||
object OpenDialog: TOpenPictureDialog
|
||||
Title = 'Open existing file'
|
||||
Filter = 'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pixmap (*.xpm)|*.xpm|Bitmaps (*.bmp)|*.bmp|All files (*.*)|*.*|'
|
||||
FilterIndex = 0
|
||||
Title = 'Open existing file'
|
||||
left = 136
|
||||
top = 288
|
||||
end
|
||||
object SaveDialog: TSavePictureDialog
|
||||
Title = 'Save file as'
|
||||
Filter = 'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pixmap (*.xpm)|*.xpm|Bitmaps (*.bmp)|*.bmp|All files (*.*)|*.*|'
|
||||
FilterIndex = 0
|
||||
Title = 'Save file as'
|
||||
left = 136
|
||||
top = 320
|
||||
end
|
||||
end
|
50
ideintf/graphicpropedit.lrs
Normal file
50
ideintf/graphicpropedit.lrs
Normal file
@ -0,0 +1,50 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TGraphicPropertyEditorForm','FORMDATA',[
|
||||
'TPF0'#26'TGraphicPropertyEditorForm'#25'GraphicPropertyEditorForm'#13'Active'
|
||||
+'Control'#7#10'LoadButton'#7'Caption'#6#17'Load Image Dialog'#12'ClientHeigh'
|
||||
+'t'#3'J'#1#11'ClientWidth'#3'r'#1#21'Constraints.MinHeight'#3#180#0#20'Const'
|
||||
+'raints.MinWidth'#3#200#0#8'OnCreate'#7#10'FormCreate'#13'PixelsPerInch'#2'`'
|
||||
+#8'Position'#7#15'poDesktopCenter'#18'HorzScrollBar.Page'#3'q'#1#18'VertScro'
|
||||
+'llBar.Page'#3'I'#1#4'Left'#3'"'#1#6'Height'#3'J'#1#3'Top'#3#153#0#5'Width'#3
|
||||
+'r'#1#0#9'TGroupBox'#9'GroupBox1'#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'
|
||||
+#6'akLeft'#7'akRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#7'Caption'#6
|
||||
+#7'Picture'#12'ClientHeight'#3#15#1#11'ClientWidth'#3'b'#1#8'TabOrder'#2#0#4
|
||||
+'Left'#2#6#6'Height'#3'!'#1#3'Top'#2#6#5'Width'#3'f'#1#0#7'TButton'#10'LoadB'
|
||||
+'utton'#7'Anchors'#11#5'akTop'#7'akRight'#0#20'BorderSpacing.Around'#2#6#25
|
||||
+'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#4'Load'#7'OnClick'#7#15'LoadBut'
|
||||
+'tonClick'#8'TabOrder'#2#0#4'Left'#3#19#1#6'Height'#2#25#5'Width'#2'K'#0#0#7
|
||||
+'TButton'#10'SaveButton'#7'Anchors'#11#5'akTop'#7'akRight'#0#20'BorderSpacin'
|
||||
+'g.Around'#2#6#25'BorderSpacing.InnerBorder'#2#2#7'Caption'#6#4'Save'#7'OnCl'
|
||||
+'ick'#7#15'SaveButtonClick'#8'TabOrder'#2#1#4'Left'#3#19#1#6'Height'#2#25#3
|
||||
+'Top'#2#31#5'Width'#2'K'#0#0#7'TButton'#11'ClearButton'#7'Anchors'#11#5'akTo'
|
||||
+'p'#7'akRight'#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.InnerBorder'#2
|
||||
+#2#7'Caption'#6#5'Clear'#7'OnClick'#7#16'ClearButtonClick'#8'TabOrder'#2#2#4
|
||||
+'Left'#3#19#1#6'Height'#2#25#3'Top'#2'>'#5'Width'#2'K'#0#0#10'TScrollBox'#9
|
||||
+'ScrollBox'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#20'Bor'
|
||||
+'derSpacing.Around'#2#6#11'ParentColor'#8#8'TabOrder'#2#3#10'AutoScroll'#9#4
|
||||
+'Left'#2#5#6'Height'#3#5#1#3'Top'#2#2#5'Width'#3#5#1#0#6'TImage'#12'ImagePre'
|
||||
+'view'#8'AutoSize'#9#6'Center'#9#11'Transparent'#9#6'Height'#2'd'#5'Width'#2
|
||||
+'d'#0#0#0#0#7'TBitBtn'#8'OKButton'#7'Anchors'#11#7'akRight'#8'akBottom'#0#20
|
||||
+'BorderSpacing.Bottom'#2#6#20'BorderSpacing.Around'#2#6#25'BorderSpacing.Inn'
|
||||
+'erBorder'#2#2#7'Caption'#6#3'&OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalRe'
|
||||
+'sult'#2#1#9'NumGlyphs'#2#0#8'TabOrder'#2#1#4'Left'#3#207#0#6'Height'#2#25#3
|
||||
+'Top'#3'-'#1#5'Width'#2'K'#0#0#7'TBitBtn'#12'CancelButton'#7'Anchors'#11#7'a'
|
||||
+'kRight'#8'akBottom'#0#20'BorderSpacing.Around'#2#6#25'BorderSpacing.InnerBo'
|
||||
+'rder'#2#2#6'Cancel'#9#7'Caption'#6#6'Cancel'#4'Kind'#7#8'bkCancel'#11'Modal'
|
||||
+'Result'#2#2#9'NumGlyphs'#2#0#8'TabOrder'#2#2#4'Left'#3'!'#1#6'Height'#2#25#3
|
||||
+'Top'#3'-'#1#5'Width'#2'K'#0#0#18'TOpenPictureDialog'#10'OpenDialog'#5'Title'
|
||||
+#6#18'Open existing file'#6'Filter'#12'2'#1#0#0'Graphic (*.ico;*.ppm;*.pgm;*'
|
||||
+'.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp|Icon (*.i'
|
||||
+'co)|*.ico|Portable PixMap (*.ppm)|*.ppm|Portable GrayMap (*.pgm)|*.pgm|Port'
|
||||
+'able BitMap (*.pbm)|*.pbm|Portable Network Graphic (*.png)|*.png|Pixmap (*.'
|
||||
+'xpm)|*.xpm|Bitmaps (*.bmp)|*.bmp|All files (*.*)|*.*|'#11'FilterIndex'#2#0#5
|
||||
+'Title'#6#18'Open existing file'#4'left'#3#136#0#3'top'#3' '#1#0#0#18'TSaveP'
|
||||
+'ictureDialog'#10'SaveDialog'#5'Title'#6#12'Save file as'#6'Filter'#12'2'#1#0
|
||||
+#0'Graphic (*.ico;*.ppm;*.pgm;*.pbm;*.png;*.xpm;*.bmp)|*.ico;*.ppm;*.pgm;*.p'
|
||||
+'bm;*.png;*.xpm;*.bmp|Icon (*.ico)|*.ico|Portable PixMap (*.ppm)|*.ppm|Porta'
|
||||
+'ble GrayMap (*.pgm)|*.pgm|Portable BitMap (*.pbm)|*.pbm|Portable Network Gr'
|
||||
+'aphic (*.png)|*.png|Pixmap (*.xpm)|*.xpm|Bitmaps (*.bmp)|*.bmp|All files (*'
|
||||
+'.*)|*.*|'#11'FilterIndex'#2#0#5'Title'#6#12'Save file as'#4'left'#3#136#0#3
|
||||
+'top'#3'@'#1#0#0#0
|
||||
]);
|
128
ideintf/graphicpropedit.pas
Normal file
128
ideintf/graphicpropedit.pas
Normal file
@ -0,0 +1,128 @@
|
||||
{
|
||||
*****************************************************************************
|
||||
* *
|
||||
* See the file COPYING.modifiedLGPL, included in this distribution, *
|
||||
* for details about the copyright. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* *
|
||||
*****************************************************************************
|
||||
|
||||
Author: Tomas Gregorovic
|
||||
|
||||
Abstract:
|
||||
This units defines the Load Image Dialog (TGraphicPropertyEditorForm)
|
||||
for graphic or picture property editor.
|
||||
}
|
||||
unit GraphicPropEdit;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
ExtCtrls, Buttons, ButtonPanel, ExtDlgs,
|
||||
ObjInspStrConsts;
|
||||
|
||||
type
|
||||
|
||||
{ TGraphicPropertyEditorForm }
|
||||
|
||||
TGraphicPropertyEditorForm = class(TForm)
|
||||
ImagePreview: TImage;
|
||||
OKButton: TBitBtn;
|
||||
CancelButton: TBitBtn;
|
||||
LoadButton: TButton;
|
||||
SaveButton: TButton;
|
||||
ClearButton: TButton;
|
||||
GroupBox1: TGroupBox;
|
||||
OpenDialog: TOpenPictureDialog;
|
||||
SaveDialog: TSavePictureDialog;
|
||||
ScrollBox: TScrollBox;
|
||||
procedure ClearButtonClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure LoadButtonClick(Sender: TObject);
|
||||
procedure SaveButtonClick(Sender: TObject);
|
||||
private
|
||||
FModified: Boolean;
|
||||
procedure SetModified(const AValue: Boolean);
|
||||
{ private declarations }
|
||||
public
|
||||
FileName: String;
|
||||
property Modified: Boolean read FModified write SetModified;
|
||||
property Preview: TImage read ImagePreview write ImagePreview;
|
||||
end;
|
||||
|
||||
var
|
||||
GraphicPropertyEditorForm: TGraphicPropertyEditorForm;
|
||||
|
||||
implementation
|
||||
|
||||
{ TGraphicPropertyEditorForm }
|
||||
|
||||
procedure TGraphicPropertyEditorForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FileName := '';
|
||||
Caption := oisLoadImageDialog;
|
||||
OKButton.Caption := oisOK;
|
||||
CancelButton.Caption := oisCancel;
|
||||
LoadButton.Caption := oisLoad;
|
||||
SaveButton.Caption := oisSave;
|
||||
ClearButton.Caption := oisClear;
|
||||
end;
|
||||
|
||||
procedure TGraphicPropertyEditorForm.ClearButtonClick(Sender: TObject);
|
||||
begin
|
||||
with Preview do
|
||||
begin
|
||||
Picture.Clear;
|
||||
end;
|
||||
|
||||
ScrollBox.Invalidate;
|
||||
SaveButton.Enabled := False;
|
||||
Modified := True;
|
||||
end;
|
||||
|
||||
procedure TGraphicPropertyEditorForm.LoadButtonClick(Sender: TObject);
|
||||
begin
|
||||
if OpenDialog.Execute then
|
||||
begin
|
||||
FileName := OpenDialog.FileName;
|
||||
try
|
||||
Preview.Picture.LoadFromFile(FileName);
|
||||
Modified := True;
|
||||
except
|
||||
on E: Exception do begin
|
||||
MessageDlg(oisErrorLoadingImage,
|
||||
Format(oisErrorLoadingImage2, ['"', FileName, '"', #13, E.Message]),
|
||||
mtError, [mbOk], 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
SaveButton.Enabled := False;
|
||||
if Assigned(Preview.Picture.Graphic) then
|
||||
if not Preview.Picture.Graphic.Empty then
|
||||
SaveButton.Enabled := True;
|
||||
end;
|
||||
|
||||
procedure TGraphicPropertyEditorForm.SaveButtonClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog.Execute then
|
||||
Preview.Picture.SaveToFile(SaveDialog.FileName);
|
||||
end;
|
||||
|
||||
procedure TGraphicPropertyEditorForm.SetModified(const AValue: Boolean);
|
||||
begin
|
||||
if FModified = AValue then Exit;
|
||||
FModified := AValue;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I graphicpropedit.lrs}
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user