fixed deleting an action in TActionListEditor

git-svn-id: trunk@7517 -
This commit is contained in:
mattias 2005-08-17 10:55:31 +00:00
parent eabd9ee61b
commit cf9646b109
4 changed files with 59 additions and 70 deletions

View File

@ -32,8 +32,8 @@ unit Designer;
interface
{$DEFINE VerboseDesigner}
{ $DEFINE VerboseDesignerDraw}
{off $DEFINE VerboseDesigner}
{off $DEFINE VerboseDesignerDraw}
uses
Classes, SysUtils, Math, LCLProc, LCLType, LResources, LCLIntf, LMessages,

View File

@ -6,7 +6,7 @@ object ActionListEditor: TActionListEditor
OnClose = ActionListEditorClose
OnKeyDown = ActionListEditorKeyDown
OnKeyPress = ActionListEditorKeyPress
PixelsPerInch = 120
PixelsPerInch = 112
Position = poScreenCenter
HorzScrollBar.Page = 399
VertScrollBar.Page = 299
@ -16,7 +16,6 @@ object ActionListEditor: TActionListEditor
Width = 400
object PanelDescr: TPanel
Align = alTop
BorderSpacing.OnChange = nil
BevelOuter = bvNone
ClientHeight = 26
ClientWidth = 400
@ -27,8 +26,6 @@ object ActionListEditor: TActionListEditor
Top = 26
Width = 400
object lblCategory: TLabel
AutoSize = True
BorderSpacing.OnChange = nil
Caption = 'Categories:'
Color = clNone
Left = 6
@ -37,8 +34,6 @@ object ActionListEditor: TActionListEditor
Width = 69
end
object lblName: TLabel
AutoSize = True
BorderSpacing.OnChange = nil
Caption = 'Actions:'
Color = clNone
Left = 162
@ -60,7 +55,6 @@ object ActionListEditor: TActionListEditor
end
object PanelToolbar: TPanel
Align = alTop
BorderSpacing.OnChange = nil
BevelInner = bvRaised
BevelOuter = bvLowered
ClientHeight = 26
@ -71,7 +65,6 @@ object ActionListEditor: TActionListEditor
Width = 400
object btnAdd: TSpeedButton
Action = ActNew
BorderSpacing.OnChange = nil
Flat = True
NumGlyphs = 0
Spacing = 0
@ -84,7 +77,6 @@ object ActionListEditor: TActionListEditor
end
object btnDelete: TSpeedButton
Action = ActDelete
BorderSpacing.OnChange = nil
Flat = True
NumGlyphs = 0
Spacing = 0
@ -97,7 +89,6 @@ object ActionListEditor: TActionListEditor
end
object btnUp: TSpeedButton
Action = ActMoveUp
BorderSpacing.OnChange = nil
Flat = True
NumGlyphs = 0
Spacing = 0
@ -110,7 +101,6 @@ object ActionListEditor: TActionListEditor
end
object btnDown: TSpeedButton
Action = ActMoveDown
BorderSpacing.OnChange = nil
Flat = True
NumGlyphs = 0
Spacing = 0
@ -123,6 +113,7 @@ object ActionListEditor: TActionListEditor
end
object SBShowMenuNewActions: TSpeedButton
AllowAllUp = True
BorderSpacing.OnChange = nil
Flat = True
Glyph.Data = {
720000002F2A2058504D202A2F0A7374617469632063686172202A2062746E5F
@ -144,14 +135,13 @@ object ActionListEditor: TActionListEditor
end
object lstActionName: TListBox
Align = alClient
BorderSpacing.OnChange = nil
ExtendedSelect = True
OnClick = lstActionNameClick
OnDblClick = lstActionNameDblClick
OnKeyDown = lstActionNameKeyDown
OnMouseDown = lstActionNameMouseDown
PopupMenu = PopMenuActions
TabOrder = 2
TopIndex = -1
Left = 157
Height = 248
Top = 52
@ -159,12 +149,11 @@ object ActionListEditor: TActionListEditor
end
object lstCategory: TListBox
Align = alLeft
BorderSpacing.OnChange = nil
ExtendedSelect = True
OnClick = lstCategoryClick
OnMouseDown = lstActionNameMouseDown
PopupMenu = PopMenuActions
TabOrder = 3
TopIndex = -1
Height = 248
Top = 52
Width = 152

View File

@ -4,54 +4,50 @@ 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#7'O'
+'nClose'#7#21'ActionListEditorClose'#9'OnKeyDown'#7#23'ActionListEditorKeyDo'
+'wn'#10'OnKeyPress'#7#24'ActionListEditorKeyPress'#13'PixelsPerInch'#2'x'#8
+'wn'#10'OnKeyPress'#7#24'ActionListEditorKeyPress'#13'PixelsPerInch'#2'p'#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'
+'Button'#5'btnUp'#6'Action'#7#9'ActMoveUp'#22'BorderSpacing.OnChange'#13#4'F'
+'lat'#9#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowHint'#9#14'ParentShowHint'#8#4
+'Left'#2'@'#6'Height'#2#22#3'Top'#2#2#5'Width'#2#24#0#0#12'TSpeedButton'#7'b'
+'tnDown'#6'Action'#7#11'ActMoveDown'#22'BorderSpacing.OnChange'#13#4'Flat'#9
+#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowHint'#9#14'ParentShowHint'#8#4'Left'#2
+'Y'#6'Height'#2#22#3'Top'#2#2#5'Width'#2#24#0#0#12'TSpeedButton'#20'SBShowMe'
+'nuNewActions'#10'AllowAllUp'#9#4'Flat'#9#10'Glyph.Data'#10'v'#0#0#0'r'#0#0#0
+'/* XPM */'#10'static char * btn_downarrow_xpm[] = {'#10'"5 3 2 1",'#10'" '#9
+'c None",'#10'".'#9'c #000000",'#10'".....",'#10'" ... ",'#10'" . "};'#10
+#10'GroupIndex'#2#1#9'NumGlyphs'#2#0#7'Spacing'#2#0#7'OnClick'#7#25'SBShowMe'
+'nuNewActionsClick'#8'ShowHint'#9#14'ParentShowHint'#8#4'Left'#2#25#6'Height'
+#2#22#3'Top'#2#2#5'Width'#2#10#0#0#0#8'TListBox'#13'lstActionName'#5'Align'#7
+#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#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
+#144#1#0#6'TPanel'#10'PanelDescr'#5'Align'#7#5'alTop'#10'BevelOuter'#7#6'bvN'
+'one'#12'ClientHeight'#2#26#11'ClientWidth'#3#144#1#11'FullRepaint'#8#9'Popu'
+'pMenu'#7#14'PopMenuActions'#8'TabOrder'#2#1#6'Height'#2#26#3'Top'#2#26#5'Wi'
+'dth'#3#144#1#0#6'TLabel'#11'lblCategory'#7'Caption'#6#11'Categories:'#5'Col'
+'or'#7#6'clNone'#4'Left'#2#6#6'Height'#2#17#3'Top'#2#6#5'Width'#2'E'#0#0#6'T'
+'Label'#7'lblName'#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'AutoSnap'#8#6'Height'#3#248#0#11'ParentColor'#9#11'OnCanResize'#7#17'Spli'
+'tterCanResize'#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'#12'PanelToolbar'#5'Align'#7#5'alTop'#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'#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'btnDelet'
+'e'#6'Action'#7#9'ActDelete'#4'Flat'#9#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'Sho'
+'wHint'#9#14'ParentShowHint'#8#4'Left'#2'#'#6'Height'#2#22#3'Top'#2#2#5'Widt'
+'h'#2#24#0#0#12'TSpeedButton'#5'btnUp'#6'Action'#7#9'ActMoveUp'#4'Flat'#9#9
+'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowHint'#9#14'ParentShowHint'#8#4'Left'#2
+'@'#6'Height'#2#22#3'Top'#2#2#5'Width'#2#24#0#0#12'TSpeedButton'#7'btnDown'#6
+'Action'#7#11'ActMoveDown'#4'Flat'#9#9'NumGlyphs'#2#0#7'Spacing'#2#0#8'ShowH'
+'int'#9#14'ParentShowHint'#8#4'Left'#2'Y'#6'Height'#2#22#3'Top'#2#2#5'Width'
+#2#24#0#0#12'TSpeedButton'#20'SBShowMenuNewActions'#10'AllowAllUp'#9#22'Bord'
+'erSpacing.OnChange'#13#4'Flat'#9#10'Glyph.Data'#10'v'#0#0#0'r'#0#0#0'/* XPM'
+' */'#10'static char * btn_downarrow_xpm[] = {'#10'"5 3 2 1",'#10'" '#9'c No'
+'ne",'#10'".'#9'c #000000",'#10'".....",'#10'" ... ",'#10'" . "};'#10#10'G'
+'roupIndex'#2#1#9'NumGlyphs'#2#0#7'Spacing'#2#0#7'OnClick'#7#25'SBShowMenuNe'
+'wActionsClick'#8'ShowHint'#9#14'ParentShowHint'#8#4'Left'#2#25#6'Height'#2
+#22#3'Top'#2#2#5'Width'#2#10#0#0#0#8'TListBox'#13'lstActionName'#5'Align'#7#8
+'alClient'#7'OnClick'#7#18'lstActionNameClick'#10'OnDblClick'#7#21'lstAction'
+'NameDblClick'#9'OnKeyDown'#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'lstCategory'#5'Align'#7#6'alLeft'#7'OnClick'#7#16'lstC'
+'ategoryClick'#11'OnMouseDown'#7#22'lstActionNameMouseDown'#9'PopupMenu'#7#14
+'PopMenuActions'#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'#14'ActionListSelf'#3'top'#3#240#0#0
+#7'TAction'#9'ActDelete'#9'OnExecute'#7#16'ActDeleteExecute'#8'OnUpdate'#7#15
+'ActDeleteUpdate'#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
+'AddDelete'#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'
@ -65,11 +61,11 @@ LazarusResources.Add('TActionListEditor','FORMDATA',[
+'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
+'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'
,'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'

View File

@ -14,7 +14,7 @@
implementing ActionList Editor
author:
authors:
Radek Cervinka, radek.cervinka@centrum.cz
Mattias Gaertner
Pawel Piwowar, alfapawel@tlen.pl
@ -835,6 +835,7 @@ var
iNameIndex: Integer;
OldName: String;
OldAction: TContainedAction;
OldIndex: LongInt;
begin
iNameIndex := lstActionName.ItemIndex;
if iNameIndex < 0 then Exit;
@ -848,8 +849,8 @@ begin
if Assigned(OldAction) then
begin
try
FDesigner.PropertyEditorHook.PersistentDeleting(OldAction);
OldAction.Free;
FDesigner.PropertyEditorHook.DeletePersistent(OldAction);
OldAction:=nil;
except
on E: Exception do begin
MessageDlg('Error deleting action',
@ -871,8 +872,11 @@ begin
FActionList.ActionByName(lstActionName.Items[lstActionName.ItemIndex]));
end;
If not IsCategory(OldName)
then lstCategory.Items.Delete(lstCategory.Items.IndexOf(OldName));
If not IsCategory(OldName) then begin
OldIndex:=lstCategory.Items.IndexOf(OldName);
if OldIndex>=0 then
lstCategory.Items.Delete(OldIndex);
end;
if lstActionName.ItemIndex < 0
then FDesigner.SelectOnlyThisComponent(FActionList);
end;