mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 12:40:22 +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
|
||||
Designer:=FindRootDesigner(MI);
|
||||
if Designer<>nil then
|
||||
MI.Name:=Designer.UniqueName('N');
|
||||
MI.Name:=Designer.UniqueName('Separator');
|
||||
end;
|
||||
end;
|
||||
SetStrValue(NewValue);
|
||||
|
@ -724,7 +724,7 @@ begin
|
||||
begin
|
||||
FEditedMenuItem.Caption:=s;
|
||||
if (s = cLineCaption) and AnsiStartsStr('MenuItem', FEditedMenuItem.Name) then
|
||||
FEditedMenuItem.Name:=FEditorDesigner.CreateUniqueComponentName('N');
|
||||
FEditedMenuItem.Name:=FEditorDesigner.CreateUniqueComponentName('Separator');
|
||||
GlobalDesignHook.RefreshPropertyValues;
|
||||
GlobalDesignHook.Modified(FEditedMenuItem);
|
||||
EditedShadow.Invalidate;
|
||||
@ -1971,17 +1971,22 @@ procedure TShadowBox.AddItemAndShadow(existingSI: TShadowItem;
|
||||
var
|
||||
idx: integer;
|
||||
newMI: TMenuItem;
|
||||
nm: string;
|
||||
begin
|
||||
FShadowMenu.HideFakes;
|
||||
idx:=existingSI.RealItem.MenuIndex;
|
||||
if not addBefore then
|
||||
Inc(idx);
|
||||
newMI:=TMenuItem.Create(FShadowMenu.LookupRoot);
|
||||
newMI.Name:=FShadowMenu.FEditorDesigner.CreateUniqueComponentName(newMI.ClassName);
|
||||
if isSeparator then
|
||||
newMI.Caption:=cLineCaption
|
||||
else
|
||||
if isSeparator then begin
|
||||
nm:='Separator';
|
||||
newMI.Caption:=cLineCaption;
|
||||
end
|
||||
else begin
|
||||
nm:=newMI.ClassName;
|
||||
newMI.Caption:=newMI.Name;
|
||||
end;
|
||||
newMI.Name:=FShadowMenu.FEditorDesigner.CreateUniqueComponentName(nm);
|
||||
existingSI.RealItem.Parent.Insert(idx, newMI);
|
||||
TShadowItem.CreateWithBoxAndItem(FShadowMenu, existingSI.ParentBox, newMI);
|
||||
FShadowMenu.UpdateBoxLocationsAndSizes;
|
||||
|
Loading…
Reference in New Issue
Block a user