localized graphprop editor form and replaced opensavedialog with opensavepicturedialog

git-svn-id: trunk@5866 -
This commit is contained in:
mattias 2004-08-26 22:12:39 +00:00
parent d9c76c32bc
commit 28e09a231e
7 changed files with 43 additions and 81 deletions

View File

@ -181,8 +181,6 @@ type
CancelButton: TButton;
ImageList: TImageList;
procedure BuildAllButtonClick(Sender: TObject);
procedure ConfigureBuildLazarusDlgKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ConfigureBuildLazarusDlgResize(Sender: TObject);
procedure ItemsListBoxDrawItem(Control: TWinControl; Index: Integer;
ARect: TRect; State: TOwnerDrawState);
@ -530,8 +528,7 @@ begin
Position:=poScreenCenter;
Caption:=Format(lisConfigureBuildLazarus, ['"', '"']);
OnResize:=@ConfigureBuildLazarusDlgResize;
OnKeyDown:=@ConfigureBuildLazarusDlgKeyDown;
SetupComponents;
OnResize(nil);
end;
@ -549,13 +546,6 @@ begin
Load(Options);
end;
procedure TConfigureBuildLazarusDlg.ConfigureBuildLazarusDlgKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
if Key=VK_Escape then
ModalResult:=mrCancel;
end;
procedure TConfigureBuildLazarusDlg.ConfigureBuildLazarusDlgResize(
Sender: TObject);
var
@ -938,6 +928,7 @@ begin
Name:='OkButton';
Caption:=lisLazBuildOk;
OnClick:=@OkButtonClick;
Default:=true;
end;
CancelButton:=TButton.Create(Self);
@ -946,6 +937,7 @@ begin
Name:='CancelButton';
Caption:=lisLazBuildCancel;
OnClick:=@CancelButtonClick;
Cancel:=true;
end;
end;

View File

@ -23,7 +23,8 @@ interface
uses
Classes, TypInfo, SysUtils, Forms, Controls, LCLType, GraphType, Graphics,
StdCtrls, Buttons, ComCtrls, Menus, ExtCtrls, Dialogs, LCLIntf, PropEdits;
StdCtrls, Buttons, ComCtrls, Menus, ExtCtrls, Dialogs, LCLIntf, ExtDlgs,
ObjInspStrConsts, PropEdits;
type
{TGraphicPropertyEditor
@ -164,8 +165,8 @@ type
FModified: boolean;
procedure SetModified(const AValue: boolean);
protected
Opendlg: TOPENDIALOG;
Savedlg: TSAVEDIALOG;
Opendlg: TOpenPictureDialog;
Savedlg: TSavePictureDialog;
OKBTN: TBITBTN;
CANCELBTN: TBITBTN;
@ -195,24 +196,14 @@ begin
FileName := '';
Position := poDesktopCenter;
Caption := 'Load Image Dialog';
Caption := oisLoadImageDialog;
HEIGHT := 419;
WIDTH := 403;
Opendlg := TOPENDIALOG.Create(Self);
With Opendlg do begin
OPTIONS := [ofextensiondifferent, ofpathmustexist, offilemustexist, ofenablesizing];
DEFAULTEXT := 'xpm';
FILTER := 'All Image formats (*.bmp;*.xpm)|*.bmp;*.xpm|Bitmaps (*.bmp)|*.bmp|XPM images (*.xpm)|*.xpm';
end;
Opendlg := TOpenPictureDialog.Create(Self);
Savedlg := TSAVEDIALOG.Create(Self);
With Savedlg do begin
OPTIONS := [ofextensiondifferent, ofpathmustexist, offilemustexist, ofenablesizing];
DEFAULTEXT := 'xpm';
FILTER := Opendlg.Filter;
end;
Savedlg := TSavePictureDialog.Create(Self);
OKBTN := TBITBTN.Create(Self);
With OKBTN do begin
@ -220,7 +211,7 @@ begin
KIND := bkok;
SPACING := 3;
MODALRESULT := mrOK;
CAPTION := '&OK';
CAPTION := oisOK;
end;
ScrollBox := TScrollBox.Create(Self);
@ -246,13 +237,13 @@ begin
KIND := bkcancel;
SPACING := 3;
MODALRESULT := mrCancel;
CAPTION := '&Cancel';
CAPTION := oisCancel;
end;
LoadBTN := TBUTTON.Create(Self);
With LoadBTN do begin
Parent := Self;
CAPTION := '&Load';
CAPTION := oisLoad;
ONCLICK := @LoadBTNCLICK;
end;
@ -260,14 +251,14 @@ begin
With SaveBTN do begin
Parent := Self;
ENABLED := False;
CAPTION := '&Save';
CAPTION := oisSave;
ONCLICK := @SaveBTNCLICK;
end;
ClearBTN := TBUTTON.Create(Self);
With ClearBTN do begin
Parent := Self;
CAPTION := 'C&lear';
CAPTION := oisCLear;
ONCLICK := @ClearBTNCLICK;
end;
@ -325,9 +316,8 @@ begin
Modified:=true;
except
on E: Exception do begin
MessageDlg('Error loading image',
'Error loading image "'+FileName+'":'#13+
E.Message,
MessageDlg(oisErrorLoadingImage,
Format(oisErrorLoadingImage2, ['"', FileName, '"', #13, E.Message]),
mtError,[mbOk],0);
end;
end;
@ -515,49 +505,12 @@ end;
procedure TColorPropertyEditor.Edit;
var
ColorDialog: TColorDialog;
{IniFile: TRegIniFile;
procedure GetCustomColors;
begin
if BaseRegistryKey = '' then Exit;
IniFile := TRegIniFile.Create(BaseRegistryKey);
try
IniFile.ReadSectionValues(SCustomColors, ColorDialog.CustomColors);
except
// Ignore errors reading values
end;
end;
procedure SaveCustomColors;
var
I, P: Integer;
S: ansistring;
begin
if IniFile <> nil then
with ColorDialog do
for I := 0 to CustomColors.Count - 1 do
begin
S := CustomColors.Strings[I];
P := Pos('=', S);
if P <> 0 then
begin
S := Copy(S, 1, P - 1);
IniFile.WriteString(SCustomColors, S,
CustomColors.Values[S]);
end;
end;
end;
}
begin
{IniFile := nil;}
ColorDialog := TColorDialog.Create(Application);
try
{GetCustomColors;}
ColorDialog.Color := GetOrdValue;
if ColorDialog.Execute then SetOrdValue(ColorDialog.Color);
{SaveCustomColors;}
finally
{IniFile.Free;}
ColorDialog.Free;
end;
end;
@ -869,7 +822,8 @@ initialization
RegisterPropertyEditor(ClassTypeInfo(TFont), nil,'',TFontPropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TGraphic), nil,'',TGraphicPropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TPicture), nil,'',TPicturePropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'), TFont,'Name', TFontNamePropertyEditor);
RegisterPropertyEditor(DummyClassForPropTypes.PTypeInfos('AnsiString'),
TFont,'Name', TFontNamePropertyEditor);
RegisterPropertyEditor(ClassTypeInfo(TBitmap), TSpeedButton,'Glyph',
TButtonGlyphPropEditor);
RegisterPropertyEditor(ClassTypeInfo(TBitmap), TBitBtn,'Glyph',

View File

@ -114,6 +114,14 @@ resourcestring
oisHelpHelpContextNotFoundInDatabase = 'Help context %s not found in '
+'Database %s%s%s.';
oisHelpHelpContextNotFound = 'Help context %s not found.';
oisLoadImageDialog = 'Load Image Dialog';
oisOK = '&OK';
oisCancel = '&Cancel';
oisLoad = '&Load';
oisSave = '&Save';
oisCLear = 'C&lear';
oisErrorLoadingImage = 'Error loading image';
oisErrorLoadingImage2 = 'Error loading image %s%s%s:%s%s';
implementation

View File

@ -379,8 +379,8 @@ end;
constructor TOpenPictureDialog.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
FDefaultFilter := 'All files ('+GetAllFilesMask+')|'+GetAllFilesMask+'|'
+GraphicFilter(TGraphic);
FDefaultFilter := Format(rsAllFiles, [GetAllFilesMask, GetAllFilesMask,
GraphicFilter(TGraphic)]);
Filter:=FDefaultFilter;
FPictureGroupBox:=TGroupBox.Create(Self);

View File

@ -1117,6 +1117,7 @@ var
begin
if Sender is TWinControl then begin
AControl:=TWinControl(Sender);
//debugln('TApplication.ControlKeyDown A ',Acontrol.Name);
// handle tab keys
if (Key=VK_Tab) and ((Shift-[ssShift])=[])
@ -1131,6 +1132,7 @@ begin
if (Shift = []) and ((Key = VK_RETURN) or (Key = VK_ESCAPE)) then
begin
Form := GetParentForm(AControl);
//debugln('TApplication.ControlKeyDown B ',Acontrol.Name,' ',dbgs(Form<>nil),' ',dbgs(anoEscapeForCancelControl in Navigation));
if Form<>nil then begin
case Key of
VK_RETURN:
@ -1142,11 +1144,13 @@ begin
end;
VK_ESCAPE:
if (anoEscapeForCancelControl in Navigation)
and (Form.CancelControl <> nil) then
begin
Form.CancelControl.ExecuteCancelAction;
Key := VK_UNKNOWN;
if (anoEscapeForCancelControl in Navigation) then begin
if (Form.CancelControl <> nil) then
begin
//debugln('TApplication.ControlKeyDown C ',Acontrol.Name);
Form.CancelControl.ExecuteCancelAction;
Key := VK_UNKNOWN;
end;
end;
end;
@ -1323,6 +1327,9 @@ end;
{ =============================================================================
$Log$
Revision 1.88 2004/08/26 22:12:39 mattias
localized graphprop editor form and replaced opensavedialog with opensavepicturedialog
Revision 1.87 2004/08/26 19:09:34 mattias
moved navigation key handling to TApplication and added options for custom navigation

View File

@ -70,6 +70,7 @@ ResourceString
rsfdFileReadOnlyTitle = 'File is not writable';
rsfdFileReadOnly = 'The file "%s" is not writable.';
rsfdFileSaveAs = 'Save file as';
rsAllFiles = 'All files (%s)|%s|%s';
rsfdSelectDirectory = 'Select Directory';
// Select color dialog

View File

@ -920,7 +920,7 @@ begin
AddFile('arrow.pp','Arrow',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('calendar.pp','Calendar',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('pairsplitter.pas','PairSplitter',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('extdlgs.pp','ExtDlgs',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('extdlgs.pas','ExtDlgs',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('dbctrls.pp','DBCtrls',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('dbgrids.pas','DBGrids',pftUnit,[pffHasRegisterProc],cpBase);
AddFile('editbtn.pas','EditBtn',pftUnit,[pffHasRegisterProc],cpBase);