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