From 28e09a231e36782d1168dc5400a3198c77878f2e Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 26 Aug 2004 22:12:39 +0000 Subject: [PATCH] localized graphprop editor form and replaced opensavedialog with opensavepicturedialog git-svn-id: trunk@5866 - --- ide/buildlazdialog.pas | 14 ++----- ideintf/graphpropedits.pas | 78 ++++++++---------------------------- ideintf/objinspstrconsts.pas | 8 ++++ lcl/extdlgs.pas | 4 +- lcl/include/application.inc | 17 +++++--- lcl/lclstrconsts.pas | 1 + packager/packagesystem.pas | 2 +- 7 files changed, 43 insertions(+), 81 deletions(-) diff --git a/ide/buildlazdialog.pas b/ide/buildlazdialog.pas index 454b846868..aaf457401d 100644 --- a/ide/buildlazdialog.pas +++ b/ide/buildlazdialog.pas @@ -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; diff --git a/ideintf/graphpropedits.pas b/ideintf/graphpropedits.pas index fc18cbe4fd..e5fef51bc5 100644 --- a/ideintf/graphpropedits.pas +++ b/ideintf/graphpropedits.pas @@ -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', diff --git a/ideintf/objinspstrconsts.pas b/ideintf/objinspstrconsts.pas index fba02da55a..7890c6b718 100644 --- a/ideintf/objinspstrconsts.pas +++ b/ideintf/objinspstrconsts.pas @@ -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 diff --git a/lcl/extdlgs.pas b/lcl/extdlgs.pas index 60f53489b3..23b842ac1b 100644 --- a/lcl/extdlgs.pas +++ b/lcl/extdlgs.pas @@ -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); diff --git a/lcl/include/application.inc b/lcl/include/application.inc index 32ff20e50c..8fe513d6b6 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -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 diff --git a/lcl/lclstrconsts.pas b/lcl/lclstrconsts.pas index a0f3f47570..84b01157eb 100644 --- a/lcl/lclstrconsts.pas +++ b/lcl/lclstrconsts.pas @@ -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 diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index cca755ac9b..7538fa764a 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -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);