IDE: codetools: class completion: added option to select default method section

git-svn-id: trunk@53167 -
This commit is contained in:
mattias 2016-10-19 21:52:40 +00:00
parent feb1a73e6c
commit f237d61e01
4 changed files with 66 additions and 12 deletions

View File

@ -83,6 +83,7 @@ type
FForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy;
FKeepForwardProcOrder: boolean;
FMethodInsertPolicy: TMethodInsertPolicy;
FMethodDefaultSection: TInsertClassSection;
FKeyWordPolicy : TWordPolicy;
FIdentifierPolicy: TWordPolicy;
FUpdateAllMethodSignatures: boolean;
@ -189,6 +190,8 @@ type
read FClassImplementationComments write FClassImplementationComments;
property MethodInsertPolicy: TMethodInsertPolicy
read FMethodInsertPolicy write FMethodInsertPolicy;
property MethodDefaultSection: TInsertClassSection
read FMethodDefaultSection write FMethodDefaultSection;
property KeyWordPolicy : TWordPolicy
read FKeyWordPolicy write FKeyWordPolicy;
property IdentifierPolicy: TWordPolicy
@ -465,6 +468,9 @@ begin
FMethodInsertPolicy:=MethodInsertPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[mipClassOrder]));
FMethodDefaultSection:=InsertClassSectionNameToSection(XMLConfig.GetValue(
'CodeToolsOptions/MethodDefaultSection/Value',
InsertClassSectionNames[DefaultMethodDefaultSection]));
FKeyWordPolicy:=WordPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/KeyWordPolicy/Value',
WordPolicyNames[wpLowerCase]));
@ -623,6 +629,9 @@ begin
XMLConfig.SetDeleteValue('CodeToolsOptions/MethodInsertPolicy/Value',
MethodInsertPolicyNames[FMethodInsertPolicy],
MethodInsertPolicyNames[mipClassOrder]);
XMLConfig.SetDeleteValue('CodeToolsOptions/MethodDefaultSection/Value',
InsertClassSectionNames[FMethodDefaultSection],
InsertClassSectionNames[DefaultMethodDefaultSection]);
XMLConfig.SetDeleteValue('CodeToolsOptions/KeyWordPolicy/Value',
WordPolicyNames[FKeyWordPolicy],
WordPolicyNames[wpLowerCase]);
@ -791,6 +800,7 @@ begin
FClassHeaderComments:=CodeToolsOpts.ClassHeaderComments;
FClassImplementationComments:=CodeToolsOpts.ClassImplementationComments;
FMethodInsertPolicy:=CodeToolsOpts.FMethodInsertPolicy;
FMethodDefaultSection:=CodeToolsOpts.FMethodDefaultSection;
FKeyWordPolicy:=CodeToolsOpts.FKeyWordPolicy;
FIdentifierPolicy:=CodeToolsOpts.FIdentifierPolicy;
FDoNotSplitLineInFront:=CodeToolsOpts.FDoNotSplitLineInFront;
@ -852,6 +862,7 @@ begin
FClassHeaderComments:=true;
FClassImplementationComments:=true;
FMethodInsertPolicy:=mipClassOrder;
FMethodDefaultSection:=DefaultMethodDefaultSection;
FKeyWordPolicy:=wpLowerCase;
FIdentifierPolicy:=wpNone;
FDoNotSplitLineInFront:=DefaultDoNotSplitLineInFront;
@ -932,6 +943,7 @@ begin
and (FClassHeaderComments=CodeToolsOpts.ClassHeaderComments)
and (FClassImplementationComments=CodeToolsOpts.ClassImplementationComments)
and (FMethodInsertPolicy=CodeToolsOpts.FMethodInsertPolicy)
and (FMethodDefaultSection=CodeToolsOpts.FMethodDefaultSection)
and (FKeyWordPolicy=CodeToolsOpts.FKeyWordPolicy)
and (FIdentifierPolicy=CodeToolsOpts.FIdentifierPolicy)
and (FDoNotSplitLineInFront=CodeToolsOpts.FDoNotSplitLineInFront)
@ -1053,6 +1065,7 @@ begin
Beauty.ClassHeaderComments:=ClassHeaderComments;
Beauty.ClassImplementationComments:=ClassImplementationComments;
Beauty.MethodInsertPolicy:=MethodInsertPolicy;
Beauty.MethodDefaultSection:=MethodDefaultSection;
Beauty.KeyWordPolicy:=KeyWordPolicy;
Beauty.IdentifierPolicy:=IdentifierPolicy;
Beauty.SetupWordPolicyExceptions(WordPolicyExceptions);

View File

@ -15,7 +15,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 72
Top = 105
Width = 227
BorderSpacing.Left = 6
Caption = 'MixMethodsAndPropertiesCheckBox'
@ -27,7 +27,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 132
Top = 165
Width = 204
BorderSpacing.Around = 6
Caption = 'ClassHeaderCommentsCheckBox'
@ -42,7 +42,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 172
Top = 192
Top = 225
Width = 575
Anchors = [akTop, akLeft, akRight]
AutoSize = True
@ -218,7 +218,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 162
Top = 195
Width = 251
BorderSpacing.Around = 6
Caption = 'ClassImplementationCommentsCheckBox'
@ -230,7 +230,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 102
Top = 135
Width = 235
BorderSpacing.Around = 6
Caption = 'UpdateAllMethodSignaturesCheckBox'
@ -238,7 +238,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
end
object InsertPoliciesPanel: TPanel
Left = 0
Height = 72
Height = 105
Top = 0
Width = 575
Align = alTop
@ -250,14 +250,14 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
ChildSizing.VerticalSpacing = 6
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 72
ClientHeight = 105
ClientWidth = 575
TabOrder = 5
object ClassPartInsertPolicyLabel: TLabel
Left = 6
Height = 13
Top = 13
Width = 142
Width = 155
BorderSpacing.CellAlignVertical = ccaCenter
Caption = 'ClassPartInsertPolicyLabel'
ParentColor = False
@ -265,7 +265,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
ShowHint = True
end
object ClassPartInsertPolicyComboBox: TComboBox
Left = 154
Left = 167
Height = 27
Top = 6
Width = 100
@ -279,7 +279,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
Left = 6
Height = 13
Top = 46
Width = 142
Width = 155
BorderSpacing.CellAlignVertical = ccaCenter
Caption = 'MethodInsertPolicyLabel'
ParentColor = False
@ -287,7 +287,7 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
ShowHint = True
end
object MethodInsertPolicyComboBox: TComboBox
Left = 154
Left = 167
Height = 27
Top = 39
Width = 100
@ -297,5 +297,23 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
Style = csDropDownList
TabOrder = 1
end
object MethodDefaultSectionLabel: TLabel
Left = 6
Height = 13
Top = 79
Width = 155
BorderSpacing.CellAlignVertical = ccaCenter
Caption = 'MethodDefaultSectionLabel'
ParentColor = False
end
object MethodDefaultSectionComboBox: TComboBox
Left = 167
Height = 27
Top = 72
Width = 100
ItemHeight = 0
Style = csDropDownList
TabOrder = 2
end
end
end

View File

@ -36,6 +36,8 @@ type
ClassPartInsertPolicyComboBox: TComboBox;
ClassPartInsertPolicyLabel: TLabel;
InsertPoliciesPanel: TPanel;
MethodDefaultSectionComboBox: TComboBox;
MethodDefaultSectionLabel: TLabel;
MethodInsertPolicyComboBox: TComboBox;
MethodInsertPolicyLabel: TLabel;
SetPropertyVariableIsPrefixCheckBox: TCheckBox;
@ -79,6 +81,9 @@ end;
procedure TCodetoolsClassCompletionOptionsFrame.Setup(
ADialog: TAbstractOptionsEditorDialog);
var
s: String;
ics: TInsertClassSection;
begin
ClassPartInsertPolicyLabel.Caption:=dlgInsertClassParts;
ClassPartInsertPolicyLabel.Hint:=
@ -97,6 +102,15 @@ begin
dlgCDTLast+LineEnding+
dlgCDTClassOrder;
MethodDefaultSectionLabel.Caption:=lisDefaultSectionOfMethods;
MethodDefaultSectionLabel.Hint:=
lisDefaultClassVisibilitySectionOfNewMethodsForExampl;
MethodDefaultSectionComboBox.Hint:=MethodDefaultSectionLabel.Hint;
s:='';
for ics in TInsertClassSection do
s:=s+InsertClassSectionNames[ics]+LineEnding;
MethodDefaultSectionComboBox.Items.Text:=s;
MixMethodsAndPropertiesCheckBox.Caption:=dlgMixMethodsAndProperties;
UpdateAllMethodSignaturesCheckBox.Caption:=lisCTOUpdateAllMethodSignatures;
ClassHeaderCommentsCheckBox.Caption:=lisHeaderCommentForClass;
@ -144,6 +158,8 @@ begin
MethodInsertPolicyComboBox.ItemIndex:=2;
end;
MethodDefaultSectionComboBox.ItemIndex:=ord(MethodDefaultSection);
PropertyCompletionCheckBox.Checked := CompleteProperties;
PropertyReadIdentPrefixEdit.Text := PropertyReadIdentPrefix;
PropertyWriteIdentPrefixEdit.Text := PropertyWriteIdentPrefix;
@ -176,6 +192,9 @@ begin
2: MethodInsertPolicy := mipClassOrder;
end;
if MethodDefaultSectionComboBox.ItemIndex>=0 then
MethodDefaultSection:=TInsertClassSection(MethodDefaultSectionComboBox.ItemIndex);
CompleteProperties:=PropertyCompletionCheckBox.Checked;
PropertyReadIdentPrefix :=
ReadIdentifier(PropertyReadIdentPrefixEdit.Text,'Get');

View File

@ -2141,11 +2141,15 @@ resourcestring
lisFirst = 'First';
lisInFrontOfRelated = 'In front of related';
lisBehindRelated = 'Behind related';
dlgInsertMethods = 'Insert methods';
dlgInsertMethods = 'Insert method implementations';
lisNewMethodImplementationsAreInsertedBetweenExisting = 'New method '
+'implementations are inserted between existing methods of this class. '
+'Either alphabetically, or as last, or in declaration order.';
dlgCDTClassOrder = 'Class order';
lisDefaultSectionOfMethods = 'Default section of methods';
lisDefaultClassVisibilitySectionOfNewMethodsForExampl = 'Default class '
+'visibility section of new methods. For example code completion on OnShow'
+':=';
dlgKeywordPolicy = 'Keyword policy';
dlgCDTLower = 'lowercase';
dlgCDTUPPERCASE = 'UPPERCASE';