diff --git a/components/codetools/codecompletiontool.pas b/components/codetools/codecompletiontool.pas index b8d8849897..98d9b00c35 100644 --- a/components/codetools/codecompletiontool.pas +++ b/components/codetools/codecompletiontool.pas @@ -138,6 +138,8 @@ type FCompleteProperties: boolean; FirstInsert: TCodeTreeNodeExtension; // list of insert requests FSetPropertyVariablename: string; + FSetPropertyVariableIsPrefix: Boolean; + FSetPropertyVariableUseConst: Boolean; FJumpToProcName: string; NewClassSectionIndent: array[TPascalClassSection] of integer; NewClassSectionInsertPos: array[TPascalClassSection] of integer; @@ -145,7 +147,9 @@ type fNewMainUsesSectionUnits: TAVLTree; // tree of AnsiString procedure AddNewPropertyAccessMethodsToClassProcs(ClassProcs: TAVLTree; const TheClassName: string); + procedure SetSetPropertyVariableIsPrefix(aValue: Boolean); procedure SetSetPropertyVariablename(AValue: string); + procedure SetSetPropertyVariableUseConst(aValue: Boolean); function UpdateProcBodySignature(ProcBodyNodes: TAVLTree; const BodyNodeExt: TCodeTreeNodeExtension; ProcAttrCopyDefToBody: TProcHeadAttributes; var ProcsCopied: boolean; @@ -381,6 +385,10 @@ type // Options property SetPropertyVariablename: string read FSetPropertyVariablename write SetSetPropertyVariablename; + property SetPropertyVariableIsPrefix: Boolean + read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix; + property SetPropertyVariableUseConst: Boolean + read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst; property CompleteProperties: boolean read FCompleteProperties write FCompleteProperties; property AddInheritedCodeToOverrideMethod: boolean @@ -473,12 +481,26 @@ begin FSourceChangeCache.MainScanner:=Scanner; end; +procedure TCodeCompletionCodeTool.SetSetPropertyVariableIsPrefix(aValue: Boolean + ); +begin + if FSetPropertyVariableIsPrefix = aValue then Exit; + FSetPropertyVariableIsPrefix := aValue; +end; + procedure TCodeCompletionCodeTool.SetSetPropertyVariablename(AValue: string); begin if FSetPropertyVariablename=aValue then Exit; FSetPropertyVariablename:=aValue; end; +procedure TCodeCompletionCodeTool.SetSetPropertyVariableUseConst(aValue: Boolean + ); +begin + if FSetPropertyVariableUseConst = aValue then Exit; + FSetPropertyVariableUseConst := aValue; +end; + function TCodeCompletionCodeTool.OnTopLvlIdentifierFound( Params: TFindDeclarationParams; const FoundContext: TFindContext ): TIdentifierFoundResult; @@ -1410,6 +1432,8 @@ begin inherited CalcMemSize(Stats); Stats.Add('TCodeCompletionCodeTool', MemSizeString(FSetPropertyVariablename) + +PtrUInt(SizeOf(FSetPropertyVariableIsPrefix)) + +PtrUInt(SizeOf(FSetPropertyVariableUseConst)) +MemSizeString(FJumpToProcName) +length(NewClassSectionIndent)*SizeOf(integer) +length(NewClassSectionInsertPos)*SizeOf(integer) @@ -6761,7 +6785,7 @@ var end; var - CleanAccessFunc, CleanParamList, ParamList, PropType, VariableName: string; + CleanAccessFunc, CleanParamList, ParamList, PropName, PropType, VariableName: string; IsClassProp: boolean; InsertPos: integer; BeautifyCodeOpts: TBeautifyCodeOptions; @@ -6788,6 +6812,10 @@ var end; ReadNextAtom; // read name Parts[ppName]:=CurPos; + PropName := copy(Src,Parts[ppName].StartPos, + Parts[ppName].EndPos-Parts[ppName].StartPos); + if (PropName <> '') and (PropName[1] = '&') then//property name starts with '&' + Delete(PropName, 1, 1); ReadNextAtom; end; @@ -6966,13 +6994,10 @@ var or (CodeCompleteClassNode.Desc in AllClassInterfaces) then begin // create the default read identifier for a function - AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos, - Parts[ppName].EndPos-Parts[ppName].StartPos); + AccessParam:=AccessParamPrefix+PropName; end else begin // create the default read identifier for a variable - AccessParam:=BeautifyCodeOpts.PrivateVariablePrefix - +copy(Src,Parts[ppName].StartPos, - Parts[ppName].EndPos-Parts[ppName].StartPos); + AccessParam:=BeautifyCodeOpts.PrivateVariablePrefix+PropName; end; end; @@ -7095,6 +7120,7 @@ var AccessParamPrefix: String; AccessParam: String; AccessFunc: String; + AccessVariableName, AccessVariableNameParam: String; begin // check write specifier if not PartIsAtom[ppWrite] then exit; @@ -7108,8 +7134,7 @@ var AccessParam:=copy(Src,Parts[ppWrite].StartPos, Parts[ppWrite].EndPos-Parts[ppWrite].StartPos) else - AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos, - Parts[ppName].EndPos-Parts[ppName].StartPos); + AccessParam:=AccessParamPrefix+PropName; // complete property definition for write specifier if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin @@ -7176,6 +7201,13 @@ var // add insert demand for function // build function code ProcBody:=''; + AccessVariableName := SetPropertyVariablename; + if SetPropertyVariableIsPrefix then + AccessVariableName := AccessVariableName+PropName; + if SetPropertyVariableUseConst then + AccessVariableNameParam := 'const '+AccessVariableName + else + AccessVariableNameParam := AccessVariableName; if (Parts[ppParamList].StartPos>0) then begin MoveCursorToCleanPos(Parts[ppParamList].StartPos); ReadNextAtom; @@ -7189,20 +7221,20 @@ var if (Parts[ppIndexWord].StartPos<1) then begin // param list, no index AccessFunc:='procedure '+AccessParam - +'('+ParamList+';'+SetPropertyVariablename+':' + +'('+ParamList+';'+AccessVariableNameParam+':' +PropType+');'; end else begin // index + param list AccessFunc:='procedure '+AccessParam +'(AIndex:'+IndexType+';'+ParamList+';' - +SetPropertyVariablename+':'+PropType+');'; + +AccessVariableNameParam+':'+PropType+');'; end; end else begin if (Parts[ppIndexWord].StartPos<1) then begin // no param list, no index AccessFunc:= 'procedure '+AccessParam - +'('+SetPropertyVariablename+':'+PropType+');'; + +'('+AccessVariableNameParam+':'+PropType+');'; if VariableName<>'' then begin { read spec is a variable -> add simple assign code to body For example: @@ -7230,14 +7262,14 @@ var ProcBody:= 'procedure ' +ExtractClassName(PropNode.Parent.Parent,false)+'.'+AccessParam - +'('+SetPropertyVariablename+':'+PropType+');' + +'('+AccessVariableNameParam+':'+PropType+');' +BeautifyCodeOpts.LineEnd +'begin'+BeautifyCodeOpts.LineEnd +BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent) - +'if '+VariableName+'='+SetPropertyVariablename+' then Exit;' + +'if '+VariableName+'='+AccessVariableName+' then Exit;' +BeautifyCodeOpts.LineEnd +BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent) - +VariableName+':='+SetPropertyVariablename+';' + +VariableName+':='+AccessVariableName+';' +BeautifyCodeOpts.LineEnd +'end;'; end; @@ -7247,7 +7279,7 @@ var end else begin // index, no param list AccessFunc:='procedure '+AccessParam - +'(AIndex:'+IndexType+';'+SetPropertyVariablename+':'+PropType+');'; + +'(AIndex:'+IndexType+';'+AccessVariableNameParam+':'+PropType+');'; end; end; // add new Insert Node @@ -7283,8 +7315,7 @@ var AccessParam:=copy(Src,Parts[ppStored].StartPos, Parts[ppStored].EndPos-Parts[ppStored].StartPos); end else - AccessParam:=copy(Src,Parts[ppName].StartPos, - Parts[ppName].EndPos-Parts[ppName].StartPos) + AccessParam:=PropName +BeautifyCodeOpts.PropertyStoredIdentPostfix; CleanAccessFunc:=UpperCaseStr(AccessParam); // check if procedure exists @@ -9300,6 +9331,8 @@ constructor TCodeCompletionCodeTool.Create; begin inherited Create; FSetPropertyVariablename:='AValue'; + FSetPropertyVariableIsPrefix := false; + FSetPropertyVariableUseConst := false; FCompleteProperties:=true; FAddInheritedCodeToOverrideMethod:=true; end; diff --git a/components/codetools/codetoolmanager.pas b/components/codetools/codetoolmanager.pas index a7859d19ef..bb946be472 100644 --- a/components/codetools/codetoolmanager.pas +++ b/components/codetools/codetoolmanager.pas @@ -118,6 +118,8 @@ type FOnSearchUsedUnit: TOnSearchUsedUnit; FResourceTool: TResourceCodeTool; FSetPropertyVariablename: string; + FSetPropertyVariableIsPrefix: Boolean; + FSetPropertyVariableUseConst: Boolean; FSourceExtensions: string; // default is '.pp;.pas;.lpr;.dpr;.dpk' FPascalTools: TAVLTree; // tree of TCustomCodeTool sorted TCustomCodeTool(Data).Scanner.MainCode FTabWidth: integer; @@ -147,7 +149,9 @@ type procedure SetCodeCompletionTemplateFileName(AValue: String); procedure SetCompleteProperties(const AValue: boolean); procedure SetIndentSize(NewValue: integer); + procedure SetSetPropertyVariableIsPrefix(aValue: Boolean); procedure SetSetPropertyVariablename(AValue: string); + procedure SetSetPropertyVariableUseConst(aValue: Boolean); procedure SetTabWidth(const AValue: integer); procedure SetUseTabs(AValue: boolean); procedure SetVisibleEditorLines(NewValue: integer); @@ -285,6 +289,10 @@ type property JumpCentered: boolean read FJumpCentered write SetJumpCentered; property SetPropertyVariablename: string read FSetPropertyVariablename write SetSetPropertyVariablename; + property SetPropertyVariableIsPrefix: Boolean + read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix; + property SetPropertyVariableUseConst: Boolean + read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst; property VisibleEditorLines: integer read FVisibleEditorLines write SetVisibleEditorLines; property TabWidth: integer read FTabWidth write SetTabWidth; @@ -5777,12 +5785,24 @@ begin FCurCodeTool.JumpCentered:=NewValue; end; +procedure TCodeToolManager.SetSetPropertyVariableIsPrefix(aValue: Boolean); +begin + if FSetPropertyVariableIsPrefix = aValue then Exit; + FSetPropertyVariableIsPrefix := aValue; +end; + procedure TCodeToolManager.SetSetPropertyVariablename(AValue: string); begin if FSetPropertyVariablename=aValue then Exit; FSetPropertyVariablename:=aValue; end; +procedure TCodeToolManager.SetSetPropertyVariableUseConst(aValue: Boolean); +begin + if FSetPropertyVariableUseConst = aValue then Exit; + FSetPropertyVariableUseConst := aValue; +end; + procedure TCodeToolManager.SetCursorBeyondEOL(NewValue: boolean); begin if NewValue=FCursorBeyondEOL then exit; @@ -5885,6 +5905,8 @@ begin AddInheritedCodeToOverrideMethod:=Self.AddInheritedCodeToOverrideMethod; CompleteProperties:=Self.CompleteProperties; SetPropertyVariablename:=Self.SetPropertyVariablename; + SetPropertyVariableIsPrefix:=Self.SetPropertyVariableIsPrefix; + SetPropertyVariableUseConst:=Self.SetPropertyVariableUseConst; end; Result.CheckFilesOnDisk:=FCheckFilesOnDisk; Result.IndentSize:=FIndentSize; @@ -6267,6 +6289,8 @@ begin PtrUInt(InstanceSize) +MemSizeString(FErrorMsg) +MemSizeString(FSetPropertyVariablename) + +PtrUInt(SizeOf(FSetPropertyVariableIsPrefix)) + +PtrUInt(SizeOf(FSetPropertyVariableUseConst)) +MemSizeString(FSourceExtensions) ); if DefinePool<>nil then diff --git a/ide/codetoolsoptions.pas b/ide/codetoolsoptions.pas index fdd6397c14..c3b095e803 100644 --- a/ide/codetoolsoptions.pas +++ b/ide/codetoolsoptions.pas @@ -97,6 +97,8 @@ type FPropertyStoredIdentPostfix: string; FPrivateVariablePrefix: string; FSetPropertyVariablename: string; + FSetPropertyVariableIsPrefix: Boolean; + FSetPropertyVariableUseConst: Boolean; FUsesInsertPolicy: TUsesInsertPolicy; // identifier completion @@ -116,6 +118,8 @@ type procedure SetCodeCompletionTemplateFileName(aValue: String); procedure SetFilename(const AValue: string); procedure SetSetPropertyVariablename(aValue: string); + procedure SetSetPropertyVariableIsPrefix(aValue: Boolean); + procedure SetSetPropertyVariableUseConst(aValue: Boolean); public class function GetGroupCaption:string; override; class function GetInstance: TAbstractIDEOptions; override; @@ -204,6 +208,10 @@ type read FPrivateVariablePrefix write FPrivateVariablePrefix; property SetPropertyVariablename: string read FSetPropertyVariablename write SetSetPropertyVariablename; + property SetPropertyVariableIsPrefix: Boolean + read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix; + property SetPropertyVariableUseConst: Boolean + read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst; property UsesInsertPolicy: TUsesInsertPolicy read FUsesInsertPolicy write FUsesInsertPolicy; @@ -472,6 +480,10 @@ begin 'CodeToolsOptions/PrivateVariablePrefix/Value',''),'F'); FSetPropertyVariablename:=ReadIdentifier(XMLConfig.GetValue( 'CodeToolsOptions/SetPropertyVariablename/Value',''),'AValue'); + FSetPropertyVariableIsPrefix:=XMLConfig.GetValue( + 'CodeToolsOptions/SetPropertyVariableIsPrefix/Value',false); + FSetPropertyVariableUseConst:=XMLConfig.GetValue( + 'CodeToolsOptions/SetPropertyVariableUseConst/Value',false); FUsesInsertPolicy:=UsesInsertPolicyNameToPolicy(XMLConfig.GetValue( 'CodeToolsOptions/UsesInsertPolicy/Value', UsesInsertPolicyNames[DefaultUsesInsertPolicy])); @@ -620,6 +632,10 @@ begin FPrivateVariablePrefix,'F'); XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariablename/Value', FSetPropertyVariablename,'AValue'); + XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariableIsPrefix/Value', + FSetPropertyVariableIsPrefix,false); + XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariableUseConst/Value', + FSetPropertyVariableUseConst,false); XMLConfig.SetDeleteValue('CodeToolsOptions/UsesInsertPolicy/Value', UsesInsertPolicyNames[FUsesInsertPolicy], UsesInsertPolicyNames[DefaultUsesInsertPolicy]); @@ -694,12 +710,24 @@ begin FFilename:=ConfFilename; end; +procedure TCodeToolsOptions.SetSetPropertyVariableIsPrefix(aValue: Boolean); +begin + if FSetPropertyVariableIsPrefix=aValue then Exit; + FSetPropertyVariableIsPrefix:=aValue; +end; + procedure TCodeToolsOptions.SetSetPropertyVariablename(aValue: string); begin if FSetPropertyVariablename=aValue then Exit; FSetPropertyVariablename:=aValue; end; +procedure TCodeToolsOptions.SetSetPropertyVariableUseConst(aValue: Boolean); +begin + if FSetPropertyVariableUseConst=aValue then Exit; + FSetPropertyVariableUseConst:=aValue; +end; + procedure TCodeToolsOptions.Assign(Source: TPersistent); var CodeToolsOpts: TCodeToolsOptions absolute Source; @@ -753,6 +781,8 @@ begin FPropertyStoredIdentPostfix:=CodeToolsOpts.FPropertyStoredIdentPostfix; FPrivateVariablePrefix:=CodeToolsOpts.FPrivateVariablePrefix; FSetPropertyVariablename:=CodeToolsOpts.FSetPropertyVariablename; + FSetPropertyVariableIsPrefix:=CodeToolsOpts.FSetPropertyVariableIsPrefix; + FSetPropertyVariableUseConst:=CodeToolsOpts.FSetPropertyVariableUseConst; FUsesInsertPolicy:=CodeToolsOpts.FUsesInsertPolicy; // identifier completion @@ -810,6 +840,8 @@ begin FPropertyStoredIdentPostfix:='IsStored'; FPrivateVariablePrefix:='f'; FSetPropertyVariablename:='AValue'; + FSetPropertyVariableIsPrefix:=false; + FSetPropertyVariableUseConst:=false; FUsesInsertPolicy:=DefaultUsesInsertPolicy; // identifier completion @@ -885,6 +917,8 @@ begin and (FPropertyStoredIdentPostfix=CodeToolsOpts.FPropertyStoredIdentPostfix) and (FPrivateVariablePrefix=CodeToolsOpts.FPrivateVariablePrefix) and (FSetPropertyVariablename=CodeToolsOpts.FSetPropertyVariablename) + and (FSetPropertyVariableIsPrefix=CodeToolsOpts.FSetPropertyVariableIsPrefix) + and (FSetPropertyVariableUseConst=CodeToolsOpts.FSetPropertyVariableUseConst) and (FUsesInsertPolicy=CodeToolsOpts.FUsesInsertPolicy) // identifier completion @@ -962,6 +996,8 @@ begin // CreateCode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AssignTo(Boss.SourceChangeCache.BeautifyCodeOptions); Boss.SetPropertyVariablename:=SetPropertyVariablename; + Boss.SetPropertyVariableIsPrefix:=SetPropertyVariableIsPrefix; + Boss.SetPropertyVariableUseConst:=SetPropertyVariableUseConst; // Identifier Completion - - - - - - - - - - - - - - - - - - - - - - - - - - Boss.IdentifierList.SortForHistory:=IdentComplSortForHistory; diff --git a/ide/frames/codetools_classcompletion_options.lfm b/ide/frames/codetools_classcompletion_options.lfm index dda49a1312..404f8bd0e0 100644 --- a/ide/frames/codetools_classcompletion_options.lfm +++ b/ide/frames/codetools_classcompletion_options.lfm @@ -63,9 +63,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideTop.Control = ClassPartInsertPolicyRadioGroup AnchorSideTop.Side = asrBottom Left = 6 - Height = 24 + Height = 17 Top = 106 - Width = 227 + Width = 192 BorderSpacing.Around = 6 Caption = 'MixMethodsAndPropertiesCheckBox' TabOrder = 2 @@ -75,12 +75,12 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideTop.Control = UpdateAllMethodSignaturesCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 24 - Top = 166 - Width = 204 + Height = 17 + Top = 152 + Width = 177 BorderSpacing.Around = 6 Caption = 'ClassHeaderCommentsCheckBox' - TabOrder = 3 + TabOrder = 4 end object PropertyCompletionGroupBox: TGroupBox AnchorSideLeft.Control = Owner @@ -90,23 +90,23 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideRight.Side = asrBottom AnchorSideBottom.Side = asrBottom Left = 0 - Height = 184 - Top = 226 + Height = 158 + Top = 198 Width = 575 Anchors = [akTop, akLeft, akRight] AutoSize = True BorderSpacing.Top = 6 Caption = 'PropertyCompletionGroupBox' - ClientHeight = 167 + ClientHeight = 140 ClientWidth = 571 - TabOrder = 4 + TabOrder = 6 object PropertyCompletionCheckBox: TCheckBox AnchorSideLeft.Control = PropertyCompletionGroupBox AnchorSideTop.Control = PropertyCompletionGroupBox Left = 6 - Height = 24 + Height = 17 Top = 6 - Width = 192 + Width = 162 BorderSpacing.Around = 6 Caption = 'PropertyCompletionCheckBox' TabOrder = 0 @@ -118,8 +118,8 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideRight.Control = PropertyCompletionGroupBox AnchorSideRight.Side = asrBottom Left = 6 - Height = 125 - Top = 36 + Height = 105 + Top = 29 Width = 559 Anchors = [akTop, akLeft, akRight] AutoSize = True @@ -127,27 +127,29 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra BevelOuter = bvNone ChildSizing.Layout = cclTopToBottomThenLeftToRight ChildSizing.ControlsPerLine = 5 - ClientHeight = 125 + ClientHeight = 105 ClientWidth = 559 TabOrder = 1 object SetPropertyVariablenameLabel: TLabel AnchorSideTop.Side = asrCenter Left = 11 - Height = 15 - Top = 5 - Width = 171 + Height = 13 + Top = 4 + Width = 147 BorderSpacing.Right = 6 BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignVertical = ccaCenter Caption = 'SetPropertyVariablenameLabel' ParentColor = False + ParentShowHint = False + ShowHint = True end object PrivateVariablePrefixLabel: TLabel AnchorSideTop.Side = asrCenter - Left = 36 - Height = 15 - Top = 30 - Width = 146 + Left = 33 + Height = 13 + Top = 25 + Width = 125 BorderSpacing.Right = 6 BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignVertical = ccaCenter @@ -157,9 +159,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra object PropertyStoredIdentPostfixLabel: TLabel AnchorSideTop.Side = asrCenter Left = 0 - Height = 15 - Top = 55 - Width = 182 + Height = 13 + Top = 46 + Width = 158 BorderSpacing.Right = 6 BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignVertical = ccaCenter @@ -169,9 +171,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra object PropertyWriteIdentPrefixLabel: TLabel AnchorSideTop.Side = asrCenter Left = 11 - Height = 15 - Top = 80 - Width = 171 + Height = 13 + Top = 67 + Width = 147 BorderSpacing.Right = 6 BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignVertical = ccaCenter @@ -180,10 +182,10 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra end object PropertyReadIdentPrefixLabel: TLabel AnchorSideTop.Side = asrCenter - Left = 14 - Height = 15 - Top = 105 - Width = 168 + Left = 12 + Height = 13 + Top = 88 + Width = 146 BorderSpacing.Right = 6 BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignVertical = ccaCenter @@ -193,53 +195,85 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra object SetPropertyVariablenameEdit: TEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom - Left = 188 - Height = 25 + Left = 164 + Height = 21 Top = 0 Width = 80 + ParentShowHint = False + ShowHint = True TabOrder = 0 Text = 'SetPropertyVariablenameEdit' end object PrivateVariablePrefixEdit: TEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom - Left = 188 - Height = 25 - Top = 25 + Left = 164 + Height = 21 + Top = 21 Width = 80 - TabOrder = 1 + TabOrder = 3 Text = 'PrivateVariablePrefixEdit' end object PropertyStoredIdentPostfixEdit: TEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom - Left = 188 - Height = 25 - Top = 50 + Left = 164 + Height = 21 + Top = 42 Width = 80 - TabOrder = 2 + TabOrder = 4 Text = 'PropertyStoredIdentPostfixEdit' end object PropertyWriteIdentPrefixEdit: TEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom - Left = 188 - Height = 25 - Top = 75 + Left = 164 + Height = 21 + Top = 63 Width = 80 - TabOrder = 3 + TabOrder = 5 Text = 'PropertyWriteIdentPrefixEdit' end object PropertyReadIdentPrefixEdit: TEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom - Left = 188 - Height = 25 - Top = 100 + Left = 164 + Height = 21 + Top = 84 Width = 80 - TabOrder = 4 + TabOrder = 6 Text = 'PropertyReadIdentPrefixEdit' end + object SetPropertyVariableIsPrefixCheckBox: TCheckBox + AnchorSideLeft.Control = SetPropertyVariablenameEdit + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = SetPropertyVariablenameEdit + AnchorSideTop.Side = asrCenter + Left = 254 + Height = 17 + Top = 2 + Width = 200 + BorderSpacing.Left = 10 + Caption = 'SetPropertyVariableIsPrefixCheckBox' + ParentShowHint = False + ShowHint = True + TabOrder = 1 + end + object SetPropertyVariableUseConstCheckBox: TCheckBox + AnchorSideLeft.Control = SetPropertyVariableIsPrefixCheckBox + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = SetPropertyVariablenameEdit + AnchorSideTop.Side = asrCenter + Left = 464 + Height = 17 + Top = 2 + Width = 209 + BorderSpacing.Left = 10 + Caption = 'SetPropertyVariableUseConstCheckBox' + ParentShowHint = False + ShowHint = True + TabOrder = 2 + end end end object ClassImplementationCommentsCheckBox: TCheckBox @@ -247,9 +281,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideTop.Control = ClassHeaderCommentsCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 24 - Top = 196 - Width = 251 + Height = 17 + Top = 175 + Width = 216 BorderSpacing.Around = 6 Caption = 'ClassImplementationCommentsCheckBox' TabOrder = 5 @@ -259,11 +293,11 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra AnchorSideTop.Control = MixMethodsAndPropertiesCheckBox AnchorSideTop.Side = asrBottom Left = 6 - Height = 24 - Top = 136 - Width = 235 + Height = 17 + Top = 129 + Width = 200 BorderSpacing.Around = 6 Caption = 'UpdateAllMethodSignaturesCheckBox' - TabOrder = 6 + TabOrder = 3 end end diff --git a/ide/frames/codetools_classcompletion_options.pas b/ide/frames/codetools_classcompletion_options.pas index b2585c8b70..17fe5f2cdf 100644 --- a/ide/frames/codetools_classcompletion_options.pas +++ b/ide/frames/codetools_classcompletion_options.pas @@ -33,6 +33,8 @@ type { TCodetoolsClassCompletionOptionsFrame } TCodetoolsClassCompletionOptionsFrame = class(TAbstractIDEOptionsEditor) + SetPropertyVariableIsPrefixCheckBox: TCheckBox; + SetPropertyVariableUseConstCheckBox: TCheckBox; ClassHeaderCommentsCheckBox: TCheckBox; ClassImplementationCommentsCheckBox: TCheckBox; ClassPartInsertPolicyRadioGroup: TRadioGroup; @@ -108,6 +110,12 @@ begin PropertyStoredIdentPostfixLabel.Caption:=dlgCDTStoredPostfix; PrivateVariablePrefixLabel.Caption:=dlgCDTVariablePrefix; SetPropertyVariablenameLabel.Caption:=dlgSetPropertyVariable; + SetPropertyVariablenameLabel.Hint:=dlgSetPropertyVariableHint; + SetPropertyVariablenameEdit.Hint:=SetPropertyVariablenameLabel.Hint; + SetPropertyVariableIsPrefixCheckBox.Caption:=dlgSetPropertyVariableIsPrefix; + SetPropertyVariableIsPrefixCheckBox.Hint:=dlgSetPropertyVariableIsPrefixHint; + SetPropertyVariableUseConstCheckBox.Caption:=dlgSetPropertyVariableUseConst; + SetPropertyVariableUseConstCheckBox.Hint:=dlgSetPropertyVariableUseConstHint; end; procedure TCodetoolsClassCompletionOptionsFrame.ReadSettings( @@ -143,6 +151,8 @@ begin PropertyStoredIdentPostfixEdit.Text := PropertyStoredIdentPostfix; PrivateVariablePrefixEdit.Text := PrivateVariablePrefix; SetPropertyVariablenameEdit.Text := SetPropertyVariablename; + SetPropertyVariableIsPrefixCheckBox.Checked := SetPropertyVariableIsPrefix; + SetPropertyVariableUseConstCheckBox.Checked := SetPropertyVariableUseConst; end; end; @@ -178,6 +188,8 @@ begin ReadIdentifier(PrivateVariablePrefixEdit.Text,'F'); SetPropertyVariablename := ReadIdentifier(SetPropertyVariablenameEdit.Text,'AValue'); + SetPropertyVariableIsPrefix := SetPropertyVariableIsPrefixCheckBox.Checked; + SetPropertyVariableUseConst := SetPropertyVariableUseConstCheckBox.Checked; end; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 6f0e7a27da..7cfd9227dc 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -2100,6 +2100,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';