diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 839d254d96..ed7a8d7e5f 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -230,10 +230,6 @@ resourcestring lisUnitPaths = 'Unit paths'; lisIncludePaths = 'Include paths'; lisSourcePaths = 'Source paths'; - lisMenuCompleteCode = 'Complete Code'; - lisMenuExtractProc = 'Extract procedure ...'; - lisMenuFindIdentifierRefs = 'Find Identifier References ...'; - lisMenuRenameIdentifier = 'Rename Identifier ...'; lisMenuInsertGPLNotice = 'GPL notice'; lisMenuInsertLGPLNotice = 'LGPL notice'; @@ -2283,11 +2279,6 @@ resourcestring uemMovePageLeftmost='Move page leftmost'; uemMovePageRightmost='Move page rightmost'; uemRefactor = 'Refactoring'; - uemCompleteCode = 'Complete Code'; - uemExtractProc = 'Extract Procedure'; - uemInvertAssignment = 'Invert Assignment'; - uemFindIdentifierReferences = 'Find Identifier References'; - uemRenameIdentifier = 'Rename Identifier'; uemEditorproperties='Editor properties'; ueNotImplCap='Not implemented yet'; ueNotImplText='If You can help us to implement this feature, mail to ' @@ -2306,8 +2297,6 @@ resourcestring +'system seems to use it.%sThat means non ASCII characters will probably ' +'be shown incorrect.%sYou can select another font in the editor options.'; lisUEDoNotSho = 'Do not show this message again.'; - lisCodeHelpShowEmptyMethods = 'Show empty methods'; - lisCodeHelpShowUnusedUnits = 'Show unused units'; uemHighlighter = 'Highlighter'; uemEncoding = 'Encoding'; uemLineEnding = 'Line ending'; @@ -2581,7 +2570,7 @@ resourcestring srkmecFindPrevious = 'Find previous'; srkmecFindInFiles = 'Find in files'; srkmecReplace = 'Replace text'; - lisKMFindIncremental = 'Find incremental'; + lisKMFindIncremental = 'Find incremental'; srkmecFindProcedureDefinition = 'Find procedure definiton'; srkmecFindProcedureMethod = 'Find procedure method'; srkmecGotoLineNumber = 'Go to line number'; @@ -2621,21 +2610,30 @@ resourcestring // codetools srkmecWordCompletion = 'Word completion'; srkmecCompletecode = 'Complete code'; + lisMenuCompleteCode = 'Complete Code'; srkmecShowCodeContext = 'Show code context'; srkmecExtractProc = 'Extract procedure'; + lisMenuExtractProc = 'Extract procedure ...'; srkmecFindIdentifierRefs = 'Find identifier references'; + lisMenuFindIdentifierRefs = 'Find Identifier References ...'; srkmecRenameIdentifier = 'Rename identifier'; + lisMenuRenameIdentifier = 'Rename Identifier ...'; srkmecInvertAssignment = 'Invert assignment'; + uemInvertAssignment = 'Invert Assignment'; srkmecSyntaxCheck = 'Syntax check'; srkmecGuessMisplacedIFDEF = 'Guess misplaced $IFDEF'; srkmecFindDeclaration = 'Find declaration'; srkmecFindBlockOtherEnd = 'Find block other end'; srkmecFindBlockStart = 'Find block start'; + srkmecAbstractMethods = 'Abstract methods ...'; srkmecShowAbstractMethods = 'Show abstract methods'; + srkmecEmptyMethods = 'Empty methods ...'; srkmecRemoveEmptyMethods = 'Remove empty methods'; + srkmecUnusedUnits = 'Unused units ...'; srkmecRemoveUnusedUnits = 'Remove unused units'; srkmecUseProjectUnit = 'Add unit to uses section'; srkmecFindOverloads = 'Find overloads'; + srkmecFindOverloadsCapt = 'Find overloads ...'; //Plugin template Edit srkmecSynPTmplEdNextCell = 'Next Cell'; diff --git a/ide/main.pp b/ide/main.pp index 142e79b1fc..eb101a3129 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -265,6 +265,10 @@ type procedure mnuRefactorEncloseBlockClicked(Sender: TObject); procedure mnuRefactorExtractProcClicked(Sender: TObject); procedure mnuRefactorInvertAssignmentClicked(Sender: TObject); + procedure mnuRefactorShowAbstractMethodsClicked(Sender: TObject); + procedure mnuRefactorShowEmptyMethodsClicked(Sender: TObject); + procedure mnuRefactorShowUnusedUnitsClicked(Sender: TObject); + procedure mnuRefactorFindOverloadsClicked(Sender: TObject); // view menu procedure mnuViewInspectorClicked(Sender: TObject); @@ -2447,6 +2451,13 @@ begin itmRefactorEncloseBlock.OnClick:=@mnuRefactorEncloseBlockClicked; itmRefactorExtractProc.OnClick:=@mnuRefactorExtractProcClicked; itmRefactorInvertAssignment.OnClick:=@mnuRefactorInvertAssignmentClicked; + // itmRefactorMenuAdvanced + itmRefactorShowAbstractMethods.OnClick:=@mnuRefactorShowAbstractMethodsClicked; + itmRefactorShowEmptyMethods.OnClick:=@mnuRefactorShowEmptyMethodsClicked; + itmRefactorShowUnusedUnits.OnClick:=@mnuRefactorShowUnusedUnitsClicked; + {$IFDEF EnableFindOverloads} + itmRefactorFindOverloads.OnClick:=@mnuRefactorFindOverloadsClicked; + {$ENDIF} end; end; @@ -3323,8 +3334,7 @@ begin OnProcessIDECommand(Sender,Command,Result); end; -function TMainIDE.OnSelectDirectory(const Title, InitialDir: string - ): string; +function TMainIDE.OnSelectDirectory(const Title, InitialDir: string): string; var Dialog: TSelectDirectoryDialog; DummyResult: Boolean; @@ -3808,12 +3818,14 @@ begin SelAvail:=(ASrcEdit<>nil) and (ASrcEdit.SelectionAvailable); SelEditable:=Editable and SelAvail; with MainIDEBar do begin - //itmRefactorMenuCodeTools: TIDEMenuSection; + //itmRefactorMenuCodeTools itmRefactorCompleteCode.Enabled:=Editable; itmRefactorRenameIdentifier.Enabled:=Editable; itmRefactorEncloseBlock.Enabled:=SelEditable; itmRefactorExtractProc.Enabled:=SelEditable; itmRefactorInvertAssignment.Enabled:=SelEditable; + //itmRefactorMenuAdvanced + //... end; end; @@ -17716,6 +17728,26 @@ begin DoSourceEditorCommand(ecInvertAssignment); end; +procedure TMainIDE.mnuRefactorShowAbstractMethodsClicked(Sender: TObject); +begin + DoSourceEditorCommand(ecShowAbstractMethods); +end; + +procedure TMainIDE.mnuRefactorShowEmptyMethodsClicked(Sender: TObject); +begin + DoSourceEditorCommand(ecRemoveEmptyMethods); +end; + +procedure TMainIDE.mnuRefactorShowUnusedUnitsClicked(Sender: TObject); +begin + DoSourceEditorCommand(ecRemoveUnusedUnits); +end; + +procedure TMainIDE.mnuRefactorFindOverloadsClicked(Sender: TObject); +begin + DoSourceEditorCommand(ecFindOverloads); +end; + procedure TMainIDE.DoCommand(ACommand: integer); var ActiveSourceEditor: TSourceEditor; diff --git a/ide/mainbar.pas b/ide/mainbar.pas index 0ae2330e2a..6df6b16843 100644 --- a/ide/mainbar.pas +++ b/ide/mainbar.pas @@ -187,12 +187,17 @@ type // refactor menu //mnuRefactor: TIDEMenuSection; - //itmEditMenuCodeTools: TIDEMenuSection; + //itmRefactorMenuCodeTools: TIDEMenuSection; itmRefactorCompleteCode: TIDEMenuCommand; itmRefactorRenameIdentifier: TIDEMenuCommand; itmRefactorEncloseBlock: TIDEMenuCommand; itmRefactorExtractProc: TIDEMenuCommand; itmRefactorInvertAssignment: TIDEMenuCommand; + //itmRefactorMenuAdvanced: TIDEMenuSection; + itmRefactorShowAbstractMethods: TIDEMenuCommand; + itmRefactorShowEmptyMethods: TIDEMenuCommand; + itmRefactorShowUnusedUnits: TIDEMenuCommand; + itmRefactorFindOverloads: TIDEMenuCommand; // view menu //mnuView: TIDEMenuSection; diff --git a/ide/mainbase.pas b/ide/mainbase.pas index 43ac443b22..bb1864b7bb 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -554,7 +554,16 @@ begin CreateMenuItem(ParentMI,itmRefactorRenameIdentifier,'itmRefactorRenameIdentifier',lisMenuRenameIdentifier); CreateMenuItem(ParentMI,itmRefactorEncloseBlock,'itmSourceEncloseBlock',lisMenuEncloseSelection); CreateMenuItem(ParentMI,itmRefactorExtractProc,'itmRefactorExtractProc',lisMenuExtractProc); - CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'InvertAssignment',uemInvertAssignment); + CreateMenuItem(ParentMI,itmRefactorInvertAssignment,'itmInvertAssignment',uemInvertAssignment); + + CreateMenuSeparatorSection(mnuRefactor,itmRefactorMenuAdvanced,'itmRefactorMenuAdvanced'); + ParentMI:=itmRefactorMenuAdvanced; + CreateMenuItem(ParentMI,itmRefactorShowAbstractMethods,'itmShowAbstractMethods',srkmecAbstractMethods); + CreateMenuItem(ParentMI,itmRefactorShowEmptyMethods,'itmShowEmptyMethods',srkmecEmptyMethods); + CreateMenuItem(ParentMI,itmRefactorShowUnusedUnits,'itmShowUnusedUnits',srkmecUnusedUnits); + {$IFDEF EnableFindOverloads} + CreateMenuItem(ParentMI,itmRefactorFindOverloads,'itmFindOverloads',srkmecFindOverloadsCapt); + {$ENDIF} end; end; @@ -932,6 +941,12 @@ begin itmRefactorEncloseBlock.Command:=GetCommand(ecSelectionEnclose); itmRefactorExtractProc.Command:=GetCommand(ecExtractProc); itmRefactorInvertAssignment.Command:=GetCommand(ecInvertAssignment); + itmRefactorShowAbstractMethods.Command:=GetCommand(ecShowAbstractMethods); + itmRefactorShowEmptyMethods.Command:=GetCommand(ecRemoveEmptyMethods); + itmRefactorShowUnusedUnits.Command:=GetCommand(ecRemoveUnusedUnits); + {$IFDEF EnableFindOverloads} + itmRefactorFindOverloads.Command:=GetCommand(ecFindOverloads); + {$ENDIF} // view menu itmViewInspector.Command:=GetCommand(ecToggleObjectInsp); diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index 26d1e2b9e2..21333c8a04 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -1448,26 +1448,26 @@ begin AParent:=SrcEditSubMenuRefactor; SrcEditMenuCompleteCode := RegisterIDEMenuCommand - (AParent,'CompleteCode', uemCompleteCode, nil, @ExecuteIdeMenuClick); + (AParent,'CompleteCode', lisMenuCompleteCode, nil, @ExecuteIdeMenuClick); SrcEditMenuEncloseSelection := RegisterIDEMenuCommand (AParent, 'EncloseSelection',lisKMEncloseSelection); SrcEditMenuRenameIdentifier := RegisterIDEMenuCommand - (AParent, 'RenameIdentifier',uemRenameIdentifier, nil, @ExecuteIdeMenuClick); + (AParent, 'RenameIdentifier',lisMenuRenameIdentifier, nil, @ExecuteIdeMenuClick); SrcEditMenuFindIdentifierReferences := RegisterIDEMenuCommand - (AParent, 'FindIdentifierReferences',uemFindIdentifierReferences, nil, @ExecuteIdeMenuClick); + (AParent, 'FindIdentifierReferences',lisMenuFindIdentifierRefs, nil, @ExecuteIdeMenuClick); SrcEditMenuExtractProc := RegisterIDEMenuCommand - (AParent, 'ExtractProc',uemExtractProc, nil, @ExecuteIdeMenuClick); + (AParent, 'ExtractProc',lisMenuExtractProc, nil, @ExecuteIdeMenuClick); SrcEditMenuInvertAssignment := RegisterIDEMenuCommand (AParent, 'InvertAssignment',uemInvertAssignment, nil, @ExecuteIdeMenuClick); SrcEditMenuShowAbstractMethods := RegisterIDEMenuCommand - (AParent, 'ShowAbstractMethods',srkmecShowAbstractMethods, nil, @ExecuteIdeMenuClick); + (AParent, 'ShowAbstractMethods',srkmecAbstractMethods, nil, @ExecuteIdeMenuClick); SrcEditMenuShowEmptyMethods := RegisterIDEMenuCommand - (AParent, 'ShowEmptyMethods', lisCodeHelpShowEmptyMethods, nil, @ExecuteIdeMenuClick); + (AParent, 'ShowEmptyMethods', srkmecEmptyMethods, nil, @ExecuteIdeMenuClick); SrcEditMenuShowUnusedUnits := RegisterIDEMenuCommand - (AParent, 'ShowUnusedUnits', lisCodeHelpShowUnusedUnits, nil, @ExecuteIdeMenuClick); + (AParent, 'ShowUnusedUnits', srkmecUnusedUnits, nil, @ExecuteIdeMenuClick); SrcEditMenuFindOverloads := RegisterIDEMenuCommand - (AParent, 'FindOverloads', srkmecFindOverloads, nil, @ExecuteIdeMenuClick); - {$IFNDEF EnableFindOverloads} + (AParent, 'FindOverloads', srkmecFindOverloadsCapt, nil, @ExecuteIdeMenuClick); + {$IFnDEF EnableFindOverloads} SrcEditMenuFindOverloads.Visible:=false; {$ENDIF} {%endregion} diff --git a/ideintf/menuintf.pas b/ideintf/menuintf.pas index 3784531ce6..5ec783b77d 100644 --- a/ideintf/menuintf.pas +++ b/ideintf/menuintf.pas @@ -319,6 +319,7 @@ var // refactor menu mnuRefactor: TIDEMenuSection; itmRefactorMenuCodeTools: TIDEMenuSection; + itmRefactorMenuAdvanced: TIDEMenuSection; // view menu mnuView: TIDEMenuSection;