mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-19 22:29:25 +02:00
ide: add option to jump directly to method body, if available. Issue #13245. Modified patch by Balázs Székely
git-svn-id: trunk@51422 -
This commit is contained in:
parent
c8a766f1e1
commit
61dcce50a6
@ -66,6 +66,7 @@ type
|
||||
FJumpCentered: boolean;
|
||||
FCursorBeyondEOL: boolean;
|
||||
FSkipForwardDeclarations: boolean;
|
||||
FJumpToMethodBody: boolean;
|
||||
|
||||
// Define Templates
|
||||
FGlobalDefineTemplates: TDefineTemplate;
|
||||
@ -152,7 +153,7 @@ type
|
||||
property CursorBeyondEOL: boolean
|
||||
read FCursorBeyondEOL write FCursorBeyondEOL;
|
||||
property SkipForwardDeclarations: boolean read FSkipForwardDeclarations write FSkipForwardDeclarations;
|
||||
|
||||
property JumpToMethodBody: boolean read FJumpToMethodBody write FJumpToMethodBody;
|
||||
// Define Templates
|
||||
property GlobalDefineTemplates: TDefineTemplate read FGlobalDefineTemplates;
|
||||
property DefinesEditMainSplitterTop: integer read FDefinesEditMainSplitterTop
|
||||
@ -425,7 +426,9 @@ begin
|
||||
'CodeToolsOptions/CursorBeyondEOL/Value',true);
|
||||
FSkipForwardDeclarations:=XMLConfig.GetValue(
|
||||
'CodeToolsOptions/SkipForwardDeclarations/Value',false);
|
||||
|
||||
FJumpToMethodBody:=XMLConfig.GetValue(
|
||||
'CodeToolsOptions/JumpToMethodBody/Value',false);
|
||||
|
||||
// Define templates
|
||||
LoadGlobalDefineTemplates;
|
||||
FDefinesEditMainSplitterTop:=XMLConfig.GetValue(
|
||||
@ -581,7 +584,8 @@ begin
|
||||
FCursorBeyondEOL,true);
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/SkipForwardDeclarations/Value',
|
||||
FSkipForwardDeclarations,false);
|
||||
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/JumpToMethodBody/Value',
|
||||
FJumpToMethodBody,false);
|
||||
// Define templates
|
||||
SaveGlobalDefineTemplates;
|
||||
XMLConfig.SetDeleteValue('CodeToolsOptions/DefinesEditMainSplitter/Top',
|
||||
@ -778,6 +782,7 @@ begin
|
||||
FAddInheritedCodeToOverrideMethod:=CodeToolsOpts.AddInheritedCodeToOverrideMethod;
|
||||
FCompleteProperties:=CodeToolsOpts.CompleteProperties;
|
||||
FSkipForwardDeclarations:=CodeToolsOpts.FSkipForwardDeclarations;
|
||||
FJumpToMethodBody:=CodeToolsOpts.FJumpToMethodBody;
|
||||
|
||||
// define templates
|
||||
ClearGlobalDefineTemplates;
|
||||
@ -925,6 +930,7 @@ begin
|
||||
and (AddInheritedCodeToOverrideMethod=CodeToolsOpts.AddInheritedCodeToOverrideMethod)
|
||||
and (CompleteProperties=CodeToolsOpts.CompleteProperties)
|
||||
and (FSkipForwardDeclarations=CodeToolsOpts.FSkipForwardDeclarations)
|
||||
and (FJumpToMethodBody=CodeToolsOpts.FJumpToMethodBody)
|
||||
|
||||
// define templates
|
||||
and (FGlobalDefineTemplates.IsEqual(
|
||||
|
@ -13,7 +13,7 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 127
|
||||
Height = 129
|
||||
Top = 6
|
||||
Width = 552
|
||||
Align = alTop
|
||||
@ -22,16 +22,16 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
Caption = 'JumpingGroupBox'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ClientHeight = 108
|
||||
ClientHeight = 109
|
||||
ClientWidth = 548
|
||||
TabOrder = 0
|
||||
object AdjustTopLineDueToCommentCheckBox: TCheckBox
|
||||
AnchorSideLeft.Control = JumpingGroupBox
|
||||
AnchorSideTop.Control = JumpingGroupBox
|
||||
Left = 6
|
||||
Height = 24
|
||||
Height = 19
|
||||
Top = 6
|
||||
Width = 297
|
||||
Width = 238
|
||||
Caption = 'AdjustTopLineDueToCommentCheckBox'
|
||||
TabOrder = 0
|
||||
end
|
||||
@ -40,9 +40,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = AdjustTopLineDueToCommentCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 30
|
||||
Width = 191
|
||||
Height = 19
|
||||
Top = 25
|
||||
Width = 149
|
||||
Caption = 'JumpCenteredCheckBox'
|
||||
TabOrder = 1
|
||||
end
|
||||
@ -51,9 +51,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = JumpCenteredCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 54
|
||||
Width = 213
|
||||
Height = 19
|
||||
Top = 44
|
||||
Width = 168
|
||||
Caption = 'CursorBeyondEOLCheckBox'
|
||||
TabOrder = 2
|
||||
end
|
||||
@ -62,17 +62,25 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = CursorBeyondEOLCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 78
|
||||
Width = 263
|
||||
Height = 19
|
||||
Top = 63
|
||||
Width = 202
|
||||
Caption = 'SkipForwardDeclarationsCheckBox'
|
||||
TabOrder = 3
|
||||
end
|
||||
object JumpToMethodBodyCheckBox: TCheckBox
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 84
|
||||
Width = 184
|
||||
Caption = 'JumpToMethodBodyCheckBox'
|
||||
TabOrder = 4
|
||||
end
|
||||
end
|
||||
object IndentationGroupBox: TGroupBox
|
||||
Left = 0
|
||||
Height = 154
|
||||
Top = 139
|
||||
Height = 151
|
||||
Top = 141
|
||||
Width = 552
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
@ -80,16 +88,16 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
Caption = 'IndentationGroupBox'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ClientHeight = 135
|
||||
ClientHeight = 131
|
||||
ClientWidth = 548
|
||||
TabOrder = 1
|
||||
object IndentFileLabel: TLabel
|
||||
AnchorSideLeft.Control = IndentationGroupBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 17
|
||||
Height = 15
|
||||
Top = 107
|
||||
Width = 104
|
||||
Width = 80
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'IndentFileLabel'
|
||||
ParentColor = False
|
||||
@ -99,9 +107,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = IndentOnPasteCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 71
|
||||
Width = 249
|
||||
Height = 19
|
||||
Top = 59
|
||||
Width = 193
|
||||
Caption = 'IndentContextSensitiveCheckBox'
|
||||
TabOrder = 2
|
||||
end
|
||||
@ -110,9 +118,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = GeneralAutoIndent
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 23
|
||||
Width = 221
|
||||
Height = 19
|
||||
Top = 21
|
||||
Width = 173
|
||||
Caption = 'IndentOnLineBreakCheckBox'
|
||||
OnChange = IndentOnLineBreakCheckBoxChange
|
||||
TabOrder = 0
|
||||
@ -122,9 +130,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Control = IndentOnLineBreakCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 24
|
||||
Top = 47
|
||||
Width = 192
|
||||
Height = 19
|
||||
Top = 40
|
||||
Width = 150
|
||||
Caption = 'IndentOnPasteCheckBox'
|
||||
OnChange = IndentOnPasteCheckBoxChange
|
||||
TabOrder = 1
|
||||
@ -132,9 +140,9 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
object GeneralAutoIndent: TLabel
|
||||
Cursor = crHandPoint
|
||||
Left = 6
|
||||
Height = 17
|
||||
Height = 15
|
||||
Top = 6
|
||||
Width = 128
|
||||
Width = 100
|
||||
Caption = 'GeneralAutoIndent'
|
||||
Font.Color = clBlue
|
||||
ParentColor = False
|
||||
@ -149,10 +157,10 @@ object CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = IndentationGroupBox
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 116
|
||||
Height = 27
|
||||
Left = 92
|
||||
Height = 23
|
||||
Top = 102
|
||||
Width = 426
|
||||
Width = 450
|
||||
FilterIndex = 0
|
||||
HideDirectories = False
|
||||
ButtonWidth = 50
|
||||
|
@ -45,6 +45,7 @@ type
|
||||
JumpCenteredCheckBox: TCheckBox;
|
||||
JumpingGroupBox: TGroupBox;
|
||||
IndentFileLabel: TLabel;
|
||||
JumpToMethodBodyCheckBox: TCheckBox;
|
||||
SkipForwardDeclarationsCheckBox: TCheckBox;
|
||||
procedure GeneralAutoIndentClick(Sender: TObject);
|
||||
procedure GeneralAutoIndentMouseEnter(Sender: TObject);
|
||||
@ -120,6 +121,7 @@ begin
|
||||
JumpCenteredCheckBox.Caption:=dlgcentercursorline;
|
||||
CursorBeyondEOLCheckBox.Caption:=dlgcursorbeyondeol;
|
||||
SkipForwardDeclarationsCheckBox.Caption:=dlgSkipForwardClassDeclarations;
|
||||
JumpToMethodBodyCheckBox.Caption := dlgJumpToMethodBody;
|
||||
|
||||
IndentationGroupBox.Caption:=lisIndentationForPascalSources;
|
||||
GeneralAutoIndent.Caption:=lisSetupDefaultIndentation;
|
||||
@ -142,6 +144,7 @@ begin
|
||||
JumpCenteredCheckBox.Checked := JumpCentered;
|
||||
CursorBeyondEOLCheckBox.Checked := CursorBeyondEOL;
|
||||
SkipForwardDeclarationsCheckBox.Checked := SkipForwardDeclarations;
|
||||
JumpToMethodBodyCheckBox.Checked := JumpToMethodBody;
|
||||
IndentOnLineBreakCheckBox.Checked:=IndentOnLineBreak;
|
||||
IndentOnPasteCheckBox.Checked:=IndentOnPaste;
|
||||
IndentFileEdit.Text:=IndentationFileName;
|
||||
@ -158,6 +161,7 @@ begin
|
||||
JumpCentered := JumpCenteredCheckBox.Checked;
|
||||
CursorBeyondEOL := CursorBeyondEOLCheckBox.Checked;
|
||||
SkipForwardDeclarations := SkipForwardDeclarationsCheckBox.Checked;
|
||||
JumpToMethodBody:=JumpToMethodBodyCheckBox.Checked;
|
||||
IndentOnLineBreak:=IndentOnLineBreakCheckBox.Checked;
|
||||
IndentOnPaste:=IndentOnPasteCheckBox.Checked;
|
||||
IndentationFileName:=IndentFileEdit.Text;
|
||||
|
@ -2094,6 +2094,7 @@ resourcestring
|
||||
dlgCenterCursorLine = 'Center cursor line';
|
||||
dlgCursorBeyondEOL = 'Cursor beyond EOL';
|
||||
dlgSkipForwardClassDeclarations = 'Skip forward class declarations';
|
||||
dlgJumpToMethodBody = 'Jump directly to method body';
|
||||
dlgInsertClassParts = 'Insert class parts';
|
||||
lisClassCompletion = 'Class Completion';
|
||||
dlgAlphabetically = 'Alphabetically';
|
||||
|
18
ide/main.pp
18
ide/main.pp
@ -9595,9 +9595,10 @@ procedure TMainIDE.DoFindDeclarationAtCaret(const LogCaretXY: TPoint);
|
||||
var
|
||||
ActiveSrcEdit: TSourceEditor;
|
||||
ActiveUnitInfo: TUnitInfo;
|
||||
NewSource: TCodeBuffer;
|
||||
NewX, NewY, NewTopLine: integer;
|
||||
NewSource, BodySource: TCodeBuffer;
|
||||
NewX, NewY, NewTopLine, BodyX, BodyY, BodyTopLine: integer;
|
||||
FindFlags: TFindSmartFlags;
|
||||
RevertableJump, JumpToBody: boolean;
|
||||
begin
|
||||
ActiveSrcEdit:=nil;
|
||||
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
|
||||
@ -9614,8 +9615,17 @@ begin
|
||||
LogCaretXY.X, LogCaretXY.Y, NewSource, NewX, NewY, NewTopLine, FindFlags )
|
||||
then begin
|
||||
//debugln(['TMainIDE.DoFindDeclarationAtCaret ',NewSource.Filename,' NewX=',Newx,',y=',NewY,' ',NewTopLine]);
|
||||
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||
if (CodeToolsOpts.JumpToMethodBody)
|
||||
and(CodeToolBoss.JumpToMethod(NewSource,
|
||||
NewX,NewY,BodySource,BodyX,BodyY,BodyTopLine,RevertableJump))
|
||||
then
|
||||
JumpToBody := DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||
BodySource, BodyX, BodyY, BodyTopLine, [jfAddJumpPoint, jfFocusEditor]) = mrOK
|
||||
else
|
||||
JumpToBody := False;
|
||||
if not JumpToBody then
|
||||
DoJumpToCodePosition(ActiveSrcEdit, ActiveUnitInfo,
|
||||
NewSource, NewX, NewY, NewTopLine, [jfAddJumpPoint, jfFocusEditor]);
|
||||
end else begin
|
||||
DoJumpToCodeToolBossError;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user