mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 14:39:06 +02:00
IDE: fixed loading toolbar config from Ondrej
git-svn-id: trunk@50073 -
This commit is contained in:
parent
d6f0f771b5
commit
cfb5aea1e9
@ -88,8 +88,8 @@ type
|
|||||||
const aCommand: TIDECommand): TIDEButtonCommand; overload;
|
const aCommand: TIDECommand): TIDEButtonCommand; overload;
|
||||||
function AddButton(const aCommand: TIDECommand): TIDEButtonCommand; overload;
|
function AddButton(const aCommand: TIDECommand): TIDEButtonCommand; overload;
|
||||||
function FindCreateCategory(const aName, aDescription: string): TIDEToolButtonCategory;
|
function FindCreateCategory(const aName, aDescription: string): TIDEToolButtonCategory;
|
||||||
function FindItemByName(aName: string): TIDEButtonCommand;
|
function FindItemByName(const aName: string): TIDEButtonCommand;
|
||||||
function FindItemByMenuPathOrName(aName: string): TIDEButtonCommand;
|
function FindItemByMenuPathOrName(var aName: string): TIDEButtonCommand;
|
||||||
function FindItemByCommand(const aCommand: TIDECommand): TIDEButtonCommand;
|
function FindItemByCommand(const aCommand: TIDECommand): TIDEButtonCommand;
|
||||||
property Items[Index: Integer]: TIDEToolButtonCategory read GetItems; default;
|
property Items[Index: Integer]: TIDEToolButtonCategory read GetItems; default;
|
||||||
end;
|
end;
|
||||||
@ -396,26 +396,22 @@ begin
|
|||||||
inherited Destroy;
|
inherited Destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEToolButtonCategories.FindItemByMenuPathOrName(aName: string
|
function TIDEToolButtonCategories.FindItemByMenuPathOrName(var aName: string
|
||||||
): TIDEButtonCommand;
|
): TIDEButtonCommand;
|
||||||
var
|
var
|
||||||
i: Integer;
|
|
||||||
xMI: TIDEMenuItem;
|
xMI: TIDEMenuItem;
|
||||||
begin
|
begin
|
||||||
i := LastDelimiter('/', aName);
|
Result := FindItemByName(aName);
|
||||||
if (i > 0) then
|
if Result<>nil then Exit;
|
||||||
begin
|
|
||||||
//find by path from aName (backwards compatibility)
|
//find by path from aName (backwards compatibility)
|
||||||
xMI := IDEMenuRoots.FindByPath(aName, False);
|
xMI := IDEMenuRoots.FindByPath(aName, False);
|
||||||
if Assigned(xMI) and Assigned(xMI.Command) then
|
if Assigned(xMI) and Assigned(xMI.Command) then
|
||||||
begin
|
begin
|
||||||
Result := FindItemByCommand(xMI.Command);
|
Result := FindItemByCommand(xMI.Command);
|
||||||
if Assigned(Result) then
|
if Assigned(Result) then
|
||||||
Exit;
|
aName := xMI.Command.Name;
|
||||||
end;
|
end;
|
||||||
Delete(aName, 1, i);
|
|
||||||
end;
|
|
||||||
Result := FindItemByName(aName);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEToolButtonCategories.FindCreateCategory(const aName,
|
function TIDEToolButtonCategories.FindCreateCategory(const aName,
|
||||||
@ -448,7 +444,8 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEToolButtonCategories.FindItemByName(aName: string): TIDEButtonCommand;
|
function TIDEToolButtonCategories.FindItemByName(const aName: string
|
||||||
|
): TIDEButtonCommand;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
@ -625,12 +625,15 @@ var
|
|||||||
begin
|
begin
|
||||||
for I := 0 to SL.Count - 1 do
|
for I := 0 to SL.Count - 1 do
|
||||||
begin
|
begin
|
||||||
Value := SL.Strings[I];
|
Value := SL[I];
|
||||||
if Value = '' then Continue;
|
if Value = '' then Continue;
|
||||||
if Value = cIDEToolbarDivider then
|
if Value = cIDEToolbarDivider then
|
||||||
MI := nil
|
MI := nil
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
MI := IDEToolButtonCategories.FindItemByMenuPathOrName(Value);
|
MI := IDEToolButtonCategories.FindItemByMenuPathOrName(Value);
|
||||||
|
SL[I] := Value;
|
||||||
|
end;
|
||||||
AddListItem(MI);
|
AddListItem(MI);
|
||||||
end;
|
end;
|
||||||
FillToolBar;
|
FillToolBar;
|
||||||
@ -765,6 +768,7 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
mi := IDEToolButtonCategories.FindItemByMenuPathOrName(ButtonName);
|
mi := IDEToolButtonCategories.FindItemByMenuPathOrName(ButtonName);
|
||||||
|
Options.ButtonNames[i] := ButtonName;
|
||||||
if Assigned(mi) then
|
if Assigned(mi) then
|
||||||
AddButton(mi);
|
AddButton(mi);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user