mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 06:39:12 +02:00
ide: fixed TIDECoolBarOptions default options
This commit is contained in:
parent
e1132e9ee7
commit
0631c5f508
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
SysUtils, fgl,
|
SysUtils, fgl,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
Laz2_XMLCfg,
|
Laz2_XMLCfg, LazLoggerBase,
|
||||||
// IdeConfig
|
// IdeConfig
|
||||||
ToolBarOptionsBase;
|
ToolBarOptionsBase;
|
||||||
|
|
||||||
@ -53,20 +53,28 @@ type
|
|||||||
FBorderStyle: Integer; //TFormBorderStyle;
|
FBorderStyle: Integer; //TFormBorderStyle;
|
||||||
FToolBars: TIDEToolBarOptionList;
|
FToolBars: TIDEToolBarOptionList;
|
||||||
procedure CreateDefaultToolbars;
|
procedure CreateDefaultToolbars;
|
||||||
|
public
|
||||||
|
const
|
||||||
|
cDefaultVisible = true;
|
||||||
|
cDefaultWidth = 230;
|
||||||
|
cDefaultGrabStyle = 1;
|
||||||
|
cDefaultGrabWidth = 5;
|
||||||
|
cDefaultBorderstyle = 1;
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure Assign(Source: TIDECoolBarOptions);
|
procedure Assign(Source: TIDECoolBarOptions);
|
||||||
|
function Equals(Obj: TObject): boolean; override;
|
||||||
function EqualToolbars(Opts: TIDECoolBarOptions): boolean;
|
function EqualToolbars(Opts: TIDECoolBarOptions): boolean;
|
||||||
procedure Load(XMLConfig: TXMLConfig; Path: String);
|
procedure Load(XMLConfig: TXMLConfig; Path: String);
|
||||||
procedure Save(XMLConfig: TXMLConfig; Path: String);
|
procedure Save(XMLConfig: TXMLConfig; Path: String);
|
||||||
public
|
public
|
||||||
property Visible: Boolean read FVisible write FVisible;
|
property Visible: Boolean read FVisible write FVisible default cDefaultVisible;
|
||||||
property Width: Integer read FWidth write FWidth;
|
property Width: Integer read FWidth write FWidth default cDefaultWidth;
|
||||||
property GrabStyle: Integer read FGrabStyle write FGrabStyle;
|
property GrabStyle: Integer read FGrabStyle write FGrabStyle default cDefaultGrabStyle;
|
||||||
property GrabWidth: Integer read FGrabWidth write FGrabWidth;
|
property GrabWidth: Integer read FGrabWidth write FGrabWidth default cDefaultGrabWidth;
|
||||||
property BorderStyle: Integer read FBorderStyle write FBorderStyle;
|
property BorderStyle: Integer read FBorderStyle write FBorderStyle default cDefaultBorderstyle;
|
||||||
property ToolBars: TIDEToolBarOptionList read FToolBars;
|
property ToolBars: TIDEToolBarOptionList read FToolBars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -138,6 +146,12 @@ constructor TIDECoolBarOptions.Create;
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
FToolBars := TIDEToolBarOptionList.Create;
|
FToolBars := TIDEToolBarOptionList.Create;
|
||||||
|
FVisible := cDefaultVisible;
|
||||||
|
FWidth := cDefaultWidth;
|
||||||
|
FGrabStyle := cDefaultGrabStyle;
|
||||||
|
FGrabWidth := cDefaultGrabWidth;
|
||||||
|
FBorderStyle := cDefaultBorderstyle;
|
||||||
|
CreateDefaultToolbars;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TIDECoolBarOptions.Destroy;
|
destructor TIDECoolBarOptions.Destroy;
|
||||||
@ -161,6 +175,23 @@ begin
|
|||||||
FToolBars.Assign(Source.FToolBars);
|
FToolBars.Assign(Source.FToolBars);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TIDECoolBarOptions.Equals(Obj: TObject): boolean;
|
||||||
|
var
|
||||||
|
Src: TIDECoolBarOptions;
|
||||||
|
begin
|
||||||
|
if Obj is TIDECoolBarOptions then
|
||||||
|
begin
|
||||||
|
Src:=TIDECoolBarOptions(Obj);
|
||||||
|
Result:=(Visible=Src.Visible)
|
||||||
|
and (Width=Src.Width)
|
||||||
|
and (GrabStyle=Src.GrabStyle)
|
||||||
|
and (GrabWidth=Src.GrabWidth)
|
||||||
|
and (BorderStyle=Src.BorderStyle)
|
||||||
|
and EqualToolbars(Src);
|
||||||
|
end else
|
||||||
|
Result:=inherited Equals(Obj);
|
||||||
|
end;
|
||||||
|
|
||||||
function TIDECoolBarOptions.EqualToolbars(Opts: TIDECoolBarOptions): boolean;
|
function TIDECoolBarOptions.EqualToolbars(Opts: TIDECoolBarOptions): boolean;
|
||||||
var
|
var
|
||||||
I: Integer;
|
I: Integer;
|
||||||
@ -224,11 +255,11 @@ begin
|
|||||||
ToolbarCount := XMLConfig.GetValue(Path + 'Count', 0);
|
ToolbarCount := XMLConfig.GetValue(Path + 'Count', 0);
|
||||||
if ToolBarCount = 0 then // Old format
|
if ToolBarCount = 0 then // Old format
|
||||||
ToolbarCount := XMLConfig.GetValue(Path + 'ToolBarCount/Value', 0);
|
ToolbarCount := XMLConfig.GetValue(Path + 'ToolBarCount/Value', 0);
|
||||||
FVisible := XMLConfig.GetValue(Path + 'Visible/Value', True);
|
FVisible := XMLConfig.GetValue(Path + 'Visible/Value', cDefaultVisible);
|
||||||
FWidth := XMLConfig.GetValue(Path + 'Width/Value', 230);
|
FWidth := XMLConfig.GetValue(Path + 'Width/Value', cDefaultWidth);
|
||||||
FGrabStyle := XMLConfig.GetValue(Path + 'GrabStyle/Value', 1);
|
FGrabStyle := XMLConfig.GetValue(Path + 'GrabStyle/Value', cDefaultGrabStyle);
|
||||||
FGrabWidth := XMLConfig.GetValue(Path + 'GrabWidth/Value', 5);
|
FGrabWidth := XMLConfig.GetValue(Path + 'GrabWidth/Value', cDefaultGrabWidth);
|
||||||
FBorderStyle := XMLConfig.GetValue(Path + 'BorderStyle/Value', 1);
|
FBorderStyle := XMLConfig.GetValue(Path + 'BorderStyle/Value', cDefaultBorderstyle);
|
||||||
if ToolBarCount > 0 then
|
if ToolBarCount > 0 then
|
||||||
begin
|
begin
|
||||||
FToolBars.Clear;
|
FToolBars.Clear;
|
||||||
@ -253,15 +284,15 @@ begin
|
|||||||
try
|
try
|
||||||
Path := Path + BasePath;
|
Path := Path + BasePath;
|
||||||
XMLConfig.DeletePath(Path);
|
XMLConfig.DeletePath(Path);
|
||||||
XMLConfig.SetDeleteValue(Path + 'Visible/Value', FVisible, True);
|
XMLConfig.SetDeleteValue(Path + 'Visible/Value', FVisible, cDefaultVisible);
|
||||||
XMLConfig.SetDeleteValue(Path + 'Width/Value', FWidth, 0);
|
XMLConfig.SetDeleteValue(Path + 'Width/Value', FWidth, cDefaultWidth);
|
||||||
XMLConfig.SetDeleteValue(Path + 'GrabStyle/Value', FGrabStyle, 1);
|
XMLConfig.SetDeleteValue(Path + 'GrabStyle/Value', FGrabStyle, cDefaultGrabStyle);
|
||||||
XMLConfig.SetDeleteValue(Path + 'GrabWidth/Value', FGrabWidth, 5);
|
XMLConfig.SetDeleteValue(Path + 'GrabWidth/Value', FGrabWidth, cDefaultGrabWidth);
|
||||||
XMLConfig.SetDeleteValue(Path + 'BorderStyle/Value', FBorderStyle, 1);
|
XMLConfig.SetDeleteValue(Path + 'BorderStyle/Value', FBorderStyle, cDefaultBorderstyle);
|
||||||
if EqualToolbars(DefaultOpts) then Exit;
|
if EqualToolbars(DefaultOpts) then Exit;
|
||||||
|
XMLConfig.SetDeleteValue(Path + 'Count', FToolBars.Count, 0);
|
||||||
if FToolBars.Count > 0 then
|
if FToolBars.Count > 0 then
|
||||||
begin
|
begin
|
||||||
XMLConfig.SetDeleteValue(Path + 'Count', FToolBars.Count, 0);
|
|
||||||
for I := 0 to FToolBars.Count - 1 do
|
for I := 0 to FToolBars.Count - 1 do
|
||||||
FToolBars[I].Save(XMLConfig, Path + 'ToolBar' + IntToStr(I+1) + '/');
|
FToolBars[I].Save(XMLConfig, Path + 'ToolBar' + IntToStr(I+1) + '/');
|
||||||
end;
|
end;
|
||||||
@ -276,11 +307,11 @@ constructor TDefaultCoolBarOptions.Create;
|
|||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
//coolbar defaults
|
//coolbar defaults
|
||||||
FVisible := True;
|
FVisible := cDefaultVisible;
|
||||||
FWidth := 230;
|
FWidth := cDefaultWidth;
|
||||||
FGrabStyle := 1;
|
FGrabStyle := cDefaultGrabStyle;
|
||||||
FGrabWidth := 5;
|
FGrabWidth := cDefaultGrabWidth;
|
||||||
FBorderStyle := 1;
|
FBorderStyle := cDefaultBorderstyle;
|
||||||
//toolbar defaults
|
//toolbar defaults
|
||||||
CreateDefaultToolbars;
|
CreateDefaultToolbars;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user