IDE, Debugger: reduce calls to Update when adding a watch.

git-svn-id: trunk@63649 -
This commit is contained in:
martin 2020-07-24 22:39:06 +00:00
parent 16b3c7f07b
commit b208794e24
5 changed files with 68 additions and 38 deletions

View File

@ -380,8 +380,13 @@ begin
S := cmbExpression.Text;
if DebugBoss.Watches.CurrentWatches.Find(S) = nil
then begin
Watch := DebugBoss.Watches.CurrentWatches.Add(S);
Watch.Enabled := True;
DebugBoss.Watches.CurrentWatches.BeginUpdate;
try
Watch := DebugBoss.Watches.CurrentWatches.Add(S);
Watch.Enabled := True;
finally
DebugBoss.Watches.CurrentWatches.EndUpdate;
end;
end;
DebugBoss.ViewDebugDialog(ddtWatches);
end;

View File

@ -311,8 +311,13 @@ begin
S := lvLocals.Selected.Caption;
if DebugBoss.Watches.CurrentWatches.Find(S) = nil then
begin
Watch := DebugBoss.Watches.CurrentWatches.Add(S);
Watch.Enabled := True;
DebugBoss.Watches.CurrentWatches.BeginUpdate;
try
Watch := DebugBoss.Watches.CurrentWatches.Add(S);
Watch.Enabled := True;
finally
DebugBoss.Watches.CurrentWatches.EndUpdate;
end;
end;
DebugBoss.ViewDebugDialog(ddtWatches);
end;

View File

@ -427,10 +427,15 @@ begin
if (Source is TCustomEdit) then s := TCustomEdit(Source).SelText;
if s <> '' then begin
NewWatch := DebugBoss.Watches.CurrentWatches.Add(s);
NewWatch.DisplayFormat := wdfDefault;
NewWatch.EvaluateFlags := [defClassAutoCast];
NewWatch.Enabled := True;
DebugBoss.Watches.CurrentWatches.BeginUpdate;
try
NewWatch := DebugBoss.Watches.CurrentWatches.Add(s);
NewWatch.DisplayFormat := wdfDefault;
NewWatch.EvaluateFlags := [defClassAutoCast];
NewWatch.Enabled := True;
finally
DebugBoss.Watches.CurrentWatches.EndUpdate;
end;
end;
end;
@ -456,10 +461,15 @@ begin
Key := 0;
s := Clipboard.AsText;
if s <> '' then begin
NewWatch := DebugBoss.Watches.CurrentWatches.Add(s);
NewWatch.DisplayFormat := wdfDefault;
NewWatch.EvaluateFlags := [defClassAutoCast];
NewWatch.Enabled := True;
DebugBoss.Watches.CurrentWatches.BeginUpdate;
try
NewWatch := DebugBoss.Watches.CurrentWatches.Add(s);
NewWatch.DisplayFormat := wdfDefault;
NewWatch.EvaluateFlags := [defClassAutoCast];
NewWatch.Enabled := True;
finally
DebugBoss.Watches.CurrentWatches.EndUpdate;
end;
end;
exit;

View File

@ -82,25 +82,30 @@ const
wdfStructure, wdfDefault, wdfMemDump, wdfBinary
);
begin
if FWatch = nil
then begin
FWatch := DebugBoss.Watches.CurrentWatches.Add(txtExpression.Text);
end
else begin
FWatch.Expression := txtExpression.Text;
DebugBoss.Watches.CurrentWatches.BeginUpdate;
try
if FWatch = nil
then begin
FWatch := DebugBoss.Watches.CurrentWatches.Add(txtExpression.Text);
end
else begin
FWatch.Expression := txtExpression.Text;
end;
if (rgStyle.ItemIndex >= low(StyleToDispFormat))
and (rgStyle.ItemIndex <= High(StyleToDispFormat))
then FWatch.DisplayFormat := StyleToDispFormat[rgStyle.ItemIndex]
else FWatch.DisplayFormat := wdfDefault;
if chkUseInstanceClass.Checked
then FWatch.EvaluateFlags := [defClassAutoCast]
else FWatch.EvaluateFlags := [];
FWatch.RepeatCount := StrToIntDef(txtRepCount.Text, 0);
FWatch.Enabled := chkEnabled.Checked;
finally
DebugBoss.Watches.CurrentWatches.EndUpdate;
end;
if (rgStyle.ItemIndex >= low(StyleToDispFormat))
and (rgStyle.ItemIndex <= High(StyleToDispFormat))
then FWatch.DisplayFormat := StyleToDispFormat[rgStyle.ItemIndex]
else FWatch.DisplayFormat := wdfDefault;
if chkUseInstanceClass.Checked
then FWatch.EvaluateFlags := [defClassAutoCast]
else FWatch.EvaluateFlags := [];
FWatch.RepeatCount := StrToIntDef(txtRepCount.Text, 0);
FWatch.Enabled := chkEnabled.Checked;
end;
procedure TWatchPropertyDlg.btnHelpClick(Sender: TObject);

View File

@ -1137,14 +1137,19 @@ begin
WatchVar := SE.GetOperandAtCurrentCaret;
if (WatchVar <> '') and SE.EditorComponent.Focused then
begin
w := Watches.CurrentWatches.Find(WatchVar);
if w = nil
then w := Watches.CurrentWatches.Add(WatchVar);
if (w <> nil)
then begin
w.Enabled := True;
ViewDebugDialog(ddtWatches, False);
Exit;
Watches.CurrentWatches.BeginUpdate;
try
w := Watches.CurrentWatches.Find(WatchVar);
if w = nil
then w := Watches.CurrentWatches.Add(WatchVar);
if (w <> nil)
then begin
w.Enabled := True;
ViewDebugDialog(ddtWatches, False);
Exit;
end;
finally
Watches.CurrentWatches.EndUpdate;
end;
end;
end;