mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-08 05:58:14 +02:00
Designer: Name Menu separators as "SeparatorX" to make name clashes less likely. Issue #39471.
This commit is contained in:
parent
dda96a3864
commit
641c3a73f0
@ -5994,7 +5994,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
Designer:=FindRootDesigner(MI);
|
Designer:=FindRootDesigner(MI);
|
||||||
if Designer<>nil then
|
if Designer<>nil then
|
||||||
MI.Name:=Designer.UniqueName('N');
|
MI.Name:=Designer.UniqueName('Separator');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
SetStrValue(NewValue);
|
SetStrValue(NewValue);
|
||||||
|
@ -724,7 +724,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FEditedMenuItem.Caption:=s;
|
FEditedMenuItem.Caption:=s;
|
||||||
if (s = cLineCaption) and AnsiStartsStr('MenuItem', FEditedMenuItem.Name) then
|
if (s = cLineCaption) and AnsiStartsStr('MenuItem', FEditedMenuItem.Name) then
|
||||||
FEditedMenuItem.Name:=FEditorDesigner.CreateUniqueComponentName('N');
|
FEditedMenuItem.Name:=FEditorDesigner.CreateUniqueComponentName('Separator');
|
||||||
GlobalDesignHook.RefreshPropertyValues;
|
GlobalDesignHook.RefreshPropertyValues;
|
||||||
GlobalDesignHook.Modified(FEditedMenuItem);
|
GlobalDesignHook.Modified(FEditedMenuItem);
|
||||||
EditedShadow.Invalidate;
|
EditedShadow.Invalidate;
|
||||||
@ -1971,17 +1971,22 @@ procedure TShadowBox.AddItemAndShadow(existingSI: TShadowItem;
|
|||||||
var
|
var
|
||||||
idx: integer;
|
idx: integer;
|
||||||
newMI: TMenuItem;
|
newMI: TMenuItem;
|
||||||
|
nm: string;
|
||||||
begin
|
begin
|
||||||
FShadowMenu.HideFakes;
|
FShadowMenu.HideFakes;
|
||||||
idx:=existingSI.RealItem.MenuIndex;
|
idx:=existingSI.RealItem.MenuIndex;
|
||||||
if not addBefore then
|
if not addBefore then
|
||||||
Inc(idx);
|
Inc(idx);
|
||||||
newMI:=TMenuItem.Create(FShadowMenu.LookupRoot);
|
newMI:=TMenuItem.Create(FShadowMenu.LookupRoot);
|
||||||
newMI.Name:=FShadowMenu.FEditorDesigner.CreateUniqueComponentName(newMI.ClassName);
|
if isSeparator then begin
|
||||||
if isSeparator then
|
nm:='Separator';
|
||||||
newMI.Caption:=cLineCaption
|
newMI.Caption:=cLineCaption;
|
||||||
else
|
end
|
||||||
|
else begin
|
||||||
|
nm:=newMI.ClassName;
|
||||||
newMI.Caption:=newMI.Name;
|
newMI.Caption:=newMI.Name;
|
||||||
|
end;
|
||||||
|
newMI.Name:=FShadowMenu.FEditorDesigner.CreateUniqueComponentName(nm);
|
||||||
existingSI.RealItem.Parent.Insert(idx, newMI);
|
existingSI.RealItem.Parent.Insert(idx, newMI);
|
||||||
TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI);
|
TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI);
|
||||||
FShadowMenu.UpdateBoxLocationsAndSizes;
|
FShadowMenu.UpdateBoxLocationsAndSizes;
|
||||||
|
Loading…
Reference in New Issue
Block a user