* patch #8301 (modified) from Flávio Etrusco:Make 'enable' and 'delete' commands act on muliple selection

git-svn-id: trunk@10752 -
This commit is contained in:
marc 2007-03-15 01:03:46 +00:00
parent b5df97096a
commit 08595e6a3b
3 changed files with 137 additions and 68 deletions

View File

@ -1,17 +1,19 @@
object BreakpointsDlg: TBreakpointsDlg inherited BreakpointsDlg: TBreakpointsDlg
Caption = 'Breakpoint list' Left = 344
ClientHeight = 205
ClientWidth = 560
OnCreate = BreakpointsDlgCREATE
Visible = True
HorzScrollBar.Page = 561
VertScrollBar.Page = 206
Left = 340
Height = 205 Height = 205
Top = 117 Top = 153
Width = 560 Width = 560
HelpType = htKeyword HelpType = htKeyword
HorzScrollBar.Page = 559
VertScrollBar.Page = 204
ActiveControl = lvBreakPoints
Caption = 'Breakpoint list'
OnCreate = BreakpointsDlgCREATE
Visible = True
object lvBreakPoints: TListView object lvBreakPoints: TListView
Height = 205
Width = 560
HelpType = htKeyword
Align = alClient Align = alClient
Columns = < Columns = <
item item
@ -38,17 +40,19 @@ object BreakpointsDlg: TBreakpointsDlg
end end
item item
Caption = 'Group' Caption = 'Group'
Width = 0 Width = 5
end> end>
MultiSelect = True MultiSelect = True
PopupMenu = mnuPopup PopupMenu = mnuPopup
ReadOnly = True
RowSelect = True
SortColumn = 1
SortType = stText
TabOrder = 0
ViewStyle = vsReport ViewStyle = vsReport
OnClick = lvBreakPointsClick OnColumnClick = lvBreakPointsColumnClick
OnDblClick = lvBreakPointsDBLCLICK OnDblClick = lvBreakPointsDBLCLICK
OnSelectItem = lvBreakPointsSelectItem OnSelectItem = lvBreakPointsSelectItem
Height = 205
Width = 560
HelpType = htKeyword
end end
object mnuPopup: TPopupMenu object mnuPopup: TPopupMenu
OnPopup = mnuPopupPopup OnPopup = mnuPopupPopup
@ -79,11 +83,13 @@ object BreakpointsDlg: TBreakpointsDlg
end end
object popEnabled: TMenuItem object popEnabled: TMenuItem
Caption = '&Enabled' Caption = '&Enabled'
ShortCut = 16462
ShowAlwaysCheckable = True ShowAlwaysCheckable = True
OnClick = popEnabledClick OnClick = popEnabledClick
end end
object popDelete: TMenuItem object popDelete: TMenuItem
Caption = '&Delete' Caption = '&Delete'
ShortCut = 46
OnClick = popDeleteClick OnClick = popDeleteClick
end end
object N2: TMenuItem object N2: TMenuItem

View File

@ -1,35 +1,39 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TBreakpointsDlg','FORMDATA',[ LazarusResources.Add('TBreakpointsDlg','FORMDATA',[
'TPF0'#15'TBreakpointsDlg'#14'BreakpointsDlg'#7'Caption'#6#15'Breakpoint list' 'TPF0'#241#15'TBreakpointsDlg'#14'BreakpointsDlg'#4'Left'#3'X'#1#6'Height'#3
+#12'ClientHeight'#3#205#0#11'ClientWidth'#3'0'#2#8'OnCreate'#7#20'Breakpoint' +#205#0#3'Top'#3#153#0#5'Width'#3'0'#2#8'HelpType'#7#9'htKeyword'#18'HorzScro'
+'sDlgCREATE'#7'Visible'#9#18'HorzScrollBar.Page'#3'1'#2#18'VertScrollBar.Pag' +'llBar.Page'#3'/'#2#18'VertScrollBar.Page'#3#204#0#13'ActiveControl'#7#13'lv'
+'e'#3#206#0#4'Left'#3'T'#1#6'Height'#3#205#0#3'Top'#2'u'#5'Width'#3'0'#2#8'H' +'BreakPoints'#7'Caption'#6#15'Breakpoint list'#8'OnCreate'#7#20'BreakpointsD'
+'elpType'#7#9'htKeyword'#0#9'TListView'#13'lvBreakPoints'#5'Align'#7#8'alCli' +'lgCREATE'#7'Visible'#9#0#9'TListView'#13'lvBreakPoints'#6'Height'#3#205#0#5
+'ent'#7'Columns'#14#1#7'Caption'#6#5'State'#0#1#7'Caption'#6#16'Filename/Add' +'Width'#3'0'#2#8'HelpType'#7#9'htKeyword'#5'Align'#7#8'alClient'#7'Columns'
+'ress'#5'Width'#3#150#0#0#1#7'Caption'#6#11'Line/Length'#5'Width'#2'd'#0#1#7 +#14#1#7'Caption'#6#5'State'#0#1#7'Caption'#6#16'Filename/Address'#5'Width'#3
+'Caption'#6#9'Condition'#5'Width'#2'K'#0#1#7'Caption'#6#6'Action'#0#1#7'Capt' +#150#0#0#1#7'Caption'#6#11'Line/Length'#5'Width'#2'd'#0#1#7'Caption'#6#9'Con'
+'ion'#6#10'Pass Count'#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#5'Width'#2#0#0 +'dition'#5'Width'#2'K'#0#1#7'Caption'#6#6'Action'#0#1#7'Caption'#6#10'Pass C'
+#0#11'MultiSelect'#9#9'PopupMenu'#7#8'mnuPopup'#9'ViewStyle'#7#8'vsReport'#7 +'ount'#5'Width'#2'd'#0#1#7'Caption'#6#5'Group'#5'Width'#2#5#0#0#11'MultiSele'
+'OnClick'#7#18'lvBreakPointsClick'#10'OnDblClick'#7#21'lvBreakPointsDBLCLICK' +'ct'#9#9'PopupMenu'#7#8'mnuPopup'#8'ReadOnly'#9#9'RowSelect'#9#10'SortColumn'
+#12'OnSelectItem'#7#23'lvBreakPointsSelectItem'#6'Height'#3#205#0#5'Width'#3 +#2#1#8'SortType'#7#6'stText'#8'TabOrder'#2#0#9'ViewStyle'#7#8'vsReport'#13'O'
+'0'#2#8'HelpType'#7#9'htKeyword'#0#0#10'TPopupMenu'#8'mnuPopup'#7'OnPopup'#7 +'nColumnClick'#7#24'lvBreakPointsColumnClick'#10'OnDblClick'#7#21'lvBreakPoi'
+#13'mnuPopupPopup'#4'left'#2#24#3'top'#2#8#0#9'TMenuItem'#7'popShow'#7'Capti' +'ntsDBLCLICK'#12'OnSelectItem'#7#23'lvBreakPointsSelectItem'#0#0#10'TPopupMe'
+'on'#6#4'Show'#7'Default'#9#7'OnClick'#7#12'popShowClick'#0#0#9'TMenuItem'#2 +'nu'#8'mnuPopup'#7'OnPopup'#7#13'mnuPopupPopup'#4'left'#2#24#3'top'#2#8#0#9
+'N0'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#6'popAdd'#7'Caption'#6#6'Add...'#0#9 +'TMenuItem'#7'popShow'#7'Caption'#6#4'Show'#7'Default'#9#7'OnClick'#7#12'pop'
+'TMenuItem'#14'popAddSourceBP'#7'Caption'#6#18'&Source breakpoint'#7'Enabled' +'ShowClick'#0#0#9'TMenuItem'#2'N0'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#6'popA'
+#8#7'OnClick'#7#19'popAddSourceBPClick'#0#0#0#9'TMenuItem'#2'N1'#7'Caption'#6 +'dd'#7'Caption'#6#6'Add...'#0#9'TMenuItem'#14'popAddSourceBP'#7'Caption'#6#18
+#1'-'#0#0#9'TMenuItem'#13'popProperties'#7'Caption'#6#11'&Properties'#7'OnCl' +'&Source breakpoint'#7'Enabled'#8#7'OnClick'#7#19'popAddSourceBPClick'#0#0#0
+'ick'#7#18'popPropertiesClick'#0#0#9'TMenuItem'#10'popEnabled'#7'Caption'#6#8 +#9'TMenuItem'#2'N1'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popProperties'#7'C'
+'&Enabled'#19'ShowAlwaysCheckable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9 +'aption'#6#11'&Properties'#7'OnClick'#7#18'popPropertiesClick'#0#0#9'TMenuIt'
+'TMenuItem'#9'popDelete'#7'Caption'#6#7'&Delete'#7'OnClick'#7#14'popDeleteCl' +'em'#10'popEnabled'#7'Caption'#6#8'&Enabled'#8'ShortCut'#3'N@'#19'ShowAlways'
+'ick'#0#0#9'TMenuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisabl' +'Checkable'#9#7'OnClick'#7#15'popEnabledClick'#0#0#9'TMenuItem'#9'popDelete'
+'eAll'#7'Caption'#6#12'D&isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0 +#7'Caption'#6#7'&Delete'#8'ShortCut'#2'.'#7'OnClick'#7#14'popDeleteClick'#0#0
+#9'TMenuItem'#12'popEnableAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17 +#9'TMenuItem'#2'N2'#7'Caption'#6#1'-'#0#0#9'TMenuItem'#13'popDisableAll'#7'C'
+'popEnableAllClick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delet' +'aption'#6#12'D&isable All'#7'OnClick'#7#18'popDisableAllClick'#0#0#9'TMenuI'
+'e All'#7'OnClick'#7#17'popDeleteAllClick'#0#0#9'TMenuItem'#2'N3'#7'Caption' +'tem'#12'popEnableAll'#7'Caption'#6#11'&Enable All'#7'OnClick'#7#17'popEnabl'
+#6#1'-'#0#0#9'TMenuItem'#23'popDisableAllSameSource'#7'Caption'#6#26'Disable' +'eAllClick'#0#0#9'TMenuItem'#12'popDeleteAll'#7'Caption'#6#11'&Delete All'#7
+' All in same source'#7'OnClick'#7#28'popDisableAllSameSourceCLICK'#0#0#9'TM' +'OnClick'#7#17'popDeleteAllClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0
+'enuItem'#22'popEnableAllSameSource'#7'Caption'#6#25'Enable All in same sour' +#0#9'TMenuItem'#23'popDisableAllSameSource'#7'Caption'#6#26'Disable All in s'
+'ce'#7'OnClick'#7#27'popEnableAllSameSourceCLICK'#0#0#9'TMenuItem'#22'popDel' +'ame source'#7'OnClick'#7#28'popDisableAllSameSourceCLICK'#0#0#9'TMenuItem'
+'eteAllSameSource'#7'Caption'#6#25'Delete All in same source'#7'OnClick'#7#27 +#22'popEnableAllSameSource'#7'Caption'#6#25'Enable All in same source'#7'OnC'
+'popDeleteAllSameSourceCLICK'#0#0#0#0 +'lick'#7#27'popEnableAllSameSourceCLICK'#0#0#9'TMenuItem'#22'popDeleteAllSam'
+'eSource'#7'Caption'#6#25'Delete All in same source'#7'OnClick'#7#27'popDele'
+'teAllSameSourceCLICK'#0#0#0#0
]); ]);

View File

@ -1,6 +1,6 @@
{ $Id$ } { $Id$ }
{ ---------------------------------------------- { ----------------------------------------------
breakpointsdlg.pp - Overview of breeakponts breakpointsdlg.pp - Overview of breakpoints
---------------------------------------------- ----------------------------------------------
@created(Fri Dec 14st WET 2001) @created(Fri Dec 14st WET 2001)
@ -47,6 +47,8 @@ type
); );
TBreakPointsDlgStates = set of TBreakPointsDlgState; TBreakPointsDlgStates = set of TBreakPointsDlgState;
{ TBreakPointsDlg }
TBreakPointsDlg = class(TDebuggerDlg) TBreakPointsDlg = class(TDebuggerDlg)
lvBreakPoints: TListView; lvBreakPoints: TListView;
N0: TMenuItem; N0: TMenuItem;
@ -67,7 +69,7 @@ type
popEnableAllSameSource: TMenuItem; popEnableAllSameSource: TMenuItem;
popDeleteAllSameSource: TMenuItem; popDeleteAllSameSource: TMenuItem;
procedure BreakpointsDlgCREATE(Sender: TObject); procedure BreakpointsDlgCREATE(Sender: TObject);
procedure lvBreakPointsClick(Sender: TObject); procedure lvBreakPointsColumnClick(Sender: TObject; Column: TListColumn);
procedure lvBreakPointsDBLCLICK(Sender: TObject); procedure lvBreakPointsDBLCLICK(Sender: TObject);
procedure lvBreakPointsSelectItem(Sender: TObject; AItem: TListItem; procedure lvBreakPointsSelectItem(Sender: TObject; AItem: TListItem;
Selected: Boolean); Selected: Boolean);
@ -260,8 +262,10 @@ begin
DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0); DoJumpToCodePos(CurBreakPoint.Source,CurBreakPoint.Line,0);
end; end;
procedure TBreakPointsDlg.lvBreakPointsClick(Sender: TObject); procedure TBreakPointsDlg.lvBreakPointsColumnClick(Sender: TObject;
Column: TListColumn);
begin begin
lvBreakPoints.SortColumn := Column.Index;
end; end;
procedure TBreakPointsDlg.BreakpointsDlgCREATE(Sender: TObject); procedure TBreakPointsDlg.BreakpointsDlgCREATE(Sender: TObject);
@ -385,8 +389,13 @@ begin
'Delete all breakpoints?', 'Delete all breakpoints?',
mtConfirmation,[mbYes,mbCancel],0)<>mrYes mtConfirmation,[mbYes,mbCancel],0)<>mrYes
then exit; then exit;
for n := lvBreakPoints.Items.Count - 1 downto 0 do lvBreakPoints.BeginUpdate;
TIDEBreakPoint(lvBreakPoints.Items[n].Data).Free; try
for n := lvBreakPoints.Items.Count - 1 downto 0 do
TIDEBreakPoint(lvBreakPoints.Items[n].Data).Free;
finally
lvBreakPoints.EndUpdate;
end;
end; end;
procedure TBreakPointsDlg.popShowClick(Sender: TObject); procedure TBreakPointsDlg.popShowClick(Sender: TObject);
@ -395,19 +404,52 @@ begin
end; end;
procedure TBreakPointsDlg.popDeleteClick(Sender: TObject); procedure TBreakPointsDlg.popDeleteClick(Sender: TObject);
//todo: make rsDeleteBreakpointConfirmation translatable
const
rsDeleteBreakpointConfirmation = 'Delete breakpoint at'#13'''"%s" line %d?';
rsDeleteSelectedBreakpointConfirmation = 'Delete all selected breakpoints?';
var var
CurItem: TListItem; Item: TListItem;
CurBreakPoint: TIDEBreakPoint; CurBreakPoint: TIDEBreakPoint;
Msg: String;
List: TList;
n: Integer;
begin begin
CurItem:=lvBreakPoints.Selected; Item:=lvBreakPoints.Selected;
if CurItem=nil then exit; if Item = nil then exit;
CurBreakPoint:=TIDEBreakPoint(CurItem.Data);
if MessageDlg('Delete breakpoint?', if lvBreakPoints.SelCount = 1 then
'Delete breakpoint at'#13 begin
+'"'+CurBreakPoint.Source+'" line '+IntToStr(CurBreakPoint.Line)+'?', CurBreakPoint:=TIDEBreakPoint(Item.Data);
mtConfirmation,[mbYes,mbCancel],0)<>mrYes Msg := Format(rsDeleteBreakpointConfirmation, [CurBreakPoint.Source,
then exit; CurBreakPoint.Line]);
CurBreakPoint.Free; end
else
Msg := rsDeleteSelectedBreakpointConfirmation;
if MessageDlg(Msg, mtConfirmation, [mbYes,mbCancel],0) <> mrYes then exit;
if lvBreakPoints.SelCount = 1
then begin
TObject(Item.Data).Free;
Exit;
end;
List := TList.Create;
for n := 0 to lvBreakPoints.Items.Count - 1 do
begin
Item := lvBreakPoints.Items[n];
if Item.Selected
then List.Add(Item);
end;
lvBreakPoints.BeginUpdate;
try
for n := 0 to List.Count - 1 do
TObject(List[n]).Free;
finally
lvBreakPoints.EndUpdate;
end;
List.Free;
end; end;
procedure TBreakPointsDlg.popDisableAllClick(Sender: TObject); procedure TBreakPointsDlg.popDisableAllClick(Sender: TObject);
@ -438,15 +480,32 @@ end;
procedure TBreakPointsDlg.popEnabledClick(Sender: TObject); procedure TBreakPointsDlg.popEnabledClick(Sender: TObject);
var var
CurItem: TListItem; n: Integer;
Item: TListItem;
Enable: Boolean;
begin begin
CurItem:=lvBreakPoints.Selected; Item:=lvBreakPoints.Selected;
if (CurItem=nil) then exit; if (Item=nil) then exit;
TIDEBreakPoint(CurItem.Data).Enabled:=not TIDEBreakPoint(CurItem.Data).Enabled;
Enable := not TIDEBreakPoint(Item.Data).Enabled;
if lvBreakPoints.SelCount > 1
then begin
for n := 0 to lvBreakPoints.Items.Count -1 do
begin
Item := lvBreakPoints.Items[n];
if Item.Selected then
TIDEBreakPoint(Item.Data).Enabled := Enable;
end;
end
else begin
TIDEBreakPoint(Item.Data).Enabled:= Enable;
end;
end; end;
procedure TBreakPointsDlg.popPropertiesClick(Sender: TObject); procedure TBreakPointsDlg.popPropertiesClick(Sender: TObject);
begin begin
ShowMessage('Not implemented yet.');
end; end;
procedure TBreakPointsDlg.DoEndUpdate; procedure TBreakPointsDlg.DoEndUpdate;