From f1bd1cc6c543077ad39730a3d1637e7488a43fbb Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 21 Sep 2005 22:33:37 +0000 Subject: [PATCH] implemented using menuintf for IDE main menu git-svn-id: trunk@7779 - --- ide/debugmanager.pas | 25 +- ide/keymapping.pp | 14 +- ide/lazarusidestrconsts.pas | 3 + ide/main.pp | 47 ++- ide/mainbar.pas | 105 ++++--- ide/mainbase.pas | 585 +++++++++++++++++++++++++++++++----- ide/mainintf.pas | 6 +- ideintf/idecommands.pas | 30 +- ideintf/menuintf.pas | 18 +- 9 files changed, 667 insertions(+), 166 deletions(-) diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index ffc0d9c1eb..da6e3c29d6 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -42,7 +42,7 @@ uses Classes, SysUtils, Forms, Controls, Dialogs, Menus, FileUtil, LCLProc, Laz_XMLCfg, SynEdit, CodeCache, CodeToolManager, - MenuIntf, + MenuIntf, IDECommands, LazConf, DebugOptionsFrm, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, UnitEditor, Project, IDEProcs, InputHistory, Debugger, @@ -1441,7 +1441,29 @@ begin end; procedure TDebugManager.SetupMainBarShortCuts; + + {$IFDEF UseMenuIntf} + function GetCommand(ACommand: word): TIDECommand; + begin + Result:=IDECommandList.FindIDECommand(ACommand); + end; + {$ENDIF} + begin + {$IFDEF UseMenuIntf} + with MainIDEBar do + begin + itmViewWatches.Command:=GetCommand(ecToggleWatches); + itmViewBreakpoints.Command:=GetCommand(ecToggleBreakPoints); + itmViewDebugOutput.Command:=GetCommand(ecToggleDebuggerOut); + itmViewLocals.Command:=GetCommand(ecToggleLocals); + itmViewCallStack.Command:=GetCommand(ecToggleCallStack); + + itmRunMenuInspect.Command:=GetCommand(ecInspect); + itmRunMenuEvaluate.Command:=GetCommand(ecEvaluate); + itmRunMenuAddWatch.Command:=GetCommand(ecAddWatch); + end; + {$ELSE} with MainIDEBar, EditorOpts.KeyMap do begin itmViewWatches.ShortCut := CommandToShortCut(ecToggleWatches); @@ -1454,6 +1476,7 @@ begin itmRunMenuEvaluate.ShortCut := CommandToShortCut(ecEvaluate); itmRunMenuAddWatch.ShortCut := CommandToShortCut(ecAddWatch); end; + {$ENDIF} end; procedure TDebugManager.UpdateButtonsAndMenuItems; diff --git a/ide/keymapping.pp b/ide/keymapping.pp index 3b622e361b..47cc766367 100644 --- a/ide/keymapping.pp +++ b/ide/keymapping.pp @@ -286,14 +286,17 @@ type //--------------------------------------------------------------------------- // class for storing the keys of a single command (key-command relationship) - TKeyCommandRelation = class(TIDECommandKeys) + TKeyCommandRelation = class(TIDECommand) public function GetLocalizedName: string; override; end; //--------------------------------------------------------------------------- // class for a list of key - command relations - TKeyCommandRelationList = class + + { TKeyCommandRelationList } + + TKeyCommandRelationList = class(TIDECommands) private fLastKey: TIDEShortCut; // for multiple key commands FCustomKeyCount: integer; @@ -322,6 +325,7 @@ type function Find(Key: TIDEShortCut; {$IFDEF UseIDEScopes}IDEWindowClass: TCustomFormClass{$ELSE}Areas: TCommandAreas{$ENDIF} ): TKeyCommandRelation; + function FindIDECommand(ACommand:word): TIDECommand; override; function FindByCommand(ACommand:word): TKeyCommandRelation; function FindCategoryByName(const CategoryName: string): TKeyCommandCategory; function TranslateKey(Key: word; Shift: TShiftState; @@ -2748,6 +2752,12 @@ begin end; end; +function TKeyCommandRelationList.FindIDECommand(ACommand: word + ): TIDECommand; +begin + Result:=FindByCommand(ACommand); +end; + function TKeyCommandRelationList.FindByCommand( ACommand: word):TKeyCommandRelation; var a:integer; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index c0bf989671..659e295bc6 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1619,6 +1619,9 @@ resourcestring // codetools defines lisCodeToolsDefsCodeToolsDefinesPreview = 'CodeTools Defines Preview'; lisCodeToolsDefsWriteError = 'Write error'; + lisStopDebugging2 = 'Stop debugging?'; + lisStopCurrentDebuggingAndRebuildProject = 'Stop current debugging and ' + +'rebuild project?'; lisErrorWritingPackageListToFile = 'Error writing package list to file%s%s%' +'s%s'; lisCodeToolsDefsErrorWhileWriting = 'Error while writing %s%s%s%s%s'; diff --git a/ide/main.pp b/ide/main.pp index d6d35044db..53af2e9157 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -563,7 +563,9 @@ type var Handled: boolean; Data: TObject); public + {$IFNDEF UseMenuIntf} CustomExtToolMenuSeparator: TMenuItem; + {$ENDIF} CurDefinesCompilerFilename: String; CurDefinesCompilerOptions: String; class procedure ParseCmdLineOptions; @@ -973,6 +975,7 @@ begin EditorOpts:=TEditorOptions.Create; EditorOpts.Load; + IDECommandList:=EditorOpts.KeyMap; EnvironmentOptions.ExternalTools.LoadShortCuts(EditorOpts.KeyMap); @@ -1935,7 +1938,9 @@ begin itmToolBuildLazarus.OnClick := @mnuToolBuildLazarusClicked; itmToolConfigureBuildLazarus.OnClick := @mnuToolConfigBuildLazClicked; end; + {$IFNDEF UseMenuIntf} CustomExtToolMenuSeparator:=nil; + {$ENDIF} UpdateCustomToolsInMenu; end; @@ -2359,7 +2364,7 @@ begin mnuViewInspectorClicked(Self); ecAboutLazarus: - MainIDEBar.itmHelpAboutLazarus.Click; + MainIDEBar.itmHelpAboutLazarus.OnClick(Self); ecAddBreakPoint: SourceNotebook.AddBreakpointClicked(Self); @@ -3140,8 +3145,13 @@ procedure TMainIDE.mnuCustomExtToolClick(Sender: TObject); var Index: integer; begin + {$IFDEF UseMenuIntf} + if not (Sender is TIDEMenuItem) then exit; + Index:=MainIDEBar.itmCustomTools.IndexOf(TIDEMenuItem(Sender))-1; + {$ELSE} if CustomExtToolMenuSeparator=nil then exit; Index:=TMenuItem(Sender).MenuIndex-CustomExtToolMenuSeparator.MenuIndex-1; + {$ENDIF} if (Index<0) or (Index>=EnvironmentOptions.ExternalTools.Count) then exit; DoRunExternalTool(Index); end; @@ -7778,6 +7788,20 @@ var ToolCount: integer; procedure CreateToolMenuItems; + {$IFDEF UseMenuIntf} + var + Section: TIDEMenuSection; + begin + Section:=MainIDEBar.itmCustomTools; + // add enough menuitems + while Section.Count-1ToolCount do + Section[Section.Count-1].Free; + end; + {$ELSE} var CurMenuItem: TMenuItem; LastIndex, FirstIndex, ExistingCount: integer; @@ -7810,22 +7834,35 @@ var dec(ExistingCount); end; end; + {$ENDIF} procedure SetToolMenuItems; var - CurMenuItem: TMenuItem; + CurMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF}; i, Index: integer; ExtTool: TExternalToolOptions; begin + {$IFDEF UseMenuIntf} + i:=1; + {$ELSE} if CustomExtToolMenuSeparator=nil then exit; i:=CustomExtToolMenuSeparator.MenuIndex+1; + {$ENDIF} Index:=0; - while (imrYes then exit; diff --git a/ide/mainbar.pas b/ide/mainbar.pas index 27ab0a45e8..2813ef43b0 100644 --- a/ide/mainbar.pas +++ b/ide/mainbar.pas @@ -111,18 +111,17 @@ type itmEditUpperCaseBlock: TIDEMenuCommand; itmEditLowerCaseBlock: TIDEMenuCommand; itmEditTabsToSpacesBlock: TIDEMenuCommand; - itmEditSelections: TIDEMenuSection; itmEditSelectionBreakLines: TIDEMenuCommand; - itmEditSelect: TIDEMenuSection; - itmEditSelectAll: TIDEMenuCommand; - itmEditSelectToBrace: TIDEMenuCommand; - itmEditSelectCodeBlock: TIDEMenuCommand; - itmEditSelectLine: TIDEMenuCommand; - itmEditSelectParagraph: TIDEMenuCommand; + itmEditSelect: TIDEMenuSection; + itmEditSelectAll: TIDEMenuCommand; + itmEditSelectToBrace: TIDEMenuCommand; + itmEditSelectCodeBlock: TIDEMenuCommand; + itmEditSelectLine: TIDEMenuCommand; + itmEditSelectParagraph: TIDEMenuCommand; itmEditInsertions: TIDEMenuSection; itmEditInsertCharacter: TIDEMenuCommand; itmEditInsertText: TIDEMenuSection; - itmEditInsertCVSKeyWord: TIDEMenuCommand; + itmEditInsertCVSKeyWord: TIDEMenuSection; itmEditInsertCVSAuthor: TIDEMenuCommand; itmEditInsertCVSDate: TIDEMenuCommand; itmEditInsertCVSHeader: TIDEMenuCommand; @@ -131,13 +130,13 @@ type itmEditInsertCVSName: TIDEMenuCommand; itmEditInsertCVSRevision: TIDEMenuCommand; itmEditInsertCVSSource: TIDEMenuCommand; - itmEditInsertGeneral: TIDEMenuCommand; + itmEditInsertGeneral: TIDEMenuSection; itmEditInsertGPLNotice: TIDEMenuCommand; itmEditInsertLGPLNotice: TIDEMenuCommand; itmEditInsertUsername: TIDEMenuCommand; itmEditInsertDateTime: TIDEMenuCommand; itmEditInsertChangeLogEntry: TIDEMenuCommand; - itmEditCodeTools: TIDEMenuSection; + itmEditMenuCodeTools: TIDEMenuSection; itmEditCompleteCode: TIDEMenuCommand; itmEditExtractProc: TIDEMenuCommand; @@ -148,7 +147,6 @@ type itmSearchFindNext: TIDEMenuCommand; itmSearchFindPrevious: TIDEMenuCommand; itmSearchFindInFiles: TIDEMenuCommand; - itmSearchFindIdentifierRefs: TIDEMenuCommand; itmSearchReplace: TIDEMenuCommand; itmIncrementalFind: TIDEMenuCommand; itmGotoLine: TIDEMenuCommand; @@ -165,61 +163,62 @@ type itmJumpToPrevBookmark: TIDEMenuCommand; itmCodeToolSearches: TIDEMenuSection; itmFindDeclaration: TIDEMenuCommand; - itmSearchRenameIdentifier: TIDEMenuCommand; itmFindBlockOtherEnd: TIDEMenuCommand; itmFindBlockStart: TIDEMenuCommand; itmOpenFileAtCursor: TIDEMenuCommand; itmGotoIncludeDirective: TIDEMenuCommand; + itmSearchFindIdentifierRefs: TIDEMenuCommand; + itmSearchRenameIdentifier: TIDEMenuCommand; // view menu mnuView: TIDEMenuSection; - itmViewMainWindows: TIDEMenuSection; - itmViewInspector: TIDEMenuCommand; - itmViewSourceEditor: TIDEMenuCommand; - itmViewCodeExplorer: TIDEMenuCommand; - itmViewLazDoc: TIDEMenuCommand; - itmViewUnitWindows: TIDEMenuSection; - itmViewUnits: TIDEMenuCommand; - itmViewForms: TIDEMenuCommand; - itmViewUnitDependencies: TIDEMenuCommand; - itmViewUnitInfo: TIDEMenuCommand; - itmViewToggleFormUnit: TIDEMenuCommand; - itmViewSecondaryWindows: TIDEMenuSection; - itmViewAnchorEditor: TIDEMenuCommand; - itmViewMessage: TIDEMenuCommand; - itmViewSearchResults: TIDEMenuCommand; - itmViewDebugWindows: TIDEMenuSection; - itmViewWatches: TIDEMenuCommand; - itmViewBreakpoints: TIDEMenuCommand; - itmViewLocals: TIDEMenuCommand; - itmViewCallStack: TIDEMenuCommand; - itmViewDebugOutput: TIDEMenuCommand; + itmViewMainWindows: TIDEMenuSection; + itmViewInspector: TIDEMenuCommand; + itmViewSourceEditor: TIDEMenuCommand; + itmViewCodeExplorer: TIDEMenuCommand; + itmViewLazDoc: TIDEMenuCommand; + itmViewUnitWindows: TIDEMenuSection; + itmViewUnits: TIDEMenuCommand; + itmViewForms: TIDEMenuCommand; + itmViewUnitDependencies: TIDEMenuCommand; + itmViewUnitInfo: TIDEMenuCommand; + itmViewToggleFormUnit: TIDEMenuCommand; + itmViewSecondaryWindows: TIDEMenuSection; + itmViewAnchorEditor: TIDEMenuCommand; + itmViewMessage: TIDEMenuCommand; + itmViewSearchResults: TIDEMenuCommand; + itmViewDebugWindows: TIDEMenuSection; + itmViewWatches: TIDEMenuCommand; + itmViewBreakpoints: TIDEMenuCommand; + itmViewLocals: TIDEMenuCommand; + itmViewCallStack: TIDEMenuCommand; + itmViewDebugOutput: TIDEMenuCommand; // project menu mnuProject: TIDEMenuSection; - itmProjectNews: TIDEMenuSection; + itmProjectNewSection: TIDEMenuSection; itmProjectNew: TIDEMenuCommand; itmProjectNewFromFile: TIDEMenuCommand; - itmProjectOpens: TIDEMenuSection; + itmProjectOpenSection: TIDEMenuSection; itmProjectOpen: TIDEMenuCommand; - itmProjectRecentOpen: TIDEMenuCommand; - itmProjectSaves: TIDEMenuSection; + itmProjectRecentOpen: TIDEMenuSection; + itmProjectSaveSection: TIDEMenuSection; itmProjectSave: TIDEMenuCommand; itmProjectSaveAs: TIDEMenuCommand; itmProjectPublish: TIDEMenuCommand; - itmProjectWindows: TIDEMenuSection; + itmProjectWindowSection: TIDEMenuSection; itmProjectInspector: TIDEMenuCommand; itmProjectOptions: TIDEMenuCommand; itmProjectCompilerOptions: TIDEMenuCommand; itmProjectViewToDos: TIDEMenuCommand; - itmProjectAddRemoves: TIDEMenuSection; + itmProjectAddRemoveSection: TIDEMenuSection; itmProjectAddTo: TIDEMenuCommand; itmProjectRemoveFrom: TIDEMenuCommand; itmProjectViewSource: TIDEMenuCommand; {$IFDEF TRANSLATESTRING} - itmProjectPoFiles:TIDEMenuCommand; - itmProjectCreatePoFiles:TIDEMenuCommand; - itmProjectCollectPoFiles:TIDEMenuCommand; + itmProjectPoFileSection: TIDEMenuCommand; + itmProjectCreatePoFiles: TIDEMenuCommand; + itmProjectCollectPoFiles: TIDEMenuCommand; {$ENDIF} // run menu @@ -237,7 +236,7 @@ type itmRunMenuStop: TIDEMenuCommand; itmRunMenuRunParameters: TIDEMenuCommand; itmRunMenuResetDebugger: TIDEMenuCommand; - itmRunBuildignFile: TIDEMenuSection; + itmRunBuildingFile: TIDEMenuSection; itmRunMenuBuildFile: TIDEMenuCommand; itmRunMenuRunFile: TIDEMenuCommand; itmRunMenuConfigBuildFile: TIDEMenuCommand; @@ -245,19 +244,19 @@ type itmRunMenuInspect: TIDEMenuCommand; itmRunMenuEvaluate: TIDEMenuCommand; itmRunMenuAddWatch: TIDEMenuCommand; - itmRunMenuAddBreakpoint: TIDEMenuCommand; - itmRunMenuAddBpSource: TIDEMenuCommand; + itmRunMenuAddBreakpoint: TIDEMenuSection; + itmRunMenuAddBpSource: TIDEMenuCommand; // components menu mnuComponents: TIDEMenuSection; - itmPkgOpening: TIDEMenuCommand; + itmPkgOpening: TIDEMenuSection; itmPkgOpenPackage: TIDEMenuCommand; itmPkgOpenPackageFile: TIDEMenuCommand; itmPkgOpenPackageOfCurUnit: TIDEMenuCommand; - itmPkgOpenRecent: TIDEMenuCommand; - itmPkgUnits: TIDEMenuCommand; + itmPkgOpenRecent: TIDEMenuSection; + itmPkgUnits: TIDEMenuSection; itmPkgAddCurUnitToPkg: TIDEMenuCommand; - itmPkgGraphs: TIDEMenuCommand; + itmPkgGraphSection: TIDEMenuSection; itmPkgPkgGraph: TIDEMenuCommand; itmPkgEditInstallPkgs: TIDEMenuCommand; {$IFDEF CustomIDEComps} @@ -272,14 +271,14 @@ type itmToolSyntaxCheck: TIDEMenuCommand; itmToolGuessUnclosedBlock: TIDEMenuCommand; itmToolGuessMisplacedIFDEF: TIDEMenuCommand; + itmSecondaryTools: TIDEMenuSection; + itmToolMakeResourceString: TIDEMenuCommand; + itmToolDiff: TIDEMenuCommand; itmDelphiConversion: TIDEMenuSection; itmToolCheckLFM: TIDEMenuCommand; itmToolConvertDelphiUnit: TIDEMenuCommand; itmToolConvertDelphiProject: TIDEMenuCommand; itmToolConvertDFMtoLFM: TIDEMenuCommand; - itmSecondaryTools: TIDEMenuSection; - itmToolMakeResourceString: TIDEMenuCommand; - itmToolDiff: TIDEMenuCommand; itmBuildingLazarus: TIDEMenuSection; itmToolBuildLazarus: TIDEMenuCommand; itmToolConfigureBuildLazarus: TIDEMenuCommand; @@ -293,7 +292,7 @@ type itmEnvDebuggerOptions: TIDEMenuCommand; itmEnvCodeToolsOptions: TIDEMenuCommand; itmEnvCodeToolsDefinesEditor: TIDEMenuCommand; - itmIDECache: TIDEMenuSection; + itmIDECacheSection: TIDEMenuSection; itmEnvRescanFPCSrcDir: TIDEMenuCommand; // windows menu diff --git a/ide/mainbase.pas b/ide/mainbase.pas index f807142059..b87fcdb4f6 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -61,6 +61,7 @@ uses CodeCache, AVL_Tree, SynEditKeyCmds, // IDE LazConf, LazarusIDEStrConsts, SrcEditorIntf, LazIDEIntf, MenuIntf, + IDECommands, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, ComponentReg, TransferMacros, ObjectInspector, PropEdits, OutputFilter, IDEDefs, MsgView, @@ -91,7 +92,8 @@ type var Section: TIDEMenuSection; const AName: String); procedure CreateMenuSubSection(ParentSection: TIDEMenuSection; var Section: TIDEMenuSection; - const AName, ACaption: String); + const AName, ACaption: String; + const bmpName: String = ''); procedure CreateMainMenuItem(var Section: TIDEMenuSection; const MenuItemName, MenuItemCaption: String); {$ELSE} @@ -166,7 +168,9 @@ type ): TModalResult; override; procedure UpdateWindowsMenu; override; - procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList; + procedure SetRecentSubMenu({$IFDEF UseMenuIntf}Section: TIDEMenuSection; + {$ELSE}Section: TMenuItem;{$ENDIF} + FileList: TStringList; OnClickEvent: TNotifyEvent); override; function DoJumpToCodePosition( @@ -307,10 +311,13 @@ begin end; procedure TMainIDEBase.CreateMenuSubSection(ParentSection: TIDEMenuSection; - var Section: TIDEMenuSection; const AName, ACaption: String); + var Section: TIDEMenuSection; const AName, ACaption: String; + const bmpName: String = ''); begin Section:=RegisterIDEMenuSection(ParentSection.GetPath,AName); Section.Caption:=ACaption; + if bmpName<>'' then + Section.Bitmap.LoadFromLazarusResource(bmpName); end; procedure TMainIDEBase.CreateMainMenuItem(var Section: TIDEMenuSection; @@ -399,17 +406,21 @@ procedure TMainIDEBase.SetupFileMenu; var ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuFile; with MainIDEBar do begin {$IFDEF UseMenuIntf} - CreateMenuSeparatorSection(ParentMI,itmFileNew,'itmFileNew'); + CreateMenuSeparatorSection(mnuFile,itmFileNew,'itmFileNew'); + ParentMI:=itmFileNew; + {$ELSE} + ParentMI:=mnuFile; {$ENDIF} + CreateMenuItem(ParentMI,itmFileNewUnit,'itmFileNewUnit',lisMenuNewUnit,'menu_new'); CreateMenuItem(ParentMI,itmFileNewForm,'itmFileNewForm',lisMenuNewForm,'menu_new'); CreateMenuItem(ParentMI,itmFileNewOther,'itmFileNewOther',lisMenuNewOther,'menu_new'); {$IFDEF UseMenuIntf} - CreateMenuSeparatorSection(ParentMI,itmFileOpenSave,'itmFileOpenSave'); + CreateMenuSeparatorSection(mnuFile,itmFileOpenSave,'itmFileOpenSave'); + ParentMI:=itmFileOpenSave; {$ELSE} ParentMI.Add(CreateMenuSeparator); {$ENDIF} @@ -417,7 +428,7 @@ begin CreateMenuItem(ParentMI,itmFileOpen,'itmFileOpen',lisMenuOpen,'menu_open'); CreateMenuItem(ParentMI,itmFileRevert,'itmFileRevert',lisMenuRevert,'menu_undo'); {$IFDEF UseMenuIntf} - CreateMenuSubSection(ParentMI,itmFileRecentOpen,'itmFileRecentOpen',lisMenuOpenRecent); + CreateMenuSubSection(mnuFile,itmFileRecentOpen,'itmFileRecentOpen',lisMenuOpenRecent); {$ELSE} CreateMenuItem(ParentMI,itmFileRecentOpen,'itmFileRecentOpen',lisMenuOpenRecent); {$ENDIF} @@ -428,7 +439,8 @@ begin CreateMenuItem(ParentMI,itmFileCloseAll,'itmFileCloseAll',lisMenuCloseAll,'',false); {$IFDEF UseMenuIntf} - CreateMenuSeparatorSection(ParentMI,itmFileDirectories,'itmFileDirectories'); + CreateMenuSeparatorSection(mnuFile,itmFileDirectories,'itmFileDirectories'); + ParentMI:=itmFileDirectories; {$ELSE} ParentMI.Add(CreateMenuSeparator); {$ENDIF} @@ -436,7 +448,8 @@ begin CreateMenuItem(ParentMI,itmFileCleanDirectory,'itmFileCleanDirectory',lisMenuCleanDirectory); {$IFDEF UseMenuIntf} - CreateMenuSeparatorSection(ParentMI,itmFileIDEStart,'itmFileIDEStart'); + CreateMenuSeparatorSection(mnuFile,itmFileIDEStart,'itmFileIDEStart'); + ParentMI:=itmFileIDEStart; {$ELSE} ParentMI.Add(CreateMenuSeparator); {$ENDIF} @@ -448,51 +461,66 @@ end; procedure TMainIDEBase.SetupEditMenu; var - ParentMI: TMenuItem; - SubParentMI: TMenuItem; - SubSubParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; + SubParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; + SubSubParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuEdit; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditReUndo,'itmEditReUndo'); + ParentMI:=itmEditReUndo; + {$ELSE} + ParentMI:=mnuEdit; + {$ENDIF} CreateMenuItem(ParentMI,itmEditUndo,'itmEditUndo',lisMenuUndo,'menu_undo'); CreateMenuItem(ParentMI,itmEditRedo,'itmEditRedo',lisMenuRedo,'menu_redo'); + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditClipboard,'itmEditClipboard'); + ParentMI:=itmEditClipboard; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmEditCut,'itmEditCut',lisMenuCut,'menu_cut'); CreateMenuItem(ParentMI,itmEditCopy,'itmEditCopy',lisMenuCopy,'menu_copy'); CreateMenuItem(ParentMI,itmEditPaste,'itmEditPaste',lisMenuPaste,'menu_paste'); + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditBlockIndentation,'itmEditBlockIndentation'); + ParentMI:=itmEditBlockIndentation; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmEditIndentBlock,'itmEditIndentBlock',lisMenuIndentSelection,'menu_indent'); CreateMenuItem(ParentMI,itmEditUnindentBlock,'itmEditUnindentBlock',lisMenuUnindentSelection,'menu_unindent'); CreateMenuItem(ParentMI,itmEditEncloseBlock,'itmEditEncloseBlock',lisMenuEncloseSelection); - - ParentMI.Add(CreateMenuSeparator); - - CreateMenuItem(ParentMI,itmEditUpperCaseBlock,'itmEditUpperCaseBlock',lisMenuUpperCaseSelection); - CreateMenuItem(ParentMI,itmEditLowerCaseBlock,'itmEditLowerCaseBlock',lisMenuLowerCaseSelection); - - ParentMI.Add(CreateMenuSeparator); - - CreateMenuItem(ParentMI,itmEditTabsToSpacesBlock,'itmEditTabsToSpacesBlock',lisMenuTabsToSpacesSelection); - CreateMenuItem(ParentMI,itmEditSelectionBreakLines,'itmEditSelectionBreakLines',lisMenuBeakLinesInSelection); - - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmEditCommentBlock,'itmEditCommentBlock',lisMenuCommentSelection); CreateMenuItem(ParentMI,itmEditUncommentBlock,'itmEditUncommentBlock',lisMenuUncommentSelection); CreateMenuItem(ParentMI,itmEditConditionalBlock,'itmEditConditionalBlock',lisMenuConditionalSelection); CreateMenuItem(ParentMI,itmEditSortBlock,'itmEditSortBlock',lisMenuSortSelection); + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditBlockCharConversion,'itmEditBlockCharConversion'); + ParentMI:=itmEditBlockCharConversion; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + CreateMenuItem(ParentMI,itmEditUpperCaseBlock,'itmEditUpperCaseBlock',lisMenuUpperCaseSelection); + CreateMenuItem(ParentMI,itmEditLowerCaseBlock,'itmEditLowerCaseBlock',lisMenuLowerCaseSelection); + CreateMenuItem(ParentMI,itmEditTabsToSpacesBlock,'itmEditTabsToSpacesBlock',lisMenuTabsToSpacesSelection); + CreateMenuItem(ParentMI,itmEditSelectionBreakLines,'itmEditSelectionBreakLines',lisMenuBeakLinesInSelection); + + {$IFDEF UseMenuIntf} + CreateMenuSubSection(mnuEdit,itmEditSelect,'itmEditSelect',lisMenuSelect); + {$ELSE} CreateMenuItem(ParentMI,itmEditSelect,'itmEditSelect',lisMenuSelect); + {$ENDIF} begin // select sub menu items - SubParentMI:=MainIDEBar.itmEditSelect; + SubParentMI:=itmEditSelect; CreateMenuItem(SubParentMI,itmEditSelectAll,'itmEditSelectAll',lisMenuSelectAll); CreateMenuItem(SubParentMI,itmEditSelectToBrace,'itmEditSelectToBrace',lisMenuSelectToBrace); CreateMenuItem(SubParentMI,itmEditSelectCodeBlock,'itmEditSelectCodeBlock',lisMenuSelectCodeBlock); @@ -500,15 +528,30 @@ begin CreateMenuItem(SubParentMI,itmEditSelectParagraph,'itmEditSelectParagraph',lisMenuSelectParagraph); end; + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditInsertions,'itmEditInsertions'); + ParentMI:=itmEditInsertions; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + CreateMenuItem(ParentMI,itmEditInsertCharacter,'itmEditInsertCharacter',lisMenuInsertCharacter); + {$IFDEF UseMenuIntf} + CreateMenuSubSection(ParentMI,itmEditInsertText,'itmEditInsertText',lisMenuInsertText); + {$ELSE} CreateMenuItem(ParentMI,itmEditInsertText,'itmEditInsertText',lisMenuInsertText); + {$ENDIF} begin // insert text sub menu items - SubParentMI:=MainIDEBar.itmEditInsertText; + SubParentMI:=itmEditInsertText; + {$IFDEF UseMenuIntf} + CreateMenuSubSection(SubParentMI,itmEditInsertCVSKeyWord,'itmEditInsertCVSKeyWord',lisMenuInsertCVSKeyword); + {$ELSE} CreateMenuItem(SubParentMI,itmEditInsertCVSKeyWord,'itmEditInsertCVSKeyWord',lisMenuInsertCVSKeyword); + {$ENDIF} begin // insert CVS keyword sub menu items - SubSubParentMI:=MainIDEBar.itmEditInsertCVSKeyWord; + SubSubParentMI:=itmEditInsertCVSKeyWord; CreateMenuItem(SubSubParentMI,itmEditInsertCVSAuthor,'itmEditInsertCVSAuthor','Author'); CreateMenuItem(SubSubParentMI,itmEditInsertCVSDate,'itmEditInsertCVSDate','Date'); CreateMenuItem(SubSubParentMI,itmEditInsertCVSHeader,'itmEditInsertCVSHeader','Header'); @@ -519,10 +562,14 @@ begin CreateMenuItem(SubSubParentMI,itmEditInsertCVSSource,'itmEditInsertCVSSource','Source'); end; + {$IFDEF UseMenuIntf} + CreateMenuSubSection(SubParentMI,itmEditInsertGeneral,'itmEditInsertGeneral',lisMenuInsertGeneral); + {$ELSE} CreateMenuItem(SubParentMI,itmEditInsertGeneral,'itmEditInsertGeneral',lisMenuInsertGeneral); + {$ENDIF} begin // insert general text sub menu items - SubSubParentMI:=MainIDEBar.itmEditInsertGeneral; + SubSubParentMI:=itmEditInsertGeneral; CreateMenuItem(SubSubParentMI,itmEditInsertGPLNotice,'itmEditInsertGPLNotice',lisMenuInsertGPLNotice); CreateMenuItem(SubSubParentMI,itmEditInsertLGPLNotice,'itmEditInsertLGPLNotice',lisMenuInsertLGPLNotice); CreateMenuItem(SubSubParentMI,itmEditInsertUsername,'itmEditInsertUsername',lisMenuInsertUsername); @@ -531,7 +578,12 @@ begin end; end; + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEdit,itmEditMenuCodeTools,'itmEditMenuCodeTools'); + ParentMI:=itmEditMenuCodeTools; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmEditCompleteCode,'itmEditCompleteCode',lisMenuCompleteCode); CreateMenuItem(ParentMI,itmEditExtractProc,'itmEditExtractProc',lisMenuExtractProc); @@ -540,23 +592,30 @@ end; procedure TMainIDEBase.SetupSearchMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuSearch; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuSearch,itmSearchFindReplace,'itmSearchFindReplace'); + ParentMI:=itmSearchFindReplace; + {$ELSE} + ParentMI:=mnuSearch; + {$ENDIF} + CreateMenuItem(ParentMI,itmSearchFind,'itmSearchFind',lisMenuFind); CreateMenuItem(ParentMI,itmSearchFindNext,'itmSearchFindNext',lisMenuFindNext); CreateMenuItem(ParentMI,itmSearchFindPrevious,'itmSearchFindPrevious',lisMenuFindPrevious); CreateMenuItem(ParentMI,itmSearchFindInFiles,'itmSearchFindInFiles',lisMenuFindInFiles); CreateMenuItem(ParentMI,itmSearchReplace,'itmSearchReplace',lisMenuReplace); CreateMenuItem(ParentMI,itmIncrementalFind,'itmIncrementalFind',lisMenuIncrementalFind); - - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmGotoLine,'itmGotoLine',lisMenuGotoLine); + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuSearch,itmJumpings,'itmJumpings'); + ParentMI:=itmJumpings; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmJumpBack,'itmJumpBack',lisMenuJumpBack); CreateMenuItem(ParentMI,itmJumpForward,'itmJumpForward',lisMenuJumpForward); @@ -564,17 +623,27 @@ begin CreateMenuItem(ParentMI,itmJumpHistory,'itmJumpHistory',lisMenuViewJumpHistory); CreateMenuItem(ParentMI,itmJumpToNextError,'itmJumpToNextError',lisMenuJumpToNextError); CreateMenuItem(ParentMI,itmJumpToPrevError,'itmJumpToPrevError',lisMenuJumpToPrevError); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuSearch,itmBookmarks,'itmBookmarks'); + ParentMI:=itmBookmarks; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + CreateMenuItem(ParentMI,itmSetFreeBookmark,'itmSetFreeBookmark',lisMenuSetFreeBookmark); CreateMenuItem(ParentMI,itmJumpToNextBookmark,'itmJumpToNextBookmark',lisMenuJumpToNextBookmark); CreateMenuItem(ParentMI,itmJumpToPrevBookmark,'itmJumpToPrevBookmark',lisMenuJumpToPrevBookmark); + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuSearch,itmCodeToolSearches,'itmCodeToolSearches'); + ParentMI:=itmCodeToolSearches; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmFindBlockOtherEnd,'itmFindBlockOtherEnd',lisMenuFindBlockOtherEndOfCodeBlock); CreateMenuItem(ParentMI,itmFindBlockStart,'itmFindBlockStart',lisMenuFindCodeBlockStart); - - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmFindDeclaration,'itmFindDeclaration',lisMenuFindDeclarationAtCursor); CreateMenuItem(ParentMI,itmOpenFileAtCursor,'itmOpenFileAtCursor',lisMenuOpenFilenameAtCursor); CreateMenuItem(ParentMI,itmGotoIncludeDirective,'itmGotoIncludeDirective',lisMenuGotoIncludeDirective); @@ -585,30 +654,49 @@ end; procedure TMainIDEBase.SetupViewMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuView; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuView,itmViewMainWindows,'itmViewMainWindows'); + ParentMI:=itmViewMainWindows; + {$ELSE} + ParentMI:=mnuView; + {$ENDIF} + CreateMenuItem(ParentMI,itmViewInspector,'itmViewInspector',lisMenuViewObjectInspector); CreateMenuItem(ParentMI,itmViewSourceEditor,'itmViewSourceEditor',lisMenuViewSourceEditor); CreateMenuItem(ParentMI,itmViewCodeExplorer,'itmViewCodeExplorer',lisMenuViewCodeExplorer); CreateMenuItem(ParentMI,itmViewLazDoc,'itmViewLazDoc',lisMenuLazDoc); //DBlaszijk 5-sep-05 + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuView,itmViewUnitWindows,'itmViewUnitWindows'); + ParentMI:=itmViewUnitWindows; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmViewUnits,'itmViewUnits',lisMenuViewUnits); CreateMenuItem(ParentMI,itmViewForms,'itmViewForms',lisMenuViewForms); CreateMenuItem(ParentMI,itmViewUnitDependencies,'itmViewUnitDependencies',lisMenuViewUnitDependencies); CreateMenuItem(ParentMI,itmViewUnitInfo,'itmViewUnitInfo',lisMenuViewUnitInfo); - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmViewToggleFormUnit,'itmViewToggleFormUnit',lisMenuViewToggleFormUnit); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuView,itmViewSecondaryWindows,'itmViewSecondaryWindows'); + ParentMI:=itmViewSecondaryWindows; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmViewMessage,'itmViewMessage',lisMenuViewMessages); CreateMenuItem(ParentMI,itmViewSearchResults,'itmViewSearchResults',lisMenuViewSearchResults); CreateMenuItem(ParentMI,itmViewAnchorEditor,'itmViewAnchorEditor',lisMenuViewAnchorEditor); + {$IFDEF UseMenuIntf} + CreateMenuSubSection(ParentMI,itmViewDebugWindows,'itmViewDebugWindows',lisMenuDebugWindows,'menu_debugger'); + {$ELSE} CreateMenuItem(ParentMI,itmViewDebugWindows,'itmViewDebugWindows',lisMenuDebugWindows,'menu_debugger'); + {$ENDIF} begin CreateMenuItem(itmViewDebugWindows,itmViewWatches,'itmViewWatches',lisMenuViewWatches,'menu_watches'); CreateMenuItem(itmViewDebugWindows,itmViewBreakPoints,'itmViewBreakPoints',lisMenuViewBreakPoints,'menu_breakpoints'); @@ -621,38 +709,74 @@ end; procedure TMainIDEBase.SetupProjectMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuProject; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectNewSection,'itmProjectNewSection'); + ParentMI:=itmProjectNewSection; + {$ELSE} + ParentMI:=mnuProject; + {$ENDIF} + CreateMenuItem(ParentMI,itmProjectNew,'itmProjectNew',lisMenuNewProject); CreateMenuItem(ParentMI,itmProjectNewFromFile,'itmProjectNewFromFile',lisMenuNewProjectFromFile); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectOpenSection,'itmProjectOpenSection'); + ParentMI:=itmProjectOpenSection; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmProjectOpen,'itmProjectOpen',lisMenuOpenProject,'menu_openproject'); + {$IFDEF UseMenuIntf} + CreateMenuSubSection(ParentMI,itmProjectRecentOpen,'itmProjectRecentOpen',lisMenuOpenRecentProject); + {$ELSE} CreateMenuItem(ParentMI,itmProjectRecentOpen,'itmProjectRecentOpen',lisMenuOpenRecentProject); - ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectSaveSection,'itmProjectSaveSection'); + ParentMI:=itmProjectSaveSection; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmProjectSave,'itmProjectSave',lisMenuSaveProject); CreateMenuItem(ParentMI,itmProjectSaveAs,'itmProjectSaveAs',lisMenuSaveProjectAs); CreateMenuItem(ParentMI,itmProjectPublish,'itmProjectPublish',lisMenuPublishProject); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectWindowSection,'itmProjectWindowSection'); + ParentMI:=itmProjectWindowSection; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmProjectInspector,'itmProjectInspector',lisMenuProjectInspector,'menu_projectinspector'); CreateMenuItem(ParentMI,itmProjectOptions,'itmProjectOptions',lisMenuProjectOptions,'menu_projectoptions'); CreateMenuItem(ParentMI,itmProjectCompilerOptions,'itmProjectCompilerOptions',lisMenuCompilerOptions); + CreateMenuItem(ParentMI,itmProjectViewToDos,'itmProjectViewToDos',lisMenuViewProjectTodos); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectAddRemoveSection,'itmProjectAddRemoveSection'); + ParentMI:=itmProjectAddRemoveSection; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmProjectAddTo,'itmProjectAddTo',lisMenuAddToProject); CreateMenuItem(ParentMI,itmProjectRemoveFrom,'itmProjectRemoveFrom',lisMenuRemoveFromProject); - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmProjectViewSource,'itmProjectViewSource',lisMenuViewSource); - CreateMenuItem(ParentMI,itmProjectViewToDos,'itmProjectViewToDos',lisMenuViewProjectTodos); - + {$IFDEF TRANSLATESTRING} + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuProject,itmProjectPoFileSection,'itmProjectPoFileSection'); + ParentMI:=itmProjectPoFileSection; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI, itmProjectCreatePoFiles,'itmProjectCreatePoFiles', lisMenuCreatePoFile); CreateMenuItem(ParentMI, itmProjectCollectPoFiles, 'itmProjectCollectPoFiles', lisMenuCollectPoFil); {$ENDIF} @@ -661,15 +785,26 @@ end; procedure TMainIDEBase.SetupRunMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuRun; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuRun,itmRunBuilding,'itmRunBuilding'); + ParentMI:=itmRunBuilding; + {$ELSE} + ParentMI:=mnuRun; + {$ENDIF} + CreateMenuItem(ParentMI,itmRunMenuBuild,'itmRunMenuBuild',lisMenuBuild,'menu_build'); CreateMenuItem(ParentMI,itmRunMenuBuildAll,'itmRunMenuBuildAll',lisMenuBuildAll,'menu_buildall'); CreateMenuItem(ParentMI,itmRunMenuAbortBuild,'itmRunMenuAbortBuild',lisMenuAbortBuild); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuRun,itmRunnning,'itmRunnning'); + ParentMI:=itmRunnning; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmRunMenuRun,'itmRunMenuRun',lisMenuProjectRun,'menu_run'); CreateMenuItem(ParentMI,itmRunMenuPause,'itmRunMenuPause',lisMenuPause,'menu_pause'); @@ -677,46 +812,84 @@ begin CreateMenuItem(ParentMI,itmRunMenuStepOver,'itmRunMenuStepOver',lisMenuStepOver,'menu_stepover'); CreateMenuItem(ParentMI,itmRunMenuRunToCursor,'itmRunMenuRunToCursor',lisMenuRunToCursor); CreateMenuItem(ParentMI,itmRunMenuStop,'itmRunMenuStop',lisMenuStop,''); - ParentMI.Add(CreateMenuSeparator); - CreateMenuItem(ParentMI,itmRunMenuRunParameters,'itmRunMenuRunParameters',lisMenuRunParameters); CreateMenuItem(ParentMI,itmRunMenuResetDebugger,'itmRunMenuResetDebugger',lisMenuResetDebugger); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuRun,itmRunBuildingFile,'itmRunBuildingFile'); + ParentMI:=itmRunBuildingFile; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmRunMenuBuildFile,'itmRunMenuBuildFile',lisMenuBuildFile); CreateMenuItem(ParentMI,itmRunMenuRunFile,'itmRunMenuRunFile',lisMenuRunFile); CreateMenuItem(ParentMI,itmRunMenuConfigBuildFile,'itmRunMenuConfigBuildFile',lisMenuConfigBuildFile); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuRun,itmRunDebugging,'itmRunDebugging'); + ParentMI:=itmRunDebugging; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmRunMenuInspect,'itmRunMenuInspect',lisMenuInspect, '', False); CreateMenuItem(ParentMI,itmRunMenuEvaluate,'itmRunMenuEvaluate',lisMenuEvaluate, '', False); CreateMenuItem(ParentMI,itmRunMenuAddWatch,'itmRunMenuAddWatch',lisMenuAddWatch, '', False); + {$IFDEF UseMenuIntf} + CreateMenuSubSection(ParentMI,itmRunMenuAddBreakpoint,'itmRunMenuAddBreakpoint',lisMenuAddBreakpoint, ''); + {$ELSE} CreateMenuItem(ParentMI,itmRunMenuAddBreakpoint,'itmRunMenuAddBreakpoint',lisMenuAddBreakpoint, ''); - CreateMenuItem(itmRunMenuAddBreakpoint,itmRunMenuAddBPSource,'itmRunMenuAdddBPSource',lisMenuAddBPSource, '', False); + {$ENDIF} + CreateMenuItem(itmRunMenuAddBreakpoint,itmRunMenuAddBPSource,'itmRunMenuAdddBPSource',lisMenuAddBPSource, '', False); end; end; procedure TMainIDEBase.SetupComponentsMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuComponents; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuComponents,itmPkgOpening,'itmPkgOpening'); + ParentMI:=itmPkgOpening; + {$ELSE} + ParentMI:=mnuComponents; + {$ENDIF} + CreateMenuItem(ParentMI,itmPkgOpenPackage,'itmPkgOpenPackage',lisMenuOpenPackage,'pkg_package'); CreateMenuItem(ParentMI,itmPkgOpenPackageFile,'itmPkgOpenPackageFile',lisMenuOpenPackageFile,'pkg_package'); CreateMenuItem(ParentMI,itmPkgOpenPackageOfCurUnit,'itmPkgOpenPackageOfCurUnit',lisMenuOpenPackageOfCurUnit,'pkg_package'); + {$IFDEF UseMenuIntf} + CreateMenuSubSection(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg,'pkg_package'); + {$ELSE} CreateMenuItem(ParentMI,itmPkgOpenRecent,'itmPkgOpenRecent',lisMenuOpenRecentPkg,'pkg_package'); + {$ENDIF} + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuComponents,itmPkgUnits,'itmPkgUnits'); + ParentMI:=itmPkgUnits; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmPkgAddCurUnitToPkg,'itmPkgAddCurUnitToPkg',lisMenuAddCurUnitToPkg,'pkg_addunittopackage'); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuComponents,itmPkgGraphSection,'itmPkgGraphSection'); + ParentMI:=itmPkgGraphSection; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmPkgPkgGraph,'itmPkgPkgGraph',lisMenuPackageGraph,'pkg_packagegraph'); CreateMenuItem(ParentMI,itmPkgEditInstallPkgs,'itmPkgEditInstallPkgs',lisMenuEditInstallPkgs,'pkg_package_install'); {$IFDEF CustomIDEComps} + {$IFDEF UseMenuIntf} + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmCompsConfigCustomComps,'itmCompsConfigCustomComps',lisMenuConfigCustomComps); {$ENDIF} end; @@ -724,26 +897,57 @@ end; procedure TMainIDEBase.SetupToolsMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuTools; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuTools,itmCustomTools,'itmCustomTools'); + ParentMI:=itmCustomTools; + {$ELSE} + ParentMI:=mnuTools; + {$ENDIF} + CreateMenuItem(ParentMI,itmToolConfigure,'itmToolConfigure',lisMenuSettings); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuTools,itmCodeToolChecks,'itmCodeToolChecks'); + ParentMI:=itmCodeToolChecks; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmToolSyntaxCheck,'itmToolSyntaxCheck',lisMenuQuickSyntaxCheck); CreateMenuItem(ParentMI,itmToolGuessUnclosedBlock,'itmToolGuessUnclosedBlock',lisMenuGuessUnclosedBlock); CreateMenuItem(ParentMI,itmToolGuessMisplacedIFDEF,'itmToolGuessMisplacedIFDEF',lisMenuGuessMisplacedIFDEF); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuTools,itmSecondaryTools,'itmSecondaryTools'); + ParentMI:=itmSecondaryTools; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + CreateMenuItem(ParentMI,itmToolMakeResourceString,'itmToolMakeResourceString',lisMenuMakeResourceString); CreateMenuItem(ParentMI,itmToolDiff,'itmToolDiff',lisMenuDiff); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuTools,itmDelphiConversion,'itmDelphiConversion'); + ParentMI:=itmDelphiConversion; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmToolCheckLFM,'itmToolCheckLFM',lisMenuCheckLFM); CreateMenuItem(ParentMI,itmToolConvertDelphiUnit,'itmToolConvertDelphiUnit',lisMenuConvertDelphiUnit); CreateMenuItem(ParentMI,itmToolConvertDelphiProject,'itmToolConvertDelphiProject',lisMenuConvertDelphiProject); CreateMenuItem(ParentMI,itmToolConvertDFMtoLFM,'itmToolConvertDFMtoLFM',lisMenuConvertDFMtoLFM); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuTools,itmBuildingLazarus,'itmBuildingLazarus'); + ParentMI:=itmBuildingLazarus; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} CreateMenuItem(ParentMI,itmToolBuildLazarus,'itmToolBuildLazarus',lisMenuBuildLazarus,'menu_buildlazarus'); CreateMenuItem(ParentMI,itmToolConfigureBuildLazarus,'itmToolConfigureBuildLazarus',lisMenuConfigureBuildLazarus); @@ -752,11 +956,16 @@ end; procedure TMainIDEBase.SetupEnvironmentMenu; var - ParentMI: TMenuItem; + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin - ParentMI:=MainIDEBar.mnuEnvironment; - with MainIDEBar do begin + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEnvironment,itmOptionsDialogs,'itmOptionsDialogs'); + ParentMI:=itmOptionsDialogs; + {$ELSE} + ParentMI:=mnuEnvironment; + {$ENDIF} + CreateMenuItem(ParentMI,itmEnvGeneralOptions,'itmEnvGeneralOptions', lisMenuGeneralOptions,'menu_environmentoptions'); CreateMenuItem(ParentMI,itmEnvEditorOptions,'itmEnvEditorOptions', @@ -770,7 +979,14 @@ begin CreateMenuItem(ParentMI,itmEnvCodeToolsDefinesEditor, 'itmEnvCodeToolsDefinesEditor',lisMenuCodeToolsDefinesEditor, 'menu_codetoolsdefineseditor'); + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuEnvironment,itmIDECacheSection,'itmIDECacheSection'); + ParentMI:=itmIDECacheSection; + {$ELSE} ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + CreateMenuItem(ParentMI,itmEnvRescanFPCSrcDir,'itmEnvRescanFPCSrcDir', lisMenuRescanFPCSourceDirectory); end; @@ -782,20 +998,209 @@ begin end; procedure TMainIDEBase.SetupHelpMenu; +var + ParentMI: {$IFDEF UseMenuIntf}TIDEMenuSection{$ELSE}TMenuItem{$ENDIF}; begin with MainIDEBar do begin - CreateMenuItem(mnuHelp,itmHelpOnlineHelp,'itmHelpOnlineHelp', + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuHelp,itmOnlineHelps,'itmOnlineHelps'); + ParentMI:=itmOnlineHelps; + {$ELSE} + ParentMI:=mnuHelp; + {$ENDIF} + + CreateMenuItem(ParentMI,itmHelpOnlineHelp,'itmHelpOnlineHelp', lisMenuOnlineHelp); - CreateMenuItem(mnuHelp,itmHelpConfigureHelp,'itmHelpConfigureHelp', + CreateMenuItem(ParentMI,itmHelpConfigureHelp,'itmHelpConfigureHelp', lisMenuConfigureHelp); - mnuHelp.Add(CreateMenuSeparator); - CreateMenuItem(mnuHelp,itmHelpAboutLazarus,'itmHelpAboutLazarus', + + {$IFDEF UseMenuIntf} + CreateMenuSeparatorSection(mnuHelp,itmInfoHelps,'itmInfoHelps'); + ParentMI:=itmInfoHelps; + {$ELSE} + ParentMI.Add(CreateMenuSeparator); + {$ENDIF} + + CreateMenuItem(ParentMI,itmHelpAboutLazarus,'itmHelpAboutLazarus', lisMenuAboutLazarus); end; end; procedure TMainIDEBase.LoadMenuShortCuts; + + {$IFDEF UseMenuIntf} + function GetCommand(ACommand: word): TIDECommand; + begin + Result:=IDECommandList.FindIDECommand(ACommand); + end; + {$ENDIF} + begin + {$IFDEF UseMenuIntf} + with MainIDEBar do begin + // file menu + itmFileNewUnit.Command:=GetCommand(ecNewUnit); + itmFileNewForm.Command:=GetCommand(ecNewForm); + itmFileNewOther.Command:=GetCommand(ecNew); + itmFileOpen.Command:=GetCommand(ecOpen); + itmFileRevert.Command:=GetCommand(ecRevert); + itmFileSave.Command:=GetCommand(ecSave); + itmFileSaveAs.Command:=GetCommand(ecSaveAs); + itmFileSaveAll.Command:=GetCommand(ecSaveAll); + itmFileClose.Command:=GetCommand(ecClose); + itmFileCloseAll.Command:=GetCommand(ecCloseAll); + itmFileCleanDirectory.Command:=GetCommand(ecCleanDirectory); + itmFileQuit.Command:=GetCommand(ecQuit); + itmFileQuit.Command:=GetCommand(ecQuit); + + // edit menu + itmEditUndo.Command:=GetCommand(ecUndo); + itmEditRedo.Command:=GetCommand(ecRedo); + itmEditCut.Command:=GetCommand(ecCut); + itmEditCopy.Command:=GetCommand(ecCopy); + itmEditPaste.Command:=GetCommand(ecPaste); + itmEditIndentBlock.Command:=GetCommand(ecBlockIndent); + itmEditUnindentBlock.Command:=GetCommand(ecBlockUnindent); + itmEditEncloseBlock.Command:=GetCommand(ecSelectionEnclose); + itmEditUpperCaseBlock.Command:=GetCommand(ecSelectionUpperCase); + itmEditLowerCaseBlock.Command:=GetCommand(ecSelectionLowerCase); + itmEditTabsToSpacesBlock.Command:=GetCommand(ecSelectionTabs2Spaces); + itmEditCommentBlock.Command:=GetCommand(ecSelectionComment); + itmEditUncommentBlock.Command:=GetCommand(ecSelectionUncomment); + itmEditConditionalBlock.Command:=GetCommand(ecSelectionConditional); + itmEditSortBlock.Command:=GetCommand(ecSelectionSort); + itmEditSelectionBreakLines.Command:=GetCommand(ecSelectionBreakLines); + itmEditSelectAll.Command:=GetCommand(ecSelectAll); + itmEditSelectToBrace.Command:=GetCommand(ecSelectToBrace); + itmEditSelectCodeBlock.Command:=GetCommand(ecSelectCodeBlock); + itmEditSelectLine.Command:=GetCommand(ecSelectLine); + itmEditSelectParagraph.Command:=GetCommand(ecSelectParagraph); + itmEditCompleteCode.Command:=GetCommand(ecCompleteCode); + itmEditExtractProc.Command:=GetCommand(ecExtractProc); + + itmEditInsertCVSAuthor.Command:=GetCommand(ecInsertCVSAuthor); + itmEditInsertCVSDate.Command:=GetCommand(ecInsertCVSDate); + itmEditInsertCVSHeader.Command:=GetCommand(ecInsertCVSHeader); + itmEditInsertCVSID.Command:=GetCommand(ecInsertCVSID); + itmEditInsertCVSLog.Command:=GetCommand(ecInsertCVSLog); + itmEditInsertCVSName.Command:=GetCommand(ecInsertCVSName); + itmEditInsertCVSRevision.Command:=GetCommand(ecInsertCVSRevision); + itmEditInsertCVSSource.Command:=GetCommand(ecInsertCVSSource); + + itmEditInsertGPLNotice.Command:=GetCommand(ecInsertGPLNotice); + itmEditInsertLGPLNotice.Command:=GetCommand(ecInsertLGPLNotice); + itmEditInsertUsername.Command:=GetCommand(ecInsertUserName); + itmEditInsertDateTime.Command:=GetCommand(ecInsertDateTime); + itmEditInsertChangeLogEntry.Command:=GetCommand(ecInsertChangeLogEntry); + + // search menu + itmSearchFind.Command:=GetCommand(ecFind); + itmSearchFindNext.Command:=GetCommand(ecFindNext); + itmSearchFindPrevious.Command:=GetCommand(ecFindPrevious); + itmSearchFindInFiles.Command:=GetCommand(ecFindInFiles); + itmSearchFindIdentifierRefs.Command:=GetCommand(ecFindIdentifierRefs); + itmSearchReplace.Command:=GetCommand(ecReplace); + itmSearchRenameIdentifier.Command:=GetCommand(ecRenameIdentifier); + itmIncrementalFind.Command:=GetCommand(ecIncrementalFind); + itmGotoLine.Command:=GetCommand(ecGotoLineNumber); + itmJumpBack.Command:=GetCommand(ecJumpBack); + itmJumpForward.Command:=GetCommand(ecJumpForward); + itmAddJumpPoint.Command:=GetCommand(ecAddJumpPoint); + itmJumpHistory.Command:=GetCommand(ecViewJumpHistory); + itmJumpToNextError.Command:=GetCommand(ecJumpToNextError); + itmJumpToPrevError.Command:=GetCommand(ecJumpToPrevError); + itmSetFreeBookmark.Command:=GetCommand(ecSetFreeBookmark); + itmJumpToNextBookmark.Command:=GetCommand(ecNextBookmark); + itmJumpToPrevBookmark.Command:=GetCommand(ecPrevBookmark); + itmFindBlockOtherEnd.Command:=GetCommand(ecFindBlockOtherEnd); + itmFindBlockStart.Command:=GetCommand(ecFindBlockStart); + itmFindDeclaration.Command:=GetCommand(ecFindDeclaration); + itmOpenFileAtCursor.Command:=GetCommand(ecOpenFileAtCursor); + itmGotoIncludeDirective.Command:=GetCommand(ecGotoIncludeDirective); + + // view menu + itmViewInspector.Command:=GetCommand(ecToggleObjectInsp); + itmViewSourceEditor.Command:=GetCommand(ecToggleSourceEditor); + itmViewUnits.Command:=GetCommand(ecViewUnits); + itmViewCodeExplorer.Command:=GetCommand(ecToggleCodeExpl); + //itmViewLazDoc.Command:=GetCommand(ecLazDoc); //DBlaszijk 5-sep-05 + itmViewUnitDependencies.Command:=GetCommand(ecViewUnitDependencies); + itmViewUnitInfo.Command:=GetCommand(ecViewUnitInfo); + itmViewForms.Command:=GetCommand(ecViewForms); + itmViewToggleFormUnit.Command:=GetCommand(ecToggleFormUnit); + itmViewMessage.Command:=GetCommand(ecToggleMessages); + itmViewSearchResults.Command:=GetCommand(ecToggleSearchResults); + itmViewAnchorEditor.Command:=GetCommand(ecViewAnchorEditor); + + // project menu + itmProjectNew.Command:=GetCommand(ecNewProject); + itmProjectNewFromFile.Command:=GetCommand(ecNewProjectFromFile); + itmProjectOpen.Command:=GetCommand(ecOpenProject); + itmProjectSave.Command:=GetCommand(ecSaveProject); + itmProjectSaveAs.Command:=GetCommand(ecSaveProjectAs); + itmProjectPublish.Command:=GetCommand(ecPublishProject); + itmProjectInspector.Command:=GetCommand(ecProjectInspector); + itmProjectOptions.Command:=GetCommand(ecProjectOptions); + itmProjectCompilerOptions.Command:=GetCommand(ecCompilerOptions); + itmProjectAddTo.Command:=GetCommand(ecAddCurUnitToProj); + itmProjectRemoveFrom.Command:=GetCommand(ecRemoveFromProj); + itmProjectViewSource.Command:=GetCommand(ecViewProjectSource); + + // run menu + itmRunMenuBuild.Command:=GetCommand(ecBuild); + itmRunMenuBuildAll.Command:=GetCommand(ecBuildAll); + itmRunMenuAbortBuild.Command:=GetCommand(ecAbortBuild); + itmRunMenuRun.Command:=GetCommand(ecRun); + itmRunMenuPause.Command:=GetCommand(ecPause); + itmRunMenuStepInto.Command:=GetCommand(ecStepInto); + itmRunMenuStepOver.Command:=GetCommand(ecStepOver); + itmRunMenuRunToCursor.Command:=GetCommand(ecRunToCursor); + itmRunMenuStop.Command:=GetCommand(ecStopProgram); + itmRunMenuResetDebugger.Command:=GetCommand(ecResetDebugger); + itmRunMenuRunParameters.Command:=GetCommand(ecRunParameters); + itmRunMenuBuildFile.Command:=GetCommand(ecBuildFile); + itmRunMenuRunFile.Command:=GetCommand(ecRunFile); + itmRunMenuConfigBuildFile.Command:=GetCommand(ecConfigBuildFile); + + // components menu + itmPkgOpenPackage.Command:=GetCommand(ecOpenPackage); + itmPkgOpenPackageFile.Command:=GetCommand(ecOpenPackageFile); + itmPkgOpenPackageOfCurUnit.Command:=GetCommand(ecOpenPackageOfCurUnit); + itmPkgAddCurUnitToPkg.Command:=GetCommand(ecAddCurUnitToPkg); + itmPkgPkgGraph.Command:=GetCommand(ecPackageGraph); + itmPkgEditInstallPkgs.Command:=GetCommand(ecEditInstallPkgs); + {$IFDEF CustomIDEComps} + itmCompsConfigCustomComps.Command:=GetCommand(ecConfigCustomComps); + {$ENDIF} + + // tools menu + itmToolConfigure.Command:=GetCommand(ecExtToolSettings); + itmToolSyntaxCheck.Command:=GetCommand(ecSyntaxCheck); + itmToolGuessUnclosedBlock.Command:=GetCommand(ecGuessUnclosedBlock); + itmToolGuessMisplacedIFDEF.Command:=GetCommand(ecGuessMisplacedIFDEF); + itmToolMakeResourceString.Command:=GetCommand(ecMakeResourceString); + itmToolDiff.Command:=GetCommand(ecDiff); + itmToolConvertDFMtoLFM.Command:=GetCommand(ecConvertDFM2LFM); + itmToolCheckLFM.Command:=GetCommand(ecCheckLFM); + itmToolConvertDelphiUnit.Command:=GetCommand(ecConvertDelphiUnit); + itmToolConvertDelphiProject.Command:=GetCommand(ecConvertDelphiProject); + itmToolBuildLazarus.Command:=GetCommand(ecBuildLazarus); + itmToolConfigureBuildLazarus.Command:=GetCommand(ecConfigBuildLazarus); + + // environment menu + itmEnvGeneralOptions.Command:=GetCommand(ecEnvironmentOptions); + itmEnvEditorOptions.Command:=GetCommand(ecEditorOptions); + itmEnvCodeTemplates.Command:=GetCommand(ecEditCodeTemplates); + itmEnvCodeToolsOptions.Command:=GetCommand(ecCodeToolsOptions); + itmEnvCodeToolsDefinesEditor.Command:=GetCommand(ecCodeToolsDefinesEd); + itmEnvRescanFPCSrcDir.Command:=GetCommand(ecRescanFPCSrcDir); + + // help menu + itmHelpAboutLazarus.Command:=GetCommand(ecAboutLazarus); + itmHelpOnlineHelp.Command:=GetCommand(ecOnlineHelp); + itmHelpConfigureHelp.Command:=GetCommand(ecConfigureHelp); + end; + {$ELSE} with MainIDEBar, EditorOpts.KeyMap do begin // file menu itmFileNewUnit.ShortCut:=CommandToShortCut(ecNewUnit); @@ -959,6 +1364,7 @@ begin itmHelpOnlineHelp.ShortCut:=CommandToShortCut(ecOnlineHelp); itmHelpConfigureHelp.ShortCut:=CommandToShortCut(ecConfigureHelp); end; + {$ENDIF} end; function TMainIDEBase.GetToolStatus: TIDEToolStatus; @@ -1308,7 +1714,7 @@ procedure TMainIDEBase.UpdateWindowsMenu; var WindowsList: TList; i: Integer; - CurMenuItem: TMenuItem; + CurMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF}; AForm: TForm; begin WindowsList:=TList.Create; @@ -1336,8 +1742,13 @@ begin if MainIDEBar.mnuWindows.Count>i then CurMenuItem:=MainIDEBar.mnuWindows.Items[i] else begin + {$IFDEF UseMenuIntf} + CurMenuItem:=RegisterIDEMenuCommand(MainIDEBar.mnuWindows.GetPath, + 'Window'+IntToStr(i),''); + {$ELSE} CurMenuItem:=TMenuItem.Create(MainIDEBar); MainIDEBar.mnuWindows.Add(CurMenuItem); + {$ENDIF} CurMenuItem.OnClick:=@mnuWindowsItemClick; end; CurMenuItem.Caption:=TCustomForm(WindowsList[i]).Caption; @@ -1349,25 +1760,33 @@ begin WindowsList.Free; end; -procedure TMainIDEBase.SetRecentSubMenu(ParentMenuItem: TMenuItem; +procedure TMainIDEBase.SetRecentSubMenu( + {$IFDEF UseMenuIntf}Section: TIDEMenuSection; + {$ELSE}Section: TMenuItem;{$ENDIF} FileList: TStringList; OnClickEvent: TNotifyEvent); -var i: integer; - AMenuItem: TMenuItem; +var + i: integer; + AMenuItem: {$IFDEF UseMenuIntf}TIDEMenuItem{$ELSE}TMenuItem{$ENDIF}; begin // create enough menuitems - while ParentMenuItem.CountFileList.Count do - ParentMenuItem.Items[ParentMenuItem.Count-1].Free; - ParentMenuItem.Enabled:=(ParentMenuItem.Count>0); + while Section.Count>FileList.Count do + Section.Items[Section.Count-1].Free; + Section.Enabled:=(Section.Count>0); // set captions and event for i:=0 to FileList.Count-1 do begin - AMenuItem:=ParentMenuItem.Items[i]; + AMenuItem:=Section.Items[i]; AMenuItem.Caption := FileList[i]; AMenuItem.OnClick := OnClickEvent; end; diff --git a/ide/mainintf.pas b/ide/mainintf.pas index f0a62db911..2e990eed3f 100644 --- a/ide/mainintf.pas +++ b/ide/mainintf.pas @@ -64,7 +64,7 @@ uses Controls, Graphics, ExtCtrls, Dialogs, FileUtil, Forms, CodeToolManager, CodeCache, AVL_Tree, SynEditKeyCmds, // IDE - ObjectInspector, + ObjectInspector, MenuIntf, LazConf, LazarusIDEStrConsts, MacroIntf, ProjectIntf, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, LazIDEIntf, @@ -202,7 +202,9 @@ type procedure UpdateWindowsMenu; virtual; abstract; procedure SaveEnvironment; virtual; abstract; - procedure SetRecentSubMenu(ParentMenuItem: TMenuItem; FileList: TStringList; + procedure SetRecentSubMenu({$IFDEF UseMenuIntf}Section: TIDEMenuSection; + {$ELSE}Section: TMenuItem;{$ENDIF} + FileList: TStringList; OnClickEvent: TNotifyEvent); virtual; abstract; function DoJumpToSourcePosition(const Filename: string; NewX, NewY, NewTopLine: integer; diff --git a/ideintf/idecommands.pas b/ideintf/idecommands.pas index 47a5db8840..42cfd98ec9 100644 --- a/ideintf/idecommands.pas +++ b/ideintf/idecommands.pas @@ -60,7 +60,7 @@ const {$ENDIF} type - TIDECommandKeys = class; + TIDECommand = class; TIDECommandCategory = class; { TIDECommandScope @@ -152,10 +152,10 @@ type end; - { TIDECommandKeys } + { TIDECommand } { class for storing the keys of a single command (shortcut-command relationship) } - TIDECommandKeys = class + TIDECommand = class private FCategory: TIDECommandCategory; FCommand: word; @@ -183,6 +183,11 @@ type property Category: TIDECommandCategory read FCategory write SetCategory; end; + TIDECommands = class + public + function FindIDECommand(ACommand:word): TIDECommand; virtual; abstract; + end; + const CleanIDEShortCut: TIDEShortCut = (Key1: VK_UNKNOWN; Shift1: []; Key2: VK_UNKNOWN; Shift2: []); @@ -215,6 +220,7 @@ function IDEShortCutToMenuShortCut(const IDEShortCut: TIDEShortCut): TShortCut; var // will be set by the IDE + IDECommandList: TIDECommands; IDECommandScopes: TIDECommandScopes = nil; var IDECmdScopeSrcEdit: TIDECommandScope; @@ -279,9 +285,9 @@ begin IDECommandScopes.Add(Result); end; -{ TIDECommandKeys } +{ TIDECommand } -function TIDECommandKeys.GetLocalizedName: string; +function TIDECommand.GetLocalizedName: string; begin if FLocalizedName<>'' then Result:=FLocalizedName @@ -289,13 +295,13 @@ begin Result:=Name; end; -procedure TIDECommandKeys.SetLocalizedName(const AValue: string); +procedure TIDECommand.SetLocalizedName(const AValue: string); begin if FLocalizedName=AValue then exit; FLocalizedName:=AValue; end; -procedure TIDECommandKeys.SetCategory(const AValue: TIDECommandCategory); +procedure TIDECommand.SetCategory(const AValue: TIDECommandCategory); begin if FCategory=AValue then exit; // unbind @@ -307,7 +313,7 @@ begin Category.Add(Self); end; -function TIDECommandKeys.AsShortCut: TShortCut; +function TIDECommand.AsShortCut: TShortCut; var CurKey: TIDEShortCut; begin @@ -326,7 +332,7 @@ begin Result:=Result+scAlt; end; -constructor TIDECommandKeys.Create(TheCategory: TIDECommandCategory; +constructor TIDECommand.Create(TheCategory: TIDECommandCategory; const TheName: String; TheCommand: word; const TheKeyA, TheKeyB: TIDEShortCut); begin @@ -339,17 +345,17 @@ begin Category:=TheCategory; end; -procedure TIDECommandKeys.ClearKeyA; +procedure TIDECommand.ClearKeyA; begin KeyA:=CleanIDEShortCut; end; -procedure TIDECommandKeys.ClearKeyB; +procedure TIDECommand.ClearKeyB; begin KeyB:=CleanIDEShortCut; end; -function TIDECommandKeys.GetCategoryAndName: string; +function TIDECommand.GetCategoryAndName: string; begin Result:='"'+GetLocalizedName+'"'; if Category<>nil then diff --git a/ideintf/menuintf.pas b/ideintf/menuintf.pas index 682d457e91..40c1e0df2c 100644 --- a/ideintf/menuintf.pas +++ b/ideintf/menuintf.pas @@ -64,6 +64,7 @@ type FSection: TIDEMenuSection; FSectionIndex: Integer; FSize: integer; + FTag: Integer; FVisible: Boolean; FLastVisibleActive: boolean; procedure MenuItemClick(Sender: TObject); @@ -110,6 +111,7 @@ type property MenuItemClass: TMenuItemClass read FMenuItemClass write FMenuItemClass; property SectionIndex: Integer read FSectionIndex; property AutoFreeMenuItem: boolean read FAutoFreeMenuItem write FAutoFreeMenuItem; + property Tag: Integer read FTag write FTag; end; TIDEMenuItemClass = class of TIDEMenuItem; @@ -201,7 +203,7 @@ type private FAutoCheck: boolean; FChecked: Boolean; - FCommand: TIDECommandKeys; + FCommand: TIDECommand; FDefault: Boolean; FGroupIndex: Byte; FRadioItem: Boolean; @@ -215,10 +217,10 @@ type procedure SetRadioItem(const AValue: Boolean); virtual; procedure SetRightJustify(const AValue: boolean); virtual; procedure SetShowAlwaysCheckable(const AValue: boolean); virtual; - procedure SetCommand(const AValue: TIDECommandKeys); virtual; + procedure SetCommand(const AValue: TIDECommand); virtual; procedure SetMenuItem(const AValue: TMenuItem); override; public - property Command: TIDECommandKeys read FCommand write SetCommand; + property Command: TIDECommand read FCommand write SetCommand; property AutoCheck: boolean read FAutoCheck write SetAutoCheck default False; property Checked: Boolean read FChecked write SetChecked default False; property Default: Boolean read FDefault write SetDefault default False; @@ -295,7 +297,7 @@ function RegisterIDESubMenu(const Path, Name, Caption: string; function RegisterIDEMenuCommand(const Path, Name, Caption: string; const OnClickMethod: TNotifyEvent = nil; const OnClickProc: TNotifyProcedure = nil; - const Command: TIDECommandKeys = nil + const Command: TIDECommand = nil ): TIDEMenuCommand; implementation @@ -344,7 +346,7 @@ end; function RegisterIDEMenuCommand(const Path, Name, Caption: string; const OnClickMethod: TNotifyEvent; const OnClickProc: TNotifyProcedure; - const Command: TIDECommandKeys): TIDEMenuCommand; + const Command: TIDECommand): TIDEMenuCommand; var Parent: TIDEMenuSection; begin @@ -364,8 +366,8 @@ end; procedure TIDEMenuItem.MenuItemClick(Sender: TObject); begin - if Assigned(OnClick) then OnClick(Sender); - if Assigned(OnClickProc) then OnClickProc(Sender); + if Assigned(OnClick) then OnClick(Self); + if Assigned(OnClickProc) then OnClickProc(Self); end; procedure TIDEMenuItem.MenuItemDestroy(Sender: TObject); @@ -1263,7 +1265,7 @@ begin MenuItem.ShowAlwaysCheckable:=ShowAlwaysCheckable; end; -procedure TIDEMenuCommand.SetCommand(const AValue: TIDECommandKeys); +procedure TIDEMenuCommand.SetCommand(const AValue: TIDECommand); begin if FCommand=AValue then exit; FCommand:=AValue;