View Issue Details

IDProjectCategoryView StatusLast Update
0034544LazarusIDEpublic2018-11-12 20:00
Reportersilvioprog Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.1 (SVN) 
Target Version2.2Fixed in Version2.2 
Summary0034544: [PATCH] registers window: allows to copy a register name+value or all listed registers
DescriptionHi.

Some times we need to copy a register name and its value or all listed registers. For example, supposing you are debugging an assembly code in a step by step debugging, after applying this patch you can copy all listed registers (name+value) to check them in a diff tool.
Steps To ReproduceJust apply the patch and rebuild your IDE.
TagsNo tags attached.
Fixed in Revision59529
LazTarget2.2
Widgetset
Attached Files

Activities

silvioprog

2018-11-12 19:13

reporter  

0001-ide-allows-to-copy-a-register-name-value-or-all-regi.patch (5,847 bytes)   
From f75ff9dbe81f7400a74e95cc3c528ac2be79e850 Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Mon, 12 Nov 2018 16:03:07 -0300
Subject: [PATCH 1/1] [ide] allows to copy a register name+value or all
 registers. (patch by silvioprog)

---
 debugger/registersdlg.lfm   | 45 +++++++++++++++++++++++++------------
 debugger/registersdlg.pp    | 33 +++++++++++++++++++++++++++
 ide/lazarusidestrconsts.pas |  2 ++
 3 files changed, 66 insertions(+), 14 deletions(-)

diff --git a/debugger/registersdlg.lfm b/debugger/registersdlg.lfm
index 86e380cf10..d5256152ca 100644
--- a/debugger/registersdlg.lfm
+++ b/debugger/registersdlg.lfm
@@ -8,7 +8,8 @@ inherited RegistersDlg: TRegistersDlg
   Caption = 'Registers'
   ClientHeight = 253
   ClientWidth = 346
-  object lvRegisters: TListView[0]
+  LCLVersion = '2.1.0.0'
+  object lvRegisters: TListView
     Left = 0
     Height = 227
     Top = 26
@@ -31,7 +32,7 @@ inherited RegistersDlg: TRegistersDlg
     ViewStyle = vsReport
     OnSelectItem = lvRegistersSelectItem
   end
-  object ToolBar1: TToolBar[1]
+  object ToolBar1: TToolBar
     Left = 0
     Height = 26
     Top = 0
@@ -67,11 +68,11 @@ inherited RegistersDlg: TRegistersDlg
       Style = tbsDropDown
     end
   end
-  object ImageList1: TImageList[2]
+  object ImageList1: TImageList
     Height = 8
     Width = 8
-    left = 112
-    top = 93
+    Left = 112
+    Top = 93
     Bitmap = {
       4C69010000000800000008000000000000000000000000000000000000000000
       000000000000000000000000000000000000000000005CDD8AFF33D56FFF65DE
@@ -84,9 +85,9 @@ inherited RegistersDlg: TRegistersDlg
       0000000000000000000000000000
     }
   end
-  object ActionList1: TActionList[3]
-    left = 200
-    top = 112
+  object ActionList1: TActionList
+    Left = 200
+    Top = 112
     object actPower: TAction
       OnExecute = actPowerExecute
     end
@@ -100,10 +101,20 @@ inherited RegistersDlg: TRegistersDlg
       Caption = 'actCopyValue'
       OnExecute = actCopyValueExecute
     end
+    object actCopyNameValue: TAction
+      Category = 'copy'
+      Caption = 'actCopyNameValue'
+      OnExecute = actCopyNameValueExecute
+    end
+    object actCopyAll: TAction
+      Category = 'copy'
+      Caption = 'actCopyAll'
+      OnExecute = actCopyAllExecute
+    end
   end
-  object PopupDispType: TPopupMenu[4]
-    left = 200
-    top = 176
+  object PopupDispType: TPopupMenu
+    Left = 200
+    Top = 176
     object DispDefault: TMenuItem
       Caption = 'New Item1'
       OnClick = DispDefaultClick
@@ -129,9 +140,9 @@ inherited RegistersDlg: TRegistersDlg
       OnClick = DispDefaultClick
     end
   end
-  object PopupMenu1: TPopupMenu[5]
-    left = 95
-    top = 178
+  object PopupMenu1: TPopupMenu
+    Left = 95
+    Top = 178
     object popFormat: TMenuItem
       Caption = 'New Item1'
       object PopDispDefault: TMenuItem
@@ -168,5 +179,11 @@ inherited RegistersDlg: TRegistersDlg
     object popCopyValue: TMenuItem
       Action = actCopyValue
     end
+    object popCopyNameValue: TMenuItem
+      Action = actCopyNameValue
+    end
+    object popCopyAll: TMenuItem
+      Action = actCopyAll
+    end
   end
 end
diff --git a/debugger/registersdlg.pp b/debugger/registersdlg.pp
index c2b5b5bc11..adca36cb5c 100644
--- a/debugger/registersdlg.pp
+++ b/debugger/registersdlg.pp
@@ -48,6 +48,8 @@ type
   TRegistersDlg = class(TDebuggerDlg)
     actCopyName: TAction;
     actCopyValue: TAction;
+    actCopyNameValue: TAction;
+    actCopyAll: TAction;
     actPower: TAction;
     ActionList1: TActionList;
     ImageList1: TImageList;
@@ -58,6 +60,8 @@ type
     DispOct: TMenuItem;
     DispDec: TMenuItem;
     DispRaw: TMenuItem;
+    popCopyAll: TMenuItem;
+    popCopyNameValue: TMenuItem;
     PopDispDefault: TMenuItem;
     PopDispHex: TMenuItem;
     PopDispBin: TMenuItem;
@@ -74,7 +78,9 @@ type
     ToolButton1: TToolButton;
     ToolButtonDispType: TToolButton;
     ToolButtonPower: TToolButton;
+    procedure actCopyAllExecute(Sender: TObject);
     procedure actCopyNameExecute(Sender: TObject);
+    procedure actCopyNameValueExecute(Sender: TObject);
     procedure actCopyValueExecute(Sender: TObject);
     procedure actPowerExecute(Sender: TObject);
     procedure DispDefaultClick(Sender: TObject);
@@ -153,6 +159,8 @@ begin
 
   actCopyName.Caption := lisLocalsDlgCopyName;
   actCopyValue.Caption := lisLocalsDlgCopyValue;
+  actCopyNameValue.Caption := lisLocalsDlgCopyNameValue;
+  actCopyAll.Caption := lisLocalsDlgCopyAll;
 
   ToolButtonDispType.Hint := regdlgDisplayTypeForSelectedRegisters;
 
@@ -224,6 +232,31 @@ begin
   Clipboard.Close;
 end;
 
+procedure TRegistersDlg.actCopyNameValueExecute(Sender: TObject);
+begin
+  Clipboard.Open;
+  Clipboard.AsText := Concat(lvRegisters.Selected.Caption, '=',
+    lvRegisters.Selected.SubItems[0]);
+  Clipboard.Close;
+end;
+
+procedure TRegistersDlg.actCopyAllExecute(Sender: TObject);
+var
+  T: string;
+  I: Integer;
+  LI: TListItem;
+begin
+  Clipboard.Open;
+  T := '';
+  for I := 0 to Pred(lvRegisters.Items.Count) do
+  begin
+    LI := lvRegisters.Items[I];
+    T := Concat(T, LI.Caption, '=', LI.SubItems[0], sLineBreak);
+  end;
+  Clipboard.AsText := T;
+  Clipboard.Close;
+end;
+
 procedure TRegistersDlg.DispDefaultClick(Sender: TObject);
 var
   n: Integer;
diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas
index 13237cb9d0..c6836bf5ca 100644
--- a/ide/lazarusidestrconsts.pas
+++ b/ide/lazarusidestrconsts.pas
@@ -5529,6 +5529,8 @@ resourcestring
   lisEvaluateModify = '&Evaluate/Modify';
   lisLocalsDlgCopyName = '&Copy Name';
   lisLocalsDlgCopyValue = 'C&opy Value';
+  lisLocalsDlgCopyNameValue = 'Co&py Name and Value';
+  lisLocalsDlgCopyAll = 'Copy &all';
   lisLocalsDlgCopyRAWValue = 'Copy &RAW Value';
 
   // Registers Dialog
-- 
2.17.1

silvioprog

2018-11-12 19:32

reporter  

0003-ide-improves-patch-0001-from-34544.-patch-by-silviop.patch (1,815 bytes)   
From 2814b32528c38eec3cd151739e0b33c1e730df83 Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Mon, 12 Nov 2018 16:27:40 -0300
Subject: [PATCH 1/1] [ide] improves patch 0001 from #34544. (patch by
 silvioprog)

---
 debugger/registersdlg.lfm | 5 +++++
 debugger/registersdlg.pp  | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/debugger/registersdlg.lfm b/debugger/registersdlg.lfm
index d5256152ca..546a858f4a 100644
--- a/debugger/registersdlg.lfm
+++ b/debugger/registersdlg.lfm
@@ -89,26 +89,31 @@ inherited RegistersDlg: TRegistersDlg
     Left = 200
     Top = 112
     object actPower: TAction
+      Enabled = False
       OnExecute = actPowerExecute
     end
     object actCopyName: TAction
       Category = 'copy'
       Caption = 'actCopyName'
+      Enabled = False
       OnExecute = actCopyNameExecute
     end
     object actCopyValue: TAction
       Category = 'copy'
       Caption = 'actCopyValue'
+      Enabled = False
       OnExecute = actCopyValueExecute
     end
     object actCopyNameValue: TAction
       Category = 'copy'
       Caption = 'actCopyNameValue'
+      Enabled = False
       OnExecute = actCopyNameValueExecute
     end
     object actCopyAll: TAction
       Category = 'copy'
       Caption = 'actCopyAll'
+      Enabled = False
       OnExecute = actCopyAllExecute
     end
   end
diff --git a/debugger/registersdlg.pp b/debugger/registersdlg.pp
index adca36cb5c..acc33c8c32 100644
--- a/debugger/registersdlg.pp
+++ b/debugger/registersdlg.pp
@@ -315,6 +315,8 @@ begin
   popFormat.Enabled := j > 0;
   actCopyName.Enabled := j > 0;
   actCopyValue.Enabled := j > 0;
+  actCopyNameValue.Enabled := j > 0;
+  actCopyAll.Enabled := lvRegisters.Items.Count > 0;
 
   PopDispDefault.Checked := False;
   PopDispHex.Checked := False;
-- 
2.17.1

silvioprog

2018-11-12 19:34

reporter   ~0111939

Sorry, damn browser caching. -.- Please delete patch 0002 and apply only 0001 and 0003. Thank you!

Martin Friebe

2018-11-12 19:36

manager   ~0111940

Last edited: 2018-11-12 19:36

View 2 revisions

It appears twice the same patch?

Should I apply it, or wait for whatever is missing in patch 2? (Or better one combined patch)

--
solved

silvioprog

2018-11-12 20:00

reporter   ~0111941

Thanks a lot for applying dude! :-)

Issue History

Date Modified Username Field Change
2018-11-12 19:13 silvioprog New Issue
2018-11-12 19:13 silvioprog File Added: 0001-ide-allows-to-copy-a-register-name-value-or-all-regi.patch
2018-11-12 19:29 silvioprog File Added: 0002-ide-allows-to-copy-a-register-name-value-or-all-regi.patch
2018-11-12 19:32 Martin Friebe Assigned To => Martin Friebe
2018-11-12 19:32 Martin Friebe Status new => assigned
2018-11-12 19:32 silvioprog File Added: 0003-ide-improves-patch-0001-from-34544.-patch-by-silviop.patch
2018-11-12 19:34 silvioprog Note Added: 0111939
2018-11-12 19:36 Martin Friebe Note Added: 0111940
2018-11-12 19:36 Martin Friebe Note Edited: 0111940 View Revisions
2018-11-12 19:37 Martin Friebe File Deleted: 0002-ide-allows-to-copy-a-register-name-value-or-all-regi.patch
2018-11-12 19:46 Martin Friebe Fixed in Revision => 59529
2018-11-12 19:46 Martin Friebe LazTarget => 2.2
2018-11-12 19:46 Martin Friebe Status assigned => resolved
2018-11-12 19:46 Martin Friebe Resolution open => fixed
2018-11-12 19:48 Martin Friebe Fixed in Version => 2.2
2018-11-12 19:48 Martin Friebe Target Version => 2.2
2018-11-12 20:00 silvioprog Note Added: 0111941
2018-11-12 20:00 silvioprog Status resolved => closed