MenuEditor: Update menuitems correctly when adding or removing separators. Patch from BrunoK, issue #37595.

git-svn-id: trunk@63803 -
This commit is contained in:
juha 2020-08-21 16:04:36 +00:00
parent 8b34fff80b
commit dbe82166d0

View File

@ -2007,9 +2007,14 @@ begin
if (sepCount > 0) then begin
FShadowMenu.HideFakes;
ShowAllUnSelected;
nearestMI:=GetNextNonSepItem(FShadowMenu.SelectedMenuItem);
if (nearestMI = nil) then
nearestMI:=GetPreviousNonSepItem(FShadowMenu.SelectedMenuItem);
nearestMI:=FShadowMenu.SelectedMenuItem;
if assigned(nearestMI) and nearestMI.IsLine then begin
nearestMI:=GetNextNonSepItem(FShadowMenu.SelectedMenuItem);
if (nearestMI = nil) then
nearestMI:=GetPreviousNonSepItem(FShadowMenu.SelectedMenuItem);
end
else
FShadowMenu.SelectedMenuItem := nil;
if (nearestMI = nil) then
nearestMI:=FParentMenuItem;
for i:=ParentMenuItem.Count-1 downto 0 do
@ -2030,6 +2035,7 @@ begin
else begin
FShadowMenu.UpdateBoxLocationsAndSizes;
FShadowMenu.SetSelectedMenuItem(nearestMI, False, True);
LocateShadows;
end;
end;
end;
@ -2042,6 +2048,7 @@ begin
if (ShadowList.Count = 0) then
Exit;
FShadowList.Sort(@SortByItemMenuIndex);
DisableAutoSizing;
if IsMenuBar then begin
len:=0;
for si in FShadowList do begin
@ -2059,6 +2066,7 @@ begin
Inc(t, h);
end;
end;
EnableAutoSizing;
end;
constructor TShadowBox.CreateWithParentBox(aSMenu: TShadowMenu;