IDE+codetools: property completion: options to use a prefixed name as Set mthod parameter, patch #28181 from Ondrej Pokorny

git-svn-id: trunk@49807 -
This commit is contained in:
mattias 2015-09-10 11:51:16 +00:00
parent c36aa6da8e
commit 796a5fdd00
6 changed files with 218 additions and 74 deletions

View File

@ -138,6 +138,8 @@ type
FCompleteProperties: boolean; FCompleteProperties: boolean;
FirstInsert: TCodeTreeNodeExtension; // list of insert requests FirstInsert: TCodeTreeNodeExtension; // list of insert requests
FSetPropertyVariablename: string; FSetPropertyVariablename: string;
FSetPropertyVariableIsPrefix: Boolean;
FSetPropertyVariableUseConst: Boolean;
FJumpToProcName: string; FJumpToProcName: string;
NewClassSectionIndent: array[TPascalClassSection] of integer; NewClassSectionIndent: array[TPascalClassSection] of integer;
NewClassSectionInsertPos: array[TPascalClassSection] of integer; NewClassSectionInsertPos: array[TPascalClassSection] of integer;
@ -145,7 +147,9 @@ type
fNewMainUsesSectionUnits: TAVLTree; // tree of AnsiString fNewMainUsesSectionUnits: TAVLTree; // tree of AnsiString
procedure AddNewPropertyAccessMethodsToClassProcs(ClassProcs: TAVLTree; procedure AddNewPropertyAccessMethodsToClassProcs(ClassProcs: TAVLTree;
const TheClassName: string); const TheClassName: string);
procedure SetSetPropertyVariableIsPrefix(aValue: Boolean);
procedure SetSetPropertyVariablename(AValue: string); procedure SetSetPropertyVariablename(AValue: string);
procedure SetSetPropertyVariableUseConst(aValue: Boolean);
function UpdateProcBodySignature(ProcBodyNodes: TAVLTree; function UpdateProcBodySignature(ProcBodyNodes: TAVLTree;
const BodyNodeExt: TCodeTreeNodeExtension; const BodyNodeExt: TCodeTreeNodeExtension;
ProcAttrCopyDefToBody: TProcHeadAttributes; var ProcsCopied: boolean; ProcAttrCopyDefToBody: TProcHeadAttributes; var ProcsCopied: boolean;
@ -381,6 +385,10 @@ type
// Options // Options
property SetPropertyVariablename: string read FSetPropertyVariablename property SetPropertyVariablename: string read FSetPropertyVariablename
write SetSetPropertyVariablename; write SetSetPropertyVariablename;
property SetPropertyVariableIsPrefix: Boolean
read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix;
property SetPropertyVariableUseConst: Boolean
read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst;
property CompleteProperties: boolean read FCompleteProperties property CompleteProperties: boolean read FCompleteProperties
write FCompleteProperties; write FCompleteProperties;
property AddInheritedCodeToOverrideMethod: boolean property AddInheritedCodeToOverrideMethod: boolean
@ -473,12 +481,26 @@ begin
FSourceChangeCache.MainScanner:=Scanner; FSourceChangeCache.MainScanner:=Scanner;
end; end;
procedure TCodeCompletionCodeTool.SetSetPropertyVariableIsPrefix(aValue: Boolean
);
begin
if FSetPropertyVariableIsPrefix = aValue then Exit;
FSetPropertyVariableIsPrefix := aValue;
end;
procedure TCodeCompletionCodeTool.SetSetPropertyVariablename(AValue: string); procedure TCodeCompletionCodeTool.SetSetPropertyVariablename(AValue: string);
begin begin
if FSetPropertyVariablename=aValue then Exit; if FSetPropertyVariablename=aValue then Exit;
FSetPropertyVariablename:=aValue; FSetPropertyVariablename:=aValue;
end; end;
procedure TCodeCompletionCodeTool.SetSetPropertyVariableUseConst(aValue: Boolean
);
begin
if FSetPropertyVariableUseConst = aValue then Exit;
FSetPropertyVariableUseConst := aValue;
end;
function TCodeCompletionCodeTool.OnTopLvlIdentifierFound( function TCodeCompletionCodeTool.OnTopLvlIdentifierFound(
Params: TFindDeclarationParams; const FoundContext: TFindContext Params: TFindDeclarationParams; const FoundContext: TFindContext
): TIdentifierFoundResult; ): TIdentifierFoundResult;
@ -1410,6 +1432,8 @@ begin
inherited CalcMemSize(Stats); inherited CalcMemSize(Stats);
Stats.Add('TCodeCompletionCodeTool', Stats.Add('TCodeCompletionCodeTool',
MemSizeString(FSetPropertyVariablename) MemSizeString(FSetPropertyVariablename)
+PtrUInt(SizeOf(FSetPropertyVariableIsPrefix))
+PtrUInt(SizeOf(FSetPropertyVariableUseConst))
+MemSizeString(FJumpToProcName) +MemSizeString(FJumpToProcName)
+length(NewClassSectionIndent)*SizeOf(integer) +length(NewClassSectionIndent)*SizeOf(integer)
+length(NewClassSectionInsertPos)*SizeOf(integer) +length(NewClassSectionInsertPos)*SizeOf(integer)
@ -6761,7 +6785,7 @@ var
end; end;
var var
CleanAccessFunc, CleanParamList, ParamList, PropType, VariableName: string; CleanAccessFunc, CleanParamList, ParamList, PropName, PropType, VariableName: string;
IsClassProp: boolean; IsClassProp: boolean;
InsertPos: integer; InsertPos: integer;
BeautifyCodeOpts: TBeautifyCodeOptions; BeautifyCodeOpts: TBeautifyCodeOptions;
@ -6788,6 +6812,10 @@ var
end; end;
ReadNextAtom; // read name ReadNextAtom; // read name
Parts[ppName]:=CurPos; 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; ReadNextAtom;
end; end;
@ -6966,13 +6994,10 @@ var
or (CodeCompleteClassNode.Desc in AllClassInterfaces) then or (CodeCompleteClassNode.Desc in AllClassInterfaces) then
begin begin
// create the default read identifier for a function // create the default read identifier for a function
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos, AccessParam:=AccessParamPrefix+PropName;
Parts[ppName].EndPos-Parts[ppName].StartPos);
end else begin end else begin
// create the default read identifier for a variable // create the default read identifier for a variable
AccessParam:=BeautifyCodeOpts.PrivateVariablePrefix AccessParam:=BeautifyCodeOpts.PrivateVariablePrefix+PropName;
+copy(Src,Parts[ppName].StartPos,
Parts[ppName].EndPos-Parts[ppName].StartPos);
end; end;
end; end;
@ -7095,6 +7120,7 @@ var
AccessParamPrefix: String; AccessParamPrefix: String;
AccessParam: String; AccessParam: String;
AccessFunc: String; AccessFunc: String;
AccessVariableName, AccessVariableNameParam: String;
begin begin
// check write specifier // check write specifier
if not PartIsAtom[ppWrite] then exit; if not PartIsAtom[ppWrite] then exit;
@ -7108,8 +7134,7 @@ var
AccessParam:=copy(Src,Parts[ppWrite].StartPos, AccessParam:=copy(Src,Parts[ppWrite].StartPos,
Parts[ppWrite].EndPos-Parts[ppWrite].StartPos) Parts[ppWrite].EndPos-Parts[ppWrite].StartPos)
else else
AccessParam:=AccessParamPrefix+copy(Src,Parts[ppName].StartPos, AccessParam:=AccessParamPrefix+PropName;
Parts[ppName].EndPos-Parts[ppName].StartPos);
// complete property definition for write specifier // complete property definition for write specifier
if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin if (Parts[ppWrite].StartPos<0) and CompleteProperties then begin
@ -7176,6 +7201,13 @@ var
// add insert demand for function // add insert demand for function
// build function code // build function code
ProcBody:=''; 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 if (Parts[ppParamList].StartPos>0) then begin
MoveCursorToCleanPos(Parts[ppParamList].StartPos); MoveCursorToCleanPos(Parts[ppParamList].StartPos);
ReadNextAtom; ReadNextAtom;
@ -7189,20 +7221,20 @@ var
if (Parts[ppIndexWord].StartPos<1) then begin if (Parts[ppIndexWord].StartPos<1) then begin
// param list, no index // param list, no index
AccessFunc:='procedure '+AccessParam AccessFunc:='procedure '+AccessParam
+'('+ParamList+';'+SetPropertyVariablename+':' +'('+ParamList+';'+AccessVariableNameParam+':'
+PropType+');'; +PropType+');';
end else begin end else begin
// index + param list // index + param list
AccessFunc:='procedure '+AccessParam AccessFunc:='procedure '+AccessParam
+'(AIndex:'+IndexType+';'+ParamList+';' +'(AIndex:'+IndexType+';'+ParamList+';'
+SetPropertyVariablename+':'+PropType+');'; +AccessVariableNameParam+':'+PropType+');';
end; end;
end else begin end else begin
if (Parts[ppIndexWord].StartPos<1) then begin if (Parts[ppIndexWord].StartPos<1) then begin
// no param list, no index // no param list, no index
AccessFunc:= AccessFunc:=
'procedure '+AccessParam 'procedure '+AccessParam
+'('+SetPropertyVariablename+':'+PropType+');'; +'('+AccessVariableNameParam+':'+PropType+');';
if VariableName<>'' then begin if VariableName<>'' then begin
{ read spec is a variable -> add simple assign code to body { read spec is a variable -> add simple assign code to body
For example: For example:
@ -7230,14 +7262,14 @@ var
ProcBody:= ProcBody:=
'procedure ' 'procedure '
+ExtractClassName(PropNode.Parent.Parent,false)+'.'+AccessParam +ExtractClassName(PropNode.Parent.Parent,false)+'.'+AccessParam
+'('+SetPropertyVariablename+':'+PropType+');' +'('+AccessVariableNameParam+':'+PropType+');'
+BeautifyCodeOpts.LineEnd +BeautifyCodeOpts.LineEnd
+'begin'+BeautifyCodeOpts.LineEnd +'begin'+BeautifyCodeOpts.LineEnd
+BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent) +BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent)
+'if '+VariableName+'='+SetPropertyVariablename+' then Exit;' +'if '+VariableName+'='+AccessVariableName+' then Exit;'
+BeautifyCodeOpts.LineEnd +BeautifyCodeOpts.LineEnd
+BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent) +BeautifyCodeOpts.GetIndentStr(BeautifyCodeOpts.Indent)
+VariableName+':='+SetPropertyVariablename+';' +VariableName+':='+AccessVariableName+';'
+BeautifyCodeOpts.LineEnd +BeautifyCodeOpts.LineEnd
+'end;'; +'end;';
end; end;
@ -7247,7 +7279,7 @@ var
end else begin end else begin
// index, no param list // index, no param list
AccessFunc:='procedure '+AccessParam AccessFunc:='procedure '+AccessParam
+'(AIndex:'+IndexType+';'+SetPropertyVariablename+':'+PropType+');'; +'(AIndex:'+IndexType+';'+AccessVariableNameParam+':'+PropType+');';
end; end;
end; end;
// add new Insert Node // add new Insert Node
@ -7283,8 +7315,7 @@ var
AccessParam:=copy(Src,Parts[ppStored].StartPos, AccessParam:=copy(Src,Parts[ppStored].StartPos,
Parts[ppStored].EndPos-Parts[ppStored].StartPos); Parts[ppStored].EndPos-Parts[ppStored].StartPos);
end else end else
AccessParam:=copy(Src,Parts[ppName].StartPos, AccessParam:=PropName
Parts[ppName].EndPos-Parts[ppName].StartPos)
+BeautifyCodeOpts.PropertyStoredIdentPostfix; +BeautifyCodeOpts.PropertyStoredIdentPostfix;
CleanAccessFunc:=UpperCaseStr(AccessParam); CleanAccessFunc:=UpperCaseStr(AccessParam);
// check if procedure exists // check if procedure exists
@ -9300,6 +9331,8 @@ constructor TCodeCompletionCodeTool.Create;
begin begin
inherited Create; inherited Create;
FSetPropertyVariablename:='AValue'; FSetPropertyVariablename:='AValue';
FSetPropertyVariableIsPrefix := false;
FSetPropertyVariableUseConst := false;
FCompleteProperties:=true; FCompleteProperties:=true;
FAddInheritedCodeToOverrideMethod:=true; FAddInheritedCodeToOverrideMethod:=true;
end; end;

View File

@ -118,6 +118,8 @@ type
FOnSearchUsedUnit: TOnSearchUsedUnit; FOnSearchUsedUnit: TOnSearchUsedUnit;
FResourceTool: TResourceCodeTool; FResourceTool: TResourceCodeTool;
FSetPropertyVariablename: string; FSetPropertyVariablename: string;
FSetPropertyVariableIsPrefix: Boolean;
FSetPropertyVariableUseConst: Boolean;
FSourceExtensions: string; // default is '.pp;.pas;.lpr;.dpr;.dpk' FSourceExtensions: string; // default is '.pp;.pas;.lpr;.dpr;.dpk'
FPascalTools: TAVLTree; // tree of TCustomCodeTool sorted TCustomCodeTool(Data).Scanner.MainCode FPascalTools: TAVLTree; // tree of TCustomCodeTool sorted TCustomCodeTool(Data).Scanner.MainCode
FTabWidth: integer; FTabWidth: integer;
@ -147,7 +149,9 @@ type
procedure SetCodeCompletionTemplateFileName(AValue: String); procedure SetCodeCompletionTemplateFileName(AValue: String);
procedure SetCompleteProperties(const AValue: boolean); procedure SetCompleteProperties(const AValue: boolean);
procedure SetIndentSize(NewValue: integer); procedure SetIndentSize(NewValue: integer);
procedure SetSetPropertyVariableIsPrefix(aValue: Boolean);
procedure SetSetPropertyVariablename(AValue: string); procedure SetSetPropertyVariablename(AValue: string);
procedure SetSetPropertyVariableUseConst(aValue: Boolean);
procedure SetTabWidth(const AValue: integer); procedure SetTabWidth(const AValue: integer);
procedure SetUseTabs(AValue: boolean); procedure SetUseTabs(AValue: boolean);
procedure SetVisibleEditorLines(NewValue: integer); procedure SetVisibleEditorLines(NewValue: integer);
@ -285,6 +289,10 @@ type
property JumpCentered: boolean read FJumpCentered write SetJumpCentered; property JumpCentered: boolean read FJumpCentered write SetJumpCentered;
property SetPropertyVariablename: string property SetPropertyVariablename: string
read FSetPropertyVariablename write SetSetPropertyVariablename; read FSetPropertyVariablename write SetSetPropertyVariablename;
property SetPropertyVariableIsPrefix: Boolean
read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix;
property SetPropertyVariableUseConst: Boolean
read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst;
property VisibleEditorLines: integer property VisibleEditorLines: integer
read FVisibleEditorLines write SetVisibleEditorLines; read FVisibleEditorLines write SetVisibleEditorLines;
property TabWidth: integer read FTabWidth write SetTabWidth; property TabWidth: integer read FTabWidth write SetTabWidth;
@ -5777,12 +5785,24 @@ begin
FCurCodeTool.JumpCentered:=NewValue; FCurCodeTool.JumpCentered:=NewValue;
end; end;
procedure TCodeToolManager.SetSetPropertyVariableIsPrefix(aValue: Boolean);
begin
if FSetPropertyVariableIsPrefix = aValue then Exit;
FSetPropertyVariableIsPrefix := aValue;
end;
procedure TCodeToolManager.SetSetPropertyVariablename(AValue: string); procedure TCodeToolManager.SetSetPropertyVariablename(AValue: string);
begin begin
if FSetPropertyVariablename=aValue then Exit; if FSetPropertyVariablename=aValue then Exit;
FSetPropertyVariablename:=aValue; FSetPropertyVariablename:=aValue;
end; end;
procedure TCodeToolManager.SetSetPropertyVariableUseConst(aValue: Boolean);
begin
if FSetPropertyVariableUseConst = aValue then Exit;
FSetPropertyVariableUseConst := aValue;
end;
procedure TCodeToolManager.SetCursorBeyondEOL(NewValue: boolean); procedure TCodeToolManager.SetCursorBeyondEOL(NewValue: boolean);
begin begin
if NewValue=FCursorBeyondEOL then exit; if NewValue=FCursorBeyondEOL then exit;
@ -5885,6 +5905,8 @@ begin
AddInheritedCodeToOverrideMethod:=Self.AddInheritedCodeToOverrideMethod; AddInheritedCodeToOverrideMethod:=Self.AddInheritedCodeToOverrideMethod;
CompleteProperties:=Self.CompleteProperties; CompleteProperties:=Self.CompleteProperties;
SetPropertyVariablename:=Self.SetPropertyVariablename; SetPropertyVariablename:=Self.SetPropertyVariablename;
SetPropertyVariableIsPrefix:=Self.SetPropertyVariableIsPrefix;
SetPropertyVariableUseConst:=Self.SetPropertyVariableUseConst;
end; end;
Result.CheckFilesOnDisk:=FCheckFilesOnDisk; Result.CheckFilesOnDisk:=FCheckFilesOnDisk;
Result.IndentSize:=FIndentSize; Result.IndentSize:=FIndentSize;
@ -6267,6 +6289,8 @@ begin
PtrUInt(InstanceSize) PtrUInt(InstanceSize)
+MemSizeString(FErrorMsg) +MemSizeString(FErrorMsg)
+MemSizeString(FSetPropertyVariablename) +MemSizeString(FSetPropertyVariablename)
+PtrUInt(SizeOf(FSetPropertyVariableIsPrefix))
+PtrUInt(SizeOf(FSetPropertyVariableUseConst))
+MemSizeString(FSourceExtensions) +MemSizeString(FSourceExtensions)
); );
if DefinePool<>nil then if DefinePool<>nil then

View File

@ -97,6 +97,8 @@ type
FPropertyStoredIdentPostfix: string; FPropertyStoredIdentPostfix: string;
FPrivateVariablePrefix: string; FPrivateVariablePrefix: string;
FSetPropertyVariablename: string; FSetPropertyVariablename: string;
FSetPropertyVariableIsPrefix: Boolean;
FSetPropertyVariableUseConst: Boolean;
FUsesInsertPolicy: TUsesInsertPolicy; FUsesInsertPolicy: TUsesInsertPolicy;
// identifier completion // identifier completion
@ -116,6 +118,8 @@ type
procedure SetCodeCompletionTemplateFileName(aValue: String); procedure SetCodeCompletionTemplateFileName(aValue: String);
procedure SetFilename(const AValue: string); procedure SetFilename(const AValue: string);
procedure SetSetPropertyVariablename(aValue: string); procedure SetSetPropertyVariablename(aValue: string);
procedure SetSetPropertyVariableIsPrefix(aValue: Boolean);
procedure SetSetPropertyVariableUseConst(aValue: Boolean);
public public
class function GetGroupCaption:string; override; class function GetGroupCaption:string; override;
class function GetInstance: TAbstractIDEOptions; override; class function GetInstance: TAbstractIDEOptions; override;
@ -204,6 +208,10 @@ type
read FPrivateVariablePrefix write FPrivateVariablePrefix; read FPrivateVariablePrefix write FPrivateVariablePrefix;
property SetPropertyVariablename: string property SetPropertyVariablename: string
read FSetPropertyVariablename write SetSetPropertyVariablename; read FSetPropertyVariablename write SetSetPropertyVariablename;
property SetPropertyVariableIsPrefix: Boolean
read FSetPropertyVariableIsPrefix write SetSetPropertyVariableIsPrefix;
property SetPropertyVariableUseConst: Boolean
read FSetPropertyVariableUseConst write SetSetPropertyVariableUseConst;
property UsesInsertPolicy: TUsesInsertPolicy property UsesInsertPolicy: TUsesInsertPolicy
read FUsesInsertPolicy write FUsesInsertPolicy; read FUsesInsertPolicy write FUsesInsertPolicy;
@ -472,6 +480,10 @@ begin
'CodeToolsOptions/PrivateVariablePrefix/Value',''),'F'); 'CodeToolsOptions/PrivateVariablePrefix/Value',''),'F');
FSetPropertyVariablename:=ReadIdentifier(XMLConfig.GetValue( FSetPropertyVariablename:=ReadIdentifier(XMLConfig.GetValue(
'CodeToolsOptions/SetPropertyVariablename/Value',''),'AValue'); 'CodeToolsOptions/SetPropertyVariablename/Value',''),'AValue');
FSetPropertyVariableIsPrefix:=XMLConfig.GetValue(
'CodeToolsOptions/SetPropertyVariableIsPrefix/Value',false);
FSetPropertyVariableUseConst:=XMLConfig.GetValue(
'CodeToolsOptions/SetPropertyVariableUseConst/Value',false);
FUsesInsertPolicy:=UsesInsertPolicyNameToPolicy(XMLConfig.GetValue( FUsesInsertPolicy:=UsesInsertPolicyNameToPolicy(XMLConfig.GetValue(
'CodeToolsOptions/UsesInsertPolicy/Value', 'CodeToolsOptions/UsesInsertPolicy/Value',
UsesInsertPolicyNames[DefaultUsesInsertPolicy])); UsesInsertPolicyNames[DefaultUsesInsertPolicy]));
@ -620,6 +632,10 @@ begin
FPrivateVariablePrefix,'F'); FPrivateVariablePrefix,'F');
XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariablename/Value', XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariablename/Value',
FSetPropertyVariablename,'AValue'); FSetPropertyVariablename,'AValue');
XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariableIsPrefix/Value',
FSetPropertyVariableIsPrefix,false);
XMLConfig.SetDeleteValue('CodeToolsOptions/SetPropertyVariableUseConst/Value',
FSetPropertyVariableUseConst,false);
XMLConfig.SetDeleteValue('CodeToolsOptions/UsesInsertPolicy/Value', XMLConfig.SetDeleteValue('CodeToolsOptions/UsesInsertPolicy/Value',
UsesInsertPolicyNames[FUsesInsertPolicy], UsesInsertPolicyNames[FUsesInsertPolicy],
UsesInsertPolicyNames[DefaultUsesInsertPolicy]); UsesInsertPolicyNames[DefaultUsesInsertPolicy]);
@ -694,12 +710,24 @@ begin
FFilename:=ConfFilename; FFilename:=ConfFilename;
end; end;
procedure TCodeToolsOptions.SetSetPropertyVariableIsPrefix(aValue: Boolean);
begin
if FSetPropertyVariableIsPrefix=aValue then Exit;
FSetPropertyVariableIsPrefix:=aValue;
end;
procedure TCodeToolsOptions.SetSetPropertyVariablename(aValue: string); procedure TCodeToolsOptions.SetSetPropertyVariablename(aValue: string);
begin begin
if FSetPropertyVariablename=aValue then Exit; if FSetPropertyVariablename=aValue then Exit;
FSetPropertyVariablename:=aValue; FSetPropertyVariablename:=aValue;
end; end;
procedure TCodeToolsOptions.SetSetPropertyVariableUseConst(aValue: Boolean);
begin
if FSetPropertyVariableUseConst=aValue then Exit;
FSetPropertyVariableUseConst:=aValue;
end;
procedure TCodeToolsOptions.Assign(Source: TPersistent); procedure TCodeToolsOptions.Assign(Source: TPersistent);
var var
CodeToolsOpts: TCodeToolsOptions absolute Source; CodeToolsOpts: TCodeToolsOptions absolute Source;
@ -753,6 +781,8 @@ begin
FPropertyStoredIdentPostfix:=CodeToolsOpts.FPropertyStoredIdentPostfix; FPropertyStoredIdentPostfix:=CodeToolsOpts.FPropertyStoredIdentPostfix;
FPrivateVariablePrefix:=CodeToolsOpts.FPrivateVariablePrefix; FPrivateVariablePrefix:=CodeToolsOpts.FPrivateVariablePrefix;
FSetPropertyVariablename:=CodeToolsOpts.FSetPropertyVariablename; FSetPropertyVariablename:=CodeToolsOpts.FSetPropertyVariablename;
FSetPropertyVariableIsPrefix:=CodeToolsOpts.FSetPropertyVariableIsPrefix;
FSetPropertyVariableUseConst:=CodeToolsOpts.FSetPropertyVariableUseConst;
FUsesInsertPolicy:=CodeToolsOpts.FUsesInsertPolicy; FUsesInsertPolicy:=CodeToolsOpts.FUsesInsertPolicy;
// identifier completion // identifier completion
@ -810,6 +840,8 @@ begin
FPropertyStoredIdentPostfix:='IsStored'; FPropertyStoredIdentPostfix:='IsStored';
FPrivateVariablePrefix:='f'; FPrivateVariablePrefix:='f';
FSetPropertyVariablename:='AValue'; FSetPropertyVariablename:='AValue';
FSetPropertyVariableIsPrefix:=false;
FSetPropertyVariableUseConst:=false;
FUsesInsertPolicy:=DefaultUsesInsertPolicy; FUsesInsertPolicy:=DefaultUsesInsertPolicy;
// identifier completion // identifier completion
@ -885,6 +917,8 @@ begin
and (FPropertyStoredIdentPostfix=CodeToolsOpts.FPropertyStoredIdentPostfix) and (FPropertyStoredIdentPostfix=CodeToolsOpts.FPropertyStoredIdentPostfix)
and (FPrivateVariablePrefix=CodeToolsOpts.FPrivateVariablePrefix) and (FPrivateVariablePrefix=CodeToolsOpts.FPrivateVariablePrefix)
and (FSetPropertyVariablename=CodeToolsOpts.FSetPropertyVariablename) and (FSetPropertyVariablename=CodeToolsOpts.FSetPropertyVariablename)
and (FSetPropertyVariableIsPrefix=CodeToolsOpts.FSetPropertyVariableIsPrefix)
and (FSetPropertyVariableUseConst=CodeToolsOpts.FSetPropertyVariableUseConst)
and (FUsesInsertPolicy=CodeToolsOpts.FUsesInsertPolicy) and (FUsesInsertPolicy=CodeToolsOpts.FUsesInsertPolicy)
// identifier completion // identifier completion
@ -962,6 +996,8 @@ begin
// CreateCode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // CreateCode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AssignTo(Boss.SourceChangeCache.BeautifyCodeOptions); AssignTo(Boss.SourceChangeCache.BeautifyCodeOptions);
Boss.SetPropertyVariablename:=SetPropertyVariablename; Boss.SetPropertyVariablename:=SetPropertyVariablename;
Boss.SetPropertyVariableIsPrefix:=SetPropertyVariableIsPrefix;
Boss.SetPropertyVariableUseConst:=SetPropertyVariableUseConst;
// Identifier Completion - - - - - - - - - - - - - - - - - - - - - - - - - - // Identifier Completion - - - - - - - - - - - - - - - - - - - - - - - - - -
Boss.IdentifierList.SortForHistory:=IdentComplSortForHistory; Boss.IdentifierList.SortForHistory:=IdentComplSortForHistory;

View File

@ -63,9 +63,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Control = ClassPartInsertPolicyRadioGroup AnchorSideTop.Control = ClassPartInsertPolicyRadioGroup
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 17
Top = 106 Top = 106
Width = 227 Width = 192
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'MixMethodsAndPropertiesCheckBox' Caption = 'MixMethodsAndPropertiesCheckBox'
TabOrder = 2 TabOrder = 2
@ -75,12 +75,12 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Control = UpdateAllMethodSignaturesCheckBox AnchorSideTop.Control = UpdateAllMethodSignaturesCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 17
Top = 166 Top = 152
Width = 204 Width = 177
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'ClassHeaderCommentsCheckBox' Caption = 'ClassHeaderCommentsCheckBox'
TabOrder = 3 TabOrder = 4
end end
object PropertyCompletionGroupBox: TGroupBox object PropertyCompletionGroupBox: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
@ -90,23 +90,23 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 184 Height = 158
Top = 226 Top = 198
Width = 575 Width = 575
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'PropertyCompletionGroupBox' Caption = 'PropertyCompletionGroupBox'
ClientHeight = 167 ClientHeight = 140
ClientWidth = 571 ClientWidth = 571
TabOrder = 4 TabOrder = 6
object PropertyCompletionCheckBox: TCheckBox object PropertyCompletionCheckBox: TCheckBox
AnchorSideLeft.Control = PropertyCompletionGroupBox AnchorSideLeft.Control = PropertyCompletionGroupBox
AnchorSideTop.Control = PropertyCompletionGroupBox AnchorSideTop.Control = PropertyCompletionGroupBox
Left = 6 Left = 6
Height = 24 Height = 17
Top = 6 Top = 6
Width = 192 Width = 162
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'PropertyCompletionCheckBox' Caption = 'PropertyCompletionCheckBox'
TabOrder = 0 TabOrder = 0
@ -118,8 +118,8 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideRight.Control = PropertyCompletionGroupBox AnchorSideRight.Control = PropertyCompletionGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 6 Left = 6
Height = 125 Height = 105
Top = 36 Top = 29
Width = 559 Width = 559
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True AutoSize = True
@ -127,27 +127,29 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
BevelOuter = bvNone BevelOuter = bvNone
ChildSizing.Layout = cclTopToBottomThenLeftToRight ChildSizing.Layout = cclTopToBottomThenLeftToRight
ChildSizing.ControlsPerLine = 5 ChildSizing.ControlsPerLine = 5
ClientHeight = 125 ClientHeight = 105
ClientWidth = 559 ClientWidth = 559
TabOrder = 1 TabOrder = 1
object SetPropertyVariablenameLabel: TLabel object SetPropertyVariablenameLabel: TLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 11 Left = 11
Height = 15 Height = 13
Top = 5 Top = 4
Width = 171 Width = 147
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignHorizontal = ccaRightBottom
BorderSpacing.CellAlignVertical = ccaCenter BorderSpacing.CellAlignVertical = ccaCenter
Caption = 'SetPropertyVariablenameLabel' Caption = 'SetPropertyVariablenameLabel'
ParentColor = False ParentColor = False
ParentShowHint = False
ShowHint = True
end end
object PrivateVariablePrefixLabel: TLabel object PrivateVariablePrefixLabel: TLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 36 Left = 33
Height = 15 Height = 13
Top = 30 Top = 25
Width = 146 Width = 125
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignHorizontal = ccaRightBottom
BorderSpacing.CellAlignVertical = ccaCenter BorderSpacing.CellAlignVertical = ccaCenter
@ -157,9 +159,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
object PropertyStoredIdentPostfixLabel: TLabel object PropertyStoredIdentPostfixLabel: TLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 0 Left = 0
Height = 15 Height = 13
Top = 55 Top = 46
Width = 182 Width = 158
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignHorizontal = ccaRightBottom
BorderSpacing.CellAlignVertical = ccaCenter BorderSpacing.CellAlignVertical = ccaCenter
@ -169,9 +171,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
object PropertyWriteIdentPrefixLabel: TLabel object PropertyWriteIdentPrefixLabel: TLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 11 Left = 11
Height = 15 Height = 13
Top = 80 Top = 67
Width = 171 Width = 147
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignHorizontal = ccaRightBottom
BorderSpacing.CellAlignVertical = ccaCenter BorderSpacing.CellAlignVertical = ccaCenter
@ -180,10 +182,10 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
end end
object PropertyReadIdentPrefixLabel: TLabel object PropertyReadIdentPrefixLabel: TLabel
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 14 Left = 12
Height = 15 Height = 13
Top = 105 Top = 88
Width = 168 Width = 146
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.CellAlignHorizontal = ccaRightBottom BorderSpacing.CellAlignHorizontal = ccaRightBottom
BorderSpacing.CellAlignVertical = ccaCenter BorderSpacing.CellAlignVertical = ccaCenter
@ -193,53 +195,85 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
object SetPropertyVariablenameEdit: TEdit object SetPropertyVariablenameEdit: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 188 Left = 164
Height = 25 Height = 21
Top = 0 Top = 0
Width = 80 Width = 80
ParentShowHint = False
ShowHint = True
TabOrder = 0 TabOrder = 0
Text = 'SetPropertyVariablenameEdit' Text = 'SetPropertyVariablenameEdit'
end end
object PrivateVariablePrefixEdit: TEdit object PrivateVariablePrefixEdit: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 188 Left = 164
Height = 25 Height = 21
Top = 25 Top = 21
Width = 80 Width = 80
TabOrder = 1 TabOrder = 3
Text = 'PrivateVariablePrefixEdit' Text = 'PrivateVariablePrefixEdit'
end end
object PropertyStoredIdentPostfixEdit: TEdit object PropertyStoredIdentPostfixEdit: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 188 Left = 164
Height = 25 Height = 21
Top = 50 Top = 42
Width = 80 Width = 80
TabOrder = 2 TabOrder = 4
Text = 'PropertyStoredIdentPostfixEdit' Text = 'PropertyStoredIdentPostfixEdit'
end end
object PropertyWriteIdentPrefixEdit: TEdit object PropertyWriteIdentPrefixEdit: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 188 Left = 164
Height = 25 Height = 21
Top = 75 Top = 63
Width = 80 Width = 80
TabOrder = 3 TabOrder = 5
Text = 'PropertyWriteIdentPrefixEdit' Text = 'PropertyWriteIdentPrefixEdit'
end end
object PropertyReadIdentPrefixEdit: TEdit object PropertyReadIdentPrefixEdit: TEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 188 Left = 164
Height = 25 Height = 21
Top = 100 Top = 84
Width = 80 Width = 80
TabOrder = 4 TabOrder = 6
Text = 'PropertyReadIdentPrefixEdit' Text = 'PropertyReadIdentPrefixEdit'
end 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
end end
object ClassImplementationCommentsCheckBox: TCheckBox object ClassImplementationCommentsCheckBox: TCheckBox
@ -247,9 +281,9 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Control = ClassHeaderCommentsCheckBox AnchorSideTop.Control = ClassHeaderCommentsCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 17
Top = 196 Top = 175
Width = 251 Width = 216
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'ClassImplementationCommentsCheckBox' Caption = 'ClassImplementationCommentsCheckBox'
TabOrder = 5 TabOrder = 5
@ -259,11 +293,11 @@ object CodetoolsClassCompletionOptionsFrame: TCodetoolsClassCompletionOptionsFra
AnchorSideTop.Control = MixMethodsAndPropertiesCheckBox AnchorSideTop.Control = MixMethodsAndPropertiesCheckBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 24 Height = 17
Top = 136 Top = 129
Width = 235 Width = 200
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'UpdateAllMethodSignaturesCheckBox' Caption = 'UpdateAllMethodSignaturesCheckBox'
TabOrder = 6 TabOrder = 3
end end
end end

View File

@ -33,6 +33,8 @@ type
{ TCodetoolsClassCompletionOptionsFrame } { TCodetoolsClassCompletionOptionsFrame }
TCodetoolsClassCompletionOptionsFrame = class(TAbstractIDEOptionsEditor) TCodetoolsClassCompletionOptionsFrame = class(TAbstractIDEOptionsEditor)
SetPropertyVariableIsPrefixCheckBox: TCheckBox;
SetPropertyVariableUseConstCheckBox: TCheckBox;
ClassHeaderCommentsCheckBox: TCheckBox; ClassHeaderCommentsCheckBox: TCheckBox;
ClassImplementationCommentsCheckBox: TCheckBox; ClassImplementationCommentsCheckBox: TCheckBox;
ClassPartInsertPolicyRadioGroup: TRadioGroup; ClassPartInsertPolicyRadioGroup: TRadioGroup;
@ -108,6 +110,12 @@ begin
PropertyStoredIdentPostfixLabel.Caption:=dlgCDTStoredPostfix; PropertyStoredIdentPostfixLabel.Caption:=dlgCDTStoredPostfix;
PrivateVariablePrefixLabel.Caption:=dlgCDTVariablePrefix; PrivateVariablePrefixLabel.Caption:=dlgCDTVariablePrefix;
SetPropertyVariablenameLabel.Caption:=dlgSetPropertyVariable; SetPropertyVariablenameLabel.Caption:=dlgSetPropertyVariable;
SetPropertyVariablenameLabel.Hint:=dlgSetPropertyVariableHint;
SetPropertyVariablenameEdit.Hint:=SetPropertyVariablenameLabel.Hint;
SetPropertyVariableIsPrefixCheckBox.Caption:=dlgSetPropertyVariableIsPrefix;
SetPropertyVariableIsPrefixCheckBox.Hint:=dlgSetPropertyVariableIsPrefixHint;
SetPropertyVariableUseConstCheckBox.Caption:=dlgSetPropertyVariableUseConst;
SetPropertyVariableUseConstCheckBox.Hint:=dlgSetPropertyVariableUseConstHint;
end; end;
procedure TCodetoolsClassCompletionOptionsFrame.ReadSettings( procedure TCodetoolsClassCompletionOptionsFrame.ReadSettings(
@ -143,6 +151,8 @@ begin
PropertyStoredIdentPostfixEdit.Text := PropertyStoredIdentPostfix; PropertyStoredIdentPostfixEdit.Text := PropertyStoredIdentPostfix;
PrivateVariablePrefixEdit.Text := PrivateVariablePrefix; PrivateVariablePrefixEdit.Text := PrivateVariablePrefix;
SetPropertyVariablenameEdit.Text := SetPropertyVariablename; SetPropertyVariablenameEdit.Text := SetPropertyVariablename;
SetPropertyVariableIsPrefixCheckBox.Checked := SetPropertyVariableIsPrefix;
SetPropertyVariableUseConstCheckBox.Checked := SetPropertyVariableUseConst;
end; end;
end; end;
@ -178,6 +188,8 @@ begin
ReadIdentifier(PrivateVariablePrefixEdit.Text,'F'); ReadIdentifier(PrivateVariablePrefixEdit.Text,'F');
SetPropertyVariablename := SetPropertyVariablename :=
ReadIdentifier(SetPropertyVariablenameEdit.Text,'AValue'); ReadIdentifier(SetPropertyVariablenameEdit.Text,'AValue');
SetPropertyVariableIsPrefix := SetPropertyVariableIsPrefixCheckBox.Checked;
SetPropertyVariableUseConst := SetPropertyVariableUseConstCheckBox.Checked;
end; end;
end; end;

View File

@ -2100,6 +2100,11 @@ resourcestring
dlgCDTStoredPostfix = 'Stored postfix'; dlgCDTStoredPostfix = 'Stored postfix';
dlgCDTVariablePrefix = 'Variable prefix'; dlgCDTVariablePrefix = 'Variable prefix';
dlgSetPropertyVariable = 'Set property Variable'; 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:'; dlgMaxLineLength = 'Max line length:';
dlgNotSplitLineFront = 'Do not split line in front of'; dlgNotSplitLineFront = 'Do not split line in front of';
dlgNotSplitLineAfter = 'Do not split line after'; dlgNotSplitLineAfter = 'Do not split line after';