mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 03:48:08 +02:00
ide, debugger: watches:
- allow Add watch always - if Add watch is called outside source editor then show the Add Watch dialog - pass expression under the cursor to the Add Watch dialog as a default value git-svn-id: trunk@21974 -
This commit is contained in:
parent
ce5feafb1b
commit
ec062ef3a0
@ -10,15 +10,15 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
ClientHeight = 210
|
||||
ClientWidth = 420
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '0.9.27'
|
||||
LCLVersion = '0.9.29'
|
||||
object lblExpression: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = txtExpression
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 13
|
||||
Top = 11
|
||||
Width = 65
|
||||
Height = 14
|
||||
Top = 9
|
||||
Width = 57
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Expression:'
|
||||
ParentColor = False
|
||||
@ -28,9 +28,9 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideTop.Control = txtRepCount
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 13
|
||||
Top = 40
|
||||
Width = 80
|
||||
Height = 14
|
||||
Top = 36
|
||||
Width = 72
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Repeat Count:'
|
||||
ParentColor = False
|
||||
@ -41,9 +41,9 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideTop.Control = txtDigits
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 171
|
||||
Height = 13
|
||||
Top = 40
|
||||
Width = 35
|
||||
Height = 14
|
||||
Top = 36
|
||||
Width = 31
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Digits:'
|
||||
ParentColor = False
|
||||
@ -53,7 +53,7 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 105
|
||||
Height = 23
|
||||
Height = 21
|
||||
Top = 6
|
||||
Width = 309
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -65,8 +65,8 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideTop.Control = txtExpression
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 105
|
||||
Height = 23
|
||||
Top = 35
|
||||
Height = 21
|
||||
Top = 33
|
||||
Width = 60
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 2
|
||||
@ -77,9 +77,9 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = txtExpression
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 212
|
||||
Height = 23
|
||||
Top = 35
|
||||
Left = 208
|
||||
Height = 21
|
||||
Top = 33
|
||||
Width = 60
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
@ -90,9 +90,9 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = chkAllowFunc
|
||||
Left = 6
|
||||
Height = 20
|
||||
Top = 64
|
||||
Width = 70
|
||||
Height = 17
|
||||
Top = 60
|
||||
Width = 56
|
||||
AllowGrayed = True
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'Enabled'
|
||||
@ -102,9 +102,9 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideTop.Control = txtRepCount
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 105
|
||||
Height = 20
|
||||
Top = 64
|
||||
Width = 140
|
||||
Height = 17
|
||||
Top = 60
|
||||
Width = 112
|
||||
AllowGrayed = True
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'Allow Function Calls'
|
||||
@ -118,7 +118,7 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 78
|
||||
Top = 90
|
||||
Top = 83
|
||||
Width = 408
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoFill = True
|
||||
@ -134,7 +134,7 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 61
|
||||
ClientHeight = 60
|
||||
ClientWidth = 404
|
||||
Columns = 3
|
||||
ItemIndex = 7
|
||||
@ -155,12 +155,10 @@ object WatchPropertyDlg: TWatchPropertyDlg
|
||||
AnchorSideTop.Control = rgStyle
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 30
|
||||
Top = 174
|
||||
Height = 37
|
||||
Top = 167
|
||||
Width = 408
|
||||
Align = alBottom
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
AutoSize = True
|
||||
TabOrder = 6
|
||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||
ShowBevel = False
|
||||
|
@ -5,55 +5,54 @@ LazarusResources.Add('TWatchPropertyDlg','FORMDATA',[
|
||||
+#210#0#3'Top'#3#184#0#5'Width'#3#164#1#13'ActiveControl'#7#12'chkAllowFunc'
|
||||
+#11'BorderIcons'#11#12'biSystemMenu'#0#11'BorderStyle'#7#8'bsDialog'#7'Capti'
|
||||
+'on'#6#16'Watch Properties'#12'ClientHeight'#3#210#0#11'ClientWidth'#3#164#1
|
||||
+#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.27'#0#6'TLabel'#13
|
||||
+#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.29'#0#6'TLabel'#13
|
||||
+'lblExpression'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Contr'
|
||||
+'ol'#7#13'txtExpression'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6
|
||||
+'Height'#2#13#3'Top'#2#11#5'Width'#2'A'#18'BorderSpacing.Left'#2#6#7'Caption'
|
||||
+'Height'#2#14#3'Top'#2#9#5'Width'#2'9'#18'BorderSpacing.Left'#2#6#7'Caption'
|
||||
+#6#11'Expression:'#11'ParentColor'#8#0#0#6'TLabel'#11'lblRepCount'#22'Anchor'
|
||||
+'SideLeft.Control'#7#5'Owner'#21'AnchorSideTop.Control'#7#11'txtRepCount'#18
|
||||
+'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#13#3'Top'#2'('#5
|
||||
+'Width'#2'P'#18'BorderSpacing.Left'#2#6#7'Caption'#6#13'Repeat Count:'#11'Pa'
|
||||
+'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#2#6#6'Height'#2#14#3'Top'#2'$'#5
|
||||
+'Width'#2'H'#18'BorderSpacing.Left'#2#6#7'Caption'#6#13'Repeat Count:'#11'Pa'
|
||||
+'rentColor'#8#0#0#6'TLabel'#9'lblDigits'#22'AnchorSideLeft.Control'#7#11'txt'
|
||||
+'RepCount'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21'AnchorSideTop.Control'#7
|
||||
+#9'txtDigits'#18'AnchorSideTop.Side'#7#9'asrCenter'#4'Left'#3#171#0#6'Height'
|
||||
+#2#13#3'Top'#2'('#5'Width'#2'#'#18'BorderSpacing.Left'#2#6#7'Caption'#6#7'Di'
|
||||
+#2#14#3'Top'#2'$'#5'Width'#2#31#18'BorderSpacing.Left'#2#6#7'Caption'#6#7'Di'
|
||||
+'gits:'#11'ParentColor'#8#0#0#5'TEdit'#13'txtExpression'#21'AnchorSideTop.Co'
|
||||
+'ntrol'#7#5'Owner'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight'
|
||||
+'.Side'#7#9'asrBottom'#4'Left'#2'i'#6'Height'#2#23#3'Top'#2#6#5'Width'#3'5'#1
|
||||
+'.Side'#7#9'asrBottom'#4'Left'#2'i'#6'Height'#2#21#3'Top'#2#6#5'Width'#3'5'#1
|
||||
+#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#17'BorderSpacing.Top'#2#6#19
|
||||
+'BorderSpacing.Right'#2#6#8'TabOrder'#2#1#0#0#5'TEdit'#11'txtRepCount'#21'An'
|
||||
+'chorSideTop.Control'#7#13'txtExpression'#18'AnchorSideTop.Side'#7#9'asrBott'
|
||||
+'om'#4'Left'#2'i'#6'Height'#2#23#3'Top'#2'#'#5'Width'#2'<'#17'BorderSpacing.'
|
||||
+'om'#4'Left'#2'i'#6'Height'#2#21#3'Top'#2'!'#5'Width'#2'<'#17'BorderSpacing.'
|
||||
+'Top'#2#6#8'TabOrder'#2#2#4'Text'#6#1'0'#0#0#5'TEdit'#9'txtDigits'#22'Anchor'
|
||||
+'SideLeft.Control'#7#9'lblDigits'#19'AnchorSideLeft.Side'#7#9'asrBottom'#21
|
||||
+'AnchorSideTop.Control'#7#13'txtExpression'#18'AnchorSideTop.Side'#7#9'asrBo'
|
||||
+'ttom'#4'Left'#3#212#0#6'Height'#2#23#3'Top'#2'#'#5'Width'#2'<'#18'BorderSpa'
|
||||
+'ttom'#4'Left'#3#208#0#6'Height'#2#21#3'Top'#2'!'#5'Width'#2'<'#18'BorderSpa'
|
||||
+'cing.Left'#2#6#17'BorderSpacing.Top'#2#6#8'TabOrder'#2#4#4'Text'#6#1'0'#0#0
|
||||
+#9'TCheckBox'#10'chkEnabled'#22'AnchorSideLeft.Control'#7#5'Owner'#21'Anchor'
|
||||
+'SideTop.Control'#7#12'chkAllowFunc'#4'Left'#2#6#6'Height'#2#20#3'Top'#2'@'#5
|
||||
+'Width'#2'F'#11'AllowGrayed'#9#18'BorderSpacing.Left'#2#6#7'Caption'#6#7'Ena'
|
||||
+'SideTop.Control'#7#12'chkAllowFunc'#4'Left'#2#6#6'Height'#2#17#3'Top'#2'<'#5
|
||||
+'Width'#2'8'#11'AllowGrayed'#9#18'BorderSpacing.Left'#2#6#7'Caption'#6#7'Ena'
|
||||
+'bled'#8'TabOrder'#2#5#0#0#9'TCheckBox'#12'chkAllowFunc'#21'AnchorSideTop.Co'
|
||||
+'ntrol'#7#11'txtRepCount'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2'i'
|
||||
+#6'Height'#2#20#3'Top'#2'@'#5'Width'#3#140#0#11'AllowGrayed'#9#17'BorderSpac'
|
||||
+'ing.Top'#2#6#7'Caption'#6#20'Allow Function Calls'#8'TabOrder'#2#0#0#0#11'T'
|
||||
+'RadioGroup'#7'rgStyle'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideT'
|
||||
+'op.Control'#7#12'chkAllowFunc'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'Anc'
|
||||
+'horSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4
|
||||
+'Left'#2#6#6'Height'#2'N'#3'Top'#2'Z'#5'Width'#3#152#1#7'Anchors'#11#5'akTop'
|
||||
+#6'akLeft'#7'akRight'#0#8'AutoFill'#9#18'BorderSpacing.Left'#2#6#17'BorderSp'
|
||||
+'acing.Top'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#5'Style'#28'ChildSi'
|
||||
+'zing.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSiz'
|
||||
+'ing.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.Enlarg'
|
||||
+'eVertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7
|
||||
+#6'Height'#2#17#3'Top'#2'<'#5'Width'#2'p'#11'AllowGrayed'#9#17'BorderSpacing'
|
||||
+'.Top'#2#6#7'Caption'#6#20'Allow Function Calls'#8'TabOrder'#2#0#0#0#11'TRad'
|
||||
+'ioGroup'#7'rgStyle'#22'AnchorSideLeft.Control'#7#5'Owner'#21'AnchorSideTop.'
|
||||
+'Control'#7#12'chkAllowFunc'#18'AnchorSideTop.Side'#7#9'asrBottom'#23'Anchor'
|
||||
+'SideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Lef'
|
||||
+'t'#2#6#6'Height'#2'N'#3'Top'#2'S'#5'Width'#3#152#1#7'Anchors'#11#5'akTop'#6
|
||||
+'akLeft'#7'akRight'#0#8'AutoFill'#9#18'BorderSpacing.Left'#2#6#17'BorderSpac'
|
||||
+'ing.Top'#2#6#19'BorderSpacing.Right'#2#6#7'Caption'#6#5'Style'#28'ChildSizi'
|
||||
+'ng.LeftRightSpacing'#2#6#28'ChildSizing.TopBottomSpacing'#2#6#29'ChildSizin'
|
||||
+'g.EnlargeHorizontal'#7#24'crsHomogenousChildResize'#27'ChildSizing.EnlargeV'
|
||||
+'ertical'#7#24'crsHomogenousChildResize'#28'ChildSizing.ShrinkHorizontal'#7
|
||||
+#14'crsScaleChilds'#26'ChildSizing.ShrinkVertical'#7#14'crsScaleChilds'#18'C'
|
||||
+'hildSizing.Layout'#7#29'cclLeftToRightThenTopToBottom'#27'ChildSizing.Contr'
|
||||
+'olsPerLine'#2#3#12'ClientHeight'#2'='#11'ClientWidth'#3#148#1#7'Columns'#2#3
|
||||
+'olsPerLine'#2#3#12'ClientHeight'#2'<'#11'ClientWidth'#3#148#1#7'Columns'#2#3
|
||||
+#9'ItemIndex'#2#7#13'Items.Strings'#1#6#9'Character'#6#6'String'#6#7'Decimal'
|
||||
+#6#11'Hexadecimal'#6#14'Floating Point'#6#7'Pointer'#6#16'Record/Structure'#6
|
||||
+#7'Default'#6#11'Memory Dump'#0#8'TabOrder'#2#3#0#0#12'TButtonPanel'#11'Butt'
|
||||
+'onPanel'#21'AnchorSideTop.Control'#7#7'rgStyle'#18'AnchorSideTop.Side'#7#9
|
||||
+'asrBottom'#4'Left'#2#6#6'Height'#2#30#3'Top'#3#174#0#5'Width'#3#152#1#5'Ali'
|
||||
+'gn'#7#8'alBottom'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0
|
||||
+#8'AutoSize'#9#8'TabOrder'#2#6#11'ShowButtons'#11#4'pbOK'#8'pbCancel'#6'pbHe'
|
||||
+'lp'#0#9'ShowBevel'#8#0#0#0
|
||||
+'asrBottom'#4'Left'#2#6#6'Height'#2'%'#3'Top'#3#167#0#5'Width'#3#152#1#7'Anc'
|
||||
+'hors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'TabOrder'#2#6#11'Sho'
|
||||
+'wButtons'#11#4'pbOK'#8'pbCancel'#6'pbHelp'#0#9'ShowBevel'#8#0#0#0
|
||||
]);
|
||||
|
@ -63,7 +63,7 @@ type
|
||||
private
|
||||
FWatch: TIDEWatch;
|
||||
public
|
||||
constructor Create(AOWner: TComponent; const AWatch: TIDEWatch); overload;
|
||||
constructor Create(AOWner: TComponent; const AWatch: TIDEWatch; const AWatchExpression: String = ''); overload;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
@ -91,13 +91,15 @@ begin
|
||||
ShowContextHelpForIDE(Self);
|
||||
end;
|
||||
|
||||
constructor TWatchPropertyDlg.Create(AOwner: TComponent; const AWatch: TIDEWatch);
|
||||
constructor TWatchPropertyDlg.Create(AOwner: TComponent; const AWatch: TIDEWatch;
|
||||
const AWatchExpression: String = '');
|
||||
begin
|
||||
FWatch := AWatch;
|
||||
inherited Create(AOwner);
|
||||
if FWatch = nil
|
||||
then begin
|
||||
chkEnabled.Checked := True;
|
||||
txtExpression.Text := AWatchExpression;
|
||||
end
|
||||
else begin
|
||||
txtExpression.Text := FWatch.Expression;
|
||||
|
@ -121,7 +121,7 @@ type
|
||||
): TModalResult; virtual; abstract;
|
||||
|
||||
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; virtual; abstract;
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch): TModalresult; virtual; abstract;
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; virtual; abstract;
|
||||
|
||||
public
|
||||
property Commands: TDBGCommands read GetCommands; // All current available commands of the debugger
|
||||
|
@ -181,7 +181,7 @@ type
|
||||
const ASourceMark: TSourceMark): TModalResult; override;
|
||||
|
||||
function ShowBreakPointProperties(const ABreakpoint: TIDEBreakPoint): TModalresult; override;
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch): TModalresult; override;
|
||||
function ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -1330,12 +1330,15 @@ begin
|
||||
if Assigned(SE) then
|
||||
begin
|
||||
WatchVar := SE.GetOperandAtCurrentCaret;
|
||||
if (WatchVar <> '') and (SE.EditorComponent.Focused) and (Watches.Find(WatchVar) = nil) and (Watches.Add(WatchVar) = nil) then
|
||||
Exit;
|
||||
if (WatchVar <> '') and SE.EditorComponent.Focused then
|
||||
begin
|
||||
if (Watches.Find(WatchVar) <> nil) or (Watches.Add(WatchVar) <> nil) then
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
// watch was not added automatically => show a dialog
|
||||
// todo: dialog
|
||||
ShowWatchProperties(nil, WatchVar);
|
||||
end;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1938,8 +1941,7 @@ begin
|
||||
|
||||
itmRunMenuEvaluate.Enabled := (not DebuggerInvalid)
|
||||
and (dcEvaluate in FDebugger.Commands);
|
||||
itmRunMenuAddWatch.Enabled := (not DebuggerInvalid)
|
||||
and (dcWatch in FDebugger.Commands);
|
||||
itmRunMenuAddWatch.Enabled := True; // always allow to add a watch
|
||||
// TODO: add other debugger menuitems
|
||||
// TODO: implement by actions
|
||||
end;
|
||||
@ -2480,9 +2482,9 @@ begin
|
||||
Result := TBreakPropertyDlg.Create(Self, ABreakpoint).ShowModal;
|
||||
end;
|
||||
|
||||
function TDebugManager.ShowWatchProperties(const AWatch: TIDEWatch): TModalresult;
|
||||
function TDebugManager.ShowWatchProperties(const AWatch: TIDEWatch; AWatchExpression: String = ''): TModalresult;
|
||||
begin
|
||||
Result := TWatchPropertyDlg.Create(Self, AWatch).ShowModal;
|
||||
Result := TWatchPropertyDlg.Create(Self, AWatch, AWatchExpression).ShowModal;
|
||||
end;
|
||||
|
||||
procedure TDebugManager.SetDebugger(const ADebugger: TDebugger);
|
||||
|
Loading…
Reference in New Issue
Block a user