IDE: added option to let find declaration skip forward declarations, bug #13814

git-svn-id: trunk@20197 -
This commit is contained in:
mattias 2009-05-25 09:49:35 +00:00
parent 5c4cc7cb58
commit 2b13ec396b
6 changed files with 71 additions and 33 deletions

View File

@ -56,6 +56,7 @@ type
FAdjustTopLineDueToComment: boolean;
FJumpCentered: boolean;
FCursorBeyondEOL: boolean;
FSkipForwardDeclarations: boolean;
// Define Templates
FGlobalDefineTemplates: TDefineTemplate;
@ -111,6 +112,7 @@ type
property JumpCentered: boolean read FJumpCentered write FJumpCentered;
property CursorBeyondEOL: boolean
read FCursorBeyondEOL write FCursorBeyondEOL;
property SkipForwardDeclarations: boolean read FSkipForwardDeclarations write FSkipForwardDeclarations;
// Define Templates
property GlobalDefineTemplates: TDefineTemplate read FGlobalDefineTemplates;
@ -311,6 +313,8 @@ begin
true);
FCursorBeyondEOL:=XMLConfig.GetValue(
'CodeToolsOptions/CursorBeyondEOL/Value',true);
FSkipForwardDeclarations:=XMLConfig.GetValue(
'CodeToolsOptions/SkipForwardDeclarations/Value',false);
// Define templates
LoadGlobalDefineTemplates;
@ -412,6 +416,8 @@ begin
FJumpCentered,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/CursorBeyondEOL/Value',
FCursorBeyondEOL,true);
XMLConfig.SetDeleteValue('CodeToolsOptions/SkipForwardDeclarations/Value',
FSkipForwardDeclarations,false);
// Define templates
SaveGlobalDefineTemplates;
@ -526,6 +532,7 @@ begin
FCursorBeyondEOL:=CodeToolsOpts.FCursorBeyondEOL;
FAddInheritedCodeToOverrideMethod:=CodeToolsOpts.AddInheritedCodeToOverrideMethod;
FCompleteProperties:=CodeToolsOpts.CompleteProperties;
FSkipForwardDeclarations:=CodeToolsOpts.FSkipForwardDeclarations;
// define templates
ClearGlobalDefineTemplates;
@ -628,6 +635,7 @@ begin
and (FCursorBeyondEOL=CodeToolsOpts.FCursorBeyondEOL)
and (AddInheritedCodeToOverrideMethod=CodeToolsOpts.AddInheritedCodeToOverrideMethod)
and (CompleteProperties=CodeToolsOpts.CompleteProperties)
and (FSkipForwardDeclarations=CodeToolsOpts.FSkipForwardDeclarations)
// define templates
and (FGlobalDefineTemplates.IsEqual(

View File

@ -1,7 +1,7 @@
inherited CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
Height = 199
Height = 231
Width = 552
ClientHeight = 195
ClientHeight = 227
ClientWidth = 548
TabOrder = 0
Visible = False
@ -21,6 +21,7 @@ inherited CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
Caption = 'SrcPathGroupBox'
ClientHeight = 39
ClientWidth = 544
Ctl3D = False
TabOrder = 0
object SrcPathEdit: TEdit
AnchorSideLeft.Control = SrcPathGroupBox
@ -43,15 +44,16 @@ inherited CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 121
Height = 155
Top = 64
Width = 548
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
Caption = 'JumpingGroupBox'
ClientHeight = 102
ClientHeight = 136
ClientWidth = 544
Ctl3D = False
TabOrder = 1
object AdjustTopLineDueToCommentCheckBox: TCheckBox
AnchorSideLeft.Control = JumpingGroupBox
@ -59,7 +61,7 @@ inherited CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
Left = 6
Height = 22
Top = 6
Width = 283
Width = 285
BorderSpacing.Around = 6
Caption = 'AdjustTopLineDueToCommentCheckBox'
TabOrder = 0
@ -90,5 +92,18 @@ inherited CodetoolsGeneralOptionsFrame: TCodetoolsGeneralOptionsFrame
Caption = 'CursorBeyondEOLCheckBox'
TabOrder = 2
end
object SkipForwardDeclarationsCheckBox: TCheckBox
AnchorSideLeft.Control = JumpingGroupBox
AnchorSideTop.Control = CursorBeyondEOLCheckBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 22
Top = 108
Width = 252
BorderSpacing.Top = 6
BorderSpacing.Around = 6
Caption = 'SkipForwardDeclarationsCheckBox'
TabOrder = 3
end
end
end

View File

@ -2,36 +2,42 @@
LazarusResources.Add('TCodetoolsGeneralOptionsFrame','FORMDATA',[
'TPF0'#241#29'TCodetoolsGeneralOptionsFrame'#28'CodetoolsGeneralOptionsFrame'
+#6'Height'#3#199#0#5'Width'#3'('#2#12'ClientHeight'#3#195#0#11'ClientWidth'#3
+#6'Height'#3#231#0#5'Width'#3'('#2#12'ClientHeight'#3#227#0#11'ClientWidth'#3
+'$'#2#8'TabOrder'#2#0#7'Visible'#8#10'DesignLeft'#3#176#0#9'DesignTop'#3#232
+#0#0#242#2#0#9'TGroupBox'#15'SrcPathGroupBox'#22'AnchorSideLeft.Control'#7#5
+'Owner'#21'AnchorSideTop.Control'#7#5'Owner'#23'AnchorSideRight.Control'#7#5
+'Owner'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#2':'#3
+'Top'#2#0#5'Width'#3'$'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'Au'
+'toSize'#9#7'Caption'#6#15'SrcPathGroupBox'#12'ClientHeight'#2''''#11'Client'
+'Width'#3' '#2#8'TabOrder'#2#0#0#5'TEdit'#11'SrcPathEdit'#22'AnchorSideLeft.'
+'Control'#7#15'SrcPathGroupBox'#23'AnchorSideRight.Control'#7#15'SrcPathGrou'
+'pBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#27#3
+'Top'#2#6#5'Width'#3#20#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#20'B'
+'orderSpacing.Around'#2#6#8'TabOrder'#2#0#4'Text'#6#11'SrcPathEdit'#0#0#0#242
+#2#1#9'TGroupBox'#15'JumpingGroupBox'#22'AnchorSideLeft.Control'#7#5'Owner'
+#21'AnchorSideTop.Control'#7#15'SrcPathGroupBox'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideRight.Side'#7
+#9'asrBottom'#4'Left'#2#0#6'Height'#2'y'#3'Top'#2'@'#5'Width'#3'$'#2#7'Ancho'
+'rs'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'BorderSpacing.Top'#2
+#6#7'Caption'#6#15'JumpingGroupBox'#12'ClientHeight'#2'f'#11'ClientWidth'#3
+' '#2#8'TabOrder'#2#1#0#9'TCheckBox!AdjustTopLineDueToCommentCheckBox'#22'An'
+'chorSideLeft.Control'#7#15'JumpingGroupBox'#21'AnchorSideTop.Control'#7#15
+'JumpingGroupBox'#4'Left'#2#6#6'Height'#2#22#3'Top'#2#6#5'Width'#3#27#1#20'B'
+'orderSpacing.Around'#2#6#7'Caption'#6'!AdjustTopLineDueToCommentCheckBox'#8
+'TabOrder'#2#0#0#0#9'TCheckBox'#20'JumpCenteredCheckBox'#22'AnchorSideLeft.C'
+'ontrol'#7#15'JumpingGroupBox'#21'AnchorSideTop.Control'#7'!AdjustTopLineDue'
+'ToCommentCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Heig'
+'ht'#2#22#3'Top'#2'('#5'Width'#3#181#0#17'BorderSpacing.Top'#2#6#20'BorderSp'
+'acing.Around'#2#6#7'Caption'#6#20'JumpCenteredCheckBox'#8'TabOrder'#2#1#0#0
+#9'TCheckBox'#23'CursorBeyondEOLCheckBox'#22'AnchorSideLeft.Control'#7#15'Ju'
+'mpingGroupBox'#21'AnchorSideTop.Control'#7#20'JumpCenteredCheckBox'#18'Anch'
+'orSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'J'#5'Wid'
+'th'#3#205#0#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Around'#2#6#7'Captio'
+'n'#6#23'CursorBeyondEOLCheckBox'#8'TabOrder'#2#2#0#0#0#0
+'Width'#3' '#2#5'Ctl3D'#8#8'TabOrder'#2#0#0#5'TEdit'#11'SrcPathEdit'#22'Anch'
+'orSideLeft.Control'#7#15'SrcPathGroupBox'#23'AnchorSideRight.Control'#7#15
+'SrcPathGroupBox'#20'AnchorSideRight.Side'#7#9'asrBottom'#4'Left'#2#6#6'Heig'
+'ht'#2#27#3'Top'#2#6#5'Width'#3#20#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRi'
+'ght'#0#20'BorderSpacing.Around'#2#6#8'TabOrder'#2#0#4'Text'#6#11'SrcPathEdi'
+'t'#0#0#0#242#2#1#9'TGroupBox'#15'JumpingGroupBox'#22'AnchorSideLeft.Control'
+#7#5'Owner'#21'AnchorSideTop.Control'#7#15'SrcPathGroupBox'#18'AnchorSideTop'
+'.Side'#7#9'asrBottom'#23'AnchorSideRight.Control'#7#5'Owner'#20'AnchorSideR'
+'ight.Side'#7#9'asrBottom'#4'Left'#2#0#6'Height'#3#155#0#3'Top'#2'@'#5'Width'
+#3'$'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#8'AutoSize'#9#17'Borde'
+'rSpacing.Top'#2#6#7'Caption'#6#15'JumpingGroupBox'#12'ClientHeight'#3#136#0
+#11'ClientWidth'#3' '#2#5'Ctl3D'#8#8'TabOrder'#2#1#0#9'TCheckBox!AdjustTopLi'
+'neDueToCommentCheckBox'#22'AnchorSideLeft.Control'#7#15'JumpingGroupBox'#21
+'AnchorSideTop.Control'#7#15'JumpingGroupBox'#4'Left'#2#6#6'Height'#2#22#3'T'
+'op'#2#6#5'Width'#3#29#1#20'BorderSpacing.Around'#2#6#7'Caption'#6'!AdjustTo'
+'pLineDueToCommentCheckBox'#8'TabOrder'#2#0#0#0#9'TCheckBox'#20'JumpCentered'
+'CheckBox'#22'AnchorSideLeft.Control'#7#15'JumpingGroupBox'#21'AnchorSideTop'
+'.Control'#7'!AdjustTopLineDueToCommentCheckBox'#18'AnchorSideTop.Side'#7#9
+'asrBottom'#4'Left'#2#6#6'Height'#2#22#3'Top'#2'('#5'Width'#3#181#0#17'Borde'
+'rSpacing.Top'#2#6#20'BorderSpacing.Around'#2#6#7'Caption'#6#20'JumpCentered'
+'CheckBox'#8'TabOrder'#2#1#0#0#9'TCheckBox'#23'CursorBeyondEOLCheckBox'#22'A'
+'nchorSideLeft.Control'#7#15'JumpingGroupBox'#21'AnchorSideTop.Control'#7#20
+'JumpCenteredCheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'H'
+'eight'#2#22#3'Top'#2'J'#5'Width'#3#205#0#17'BorderSpacing.Top'#2#6#20'Borde'
+'rSpacing.Around'#2#6#7'Caption'#6#23'CursorBeyondEOLCheckBox'#8'TabOrder'#2
+#2#0#0#9'TCheckBox'#31'SkipForwardDeclarationsCheckBox'#22'AnchorSideLeft.Co'
+'ntrol'#7#15'JumpingGroupBox'#21'AnchorSideTop.Control'#7#23'CursorBeyondEOL'
+'CheckBox'#18'AnchorSideTop.Side'#7#9'asrBottom'#4'Left'#2#6#6'Height'#2#22#3
+'Top'#2'l'#5'Width'#3#252#0#17'BorderSpacing.Top'#2#6#20'BorderSpacing.Aroun'
+'d'#2#6#7'Caption'#6#31'SkipForwardDeclarationsCheckBox'#8'TabOrder'#2#3#0#0
+#0#0
]);

View File

@ -37,6 +37,7 @@ type
CursorBeyondEOLCheckBox: TCheckBox;
JumpCenteredCheckBox: TCheckBox;
JumpingGroupBox: TGroupBox;
SkipForwardDeclarationsCheckBox: TCheckBox;
SrcPathEdit: TEdit;
SrcPathGroupBox: TGroupBox;
private
@ -74,6 +75,8 @@ begin
with CursorBeyondEOLCheckBox do
Caption:=dlgcursorbeyondeol;
SkipForwardDeclarationsCheckBox.Caption:=dlgSkipForwardDeclarations;
end;
procedure TCodetoolsGeneralOptionsFrame.ReadSettings(
@ -85,6 +88,7 @@ begin
AdjustTopLineDueToCommentCheckBox.Checked := AdjustTopLineDueToComment;
JumpCenteredCheckBox.Checked := JumpCentered;
CursorBeyondEOLCheckBox.Checked := CursorBeyondEOL;
SkipForwardDeclarationsCheckBox.Checked := SkipForwardDeclarations;
end;
end;
@ -97,6 +101,7 @@ begin
AdjustTopLineDueToComment := AdjustTopLineDueToCommentCheckBox.Checked;
JumpCentered := JumpCenteredCheckBox.Checked;
CursorBeyondEOL := CursorBeyondEOLCheckBox.Checked;
SkipForwardDeclarations := SkipForwardDeclarationsCheckBox.Checked;
end;
end;

View File

@ -1314,6 +1314,7 @@ resourcestring
dlgAdjustTopLine = 'Adjust top line due to comment in front';
dlgCenterCursorLine = 'Center Cursor Line';
dlgCursorBeyondEOL = 'Cursor beyond EOL';
dlgSkipForwardDeclarations = 'Skip forward declarations';
dlgClassInsertPolicy = 'Class part insert policy';
lisClassCompletion = 'Class Completion';
dlgAlphabetically = 'Alphabetically';

View File

@ -12598,6 +12598,7 @@ var
ActiveUnitInfo: TUnitInfo;
NewSource: TCodeBuffer;
NewX, NewY, NewTopLine: integer;
FindFlags: TFindSmartFlags;
begin
if not BeginCodeTool(ActiveSrcEdit,ActiveUnitInfo,[]) then exit;
{$IFDEF IDE_DEBUG}
@ -12606,10 +12607,12 @@ begin
{$ENDIF}
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TMainIDE.DoFindDeclarationAtCaret A');{$ENDIF}
//DebugLn(['TMainIDE.DoFindDeclarationAtCaret LogCaretXY=',dbgs(LogCaretXY),' SynEdit.Log=',dbgs(ActiveSrcEdit.EditorComponent.LogicalCaretXY),' SynEdit.Caret=',dbgs(ActiveSrcEdit.EditorComponent.CaretXY)]);
FindFlags := DefaultFindSmartFlags;
if CodeToolsOpts.SkipForwardDeclarations then
Include(FindFlags, fsfSkipClassForward);
if CodeToolBoss.FindDeclaration(ActiveUnitInfo.Source,
LogCaretXY.X,LogCaretXY.Y,
NewSource,NewX,NewY,NewTopLine,DefaultFindSmartFlags
//+[fsfSkipClassForward]
NewSource,NewX,NewY,NewTopLine,FindFlags
)
then begin
//debugln(['TMainIDE.DoFindDeclarationAtCaret ',NewSource.Filename,' NewX=',Newx,',y=',NewY,' ',NewTopLine]);