mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-03 13:58:18 +02:00
IDE: Locals Dialog: add evaluate all menu item
git-svn-id: trunk@62983 -
This commit is contained in:
parent
8050fccc64
commit
e52c398bbc
@ -10,7 +10,7 @@ object LocalsDlg: TLocalsDlg
|
||||
Caption = 'Locals'
|
||||
ClientHeight = 200
|
||||
ClientWidth = 500
|
||||
LCLVersion = '1.7'
|
||||
LCLVersion = '2.1.0.0'
|
||||
object lvLocals: TListView
|
||||
Left = 0
|
||||
Height = 200
|
||||
@ -34,8 +34,8 @@ object LocalsDlg: TLocalsDlg
|
||||
ViewStyle = vsReport
|
||||
end
|
||||
object ActionList1: TActionList
|
||||
left = 152
|
||||
top = 80
|
||||
Left = 152
|
||||
Top = 80
|
||||
object actInspect: TAction
|
||||
Category = 'main'
|
||||
Caption = 'actInspect'
|
||||
@ -81,10 +81,17 @@ object LocalsDlg: TLocalsDlg
|
||||
OnExecute = actCopyRAWValueExecute
|
||||
OnUpdate = actInspectUpdate
|
||||
end
|
||||
object actEvaluateAll: TAction
|
||||
Category = 'main'
|
||||
Caption = 'actEvaluateAll'
|
||||
OnExecute = actEvaluateAllExecute
|
||||
OnUpdate = actCopyAllUpdate
|
||||
ShortCut = 16466
|
||||
end
|
||||
end
|
||||
object PopupMenu1: TPopupMenu
|
||||
left = 38
|
||||
top = 75
|
||||
Left = 38
|
||||
Top = 75
|
||||
object MenuItem1: TMenuItem
|
||||
Action = actInspect
|
||||
end
|
||||
@ -94,6 +101,9 @@ object LocalsDlg: TLocalsDlg
|
||||
object MenuItem3: TMenuItem
|
||||
Action = actEvaluate
|
||||
end
|
||||
object MenuItem9: TMenuItem
|
||||
Action = actEvaluateAll
|
||||
end
|
||||
object MenuItem4: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
|
@ -51,6 +51,7 @@ type
|
||||
actCopyValue: TAction;
|
||||
actCopyAll: TAction;
|
||||
actCopyRAWValue: TAction;
|
||||
actEvaluateAll: TAction;
|
||||
actWath: TAction;
|
||||
ActionList1: TActionList;
|
||||
lvLocals: TListView;
|
||||
@ -62,11 +63,13 @@ type
|
||||
MenuItem6: TMenuItem;
|
||||
MenuItem7: TMenuItem;
|
||||
MenuItem8: TMenuItem;
|
||||
MenuItem9: TMenuItem;
|
||||
PopupMenu1: TPopupMenu;
|
||||
procedure actCopyAllExecute(Sender: TObject);
|
||||
procedure actCopyAllUpdate(Sender: TObject);
|
||||
procedure actCopyNameExecute(Sender: TObject);
|
||||
procedure actCopyValueExecute(Sender: TObject);
|
||||
procedure actEvaluateAllExecute(Sender: TObject);
|
||||
procedure actEvaluateExecute(Sender: TObject);
|
||||
procedure actInspectExecute(Sender: TObject);
|
||||
procedure actInspectUpdate(Sender: TObject);
|
||||
@ -74,10 +77,13 @@ type
|
||||
procedure actWathExecute(Sender: TObject);
|
||||
private
|
||||
FUpdateFlags: set of (ufNeedUpdating);
|
||||
EvaluateAllCallbackCaption: string;
|
||||
procedure CopyRAWValueEvaluateCallback(Sender: TObject; ASuccess: Boolean;
|
||||
ResultText: String; ResultDBGType: TDBGType);
|
||||
procedure CopyValueEvaluateCallback(Sender: TObject; ASuccess: Boolean;
|
||||
ResultText: String; ResultDBGType: TDBGType);
|
||||
procedure EvaluateAllCallback(Sender: TObject; ASuccess: Boolean;
|
||||
ResultText: String; ResultDBGType: TDBGType);
|
||||
|
||||
procedure LocalsChanged(Sender: TObject);
|
||||
function GetThreadId: Integer;
|
||||
@ -98,6 +104,7 @@ type
|
||||
end;
|
||||
|
||||
function ValueToRAW(const AValue: string): string;
|
||||
function ExtractValue(const AValue, AType: string): string;
|
||||
|
||||
implementation
|
||||
|
||||
@ -221,6 +228,19 @@ begin
|
||||
ProcessOther;
|
||||
end;
|
||||
|
||||
function ExtractValue(const AValue, AType: string): string;
|
||||
var
|
||||
StringStart: SizeInt;
|
||||
begin
|
||||
Result := AValue;
|
||||
if (StringCase(Lowercase(AType), ['^char', '^widechar'])>=0) then
|
||||
begin
|
||||
StringStart := Pos('''', Result);
|
||||
if StringStart>0 then
|
||||
Delete(Result, 1, StringStart-1);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TLocalsDlg }
|
||||
|
||||
constructor TLocalsDlg.Create(AOwner: TComponent);
|
||||
@ -239,6 +259,7 @@ begin
|
||||
actInspect.Caption := lisInspect;
|
||||
actWath.Caption := lisWatch;
|
||||
actEvaluate.Caption := lisEvaluateModify;
|
||||
actEvaluateAll.Caption := lisEvaluateAll;
|
||||
actCopyName.Caption := lisLocalsDlgCopyName;
|
||||
actCopyValue.Caption := lisLocalsDlgCopyValue;
|
||||
actCopyRAWValue.Caption := lisLocalsDlgCopyRAWValue;
|
||||
@ -325,6 +346,17 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.actEvaluateAllExecute(Sender: TObject);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
for I := 0 to lvLocals.Items.Count-1 do
|
||||
begin
|
||||
EvaluateAllCallbackCaption := lvLocals.Items[I].Caption;
|
||||
DebugBoss.Evaluate(EvaluateAllCallbackCaption, @EvaluateAllCallback, []);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.LocalsChanged(Sender: TObject);
|
||||
var
|
||||
n, idx: Integer;
|
||||
@ -482,6 +514,21 @@ begin
|
||||
lvLocals.EndUpdate;
|
||||
end;
|
||||
|
||||
procedure TLocalsDlg.EvaluateAllCallback(Sender: TObject; ASuccess: Boolean;
|
||||
ResultText: String; ResultDBGType: TDBGType);
|
||||
var
|
||||
Item: TListItem;
|
||||
begin
|
||||
if ASuccess then
|
||||
begin
|
||||
ResultText := ExtractValue(ResultText, ResultDBGType.TypeName);
|
||||
Item := lvLocals.Items.FindCaption(0, EvaluateAllCallbackCaption, False, True, False, False);
|
||||
if Assigned(Item) then
|
||||
Item.SubItems[0] := ResultText+' ('+ResultDBGType.Value.AsString+')'; // xxx
|
||||
end;
|
||||
FreeAndNil(ResultDBGType);
|
||||
end;
|
||||
|
||||
function TLocalsDlg.ColSizeGetter(AColId: Integer; var ASize: Integer): Boolean;
|
||||
begin
|
||||
if (AColId - 1 >= 0) and (AColId - 1 < lvLocals.ColumnCount) then begin
|
||||
@ -502,20 +549,11 @@ end;
|
||||
|
||||
procedure TLocalsDlg.CopyRAWValueEvaluateCallback(Sender: TObject;
|
||||
ASuccess: Boolean; ResultText: String; ResultDBGType: TDBGType);
|
||||
var
|
||||
StringStart: SizeInt;
|
||||
begin
|
||||
Clipboard.Open;
|
||||
if ASuccess then
|
||||
begin
|
||||
if (StringCase(Lowercase(ResultDBGType.TypeName), ['^char', '^widechar'])>=0) then
|
||||
begin
|
||||
StringStart := Pos('''', ResultText);
|
||||
if StringStart>0 then
|
||||
Delete(ResultText, 1, StringStart-1);
|
||||
end;
|
||||
Clipboard.AsText := ValueToRAW(ResultText);
|
||||
end else
|
||||
Clipboard.AsText := ValueToRAW(ExtractValue(ResultText, ResultDBGType.TypeName))
|
||||
else
|
||||
Clipboard.AsText := ValueToRAW(lvLocals.Selected.SubItems[0]);
|
||||
Clipboard.Close;
|
||||
FreeAndNil(ResultDBGType);
|
||||
@ -523,20 +561,11 @@ end;
|
||||
|
||||
procedure TLocalsDlg.CopyValueEvaluateCallback(Sender: TObject;
|
||||
ASuccess: Boolean; ResultText: String; ResultDBGType: TDBGType);
|
||||
var
|
||||
StringStart: SizeInt;
|
||||
begin
|
||||
Clipboard.Open;
|
||||
if ASuccess then
|
||||
begin
|
||||
if (StringCase(Lowercase(ResultDBGType.TypeName), ['^char', '^widechar'])>=0) then
|
||||
begin
|
||||
StringStart := Pos('''', ResultText);
|
||||
if StringStart>0 then
|
||||
Delete(ResultText, 1, StringStart-1);
|
||||
end;
|
||||
Clipboard.AsText := ResultText;
|
||||
end else
|
||||
Clipboard.AsText := ExtractValue(ResultText, ResultDBGType.TypeName)
|
||||
else
|
||||
Clipboard.AsText := lvLocals.Selected.SubItems[0];
|
||||
Clipboard.Close;
|
||||
FreeAndNil(ResultDBGType);
|
||||
|
@ -5650,6 +5650,7 @@ resourcestring
|
||||
lisLocals = 'Local Variables';
|
||||
lisLocalsNotEvaluated = 'Locals not evaluated';
|
||||
lisEvaluateModify = '&Evaluate/Modify';
|
||||
lisEvaluateAll = 'Evaluate all';
|
||||
lisLocalsDlgCopyName = '&Copy Name';
|
||||
lisLocalsDlgCopyValue = 'C&opy Value';
|
||||
lisLocalsDlgCopyNameValue = 'Co&py Name and Value';
|
||||
|
Loading…
Reference in New Issue
Block a user