mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 14:18:17 +02:00
LCL: in TMenuItem.InternalRethinkLines un-hide a separator if a previously hidden (but now visible) menu-item was between separators. Part of issue #41028.
This commit is contained in:
parent
9a1bfd8663
commit
3afd9c5762
@ -362,19 +362,40 @@ begin
|
|||||||
for I:= 0 to Count - 1 do
|
for I:= 0 to Count - 1 do
|
||||||
begin
|
begin
|
||||||
CurItem := Items[I];
|
CurItem := Items[I];
|
||||||
if CurItem.IsLine and CurItem.Visible then
|
if CurItem.IsLine {and CurItem.Visible} then
|
||||||
begin
|
begin
|
||||||
debugln(['TMenuItem.InternalRethinkLines: LastVisibleItem=',dbgsname(LastVisibleItem)]);
|
if CurItem.Visible then
|
||||||
if (LastVisibleItem = nil) or (LastVisibleItem.IsLine) or (I = Count-1) then
|
|
||||||
begin
|
begin
|
||||||
CurItem.Visible := False;
|
debugln(['TMenuItem.InternalRethinkLines: LastVisibleItem=',dbgsname(LastVisibleItem)]);
|
||||||
Result := True;
|
if (LastVisibleItem = nil) or (LastVisibleItem.IsLine) or (I = Count-1) then
|
||||||
debugln(['TMenuItem.InternalRethinkLines: hiding separator with name "',CurItem.Name,'"']);
|
begin
|
||||||
|
CurItem.Visible := False;
|
||||||
|
Result := True;
|
||||||
|
debugln(['TMenuItem.InternalRethinkLines: hiding separator with name "',CurItem.Name,'"']);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
//if a previously hidden item is now visible and it was between separators
|
||||||
|
// we may need to unhide the separator now
|
||||||
|
if (LastVisibleItem <> nil) and (not LastVisibleItem.IsLine) then
|
||||||
|
begin
|
||||||
|
CurItem.Visible := True;
|
||||||
|
Result := True;
|
||||||
|
debugln(['TMenuItem.InternalRethinkLines: UNhiding separator with name "',CurItem.Name,'"']);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if CurItem.Visible then
|
if CurItem.Visible then
|
||||||
LastVisibleItem := CurItem;
|
LastVisibleItem := CurItem;
|
||||||
end;//for
|
end;//for
|
||||||
|
//we may have accidently unhidden a separator which turns out to be the last visible item: we must hide that
|
||||||
|
if (LastVisibleItem <> nil) and (LastVisibleItem.IsLine) then
|
||||||
|
begin
|
||||||
|
LastVisibleItem.Visible := False;
|
||||||
|
Result := True;
|
||||||
|
debugln(['TMenuItem.InternalRethinkLines: hiding LastVisibleItem with name "',LastVisibleItem.Name,'"']);
|
||||||
|
end;
|
||||||
end// if AForced or HideSep
|
end// if AForced or HideSep
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user