mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 12:30:36 +02:00
SourceEditor: Fix to show bookmark pop-up menu using key-shortcut (without toolbar). Fixes regression from issue #35883
(cherry picked from commit 9519a967ca
)
This commit is contained in:
parent
c241f20c7f
commit
0bf8dc1256
@ -1444,6 +1444,27 @@ var
|
|||||||
EnglishMITNotice: string;
|
EnglishMITNotice: string;
|
||||||
|
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TToolButton_GotoBookmarks }
|
||||||
|
|
||||||
|
TToolButton_GotoBookmarks = class(TIDEToolButton_ButtonDrop)
|
||||||
|
protected
|
||||||
|
procedure RefreshMenu; override;
|
||||||
|
public
|
||||||
|
class procedure ShowAloneMenu(Sender: TObject); static;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TToolButton_ToggleBookmarks }
|
||||||
|
|
||||||
|
TToolButton_ToggleBookmarks = class(TIDEToolButton_ButtonDrop)
|
||||||
|
protected
|
||||||
|
procedure RefreshMenu; override;
|
||||||
|
public
|
||||||
|
class procedure ShowAloneMenu(Sender: TObject); static;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
@ -1701,8 +1722,10 @@ begin
|
|||||||
{%region *** Goto Marks section ***}
|
{%region *** Goto Marks section ***}
|
||||||
SrcEditMenuSectionMarks:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'Marks section');
|
SrcEditMenuSectionMarks:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'Marks section');
|
||||||
// register the Goto Bookmarks Submenu
|
// register the Goto Bookmarks Submenu
|
||||||
SrcEditSubMenuGotoBookmarks:=RegisterIDESubMenu(SrcEditMenuSectionMarks,
|
SrcEditSubMenuGotoBookmarks:=RegisterIDESubMenu(AParent,
|
||||||
'Goto bookmarks submenu', uemGotoBookmark, nil, nil, 'menu_goto_bookmarks');
|
'Goto bookmarks', uemGotoBookmark,
|
||||||
|
nil, TNotifyProcedure(@TToolButton_GotoBookmarks.ShowAloneMenu),
|
||||||
|
'menu_goto_bookmarks');
|
||||||
AParent:=SrcEditSubMenuGotoBookmarks;
|
AParent:=SrcEditSubMenuGotoBookmarks;
|
||||||
for I in TBookmarkNumRange do
|
for I in TBookmarkNumRange do
|
||||||
SrcEditMenuGotoBookmark[I]:=RegisterIDEMenuCommand(AParent,
|
SrcEditMenuGotoBookmark[I]:=RegisterIDEMenuCommand(AParent,
|
||||||
@ -1720,8 +1743,10 @@ begin
|
|||||||
{%endregion}
|
{%endregion}
|
||||||
|
|
||||||
{%region *** Toggle Bookmarks Submenu ***}
|
{%region *** Toggle Bookmarks Submenu ***}
|
||||||
SrcEditSubMenuToggleBookmarks:=RegisterIDESubMenu(SrcEditMenuSectionMarks,
|
SrcEditSubMenuToggleBookmarks:=RegisterIDESubMenu(AParent,
|
||||||
'Toggle bookmarks submenu', uemToggleBookmark, nil, nil, 'menu_toggle_bookmarks');
|
'Toggle bookmarks', uemToggleBookmark,
|
||||||
|
nil, TNotifyProcedure(@TToolButton_ToggleBookmarks.ShowAloneMenu),
|
||||||
|
'menu_toggle_bookmarks');
|
||||||
AParent:=SrcEditSubMenuToggleBookmarks;
|
AParent:=SrcEditSubMenuToggleBookmarks;
|
||||||
for I in TBookmarkNumRange do
|
for I in TBookmarkNumRange do
|
||||||
SrcEditMenuToggleBookmark[I]:=RegisterIDEMenuCommand(AParent,
|
SrcEditMenuToggleBookmark[I]:=RegisterIDEMenuCommand(AParent,
|
||||||
@ -1848,6 +1873,68 @@ begin
|
|||||||
Result:=CompareFilenames(AnsiString(FileNameStr),SE1.FileName);
|
Result:=CompareFilenames(AnsiString(FileNameStr),SE1.FileName);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TToolButton_GotoBookmarks }
|
||||||
|
|
||||||
|
procedure TToolButton_GotoBookmarks.RefreshMenu;
|
||||||
|
var
|
||||||
|
i: TIDEMenuCommand;
|
||||||
|
begin
|
||||||
|
for i in SrcEditMenuGotoBookmark do
|
||||||
|
if i <> nil then begin
|
||||||
|
i.CreateMenuItem;
|
||||||
|
DropdownMenu.Items.Add(i.MenuItem);
|
||||||
|
end;
|
||||||
|
DropdownMenu.Items.AddSeparator;
|
||||||
|
SrcEditMenuPrevBookmark.CreateMenuItem;
|
||||||
|
SrcEditMenuNextBookmark.CreateMenuItem;
|
||||||
|
DropdownMenu.Items.Add([
|
||||||
|
SrcEditMenuPrevBookmark.MenuItem,
|
||||||
|
SrcEditMenuNextBookmark.MenuItem]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TToolButton_GotoBookmarks.ShowAloneMenu(Sender: TObject); // on shortcuts only
|
||||||
|
const
|
||||||
|
Btn: TToolButton_GotoBookmarks=nil; // static var
|
||||||
|
begin
|
||||||
|
if Btn = nil then
|
||||||
|
Btn := TToolButton_GotoBookmarks.Create(Application);
|
||||||
|
Btn.PopUpAloneMenu(nil);
|
||||||
|
// Btn should not be destroyed immediately after PopUp
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{ TToolButton_ToggleBookmarks }
|
||||||
|
|
||||||
|
procedure TToolButton_ToggleBookmarks.RefreshMenu;
|
||||||
|
var
|
||||||
|
i: TIDEMenuCommand;
|
||||||
|
begin
|
||||||
|
for i in SrcEditMenuToggleBookmark do
|
||||||
|
if i <> nil then begin
|
||||||
|
i.CreateMenuItem;
|
||||||
|
DropdownMenu.Items.Add(i.MenuItem);
|
||||||
|
end;
|
||||||
|
DropdownMenu.Items.AddSeparator;
|
||||||
|
SrcEditMenuSetFreeBookmark.CreateMenuItem;
|
||||||
|
DropdownMenu.Items.Add(SrcEditMenuSetFreeBookmark.MenuItem);
|
||||||
|
DropdownMenu.Items.AddSeparator;
|
||||||
|
SrcEditMenuClearFileBookmark.CreateMenuItem;
|
||||||
|
SrcEditMenuClearAllBookmark.CreateMenuItem;
|
||||||
|
DropdownMenu.Items.Add([
|
||||||
|
SrcEditMenuClearFileBookmark.MenuItem,
|
||||||
|
SrcEditMenuClearAllBookmark.MenuItem]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class procedure TToolButton_ToggleBookmarks.ShowAloneMenu(Sender: TObject); // on shortcuts only
|
||||||
|
const
|
||||||
|
Btn: TToolButton_ToggleBookmarks=nil; // static var
|
||||||
|
begin
|
||||||
|
if Btn = nil then
|
||||||
|
Btn := TToolButton_ToggleBookmarks.Create(Application);
|
||||||
|
Btn.PopUpAloneMenu(nil);
|
||||||
|
// Btn should not be destroyed immediately after PopUp
|
||||||
|
end;
|
||||||
|
|
||||||
{ TSourceEditorWordCompletion }
|
{ TSourceEditorWordCompletion }
|
||||||
|
|
||||||
constructor TSourceEditorWordCompletion.Create;
|
constructor TSourceEditorWordCompletion.Create;
|
||||||
@ -10833,13 +10920,14 @@ begin
|
|||||||
SrcEditMenuClearFileBookmark.Command:=GetIdeCmdRegToolBtn(ecClearBookmarkForFile);
|
SrcEditMenuClearFileBookmark.Command:=GetIdeCmdRegToolBtn(ecClearBookmarkForFile);
|
||||||
SrcEditMenuClearAllBookmark.Command:=GetIdeCmdRegToolBtn(ecClearAllBookmark);
|
SrcEditMenuClearAllBookmark.Command:=GetIdeCmdRegToolBtn(ecClearAllBookmark);
|
||||||
|
|
||||||
|
SrcEditSubMenuGotoBookmarks.Command:=GetCommand(ecGotoBookmarks, TToolButton_GotoBookmarks);
|
||||||
|
SrcEditSubMenuToggleBookmarks.Command:=GetCommand(ecToggleBookmarks, TToolButton_ToggleBookmarks);
|
||||||
|
|
||||||
for i in TBookmarkNumRange do
|
for i in TBookmarkNumRange do
|
||||||
SrcEditMenuGotoBookmark[i].Command := GetIdeCmdRegToolBtn(ecGotoMarker0 + i);
|
SrcEditMenuGotoBookmark[i].Command := GetIdeCmdRegToolBtn(ecGotoMarker0 + i);
|
||||||
GetCommand_ButtonDrop(ecGotoBookmarks ,SrcEditSubMenuGotoBookmarks); // [ ▼]
|
|
||||||
|
|
||||||
for i in TBookmarkNumRange do
|
for i in TBookmarkNumRange do
|
||||||
SrcEditMenuToggleBookmark[i].Command := GetIdeCmdRegToolBtn(ecToggleMarker0 + i);
|
SrcEditMenuToggleBookmark[i].Command := GetIdeCmdRegToolBtn(ecToggleMarker0 + i);
|
||||||
GetCommand_ButtonDrop(ecToggleBookmarks ,SrcEditSubMenuToggleBookmarks); // [ ▼]
|
|
||||||
|
|
||||||
{%region *** Source Section ***}
|
{%region *** Source Section ***}
|
||||||
SrcEditMenuEncloseSelection.Command:=GetIdeCmdRegToolBtn(ecSelectionEnclose);
|
SrcEditMenuEncloseSelection.Command:=GetIdeCmdRegToolBtn(ecSelectionEnclose);
|
||||||
|
Loading…
Reference in New Issue
Block a user