DBG: Register Copy Name/Value to clipboard. Issue #0021860

git-svn-id: trunk@37106 -
This commit is contained in:
martin 2012-04-30 16:00:05 +00:00
parent 0ce265622c
commit cac7a2cac5
3 changed files with 138 additions and 18 deletions

View File

@ -23,11 +23,11 @@ inherited RegistersDlg: TRegistersDlg
Caption = 'Value'
end>
MultiSelect = True
PopupMenu = PopupMenu1
RowSelect = True
SmallImages = ImageList1
TabOrder = 0
ViewStyle = vsReport
OnMouseUp = lvRegistersMouseUp
OnSelectItem = lvRegistersSelectItem
end
object ToolBar1: TToolBar[1]
@ -89,6 +89,16 @@ inherited RegistersDlg: TRegistersDlg
object actPower: TAction
OnExecute = actPowerExecute
end
object actCopyName: TAction
Category = 'copy'
Caption = 'actCopyName'
OnExecute = actCopyNameExecute
end
object actCopyValue: TAction
Category = 'copy'
Caption = 'actCopyValue'
OnExecute = actCopyValueExecute
end
end
object PopupDispType: TPopupMenu[4]
left = 200
@ -118,4 +128,44 @@ inherited RegistersDlg: TRegistersDlg
OnClick = DispDefaultClick
end
end
object PopupMenu1: TPopupMenu[5]
left = 95
top = 178
object popFormat: TMenuItem
Caption = 'New Item1'
object PopDispDefault: TMenuItem
Caption = 'New Item1'
OnClick = DispDefaultClick
end
object PopDispHex: TMenuItem
Caption = 'New Item2'
OnClick = DispDefaultClick
end
object PopDispBin: TMenuItem
Caption = 'New Item3'
OnClick = DispDefaultClick
end
object PopDispOct: TMenuItem
Caption = 'New Item4'
OnClick = DispDefaultClick
end
object PopDispDec: TMenuItem
Caption = 'New Item5'
OnClick = DispDefaultClick
end
object PopDispRaw: TMenuItem
Caption = 'New Item6'
OnClick = DispDefaultClick
end
end
object popL1: TMenuItem
Caption = '-'
end
object popCopyName: TMenuItem
Action = actCopyName
end
object popCopyValue: TMenuItem
Action = actCopyValue
end
end
end

View File

@ -36,7 +36,7 @@ unit RegistersDlg;
interface
uses
SysUtils, Classes, Controls, Forms,
SysUtils, Classes, Controls, Forms, Clipbrd,
BaseDebugManager, IDEWindowIntf, DebuggerStrConst,
ComCtrls, ActnList, Menus, Debugger, DebuggerDlg,
LazarusIDEStrConsts, IDEImagesIntf;
@ -46,6 +46,8 @@ type
{ TRegistersDlg }
TRegistersDlg = class(TDebuggerDlg)
actCopyName: TAction;
actCopyValue: TAction;
actPower: TAction;
ActionList1: TActionList;
ImageList1: TImageList;
@ -56,15 +58,26 @@ type
DispOct: TMenuItem;
DispDec: TMenuItem;
DispRaw: TMenuItem;
PopDispDefault: TMenuItem;
PopDispHex: TMenuItem;
PopDispBin: TMenuItem;
PopDispOct: TMenuItem;
PopDispDec: TMenuItem;
PopDispRaw: TMenuItem;
popCopyValue: TMenuItem;
popCopyName: TMenuItem;
popFormat: TMenuItem;
popL1: TMenuItem;
PopupDispType: TPopupMenu;
PopupMenu1: TPopupMenu;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButtonDispType: TToolButton;
ToolButtonPower: TToolButton;
procedure actCopyNameExecute(Sender: TObject);
procedure actCopyValueExecute(Sender: TObject);
procedure actPowerExecute(Sender: TObject);
procedure DispDefaultClick(Sender: TObject);
procedure lvRegistersMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
procedure lvRegistersSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
procedure ToolButtonDispTypeClick(Sender: TObject);
private
@ -135,14 +148,17 @@ begin
//actPower.Caption := lisDbgWinPower;
actPower.Hint := lisDbgWinPowerHint;
actCopyName.Caption := lisLocalsDlgCopyName;
actCopyValue.Caption := lisLocalsDlgCopyValue;
ToolButtonDispType.Hint := regdlgDisplayTypeForSelectedRegisters;
DispDefault.Caption := dlgPasStringKeywordsOptDefault;
DispHex.Caption := regdlgHex;
DispBin.Caption := regdlgBinary;
DispOct.Caption := regdlgOctal;
DispDec.Caption := regdlgDecimal;
DispRaw.Caption := regdlgRaw;
DispDefault.Tag := ord(rdDefault);
DispHex.Tag := ord(rdHex);
DispBin.Tag := ord(rdBinary);
@ -150,6 +166,24 @@ begin
DispDec.Tag := ord(rdDecimal);
DispRaw.Tag := ord(rdRaw);
PopDispDefault.Caption := dlgPasStringKeywordsOptDefault;
PopDispHex.Caption := regdlgHex;
PopDispBin.Caption := regdlgBinary;
PopDispOct.Caption := regdlgOctal;
PopDispDec.Caption := regdlgDecimal;
PopDispRaw.Caption := regdlgRaw;
PopDispDefault.Tag := ord(rdDefault);
PopDispHex.Tag := ord(rdHex);
PopDispBin.Tag := ord(rdBinary);
PopDispOct.Tag := ord(rdOctal);
PopDispDec.Tag := ord(rdDecimal);
PopDispRaw.Tag := ord(rdRaw);
popFormat.Caption := regdlgFormat;
actCopyName.Caption := lisLocalsDlgCopyName;
actCopyValue.Caption := lisLocalsDlgCopyValue;
for i := low(COL_WIDTHS) to high(COL_WIDTHS) do
lvRegisters.Column[i].Width := COL_WIDTHS[i];
end;
@ -176,6 +210,20 @@ begin
end;
end;
procedure TRegistersDlg.actCopyNameExecute(Sender: TObject);
begin
Clipboard.Open;
Clipboard.AsText := lvRegisters.Selected.Caption;
Clipboard.Close;
end;
procedure TRegistersDlg.actCopyValueExecute(Sender: TObject);
begin
Clipboard.Open;
Clipboard.AsText := lvRegisters.Selected.SubItems[0];
Clipboard.Close;
end;
procedure TRegistersDlg.DispDefaultClick(Sender: TObject);
var
n, i: Integer;
@ -199,13 +247,6 @@ begin
lvRegistersSelectItem(nil, nil, True);
end;
procedure TRegistersDlg.lvRegistersMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbRight then
PopupDispType.PopUp;
end;
procedure TRegistersDlg.lvRegistersSelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
var
@ -233,16 +274,44 @@ begin
end;
end;
ToolButtonDispType.Enabled := j > 0;
popFormat.Enabled := j > 0;
actCopyName.Enabled := j > 0;
actCopyValue.Enabled := j > 0;
PopDispDefault.Checked := False;
PopDispHex.Checked := False;
PopDispBin.Checked := False;
PopDispOct.Checked := False;
PopDispDec.Checked := False;
PopDispRaw.Checked := False;
if MultiFormat
then ToolButtonDispType.Caption := '...'
else begin
case SelFormat of
rdDefault: ToolButtonDispType.Caption := DispDefault.Caption;
rdHex: ToolButtonDispType.Caption := DispHex.Caption;
rdBinary: ToolButtonDispType.Caption := DispBin.Caption;
rdOctal: ToolButtonDispType.Caption := DispOct.Caption;
rdDecimal: ToolButtonDispType.Caption := DispDec.Caption;
rdRaw: ToolButtonDispType.Caption := DispRaw.Caption;
rdDefault: begin
ToolButtonDispType.Caption := DispDefault.Caption;
PopDispDefault.Checked := True;
end;
rdHex: begin
ToolButtonDispType.Caption := DispHex.Caption;
PopDispHex.Checked := True;
end;
rdBinary: begin
ToolButtonDispType.Caption := DispBin.Caption;
PopDispBin.Checked := True;
end;
rdOctal: begin
ToolButtonDispType.Caption := DispOct.Caption;
PopDispOct.Checked := True;
end;
rdDecimal: begin
ToolButtonDispType.Caption := DispDec.Caption;
PopDispDec.Checked := True;
end;
rdRaw: begin
ToolButtonDispType.Caption := DispRaw.Caption;
PopDispRaw.Checked := True;
end;
end;
end;
end;

View File

@ -5435,6 +5435,7 @@ resourcestring
//Registers dialog
regdlgDisplayTypeForSelectedRegisters = 'Display type for selected Registers';
regdlgFormat = 'Format';
regdlgHex = 'Hex';
regdlgDecimal = 'Decimal';
regdlgOctal = 'Octal';