mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-05 03:57:23 +01:00
IDE: New JumpTo... commands and menu items. Remove the functionality from EditorToolbar. Issue #28199, patch from Ondrej Pokorny.
git-svn-id: trunk@49226 -
This commit is contained in:
parent
50fb4a0145
commit
c6b6503cf2
@ -2,6 +2,7 @@
|
||||
<CONFIG>
|
||||
<Package Version="4">
|
||||
<Name Value="editortoolbar"/>
|
||||
<Type Value="DesignTime"/>
|
||||
<AddToProjectUsesSection Value="True"/>
|
||||
<Author Value="Graeme Geldenhuys, Giuliano Colla"/>
|
||||
<CompilerOptions>
|
||||
@ -20,31 +21,26 @@
|
||||
<License Value="GPL
|
||||
"/>
|
||||
<Version Minor="8" Release="2"/>
|
||||
<Files Count="4">
|
||||
<Files Count="3">
|
||||
<Item1>
|
||||
<Filename Value="jumpto_impl.pas"/>
|
||||
<UnitName Value="jumpto_impl"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="editortoolbar_impl.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="editortoolbar_impl"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Filename Value="edttbconfigfrm.pas"/>
|
||||
<UnitName Value="EdtTbConfigFrm"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Filename Value="editortoolbar_str.pas"/>
|
||||
<UnitName Value="editortoolbar_str"/>
|
||||
</Item4>
|
||||
</Item3>
|
||||
</Files>
|
||||
<i18n>
|
||||
<EnableI18N Value="True"/>
|
||||
<OutDir Value="languages"/>
|
||||
<EnableI18NForLFM Value="True"/>
|
||||
</i18n>
|
||||
<Type Value="DesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="IDEIntf"/>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{ Этот файл был автоматически создан Lazarus. Не редактировать!
|
||||
Исходный код используется только для компиляции и установки пакета.
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit editortoolbar;
|
||||
@ -7,16 +7,15 @@ unit editortoolbar;
|
||||
interface
|
||||
|
||||
uses
|
||||
jumpto_impl, editortoolbar_impl, EdtTbConfigFrm, editortoolbar_str,
|
||||
LazarusPackageIntf;
|
||||
editortoolbar_impl, EdtTbConfigFrm, editortoolbar_str, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('editortoolbar_impl',@editortoolbar_impl.Register);
|
||||
RegisterUnit('editortoolbar_impl', @editortoolbar_impl.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('editortoolbar',@Register);
|
||||
RegisterPackage('editortoolbar', @Register);
|
||||
end.
|
||||
|
||||
@ -24,7 +24,6 @@ interface
|
||||
|
||||
uses
|
||||
Classes
|
||||
,jumpto_impl
|
||||
,Forms
|
||||
,ComCtrls
|
||||
,Controls
|
||||
@ -52,16 +51,13 @@ type
|
||||
|
||||
TEditorToolbar = class(TComponent)
|
||||
private
|
||||
FJumpHandler: TJumpHandler;
|
||||
FWindow: TSourceEditorWindowInterface;
|
||||
TB: TToolbar;
|
||||
PM: TPopupMenu;
|
||||
PPUP: TPopupMenu;
|
||||
CfgButton: TToolButton;
|
||||
FButtonList: TList;
|
||||
UpdateTimer: TTimer;
|
||||
procedure CreateEditorToolbar(AW: TForm; var ATB: TToolbar);
|
||||
function CreateJumpItem(AJumpType: TJumpType; O: TComponent): TMenuItem;
|
||||
function CreateProfileItem(ProfIndx: Integer; O: TComponent): TMenuItem;
|
||||
procedure DoConfigureToolbar(Sender: TObject);
|
||||
procedure UpdateBar(Sender: TObject);
|
||||
@ -121,7 +117,8 @@ uses
|
||||
,EdtTbConfigFrm
|
||||
,LazConfigStorage
|
||||
,BaseIDEIntf
|
||||
,LCLProc;
|
||||
,LCLProc
|
||||
,LCLType;
|
||||
|
||||
type
|
||||
|
||||
@ -241,14 +238,6 @@ begin
|
||||
ATB.PopupMenu := PPUP;
|
||||
end;
|
||||
|
||||
function TEditorToolbar.CreateJumpItem(AJumpType: TJumpType; O: TComponent): TMenuItem;
|
||||
begin
|
||||
Result := TMenuItem.Create(O);
|
||||
Result.Tag := Ord(AJumpType);
|
||||
Result.OnClick := @FJumpHandler.DoJump;
|
||||
Result.Caption := cJumpNames[AJumpType];
|
||||
end;
|
||||
|
||||
function TEditorToolbar.CreateProfileItem(ProfIndx: Integer; O: TComponent
|
||||
): TMenuItem;
|
||||
begin
|
||||
@ -310,7 +299,6 @@ end;
|
||||
|
||||
constructor TEditorToolbar.Create(AOwner: TComponent);
|
||||
var
|
||||
T: TJumpType;
|
||||
c: integer;
|
||||
cfg: TConfigStorage;
|
||||
begin
|
||||
@ -325,7 +313,6 @@ begin
|
||||
sLocalizedProfileNames[3] := rsHTML;
|
||||
sLocalizedProfileNames[4] := rsCustom;
|
||||
|
||||
FJumpHandler := TJumpHandler.Create(nil);
|
||||
FWindow := TSourceEditorWindowInterface(AOwner);
|
||||
|
||||
PPUP := TPopupMenu.Create(FWindow);
|
||||
@ -335,10 +322,6 @@ begin
|
||||
|
||||
CreateEditorToolBar(FWindow, TB);
|
||||
|
||||
PM := TPopupMenu.Create(FWindow);
|
||||
for T := Low(TJumpType) to High(TJumpType) do
|
||||
PM.Items.Add(CreateJumpItem(T, FWindow));
|
||||
|
||||
AddStaticItems;
|
||||
// Let's verify if it's a first start
|
||||
c:= 0; // Just in case...
|
||||
@ -361,7 +344,6 @@ end;
|
||||
destructor TEditorToolbar.Destroy;
|
||||
begin
|
||||
uEditorToolbarList.DelBar(Self);
|
||||
FJumpHandler.Free;
|
||||
FButtonList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -514,19 +496,6 @@ begin
|
||||
CfgButton.OnClick := @DoConfigureToolbar;
|
||||
PositionAtEnd(TB, CfgButton);
|
||||
AddDivider;
|
||||
|
||||
// JumpTo Button
|
||||
B := TToolbutton.Create(TB);
|
||||
B.Caption := rsJumpTo;
|
||||
B.Hint := B.Caption;
|
||||
B.ImageIndex := IDEImages.LoadImage(16, 'jumpto16');
|
||||
B.Style := tbsDropDown;
|
||||
B.OnClick := @FJumpHandler.DoJumpToImplementation;
|
||||
B.DropdownMenu := PM;
|
||||
PositionAtEnd(TB, B);
|
||||
|
||||
if TB.ButtonCount <> 0 then
|
||||
AddDivider;
|
||||
finally
|
||||
TB.EndUpdate;
|
||||
end;
|
||||
@ -579,7 +548,8 @@ procedure Register;
|
||||
var
|
||||
MenuIcon: string;
|
||||
begin
|
||||
if uEditorToolbarList = nil then begin
|
||||
if uEditorToolbarList = nil then
|
||||
begin
|
||||
TEditorToolbarList.Create;
|
||||
EditorMenuCommand:= RegisterIDEMenuCommand(itmViewSecondaryWindows,'EditorToolBar',
|
||||
rsEditorToolbar,nil,@ToggleToolbar);
|
||||
@ -589,7 +559,6 @@ begin
|
||||
//MenuIcon:= 'menu_editor_toolbar'; TODO!
|
||||
EditorMenuCommand.ImageIndex := IDEImages.LoadImage(16, MenuIcon);
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
|
||||
|
||||
@ -1,134 +0,0 @@
|
||||
{
|
||||
Copyright (C) 2007 Graeme Geldenhuys (graemeg@gmail.com)
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
}
|
||||
|
||||
unit jumpto_impl;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes
|
||||
,CodeToolManager
|
||||
,CodeTree
|
||||
;
|
||||
|
||||
|
||||
type
|
||||
TJumpType =
|
||||
( jmpIntf, jmpIntfUses, jmpImpl, jmpImplUses, jmpInit );
|
||||
|
||||
|
||||
const
|
||||
cJumpNames: array[TJumpType] of string =
|
||||
('Interface', 'Interface uses', 'Implementation', 'Implementation uses',
|
||||
'Initialization');
|
||||
|
||||
type
|
||||
TJumpHandler = class(TComponent)
|
||||
private
|
||||
function JumpToNode(Tool: TCodeTool; Node: TCodeTreeNode): Boolean;
|
||||
public
|
||||
procedure DoJump(Sender: TObject);
|
||||
procedure DoJumpToImplementation(Sender: TObject);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
SrcEditorIntf
|
||||
,LazIDEIntf
|
||||
,Controls
|
||||
,CodeCache
|
||||
,Dialogs
|
||||
,SysUtils
|
||||
,editortoolbar_str
|
||||
;
|
||||
|
||||
{ TJumpHandler }
|
||||
|
||||
function TJumpHandler.JumpToNode(Tool: TCodeTool; Node: TCodeTreeNode): Boolean;
|
||||
var
|
||||
NewTopLine: Integer;
|
||||
NewCodePos: TCodeXYPosition;
|
||||
SrcEditor: TSourceEditorInterface;
|
||||
begin
|
||||
NewTopLine := 0;
|
||||
NewCodePos := CleanCodeXYPosition;
|
||||
Result := Tool.CleanPosToCaretAndTopLine(Node.StartPos, NewCodePos,NewTopLine);
|
||||
if Result then
|
||||
Result := LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename
|
||||
,Point(NewCodePos.X,NewCodePos.Y), NewTopLine, -1,-1
|
||||
,[ofRegularFile,ofUseCache]) = mrOk;
|
||||
if Result then
|
||||
begin
|
||||
SrcEditor := SourceEditorManagerIntf.ActiveEditor;
|
||||
if Assigned(SrcEditor) then
|
||||
SrcEditor.EditorControl.SetFocus;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJumpHandler.DoJump(Sender: TObject);
|
||||
var
|
||||
SrcEditor: TSourceEditorInterface;
|
||||
CodeBuffer: TCodeBuffer;
|
||||
Node: TCodeTreeNode;
|
||||
Tool: TCodeTool;
|
||||
T: TJumpType;
|
||||
begin
|
||||
If (Sender <> nil) and (Sender is TComponent) then
|
||||
T := TJumpType(TComponent(Sender).Tag);
|
||||
|
||||
if not LazarusIDE.BeginCodeTools then
|
||||
Exit; //==>
|
||||
|
||||
SrcEditor := SourceEditorManagerIntf.ActiveEditor;
|
||||
if not Assigned(SrcEditor) then
|
||||
Exit; //==>
|
||||
|
||||
CodeBuffer := SrcEditor.CodeToolsBuffer as TCodeBuffer;
|
||||
if CodeToolBoss.Explore(CodeBuffer,Tool,false,false) then
|
||||
begin
|
||||
case T of
|
||||
jmpIntf : Node := Tool.FindInterfaceNode;
|
||||
jmpIntfUses : Node := Tool.FindMainUsesSection;
|
||||
jmpImpl : Node := Tool.FindImplementationNode;
|
||||
jmpImplUses : Node := Tool.FindImplementationUsesSection;
|
||||
jmpInit : Node := Tool.FindInitializationNode;
|
||||
end;
|
||||
if (Node <> nil) then
|
||||
JumpToNode(Tool, Node)
|
||||
else
|
||||
ShowMessage(Format(SErrCouldNotFind, [cJumpNames[T]]));
|
||||
end
|
||||
else
|
||||
LazarusIDE.DoJumpToCodeToolBossError;
|
||||
end;
|
||||
|
||||
procedure TJumpHandler.DoJumpToImplementation(Sender: TObject);
|
||||
begin
|
||||
if (Sender <> nil) and (Sender is TComponent) then
|
||||
TComponent(Sender).Tag := Ord(jmpImpl);
|
||||
DoJump(Sender);
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
@ -75,6 +75,11 @@ 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;
|
||||
|
||||
// edit selection
|
||||
ecSelectionUpperCase = ecFirstLazarus + 50;
|
||||
@ -1219,7 +1224,7 @@ begin
|
||||
end;
|
||||
|
||||
const
|
||||
IDEEditorCommandStrs: array[0..302] of TIdentMapEntry = (
|
||||
IDEEditorCommandStrs: array[0..307] of TIdentMapEntry = (
|
||||
// search
|
||||
(Value: ecFind; Name: 'ecFind'),
|
||||
(Value: ecFindAgain; Name: 'ecFindAgain'),
|
||||
@ -1247,6 +1252,11 @@ const
|
||||
(Value: ecFindBlockStart; Name: 'ecFindBlockStart'),
|
||||
(Value: ecOpenFileAtCursor; Name: 'ecOpenFileAtCursor'),
|
||||
(Value: ecGotoIncludeDirective; Name: 'ecGotoIncludeDirective'),
|
||||
(Value: ecJumpToInterface; Name: 'ecJumpToInterface'),
|
||||
(Value: ecJumpToInterfaceUses; Name: 'ecJumpToInterfaceUses'),
|
||||
(Value: ecJumpToImplementation; Name: 'ecJumpToImplementation'),
|
||||
(Value: ecJumpToImplementationUses; Name: 'ecJumpToImplementationUses'),
|
||||
(Value: ecJumpToInitialization; Name: 'ecJumpToInitialization'),
|
||||
|
||||
// edit selection
|
||||
(Value: ecSelectionUpperCase; Name: 'ecSelectionUpperCase'),
|
||||
|
||||
@ -303,6 +303,7 @@ var
|
||||
mnuSearch: TIDEMenuSection;
|
||||
itmSearchFindReplace: TIDEMenuSection;
|
||||
itmJumpings: TIDEMenuSection;
|
||||
itmJumpToSection: TIDEMenuSection;
|
||||
itmBookmarks: TIDEMenuSection;
|
||||
itmCodeToolSearches: TIDEMenuSection;
|
||||
|
||||
|
||||
@ -100,10 +100,10 @@ begin
|
||||
// register IDE shortcut and menu item
|
||||
Key := IDEShortCut(VK_UNKNOWN,[],VK_UNKNOWN,[]);
|
||||
Cat:=IDECommandList.FindCategoryByName(CommandCategoryCodeTools);
|
||||
CmdMyTool := RegisterIDECommand(Cat,'JumpToImplementation', 'Jump to implementation keyword', Key, nil, @JumpIDEToImplementationKeyword);
|
||||
CmdMyTool := RegisterIDECommand(Cat,'JumpToImplementationDemo', 'Jump to implementation keyword (demo)', Key, nil, @JumpIDEToImplementationKeyword);
|
||||
|
||||
RegisterIDEMenuCommand(itmCodeToolSearches,'JumpToImplementation',
|
||||
'Jump to implementation keyword',nil,@JumpIDEToImplementationKeyword, CmdMyTool);
|
||||
RegisterIDEMenuCommand(itmCodeToolSearches,'JumpToImplementationDemo',
|
||||
'Jump to implementation keyword (demo)',nil,@JumpIDEToImplementationKeyword, CmdMyTool);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -144,7 +144,6 @@ type
|
||||
Shift: TShiftState);
|
||||
procedure IdleTimer1Timer(Sender: TObject);
|
||||
procedure JumpToMenuItemClick(Sender: TObject);
|
||||
procedure JumpToImplementationMenuItemClick(Sender: TObject);
|
||||
procedure OnCloseIDE(Sender: TObject);
|
||||
procedure ShowSrcEditPosMenuItemClick(Sender: TObject);
|
||||
procedure MainNotebookPageChanged(Sender: TObject);
|
||||
@ -278,7 +277,6 @@ const
|
||||
var
|
||||
CodeExplorerView: TCodeExplorerView = nil;
|
||||
CEJumpToIDEMenuCommand: TIDEMenuCommand;
|
||||
CEJumpToImplementationIDEMenuCommand: TIDEMenuCommand;
|
||||
CEShowSrcEditPosIDEMenuCommand: TIDEMenuCommand;
|
||||
CERefreshIDEMenuCommand: TIDEMenuCommand;
|
||||
CERenameIDEMenuCommand: TIDEMenuCommand;
|
||||
@ -369,8 +367,6 @@ begin
|
||||
CodeExplorerMenuRoot:=RegisterIDEMenuRoot(CodeExplorerMenuRootName);
|
||||
Path:=CodeExplorerMenuRoot.Name;
|
||||
CEJumpToIDEMenuCommand:=RegisterIDEMenuCommand(Path, 'Jump to', lisMenuJumpTo);
|
||||
CEJumpToImplementationIDEMenuCommand:=RegisterIDEMenuCommand(Path,
|
||||
'Jump to implementation', lisMenuJumpToImplementation);
|
||||
CEShowSrcEditPosIDEMenuCommand:=RegisterIDEMenuCommand(Path, 'Show position of source editor',
|
||||
lisShowPositionOfSourceEditor);
|
||||
CERefreshIDEMenuCommand:=RegisterIDEMenuCommand(Path, 'Refresh', dlgUnitDepRefresh);
|
||||
@ -507,7 +503,6 @@ begin
|
||||
//CodeExplorerMenuRoot.Items.WriteDebugReport(' ');
|
||||
|
||||
CEJumpToIDEMenuCommand.OnClick:=@JumpToMenuItemClick;
|
||||
CEJumpToImplementationIDEMenuCommand.OnClick:=@JumpToImplementationMenuItemClick;
|
||||
CEShowSrcEditPosIDEMenuCommand.OnClick:=@ShowSrcEditPosMenuItemClick;
|
||||
CERefreshIDEMenuCommand.OnClick:=@RefreshMenuItemClick;
|
||||
CERenameIDEMenuCommand.OnClick:=@RenameMenuItemClick;
|
||||
@ -609,11 +604,6 @@ begin
|
||||
JumpToSelection(false);
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.JumpToImplementationMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
JumpToSelection(true);
|
||||
end;
|
||||
|
||||
procedure TCodeExplorerView.OnCloseIDE(Sender: TObject);
|
||||
begin
|
||||
CodeExplorerOptions.Save;
|
||||
@ -678,10 +668,8 @@ var
|
||||
CurItem: TTreeNode;
|
||||
CanRename: boolean;
|
||||
CurNode: TViewNodeData;
|
||||
HasImplementation: Boolean;
|
||||
begin
|
||||
CanRename:=false;
|
||||
HasImplementation:=false;
|
||||
CurTreeView:=GetCurrentTreeView;
|
||||
if CurTreeView<>nil then begin
|
||||
if tvoAllowMultiselect in CurTreeView.Options then
|
||||
@ -700,13 +688,9 @@ begin
|
||||
;
|
||||
end;
|
||||
end;
|
||||
if (CurNode.ImplementationNode<>nil)
|
||||
and (CurNode.ImplementationNode.StartPos>0) then
|
||||
HasImplementation:=true;
|
||||
end;
|
||||
end;
|
||||
CERenameIDEMenuCommand.Visible:=CanRename;
|
||||
CEJumpToImplementationIDEMenuCommand.Visible:=HasImplementation;
|
||||
//DebugLn(['TCodeExplorerView.TreePopupmenuPopup ',CERenameIDEMenuCommand.Visible]);
|
||||
end;
|
||||
|
||||
|
||||
@ -550,6 +550,11 @@ begin
|
||||
ecJumpToNextError : Result:= lisMenuJumpToNextError;
|
||||
ecJumpToPrevError : Result:= lisMenuJumpToPrevError;
|
||||
ecGotoIncludeDirective : Result:= srkmecGotoIncludeDirective;
|
||||
ecJumpToInterface : Result:= lisMenuJumpToInterface;
|
||||
ecJumpToInterfaceUses : Result:= lisMenuJumpToInterfaceUses;
|
||||
ecJumpToImplementation : Result:= lisMenuJumpToImplementation;
|
||||
ecJumpToImplementationUses: Result:= lisMenuJumpToImplementationUses;
|
||||
ecJumpToInitialization : Result:= lisMenuJumpToInitialization;
|
||||
ecOpenFileAtCursor : Result:= srkmecOpenFileAtCursor;
|
||||
ecProcedureList : Result:= lisPListProcedureList;
|
||||
|
||||
@ -2758,6 +2763,11 @@ 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 Interface', lisMenuJumpToInterface, ecJumpToInterface);
|
||||
AddDefault(C, 'Jump to Interface uses', lisMenuJumpToInterfaceUses, ecJumpToInterfaceUses);
|
||||
AddDefault(C, 'Jump to Implementation', lisMenuJumpToImplementation, ecJumpToImplementation);
|
||||
AddDefault(C, 'Jump to Implementation uses', lisMenuJumpToImplementationUses, ecJumpToImplementationUses);
|
||||
AddDefault(C, 'Jump to Initialization', lisMenuJumpToInitialization, ecJumpToInitialization);
|
||||
AddDefault(C, 'Show abstract methods', srkmecShowAbstractMethods, ecShowAbstractMethods);
|
||||
AddDefault(C, 'Remove empty methods', srkmecRemoveEmptyMethods, ecRemoveEmptyMethods);
|
||||
AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits, ecRemoveUnusedUnits);
|
||||
|
||||
@ -368,7 +368,11 @@ resourcestring
|
||||
lisMenuViewRestrictionBrowser = 'Restriction Browser';
|
||||
lisMenuViewComponents = '&Components';
|
||||
lisMenuJumpTo = 'Jump to';
|
||||
lisMenuJumpToInterface = 'Jump to Interface';
|
||||
lisMenuJumpToInterfaceUses = 'Jump to Interface uses';
|
||||
lisMenuJumpToImplementation = 'Jump to Implementation';
|
||||
lisMenuJumpToImplementationUses = 'Jump to Implementation uses';
|
||||
lisMenuJumpToInitialization = 'Jump to Initialization';
|
||||
lisMenuViewUnits = 'Units ...';
|
||||
lisMenuViewForms = 'Forms ...';
|
||||
lisMenuViewUnitDependencies = 'Unit Dependencies';
|
||||
@ -2051,6 +2055,11 @@ resourcestring
|
||||
dlgCDTStoredPostfix = 'Stored postfix';
|
||||
dlgCDTVariablePrefix = 'Variable prefix';
|
||||
dlgSetPropertyVariable = 'Set property Variable';
|
||||
dlgSetPropertyVariableHint = 'The parameter name for the default setter procedure.';
|
||||
dlgSetPropertyVariableIsPrefix = 'is prefix';
|
||||
dlgSetPropertyVariableIsPrefixHint = 'If checked, the "Set property Variable" is a prefix. Otherwise it is a fixed name.';
|
||||
dlgSetPropertyVariableUseConst = 'use const';
|
||||
dlgSetPropertyVariableUseConstHint = 'If checked, the setter parameter is marked with "const".';
|
||||
dlgMaxLineLength = 'Max line length:';
|
||||
dlgNotSplitLineFront = 'Do not split line in front of';
|
||||
dlgNotSplitLineAfter = 'Do not split line after';
|
||||
|
||||
@ -2161,6 +2161,11 @@ begin
|
||||
MainIDEBar.itmJumpHistory.OnClick := @SourceEditorManager.ViewJumpHistoryClicked;
|
||||
MainIDEBar.itmJumpToNextBookmark.OnClick := @SourceEditorManager.BookMarkNextClicked;
|
||||
MainIDEBar.itmJumpToPrevBookmark.OnClick := @SourceEditorManager.BookMarkPrevClicked;
|
||||
MainIDEBar.itmJumpToInterface.OnClick := @SourceEditorManager.JumpToInterfaceClicked;
|
||||
MainIDEBar.itmJumpToInterfaceUses.OnClick := @SourceEditorManager.JumpToInterfaceUsesClicked;
|
||||
MainIDEBar.itmJumpToImplementation.OnClick := @SourceEditorManager.JumpToImplementationClicked;
|
||||
MainIDEBar.itmJumpToImplementationUses.OnClick := @SourceEditorManager.JumpToImplementationUsesClicked;
|
||||
MainIDEBar.itmJumpToInitialization.OnClick := @SourceEditorManager.JumpToInitializationClicked;
|
||||
MainIDEBar.itmFindBlockStart.OnClick:=@mnuSearchFindBlockStart;
|
||||
MainIDEBar.itmFindBlockOtherEnd.OnClick:=@mnuSearchFindBlockOtherEnd;
|
||||
MainIDEBar.itmFindDeclaration.OnClick:=@mnuSearchFindDeclaration;
|
||||
|
||||
@ -131,6 +131,11 @@ type
|
||||
itmAddJumpPoint: TIDEMenuCommand;
|
||||
itmJumpToNextError: TIDEMenuCommand;
|
||||
itmJumpToPrevError: TIDEMenuCommand;
|
||||
itmJumpToInterface: TIDEMenuCommand;
|
||||
itmJumpToInterfaceUses: TIDEMenuCommand;
|
||||
itmJumpToImplementation: TIDEMenuCommand;
|
||||
itmJumpToImplementationUses: TIDEMenuCommand;
|
||||
itmJumpToInitialization: TIDEMenuCommand;
|
||||
//itmBookmarks: TIDEMenuSection;
|
||||
itmSetFreeBookmark: TIDEMenuCommand;
|
||||
itmJumpToNextBookmark: TIDEMenuCommand;
|
||||
|
||||
@ -693,6 +693,15 @@ begin
|
||||
CreateMenuItem(ParentMI,itmJumpToNextError,'itmJumpToNextError',lisMenuJumpToNextError);
|
||||
CreateMenuItem(ParentMI,itmJumpToPrevError,'itmJumpToPrevError',lisMenuJumpToPrevError);
|
||||
|
||||
CreateMenuSubSection(ParentMI,itmJumpToSection,'itmJumpToSection',lisMenuJumpTo);
|
||||
ParentMI:=itmJumpToSection;
|
||||
|
||||
CreateMenuItem(ParentMI,itmJumpToInterface,'itmJumpToInterface',lisMenuJumpToInterface, 'menu_jumpto_interface');
|
||||
CreateMenuItem(ParentMI,itmJumpToInterfaceUses,'itmJumpToInterfaceUses',lisMenuJumpToInterfaceUses, 'menu_jumpto_interfaceuses');
|
||||
CreateMenuItem(ParentMI,itmJumpToImplementation,'itmJumpToImplementation',lisMenuJumpToImplementation, 'menu_jumpto_implementation');
|
||||
CreateMenuItem(ParentMI,itmJumpToImplementationUses,'itmJumpToImplementationUses',lisMenuJumpToImplementationUses, 'menu_jumpto_implementationuses');
|
||||
CreateMenuItem(ParentMI,itmJumpToInitialization,'itmJumpToInitialization',lisMenuJumpToInitialization, 'menu_jumpto_initialization');
|
||||
|
||||
CreateMenuSeparatorSection(mnuSearch,itmBookmarks,'itmBookmarks');
|
||||
ParentMI:=itmBookmarks;
|
||||
|
||||
@ -1137,6 +1146,11 @@ begin
|
||||
itmSetFreeBookmark.Command:=GetCommand(ecSetFreeBookmark);
|
||||
itmJumpToNextBookmark.Command:=GetCommand(ecNextBookmark);
|
||||
itmJumpToPrevBookmark.Command:=GetCommand(ecPrevBookmark);
|
||||
itmJumpToInterface.Command:=GetCommand(ecJumpToInterface);
|
||||
itmJumpToInterfaceUses.Command:=GetCommand(ecJumpToInterfaceUses);
|
||||
itmJumpToImplementation.Command:=GetCommand(ecJumpToImplementation);
|
||||
itmJumpToImplementationUses.Command:=GetCommand(ecJumpToImplementationUses);
|
||||
itmJumpToInitialization.Command:=GetCommand(ecJumpToInitialization);
|
||||
itmFindBlockOtherEnd.Command:=GetCommand(ecFindBlockOtherEnd);
|
||||
itmFindBlockStart.Command:=GetCommand(ecFindBlockStart);
|
||||
itmFindDeclaration.Command:=GetCommand(ecFindDeclaration);
|
||||
|
||||
@ -8,11 +8,11 @@ object SourceNotebook: TSourceNotebook
|
||||
ClientHeight = 300
|
||||
ClientWidth = 400
|
||||
OnMouseUp = FormMouseUp
|
||||
LCLVersion = '1.3'
|
||||
LCLVersion = '1.5'
|
||||
object StatusBar: TStatusBar
|
||||
Left = 0
|
||||
Height = 21
|
||||
Top = 279
|
||||
Height = 20
|
||||
Top = 280
|
||||
Width = 400
|
||||
Panels = <
|
||||
item
|
||||
|
||||
@ -941,6 +941,11 @@ type
|
||||
read FOnCurrentCodeBufferChanged write FOnCurrentCodeBufferChanged;
|
||||
end;
|
||||
|
||||
TJumpToSectionType = (
|
||||
jmpInterface, jmpInterfaceUses,
|
||||
jmpImplementation, jmpImplementationUses,
|
||||
jmpInitialization);
|
||||
|
||||
{ TSourceEditorManager }
|
||||
(* Reintroduce all Methods with the final types *)
|
||||
|
||||
@ -1016,6 +1021,12 @@ type
|
||||
public
|
||||
procedure BookMarkNextClicked(Sender: TObject);
|
||||
procedure BookMarkPrevClicked(Sender: TObject);
|
||||
procedure JumpToSection(JumpType: TJumpToSectionType);
|
||||
procedure JumpToInterfaceClicked(Sender: TObject);
|
||||
procedure JumpToInterfaceUsesClicked(Sender: TObject);
|
||||
procedure JumpToImplementationClicked(Sender: TObject);
|
||||
procedure JumpToImplementationUsesClicked(Sender: TObject);
|
||||
procedure JumpToInitializationClicked(Sender: TObject);
|
||||
protected
|
||||
// macros
|
||||
function MacroFuncCol(const {%H-}s:string; const {%H-}Data: PtrInt;
|
||||
@ -9532,6 +9543,89 @@ begin
|
||||
if ActiveSourceWindow <> nil then HistoryJump(Sender,jhaForward);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToImplementationClicked(Sender: TObject);
|
||||
begin
|
||||
JumpToSection(jmpImplementation);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToImplementationUsesClicked(Sender: TObject);
|
||||
begin
|
||||
JumpToSection(jmpImplementationUses);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToInitializationClicked(Sender: TObject);
|
||||
begin
|
||||
JumpToSection(jmpInitialization);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToInterfaceClicked(Sender: TObject);
|
||||
begin
|
||||
JumpToSection(jmpInterface);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToInterfaceUsesClicked(Sender: TObject);
|
||||
begin
|
||||
JumpToSection(jmpInterfaceUses);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.JumpToSection(JumpType: TJumpToSectionType);
|
||||
const
|
||||
cJumpNames: array[TJumpToSectionType] of string = (
|
||||
'Interface', 'Interface uses', 'Implementation', 'Implementation uses', 'Initialization');
|
||||
var
|
||||
SrcEditor: TSourceEditorInterface;
|
||||
Node: TCodeTreeNode;
|
||||
Tool: TCodeTool;
|
||||
NewTopLine: Integer;
|
||||
NewCodePos: TCodeXYPosition;
|
||||
begin
|
||||
if not LazarusIDE.BeginCodeTools then Exit; //==>
|
||||
|
||||
SrcEditor := SourceEditorManagerIntf.ActiveEditor;
|
||||
if not Assigned(SrcEditor) then Exit; //==>
|
||||
|
||||
if CodeToolBoss.Explore(SrcEditor.CodeToolsBuffer as TCodeBuffer, Tool, false, false) then
|
||||
begin
|
||||
case JumpType of
|
||||
jmpInterface: Node := Tool.FindInterfaceNode;
|
||||
jmpInterfaceUses:
|
||||
begin
|
||||
Node := Tool.FindMainUsesSection;
|
||||
if Node = nil then//if the uses section is missing, jump to interface
|
||||
Node := Tool.FindInterfaceNode;
|
||||
end;
|
||||
jmpImplementation: Node := Tool.FindImplementationNode;
|
||||
jmpImplementationUses:
|
||||
begin
|
||||
Node := Tool.FindImplementationUsesSection;
|
||||
if Node = nil then//if the uses section is missing, jump to implementation
|
||||
Node := Tool.FindImplementationNode;
|
||||
end;
|
||||
jmpInitialization:
|
||||
begin
|
||||
Node := Tool.FindInitializationNode;
|
||||
if Node = nil then//if initialization is missing, jump to last end
|
||||
Node := Tool.FindRootNode(ctnEndPoint);
|
||||
end;
|
||||
end;
|
||||
if (Node <> nil) then
|
||||
begin
|
||||
NewTopLine := 0;
|
||||
NewCodePos := CleanCodeXYPosition;
|
||||
if Tool.CleanPosToCaretAndTopLine(Node.StartPos, NewCodePos, NewTopLine)
|
||||
and (LazarusIDE.DoOpenFileAndJumpToPos(NewCodePos.Code.Filename
|
||||
,Point(NewCodePos.X,NewCodePos.Y), NewTopLine, -1,-1
|
||||
,[ofRegularFile,ofUseCache]) = mrOk)
|
||||
then
|
||||
SrcEditor.EditorControl.SetFocus;
|
||||
end
|
||||
else
|
||||
ShowMessage(Format(lisCannotFind, [cJumpNames[JumpType]]));
|
||||
end
|
||||
else
|
||||
LazarusIDE.DoJumpToCodeToolBossError;
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.AddJumpPointClicked(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnAddJumpPoint) and (ActiveEditor <> nil) then
|
||||
|
||||
Binary file not shown.
@ -84,6 +84,11 @@ menu/menu_search_find_previous.png
|
||||
menu/menu_search_incremental.png
|
||||
menu/menu_search_jumpback.png
|
||||
menu/menu_search_jumpforward.png
|
||||
menu/menu_jumpto_interface.png
|
||||
menu/menu_jumpto_interfaceuses.png
|
||||
menu/menu_jumpto_implementation.png
|
||||
menu/menu_jumpto_implementationuses.png
|
||||
menu/menu_jumpto_initialization.png
|
||||
menu/menu_search_next_bookmark.png
|
||||
menu/menu_search_openfile_atcursor.png
|
||||
menu/menu_search_previous_bookmark.png
|
||||
|
||||
Loading…
Reference in New Issue
Block a user