From 173f90556b683b31d41a88983db82fcf711211a7 Mon Sep 17 00:00:00 2001 From: paul Date: Fri, 1 May 2009 07:04:20 +0000 Subject: [PATCH] ideintf: use button panel in standard actions editor git-svn-id: trunk@19722 - --- ideintf/actionseditorstd.lfm | 89 ++++++++++------------------- ideintf/actionseditorstd.lrs | 48 +++++++--------- ideintf/actionseditorstd.pas | 107 +++++++++++++++++------------------ 3 files changed, 102 insertions(+), 142 deletions(-) diff --git a/ideintf/actionseditorstd.lfm b/ideintf/actionseditorstd.lfm index f9d1766e78..f0b5144d54 100644 --- a/ideintf/actionseditorstd.lfm +++ b/ideintf/actionseditorstd.lfm @@ -1,7 +1,7 @@ object FormActStandard: TFormActStandard - Left = 294 + Left = 537 Height = 483 - Top = 184 + Top = 187 Width = 330 ActiveControl = tvActStdList BorderStyle = bsDialog @@ -10,28 +10,37 @@ object FormActStandard: TFormActStandard ClientWidth = 330 KeyPreview = True OnClose = FormActStandardClose - OnKeyPress = FormActStandardKeyPress Position = poOwnerFormCenter LCLVersion = '0.9.27' object LabelHeadLine: TLabel - Left = 12 - Height = 18 - Top = 9 - Width = 95 + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Owner + Left = 6 + Height = 14 + Top = 6 + Width = 70 + BorderSpacing.Left = 6 + BorderSpacing.Top = 6 Caption = 'LabelHeadLine' ParentColor = False end object tvActStdList: TTreeView + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = LabelHeadLine + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = BtnPanel - Left = 8 - Height = 395 - Top = 32 - Width = 313 + Left = 6 + Height = 422 + Top = 23 + Width = 318 Anchors = [akTop, akLeft, akRight, akBottom] AutoExpand = True - BorderSpacing.Bottom = 6 - Ctl3D = False - DefaultItemHeight = 19 + BorderSpacing.Left = 6 + BorderSpacing.Top = 3 + BorderSpacing.Right = 6 + DefaultItemHeight = 15 HideSelection = False HotTrack = True ReadOnly = True @@ -41,51 +50,13 @@ object FormActStandard: TFormActStandard OnDblClick = tvActStdListDblClick Options = [tvoAutoExpand, tvoAutoItemHeight, tvoHotTrack, tvoKeepCollapsedNodes, tvoReadOnly, tvoRightClickSelect, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips] end - object BtnPanel: TPanel - Left = 0 - Height = 50 - Top = 433 - Width = 330 - Align = alBottom - BevelOuter = bvNone - ChildSizing.LeftRightSpacing = 6 - ChildSizing.TopBottomSpacing = 6 - ChildSizing.HorizontalSpacing = 6 - ChildSizing.VerticalSpacing = 6 - ClientHeight = 50 - ClientWidth = 330 + object BtnPanel: TButtonPanel + Left = 6 + Height = 26 + Top = 451 + Width = 318 TabOrder = 1 - object btnCancel: TBitBtn - Left = 165 - Height = 38 - Top = 6 - Width = 78 - Align = alRight - Anchors = [akRight, akBottom] - AutoSize = True - Caption = 'Cancel' - Constraints.MinWidth = 75 - Kind = bkCancel - ModalResult = 2 - NumGlyphs = 0 - TabOrder = 0 - end - object btnOK: TBitBtn - Left = 249 - Height = 38 - Top = 6 - Width = 75 - Align = alRight - Anchors = [akRight, akBottom] - AutoSize = True - Caption = '&OK' - Constraints.MinWidth = 75 - Default = True - Kind = bkOK - ModalResult = 1 - NumGlyphs = 0 - OnClick = btnOKClick - TabOrder = 1 - end + ShowButtons = [pbOK, pbCancel] + ShowBevel = False end end diff --git a/ideintf/actionseditorstd.lrs b/ideintf/actionseditorstd.lrs index 61226fb4a8..d48fd85e1c 100644 --- a/ideintf/actionseditorstd.lrs +++ b/ideintf/actionseditorstd.lrs @@ -1,33 +1,27 @@ { This is an automatically generated lazarus resource file } LazarusResources.Add('TFormActStandard','FORMDATA',[ - 'TPF0'#16'TFormActStandard'#15'FormActStandard'#4'Left'#3'&'#1#6'Height'#3#227 - +#1#3'Top'#3#184#0#5'Width'#3'J'#1#13'ActiveControl'#7#12'tvActStdList'#11'Bo' + 'TPF0'#16'TFormActStandard'#15'FormActStandard'#4'Left'#3#25#2#6'Height'#3#227 + +#1#3'Top'#3#187#0#5'Width'#3'J'#1#13'ActiveControl'#7#12'tvActStdList'#11'Bo' +'rderStyle'#7#8'bsDialog'#7'Caption'#6#15'FormActStandard'#12'ClientHeight'#3 +#227#1#11'ClientWidth'#3'J'#1#10'KeyPreview'#9#7'OnClose'#7#20'FormActStanda' - +'rdClose'#10'OnKeyPress'#7#23'FormActStandardKeyPress'#8'Position'#7#17'poOw' - +'nerFormCenter'#10'LCLVersion'#6#6'0.9.27'#0#6'TLabel'#13'LabelHeadLine'#4'L' - +'eft'#2#12#6'Height'#2#18#3'Top'#2#9#5'Width'#2'_'#7'Caption'#6#13'LabelHead' - +'Line'#11'ParentColor'#8#0#0#9'TTreeView'#12'tvActStdList'#24'AnchorSideBott' - +'om.Control'#7#8'BtnPanel'#4'Left'#2#8#6'Height'#3#139#1#3'Top'#2' '#5'Width' - +#3'9'#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'AutoExp' - +'and'#9#20'BorderSpacing.Bottom'#2#6#5'Ctl3D'#8#17'DefaultItemHeight'#2#19#13 - +'HideSelection'#8#8'HotTrack'#9#8'ReadOnly'#9#16'RightClickSelect'#9#10'Scro' - +'llBars'#7#10'ssVertical'#8'TabOrder'#2#0#10'OnDblClick'#7#20'tvActStdListDb' - +'lClick'#7'Options'#11#13'tvoAutoExpand'#17'tvoAutoItemHeight'#11'tvoHotTrac' - +'k'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#19'tvoRightClickSelect'#14'tvo' - +'ShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoToolTips'#0#0#0#6'TPane' - +'l'#8'BtnPanel'#4'Left'#2#0#6'Height'#2'2'#3'Top'#3#177#1#5'Width'#3'J'#1#5 - +'Align'#7#8'alBottom'#10'BevelOuter'#7#6'bvNone'#28'ChildSizing.LeftRightSpa' - +'cing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizing.HorizontalSpa' - +'cing'#2#6#27'ChildSizing.VerticalSpacing'#2#6#12'ClientHeight'#2'2'#11'Clie' - +'ntWidth'#3'J'#1#8'TabOrder'#2#1#0#7'TBitBtn'#9'btnCancel'#4'Left'#3#165#0#6 - +'Height'#2'&'#3'Top'#2#6#5'Width'#2'N'#5'Align'#7#7'alRight'#7'Anchors'#11#7 - +'akRight'#8'akBottom'#0#8'AutoSize'#9#7'Caption'#6#6'Cancel'#20'Constraints.' - +'MinWidth'#2'K'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#9'NumGlyphs'#2#0#8 - +'TabOrder'#2#0#0#0#7'TBitBtn'#5'btnOK'#4'Left'#3#249#0#6'Height'#2'&'#3'Top' - +#2#6#5'Width'#2'K'#5'Align'#7#7'alRight'#7'Anchors'#11#7'akRight'#8'akBottom' - +#0#8'AutoSize'#9#7'Caption'#6#3'&OK'#20'Constraints.MinWidth'#2'K'#7'Default' - +#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7#10'bt' - +'nOKClick'#8'TabOrder'#2#1#0#0#0#0 + +'rdClose'#8'Position'#7#17'poOwnerFormCenter'#10'LCLVersion'#6#6'0.9.27'#0#6 + +'TLabel'#13'LabelHeadLine'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSi' + +'deTop.Control'#7#5'Owner'#4'Left'#2#6#6'Height'#2#14#3'Top'#2#6#5'Width'#2 + +'F'#18'BorderSpacing.Left'#2#6#17'BorderSpacing.Top'#2#6#7'Caption'#6#13'Lab' + +'elHeadLine'#11'ParentColor'#8#0#0#9'TTreeView'#12'tvActStdList'#22'AnchorSi' + +'deLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#13'LabelHeadLine'#18 + +'AnchorSideTop.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20 + +'AnchorSideRight.Side'#7#9'asrBottom'#24'AnchorSideBottom.Control'#7#8'BtnPa' + +'nel'#4'Left'#2#6#6'Height'#3#166#1#3'Top'#2#23#5'Width'#3'>'#1#7'Anchors'#11 + +#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'AutoExpand'#9#18'BorderSpaci' + +'ng.Left'#2#6#17'BorderSpacing.Top'#2#3#19'BorderSpacing.Right'#2#6#17'Defau' + +'ltItemHeight'#2#15#13'HideSelection'#8#8'HotTrack'#9#8'ReadOnly'#9#16'Right' + +'ClickSelect'#9#10'ScrollBars'#7#10'ssVertical'#8'TabOrder'#2#0#10'OnDblClic' + +'k'#7#20'tvActStdListDblClick'#7'Options'#11#13'tvoAutoExpand'#17'tvoAutoIte' + +'mHeight'#11'tvoHotTrack'#21'tvoKeepCollapsedNodes'#11'tvoReadOnly'#19'tvoRi' + +'ghtClickSelect'#14'tvoShowButtons'#12'tvoShowLines'#11'tvoShowRoot'#11'tvoT' + +'oolTips'#0#0#0#12'TButtonPanel'#8'BtnPanel'#4'Left'#2#6#6'Height'#2#26#3'To' + +'p'#3#195#1#5'Width'#3'>'#1#8'TabOrder'#2#1#11'ShowButtons'#11#4'pbOK'#8'pbC' + +'ancel'#0#9'ShowBevel'#8#0#0#0 ]); diff --git a/ideintf/actionseditorstd.pas b/ideintf/actionseditorstd.pas index b231a8c764..6a04d808e6 100644 --- a/ideintf/actionseditorstd.pas +++ b/ideintf/actionseditorstd.pas @@ -33,25 +33,22 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, Buttons, ActnList, StdActns, DBActns, LCLType, Contnrs, - LCLProc, ActionsEditor, ObjInspStrConsts, ExtCtrls; + LCLProc, ActionsEditor, ObjInspStrConsts, ExtCtrls, ButtonPanel; type { TFormActStandard } TFormActStandard = class(TForm) - btnCancel: TBitBtn; - btnOK: TBitBtn; LabelHeadLine: TLabel; - BtnPanel: TPanel; tvActStdList: TTreeView; + BtnPanel: TButtonPanel; procedure FormActStandardClose(Sender: TObject; var CloseAction: TCloseAction); - procedure FormActStandardKeyPress(Sender: TObject; var Key: char); procedure btnOKClick(Sender: TObject); procedure tvActStdListDblClick(Sender: TObject); private FResultActionProc: TResultActProc; - fActStdProperty: TActStdProp; + FActStdProperty: TActStdProp; procedure EnumAct; procedure ResultActionProc; procedure AddStdActProperties; @@ -71,16 +68,10 @@ begin CloseAction := caFree; end; -procedure TFormActStandard.FormActStandardKeyPress(Sender: TObject; var Key: char); -begin - if Ord(Key) = VK_ESCAPE then Self.Close; -end; - procedure TFormActStandard.btnOKClick(Sender: TObject); begin - if Assigned(FResultActionProc) - and not tvActStdList.Selected.HasChildren - then ResultActionProc; + if Assigned(FResultActionProc) and not tvActStdList.Selected.HasChildren then + ResultActionProc; end; procedure TFormActStandard.tvActStdListDblClick(Sender: TObject); @@ -91,12 +82,13 @@ var begin mousePoint := TTreeView(Sender).ScreenToClient(Mouse.CursorPos); node := TTreeView(Sender).Selected; - if Assigned(node) then begin + if Assigned(node) then + begin MyHitTest := TTreeView(Sender).GetHitTestInfoAt(mousePoint.X, mousePoint.Y ); - if (htOnItem in MyHitTest) - or (htOnLabel in MyHitTest) then begin - if (not node.HasChildren) and (node.Parent is TTreeNode) - then btnOK.Click + if (htOnItem in MyHitTest) or (htOnLabel in MyHitTest) then + begin + if (not node.HasChildren) and (node.Parent is TTreeNode) then + BtnPanel.OKButton.Click { else begin if node.Expanded then node.Collapse(False) @@ -112,11 +104,13 @@ var NodeCategory: TTreeNode; begin tvActStdList.BeginUpdate; - for outer := 0 to RegisteredActions.Count-1 do begin - with tvActStdList.Items do begin + for outer := 0 to RegisteredActions.Count-1 do + begin + with tvActStdList.Items do + begin NodeCategory := Add(nil, RegisteredActions.Items[outer].Name); - for inner := 0 to RegisteredActions.Items[outer].Count-1 - do AddChild(NodeCategory, RegisteredActions.Items[outer].Items[inner].ActionClass.ClassName); + for inner := 0 to RegisteredActions.Items[outer].Count-1 do + AddChild(NodeCategory, RegisteredActions.Items[outer].Items[inner].ActionClass.ClassName); end; // with end; // for outer tvActStdList.EndUpdate; @@ -133,46 +127,46 @@ begin Category := tvActStdList.Selected.Parent.Text; lastItem := True; fClass := RegisteredActions.Items[RegisteredActions.IndexOfCategory(Category)].Items[tvActStdList.Selected.Index].ActionClass; - FResultActionProc(Category, fClass, fActStdProperty.IndexOfClass(fClass.ClassName), lastItem); + FResultActionProc(Category, fClass, FActStdProperty.IndexOfClass(fClass.ClassName), lastItem); end; procedure TFormActStandard.AddStdActProperties; begin //ActStdResource.Add(TEditCutResource); - fActStdProperty.Add(TEditCut, oiStdActEditCutHeadLine, oiStdActEditCutShortCut, oiStdActEditCutShortHint); - fActStdProperty.Add(TEditCopy, oiStdActEditCopyHeadLine, oiStdActEditCopyShortCut, oiStdActEditCopyShortHint); - fActStdProperty.Add(TEditPaste, oiStdActEditPasteHeadLine, oiStdActEditPasteShortCut, oiStdActEditPasteShortHint); - fActStdProperty.Add(TEditSelectAll, oiStdActEditSelectAllHeadLine, oiStdActEditSelectAllShortCut, oiStdActEditSelectAllShortHint); - fActStdProperty.Add(TEditUndo, oiStdActEditUndoHeadLine, oiStdActEditUndoShortCut, oiStdActEditUndoShortHint); - fActStdProperty.Add(TEditDelete, oiStdActEditDeleteHeadLine, oiStdActEditDeleteShortCut, oiStdActEditDeleteShortHint); + FActStdProperty.Add(TEditCut, oiStdActEditCutHeadLine, oiStdActEditCutShortCut, oiStdActEditCutShortHint); + FActStdProperty.Add(TEditCopy, oiStdActEditCopyHeadLine, oiStdActEditCopyShortCut, oiStdActEditCopyShortHint); + FActStdProperty.Add(TEditPaste, oiStdActEditPasteHeadLine, oiStdActEditPasteShortCut, oiStdActEditPasteShortHint); + FActStdProperty.Add(TEditSelectAll, oiStdActEditSelectAllHeadLine, oiStdActEditSelectAllShortCut, oiStdActEditSelectAllShortHint); + FActStdProperty.Add(TEditUndo, oiStdActEditUndoHeadLine, oiStdActEditUndoShortCut, oiStdActEditUndoShortHint); + FActStdProperty.Add(TEditDelete, oiStdActEditDeleteHeadLine, oiStdActEditDeleteShortCut, oiStdActEditDeleteShortHint); - fActStdProperty.Add(TSearchFind, oiStdActSearchFindHeadLine, oiStdActSearchFindShortCut, ''); - fActStdProperty.Add(TSearchFindFirst, oiStdActSearchFindFirstHeadLine, '', ''); - fActStdProperty.Add(TSearchFindNext, oiStdActSearchFindNextHeadLine, oiStdActSearchFindNextShortCut, ''); - fActStdProperty.Add(TSearchReplace, oiStdActSearchReplaceHeadLine, '', ''); + FActStdProperty.Add(TSearchFind, oiStdActSearchFindHeadLine, oiStdActSearchFindShortCut, ''); + FActStdProperty.Add(TSearchFindFirst, oiStdActSearchFindFirstHeadLine, '', ''); + FActStdProperty.Add(TSearchFindNext, oiStdActSearchFindNextHeadLine, oiStdActSearchFindNextShortCut, ''); + FActStdProperty.Add(TSearchReplace, oiStdActSearchReplaceHeadLine, '', ''); - fActStdProperty.Add(THelpContents, oiStdActHelpContentsHeadLine, '', oiStdActHelpContentsHint); - fActStdProperty.Add(THelpTopicSearch, oiStdActHelpTopicSearchHeadLine, '', oiStdActHelpTopicSearchHint); - fActStdProperty.Add(THelpOnHelp, oiStdActHelpHelpHelpHeadLine, '', oiStdActHelpHelpHelpHint); + FActStdProperty.Add(THelpContents, oiStdActHelpContentsHeadLine, '', oiStdActHelpContentsHint); + FActStdProperty.Add(THelpTopicSearch, oiStdActHelpTopicSearchHeadLine, '', oiStdActHelpTopicSearchHint); + FActStdProperty.Add(THelpOnHelp, oiStdActHelpHelpHelpHeadLine, '', oiStdActHelpHelpHelpHint); - fActStdProperty.Add(TFileOpen, oiStdActFileOpenHeadLine, oiStdActFileOpenShortCut, oiStdActFileOpenHint); - fActStdProperty.Add(TFileOpenWith, oiStdActFileOpenWithHeadLine, '', oiStdActFileOpenHint); - fActStdProperty.Add(TFileSaveAs, oiStdActFileSaveAsHeadLine, '', oiStdActFileSaveAsHint); - fActStdProperty.Add(TFileExit, oiStdActFileExitHeadLine, '', oiStdActFileExitHint); + FActStdProperty.Add(TFileOpen, oiStdActFileOpenHeadLine, oiStdActFileOpenShortCut, oiStdActFileOpenHint); + FActStdProperty.Add(TFileOpenWith, oiStdActFileOpenWithHeadLine, '', oiStdActFileOpenHint); + FActStdProperty.Add(TFileSaveAs, oiStdActFileSaveAsHeadLine, '', oiStdActFileSaveAsHint); + FActStdProperty.Add(TFileExit, oiStdActFileExitHeadLine, '', oiStdActFileExitHint); - fActStdProperty.Add(TColorSelect, oiStdActColorSelect1HeadLine, '', oiStdActColorSelectHint); - fActStdProperty.Add(TFontEdit, oiStdActFontEditHeadLine, '', oiStdActFontEditHint); + FActStdProperty.Add(TColorSelect, oiStdActColorSelect1HeadLine, '', oiStdActColorSelectHint); + FActStdProperty.Add(TFontEdit, oiStdActFontEditHeadLine, '', oiStdActFontEditHint); - fActStdProperty.Add(TDataSetFirst, oiStdActDataSetFirstHeadLine, '', oiStdActDataSetFirstHint); - fActStdProperty.Add(TDataSetPrior, oiStdActDataSetPriorHeadLine, '', oiStdActDataSetPriorHint); - fActStdProperty.Add(TDataSetNext, oiStdActDataSetNextHeadLine, '', oiStdActDataSetNextHint); - fActStdProperty.Add(TDataSetLast, oiStdActDataSetLastHeadLine, '', oiStdActDataSetLastHint); - fActStdProperty.Add(TDataSetInsert, oiStdActDataSetInsertHeadLine, '', oiStdActDataSetInsertHint); - fActStdProperty.Add(TDataSetDelete, oiStdActDataSetDeleteHeadLine, '', oiStdActDataSetDeleteHint); - fActStdProperty.Add(TDataSetEdit, oiStdActDataSetEditHeadLine, '', oiStdActDataSetEditHint); - fActStdProperty.Add(TDataSetPost, oiStdActDataSetPostHeadLine, '', oiStdActDataSetPostHint); - fActStdProperty.Add(TDataSetCancel, oiStdActDataSetCancelHeadLine, '', oiStdActDataSetCancel1Hint); - fActStdProperty.Add(TDataSetRefresh, oiStdActDataSetRefreshHeadLine, '', oiStdActDataSetRefreshHint); + FActStdProperty.Add(TDataSetFirst, oiStdActDataSetFirstHeadLine, '', oiStdActDataSetFirstHint); + FActStdProperty.Add(TDataSetPrior, oiStdActDataSetPriorHeadLine, '', oiStdActDataSetPriorHint); + FActStdProperty.Add(TDataSetNext, oiStdActDataSetNextHeadLine, '', oiStdActDataSetNextHint); + FActStdProperty.Add(TDataSetLast, oiStdActDataSetLastHeadLine, '', oiStdActDataSetLastHint); + FActStdProperty.Add(TDataSetInsert, oiStdActDataSetInsertHeadLine, '', oiStdActDataSetInsertHint); + FActStdProperty.Add(TDataSetDelete, oiStdActDataSetDeleteHeadLine, '', oiStdActDataSetDeleteHint); + FActStdProperty.Add(TDataSetEdit, oiStdActDataSetEditHeadLine, '', oiStdActDataSetEditHint); + FActStdProperty.Add(TDataSetPost, oiStdActDataSetPostHeadLine, '', oiStdActDataSetPostHint); + FActStdProperty.Add(TDataSetCancel, oiStdActDataSetCancelHeadLine, '', oiStdActDataSetCancel1Hint); + FActStdProperty.Add(TDataSetRefresh, oiStdActDataSetRefreshHeadLine, '', oiStdActDataSetRefreshHint); end; constructor TFormActStandard.Create(AOwner: TComponent); @@ -186,21 +180,22 @@ begin FResultActionProc := ResultActProc; Caption := OisStdActionListEditor; LabelHeadLine.Caption := oisStdActionListEditorClass; + BtnPanel.OKButton.OnClick := @btnOKClick; EnumAct; - fActStdProperty := TActStdProp.Create; + FActStdProperty := TActStdProp.Create; AddStdActProperties; end; destructor TFormActStandard.Destroy; begin - fActStdProperty.Free; + FActStdProperty.Free; inherited Destroy; end; procedure CreateFormActStandard(AOwner: TComponent; ResultActProc: TResultActProc; out Form: TForm); begin - Form:=TFormActStandard.CreateEx(AOwner,ResultActProc); + Form := TFormActStandard.CreateEx(AOwner, ResultActProc); end; initialization