Jedi code format: new indent options for case labels and interface guid.

I borrowed the features and some code from https://github.com/quadroid/jcf-pascal-format
This commit is contained in:
DomingoGP 2024-09-14 10:02:30 +02:00
parent 930797ee74
commit f7293e2477
21 changed files with 241 additions and 64 deletions

View File

@ -32,9 +32,11 @@
<KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef> <KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef>
<KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere> <KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere>
<IndentElse> False </IndentElse> <IndentElse> False </IndentElse>
<IndentCaseLabels> True </IndentCaseLabels>
<IndentCaseElse> True </IndentCaseElse> <IndentCaseElse> True </IndentCaseElse>
<IndentNestedTypes> False </IndentNestedTypes> <IndentNestedTypes> False </IndentNestedTypes>
<IndentVarAndConstInClass> False </IndentVarAndConstInClass> <IndentVarAndConstInClass> False </IndentVarAndConstInClass>
<IndentInterfaceGuid> True </IndentInterfaceGuid>
</Indent> </Indent>
<Spaces> <Spaces>
<TabsToSpaces> True </TabsToSpaces> <TabsToSpaces> True </TabsToSpaces>

View File

@ -107,10 +107,12 @@ resourcestring
+'comments with code elsewhere'; +'comments with code elsewhere';
lisIndentExtraIndentForIfElseBlocks = 'Extra Indent for If...Else blocks'; lisIndentExtraIndentForIfElseBlocks = 'Extra Indent for If...Else blocks';
lisIndentExtraIndentForCaseElseBlocks = 'Extra Indent for Case...Else blocks'; lisIndentExtraIndentForCaseElseBlocks = 'Extra Indent for Case...Else blocks';
lisIndentExtraIndentForCaseLabels = 'Extra Indent for Case labels';
lisIndentIndentForProceduresInLibrary = 'Indent for procedures in program/library'; lisIndentIndentForProceduresInLibrary = 'Indent for procedures in program/library';
lisIndentIndentForProcedureBody = 'Indent for procedure body'; lisIndentIndentForProcedureBody = 'Indent for procedure body';
lisIndentIndentNestedTypes = 'Indent nested types'; lisIndentIndentNestedTypes = 'Indent nested types';
lisIndentIndentVarAndConstInClass = 'Indent var and const in class'; lisIndentIndentVarAndConstInClass = 'Indent var and const in class';
lisIndentExtraIndentForInterfaceGuid = 'Extra Indent for interface guid';
//Blank lines tab //Blank lines tab
lisBLBlankLines = 'Blank Lines'; lisBLBlankLines = 'Blank Lines';

View File

@ -648,10 +648,18 @@ msgstr ""
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "" msgstr ""

View File

@ -649,10 +649,18 @@ msgstr "Zusätzliche Einrückung für Begin/End in Prozeduren"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Zusätzliche Einrückung bei Case..Else-Blöcken" msgstr "Zusätzliche Einrückung bei Case..Else-Blöcken"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Zusätzliche Einrückung bei If..Else-Blöcken" msgstr "Zusätzliche Einrückung bei If..Else-Blöcken"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Einrückung" msgstr "Einrückung"

View File

@ -644,10 +644,18 @@ msgstr ""
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "" msgstr ""

View File

@ -650,10 +650,18 @@ msgstr "Retrait supplémentaire pour \"begin/end\" dans les procédures"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Retrait supplémentaire dans les blocs \"Case...Else\"" msgstr "Retrait supplémentaire dans les blocs \"Case...Else\""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Retrait supplémentaire pour les blocs \"If...Else\"" msgstr "Retrait supplémentaire pour les blocs \"If...Else\""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Indentation" msgstr "Indentation"

View File

@ -651,10 +651,18 @@ msgstr "Extra behúzás a begin/end számára eljárásokban"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Extra behúzás a Case...Else számára" msgstr "Extra behúzás a Case...Else számára"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Extra behúzás az If...Else számára" msgstr "Extra behúzás az If...Else számára"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Behúzás" msgstr "Behúzás"

View File

@ -651,10 +651,18 @@ msgstr "Indentazione extra per begin/end all'interno delle procedure"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Indentazione extra per blocchi Case...Else" msgstr "Indentazione extra per blocchi Case...Else"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Indentazione extra per blocchi If...Else" msgstr "Indentazione extra per blocchi If...Else"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Indentazione" msgstr "Indentazione"

View File

@ -650,10 +650,18 @@ msgstr "手続き内での begin/end にインデントを追加する"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "case...else ブロックにインデントを追加する" msgstr "case...else ブロックにインデントを追加する"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "if...else ブロックにインデントを追加する" msgstr "if...else ブロックにインデントを追加する"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "インデント" msgstr "インデント"

View File

@ -650,10 +650,18 @@ msgstr "Papildoma „begin“/„end“ įtrauka procedūrų viduje"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Papildoma „Case...Else“ blokų įtrauka" msgstr "Papildoma „Case...Else“ blokų įtrauka"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Papildoma „If...Else“ blokų įtrauką" msgstr "Papildoma „If...Else“ blokų įtrauką"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Įtrauka" msgstr "Įtrauka"

View File

@ -650,10 +650,18 @@ msgstr ""
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "" msgstr ""

View File

@ -628,10 +628,18 @@ msgstr ""
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "" msgstr ""

View File

@ -650,10 +650,18 @@ msgstr "Identação extra para \"begin/end\" dentro de procedimento"
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Identação extra para blocos \"Case...Else\"" msgstr "Identação extra para blocos \"Case...Else\""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Identação extra para blocos \"If...Else\"" msgstr "Identação extra para blocos \"If...Else\""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Identação" msgstr "Identação"

View File

@ -642,10 +642,18 @@ msgstr "Дополнительный отступ для begin/end в проце
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Дополнительный отступ для блоков Case...Else" msgstr "Дополнительный отступ для блоков Case...Else"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Дополнительный отступ для блоков If...Else" msgstr "Дополнительный отступ для блоков If...Else"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Отступы" msgstr "Отступы"

View File

@ -653,10 +653,18 @@ msgstr "Додатковий відступ для begin/end в процедур
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "Додатковий відступ для блоків Case...Else" msgstr "Додатковий відступ для блоків Case...Else"
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "Додатковий відступ для блоків If...Else" msgstr "Додатковий відступ для блоків If...Else"
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "Відступи" msgstr "Відступи"

View File

@ -650,10 +650,18 @@ msgstr ""
msgid "Extra Indent for Case...Else blocks" msgid "Extra Indent for Case...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforcaselabels
msgid "Extra Indent for Case labels"
msgstr ""
#: jcfuiconsts.lisindentextraindentforifelseblocks #: jcfuiconsts.lisindentextraindentforifelseblocks
msgid "Extra Indent for If...Else blocks" msgid "Extra Indent for If...Else blocks"
msgstr "" msgstr ""
#: jcfuiconsts.lisindentextraindentforinterfaceguid
msgid "Extra Indent for interface guid"
msgstr ""
#: jcfuiconsts.lisindentindentation #: jcfuiconsts.lisindentindentation
msgid "Indentation" msgid "Indentation"
msgstr "缩进(Indentation)" msgstr "缩进(Indentation)"

View File

@ -467,6 +467,11 @@ begin
if IsRunOnProcDecl(pt) then if IsRunOnProcDecl(pt) then
Inc(liIndentCount); Inc(liIndentCount);
// decrease ident for interface guid
if (not FormattingSettings.Indent.IndentInterfaceGuid) and
(pt.TokenType = ttOpenSquareBracket) and pt.HasParentNode(nInterfaceType, 2) then
Dec(liIndentCount);
lbHasIndentedDecl := True; lbHasIndentedDecl := True;
liClassNestingCount := CountClassNesting(pt); liClassNestingCount := CountClassNesting(pt);
@ -577,13 +582,16 @@ begin
if pt.Nestings.GetLevel(nlCaseSelector) > 0 then if pt.Nestings.GetLevel(nlCaseSelector) > 0 then
begin begin
liIndentCount := liIndentCount + pt.Nestings.GetLevel(nlCaseSelector); liIndentCount := liIndentCount + pt.Nestings.GetLevel(nlCaseSelector);
//labels on the same level as `case` statement
if (liIndentCount > 0) and (not FormattingSettings.Indent.IndentCaseLabels) then
Dec(liIndentCount);
// don't indent the case label again // don't indent the case label again
if pt.HasParentNode(nCaseLabel, 6) then if pt.HasParentNode(nCaseLabel, 6) then
Dec(liIndentCount) Dec(liIndentCount)
else if (pt.TokenType in [ttElse, ttOtherwise]) and pt.HasParentNode(nElseCase, 1) then else if (pt.TokenType in [ttElse, ttOtherwise]) and pt.HasParentNode(nElseCase, 1) then
Dec(liIndentCount); Dec(liIndentCount);
if not FormattingSettings.Indent.IndentCaseElse then if (not FormattingSettings.Indent.IndentCaseElse) and FormattingSettings.Indent.IndentCaseLabels then
begin begin
liIndentCount := liIndentCount - pt.CountParentNodes(nElseCase); liIndentCount := liIndentCount - pt.CountParentNodes(nElseCase);
end; end;

View File

@ -50,9 +50,11 @@ type
fbKeepCommentsWithCodeInClassDef: boolean; fbKeepCommentsWithCodeInClassDef: boolean;
fbKeepCommentsWithCodeElsewhere: boolean; fbKeepCommentsWithCodeElsewhere: boolean;
fbIndentElse: Boolean; fbIndentElse: Boolean;
fbIndentCaseLabels: Boolean;
fbIndentCaseElse: Boolean; fbIndentCaseElse: Boolean;
fbIndentNestedTypes: Boolean; fbIndentNestedTypes: Boolean;
fbIndentVarAndConstInClass: Boolean; fbIndentVarAndConstInClass: Boolean;
fbIndentInterfaceGuid: boolean;
protected protected
public public
@ -85,7 +87,9 @@ type
Read fbKeepCommentsWithCodeElsewhere Write fbKeepCommentsWithCodeElsewhere; Read fbKeepCommentsWithCodeElsewhere Write fbKeepCommentsWithCodeElsewhere;
property IndentElse: boolean read fbIndentElse write fbIndentElse; property IndentElse: boolean read fbIndentElse write fbIndentElse;
property IndentCaseLabels: boolean read fbIndentCaseLabels write fbIndentCaseLabels;
property IndentCaseElse: boolean read fbIndentCaseElse write fbIndentCaseElse; property IndentCaseElse: boolean read fbIndentCaseElse write fbIndentCaseElse;
property IndentInterfaceGuid: boolean read fbIndentInterfaceGuid write fbIndentInterfaceGuid;
property IndentNestedTypes: Boolean read fbIndentNestedTypes write fbIndentNestedTypes; property IndentNestedTypes: Boolean read fbIndentNestedTypes write fbIndentNestedTypes;
property IndentVarAndConstInClass: Boolean read fbIndentVarAndConstInClass write fbIndentVarAndConstInClass; property IndentVarAndConstInClass: Boolean read fbIndentVarAndConstInClass write fbIndentVarAndConstInClass;
@ -111,9 +115,11 @@ const
REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE = 'KeepCommentsWithCodeElsewhere'; REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE = 'KeepCommentsWithCodeElsewhere';
REG_INDENT_ELSE = 'IndentElse'; REG_INDENT_ELSE = 'IndentElse';
REG_INDENT_CASE_LABELS = 'IndentCaseLabels';
REG_INDENT_CASE_ELSE = 'IndentCaseElse'; REG_INDENT_CASE_ELSE = 'IndentCaseElse';
REG_INDENT_VAR_AND_CONST_IN_CLASS = 'IndentVarAndConstInClass'; REG_INDENT_VAR_AND_CONST_IN_CLASS = 'IndentVarAndConstInClass';
REG_INDENT_NESTED_TYPES = 'IndentNestedTypes'; REG_INDENT_NESTED_TYPES = 'IndentNestedTypes';
REG_INDENT_INTERFACE_GUID = 'IndentInterfaceGuid';
constructor TSetIndent.Create; constructor TSetIndent.Create;
begin begin
@ -146,10 +152,13 @@ begin
pcStream.Read(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, True); pcStream.Read(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, True);
fbIndentElse := pcStream.Read(REG_INDENT_ELSE, False); fbIndentElse := pcStream.Read(REG_INDENT_ELSE, False);
fbIndentCaseLabels := pcStream.Read(REG_INDENT_CASE_LABELS, True);
fbIndentCaseElse := pcStream.Read(REG_INDENT_CASE_ELSE, True); fbIndentCaseElse := pcStream.Read(REG_INDENT_CASE_ELSE, True);
fbIndentNestedTypes := pcStream.Read(REG_INDENT_NESTED_TYPES, False); fbIndentNestedTypes := pcStream.Read(REG_INDENT_NESTED_TYPES, False);
fbIndentVarAndConstInClass := pcStream.Read(REG_INDENT_VAR_AND_CONST_IN_CLASS, False); fbIndentVarAndConstInClass := pcStream.Read(REG_INDENT_VAR_AND_CONST_IN_CLASS, False);
fbIndentInterfaceGuid := pcStream.Read(REG_INDENT_INTERFACE_GUID, True);
end; end;
procedure TSetIndent.WriteToStream(const pcOut: TSettingsOutput); procedure TSetIndent.WriteToStream(const pcOut: TSettingsOutput);
@ -173,10 +182,12 @@ begin
pcOut.Write(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, fbKeepCommentsWithCodeElsewhere); pcOut.Write(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, fbKeepCommentsWithCodeElsewhere);
pcOut.Write(REG_INDENT_ELSE, fbIndentElse); pcOut.Write(REG_INDENT_ELSE, fbIndentElse);
pcOut.Write(REG_INDENT_CASE_LABELS, fbIndentCaseLabels);
pcOut.Write(REG_INDENT_CASE_ELSE, fbIndentCaseElse); pcOut.Write(REG_INDENT_CASE_ELSE, fbIndentCaseElse);
pcOut.Write(REG_INDENT_NESTED_TYPES, fbIndentNestedTypes); pcOut.Write(REG_INDENT_NESTED_TYPES, fbIndentNestedTypes);
pcOut.Write(REG_INDENT_VAR_AND_CONST_IN_CLASS, fbIndentVarAndConstInClass); pcOut.Write(REG_INDENT_VAR_AND_CONST_IN_CLASS, fbIndentVarAndConstInClass);
pcOut.Write(REG_INDENT_INTERFACE_GUID, fbIndentInterfaceGuid);
end; end;
function TSetIndent.SpacesForIndentLevel(const piLevel: integer): integer; function TSetIndent.SpacesForIndentLevel(const piLevel: integer): integer;

View File

@ -32,9 +32,11 @@
<KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef> <KeepCommentsWithCodeInClassDef> True </KeepCommentsWithCodeInClassDef>
<KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere> <KeepCommentsWithCodeElsewhere> True </KeepCommentsWithCodeElsewhere>
<IndentElse> False </IndentElse> <IndentElse> False </IndentElse>
<IndentCaseLabels> True </IndentCaseLabels>
<IndentCaseElse> True </IndentCaseElse> <IndentCaseElse> True </IndentCaseElse>
<IndentNestedTypes> True </IndentNestedTypes> <IndentNestedTypes> True </IndentNestedTypes>
<IndentVarAndConstInClass> True </IndentVarAndConstInClass> <IndentVarAndConstInClass> True </IndentVarAndConstInClass>
<IndentInterfaceGuid> True </IndentInterfaceGuid>
</Indent> </Indent>
<Spaces> <Spaces>
<TabsToSpaces> True </TabsToSpaces> <TabsToSpaces> True </TabsToSpaces>

View File

@ -1,36 +1,38 @@
inherited fClarifyIndent: TfClarifyIndent object fClarifyIndent: TfClarifyIndent
Height = 347 Left = 0
Height = 426
Top = 0
Width = 430 Width = 430
ClientHeight = 347 ClientHeight = 426
ClientWidth = 430 ClientWidth = 430
TabOrder = 0 TabOrder = 0
DesignLeft = 737 DesignLeft = 737
DesignTop = 299 DesignTop = 299
object Label2: TLabel[0] object Label2: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = edtIndentSpaces AnchorSideTop.Control = edtIndentSpaces
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 14 Height = 15
Top = 9 Top = 10
Width = 118 Width = 131
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'Block indentation spaces' Caption = 'Block indentation spaces'
ParentColor = False ParentColor = False
end end
object edtIndentSpaces: TSpinEdit[1] object edtIndentSpaces: TSpinEdit
AnchorSideLeft.Control = Label2 AnchorSideLeft.Control = Label2
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 130 Left = 143
Height = 21 Height = 23
Top = 6 Top = 6
Width = 50 Width = 50
BorderSpacing.Around = 6 BorderSpacing.Around = 6
MaxValue = 12 MaxValue = 12
TabOrder = 0 TabOrder = 0
end end
object gbOptions: TGroupBox[2] object gbOptions: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = edtIndentSpaces AnchorSideTop.Control = edtIndentSpaces
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
@ -39,35 +41,35 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 308 Height = 385
Top = 33 Top = 35
Width = 418 Width = 418
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Options' Caption = 'Options'
ClientHeight = 308 ClientHeight = 365
ClientWidth = 418 ClientWidth = 414
TabOrder = 1 TabOrder = 1
object cbIndentBeginEnd: TCheckBox object cbIndentBeginEnd: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = eIndentBeginEndSpaces AnchorSideTop.Control = eIndentBeginEndSpaces
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 17 Height = 19
Top = 8 Top = 8
Width = 232 Width = 252
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Extra indent for begin/end inside procedures' Caption = 'Extra indent for begin/end inside procedures'
OnClick = cbIndentBeginEndClick
TabOrder = 0 TabOrder = 0
OnClick = cbIndentBeginEndClick
end end
object eIndentBeginEndSpaces: TSpinEdit object eIndentBeginEndSpaces: TSpinEdit
AnchorSideTop.Control = gbOptions AnchorSideTop.Control = gbOptions
AnchorSideRight.Control = gbOptions AnchorSideRight.Control = gbOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 348 Left = 344
Height = 21 Height = 23
Top = 6 Top = 6
Width = 50 Width = 50
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@ -82,23 +84,23 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = eFirstLevelIndent AnchorSideTop.Control = eFirstLevelIndent
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
Left = 6 Left = 6
Height = 17 Height = 19
Top = 35 Top = 37
Width = 158 Width = 169
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Different indent for first level' Caption = 'Different indent for first level'
OnClick = cbHasFirstLevelIndentClick
TabOrder = 2 TabOrder = 2
OnClick = cbHasFirstLevelIndentClick
end end
object eFirstLevelIndent: TSpinEdit object eFirstLevelIndent: TSpinEdit
AnchorSideTop.Control = eIndentBeginEndSpaces AnchorSideTop.Control = eIndentBeginEndSpaces
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = gbOptions AnchorSideRight.Control = gbOptions
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 348 Left = 344
Height = 21 Height = 23
Top = 33 Top = 35
Width = 50 Width = 50
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -110,9 +112,9 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = cbHasFirstLevelIndent AnchorSideTop.Control = cbHasFirstLevelIndent
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 58 Top = 62
Width = 260 Width = 292
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -125,9 +127,9 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = cbKeepWithInProc AnchorSideTop.Control = cbKeepWithInProc
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 81 Top = 87
Width = 239 Width = 271
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -140,9 +142,9 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = cbKeepWithInGlobals AnchorSideTop.Control = cbKeepWithInGlobals
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 104 Top = 112
Width = 281 Width = 317
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -155,9 +157,9 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = cbKeepWithInClassDef AnchorSideTop.Control = cbKeepWithInClassDef
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 127 Top = 137
Width = 244 Width = 272
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -170,9 +172,9 @@ inherited fClarifyIndent: TfClarifyIndent
AnchorSideTop.Control = cbKeepWithElsewhere AnchorSideTop.Control = cbKeepWithElsewhere
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 150 Top = 162
Width = 170 Width = 174
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
@ -182,78 +184,108 @@ inherited fClarifyIndent: TfClarifyIndent
end end
object cbIndentCaseElse: TCheckBox object cbIndentCaseElse: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentIfElse AnchorSideTop.Control = cbIndentCaseLabels
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 173 Top = 212
Width = 186 Width = 192
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Extra Indent for Case...Else blocks' Caption = 'Extra Indent for Case...Else blocks'
TabOrder = 9 TabOrder = 10
end end
object cbIndentLibraryProcs: TCheckBox object cbIndentLibraryProcs: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentCaseElse AnchorSideTop.Control = cbIndentCaseElse
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 196 Top = 237
Width = 168 Width = 181
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Indent for procedures in library' Caption = 'Indent for procedures in library'
TabOrder = 10 TabOrder = 11
end end
object cbIndentProcedureBody: TCheckBox object cbIndentProcedureBody: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentLibraryProcs AnchorSideTop.Control = cbIndentLibraryProcs
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 219 Top = 262
Width = 146 Width = 157
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Indent for procedure body' Caption = 'Indent for procedure body'
TabOrder = 11 TabOrder = 12
end end
object cbIndentNestedTypes: TCheckBox object cbIndentNestedTypes: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentProcedureBody AnchorSideTop.Control = cbIndentProcedureBody
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 242 Top = 287
Width = 116 Width = 121
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Indent nested types' Caption = 'Indent nested types'
TabOrder = 12 TabOrder = 13
end end
object cbIndentVarAndConstInClass: TCheckBox object cbIndentVarAndConstInClass: TCheckBox
AnchorSideLeft.Control = gbOptions AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentNestedTypes AnchorSideTop.Control = cbIndentNestedTypes
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 17 Height = 19
Top = 265 Top = 312
Width = 156 Width = 167
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Top = 6 BorderSpacing.Top = 6
BorderSpacing.Right = 6 BorderSpacing.Right = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'Indent var and const in class' Caption = 'Indent var and const in class'
TabOrder = 13 TabOrder = 14
end
object cbIndentCaseLabels: TCheckBox
AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentIfElse
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 187
Width = 157
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'Extra Indent for case labels'
TabOrder = 9
end
object cbIndentInterfaceGuid: TCheckBox
AnchorSideLeft.Control = gbOptions
AnchorSideTop.Control = cbIndentVarAndConstInClass
AnchorSideTop.Side = asrBottom
Left = 6
Height = 19
Top = 337
Width = 174
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
Caption = 'Extra Indent for interface guid'
TabOrder = 15
end end
end end
end end

View File

@ -38,6 +38,8 @@ type
{ TfClarifyIndent } { TfClarifyIndent }
TfClarifyIndent = class(TAbstractIDEOptionsEditor) TfClarifyIndent = class(TAbstractIDEOptionsEditor)
cbIndentCaseLabels: TCheckBox;
cbIndentInterfaceGuid: TCheckBox;
Label2: TLabel; Label2: TLabel;
edtIndentSpaces: TSpinEdit; edtIndentSpaces: TSpinEdit;
gbOptions: TGroupBox; gbOptions: TGroupBox;
@ -100,10 +102,12 @@ begin
lisIndentKeepSingleLineCommentsWithCodeElsewhere; lisIndentKeepSingleLineCommentsWithCodeElsewhere;
cbIndentIfElse.Caption := lisIndentExtraIndentForIfElseBlocks; cbIndentIfElse.Caption := lisIndentExtraIndentForIfElseBlocks;
cbIndentCaseElse.Caption := lisIndentExtraIndentForCaseElseBlocks; cbIndentCaseElse.Caption := lisIndentExtraIndentForCaseElseBlocks;
cbIndentCaseLabels.Caption := lisIndentExtraIndentForCaseLabels;
cbIndentLibraryProcs.Caption := lisIndentIndentForProceduresInLibrary; cbIndentLibraryProcs.Caption := lisIndentIndentForProceduresInLibrary;
cbIndentProcedureBody.Caption := lisIndentIndentForProcedureBody; cbIndentProcedureBody.Caption := lisIndentIndentForProcedureBody;
cbIndentNestedTypes.Caption := lisIndentIndentNestedTypes; cbIndentNestedTypes.Caption := lisIndentIndentNestedTypes;
cbIndentVarAndConstInClass.Caption := lisIndentIndentVarAndConstInClass; cbIndentVarAndConstInClass.Caption := lisIndentIndentVarAndConstInClass;
cbIndentInterfaceGuid.Caption := lisIndentExtraIndentForInterfaceGuid;
end; end;
{------------------------------------------------------------------------------- {-------------------------------------------------------------------------------
@ -127,11 +131,13 @@ begin
cbKeepWithInClassDef.Checked := KeepCommentsWithCodeInClassDef; cbKeepWithInClassDef.Checked := KeepCommentsWithCodeInClassDef;
cbKeepWithElsewhere.Checked := KeepCommentsWithCodeElsewhere; cbKeepWithElsewhere.Checked := KeepCommentsWithCodeElsewhere;
cbIndentIfElse.Checked := IndentElse; cbIndentIfElse.Checked := IndentElse;
cbIndentCaseLabels.Checked := IndentCaseLabels;
cbIndentCaseElse.Checked := IndentCaseElse; cbIndentCaseElse.Checked := IndentCaseElse;
cbIndentProcedureBody.Checked := IndentProcedureBody; cbIndentProcedureBody.Checked := IndentProcedureBody;
cbIndentNestedTypes.Checked := IndentNestedTypes; cbIndentNestedTypes.Checked := IndentNestedTypes;
cbIndentVarAndConstInClass.Checked := IndentVarAndConstInClass; cbIndentVarAndConstInClass.Checked := IndentVarAndConstInClass;
cbIndentInterfaceGuid.Checked := IndentInterfaceGuid;
end; end;
cbIndentBeginEndClick(nil); cbIndentBeginEndClick(nil);
@ -157,11 +163,13 @@ begin
KeepCommentsWithCodeInClassDef := cbKeepWithInClassDef.Checked; KeepCommentsWithCodeInClassDef := cbKeepWithInClassDef.Checked;
KeepCommentsWithCodeElsewhere := cbKeepWithElsewhere.Checked; KeepCommentsWithCodeElsewhere := cbKeepWithElsewhere.Checked;
IndentElse := cbIndentIfElse.Checked; IndentElse := cbIndentIfElse.Checked;
IndentCaseLabels := cbIndentCaseLabels.Checked;
IndentCaseElse := cbIndentCaseElse.Checked; IndentCaseElse := cbIndentCaseElse.Checked;
IndentProcedureBody := cbIndentProcedureBody.Checked; IndentProcedureBody := cbIndentProcedureBody.Checked;
IndentNestedTypes := cbIndentNestedTypes.Checked; IndentNestedTypes := cbIndentNestedTypes.Checked;
IndentVarAndConstInClass := cbIndentVarAndConstInClass.Checked; IndentVarAndConstInClass := cbIndentVarAndConstInClass.Checked;
IndentInterfaceGuid := cbIndentInterfaceGuid.Checked;
end; end;
end; end;