codetools: added policy for uses additions

git-svn-id: trunk@19779 -
This commit is contained in:
mattias 2009-05-03 10:34:33 +00:00
parent dfe1e5a3cf
commit 018eab6b38
2 changed files with 28 additions and 13 deletions

View File

@ -195,23 +195,23 @@ type
read FOnSearchUsedUnit write FOnSearchUsedUnit;
// initializing single codetools
function GetCodeToolForSource(Code: TCodeBuffer;
GoToMainCode, ExceptionOnError: boolean): TCustomCodeTool;
function FindCodeToolForSource(Code: TCodeBuffer): TCustomCodeTool;
property CurCodeTool: TCodeTool read FCurCodeTool;
procedure ClearCurCodeTool;
function InitCurCodeTool(Code: TCodeBuffer): boolean;
function InitResourceTool: boolean;
procedure ClearPositions;
function GetCodeToolForSource(Code: TCodeBuffer;
GoToMainCode, ExceptionOnError: boolean): TCustomCodeTool;
// initializing single compilerdirectivestrees
function FindDirectivesToolForSource(Code: TCodeBuffer
): TDirectivesTool;
function GetDirectivesToolForSource(Code: TCodeBuffer;
ExceptionOnError: boolean): TCompilerDirectivesTree;
property CurDirectivesTool: TDirectivesTool read FCurDirectivesTool;
procedure ClearCurDirectivesTool;
function InitCurDirectivesTool(Code: TCodeBuffer): boolean;
function GetDirectivesToolForSource(Code: TCodeBuffer;
ExceptionOnError: boolean): TCompilerDirectivesTree;
function FindDirectivesToolForSource(Code: TCodeBuffer
): TDirectivesTool;
// exception handling
procedure ClearError;

View File

@ -68,6 +68,15 @@ type
fpipBehindMethods
);
// where to add new units to a uses section
TUsesInsertPolicy = (
uipFirst,
uipInFrontOfRelated, // related = shortest relative file path (#directory changes)
uipBehindRelated,
uipLast,
uipAlphabetically
);
TWordPolicy = (wpNone, wpLowerCase, wpUpperCase, wpLowerCaseFirstLetterUp);
TAtomType = (atNone, atKeyword, atIdentifier, atColon, atSemicolon, atComma,
atPoint, atAt, atNumber, atStringConstant, atNewLine,
@ -103,12 +112,6 @@ type
LineEnd: string; // default: #13#10
Indent: integer;
TabWidth: integer;
ClassPartInsertPolicy: TClassPartInsertPolicy;
MixMethodsAndProperties: boolean;
MethodInsertPolicy: TMethodInsertPolicy;
ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy;
KeepForwardProcOrder: boolean;
ClassHeaderComments: boolean;
KeyWordPolicy: TWordPolicy;
IdentifierPolicy: TWordPolicy;
DoNotSplitLineInFront: TAtomTypes;
@ -117,10 +120,21 @@ type
DoInsertSpaceAfter: TAtomTypes;
DoNotInsertSpaceInFront: TAtomTypes;
DoNotInsertSpaceAfter: TAtomTypes;
// procedures
ForwardProcBodyInsertPolicy: TForwardProcBodyInsertPolicy;
KeepForwardProcOrder: boolean;
// classes, methods, properties
ClassHeaderComments: boolean;
ClassPartInsertPolicy: TClassPartInsertPolicy;
MixMethodsAndProperties: boolean;
MethodInsertPolicy: TMethodInsertPolicy;
PropertyReadIdentPrefix: string;
PropertyWriteIdentPrefix: string;
PropertyStoredIdentPostfix: string;
PrivateVariablePrefix: string;
// uses section
UsesInsertPolicy: TUsesInsertPolicy;
CurFlags: TBeautifyCodeFlags;
NestedComments: boolean;
@ -971,6 +985,7 @@ begin
PropertyWriteIdentPrefix:='Set';
PropertyStoredIdentPostfix:='IsStored';
PrivateVariablePrefix:='f';
UsesInsertPolicy:=uipInFrontOfRelated;
NestedComments:=true;
end;