mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 21:06:39 +02:00
IDE: change order of Source Editor popup sections + other fixes.
git-svn-id: trunk@35738 -
This commit is contained in:
parent
80faea06cf
commit
bf285bb78e
@ -1148,6 +1148,11 @@ const
|
|||||||
SourceEditorMenuRootName = 'SourceEditor';
|
SourceEditorMenuRootName = 'SourceEditor';
|
||||||
|
|
||||||
var
|
var
|
||||||
|
// Clipboard
|
||||||
|
SrcEditMenuCut: TIDEMenuCommand;
|
||||||
|
SrcEditMenuCopy: TIDEMenuCommand;
|
||||||
|
SrcEditMenuPaste: TIDEMenuCommand;
|
||||||
|
SrcEditMenuCopyFilename: TIDEMenuCommand;
|
||||||
SrcEditMenuFindDeclaration: TIDEMenuCommand;
|
SrcEditMenuFindDeclaration: TIDEMenuCommand;
|
||||||
// finding / jumping
|
// finding / jumping
|
||||||
SrcEditMenuProcedureJump: TIDEMenuCommand;
|
SrcEditMenuProcedureJump: TIDEMenuCommand;
|
||||||
@ -1159,10 +1164,6 @@ var
|
|||||||
SrcEditMenuOpenFileAtCursor: TIDEMenuCommand;
|
SrcEditMenuOpenFileAtCursor: TIDEMenuCommand;
|
||||||
SrcEditMenuClosePage: TIDEMenuCommand;
|
SrcEditMenuClosePage: TIDEMenuCommand;
|
||||||
SrcEditMenuCloseOtherPages: TIDEMenuCommand;
|
SrcEditMenuCloseOtherPages: TIDEMenuCommand;
|
||||||
SrcEditMenuCut: TIDEMenuCommand;
|
|
||||||
SrcEditMenuCopy: TIDEMenuCommand;
|
|
||||||
SrcEditMenuPaste: TIDEMenuCommand;
|
|
||||||
SrcEditMenuCopyFilename: TIDEMenuCommand;
|
|
||||||
// bookmarks
|
// bookmarks
|
||||||
SrcEditMenuNextBookmark: TIDEMenuCommand;
|
SrcEditMenuNextBookmark: TIDEMenuCommand;
|
||||||
SrcEditMenuPrevBookmark: TIDEMenuCommand;
|
SrcEditMenuPrevBookmark: TIDEMenuCommand;
|
||||||
@ -1346,10 +1347,20 @@ begin
|
|||||||
AParent:=SourceEditorMenuRoot;
|
AParent:=SourceEditorMenuRoot;
|
||||||
|
|
||||||
// register the first dynamic section for often used context sensitive stuff
|
// register the first dynamic section for often used context sensitive stuff
|
||||||
SrcEditMenuSectionFirstDynamic:=RegisterIDEMenuSection(AParent, 'First dynamic section');
|
SrcEditMenuSectionFirstDynamic:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'First dynamic section');
|
||||||
|
|
||||||
|
{%region *** Clipboard section ***}
|
||||||
|
SrcEditMenuSectionClipboard:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'Clipboard');
|
||||||
|
AParent:=SrcEditMenuSectionClipboard;
|
||||||
|
|
||||||
|
SrcEditMenuCut:=RegisterIDEMenuCommand(AParent,'Cut',lisCut, nil, nil, nil, 'laz_cut');
|
||||||
|
SrcEditMenuCopy:=RegisterIDEMenuCommand(AParent,'Copy',lisCopy, nil, nil, nil, 'laz_copy');
|
||||||
|
SrcEditMenuPaste:=RegisterIDEMenuCommand(AParent,'Paste',lisPaste, nil, nil, nil, 'laz_paste');
|
||||||
|
SrcEditMenuCopyFilename:=RegisterIDEMenuCommand(AParent,'Copy filename', uemCopyFilename);
|
||||||
|
{%endregion}
|
||||||
|
|
||||||
{%region *** first static section *** }
|
{%region *** first static section *** }
|
||||||
SrcEditMenuSectionFirstStatic:=RegisterIDEMenuSection(AParent, 'First static section');
|
SrcEditMenuSectionFirstStatic:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'First static section');
|
||||||
AParent:=SrcEditMenuSectionFirstStatic;
|
AParent:=SrcEditMenuSectionFirstStatic;
|
||||||
|
|
||||||
SrcEditMenuFindDeclaration := RegisterIDEMenuCommand
|
SrcEditMenuFindDeclaration := RegisterIDEMenuCommand
|
||||||
@ -1403,16 +1414,6 @@ begin
|
|||||||
{%endregion}
|
{%endregion}
|
||||||
{%endregion}
|
{%endregion}
|
||||||
|
|
||||||
{%region *** Clipboard section ***}
|
|
||||||
SrcEditMenuSectionClipboard:=RegisterIDEMenuSection(SourceEditorMenuRoot, 'Clipboard');
|
|
||||||
AParent:=SrcEditMenuSectionClipboard;
|
|
||||||
|
|
||||||
SrcEditMenuCut:=RegisterIDEMenuCommand(AParent,'Cut',lisCut, nil, nil, nil, 'laz_cut');
|
|
||||||
SrcEditMenuCopy:=RegisterIDEMenuCommand(AParent,'Copy',lisCopy, nil, nil, nil, 'laz_copy');
|
|
||||||
SrcEditMenuPaste:=RegisterIDEMenuCommand(AParent,'Paste',lisPaste, nil, nil, nil, 'laz_paste');
|
|
||||||
SrcEditMenuCopyFilename:=RegisterIDEMenuCommand(AParent,'Copy filename', uemCopyFilename);
|
|
||||||
{%endregion}
|
|
||||||
|
|
||||||
{%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
|
||||||
@ -5367,19 +5368,20 @@ var
|
|||||||
NBAvail: Boolean;
|
NBAvail: Boolean;
|
||||||
PageCtrl: TPageControl;
|
PageCtrl: TPageControl;
|
||||||
PopM: TPopupMenu;
|
PopM: TPopupMenu;
|
||||||
|
PageI: integer;
|
||||||
begin
|
begin
|
||||||
PopM:=TPopupMenu(Sender);
|
PopM:=TPopupMenu(Sender);
|
||||||
SourceTabMenuRoot.MenuItem:=PopM.Items;
|
SourceTabMenuRoot.MenuItem:=PopM.Items;
|
||||||
SourceTabMenuRoot.BeginUpdate;
|
SourceTabMenuRoot.BeginUpdate;
|
||||||
try
|
try
|
||||||
RemoveUserDefinedMenuItems;
|
|
||||||
RemoveContextMenuItems;
|
|
||||||
|
|
||||||
// Get the tab that was clicked
|
// Get the tab that was clicked
|
||||||
Assert(PopM.PopupComponent is TPageControl, 'PopupComponent is not TPageControl');
|
Assert(PopM.PopupComponent is TPageControl, 'PopupComponent is not TPageControl');
|
||||||
PageCtrl:=TPageControl(PopM.PopupComponent);
|
PageCtrl:=TPageControl(PopM.PopupComponent);
|
||||||
PageIndex:=PageCtrl.TabIndexAtClientPos(PageCtrl.ScreenToClient(PopM.PopupPoint));
|
PageI:=PageCtrl.TabIndexAtClientPos(PageCtrl.ScreenToClient(PopM.PopupPoint));
|
||||||
//DebugLn(['TSourceNotebook.TabPopUpMenuPopup: Popup PageIndex=', PageIndex]);
|
if (PageI>=0) and (PageI<PageCtrl.PageCount) then
|
||||||
|
PageIndex:=PageI
|
||||||
|
else
|
||||||
|
DebugLn(['TSourceNotebook.TabPopUpMenuPopup: Popup PageIndex=', PageI]);
|
||||||
ASrcEdit:=Editors[PageIndex];
|
ASrcEdit:=Editors[PageIndex];
|
||||||
|
|
||||||
// editor layout
|
// editor layout
|
||||||
@ -5447,17 +5449,24 @@ var
|
|||||||
Marks: PSourceMark;
|
Marks: PSourceMark;
|
||||||
i, MarkCount: integer;
|
i, MarkCount: integer;
|
||||||
EditorPopupPoint, EditorCaret: TPoint;
|
EditorPopupPoint, EditorCaret: TPoint;
|
||||||
SelAvail, SelAvailAndWritable: Boolean;
|
SelAvail, SelAvailAndWritable, AtIdentifier: Boolean;
|
||||||
CurWordAtCursor: String;
|
CurWordAtCursor: String;
|
||||||
AtIdentifier: Boolean;
|
|
||||||
begin
|
begin
|
||||||
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
|
SourceEditorMenuRoot.MenuItem:=SrcPopupMenu.Items;
|
||||||
SourceEditorMenuRoot.BeginUpdate;
|
SourceEditorMenuRoot.BeginUpdate;
|
||||||
try
|
try
|
||||||
|
RemoveUserDefinedMenuItems;
|
||||||
|
RemoveContextMenuItems;
|
||||||
|
|
||||||
ASrcEdit:=FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
|
ASrcEdit:=FindSourceEditorWithEditorComponent(TPopupMenu(Sender).PopupComponent);
|
||||||
Assert(Assigned(ASrcEdit), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit=nil');
|
Assert(Assigned(ASrcEdit), 'TSourceNotebook.SrcPopUpMenuPopup: ASrcEdit=nil');
|
||||||
EditorComp:=ASrcEdit.EditorComponent;
|
EditorComp:=ASrcEdit.EditorComponent;
|
||||||
|
|
||||||
|
// Clipboard section:
|
||||||
|
SrcEditMenuCut.Enabled := ASrcEdit.SelectionAvailable and not ASrcEdit.ReadOnly;
|
||||||
|
SrcEditMenuCopy.Enabled := ASrcEdit.SelectionAvailable;
|
||||||
|
SrcEditMenuPaste.Enabled := not ASrcEdit.ReadOnly;
|
||||||
|
|
||||||
// Files section: Readonly, ShowLineNumbers
|
// Files section: Readonly, ShowLineNumbers
|
||||||
SrcEditMenuReadOnly.Checked:=ASrcEdit.ReadOnly;
|
SrcEditMenuReadOnly.Checked:=ASrcEdit.ReadOnly;
|
||||||
SrcEditMenuShowLineNumbers.Checked := ASrcEdit.EditorComponent.Gutter.LineNumberPart.Visible;
|
SrcEditMenuShowLineNumbers.Checked := ASrcEdit.EditorComponent.Gutter.LineNumberPart.Visible;
|
||||||
@ -5510,11 +5519,6 @@ begin
|
|||||||
true,@OnPopupMenuOpenFile);
|
true,@OnPopupMenuOpenFile);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Clipboard
|
|
||||||
SrcEditMenuCut.Enabled := ASrcEdit.SelectionAvailable and not ASrcEdit.ReadOnly;
|
|
||||||
SrcEditMenuCopy.Enabled := ASrcEdit.SelectionAvailable;
|
|
||||||
SrcEditMenuPaste.Enabled := not ASrcEdit.ReadOnly;
|
|
||||||
|
|
||||||
// bookmarks
|
// bookmarks
|
||||||
for BookMarkID:=0 to 9 do begin
|
for BookMarkID:=0 to 9 do begin
|
||||||
MarkDesc:=' '+IntToStr(BookMarkID);
|
MarkDesc:=' '+IntToStr(BookMarkID);
|
||||||
|
@ -390,10 +390,10 @@ var
|
|||||||
// Source Editor: First dynamic section for often used context sensitive stuff
|
// Source Editor: First dynamic section for often used context sensitive stuff
|
||||||
// The items are cleared automatically after each popup.
|
// The items are cleared automatically after each popup.
|
||||||
SrcEditMenuSectionFirstDynamic: TIDEMenuSection;
|
SrcEditMenuSectionFirstDynamic: TIDEMenuSection;
|
||||||
|
SrcEditMenuSectionClipboard: TIDEMenuSection;
|
||||||
SrcEditMenuSectionFirstStatic: TIDEMenuSection;
|
SrcEditMenuSectionFirstStatic: TIDEMenuSection;
|
||||||
SrcEditSubMenuFind: TIDEMenuSection;
|
SrcEditSubMenuFind: TIDEMenuSection;
|
||||||
SrcEditMenuSectionFiles: TIDEMenuSection;
|
SrcEditMenuSectionFiles: TIDEMenuSection;
|
||||||
SrcEditMenuSectionClipboard: TIDEMenuSection;
|
|
||||||
SrcEditMenuSectionMarks: TIDEMenuSection;
|
SrcEditMenuSectionMarks: TIDEMenuSection;
|
||||||
SrcEditSubMenuGotoBookmarks: TIDEMenuSection;
|
SrcEditSubMenuGotoBookmarks: TIDEMenuSection;
|
||||||
SrcEditSubMenuToggleBookmarks: TIDEMenuSection;
|
SrcEditSubMenuToggleBookmarks: TIDEMenuSection;
|
||||||
|
Loading…
Reference in New Issue
Block a user