mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 21:29:36 +02:00
DebuggerOptions: TDebuggerPropertiesConfig removed MarkAsDeleted workaround.
This commit is contained in:
parent
8ddfc51b46
commit
8f2367727a
debugger/frames
ide
@ -297,9 +297,9 @@ begin
|
||||
exit;
|
||||
|
||||
i := FCopiedDbgPropertiesConfigList.IndexOfObject(FSelectedDbgPropertiesConfig);
|
||||
FSelectedDbgPropertiesConfig.MarkAsDeleted;
|
||||
if i >= 0 then
|
||||
FCopiedDbgPropertiesConfigList.Delete(i);
|
||||
FSelectedDbgPropertiesConfig := nil;
|
||||
FCopiedDbgPropertiesConfigList[i] := ''; // remove from named part of list
|
||||
|
||||
FillNameDropDown;
|
||||
UpdateDebuggerClassDropDown;
|
||||
@ -522,7 +522,6 @@ begin
|
||||
while i >= 0 do
|
||||
if (FCopiedDbgPropertiesConfigList[i] <> '') or
|
||||
(FCopiedDbgPropertiesConfigList.Opt[i].DebuggerClass <> SelectedDebuggerClass) or
|
||||
(FCopiedDbgPropertiesConfigList.Opt[i].IsDeleted) or
|
||||
(FCopiedDbgPropertiesConfigList.Opt[i] = FSelectedDbgPropertiesConfig)
|
||||
then
|
||||
dec(i)
|
||||
@ -553,7 +552,7 @@ end;
|
||||
procedure TDebuggerClassOptionsFrame.ClearDbgProperties;
|
||||
begin
|
||||
PropertyGrid.Selection.Clear;
|
||||
FCopiedDbgPropertiesConfigList.ClearAll;
|
||||
FCopiedDbgPropertiesConfigList.Clear;
|
||||
DoModifiedDbgPropertiesCountChanged;
|
||||
end;
|
||||
|
||||
@ -569,8 +568,7 @@ begin
|
||||
{$ENDIF}
|
||||
tbDropMenu.Items.Clear;
|
||||
for i := 0 to FCopiedDbgPropertiesConfigList.Count - 1 do
|
||||
if (not FCopiedDbgPropertiesConfigList.Opt[i].IsDeleted) and
|
||||
(FCopiedDbgPropertiesConfigList.Opt[i].IsLoaded)
|
||||
if (FCopiedDbgPropertiesConfigList.Opt[i].IsLoaded)
|
||||
then begin
|
||||
m := TMenuItem.Create(tbDropMenu);
|
||||
m.Caption := FCopiedDbgPropertiesConfigList.Opt[i].DisplayName;
|
||||
@ -592,7 +590,7 @@ begin
|
||||
lblWarningProject.Visible := not (
|
||||
(Project1.DebuggerBackend = FSelectedDbgPropertiesConfig.UID) or
|
||||
(Project1.DebuggerBackend = 'IDE') or
|
||||
( (Project1.DebuggerBackend = '') and (Project1.DebuggerPropertiesConfigList.CountWithoutDeleted = 0) )
|
||||
( (Project1.DebuggerBackend = '') and (Project1.DebuggerPropertiesConfigList.Count = 0) )
|
||||
);
|
||||
end;
|
||||
|
||||
@ -694,7 +692,7 @@ begin
|
||||
|
||||
ClearDbgProperties;
|
||||
FDebuggerFileHistory.Clear;
|
||||
FCopiedDbgPropertiesConfigList.ClearAll;
|
||||
FCopiedDbgPropertiesConfigList.Clear;
|
||||
for i := 0 to ADbgConf.Count - 1 do
|
||||
FCopiedDbgPropertiesConfigList.AddObject(ADbgConf[i],
|
||||
TDebuggerPropertiesConfig.CreateCopy(ADbgConf.Opt[i], True, True) );
|
||||
@ -728,7 +726,7 @@ begin
|
||||
|
||||
// DebuggerSearchPath := TrimSearchPath(txtAdditionalPath.Text,'');
|
||||
|
||||
ADbgConf.ClearAll;
|
||||
ADbgConf.Clear;
|
||||
for i := 0 to FCopiedDbgPropertiesConfigList.Count - 1 do
|
||||
ADbgConf.AddObject(FCopiedDbgPropertiesConfigList[i],
|
||||
TDebuggerPropertiesConfig.CreateCopy(FCopiedDbgPropertiesConfigList.Opt[i], True, True) );
|
||||
|
@ -133,13 +133,13 @@ begin
|
||||
lblResolvedDebuggerHint.Visible := False;
|
||||
case FDebuggerBackendIdx of
|
||||
DBG_IDX_PROJECT: begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.CountWithoutDeleted = 0 then begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.Count = 0 then begin
|
||||
lblResolvedDebuggerHint.Caption := drsUsingIDEDefaultDebuggerSe;
|
||||
lblResolvedDebuggerHint.Visible := True;
|
||||
end;
|
||||
end;
|
||||
DBG_IDX_IDE: begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.CountWithoutDeleted > 0 then begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.Count > 0 then begin
|
||||
lblResolvedDebuggerHint.Caption := drsUsingIDEDefaultDebuggerSe;
|
||||
lblResolvedDebuggerHint.Caption := lblResolvedDebuggerHint.Caption + drsIgnoringProjectDebuggerSettings;
|
||||
lblResolvedDebuggerHint.Visible := True;
|
||||
@ -147,12 +147,12 @@ begin
|
||||
end;
|
||||
DBG_IDX_UNKNOWN: begin
|
||||
lblResolvedDebuggerHint.Caption := drsUsingIDEDefaultDebuggerSe;
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.CountWithoutDeleted > 0 then
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.Count > 0 then
|
||||
lblResolvedDebuggerHint.Caption := lblResolvedDebuggerHint.Caption + drsIgnoringProjectDebuggerSettings;
|
||||
lblResolvedDebuggerHint.Visible := True;
|
||||
end;
|
||||
otherwise begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.CountWithoutDeleted > 0 then begin
|
||||
if FClassOpts.ModifiedDbgPropertiesConfigList.Count > 0 then begin
|
||||
lblResolvedDebuggerHint.Caption := drsUsingSelectedIDEDebuggerS;
|
||||
lblResolvedDebuggerHint.Caption := lblResolvedDebuggerHint.Caption + drsIgnoringProjectDebuggerSettings;
|
||||
lblResolvedDebuggerHint.Visible := True;
|
||||
|
@ -15,7 +15,7 @@ type
|
||||
|
||||
TDebuggerPropertiesConfig = class(TPersistent)
|
||||
private
|
||||
FFLags: set of (dpcLoaded, dpcDeleted);
|
||||
FFLags: set of (dpcLoaded);
|
||||
FActive: Boolean;
|
||||
FConfigClass: String;
|
||||
FConfigClassInOldXml: String; // The ConfigClass in the xml file. In case the class in memory is changed
|
||||
@ -41,9 +41,7 @@ type
|
||||
function DisplayName: String;
|
||||
function NeedsExePath: Boolean;
|
||||
procedure ChangeDebuggerClass(ADebuggerClass: TDebuggerClass; ACopyPropValues: Boolean = True);
|
||||
procedure MarkAsDeleted;
|
||||
function IsLoaded: Boolean; // The class for the debugger was found
|
||||
function IsDeleted: Boolean;
|
||||
function DebugText: String;
|
||||
|
||||
procedure DeleteFromOldXml(AXMLCfg: TRttiXMLConfig; APath: String);
|
||||
@ -75,12 +73,11 @@ type
|
||||
function GetOpt(Index: Integer): TDebuggerPropertiesConfig;
|
||||
procedure SetCurrentDebuggerPropertiesOpt(AValue: TDebuggerPropertiesConfig);
|
||||
public
|
||||
constructor Create;
|
||||
procedure LoadFromXml(AXMLCfg: TRttiXMLConfig; APath: String);
|
||||
procedure LoadFromOldXml(AXMLCfg: TRttiXMLConfig; APath: String; AnOldFileNamePath: String = '');
|
||||
procedure SaveToXml(AXMLCfg: TRttiXMLConfig; APath: String; AForceSaveEmpty: Boolean = False);
|
||||
|
||||
procedure ClearAll;
|
||||
function CountWithoutDeleted: Integer;
|
||||
function EntryByName(AConfName, AConfClass: String): TDebuggerPropertiesConfig;
|
||||
function EntryByUid(AnUid: String): TDebuggerPropertiesConfig;
|
||||
property Opt[Index: Integer]: TDebuggerPropertiesConfig read GetOpt;
|
||||
@ -308,13 +305,11 @@ begin
|
||||
FDebuggerFilename := ASource.FDebuggerFilename;
|
||||
FFLags := ASource.FFLags;
|
||||
|
||||
if not IsDeleted then begin
|
||||
FreeAndNil(FDebuggerProperties);
|
||||
if ASource.DebuggerClass <> nil then
|
||||
FDebuggerProperties := ASource.DebuggerClass.CreateProperties;
|
||||
if ACopyPropValues and (ASource.FDebuggerProperties <> nil) then
|
||||
FDebuggerProperties.Assign(ASource.FDebuggerProperties);
|
||||
end;
|
||||
FreeAndNil(FDebuggerProperties);
|
||||
if ASource.DebuggerClass <> nil then
|
||||
FDebuggerProperties := ASource.DebuggerClass.CreateProperties;
|
||||
if ACopyPropValues and (ASource.FDebuggerProperties <> nil) then
|
||||
FDebuggerProperties.Assign(ASource.FDebuggerProperties);
|
||||
|
||||
FUID := '';
|
||||
InitUID;
|
||||
@ -347,7 +342,7 @@ procedure TDebuggerPropertiesConfig.ChangeDebuggerClass(
|
||||
var
|
||||
p: TDebuggerProperties;
|
||||
begin
|
||||
assert(IsLoaded and not IsDeleted, 'TDebuggerPropertiesConfig.ChangeDebuggerClass: IsLoaded');
|
||||
assert(IsLoaded, 'TDebuggerPropertiesConfig.ChangeDebuggerClass: IsLoaded');
|
||||
FDebuggerClass := ADebuggerClass;
|
||||
FConfigClass := ADebuggerClass.ClassName;
|
||||
p := FDebuggerProperties;
|
||||
@ -357,22 +352,11 @@ begin
|
||||
p.Free;
|
||||
end;
|
||||
|
||||
procedure TDebuggerPropertiesConfig.MarkAsDeleted;
|
||||
begin
|
||||
FreeAndNil(FDebuggerProperties);
|
||||
FFLags := FFLags + [dpcDeleted];
|
||||
end;
|
||||
|
||||
function TDebuggerPropertiesConfig.IsLoaded: Boolean;
|
||||
begin
|
||||
Result := dpcLoaded in FFLags; // (FDebuggerClass <> nil) and (FDebuggerProperties <> nil);
|
||||
end;
|
||||
|
||||
function TDebuggerPropertiesConfig.IsDeleted: Boolean;
|
||||
begin
|
||||
Result := dpcDeleted in FFLags; // (FDebuggerClass <> nil) and (FDebuggerProperties = nil);
|
||||
end;
|
||||
|
||||
function TDebuggerPropertiesConfig.DebugText: String;
|
||||
begin
|
||||
if Self = nil then
|
||||
@ -491,6 +475,12 @@ begin
|
||||
FCurrentDebuggerPropertiesConfig := AValue;
|
||||
end;
|
||||
|
||||
constructor TDebuggerPropertiesConfigList.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
OwnsObjects := True;
|
||||
end;
|
||||
|
||||
procedure TDebuggerPropertiesConfigList.LoadFromXml(AXMLCfg: TRttiXMLConfig;
|
||||
APath: String);
|
||||
var
|
||||
@ -506,7 +496,7 @@ begin
|
||||
HasActiveDebuggerEntry := False;
|
||||
|
||||
|
||||
ClearAll;
|
||||
Clear;
|
||||
FCurrentDebuggerPropertiesConfig := nil;
|
||||
|
||||
ConfCount := AXMLCfg.GetListItemCount(APath, 'Config', False);
|
||||
@ -602,8 +592,6 @@ begin
|
||||
Idx := 1;
|
||||
for i := 0 to Count - 1 do begin
|
||||
Entry := Opt[i];
|
||||
if Entry.IsDeleted then
|
||||
Continue;
|
||||
|
||||
Entry.Active := Entry = FCurrentDebuggerPropertiesConfig;
|
||||
Entry.SaveToXml(AXMLCfg, APath + XML_PATH_DEBUGGER_CONF, Idx);
|
||||
@ -614,25 +602,6 @@ begin
|
||||
AXMLCfg.SetValue(APath+'Version', 1);
|
||||
end;
|
||||
|
||||
procedure TDebuggerPropertiesConfigList.ClearAll;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i := 0 to Count - 1 do
|
||||
Objects[i].Free;
|
||||
Clear;
|
||||
end;
|
||||
|
||||
function TDebuggerPropertiesConfigList.CountWithoutDeleted: Integer;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := 0;
|
||||
for i := 0 to Count - 1 do
|
||||
if not Opt[i].IsDeleted then
|
||||
inc(Result);
|
||||
end;
|
||||
|
||||
function TDebuggerPropertiesConfigList.EntryByName(AConfName, AConfClass: String
|
||||
): TDebuggerPropertiesConfig;
|
||||
var
|
||||
@ -643,7 +612,7 @@ begin
|
||||
i := Count - 1;
|
||||
while i >= 0 do begin
|
||||
dpCfg := Opt[i];
|
||||
if (not dpCfg.IsDeleted) and dpCfg.IsLoaded
|
||||
if dpCfg.IsLoaded
|
||||
and (dpCfg.ConfigName = AConfName)
|
||||
and (dpCfg.ConfigClass = AConfClass) then
|
||||
Break;
|
||||
@ -700,9 +669,7 @@ destructor TDebuggerOptions.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
BackendConverterConfig.Free;
|
||||
|
||||
FDebuggerConfigList.ClearAll;
|
||||
FreeAndNil(FDebuggerConfigList);
|
||||
FDebuggerConfigList.Free;
|
||||
|
||||
FXMLCfg.Free;
|
||||
end;
|
||||
|
@ -530,7 +530,7 @@ begin
|
||||
writeln(opts.DebuggerPropertiesConfigList.Count);
|
||||
for i := 0 to opts.DebuggerPropertiesConfigList.Count - 1 do
|
||||
with opts.DebuggerPropertiesConfigList.Opt[i] do
|
||||
WriteLn(' # ', ConfigName, 'C=', ConfigClass, ' , A=', Active, ' , D=', IsDeleted, ' , L=',IsLoaded);
|
||||
WriteLn(' # ', ConfigName, 'C=', ConfigClass, ' , A=', Active, ' , L=',IsLoaded);
|
||||
end;
|
||||
|
||||
procedure TTestXmlOpts.TearDown;
|
||||
|
@ -2881,7 +2881,6 @@ begin
|
||||
FreeThenNil(FDefineTemplates);
|
||||
FreeThenNil(FHistoryLists);
|
||||
{$IFnDEF LCLNOGUI}
|
||||
FDebuggerProperties.ClearAll;
|
||||
FreeAndNil(FDebuggerProperties);
|
||||
FreeAndNil(FBackendConverterConfig);
|
||||
{$EndIf}
|
||||
|
Loading…
Reference in New Issue
Block a user