ide: fixed editortoolbar options defaults

This commit is contained in:
mattias 2024-10-20 19:59:26 +02:00
parent 39caeecab4
commit 0aa1b762d3

View File

@ -21,6 +21,10 @@ type
private private
FVisible: Boolean; FVisible: Boolean;
FPosition: string; FPosition: string;
public
const
cDefaultVisible = true;
cDefaultPosition = 'Top';
public public
constructor Create; constructor Create;
//destructor Destroy; override; //destructor Destroy; override;
@ -48,18 +52,16 @@ const
constructor TEditorToolBarOptions.Create; constructor TEditorToolBarOptions.Create;
begin begin
inherited Create; inherited Create;
FVisible := True; FVisible := cDefaultVisible;
FPosition := cDefaultPosition;
CreateDefaults;
end; end;
{
destructor TEditorToolBarOptions.Destroy;
begin
inherited Destroy;
end;
}
procedure TEditorToolBarOptions.Clear; procedure TEditorToolBarOptions.Clear;
begin begin
inherited Clear; inherited Clear;
FVisible := True; FVisible := cDefaultVisible;
FPosition := cDefaultPosition;
end; end;
function TEditorToolBarOptions.Equals(Opts: TEditorToolBarOptions): boolean; function TEditorToolBarOptions.Equals(Opts: TEditorToolBarOptions): boolean;
@ -94,8 +96,8 @@ begin
Path := Path + BasePath; Path := Path + BasePath;
if XMLConfig.HasPath(Path + 'Count', True) then if XMLConfig.HasPath(Path + 'Count', True) then
begin begin
FVisible := XMLConfig.GetValue(Path + 'Visible', True); FVisible := XMLConfig.GetValue(Path + 'Visible', cDefaultVisible);
FPosition := XMLConfig.GetValue(Path + 'Position', 'Top'); FPosition := XMLConfig.GetValue(Path + 'Position', cDefaultPosition);
LoadButtonNames(XMLConfig, Path); LoadButtonNames(XMLConfig, Path);
end end
else begin else begin
@ -128,8 +130,8 @@ end;
procedure TEditorToolBarOptions.Save(XMLConfig: TXMLConfig; Path: String); procedure TEditorToolBarOptions.Save(XMLConfig: TXMLConfig; Path: String);
begin begin
Path := Path + BasePath; Path := Path + BasePath;
XMLConfig.SetDeleteValue(Path + 'Visible', FVisible, True); XMLConfig.SetDeleteValue(Path + 'Visible', FVisible, cDefaultVisible);
XMLConfig.SetDeleteValue(Path + 'Position', FPosition, 'Top'); XMLConfig.SetDeleteValue(Path + 'Position', FPosition, cDefaultPosition);
SaveButtonNames(XMLConfig, Path); SaveButtonNames(XMLConfig, Path);
end; end;