IDE: fixed loading toolbar config from Ondrej

git-svn-id: trunk@50073 -
This commit is contained in:
mattias 2015-10-15 20:55:07 +00:00
parent d6f0f771b5
commit cfb5aea1e9
2 changed files with 20 additions and 19 deletions

View File

@ -88,8 +88,8 @@ type
const aCommand: TIDECommand): TIDEButtonCommand; overload;
function AddButton(const aCommand: TIDECommand): TIDEButtonCommand; overload;
function FindCreateCategory(const aName, aDescription: string): TIDEToolButtonCategory;
function FindItemByName(aName: string): TIDEButtonCommand;
function FindItemByMenuPathOrName(aName: string): TIDEButtonCommand;
function FindItemByName(const aName: string): TIDEButtonCommand;
function FindItemByMenuPathOrName(var aName: string): TIDEButtonCommand;
function FindItemByCommand(const aCommand: TIDECommand): TIDEButtonCommand;
property Items[Index: Integer]: TIDEToolButtonCategory read GetItems; default;
end;
@ -396,26 +396,22 @@ begin
inherited Destroy;
end;
function TIDEToolButtonCategories.FindItemByMenuPathOrName(aName: string
function TIDEToolButtonCategories.FindItemByMenuPathOrName(var aName: string
): TIDEButtonCommand;
var
i: Integer;
xMI: TIDEMenuItem;
begin
i := LastDelimiter('/', aName);
if (i > 0) then
begin
//find by path from aName (backwards compatibility)
xMI := IDEMenuRoots.FindByPath(aName, False);
if Assigned(xMI) and Assigned(xMI.Command) then
begin
Result := FindItemByCommand(xMI.Command);
if Assigned(Result) then
Exit;
end;
Delete(aName, 1, i);
end;
Result := FindItemByName(aName);
if Result<>nil then Exit;
//find by path from aName (backwards compatibility)
xMI := IDEMenuRoots.FindByPath(aName, False);
if Assigned(xMI) and Assigned(xMI.Command) then
begin
Result := FindItemByCommand(xMI.Command);
if Assigned(Result) then
aName := xMI.Command.Name;
end;
end;
function TIDEToolButtonCategories.FindCreateCategory(const aName,
@ -448,7 +444,8 @@ begin
Result := nil;
end;
function TIDEToolButtonCategories.FindItemByName(aName: string): TIDEButtonCommand;
function TIDEToolButtonCategories.FindItemByName(const aName: string
): TIDEButtonCommand;
var
i: Integer;
begin

View File

@ -625,12 +625,15 @@ var
begin
for I := 0 to SL.Count - 1 do
begin
Value := SL.Strings[I];
Value := SL[I];
if Value = '' then Continue;
if Value = cIDEToolbarDivider then
MI := nil
else
begin
MI := IDEToolButtonCategories.FindItemByMenuPathOrName(Value);
SL[I] := Value;
end;
AddListItem(MI);
end;
FillToolBar;
@ -765,6 +768,7 @@ begin
else
begin
mi := IDEToolButtonCategories.FindItemByMenuPathOrName(ButtonName);
Options.ButtonNames[i] := ButtonName;
if Assigned(mi) then
AddButton(mi);
end;