On 15.10.2015 18:33, Ondrej Pokorny wrote:
On 15.10.2015 16:31, FreeMan wrote:
Problem not just this damages. I can not add "Build ( Shift + F9)" in toolbar still. I wrote this, in last my mail.

Ok, I see that The "Build" button cannot be added. I can confirm the bug and will check why it happens.

Patch attached (Juha?).

Mattias, I see you added a version info into the file. Good! Unfortunately I cannot use it for determining if the buttons are saved in IDEMenuCommand format (old) or the IDEButtonCommand format (new) because when loading the MenuCommands are not available yet. Therefore I changed the FindItemByMenuPathOrName procedure that updates the button name and writes it back. It doesn't use the version info, though.

Ondrej
Index: components/ideintf/toolbarintf.pas
===================================================================
--- components/ideintf/toolbarintf.pas  (revision 50072)
+++ components/ideintf/toolbarintf.pas  (working copy)
@@ -88,8 +88,8 @@
       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 @@
   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
+  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
-    //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);
+    Result := FindItemByCommand(xMI.Command);
+    if Assigned(Result) then
+      aName := xMI.Command.Name;
   end;
-  Result := FindItemByName(aName);
 end;
 
 function TIDEToolButtonCategories.FindCreateCategory(const aName,
@@ -448,7 +444,8 @@
   Result := nil;
 end;
 
-function TIDEToolButtonCategories.FindItemByName(aName: string): 
TIDEButtonCommand;
+function TIDEToolButtonCategories.FindItemByName(const aName: string
+  ): TIDEButtonCommand;
 var
   i: Integer;
 begin
Index: ide/toolbarconfig.pas
===================================================================
--- ide/toolbarconfig.pas       (revision 50072)
+++ ide/toolbarconfig.pas       (working copy)
@@ -625,12 +625,15 @@
 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 @@
       else
       begin
         mi := IDEToolButtonCategories.FindItemByMenuPathOrName(ButtonName);
+        Options.ButtonNames[i] := ButtonName;
         if Assigned(mi) then
           AddButton(mi);
       end;
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to