diff --git a/debugger/inspectdlg.lfm b/debugger/inspectdlg.lfm index 753b567a63..a6c3230c90 100644 --- a/debugger/inspectdlg.lfm +++ b/debugger/inspectdlg.lfm @@ -154,5 +154,18 @@ object IDEInspectDlg: TIDEInspectDlg Caption = 'ToolButton4' Style = tbsDivider end + object BtnAddWatch: TToolButton + Left = 188 + Top = 2 + Caption = 'Add Watch' + OnClick = BtnAddWatchClick + end + object ToolButton3: TToolButton + Left = 180 + Height = 22 + Top = 2 + Caption = 'ToolButton3' + Style = tbsSeparator + end end end diff --git a/debugger/inspectdlg.pas b/debugger/inspectdlg.pas index c9ed102705..54d0cddda3 100644 --- a/debugger/inspectdlg.pas +++ b/debugger/inspectdlg.pas @@ -60,12 +60,15 @@ type ToolBar1: TToolBar; btnUseInstance: TToolButton; btnBackward: TToolButton; + BtnAddWatch: TToolButton; ToolButton2: TToolButton; btnColClass: TToolButton; btnColType: TToolButton; btnColVisibility: TToolButton; btnForward: TToolButton; + ToolButton3: TToolButton; ToolButton4: TToolButton; + procedure BtnAddWatchClick(Sender: TObject); procedure btnBackwardClick(Sender: TObject); procedure btnColClassClick(Sender: TObject); procedure btnForwardClick(Sender: TObject); @@ -300,6 +303,27 @@ begin GotoHistory(FHistoryIndex - 1); end; +procedure TIDEInspectDlg.BtnAddWatchClick(Sender: TObject); +var + w: TCurrentWatch; +begin + if DebugBoss = nil then + exit; + DebugBoss.Watches.CurrentWatches.BeginUpdate; + try + w := DebugBoss.Watches.CurrentWatches.Find(FExpression); + if w = nil then + w := DebugBoss.Watches.CurrentWatches.Add(FExpression); + if (w <> nil) then begin + w.Enabled := True; + DebugBoss.ViewDebugDialog(ddtWatches, False); + end; + finally + DebugBoss.Watches.CurrentWatches.EndUpdate; + end; + +end; + procedure TIDEInspectDlg.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if (Key = VK_ESCAPE) and not Docked then @@ -797,6 +821,7 @@ begin btnBackward.Caption := ''; btnForward.ImageIndex := IDEImages.LoadImage('arrow_right'); btnForward.Caption := ''; + BtnAddWatch.Caption:=lisInspectAddWatch; btnUseInstance.Enabled := False; btnColClass.Enabled := False; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 2420981512..36c6fe94d7 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -559,6 +559,7 @@ resourcestring lisInspectClassInherit = '%s: class %s inherits from %s'; lisInspectUnavailableError = '%s: unavailable (error: %s)'; lisInspectPointerTo = 'Pointer to %s'; + lisInspectAddWatch = 'Add watch'; lisColClass = 'Class'; lisColVisibility = 'Visibility'; lisColReturns = 'Returns';