made actions editor translatable from Pawel

git-svn-id: trunk@6961 -
This commit is contained in:
mattias 2005-03-16 11:59:50 +00:00
parent 2d3286e8c2
commit e94b4e2fe9
8 changed files with 522 additions and 328 deletions

View File

@ -3,8 +3,10 @@ object ActionListEditor: TActionListEditor
ClientHeight = 300
ClientWidth = 400
KeyPreview = True
OnClose = ActionListEditorClose
OnKeyDown = ActionListEditorKeyDown
OnKeyPress = ActionListEditorKeyPress
PixelsPerInch = 112
PixelsPerInch = 120
Position = poScreenCenter
HorzScrollBar.Page = 399
VertScrollBar.Page = 299
@ -12,13 +14,14 @@ object ActionListEditor: TActionListEditor
Height = 300
Top = 159
Width = 400
object Panel2: TPanel
object PanelDescr: TPanel
Align = alTop
BorderSpacing.OnChange = nil
BevelOuter = bvNone
ClientHeight = 26
ClientWidth = 400
FullRepaint = False
PopupMenu = PopMenuActions
TabOrder = 1
Height = 26
Top = 26
@ -55,7 +58,7 @@ object ActionListEditor: TActionListEditor
Top = 52
Width = 5
end
object Panel1: TPanel
object PanelToolbar: TPanel
Align = alTop
BorderSpacing.OnChange = nil
BevelInner = bvRaised
@ -74,7 +77,9 @@ object ActionListEditor: TActionListEditor
Spacing = 0
ShowHint = True
ParentShowHint = False
Left = 1
Height = 22
Top = 2
Width = 24
end
object btnDelete: TSpeedButton
@ -147,7 +152,6 @@ object ActionListEditor: TActionListEditor
OnMouseDown = lstActionNameMouseDown
PopupMenu = PopMenuActions
TabOrder = 2
TopIndex = -1
Left = 157
Height = 248
Top = 52
@ -159,13 +163,13 @@ object ActionListEditor: TActionListEditor
ExtendedSelect = True
OnClick = lstCategoryClick
OnMouseDown = lstActionNameMouseDown
PopupMenu = PopMenuActions
TabOrder = 3
TopIndex = -1
Height = 248
Top = 52
Width = 152
end
object ActionList1: TActionList
object ActionListSelf: TActionList
top = 240
object ActDelete: TAction
OnExecute = ActDeleteExecute
@ -195,28 +199,23 @@ object ActionListEditor: TActionListEditor
ShortCut = 16424
Category = 'MoveUpDown'
end
object ActCreateExecuteEvent: TAction
Caption = 'OnExecute'
OnExecute = ActCreateExecuteEventExecute
OnUpdate = ActCreateExecuteUpdate
Category = 'CreateEvents'
object ActPanelDescr: TAction
AutoCheck = True
Caption = 'ActPanelDescr'
Checked = True
OnExecute = ActPanelDescrExecute
Category = 'Panels'
end
object ActCreateHintEvent: TAction
Caption = 'OnHint'
OnExecute = ActCreateHintExecute
OnUpdate = ActCreateExecuteUpdate
Category = 'CreateEvents'
end
object ActCreateUpdateEvent: TAction
Caption = 'OnUpdate'
OnExecute = ActCreateUpdateExecute
OnUpdate = ActCreateExecuteUpdate
Category = 'CreateEvents'
object ActPanelToolBar: TAction
AutoCheck = True
Caption = 'ActPanelToolBar'
Checked = True
OnExecute = ActPanelToolBarExecute
Category = 'Panels'
end
end
object PopMenuActions: TPopupMenu
OnPopup = PopMenuActionsPopup
left = 161
left = 160
top = 261
object mItemActListNewAction: TMenuItem
Action = ActNew
@ -227,30 +226,15 @@ object ActionListEditor: TActionListEditor
Action = ActNewStd
OnClick = ActNewStdExecute
end
object MenuItem3: TMenuItem
Caption = '-'
end
object mItemCreateOnExecuteEvent: TMenuItem
Action = ActCreateExecuteEvent
OnClick = ActCreateExecuteEventExecute
end
object mItemCreateOnHintEvent: TMenuItem
Action = ActCreateHintEvent
OnClick = ActCreateHintExecute
end
object mItemCreateOnUpdateEvent: TMenuItem
Action = ActCreateUpdateEvent
OnClick = ActCreateUpdateExecute
end
object MenuItem8: TMenuItem
Caption = '-'
end
object MenuItem4: TMenuItem
object mItemActListMoveUpAction: TMenuItem
Action = ActMoveUp
Caption = 'Move Up'
OnClick = ActMoveDownExecute
end
object MenuItem5: TMenuItem
object mItemActListMoveDownAction: TMenuItem
Action = ActMoveDown
Caption = 'Move Down'
OnClick = ActMoveDownExecute
@ -263,6 +247,19 @@ object ActionListEditor: TActionListEditor
Caption = 'Delete'
OnClick = ActDeleteExecute
end
object MenuItem1: TMenuItem
Caption = '-'
end
object mItemActListPanelDescr: TMenuItem
Action = ActPanelDescr
AutoCheck = True
OnClick = ActPanelDescrExecute
end
object MenuItem2: TMenuItem
Action = ActPanelToolBar
AutoCheck = True
OnClick = ActPanelToolBarExecute
end
end
object PopMenuToolBarActions: TPopupMenu
top = 200

View File

@ -2,26 +2,28 @@
LazarusResources.Add('TActionListEditor','FORMDATA',[
'TPF0'#17'TActionListEditor'#16'ActionListEditor'#7'Caption'#6#16'ActionListE'
+'ditor'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#10'KeyPreview'#9#10
+'OnKeyPress'#7#24'ActionListEditorKeyPress'#13'PixelsPerInch'#2'p'#8'Positio'
+'n'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3#143#1#18'VertScrollBar.Pag'
+'e'#3'+'#1#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'#3#159#0#5'Width'#3#144#1#0
+#6'TPanel'#6'Panel2'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'#13#10'Be'
+'velOuter'#7#6'bvNone'#12'ClientHeight'#2#26#11'ClientWidth'#3#144#1#11'Full'
+'Repaint'#8#8'TabOrder'#2#1#6'Height'#2#26#3'Top'#2#26#5'Width'#3#144#1#0#6
+'TLabel'#11'lblCategory'#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#7'Capti'
+'on'#6#11'Categories:'#5'Color'#7#6'clNone'#4'Left'#2#6#6'Height'#2#17#3'Top'
+#2#6#5'Width'#2'E'#0#0#6'TLabel'#7'lblName'#8'AutoSize'#9#22'BorderSpacing.O'
+'nChange'#13#7'Caption'#6#8'Actions:'#5'Color'#7#6'clNone'#4'Left'#3#162#0#6
+'Height'#2#17#3'Top'#2#6#5'Width'#2'1'#0#0#0#9'TSplitter'#8'Splitter'#8'Auto'
+'Snap'#8#6'Height'#3#248#0#11'ParentColor'#9#11'OnCanResize'#7#17'SplitterCa'
+'nResize'#6'Cursor'#7#8'crHSplit'#4'Left'#3#152#0#6'Height'#3#248#0#3'Top'#2
+'4'#5'Width'#2#5#0#0#6'TPanel'#6'Panel1'#5'Align'#7#5'alTop'#22'BorderSpacin'
+'g.OnChange'#13#10'BevelInner'#7#8'bvRaised'#10'BevelOuter'#7#9'bvLowered'#12
+'ClientHeight'#2#26#11'ClientWidth'#3#144#1#11'FullRepaint'#8#8'TabOrder'#2#0
+#6'Height'#2#26#5'Width'#3#144#1#0#12'TSpeedButton'#6'btnAdd'#6'Action'#7#6
+'ActNew'#22'BorderSpacing.OnChange'#13#4'Flat'#9#9'NumGlyphs'#2#0#7'Spacing'
+#2#0#8'ShowHint'#9#14'ParentShowHint'#8#6'Height'#2#22#5'Width'#2#24#0#0#12
+'ditor'#12'ClientHeight'#3','#1#11'ClientWidth'#3#144#1#10'KeyPreview'#9#7'O'
+'nClose'#7#21'ActionListEditorClose'#9'OnKeyDown'#7#23'ActionListEditorKeyDo'
+'wn'#10'OnKeyPress'#7#24'ActionListEditorKeyPress'#13'PixelsPerInch'#2'x'#8
+'Position'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3#143#1#18'VertScroll'
+'Bar.Page'#3'+'#1#4'Left'#3'"'#1#6'Height'#3','#1#3'Top'#3#159#0#5'Width'#3
+#144#1#0#6'TPanel'#10'PanelDescr'#5'Align'#7#5'alTop'#22'BorderSpacing.OnCha'
+'nge'#13#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2#26#11'ClientWidth'#3
+#144#1#11'FullRepaint'#8#9'PopupMenu'#7#14'PopMenuActions'#8'TabOrder'#2#1#6
+'Height'#2#26#3'Top'#2#26#5'Width'#3#144#1#0#6'TLabel'#11'lblCategory'#8'Aut'
+'oSize'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#11'Categories:'#5'Color'
+#7#6'clNone'#4'Left'#2#6#6'Height'#2#17#3'Top'#2#6#5'Width'#2'E'#0#0#6'TLabe'
+'l'#7'lblName'#8'AutoSize'#9#22'BorderSpacing.OnChange'#13#7'Caption'#6#8'Ac'
+'tions:'#5'Color'#7#6'clNone'#4'Left'#3#162#0#6'Height'#2#17#3'Top'#2#6#5'Wi'
+'dth'#2'1'#0#0#0#9'TSplitter'#8'Splitter'#8'AutoSnap'#8#6'Height'#3#248#0#11
+'ParentColor'#9#11'OnCanResize'#7#17'SplitterCanResize'#6'Cursor'#7#8'crHSpl'
+'it'#4'Left'#3#152#0#6'Height'#3#248#0#3'Top'#2'4'#5'Width'#2#5#0#0#6'TPanel'
+#12'PanelToolbar'#5'Align'#7#5'alTop'#22'BorderSpacing.OnChange'#13#10'Bevel'
+'Inner'#7#8'bvRaised'#10'BevelOuter'#7#9'bvLowered'#12'ClientHeight'#2#26#11
+'ClientWidth'#3#144#1#11'FullRepaint'#8#8'TabOrder'#2#0#6'Height'#2#26#5'Wid'
+'th'#3#144#1#0#12'TSpeedButton'#6'btnAdd'#6'Action'#7#6'ActNew'#22'BorderSpa'
+'cing.OnChange'#13#4'Flat'#9#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowHint'#9#14
+'ParentShowHint'#8#4'Left'#2#1#6'Height'#2#22#3'Top'#2#2#5'Width'#2#24#0#0#12
+'TSpeedButton'#9'btnDelete'#6'Action'#7#9'ActDelete'#22'BorderSpacing.OnChan'
+'ge'#13#4'Flat'#9#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowHint'#9#14'ParentSho'
+'wHint'#8#4'Left'#2'#'#6'Height'#2#22#3'Top'#2#2#5'Width'#2#24#0#0#12'TSpeed'
@ -40,46 +42,41 @@ LazarusResources.Add('TActionListEditor','FORMDATA',[
+#8'alClient'#22'BorderSpacing.OnChange'#13#14'ExtendedSelect'#9#7'OnClick'#7
+#18'lstActionNameClick'#10'OnDblClick'#7#21'lstActionNameDblClick'#9'OnKeyDo'
+'wn'#7#20'lstActionNameKeyDown'#11'OnMouseDown'#7#22'lstActionNameMouseDown'
+#9'PopupMenu'#7#14'PopMenuActions'#8'TabOrder'#2#2#8'TopIndex'#2#255#4'Left'
+#3#157#0#6'Height'#3#248#0#3'Top'#2'4'#5'Width'#3#243#0#0#0#8'TListBox'#11'l'
+'stCategory'#5'Align'#7#6'alLeft'#22'BorderSpacing.OnChange'#13#14'ExtendedS'
+'elect'#9#7'OnClick'#7#16'lstCategoryClick'#11'OnMouseDown'#7#22'lstActionNa'
+'meMouseDown'#8'TabOrder'#2#3#8'TopIndex'#2#255#6'Height'#3#248#0#3'Top'#2'4'
+#5'Width'#3#152#0#0#0#11'TActionList'#11'ActionList1'#3'top'#3#240#0#0#7'TAc'
+'tion'#9'ActDelete'#9'OnExecute'#7#16'ActDeleteExecute'#8'OnUpdate'#7#15'Act'
+'DeleteUpdate'#8'ShortCut'#2'.'#8'Category'#6#9'AddDelete'#0#0#7'TAction'#6
+#9'PopupMenu'#7#14'PopMenuActions'#8'TabOrder'#2#2#4'Left'#3#157#0#6'Height'
+#3#248#0#3'Top'#2'4'#5'Width'#3#243#0#0#0#8'TListBox'#11'lstCategory'#5'Alig'
+'n'#7#6'alLeft'#22'BorderSpacing.OnChange'#13#14'ExtendedSelect'#9#7'OnClick'
+#7#16'lstCategoryClick'#11'OnMouseDown'#7#22'lstActionNameMouseDown'#9'Popup'
+'Menu'#7#14'PopMenuActions'#8'TabOrder'#2#3#6'Height'#3#248#0#3'Top'#2'4'#5
+'Width'#3#152#0#0#0#11'TActionList'#14'ActionListSelf'#3'top'#3#240#0#0#7'TA'
+'ction'#9'ActDelete'#9'OnExecute'#7#16'ActDeleteExecute'#8'OnUpdate'#7#15'Ac'
+'tDeleteUpdate'#8'ShortCut'#2'.'#8'Category'#6#9'AddDelete'#0#0#7'TAction'#6
+'ActNew'#9'OnExecute'#7#13'ActNewExecute'#8'ShortCut'#2'-'#8'Category'#6#9'A'
+'ddDelete'#0#0#7'TAction'#9'ActNewStd'#9'OnExecute'#7#16'ActNewStdExecute'#8
+'ShortCut'#3'-@'#8'Category'#6#9'AddDelete'#0#0#7'TAction'#9'ActMoveUp'#9'On'
+'Execute'#7#18'ActMoveDownExecute'#8'OnUpdate'#7#15'ActMoveUpUpdate'#8'Short'
+'Cut'#3'&@'#8'Category'#6#10'MoveUpDown'#0#0#7'TAction'#11'ActMoveDown'#9'On'
+'Execute'#7#18'ActMoveDownExecute'#8'OnUpdate'#7#17'ActMoveDownUpdate'#8'Sho'
+'rtCut'#3'(@'#8'Category'#6#10'MoveUpDown'#0#0#7'TAction'#21'ActCreateExecut'
+'eEvent'#7'Caption'#6#9'OnExecute'#9'OnExecute'#7#28'ActCreateExecuteEventEx'
+'ecute'#8'OnUpdate'#7#22'ActCreateExecuteUpdate'#8'Category'#6#12'CreateEven'
+'ts'#0#0#7'TAction'#18'ActCreateHintEvent'#7'Caption'#6#6'OnHint'#9'OnExecut'
+'e'#7#20'ActCreateHintExecute'#8'OnUpdate'#7#22'ActCreateExecuteUpdate'#8'Ca'
+'tegory'#6#12'CreateEvents'#0#0#7'TAction'#20'ActCreateUpdateEvent'#7'Captio'
+'n'#6#8'OnUpdate'#9'OnExecute'#7#22'ActCreateUpdateExecute'#8'OnUpdate'#7#22
+'ActCreateExecuteUpdate'#8'Category'#6#12'CreateEvents'#0#0#0#10'TPopupMenu'
+#14'PopMenuActions'#7'OnPopup'#7#19'PopMenuActionsPopup'#4'left'#3#161#0#3't'
+'op'#3#5#1#0#9'TMenuItem'#21'mItemActListNewAction'#6'Action'#7#6'ActNew'#7
+'Caption'#6#10'New Action'#7'OnClick'#7#13'ActNewExecute'#0#0#9'TMenuItem'#24
,'mItemActListNewStdAction'#6'Action'#7#9'ActNewStd'#7'OnClick'#7#16'ActNewSt'
+'dExecute'#0#0#9'TMenuItem'#9'MenuItem3'#7'Caption'#6#1'-'#0#0#9'TMenuItem'
+#25'mItemCreateOnExecuteEvent'#6'Action'#7#21'ActCreateExecuteEvent'#7'OnCli'
+'ck'#7#28'ActCreateExecuteEventExecute'#0#0#9'TMenuItem'#22'mItemCreateOnHin'
+'tEvent'#6'Action'#7#18'ActCreateHintEvent'#7'OnClick'#7#20'ActCreateHintExe'
+'cute'#0#0#9'TMenuItem'#24'mItemCreateOnUpdateEvent'#6'Action'#7#20'ActCreat'
+'eUpdateEvent'#7'OnClick'#7#22'ActCreateUpdateExecute'#0#0#9'TMenuItem'#9'Me'
+'nuItem8'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#9'MenuItem4'#6'Action'#7#9'ActM'
+'oveUp'#7'Caption'#6#7'Move Up'#7'OnClick'#7#18'ActMoveDownExecute'#0#0#9'TM'
+'enuItem'#9'MenuItem5'#6'Action'#7#11'ActMoveDown'#7'Caption'#6#9'Move Down'
+#7'OnClick'#7#18'ActMoveDownExecute'#0#0#9'TMenuItem'#9'MenuItem6'#7'Caption'
+#6#1'-'#0#0#9'TMenuItem'#21'mItemActListDelAction'#6'Action'#7#9'ActDelete'#7
+'Caption'#6#6'Delete'#7'OnClick'#7#16'ActDeleteExecute'#0#0#0#10'TPopupMenu'
+#21'PopMenuToolBarActions'#3'top'#3#200#0#0#9'TMenuItem'#21'mItemToolBarNewA'
+'ction'#6'Action'#7#6'ActNew'#7'Default'#9#7'OnClick'#7#13'ActNewExecute'#0#0
+#9'TMenuItem'#24'mItemToolBarNewStdAction'#6'Action'#7#9'ActNewStd'#7'OnClic'
+'k'#7#16'ActNewStdExecute'#0#0#0#0
+'rtCut'#3'(@'#8'Category'#6#10'MoveUpDown'#0#0#7'TAction'#13'ActPanelDescr'#9
+'AutoCheck'#9#7'Caption'#6#13'ActPanelDescr'#7'Checked'#9#9'OnExecute'#7#20
+'ActPanelDescrExecute'#8'Category'#6#6'Panels'#0#0#7'TAction'#15'ActPanelToo'
+'lBar'#9'AutoCheck'#9#7'Caption'#6#15'ActPanelToolBar'#7'Checked'#9#9'OnExec'
+'ute'#7#22'ActPanelToolBarExecute'#8'Category'#6#6'Panels'#0#0#0#10'TPopupMe'
+'nu'#14'PopMenuActions'#4'left'#3#160#0#3'top'#3#5#1#0#9'TMenuItem'#21'mItem'
+'ActListNewAction'#6'Action'#7#6'ActNew'#7'Caption'#6#10'New Action'#7'OnCli'
+'ck'#7#13'ActNewExecute'#0#0#9'TMenuItem'#24'mItemActListNewStdAction'#6'Act'
+'ion'#7#9'ActNewStd'#7'OnClick'#7#16'ActNewStdExecute'#0#0#9'TMenuItem'#9'Me'
,'nuItem8'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#24'mItemActListMoveUpAction'#6
+'Action'#7#9'ActMoveUp'#7'Caption'#6#7'Move Up'#7'OnClick'#7#18'ActMoveDownE'
+'xecute'#0#0#9'TMenuItem'#26'mItemActListMoveDownAction'#6'Action'#7#11'ActM'
+'oveDown'#7'Caption'#6#9'Move Down'#7'OnClick'#7#18'ActMoveDownExecute'#0#0#9
+'TMenuItem'#9'MenuItem6'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#21'mItemActListD'
+'elAction'#6'Action'#7#9'ActDelete'#7'Caption'#6#6'Delete'#7'OnClick'#7#16'A'
+'ctDeleteExecute'#0#0#9'TMenuItem'#9'MenuItem1'#7'Caption'#6#1'-'#0#0#9'TMen'
+'uItem'#22'mItemActListPanelDescr'#6'Action'#7#13'ActPanelDescr'#9'AutoCheck'
+#9#7'OnClick'#7#20'ActPanelDescrExecute'#0#0#9'TMenuItem'#9'MenuItem2'#6'Act'
+'ion'#7#15'ActPanelToolBar'#9'AutoCheck'#9#7'OnClick'#7#22'ActPanelToolBarEx'
+'ecute'#0#0#0#10'TPopupMenu'#21'PopMenuToolBarActions'#3'top'#3#200#0#0#9'TM'
+'enuItem'#21'mItemToolBarNewAction'#6'Action'#7#6'ActNew'#7'Default'#9#7'OnC'
+'lick'#7#13'ActNewExecute'#0#0#9'TMenuItem'#24'mItemToolBarNewStdAction'#6'A'
+'ction'#7#9'ActNewStd'#7'OnClick'#7#16'ActNewStdExecute'#0#0#0#0
]);

View File

@ -27,15 +27,17 @@
0.3 - 27.3.2004 - rename action > actualise editor
0.4 - 29.3.2004 - dblclick generate xxx.OnExecute code to editor
0.5 - 10.03.2005 - New design
0.6 - 14.03.2005 - multilanguage support
TODO:- multiselect for the actions and categories
- drag & drop for the actions and categories
- standard icon for "Standard Action"
- sometimes click in listbox causes selecting last item
(it's an strange gtk error. The LCL and the gtk intf do not send any
change to the gtk. Either it is a bug in the gtk1 or we are doing
something wrong in the handlers.)
}
unit ActionsEditor;
unit actionseditor;
{$mode objfpc}{$H+}
@ -45,42 +47,41 @@ uses
Classes, SysUtils, LResources, LCLProc, Forms, Controls, Dialogs,
ActnList, ExtCtrls, ComCtrls, Buttons, StdCtrls, ObjInspStrConsts,
ComponentEditors, PropEdits, DBActns, StdActns, LCLIntf, LCLType,
Graphics, GraphType, Menus;
Graphics, Menus, actionseditorstd;
type
TActionListComponentEditor = class;
{ TActionListEditor }
TActionListEditor = class(TForm)
ActDelete: TAction;
ActCreateExecuteEvent: TAction;
ActCreateHintEvent: TAction;
ActCreateUpdateEvent: TAction;
Action1: TAction;
ActPanelToolBar: TAction;
ActPanelDescr: TAction;
ActMoveUp: TAction;
ActMoveDown: TAction;
ActNewStd: TAction;
ActionList1: TActionList;
ActionListSelf: TActionList;
ActNew: TAction;
lblCategory: TLabel;
lblName: TLabel;
lstCategory: TListBox;
lstActionName: TListBox;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
mItemActListPanelDescr: TMenuItem;
mItemToolBarNewStdAction: TMenuItem;
mItemToolBarNewAction: TMenuItem;
mItemActListNewAction: TMenuItem;
mItemCreateOnExecuteEvent: TMenuItem;
mItemCreateOnHintEvent: TMenuItem;
mItemCreateOnUpdateEvent: TMenuItem;
mItemActListNewStdAction: TMenuItem;
MenuItem3: TMenuItem;
MenuItem4: TMenuItem;
MenuItem5: TMenuItem;
mItemActListMoveUpAction: TMenuItem;
mItemActListMoveDownAction: TMenuItem;
MenuItem6: TMenuItem;
mItemActListDelAction: TMenuItem;
MenuItem8: TMenuItem;
Panel1: TPanel;
Panel2: TPanel;
PanelToolbar: TPanel;
PanelDescr: TPanel;
btnAdd: TSpeedButton;
btnDelete: TSpeedButton;
btnUp: TSpeedButton;
@ -89,10 +90,6 @@ type
PopMenuToolBarActions: TPopupMenu;
SBShowMenuNewActions: TSpeedButton;
Splitter: TSplitter;
procedure ActCreateExecuteEventExecute(Sender: TObject);
procedure ActCreateExecuteUpdate(Sender: TObject);
procedure ActCreateHintExecute(Sender: TObject);
procedure ActCreateUpdateExecute(Sender: TObject);
procedure ActDeleteExecute(Sender: TObject);
procedure ActDeleteUpdate(Sender: TObject);
procedure ActMoveDownExecute(Sender: TObject);
@ -100,8 +97,13 @@ type
procedure ActMoveUpUpdate(Sender: TObject);
procedure ActNewExecute(Sender: TObject);
procedure ActNewStdExecute(Sender: TObject);
procedure ActPanelDescrExecute(Sender: TObject);
procedure ActPanelToolBarExecute(Sender: TObject);
procedure ActionListEditorClose(Sender: TObject;
var CloseAction: TCloseAction);
procedure ActionListEditorKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure ActionListEditorKeyPress(Sender: TObject; var Key: char);
procedure PopMenuActionsPopup(Sender: TObject);
procedure SBShowMenuNewActionsClick(Sender: TObject);
procedure SplitterCanResize(Sender: TObject; var NewSize: Integer;
var Accept: Boolean);
@ -121,8 +123,8 @@ type
{ private declarations }
FActionList: TActionList;
FDesigner: TComponentEditorDesigner;
procedure ResultStdActProc(const Category: string;
ActionClass: TBasicActionClass; LastItem: Boolean);
FComponentEditor: TActionListComponentEditor;
procedure ResultStdActProc(const Category: string; ActionClass: TBasicActionClass; ActionProperty: TActStdPropItem; LastItem: Boolean);
public
{ public declarations }
constructor Create(AOwner: TComponent); override;
@ -131,6 +133,7 @@ type
procedure FillCategories;
procedure FillActionByCategory(iIndex: Integer);
property Designer:TComponentEditorDesigner read FDesigner write FDesigner;
property ComponentEditor: TActionListComponentEditor write FComponentEditor;
end;
{ TActionListComponentEditor }
@ -139,6 +142,8 @@ type
private
FActionList: TActionList;
FDesigner: TComponentEditorDesigner;
FActionListEditorForm: TActionListEditor;
fWindowClosed: Boolean;
protected
public
constructor Create(AComponent: TComponent;
@ -149,6 +154,7 @@ type
function GetVerbCount: Integer; override;
function GetVerb(Index: Integer): string; override;
procedure ExecuteVerb(Index: Integer); override;
procedure EditorWindowClose;
end;
{ Action Registration }
@ -198,19 +204,13 @@ type
function Count: Integer;
property Items[Index: Integer]: TRegisteredActionCategory read GetItems;
end;
TNotifyActionListChange = procedure;
var
RegisteredActions: TRegisteredActionCategories;
type
TNotifyActionListChange = procedure;
var
NotifyActionListChange: TNotifyActionListChange;
var
ActionListEditorForm: TActionListEditor;
type
PCharArray = Array[0..16+5] of PChar;
var
@ -239,7 +239,7 @@ var
'.....#aaa#......',
'.....#####......',
'................');
cImg_Delete: PCharArray =
('16 16 5 1',
'. c None',
@ -343,14 +343,9 @@ procedure UnRegisterActions(const Classes: array of TBasicActionClass);
procedure EnumActions(Proc: TEnumActionProc; Info: Pointer);
function CreateAction(TheOwner: TComponent;
ActionClass: TBasicActionClass): TBasicAction;
procedure ShowActionListEditor(AActionList: TActionList;
ADesigner: TComponentEditorDesigner);
implementation
uses actionseditorstd;
procedure RegisterActions(const ACategory: string;
const AClasses: array of TBasicActionClass; AResource: TComponentClass);
begin
@ -380,34 +375,41 @@ var
begin
Result := ActionClass.Create(TheOwner);
// find a Resource component registered for this ActionClass
ResourceClass:=RegisteredActions.FindResource(ActionClass);
if ResourceClass=nil then exit;
ResInstance:=ResourceClass.Create(nil);
ResourceClass := RegisteredActions.FindResource(ActionClass);
if ResourceClass = nil then Exit;
showmessage(TCustomAction(ResourceClass).Caption);
ResInstance := ResourceClass.Create(nil);
try
// find an action owned by the Resource component
Action:=nil;
for i:=0 to ResInstance.ComponentCount-1 do begin
Component:=ResInstance.Components[i];
if (CompareText(Component.ClassName,ActionClass.ClassName)=0)
and (Component is TBasicAction) then begin
Action:=TBasicAction(Component);
for i:= 0 to ResInstance.ComponentCount-1 do begin
Component := ResInstance.Components[i];
if (CompareText(Component.ClassName, ActionClass.ClassName)=0)
and (Component is TBasicAction) then begin
Action := TBasicAction(Component);
Break;
end;
end;
if Action=nil then exit;
if Action = nil then Exit;
// copy TCustomAction properties
if (Action is TCustomAction) and (Result is TCustomAction) then begin
Src:=TCustomAction(Action);
Dest:=TCustomAction(Result);
Src := TCustomAction(Action);
Dest := TCustomAction(Result);
Dest.AutoCheck := Src.AutoCheck;
Dest.Caption:=Src.Caption;
Dest.Category := Src.Category;
Dest.Checked:=Src.Checked;
Dest.Enabled:=Src.Enabled;
Dest.HelpContext:=Src.HelpContext;
Dest.HelpKeyword := Src.HelpKeyword;
Dest.HelpType := Src.HelpType;
Dest.Hint:=Src.Hint;
Dest.ImageIndex:=Src.ImageIndex;
Dest.SecondaryShortCuts := Src.SecondaryShortCuts;
Dest.ShortCut:=Src.ShortCut;
Dest.Visible:=Src.Visible;
// Src.AssignTo(Dest);
if (Dest is TContainedAction) and (Dest.ImageIndex>=0)
and (Src is TContainedAction) then begin
// ToDo: copy image
@ -419,21 +421,6 @@ begin
end;
end;
procedure ShowActionListEditor(AActionList: TActionList;
ADesigner:TComponentEditorDesigner);
begin
if AActionList = nil
then Raise Exception.Create('ShowActionListEditor AActionList=nil');
if ActionListEditorForm = nil
then ActionListEditorForm := TActionListEditor.Create(Application);
with ActionListEditorForm do begin
lstActionName.ItemIndex := -1;
Designer := ADesigner;
SetActionList(AActionList);
ShowOnTop;
end;
end;
{ TActionListEditor }
procedure TActionListEditor.OnComponentRenamed(AComponent: TComponent);
@ -447,6 +434,19 @@ procedure TActionListEditor.OnComponentSelection(const OnSetSelection: TPersiste
var
CurSelect: TContainedAction;
tmpCategory: String;
function CategoryIndexOf(Name: String): Integer;
var
i: Integer;
begin
for i:= lstCategory.Items.Count-1 downto 0 do begin
if lstCategory.Items[i] = Name
then Break;
end;
Result := i;
if (i = lstCategory.Items.IndexOf(cActionListEditorUnknownCategory))
and (i = lstCategory.Items.IndexOf(cActionListEditorAllCategory))
then Result := 0;
end;
begin
// TODO: multiselect
if Self.Visible
@ -455,15 +455,22 @@ begin
and (OnSetSelection.Items[0] is TContainedAction)
and (TContainedAction(OnSetSelection.Items[0]).ActionList = FActionList) then
begin
if not (GetSelectedAction <> OnSetSelection.Items[0])
if GetSelectedAction = OnSetSelection.Items[0]
then Exit;
CurSelect := TContainedAction(OnSetSelection.Items[0]);
CurSelect.Category := Trim(CurSelect.Category);
tmpCategory := CurSelect.Category;
if tmpCategory = '' then tmpCategory := cActionListEditorUnknownCategory;
if (tmpCategory <> '')
and (lstCategory.Items.IndexOf(tmpCategory) < 0)
then FillCategories;
if tmpCategory = ''
then tmpCategory := cActionListEditorUnknownCategory;
if (lstCategory.Items[lstCategory.ItemIndex] <> tmpCategory)
or ((lstCategory.Items[lstCategory.ItemIndex] = tmpCategory)
and (lstActionName.Items.IndexOf(CurSelect.Name) < 0)) then begin
lstCategory.ItemIndex := lstCategory.Items.IndexOf(tmpCategory);
if CurSelect.Category = ''
then lstCategory.ItemIndex := lstCategory.Items.IndexOf(tmpCategory)
else lstCategory.ItemIndex := CategoryIndexOf(CurSelect.Category);
lstCategory.Click;
end;
lstActionName.ItemIndex := lstActionName.Items.IndexOf(CurSelect.Name);
@ -482,7 +489,8 @@ procedure TActionListEditor.OnRefreshPropertyValues;
begin
Result := True;
for i:= lstCategory.Items.Count-1 downto 0 do begin
if lstCategory.Items[i] = cActionListEditorUnknownCategory
if (lstCategory.Items[i] = cActionListEditorUnknownCategory)
and (i = lstCategory.Items.IndexOf(cActionListEditorAllCategory))
then Break;
bool := False;
for j:= FActionList.ActionCount-1 downto 0 do begin
@ -503,13 +511,15 @@ procedure TActionListEditor.OnRefreshPropertyValues;
begin
Result := False;
for i:= lstCategory.Items.Count-1 downto 0 do begin
if lstCategory.Items[i] = cActionListEditorUnknownCategory
then Break;
if lstCategory.Items[i] = Category then begin
Result := True;
Break;
end;
end;
if (i >= 0)
and ((i = lstCategory.Items.IndexOf(cActionListEditorUnknownCategory))
or (i = lstCategory.Items.IndexOf(cActionListEditorAllCategory)))
then Result := False;
end;
var
ASelections: TPersistentSelectionList;
@ -523,9 +533,10 @@ begin
GlobalDesignHook.GetSelection(ASelections);
try
if (ASelections.Count > 0)
and (ASelections.Items[0] is TContainedAction {.ClassNameIs(TAction.ClassName})
and (ASelections.Items[0] is TContainedAction)
and (TContainedAction(ASelections.Items[0]).ActionList = FActionList) then begin
curSelect := TContainedAction(ASelections.Items[0]);
CurSelect.Category := Trim(CurSelect.Category);
oldSelCategory := lstCategory.Items[lstCategory.ItemIndex];
tmpCategory := CurSelect.Category;
@ -586,23 +597,30 @@ begin
end;
procedure TActionListEditor.ResultStdActProc(const Category: string;
ActionClass: TBasicActionClass; LastItem: Boolean);
ActionClass: TBasicActionClass; ActionProperty: TActStdPropItem;
LastItem: Boolean);
var
NewAction: TContainedAction;
begin
NewAction := ActionClass.Create(FActionList.Owner) as TContainedAction;
if NewAction.Category <> cActionListEditorUnknownCategory
// NewAction := CreateAction(FActionList.Owner, ActionClass) as TContainedAction;
if Category <> cActionListEditorUnknownCategory
then NewAction.Category := Category
else NewAction.Category := '';
NewAction.Name := FDesigner.CreateUniqueComponentName(NewAction.ClassName);
if lstCategory.Items.IndexOf(Category) < 0
then lstCategory.Items.Add(NewAction.Category);
if Assigned(ActionProperty) then begin
TCustomAction(NewAction).Caption := ActionProperty.ActionProperty.Caption;
TCustomAction(NewAction).ShortCut := ActionProperty.ActionProperty.ShortCut;
TCustomAction(NewAction).Hint := ActionProperty.ActionProperty.Hint;
end;
NewAction.ActionList := FActionList;
FDesigner.PropertyEditorHook.PersistentAdded(NewAction,True);
FDesigner.Modified;
FDesigner.SelectOnlyThisComponent(FActionList.ActionByName(NewAction.Name));
if LastItem
then FDesigner.SelectOnlyThisComponent(FActionList.ActionByName(NewAction.Name));
end;
procedure TActionListEditor.SplitterCanResize(Sender: TObject;
@ -617,13 +635,11 @@ begin
if (ssCtrl in Shift) then begin
case key of
VK_UP: if ActMoveUp.Enabled then begin
// ActMoveUp.ExecuteAction(ActMoveUp);
ActMoveUp.OnExecute(ActMoveUp);
Key := 0;
end;
VK_DOWN: if ActMoveDown.Enabled then begin
// ActMoveDown.ExecuteAction(ActMoveDown);
ActMoveDown.OnExecute(ActMoveDown);
Key := 0;
end;
@ -646,7 +662,6 @@ begin
end;
end;
procedure TActionListEditor.ActDeleteUpdate(Sender: TObject);
var
oldState: Boolean;
@ -672,8 +687,7 @@ end;
procedure TActionListEditor.ActMoveDownExecute(Sender: TObject);
var
fact0,fAct1,fAct2: TContainedAction;
fName: String;
fact0,fAct1: TContainedAction;
lboxIndex: Integer;
direction: Integer;
begin
@ -682,33 +696,14 @@ begin
else direction := 1;
lboxIndex := lstActionName.ItemIndex;
fAct0 := TAction.Create(Self);
try
fAct1 := GetSelectedAction;
fAct2 := FActionList.ActionByName(lstActionName.Items[lboxIndex+direction]);
fAct1.AssignTo(fAct0);
fName := fAct1.Name;
fAct1.Name := 'tN1';
fAct0.Name := fName;
fact0 := FActionList.ActionByName(lstActionName.Items[lboxIndex]);
fact1 := FActionList.ActionByName(lstActionName.Items[lboxIndex+direction]);
fact1.Index := fact0.Index;
fAct2.AssignTo(fAct1);
fName := fAct2.Name;
fAct2.Name := 'tN2';
fAct1.Name := fName;
fAct0.AssignTo(fAct2);
fName := fAct0.Name;
fAct0.Name := 'tN1';
fAct2.Name := fName;
finally
fAct0.Free;
end;
fName := lstActionName.Items[lboxIndex];
lstActionName.Items[lboxIndex] := lstActionName.Items[lboxIndex+direction];
lstActionName.Items[lboxIndex+direction] := fName;
lstActionName.ItemIndex := lstActionName.Items.IndexOf(fName);
FDesigner.SelectOnlyThisComponent(FActionList.ActionByName(fName));
lstActionName.Items.Move(lboxIndex, lboxIndex+direction);
lstActionName.ItemIndex := lboxIndex+direction;
FDesigner.Modified;
end;
procedure TActionListEditor.ActMoveDownUpdate(Sender: TObject);
@ -766,7 +761,6 @@ var
begin
NewAction := TAction.Create(FActionList.Owner);
NewAction.Name := FDesigner.CreateUniqueComponentName(NewAction.ClassName);
DebugLn(NewAction.Name);
if lstCategory.ItemIndex > 1 // ignore first two items (virtual categories)
then NewAction.Category := lstCategory.Items[lstCategory.ItemIndex]
@ -783,30 +777,38 @@ begin
TFormActStandard.CreateEx(Self, @ResultStdActProc).ShowModal;
end;
procedure TActionListEditor.ActPanelDescrExecute(Sender: TObject);
begin
PanelDescr.Visible := TAction(Sender).Checked;
end;
procedure TActionListEditor.ActPanelToolBarExecute(Sender: TObject);
begin
PanelToolBar.Visible := TAction(Sender).Checked;
end;
procedure TActionListEditor.ActionListEditorClose(Sender: TObject;
var CloseAction: TCloseAction);
begin
CloseAction := caFree;
end;
procedure TActionListEditor.ActionListEditorKeyDown(Sender: TObject;
var Key: Word; Shift: TShiftState);
var
MousePoint: TPoint;
begin
MousePoint := Self.ClientToScreen(Point(0,0));
if Key = VK_APPS
then PopMenuActions.PopUp(MousePoint.X, MousePoint.Y);
end;
procedure TActionListEditor.ActionListEditorKeyPress(Sender: TObject;
var Key: char);
begin
if Ord(Key) = VK_ESCAPE then Self.Close;
end;
procedure TActionListEditor.PopMenuActionsPopup(Sender: TObject);
var
CurAction: TContainedAction;
begin
ActCreateExecuteEvent.Caption := 'Create OnExecute Event';
ActCreateHintEvent.Caption := 'Create OnHint Event';
ActCreateUpdateEvent.Caption := 'Create OnUpdate Event';
CurAction := GetSelectedAction;
if Assigned(CurAction) then begin
if Assigned(CurAction.OnExecute)
then ActCreateExecuteEvent.Caption := 'Show OnExecute Event';
if Assigned(TAction(CurAction).OnHint)
then ActCreateHintEvent.Caption := 'Show OnHint Event';
if Assigned(CurAction.OnUpdate)
then ActCreateUpdateEvent.Caption := 'Show OnUpdate Event';
end;
end;
procedure TActionListEditor.SBShowMenuNewActionsClick(Sender: TObject);
var
MousePoint: TPoint;
@ -837,7 +839,6 @@ begin
iNameIndex := lstActionName.ItemIndex;
if iNameIndex < 0 then Exit;
OldName := lstActionName.Items[iNameIndex];
DebugLn('',OldName);
lstActionName.Items.Delete(iNameIndex);
OldAction := FActionList.ActionByName(OldName);
@ -876,41 +877,6 @@ begin
then FDesigner.SelectOnlyThisComponent(FActionList);
end;
procedure TActionListEditor.ActCreateExecuteUpdate(Sender: TObject);
begin
TAction(Sender).Enabled := (lstActionName.ItemIndex >= 0);
end;
procedure TActionListEditor.ActCreateExecuteEventExecute(Sender: TObject);
var
CurAction: TContainedAction;
begin
CurAction := GetSelectedAction;
if CurAction = nil then Exit;
// Add OnExecute for this action
CreateComponentEvent(CurAction,'OnExecute');
end;
procedure TActionListEditor.ActCreateHintExecute(Sender: TObject);
var
CurAction: TContainedAction;
begin
CurAction := GetSelectedAction;
if CurAction = nil then Exit;
// Add OnHint for this action
CreateComponentEvent(CurAction,'OnHint');
end;
procedure TActionListEditor.ActCreateUpdateExecute(Sender: TObject);
var
CurAction: TContainedAction;
begin
CurAction := GetSelectedAction;
if CurAction = nil then Exit;
// Add OnUpdate for this action
CreateComponentEvent(CurAction,'OnUpdate');
end;
procedure TActionListEditor.lstCategoryClick(Sender: TObject);
begin
if lstCategory.ItemIndex >= 0
@ -950,15 +916,20 @@ begin
lblCategory.Caption := oisCategory;
lblName.Caption := oisAction;
Splitter.MinSize := lblCategory.Left + lblCategory.Width;
ActNew.Hint := 'New Action';
ActNewStd.Hint := 'New Standard Action';
ActDelete.Hint := 'Delete Action';
ActMoveUp.Hint := 'Move Up';
ActMoveDown.Hint := 'Move Down';
SBShowMenuNewActions.Hint := ActNew.Hint;
mItemToolBarNewAction.Caption := ActNew.Hint;
mItemToolBarNewStdAction.Caption := ActNewStd.Hint;
mItemActListNewStdAction.Caption := ActNewStd.Hint;
ActNew.Hint := cActionListEditorNewAction;
ActNewStd.Hint := cActionListEditorNewStdAction;
ActDelete.Hint := cActionListEditorDeleteActionHint;
ActMoveUp.Hint := cActionListEditorMoveUpAction;
ActMoveDown.Hint := cActionListEditorMoveDownAction;
ActPanelDescr.Caption := cActionListEditorPanelDescrriptions;
ActPanelToolBar.Caption := cActionListEditorPanelToolBar;
SBShowMenuNewActions.Hint := cActionListEditorNewAction;
mItemToolBarNewAction.Caption := cActionListEditorNewAction;
mItemToolBarNewStdAction.Caption := cActionListEditorNewStdAction;
mItemActListNewStdAction.Caption := cActionListEditorNewStdAction;
mItemActListMoveDownAction.Caption := cActionListEditorMoveDownAction;
mItemActListMoveUpAction.Caption := cActionListEditorMoveUpAction;
mItemActListDelAction.Caption := cActionListEditorDeleteAction;
cImg_Add[3] := aColor;
bmp := TBitMap.Create;
@ -993,13 +964,17 @@ destructor TActionListEditor.Destroy;
begin
if Assigned(GlobalDesignHook)
then GlobalDesignHook.RemoveAllHandlersForObject(Self);
FComponentEditor.EditorWindowClose;
inherited Destroy;
end;
procedure TActionListEditor.SetActionList(AActionList: TActionList);
begin
FActionList := AActionList;
FillCategories;
if FActionList <> AActionList then begin
FActionList := AActionList;
FillCategories;
FillActionByCategory(-1);
end;
end;
procedure TActionListEditor.FillCategories;
@ -1020,9 +995,9 @@ begin
countCategory := lstCategory.Items.Count;
lstCategory.Clear;
for i:=0 to FActionList.ActionCount-1 do begin
for i := 0 to FActionList.ActionCount-1 do begin
sCategory := FActionList.Actions[i].Category;
if Trim(sCategory) = ''
if sCategory = ''
then Continue;
xIndex := lstCategory.Items.IndexOf(sCategory);
if xIndex < 0
@ -1034,10 +1009,15 @@ begin
xIndex := lstCategory.Items.IndexOf(sOldCategory);
if lstCategory.Items.Count > 0
then lstCategory.Items.Insert(0, cActionListEditorAllCategory);
if lstCategory.Items.Count > 0
then lstCategory.Items.Insert(1, cActionListEditorUnknownCategory)
if lstCategory.Items.Count > 0 then begin
lstCategory.Items.Insert(0, cActionListEditorAllCategory);
if xIndex > 0 then Inc(xIndex);
end;
if lstCategory.Items.Count > 0 then
begin
lstCategory.Items.Insert(1, cActionListEditorUnknownCategory);
if xIndex > 0 then Inc(xIndex);
end
else lstCategory.Items.Add(cActionListEditorUnknownCategory);
finally
lstCategory.Items.EndUpdate;
@ -1106,25 +1086,44 @@ end;
{ TActionListComponentEditor }
procedure TActionListComponentEditor.EditorWindowClose;
begin
fWindowClosed := True;
end;
constructor TActionListComponentEditor.Create(AComponent: TComponent;
ADesigner: TComponentEditorDesigner);
begin
inherited Create(AComponent, ADesigner);
FDesigner := ADesigner;
fWindowClosed := True;
end;
destructor TActionListComponentEditor.Destroy;
begin
if Assigned(ActionListEditorForm)
and (ActionListEditorForm.FActionList = GetComponent)
then FreeThenNil(ActionListEditorForm);
if not fWindowClosed
then FreeThenNil(FActionListEditorForm);
inherited Destroy;
end;
procedure TActionListComponentEditor.Edit;
var
AActionList: TActionList;
begin
DebugLn('TActionListComponentEditor.Edit ',GetComponent.Name);
ShowActionListEditor(GetComponent as TActionList, FDesigner);
AActionList := GetComponent as TActionList;
if AActionList = nil
then raise Exception.Create('TActionListComponentEditor.Edit AActionList=nil');
if fWindowClosed then begin
FActionListEditorForm := TActionListEditor.Create(Application);
fWindowClosed := False;
end;
with FActionListEditorForm do begin
lstActionName.ItemIndex := -1;
Designer := Self.FDesigner;
SetActionList(AActionList);
ComponentEditor := Self;
ShowOnTop;
end;
end;
function TActionListComponentEditor.GetVerbCount: Integer;
@ -1318,26 +1317,27 @@ begin
// TODO
// - default images for actions
RegisterActions(cActionListEditorUnknownCategory,[TAction],nil);
// register edit actions
RegisterActions('Edit',[TEditCut,TEditCopy,TEditPaste,TEditSelectAll,
RegisterActions(cActionListEditorEditCategory,[TEditCut,TEditCopy,TEditPaste,TEditSelectAll,
TEditUndo,TEditDelete],nil);
// register help actions
RegisterActions('Help',[THelpAction,THelpContents,THelpTopicSearch,
RegisterActions(cActionListEditorHelpCategory,[THelpAction,THelpContents,THelpTopicSearch,
THelpOnHelp,THelpContextAction],nil);
// register dialog actions
RegisterActions('Dialog',[TFontEdit,TColorSelect],nil);
RegisterActions(cActionListEditorDialogCategory,[TColorSelect,TFontEdit],nil);
// register file actions
RegisterActions('File',[TFileOpen,TFileOpenWith,TFileSaveAs,TFileExit],nil);
RegisterActions(cActionListEditorFileCategory,[TFileOpen,TFileOpenWith,TFileSaveAs,TFileExit],nil);
// register database actions
RegisterActions('Database',[TDataSetFirst,TDataSetLast,TDataSetNext,
RegisterActions(cActionListEditorDatabaseCategory,[TDataSetFirst,TDataSetLast,TDataSetNext,
TDataSetPrior,TDataSetRefresh,TDataSetCancel,TDataSetDelete,TDataSetEdit,
TDataSetInsert,TDataSetPost],nil);
end;
initialization
{$I actionseditor.lrs}
ActionListEditorForm := nil;
NotifyActionListChange := nil;
RegisteredActions := TRegisteredActionCategories.Create;
RegisterActionsProc := @RegisterActions;
UnRegisterActionsProc := @UnregisterActions;

View File

@ -6,7 +6,7 @@ object FormActStandard: TFormActStandard
KeyPreview = True
OnClose = FormActStandardClose
OnKeyPress = FormActStandardKeyPress
PixelsPerInch = 112
PixelsPerInch = 120
Position = poOwnerFormCenter
HorzScrollBar.Page = 329
VertScrollBar.Page = 438
@ -19,14 +19,14 @@ object FormActStandard: TFormActStandard
Caption = 'LabelHeadLine'
Color = clNone
Left = 12
Height = 12
Height = 17
Top = 9
Width = 85
Width = 86
end
object tvActStdList: TTreeView
Anchors = [akTop, akLeft, akRight, akBottom]
AutoExpand = True
DefaultItemHeight = 14
DefaultItemHeight = 19
HideSelection = False
HotTrack = True
ReadOnly = True
@ -42,7 +42,7 @@ object FormActStandard: TFormActStandard
end
object btnCancel: TBitBtn
Anchors = [akRight, akBottom]
Caption = 'Cancel'
Caption = 'Anuluj'
Kind = bkCancel
ModalResult = 2
TabOrder = 2

View File

@ -4,20 +4,20 @@ LazarusResources.Add('TFormActStandard','FORMDATA',[
'TPF0'#16'TFormActStandard'#15'FormActStandard'#11'BorderStyle'#7#8'bsDialog'
+#7'Caption'#6#15'FormActStandard'#12'ClientHeight'#3#183#1#11'ClientWidth'#3
+'J'#1#10'KeyPreview'#9#7'OnClose'#7#20'FormActStandardClose'#10'OnKeyPress'#7
+#23'FormActStandardKeyPress'#13'PixelsPerInch'#2'p'#8'Position'#7#17'poOwner'
+#23'FormActStandardKeyPress'#13'PixelsPerInch'#2'x'#8'Position'#7#17'poOwner'
+'FormCenter'#18'HorzScrollBar.Page'#3'I'#1#18'VertScrollBar.Page'#3#182#1#4
+'Left'#3'!'#1#6'Height'#3#183#1#3'Top'#3#160#0#5'Width'#3'J'#1#0#6'TLabel'#13
+'LabelHeadLine'#8'AutoSize'#9#7'Caption'#6#13'LabelHeadLine'#5'Color'#7#6'cl'
+'None'#4'Left'#2#12#6'Height'#2#12#3'Top'#2#9#5'Width'#2'U'#0#0#9'TTreeView'
+'None'#4'Left'#2#12#6'Height'#2#17#3'Top'#2#9#5'Width'#2'V'#0#0#9'TTreeView'
+#12'tvActStdList'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
+#10'AutoExpand'#9#17'DefaultItemHeight'#2#14#13'HideSelection'#8#8'HotTrack'
+#10'AutoExpand'#9#17'DefaultItemHeight'#2#19#13'HideSelection'#8#8'HotTrack'
+#9#8'ReadOnly'#9#16'RightClickSelect'#9#10'ScrollBars'#7#10'ssVertical'#8'Ta'
+'bOrder'#2#0#10'OnDblClick'#7#20'tvActStdListDblClick'#7'Options'#11#13'tvoA'
+'utoExpand'#17'tvoAutoItemHeight'#11'tvoHotTrack'#21'tvoKeepCollapsedNodes'
+#11'tvoReadOnly'#19'tvoRightClickSelect'#14'tvoShowButtons'#12'tvoShowLines'
+#11'tvoShowRoot'#11'tvoToolTips'#0#4'Left'#2#8#6'Height'#3'o'#1#3'Top'#2' '#5
+'Width'#3'9'#1#0#0#7'TBitBtn'#9'btnCancel'#7'Anchors'#11#7'akRight'#8'akBott'
+'om'#0#7'Caption'#6#6'Cancel'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#8'Ta'
+'om'#0#7'Caption'#6#6'Anuluj'#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#8'Ta'
+'bOrder'#2#2#4'Left'#3#230#0#6'Height'#2#25#3'Top'#3#152#1#5'Width'#2'['#0#0
+#7'TBitBtn'#5'btnOK'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#3'&'
+'OK'#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#7'OnClick'#7#10'btnO'

View File

@ -19,10 +19,12 @@
version:
0.1 - 10.03.2005 - added to ActionList Editor
0.2 - 14.03.2005 - hedadline, hint and shortcut descriptions
ToDo: - multiselect for actions
- standard icon
}
unit ActionsEditorStd;
unit actionseditorstd;
{$mode objfpc}{$H+}
@ -30,12 +32,14 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
ComCtrls, Buttons, ActnList, StdActns, LCLType;
ComCtrls, Buttons, ActnList, StdActns, DBActns, LCLType, Contnrs,
LCLProc;
type
TResultActProc = procedure (const Category: string;
ActionClass: TBasicActionClass; LastItem: Boolean) of object;
TActStdPropItem = class;
TActStdProp = class;
TResultActProc = procedure (const Category: string; ActionClass: TBasicActionClass; ActionProperty: TActStdPropItem; LastItem: Boolean) of object;
{ TFormActStandard }
TFormActStandard = class(TForm)
@ -50,8 +54,10 @@ type
private
{ private declarations }
FResultActionProc: TResultActProc;
fActStdProperty: TActStdProp;
procedure EnumAct;
procedure ResultActionProc;
procedure AddStdActProperties;
public
{ public declarations }
constructor Create(AOwner: TComponent); override;
@ -59,10 +65,43 @@ type
destructor Destroy; override;
end;
TRecActStdProp = packed record
Caption: String;
ShortCut: TShortCut;
Hint: String;
end;
{ TActStdPropItem }
TActStdPropItem = class
private
FActProperties: TRecActStdProp;
FClassName: String;
procedure SetActClassName(const AValue: String);
procedure SetActProperties(const AValue: TRecActStdProp);
public
property ActClassName: String read FClassName write SetActClassName;
property ActionProperty: TRecActStdProp read FActProperties write FActProperties;
end;
{ TActStdProp }
TActStdProp = class
private
fPropList: TObjectList;
procedure Add(ActClassType: TClass; HeadLine, ShortCut, Hint: String);
public
constructor Create;
destructor Destroy; override;
function IndexOfClass(ActClassName: String): TActStdPropItem;
end;
implementation
uses actionseditor, ObjInspStrConsts;
{ TFormActStandard }
procedure TFormActStandard.FormActStandardClose(Sender: TObject;
@ -97,11 +136,11 @@ begin
or (htOnLabel in MyHitTest) then begin
if (not node.HasChildren) and (node.Parent is TTreeNode)
then btnOK.Click
else begin
{ else begin
if node.Expanded
then node.Collapse(False)
else node.Expand(False);
end;
end; }
end;
end;
end;
@ -112,11 +151,6 @@ var
NodeCategory: TTreeNode;
begin
tvActStdList.BeginUpdate;
with tvActStdList.Items do begin
NodeCategory := tvActStdList.Items.Add(nil, cActionListEditorUnknownCategory);
AddChild(NodeCategory, TAction.ClassName);
end;
for outer := 0 to RegisteredActions.Count-1 do begin
with tvActStdList.Items do begin
NodeCategory := Add(nil, RegisteredActions.Items[outer].Name);
@ -132,19 +166,47 @@ end;
procedure TFormActStandard.ResultActionProc;
var
Category: String;
outer: Integer;
lastItem: Boolean; // for multiselect, but now the multiselect property is not implemented in the TTreeView
fClass: TBasicActionClass;
begin
Category := tvActStdList.Selected.Parent.Text;
lastItem := True;
for outer := 0 to RegisteredActions.Count-1 do begin
if RegisteredActions.Items[outer].Name = Category then begin
FResultActionProc(Category, RegisteredActions.Items[outer].
Items[tvActStdList.Selected.Index].ActionClass, lastItem);
Break;
end;
end;
fClass := RegisteredActions.Items[RegisteredActions.IndexOfCategory(Category)].Items[tvActStdList.Selected.Index].ActionClass;
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(THelpContents, oiStdActHelpContentsHeadLine, '', oiStdActHelpContentsHint);
fActStdProperty.Add(THelpTopicSearch, oiStdActHelpTopicSearchHeadLine, '', oiStdActHelpTopicSearchHint);
fActStdProperty.Add(THelpOnHelp, oiStdActHelpHelpHelpHeadLine, '', oiStdActHelpHelpHelpHint);
fActStdProperty.Add(TFileOpen, oiStdActFileOpenHeadLine, oiStdActFileOpenShortCut, oiStdActFileOpenHint);
fActStdProperty.Add(TFileSaveAs, oiStdActFileSaveAsHeadLine, '', oiStdActFileSaveAsHint);
fActStdProperty.Add(TFileExit, oiStdActFileExitHeadLine, '', oiStdActFileExitHint);
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);
end;
constructor TFormActStandard.Create(AOwner: TComponent);
@ -156,16 +218,71 @@ constructor TFormActStandard.CreateEx(AOwner: TComponent; ResultActProc: TResult
begin
inherited Create(AOwner);
FResultActionProc := ResultActProc;
Caption := 'Standard Action Classes';
LabelHeadLine.Caption := 'Available Action Classes:';
Caption := OisStdActionListEditor;
LabelHeadLine.Caption := oisStdActionListEditorClass;
EnumAct;
fActStdProperty := TActStdProp.Create;
AddStdActProperties;
end;
destructor TFormActStandard.Destroy;
begin
fActStdProperty.Free;
inherited Destroy;
end;
{ TActStdProp }
procedure TActStdProp.Add(ActClassType: TClass; HeadLine, ShortCut, Hint: String);
var
ActItem: TActStdPropItem;
begin
if Assigned(IndexOfClass(ActClassType.ClassName)) then Exit;
ActItem := TActStdPropItem.Create;
ActItem.ActClassName := ActClassType.ClassName;
ActItem.ActionProperty.Caption := HeadLine;
ActItem.ActionProperty.ShortCut := TextToShortCut(ShortCut);
ActItem.ActionProperty.Hint := Hint;
fPropList.Add(ActItem);
end;
constructor TActStdProp.Create;
begin
fPropList := TObjectList.Create;
end;
destructor TActStdProp.Destroy;
begin
fPropList.Free;
inherited Destroy;
end;
function TActStdProp.IndexOfClass(ActClassName: String): TActStdPropItem;
var
i: Integer;
begin
Result := nil;
for i:= 0 to fPropList.Count-1 do begin
if TActStdPropItem(fPropList[i]).ActClassName = ActClassName then begin
Result := TActStdPropItem(fPropList[i]);
Break;
end;
end;
end;
{ TActStdPropItem }
procedure TActStdPropItem.SetActClassName(const AValue: String);
begin
if FClassName = AValue then Exit;
FClassName := AValue;
end;
procedure TActStdPropItem.SetActProperties(const AValue: TRecActStdProp);
begin
FActProperties := AValue;
end;
initialization
{$I actionseditorstd.lrs}

View File

@ -81,11 +81,86 @@ resourcestring
oisCreateDefaultEvent = 'Create default event';
// Actions Editor
cActionListEditorUnknownCategory='(Unknown)';
cActionListEditorUnknownCategory = '(Unknown)';
cActionListEditorAllCategory = '(All)';
cActionListEditorEditCategory = 'Edit';
cActionListEditorHelpCategory = 'Help';
cActionListEditorDialogCategory = 'Dialog';
cActionListEditorFileCategory = 'File';
cActionListEditorDatabaseCategory = 'Database';
oisEditActionList = 'Edit action list...';
oisActionListEditor = 'Action List Editor';
oisAdd = 'Add';
cActionListEditorAllCategory='(All)';
cActionListEditorNewAction = 'New Action';
cActionListEditorNewStdAction = 'New Standard Action';
cActionListEditorMoveDownAction = 'Move Down';
cActionListEditorMoveUpAction = 'Move Up';
cActionListEditorDeleteActionHint = 'Delete Action';
cActionListEditorDeleteAction = 'Delete';
cActionListEditorPanelDescrriptions = 'Panel Descriptions';
cActionListEditorPanelToolBar = 'Toolbar';
oiStdActEditCutHeadLine = 'Cu&t';
oiStdActEditCopyHeadLine = '&Copy';
oiStdActEditPasteHeadLine = '&Paste';
oiStdActEditSelectAllHeadLine = 'Select &All';
oiStdActEditUndoHeadLine = '&Undo';
oiStdActEditDeleteHeadLine = '&Delete';
oiStdActHelpContentsHeadLine = '&Contents';
oiStdActHelpTopicSearchHeadLine = '&Topic Search';
oiStdActHelpHelpHelpHeadLine = '&Help on Help';
oiStdActFileOpenHeadLine = '&Open...';
oiStdActFileSaveAsHeadLine = 'Save &As...';
oiStdActFileExitHeadLine = 'E&xit';
oiStdActColorSelect1HeadLine = 'Select &Color...';
oiStdActFontEditHeadLine = 'Select &Font...';
oiStdActDataSetFirstHeadLine = '&First';
oiStdActDataSetPriorHeadLine = '&Prior';
oiStdActDataSetNextHeadLine = '&Next';
oiStdActDataSetLastHeadLine = '&Last';
oiStdActDataSetInsertHeadLine = '&Insert';
oiStdActDataSetDeleteHeadLine = '&Delete';
oiStdActDataSetEditHeadLine = '&Edit';
oiStdActDataSetPostHeadLine = 'P&ost';
oiStdActDataSetCancelHeadLine = '&Cancel';
oiStdActDataSetRefreshHeadLine = '&Refresh';
oiStdActEditCutShortCut = 'Ctrl+X';
oiStdActEditCopyShortCut = 'Ctrl+C';
oiStdActEditPasteShortCut = 'Ctrl+V';
oiStdActEditSelectAllShortCut = 'Ctrl+A';
oiStdActEditUndoShortCut = 'Ctrl+Z';
oiStdActEditDeleteShortCut = 'Del';
oiStdActFileOpenShortCut = 'Ctrl+O';
oiStdActEditCutShortHint = 'Cut';
oiStdActEditCopyShortHint = 'Copy';
oiStdActEditPasteShortHint = 'Paste';
oiStdActEditSelectAllShortHint = 'Select All';
oiStdActEditUndoShortHint = 'Undo';
oiStdActEditDeleteShortHint = 'Delete';
oiStdActHelpContentsHint = 'Help Contents';
oiStdActHelpTopicSearchHint = 'Topic Search';
oiStdActHelpHelpHelpHint = 'Help on help';
oiStdActFileOpenHint = 'Open';
oiStdActFileSaveAsHint = 'Save As';
oiStdActFileExitHint = 'Exit';
oiStdActColorSelectHint = 'Color Select';
oiStdActFontEditHint = 'Font Select';
oiStdActDataSetFirstHint = 'First';
oiStdActDataSetPriorHint = 'Prior';
oiStdActDataSetNextHint = 'Next';
oiStdActDataSetLastHint = 'Last';
oiStdActDataSetInsertHint = 'Insert';
oiStdActDataSetDeleteHint = 'Delete';
oiStdActDataSetEditHint = 'Edit';
oiStdActDataSetPostHint = 'Post';
oiStdActDataSetCancel1Hint = 'Cancel';
oiStdActDataSetRefreshHint = 'Refresh';
oisStdActionListEditor = 'Standard Action Classes';
oisStdActionListEditorClass = 'Available Action Classes:';
// TFileNamePropertyEditor
oisSelectAFile = 'Select a file';

View File

@ -495,7 +495,7 @@ end;
function TEditAction.GetControl(Target: TObject): TCustomEdit;
begin
Result:=nil;
Result := TCustomEdit(Target);
end;
procedure TEditAction.Notification(AComponent: TComponent; Operation: TOperation
@ -660,8 +660,16 @@ begin
end;
constructor TCommonDialogAction.Create(TheOwner: TComponent);
var
DlgClass: TCommonDialogClass;
begin
inherited Create(TheOwner);
DlgClass := GetDialogClass;
if Assigned(DlgClass)
then FDialog := DlgClass.Create(Self);
DisableIfNoHandler := False;
Enabled := True;
end;
destructor TCommonDialogAction.Destroy;
@ -683,24 +691,24 @@ end;
function TFileAction.GetFileName: TFileName;
begin
Result:='ToDo';
Result := GetDialog.FileName;
end;
procedure TFileAction.SetFileName(const AValue: TFileName);
begin
GetDialog.FileName := AValue;
end;
function TFileAction.GetDialog: TOpenDialog;
begin
Result:=nil;
Result := TOpenDialog(FDialog);
end;
{ TFileOpen }
function TFileOpen.GetDialog: TOpenDialog;
begin
Result:=nil;
Result := TOpenDialog(FDialog);
end;
function TFileOpen.GetDialogClass: TCommonDialogClass;
@ -729,7 +737,7 @@ end;
function TFileSaveAs.GetSaveDialog: TSaveDialog;
begin
Result:=nil;
Result := TSaveDialog(FDialog);
end;
function TFileSaveAs.GetDialogClass: TCommonDialogClass;
@ -796,7 +804,7 @@ end;
function TFontEdit.GetDialog: TFontDialog;
begin
Result:=nil;
Result := TFontDialog(FDialog);
end;
function TFontEdit.GetDialogClass: TCommonDialogClass;
@ -808,7 +816,7 @@ end;
function TColorSelect.GetDialog: TColorDialog;
begin
Result:=nil;
Result := TColorDialog(FDialog);
end;
function TColorSelect.GetDialogClass: TCommonDialogClass;