mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 16:49:07 +02:00
Debugger, Watches: Store column width
git-svn-id: trunk@32382 -
This commit is contained in:
parent
b93cbd8178
commit
d0c22113e6
@ -167,16 +167,45 @@ type
|
|||||||
{ TDebuggerConfigStore }
|
{ TDebuggerConfigStore }
|
||||||
(* TODO: maybe revert relations. Create this in Debugger, and call environmentoptions for the configstore only? *)
|
(* TODO: maybe revert relations. Create this in Debugger, and call environmentoptions for the configstore only? *)
|
||||||
|
|
||||||
TDebuggerConfigStore = class
|
{ TDebuggerConfigStoreBase }
|
||||||
|
|
||||||
|
TDebuggerConfigStoreBase = class(TPersistent)
|
||||||
private
|
private
|
||||||
FConfigStore: TConfigStorage;
|
FConfigStore: TConfigStorage;
|
||||||
FDebuggerClass: String;
|
|
||||||
public
|
public
|
||||||
property ConfigStore: TConfigStorage read FConfigStore write FConfigStore;
|
property ConfigStore: TConfigStorage read FConfigStore write FConfigStore;
|
||||||
procedure Load;
|
procedure Load; virtual;
|
||||||
procedure Save;
|
procedure Save; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDebuggerWatchesDlgConfig }
|
||||||
|
|
||||||
|
TDebuggerWatchesDlgConfig = class(TDebuggerConfigStoreBase)
|
||||||
|
private
|
||||||
|
FColumnNameWidth: Integer;
|
||||||
|
FColumnValueWidth: Integer;
|
||||||
public
|
public
|
||||||
|
constructor Create;
|
||||||
|
procedure Init;
|
||||||
|
procedure Load; override;
|
||||||
|
procedure Save; override;
|
||||||
|
published
|
||||||
|
property ColumnNameWidth: Integer read FColumnNameWidth write FColumnNameWidth;
|
||||||
|
property ColumnValueWidth: Integer read FColumnValueWidth write FColumnValueWidth;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TDebuggerConfigStore = class(TDebuggerConfigStoreBase)
|
||||||
|
private
|
||||||
|
FDebuggerClass: String;
|
||||||
|
FTDebuggerWatchesDlgConfig: TDebuggerWatchesDlgConfig;
|
||||||
|
public
|
||||||
|
procedure Load; override;
|
||||||
|
procedure Save; override;
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
property DebuggerClass: String read FDebuggerClass write FDebuggerClass;
|
property DebuggerClass: String read FDebuggerClass write FDebuggerClass;
|
||||||
|
property DlgWatchesConfig: TDebuggerWatchesDlgConfig read FTDebuggerWatchesDlgConfig;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TRefCountedObject }
|
{ TRefCountedObject }
|
||||||
@ -2863,40 +2892,89 @@ begin
|
|||||||
Result:=bpaStop;
|
Result:=bpaStop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TDebuggerWatchesDlgConfig }
|
||||||
|
|
||||||
|
constructor TDebuggerWatchesDlgConfig.Create;
|
||||||
|
begin
|
||||||
|
Init;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerWatchesDlgConfig.Init;
|
||||||
|
begin
|
||||||
|
FColumnNameWidth := -1;
|
||||||
|
FColumnValueWidth := -1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerWatchesDlgConfig.Load;
|
||||||
|
begin
|
||||||
|
Init;
|
||||||
|
ConfigStore.ReadObject('', self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerWatchesDlgConfig.Save;
|
||||||
|
begin
|
||||||
|
ConfigStore.WriteObject('', self);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TDebuggerConfigStoreBase }
|
||||||
|
|
||||||
|
procedure TDebuggerConfigStoreBase.Load;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDebuggerConfigStoreBase.Save;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
{ TDebuggerConfigStore }
|
{ TDebuggerConfigStore }
|
||||||
|
|
||||||
procedure TDebuggerConfigStore.Load;
|
procedure TDebuggerConfigStore.Load;
|
||||||
type
|
|
||||||
TDebuggerType = (dtNone, dtGnuDebugger, dtSSHGNUDebugger);
|
|
||||||
const
|
const
|
||||||
DebuggerName: array[TDebuggerType] of string = (
|
OLD_GDB_DBG_NAME = 'GNU debugger (gdb)';
|
||||||
'(None)','GNU debugger (gdb)', 'GNU debugger through SSH (gdb)'
|
OLD_SSH_DBG_NAME = 'GNU debugger through SSH (gdb)';
|
||||||
);
|
|
||||||
|
|
||||||
function DebuggerNameToType(const s: string): TDebuggerType;
|
|
||||||
begin
|
|
||||||
for Result:=Low(TDebuggerType) to High(TDebuggerType) do
|
|
||||||
if CompareText(DebuggerName[Result],s)=0 then exit;
|
|
||||||
Result:=dtNone;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
OldDebuggerType: TDebuggerType;
|
s: String;
|
||||||
begin
|
begin
|
||||||
FDebuggerClass := FConfigStore.GetValue('Class', '');
|
FDebuggerClass := ConfigStore.GetValue('Class', '');
|
||||||
if FDebuggerClass='' then begin
|
if FDebuggerClass='' then begin
|
||||||
// try old format
|
// try old format
|
||||||
OldDebuggerType := DebuggerNameToType(FConfigStore.GetValue('Type', ''));
|
s := ConfigStore.GetValue('Type', '');
|
||||||
if OldDebuggerType=dtGnuDebugger then
|
if s = OLD_GDB_DBG_NAME then FDebuggerClass:='TGDBMIDEBUGGER';
|
||||||
FDebuggerClass:='TGDBMIDEBUGGER';
|
if s = OLD_SSH_DBG_NAME then FDebuggerClass:='TSSHGDBMIDEBUGGER';
|
||||||
|
end;
|
||||||
|
ConfigStore.AppendBasePath('WatchesDlg/');
|
||||||
|
try
|
||||||
|
FTDebuggerWatchesDlgConfig.ConfigStore := ConfigStore;
|
||||||
|
FTDebuggerWatchesDlgConfig.Load;
|
||||||
|
finally
|
||||||
|
ConfigStore.UndoAppendBasePath;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDebuggerConfigStore.Save;
|
procedure TDebuggerConfigStore.Save;
|
||||||
begin
|
begin
|
||||||
FConfigStore.SetDeleteValue('Class', FDebuggerClass, '');
|
ConfigStore.SetDeleteValue('Class', FDebuggerClass, '');
|
||||||
FConfigStore.DeletePath('Type');
|
ConfigStore.DeletePath('Type');
|
||||||
|
ConfigStore.AppendBasePath('WatchesDlg/');
|
||||||
|
try
|
||||||
|
FTDebuggerWatchesDlgConfig.ConfigStore := ConfigStore;
|
||||||
|
FTDebuggerWatchesDlgConfig.Save;
|
||||||
|
finally
|
||||||
|
ConfigStore.UndoAppendBasePath;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TDebuggerConfigStore.Create;
|
||||||
|
begin
|
||||||
|
FTDebuggerWatchesDlgConfig := TDebuggerWatchesDlgConfig.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TDebuggerConfigStore.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
FreeAndNil(FTDebuggerWatchesDlgConfig);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TDebuggerUnitInfoProvider }
|
{ TDebuggerUnitInfoProvider }
|
||||||
|
@ -40,7 +40,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, math,
|
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, math,
|
||||||
StdCtrls, Buttons, Menus, ComCtrls, LCLType, ActnList, IDEImagesIntf,
|
StdCtrls, Buttons, Menus, ComCtrls, LCLType, ActnList, IDEImagesIntf,
|
||||||
LazarusIDEStrConsts, Debugger, DebuggerDlg, BaseDebugManager;
|
EnvironmentOpts, LazarusIDEStrConsts, Debugger, DebuggerDlg, BaseDebugManager;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -108,6 +108,7 @@ type
|
|||||||
function GetWatches: TWatches;
|
function GetWatches: TWatches;
|
||||||
procedure ContextChanged(Sender: TObject);
|
procedure ContextChanged(Sender: TObject);
|
||||||
procedure SnapshotChanged(Sender: TObject);
|
procedure SnapshotChanged(Sender: TObject);
|
||||||
|
procedure SaveColumnWidths;
|
||||||
private
|
private
|
||||||
FWatchesInView: TWatches;
|
FWatchesInView: TWatches;
|
||||||
FPowerImgIdx, FPowerImgIdxGrey: Integer;
|
FPowerImgIdx, FPowerImgIdxGrey: Integer;
|
||||||
@ -340,18 +341,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatchesDlg.FormShow(Sender: TObject);
|
procedure TWatchesDlg.FormShow(Sender: TObject);
|
||||||
|
var
|
||||||
|
Conf: TDebuggerWatchesDlgConfig;
|
||||||
begin
|
begin
|
||||||
UpdateAll;
|
UpdateAll;
|
||||||
|
Conf := EnvironmentOptions.DebuggerConfig.DlgWatchesConfig;
|
||||||
|
if Conf.ColumnNameWidth > 0 then
|
||||||
|
lvWatches.Column[0].Width := Conf.ColumnNameWidth;
|
||||||
|
if Conf.ColumnValueWidth > 0 then
|
||||||
|
lvWatches.Column[1].Width := Conf.ColumnValueWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatchesDlg.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
procedure TWatchesDlg.FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||||
begin
|
begin
|
||||||
//DebugLn('TWatchesDlg.FormCloseQuery ',dbgs(CanClose));
|
//DebugLn('TWatchesDlg.FormCloseQuery ',dbgs(CanClose));
|
||||||
|
SaveColumnWidths;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatchesDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
procedure TWatchesDlg.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||||
begin
|
begin
|
||||||
//DebugLn('TWatchesDlg.FormClose ',dbgs(ord(CloseAction)));
|
//DebugLn('TWatchesDlg.FormClose ',dbgs(ord(CloseAction)));
|
||||||
|
SaveColumnWidths;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWatchesDlg.actPowerExecute(Sender: TObject);
|
procedure TWatchesDlg.actPowerExecute(Sender: TObject);
|
||||||
@ -453,6 +463,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWatchesDlg.SaveColumnWidths;
|
||||||
|
var
|
||||||
|
Conf: TDebuggerWatchesDlgConfig;
|
||||||
|
begin
|
||||||
|
Conf := EnvironmentOptions.DebuggerConfig.DlgWatchesConfig;
|
||||||
|
Conf.ColumnNameWidth := lvWatches.Column[0].Width;
|
||||||
|
Conf.ColumnValueWidth := lvWatches.Column[1].Width;
|
||||||
|
end;
|
||||||
|
|
||||||
function TWatchesDlg.GetWatches: TWatches;
|
function TWatchesDlg.GetWatches: TWatches;
|
||||||
var
|
var
|
||||||
Snap: TSnapshot;
|
Snap: TSnapshot;
|
||||||
|
Loading…
Reference in New Issue
Block a user