IDE: New toolbutton command "Open Recent Project". Issue #35883, patch from FTurtle.

git-svn-id: trunk@62096 -
This commit is contained in:
juha 2019-10-20 18:13:56 +00:00
parent 92a535fc1f
commit a555d027da
14 changed files with 187 additions and 222 deletions

3
.gitattributes vendored
View File

@ -8995,6 +8995,9 @@ images/packages/pkg_lrs_200.png -text svneol=unset#image/png
images/packages/pkg_open.png -text svneol=unset#image/png
images/packages/pkg_open_150.png -text svneol=unset#image/png
images/packages/pkg_open_200.png -text svneol=unset#image/png
images/packages/pkg_open_recent.png -text svneol=unset#image/png
images/packages/pkg_open_recent_150.png -text svneol=unset#image/png
images/packages/pkg_open_recent_200.png -text svneol=unset#image/png
images/packages/pkg_package_autoinstall.png -text svneol=unset#image/png
images/packages/pkg_package_autoinstall_150.png -text svneol=unset#image/png
images/packages/pkg_package_autoinstall_200.png -text svneol=unset#image/png

View File

@ -81,13 +81,14 @@ const
ecFindBlockStart = ecFirstLazarus + 22;
ecOpenFileAtCursor = ecFirstLazarus + 23;
ecGotoIncludeDirective = ecFirstLazarus + 24;
ecJumpToInterface = ecFirstLazarus + 25;
ecJumpToInterfaceUses = ecFirstLazarus + 26;
ecJumpToImplementation = ecFirstLazarus + 27;
ecJumpToImplementationUses= ecFirstLazarus + 28;
ecJumpToInitialization = ecFirstLazarus + 29;
ecJumpToProcedureHeader = ecFirstLazarus + 30;
ecJumpToProcedureBegin = ecFirstLazarus + 31;
ecJumpToSection = ecFirstLazarus + 25;
ecJumpToInterface = ecFirstLazarus + 26;
ecJumpToInterfaceUses = ecFirstLazarus + 27;
ecJumpToImplementation = ecFirstLazarus + 28;
ecJumpToImplementationUses= ecFirstLazarus + 29;
ecJumpToInitialization = ecFirstLazarus + 30;
ecJumpToProcedureHeader = ecFirstLazarus + 31;
ecJumpToProcedureBegin = ecFirstLazarus + 32;
// edit selection
ecSelectionUpperCase = ecFirstLazarus + 50;
@ -174,8 +175,9 @@ const
ecRestart = ecFirstLazarus + 213;
ecQuit = ecFirstLazarus + 214;
ecOpenUnit = ecFirstLazarus + 215;
ecCloseOtherTabs = ecFirstLazarus + 216;
ecCloseRightTabs = ecFirstLazarus + 217;
ecOpenRecent = ecFirstLazarus + 216;
ecCloseOtherTabs = ecFirstLazarus + 217;
ecCloseRightTabs = ecFirstLazarus + 218;
// edit menu
ecMultiPaste = ecFirstLazarus + 230;
@ -305,31 +307,33 @@ const
ecNewProject = ecFirstLazarus + 500;
ecNewProjectFromFile = ecFirstLazarus + 501;
ecOpenProject = ecFirstLazarus + 502;
ecCloseProject = ecFirstLazarus + 503;
ecSaveProject = ecFirstLazarus + 504;
ecSaveProjectAs = ecFirstLazarus + 505;
ecPublishProject = ecFirstLazarus + 506;
ecProjectInspector = ecFirstLazarus + 507;
ecAddCurUnitToProj = ecFirstLazarus + 508;
ecRemoveFromProj = ecFirstLazarus + 509;
ecViewProjectUnits = ecFirstLazarus + 510;
ecViewProjectForms = ecFirstLazarus + 511;
ecViewProjectSource = ecFirstLazarus + 512;
ecProjectOptions = ecFirstLazarus + 513;
ecProjectChangeBuildMode = ecFirstLazarus + 514;
ecProjectResaveFormsWithI18n = ecFirstLazarus + 515;
ecOpenRecentProject = ecFirstLazarus + 503;
ecCloseProject = ecFirstLazarus + 504;
ecSaveProject = ecFirstLazarus + 505;
ecSaveProjectAs = ecFirstLazarus + 506;
ecPublishProject = ecFirstLazarus + 507;
ecProjectInspector = ecFirstLazarus + 508;
ecAddCurUnitToProj = ecFirstLazarus + 509;
ecRemoveFromProj = ecFirstLazarus + 510;
ecViewProjectUnits = ecFirstLazarus + 511;
ecViewProjectForms = ecFirstLazarus + 512;
ecViewProjectSource = ecFirstLazarus + 513;
ecProjectOptions = ecFirstLazarus + 514;
ecProjectChangeBuildMode = ecFirstLazarus + 515;
ecProjectResaveFormsWithI18n = ecFirstLazarus + 516;
// package menu
ecOpenPackage = ecFirstLazarus + 600;
ecOpenPackageFile = ecFirstLazarus + 601;
ecOpenPackageOfCurUnit = ecFirstLazarus + 602;
ecAddCurFileToPkg = ecFirstLazarus + 603;
ecNewPkgComponent = ecFirstLazarus + 604;
ecPackageGraph = ecFirstLazarus + 605;
ecPackageLinks = ecFirstLazarus + 606;
ecEditInstallPkgs = ecFirstLazarus + 607;
ecConfigCustomComps = ecFirstLazarus + 608;
ecNewPackage = ecFirstLazarus + 609;
ecOpenRecentPackage = ecFirstLazarus + 603;
ecAddCurFileToPkg = ecFirstLazarus + 604;
ecNewPkgComponent = ecFirstLazarus + 605;
ecPackageGraph = ecFirstLazarus + 606;
ecPackageLinks = ecFirstLazarus + 607;
ecEditInstallPkgs = ecFirstLazarus + 608;
ecConfigCustomComps = ecFirstLazarus + 609;
ecNewPackage = ecFirstLazarus + 610;
// custom tools menu
ecExtToolFirst = ecFirstLazarus + 700;

View File

@ -18,7 +18,7 @@ interface
uses
Classes, SysUtils,
// LCL
Controls, ComCtrls, Menus, Forms,
Controls, ComCtrls, Menus, Forms, LCLType,
// IdeIntf
IDECommands, MenuIntf, IDEImagesIntf, SrcEditorIntf;
@ -29,6 +29,7 @@ type
TIDEButtonCommand = class(TIDESpecialCommand)
private
FTag: PtrInt;
FToolButtonClass: TIDEToolButtonClass;
FToolButtons: TIDEToolButtons;
protected
@ -46,6 +47,7 @@ type
constructor Create(const TheName: string); override;
destructor Destroy; override;
public
property Tag: PtrInt read FTag write FTag;
property ToolButtonClass: TIDEToolButtonClass read FToolButtonClass write FToolButtonClass;
property ToolButtons: TIDEToolButtons read FToolButtons;
end;
@ -64,35 +66,41 @@ type
property Item: TIDEButtonCommand read FItem write FItem;
end;
{ TIDEToolButtonWithArrow }
{%region *** Classes for toolbuttons with arrow *** }
TIDEToolButtonWithArrow = class(TIDEToolButton)
TIDEToolButton_WithArrow_Class = class of TIDEToolButton_WithArrow;
TIDEToolButton_ButtonDrop_Class = class of TIDEToolButton_ButtonDrop;
TIDEToolButton_DropDown_Class = class of TIDEToolButton_DropDown;
{ TIDEToolButton_WithArrow } // [ ][], [ ]
TIDEToolButton_WithArrow = class(TIDEToolButton)
private
function GetSection: TIDEMenuSection;
protected
procedure AddMenuItem(ACommand: TIDEMenuCommand); virtual;
procedure AddMenuItems(ACommands: array of TIDEMenuCommand);
procedure DoOnMenuItemClick(Sender: TObject);
procedure DoOnMenuPopup(Sender: TObject);
procedure RefreshMenu; virtual;
property Section: TIDEMenuSection read GetSection;
public
constructor Create(AOwner: TComponent); override;
end;
{ TIDEToolButton_ButtonDrop }
{ TIDEToolButton_DropDown } // [ ][]
TIDEToolButton_ButtonDrop = class(TIDEToolButtonWithArrow)
TIDEToolButton_DropDown = class(TIDEToolButton_WithArrow)
public
procedure DoOnAdded; override;
end;
{ TIDEToolButton_ButtonDrop } // [ ]
TIDEToolButton_ButtonDrop = class(TIDEToolButton_WithArrow)
protected
procedure PopUpAloneMenu;
procedure PopUpAloneMenu(Sender: TObject);
public
procedure DoOnAdded; override;
end;
{ TIDEToolButton_DropDown }
TIDEToolButton_DropDown = class(TIDEToolButtonWithArrow)
public
procedure DoOnAdded; override;
end;
{%endregion}
TIDEToolButtonCategory = class
private
@ -171,6 +179,12 @@ function RegisterIDEButtonCommand(const aCategory: TIDEToolButtonCategory; const
const aCommand: TIDECommand): TIDEButtonCommand;
function RegisterIDEButtonCommand(const aCommand: TIDECommand): TIDEButtonCommand;
function GetCommand_DropDown(ACommand: Word; AMenuSection: TIDEMenuSection;
AButtonClass: TIDEToolButton_DropDown_Class=nil): TIDECommand;
function GetCommand_ButtonDrop(ACommand: Word; AMenuSection: TIDEMenuSection;
AButtonClass: TIDEToolButton_ButtonDrop_Class=nil): TIDECommand;
implementation
function RegisterIDEButtonCategory(const aName, aDescription: string): TIDEToolButtonCategory;
@ -189,9 +203,42 @@ begin
Result := IDEToolButtonCategories.AddButton(aCommand);
end;
{ TIDEToolButtonWithArrow }
{%region *** Functions and classes for toolbuttons with arrow *** }
constructor TIDEToolButtonWithArrow.Create(AOwner: TComponent);
function GetCommand_BtnWithArrow(ACommand: Word; AMenuSection: TIDEMenuSection; // not in Interface
AButtonClass: TIDEToolButton_WithArrow_Class): TIDECommand;
var
ButtonCommand: TIDEButtonCommand;
begin
Result:=IDECommandList.FindIDECommand(ACommand);
if Result=nil then
Exit(nil);
ButtonCommand:=RegisterIDEButtonCommand(Result);
ButtonCommand.ToolButtonClass:=AButtonClass;
if AButtonClass.InheritsFrom(TIDEToolButton_ButtonDrop) then
ButtonCommand.ImageIndex:=AMenuSection.ImageIndex;
ButtonCommand.Tag:=PtrInt(AMenuSection);
end;
function GetCommand_DropDown(ACommand: Word; AMenuSection: TIDEMenuSection;
AButtonClass: TIDEToolButton_DropDown_Class=nil): TIDECommand;
begin
if AButtonClass=nil then
AButtonClass:=TIDEToolButton_DropDown;
Result:=GetCommand_BtnWithArrow(ACommand, AMenuSection, AButtonClass);
end;
function GetCommand_ButtonDrop(ACommand: Word; AMenuSection: TIDEMenuSection;
AButtonClass: TIDEToolButton_ButtonDrop_Class=nil): TIDECommand;
begin
if AButtonClass=nil then
AButtonClass:=TIDEToolButton_ButtonDrop;
Result:=GetCommand_BtnWithArrow(ACommand, AMenuSection, AButtonClass);
end;
{ TIDEToolButton_WithArrow }
constructor TIDEToolButton_WithArrow.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
DropdownMenu := TPopupMenu.Create(Self);
@ -199,74 +246,28 @@ begin
DropdownMenu.OnPopup := @DoOnMenuPopup;
end;
procedure TIDEToolButtonWithArrow.AddMenuItem(ACommand: TIDEMenuCommand);
var
Itm: TMenuItem;
function TIDEToolButton_WithArrow.GetSection: TIDEMenuSection;
begin
Itm := TMenuItem.Create(DropdownMenu);
Itm.Caption := ACommand.Caption;
Itm.ShortCut := ACommand.Command.AsShortCut;
Itm.ImageIndex := ACommand.ImageIndex;
Itm.Enabled := ACommand.Enabled;
Itm.OnClick := @DoOnMenuItemClick;
Itm.Tag := PtrInt(ACommand);
DropdownMenu.Items.Add(Itm);
Result:=nil;
if (Item<>nil) then
Result:=TIDEMenuSection(Item.Tag);
end;
procedure TIDEToolButtonWithArrow.AddMenuItems(ACommands: array of TIDEMenuCommand);
var
Cmd: TIDEMenuCommand;
begin
for Cmd in ACommands do
AddMenuItem(Cmd);
end;
procedure TIDEToolButtonWithArrow.DoOnMenuPopup(Sender: TObject);
procedure TIDEToolButton_WithArrow.DoOnMenuPopup(Sender: TObject);
begin
DropdownMenu.Items.Clear;
RefreshMenu;
end;
procedure TIDEToolButtonWithArrow.RefreshMenu;
procedure TIDEToolButton_WithArrow.RefreshMenu;
begin
{ Override this method in descendants.
DropdownMenu fully regenerates for every showing on OnPopup event.
So, RefreshMenu calling happens:
- On click to arrow (Style=tbsDropDown)
- On click to button (Style=tbsButtonDrop)
- On popup alone menu in static methods (on shortcuts)
of TIDEToolButton_ButtonDrop descendants (Style is not matter)
At calling time:
- Instance of DropdownMenu exists
- DropdownMenu is empty }
end;
procedure TIDEToolButtonWithArrow.DoOnMenuItemClick(Sender: TObject);
var
Cmd: TIDEMenuCommand;
begin
Cmd:=TIDEMenuCommand((Sender as TMenuItem).Tag);
Cmd.DoOnClick; // Sender in handler should be a command but not a menu item
end;
{ TIDEToolButton_ButtonDrop }
procedure TIDEToolButton_ButtonDrop.DoOnAdded;
begin
Style := tbsButtonDrop; // not in constructor
end;
procedure TIDEToolButton_ButtonDrop.PopUpAloneMenu;
var
ActiveEditor: TSourceEditorInterface;
ScreenXY: TPoint;
begin
ActiveEditor := SourceEditorManagerIntf.ActiveEditor;
if ActiveEditor=nil then
if Section=nil then
Exit;
ScreenXY := ActiveEditor.EditorControl.ClientToScreen(Point(0, 0));
DropdownMenu.PopUp(ScreenXY.X, ScreenXY.Y);
if Section.MenuItem=nil then
Section.GetRoot.CreateMenuItem; // this forces creating menu (it is necessary
// for TPopupMenu before first popup)
if Section.MenuItem<>nil then
DropdownMenu.Items.Assign(Section.MenuItem);
end;
{ TIDEToolButton_DropDown }
@ -276,6 +277,29 @@ begin
Style := tbsDropDown; // not in constructor
end;
{ TIDEToolButton_ButtonDrop }
procedure TIDEToolButton_ButtonDrop.DoOnAdded;
begin
Style := tbsButtonDrop; // not in constructor
if (Item<>nil) then
if (Item.Command<>nil) then
Item.Command.OnExecute:=@PopUpAloneMenu;
end;
procedure TIDEToolButton_ButtonDrop.PopUpAloneMenu(Sender: TObject);
var
ActiveEditor: TSourceEditorInterface;
ScreenXY: TPoint;
begin
ActiveEditor := SourceEditorManagerIntf.ActiveEditor;
if ActiveEditor=nil then
Exit;
ScreenXY := ActiveEditor.EditorControl.ClientToScreen(Point(0, 0));
DropdownMenu.PopUp(ScreenXY.X, ScreenXY.Y);
end;
{%endregion}
{ TIDEToolButtonsEnumerator }
constructor TIDEToolButtonsEnumerator.Create(AButtons: TIDEToolButtons);
@ -285,6 +309,7 @@ begin
FPosition := -1;
end;
function TIDEToolButtonsEnumerator.GetCurrent: TIDEToolButton;
begin
Result := FList[FPosition];

View File

@ -510,6 +510,7 @@ begin
ecNewForm : Result:= lisMenuNewForm;
ecOpen : Result:= lisMenuOpen;
ecOpenUnit : Result:= lisMenuOpenUnit;
ecOpenRecent : Result:= lisTBOpenRecent;
ecRevert : Result:= lisMenuRevert;
ecSave : Result:= lisSave;
ecSaveAs : Result:= lisMenuSaveAs;
@ -580,6 +581,7 @@ begin
ecJumpToNextError : Result:= lisMenuJumpToNextError;
ecJumpToPrevError : Result:= lisMenuJumpToPrevError;
ecGotoIncludeDirective : Result:= srkmecGotoIncludeDirective;
ecJumpToSection : Result:= lisMenuJumpTo;
ecJumpToInterface : Result:= lisMenuJumpToInterface;
ecJumpToInterfaceUses : Result:= lisMenuJumpToInterfaceUses;
ecJumpToImplementation : Result:= lisMenuJumpToImplementation;
@ -653,6 +655,7 @@ begin
ecNewProject : Result:= lisMenuNewProject;
ecNewProjectFromFile : Result:= lisMenuNewProjectFromFile;
ecOpenProject : Result:= lisMenuOpenProject;
ecOpenRecentProject : Result:= lisMenuOpenRecentProject;
ecCloseProject : Result:= lisMenuCloseProject;
ecSaveProject : Result:= lisMenuSaveProject;
ecSaveProjectAs : Result:= lisMenuSaveProjectAs;
@ -706,6 +709,7 @@ begin
ecOpenPackage : Result:= lisMenuOpenPackage;
ecOpenPackageFile : Result:= lisMenuOpenPackageFile;
ecOpenPackageOfCurUnit : Result:= lisMenuOpenPackageOfCurUnit;
ecOpenRecentPackage : Result:= lisMenuOpenRecentPkg;
ecAddCurFileToPkg : Result:= lisMenuAddCurFileToPkg;
ecNewPkgComponent : Result:= lisMenuPkgNewPackageComponent;
ecPackageGraph : Result:= lisMenuPackageGraph;
@ -2890,6 +2894,7 @@ begin
AddDefault(C, 'Find block other end', srkmecFindBlockOtherEnd, ecFindBlockOtherEnd);
AddDefault(C, 'Find block start', srkmecFindBlockStart, ecFindBlockStart);
AddDefault(C, 'Goto include directive', lisMenuGotoIncludeDirective, ecGotoIncludeDirective);
AddDefault(C, 'Jump to Section', lisMenuJumpTo, ecJumpToSection);
AddDefault(C, 'Jump to Interface', lisMenuJumpToInterface, ecJumpToInterface);
AddDefault(C, 'Jump to Interface uses', lisMenuJumpToInterfaceUses, ecJumpToInterfaceUses);
AddDefault(C, 'Jump to Implementation', lisMenuJumpToImplementation, ecJumpToImplementation);
@ -3034,6 +3039,7 @@ begin
AddDefault(C, 'NewForm', lisMenuNewForm, ecNewForm);
AddDefault(C, 'Open', lisOpen, ecOpen);
AddDefault(C, 'OpenUnit', lisOpenUnit, ecOpenUnit);
AddDefault(C, 'OpenRecent', lisKMOpenRecent, ecOpenRecent);
AddDefault(C, 'Revert', lisMenuRevert, ecRevert);
AddDefault(C, 'Save', lisSave, ecSave);
AddDefault(C, 'SaveAs', lisKMSaveAs, ecSaveAs);
@ -3081,6 +3087,7 @@ begin
AddDefault(C, 'New project', lisKMNewProject, ecNewProject);
AddDefault(C, 'New project from file', lisKMNewProjectFromFile, ecNewProjectFromFile);
AddDefault(C, 'Open project', lisOpenProject2, ecOpenProject);
AddDefault(C, 'Open recent project', lisKMOpenRecentProject, ecOpenRecentProject);
AddDefault(C, 'Close project', lisKMCloseProject, ecCloseProject);
AddDefault(C, 'Save project', lisKMSaveProject, ecSaveProject);
AddDefault(C, 'Save project as', lisKMSaveProjectAs, ecSaveProjectAs);
@ -3136,6 +3143,7 @@ begin
AddDefault(C, 'New package', lisKMNewPackage, ecNewPackage);
AddDefault(C, 'Open package', lisCompPalOpenPackage, ecOpenPackage);
AddDefault(C, 'Open package file', lisKMOpenPackageFile, ecOpenPackageFile);
AddDefault(C, 'Open recent package', lisKMOpenRecentPackage, ecOpenRecentPackage);
AddDefault(C, 'Open package of current unit', lisMenuOpenPackageOfCurUnit, ecOpenPackageOfCurUnit);
AddDefault(C, 'Add active unit to a package', lisMenuAddCurFileToPkg, ecAddCurFileToPkg);
AddDefault(C, 'Add new component to a package', lisMenuPkgNewPackageComponent, ecNewPkgComponent);

View File

@ -252,6 +252,7 @@ resourcestring
lisPathOfTheMakeUtility = 'Path of the make utility';
lisProjectMacroProperties = 'Project macro properties';
lisOpenProject2 = 'Open project';
lisKMOpenRecentProject = 'Open recent project';
lisFileHasNoProject = 'File has no project';
lisTheFileIsNotALazarusProjectCreateANewProjectForThi =
'The file "%s" is not a Lazarus project.'
@ -307,6 +308,7 @@ resourcestring
lisPkgEditPublishPackage = 'Publish Package';
lisPERevertPackage = 'Revert Package';
lisMenuOpenRecent = 'Open &Recent';
lisTBOpenRecent = 'Open Recent';
lisMenuSave = '&Save';
lisMenuSaveAs = 'Save &As ...';
lisKMSaveAs = 'SaveAs';
@ -4130,6 +4132,7 @@ resourcestring
lisKMNewPackage = 'New package';
lisCompPalOpenPackage = 'Open package';
lisKMOpenPackageFile = 'Open package file';
lisKMOpenRecentPackage = 'Open recent package';
lisCPOpenPackage = 'Open Package %s';
lisFilterAllMessagesOfType = 'Filter all messages of type %s';
lisFilterAllMessagesOfCertainType = 'Filter all messages of certain type';
@ -5096,6 +5099,7 @@ resourcestring
// Standard File menu
lisKMNewUnit = 'New Unit';
lisKMOpenRecent = 'Open Recent';
// Standard Help menu
lisMenuTemplateAbout = 'About';

View File

@ -2893,6 +2893,10 @@ procedure TMainIDE.LoadMenuShortCuts;
ToolButton.ToolButtonClass := ToolButtonClass;
end;
// See also in ToolBarIntf:
// function GetCommand_DropDown
// function GetCommand_ButtonDrop
var
xBtnItem: TIDEButtonCommand;
begin
@ -2903,6 +2907,7 @@ begin
itmFileNewOther.Command:=GetCommand(ecNew);
itmFileOpen.Command:=GetCommand(ecOpen, nil, TOpenFileToolButton);
itmFileOpenUnit.Command:=GetCommand(ecOpenUnit);
GetCommand_ButtonDrop(ecOpenRecent, itmFileRecentOpen);
itmFileRevert.Command:=GetCommand(ecRevert);
itmFileSave.Command:=GetCommand(ecSave);
itmFileSaveAs.Command:=GetCommand(ecSaveAs);
@ -2955,11 +2960,12 @@ begin
itmSetFreeBookmark.Command:=GetCommand(ecSetFreeBookmark);
itmJumpToNextBookmark.Command:=GetCommand(ecNextBookmark);
itmJumpToPrevBookmark.Command:=GetCommand(ecPrevBookmark);
itmJumpToInterface.Command:=GetCommand(ecJumpToInterface, nil, TJumpToSectionToolButton);
itmJumpToInterfaceUses.Command:=GetCommand(ecJumpToInterfaceUses, nil, TJumpToSectionToolButton);
itmJumpToImplementation.Command:=GetCommand(ecJumpToImplementation, nil, TJumpToSectionToolButton);
itmJumpToImplementationUses.Command:=GetCommand(ecJumpToImplementationUses, nil, TJumpToSectionToolButton);
itmJumpToInitialization.Command:=GetCommand(ecJumpToInitialization, nil, TJumpToSectionToolButton);
GetCommand_ButtonDrop(ecJumpToSection, itmJumpToSection);
itmJumpToInterface.Command:=GetCommand_DropDown(ecJumpToInterface, itmJumpToSection);
itmJumpToInterfaceUses.Command:=GetCommand_DropDown(ecJumpToInterfaceUses, itmJumpToSection);
itmJumpToImplementation.Command:=GetCommand_DropDown(ecJumpToImplementation, itmJumpToSection);
itmJumpToImplementationUses.Command:=GetCommand_DropDown(ecJumpToImplementationUses, itmJumpToSection);
itmJumpToInitialization.Command:=GetCommand_DropDown(ecJumpToInitialization, itmJumpToSection);
GetCmdAndBtn(ecJumpToProcedureHeader, xBtnItem);
xBtnItem.Caption := lisMenuJumpToProcedureHeader;
xBtnItem.OnClick := @SourceEditorManager.JumpToProcedureHeaderClicked;
@ -3047,7 +3053,8 @@ begin
// project menu
itmProjectNew.Command:=GetCommand(ecNewProject);
itmProjectNewFromFile.Command:=GetCommand(ecNewProjectFromFile);
itmProjectOpen.Command:=GetCommand(ecOpenProject);
itmProjectOpen.Command:=GetCommand_DropDown(ecOpenProject, itmProjectRecentOpen);
GetCommand_ButtonDrop(ecOpenRecentProject, itmProjectRecentOpen);
itmProjectClose.Command:=GetCommand(ecCloseProject);
itmProjectSave.Command:=GetCommand(ecSaveProject);
itmProjectSaveAs.Command:=GetCommand(ecSaveProjectAs);
@ -3093,8 +3100,9 @@ begin
// package menu
itmPkgNewPackage.Command:=GetCommand(ecNewPackage);
itmPkgOpenLoadedPackage.Command:=GetCommand(ecOpenPackage);
itmPkgOpenPackageFile.Command:=GetCommand(ecOpenPackageFile);
itmPkgOpenPackageFile.Command:=GetCommand_DropDown(ecOpenPackageFile, itmPkgOpenRecent);
itmPkgOpenPackageOfCurUnit.Command:=GetCommand(ecOpenPackageOfCurUnit);
GetCommand_ButtonDrop(ecOpenRecentPackage, itmPkgOpenRecent);
itmPkgAddCurFileToPkg.Command:=GetCommand(ecAddCurFileToPkg);
itmPkgAddNewComponentToPkg.Command:=GetCommand(ecNewPkgComponent);
itmPkgPkgGraph.Command:=GetCommand(ecPackageGraph);

View File

@ -93,7 +93,7 @@ type
protected
FNeedUpdateHighlighters: boolean;
function CreateMenuSeparator : TMenuItem;
function CreateMenuSeparator(Section: TIDEMenuSection): TIDEMenuCommand;
procedure CreateMenuItem(Section: TIDEMenuSection;
var MenuCommand: TIDEMenuCommand;
const MenuItemName, MenuItemCaption: String;
@ -204,13 +204,6 @@ type
property DisplayState: TDisplayState read FDisplayState write SetDisplayState;
end;
{ TJumpToSectionToolButton }
TJumpToSectionToolButton = class(TIDEToolButton_DropDown)
protected
procedure RefreshMenu; override;
end;
{ TSetBuildModeToolButton }
TSetBuildModeToolButton = class(TIDEToolButton)
@ -608,19 +601,6 @@ begin
Style := tbsDropDown;
end;
{ TJumpToSectionToolButton }
procedure TJumpToSectionToolButton.RefreshMenu;
begin
AddMenuItem(MainIDEBar.itmJumpToInterface);
AddMenuItem(MainIDEBar.itmJumpToInterfaceUses);
DropdownMenu.Items.AddSeparator;
AddMenuItem(MainIDEBar.itmJumpToImplementation);
AddMenuItem(MainIDEBar.itmJumpToImplementationUses);
DropdownMenu.Items.AddSeparator;
AddMenuItem(MainIDEBar.itmJumpToInitialization);
end;
{$IFDEF LCLCocoa}
var
mnuApple: TIDEMenuSection = nil;
@ -953,10 +933,13 @@ begin
{$ENDIF}
end;
function TMainIDEBase.CreateMenuSeparator : TMenuItem;
var
SeparatorNum: Integer=0;
function TMainIDEBase.CreateMenuSeparator(Section: TIDEMenuSection): TIDEMenuCommand;
begin
Result := TMenuItem.Create(MainIDEBar);
Result.Caption := '-';
Inc(SeparatorNum);
CreateMenuItem(Section, Result, 'Separator'+IntToStr(SeparatorNum), '-'); // Result - var parameter
end;
procedure TMainIDEBase.CreateMenuItem(Section: TIDEMenuSection;
@ -1144,8 +1127,10 @@ begin
CreateMenuItem(ParentMI,itmJumpToInterface,'itmJumpToInterface',lisMenuJumpToInterface, 'menu_jumpto_interface');
CreateMenuItem(ParentMI,itmJumpToInterfaceUses,'itmJumpToInterfaceUses',lisMenuJumpToInterfaceUses, 'menu_jumpto_interfaceuses');
CreateMenuSeparator(ParentMI);
CreateMenuItem(ParentMI,itmJumpToImplementation,'itmJumpToImplementation',lisMenuJumpToImplementation, 'menu_jumpto_implementation');
CreateMenuItem(ParentMI,itmJumpToImplementationUses,'itmJumpToImplementationUses',lisMenuJumpToImplementationUses, 'menu_jumpto_implementationuses');
CreateMenuSeparator(ParentMI);
CreateMenuItem(ParentMI,itmJumpToInitialization,'itmJumpToInitialization',lisMenuJumpToInitialization, 'menu_jumpto_initialization');
CreateMenuSeparatorSection(mnuSearch,itmBookmarks,'itmBookmarks');
@ -1409,7 +1394,7 @@ begin
CreateMenuItem(ParentMI,itmPkgOpenLoadedPackage,'itmPkgOpenPackage',lisMenuOpenPackage,'pkg_installed');
CreateMenuItem(ParentMI,itmPkgOpenPackageFile,'itmPkgOpenPackageFile',lisMenuOpenPackageFile,'pkg_open');
CreateMenuItem(ParentMI,itmPkgOpenPackageOfCurUnit,'itmPkgOpenPackageOfCurUnit',lisMenuOpenPackageOfCurUnit);
CreateMenuSubSection(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg);
CreateMenuSubSection(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg, 'pkg_open_recent');
CreateMenuSeparatorSection(mnuComponent,itmPkgUnits,'itmPkgUnits');
ParentMI:=itmPkgUnits;

View File

@ -1370,9 +1370,7 @@ var
SrcEditMenuClearFileBookmark: TIDEMenuCommand;
SrcEditMenuClearAllBookmark: TIDEMenuCommand;
SrcEditMenuGotoBookmark: array [TBookmarkNumRange] of TIDEMenuCommand;
SrcEditMenuGotoBookmarks: TIDEMenuCommand;
SrcEditMenuToggleBookmark: array [TBookmarkNumRange] of TIDEMenuCommand;
SrcEditMenuToggleBookmarks: TIDEMenuCommand;
// debugging
SrcEditMenuToggleBreakpoint: TIDEMenuCommand;
SrcEditMenuRunToCursor: TIDEMenuCommand;
@ -1437,26 +1435,6 @@ var
EnglishModifiedLGPLNotice: 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
@ -1712,13 +1690,6 @@ begin
SrcEditMenuPrevBookmark:=RegisterIDEMenuCommand(AParent,
'Goto previous Bookmark',uemPrevBookmark, nil,
@ExecuteIdeMenuClick, nil, 'menu_search_previous_bookmark');
{For toolbar only. Hidden in menu.}
SrcEditMenuGotoBookmarks:=RegisterIDEMenuCommand(AParent,
'Goto bookmarks', uemGotoBookmarks,
nil, TNotifyProcedure(@TToolButton_GotoBookmarks.ShowAloneMenu), nil,
'menu_goto_bookmarks');
SrcEditMenuGotoBookmarks.Visible:=False;
{%endregion}
{%region *** Toggle Bookmarks Submenu ***}
@ -1740,13 +1711,6 @@ begin
'Clear Bookmark for current file',srkmecClearBookmarkForFile, nil, @ExecuteIdeMenuClick, nil, 'menu_clear_file_bookmarks');
SrcEditMenuClearAllBookmark:=RegisterIDEMenuCommand(AParent,
'Clear all Bookmark',srkmecClearAllBookmark, nil, @ExecuteIdeMenuClick, nil, 'menu_clear_all_bookmarks');
{For toolbar only. Hidden in menu.}
SrcEditMenuToggleBookmarks:=RegisterIDEMenuCommand(AParent,
'Toggle bookmarks', uemToggleBookmarks,
nil, TNotifyProcedure(@TToolButton_ToggleBookmarks.ShowAloneMenu), nil,
'menu_toggle_bookmarks');
SrcEditMenuToggleBookmarks.Visible:=False;
{%endregion}
{%region *** Debug Section ***}
@ -1855,51 +1819,6 @@ begin
Result:=CompareFilenames(AnsiString(FileNameStr),SE1.FileName);
end;
{ TToolButton_GotoBookmarks }
procedure TToolButton_GotoBookmarks.RefreshMenu;
begin
AddMenuItems(SrcEditMenuGotoBookmark);
DropdownMenu.Items.AddSeparator;
AddMenuItems([
SrcEditMenuPrevBookmark,
SrcEditMenuNextBookmark]);
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;
// Btn should not be destroyed immediately after PopUp
end;
{ TToolButton_ToggleBookmarks }
procedure TToolButton_ToggleBookmarks.RefreshMenu;
begin
AddMenuItems(SrcEditMenuToggleBookmark);
DropdownMenu.Items.AddSeparator;
AddMenuItem(SrcEditMenuSetFreeBookmark);
DropdownMenu.Items.AddSeparator;
AddMenuItems([
SrcEditMenuClearFileBookmark,
SrcEditMenuClearAllBookmark]);
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;
// Btn should not be destroyed immediately after PopUp
end;
{ TSourceEditorWordCompletion }
constructor TSourceEditorWordCompletion.Create;
@ -10732,6 +10651,10 @@ procedure TSourceEditorManager.SetupShortCuts;
ToolButton.ToolButtonClass := ToolButtonClass;
end;
// See also in ToolBarIntf:
// function GetCommand_DropDown
// function GetCommand_ButtonDrop
var
i: Integer;
begin
@ -10797,14 +10720,13 @@ begin
SrcEditMenuClearFileBookmark.Command:=GetCommand(ecClearBookmarkForFile);
SrcEditMenuClearAllBookmark.Command:=GetCommand(ecClearAllBookmark);
SrcEditMenuGotoBookmarks.Command:=GetCommand(ecGotoBookmarks, TToolButton_GotoBookmarks);
SrcEditMenuToggleBookmarks.Command:=GetCommand(ecToggleBookmarks, TToolButton_ToggleBookmarks);
for i in TBookmarkNumRange do
SrcEditMenuGotoBookmark[i].Command := GetCommand(ecGotoMarker0 + i);
GetCommand_ButtonDrop(ecGotoBookmarks ,SrcEditSubMenuGotoBookmarks); // [ ]
for i in TBookmarkNumRange do
SrcEditMenuToggleBookmark[i].Command := GetCommand(ecToggleMarker0 + i);
GetCommand_ButtonDrop(ecToggleBookmarks ,SrcEditSubMenuToggleBookmarks); // [ ]
{%region *** Source Section ***}
SrcEditMenuEncloseSelection.Command:=GetCommand(ecSelectionEnclose);

View File

@ -169,6 +169,9 @@ states directory:
state_warning_150.png
state_warning_200.png
packages directory
pkg_open_recent.png (used 'pkg_open.png' created by Roland Hahn)
--------------------------------------------------------------------------------
The following component palette and menu/toolbar icons (including equally named

Binary file not shown.

View File

@ -945,6 +945,9 @@ packages/pkg_lrs_200.png
packages/pkg_open.png
packages/pkg_open_150.png
packages/pkg_open_200.png
packages/pkg_open_recent.png
packages/pkg_open_recent_150.png
packages/pkg_open_recent_200.png
packages/pkg_package_autoinstall.png
packages/pkg_package_autoinstall_150.png
packages/pkg_package_autoinstall_200.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB