From f7293e2477eb16f5441df4724a47edcc10acfc21 Mon Sep 17 00:00:00 2001 From: DomingoGP Date: Sat, 14 Sep 2024 10:02:30 +0200 Subject: [PATCH] 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 --- .../jcf2/CommandLine/Lazarus/jcfsettings.cfg | 2 + .../jcf2/IdePlugin/lazarus/jcfuiconsts.pas | 2 + .../lazarus/languages/jcfuiconsts.cs.po | 8 + .../lazarus/languages/jcfuiconsts.de.po | 8 + .../lazarus/languages/jcfuiconsts.es.po | 8 + .../lazarus/languages/jcfuiconsts.fr.po | 8 + .../lazarus/languages/jcfuiconsts.hu.po | 8 + .../lazarus/languages/jcfuiconsts.it.po | 8 + .../lazarus/languages/jcfuiconsts.ja.po | 8 + .../lazarus/languages/jcfuiconsts.lt.po | 8 + .../lazarus/languages/jcfuiconsts.pl.po | 8 + .../lazarus/languages/jcfuiconsts.pot | 8 + .../lazarus/languages/jcfuiconsts.pt_BR.po | 8 + .../lazarus/languages/jcfuiconsts.ru.po | 8 + .../lazarus/languages/jcfuiconsts.uk.po | 8 + .../lazarus/languages/jcfuiconsts.zh_CN.po | 8 + components/jcf2/Process/Indent/Indenter.pas | 10 +- components/jcf2/Settings/SetIndent.pas | 11 ++ .../jcf2/TestApplication/JCFSettings.cfg | 2 + .../jcf2/Ui/Settings/frClarifyIndent.lfm | 158 +++++++++++------- .../jcf2/Ui/Settings/frClarifyIndent.pas | 8 + 21 files changed, 241 insertions(+), 64 deletions(-) diff --git a/components/jcf2/CommandLine/Lazarus/jcfsettings.cfg b/components/jcf2/CommandLine/Lazarus/jcfsettings.cfg index bf653c7b4b..b3382ae61a 100644 --- a/components/jcf2/CommandLine/Lazarus/jcfsettings.cfg +++ b/components/jcf2/CommandLine/Lazarus/jcfsettings.cfg @@ -32,9 +32,11 @@ True True False + True True False False + True True diff --git a/components/jcf2/IdePlugin/lazarus/jcfuiconsts.pas b/components/jcf2/IdePlugin/lazarus/jcfuiconsts.pas index 35909fb764..fe9b5e0b3b 100644 --- a/components/jcf2/IdePlugin/lazarus/jcfuiconsts.pas +++ b/components/jcf2/IdePlugin/lazarus/jcfuiconsts.pas @@ -107,10 +107,12 @@ resourcestring +'comments with code elsewhere'; lisIndentExtraIndentForIfElseBlocks = 'Extra Indent for If...Else blocks'; lisIndentExtraIndentForCaseElseBlocks = 'Extra Indent for Case...Else blocks'; + lisIndentExtraIndentForCaseLabels = 'Extra Indent for Case labels'; lisIndentIndentForProceduresInLibrary = 'Indent for procedures in program/library'; lisIndentIndentForProcedureBody = 'Indent for procedure body'; lisIndentIndentNestedTypes = 'Indent nested types'; lisIndentIndentVarAndConstInClass = 'Indent var and const in class'; + lisIndentExtraIndentForInterfaceGuid = 'Extra Indent for interface guid'; //Blank lines tab lisBLBlankLines = 'Blank Lines'; diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.cs.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.cs.po index 42bd19ee09..891433b412 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.cs.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.cs.po @@ -648,10 +648,18 @@ msgstr "" msgid "Extra Indent for Case...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.de.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.de.po index a2b03febec..615bb1831c 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.de.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.de.po @@ -649,10 +649,18 @@ msgstr "Zusätzliche Einrückung für Begin/End in Prozeduren" msgid "Extra Indent for Case...Else blocks" msgstr "Zusätzliche Einrückung bei Case..Else-Blöcken" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Zusätzliche Einrückung bei If..Else-Blöcken" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Einrückung" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.es.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.es.po index d9a18b0d2a..9db6d0d0a9 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.es.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.es.po @@ -644,10 +644,18 @@ msgstr "" msgid "Extra Indent for Case...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.fr.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.fr.po index b8c65eca6f..95b75488cd 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.fr.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.fr.po @@ -650,10 +650,18 @@ msgstr "Retrait supplémentaire pour \"begin/end\" dans les procédures" msgid "Extra Indent for Case...Else blocks" msgstr "Retrait supplémentaire dans les blocs \"Case...Else\"" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Retrait supplémentaire pour les blocs \"If...Else\"" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Indentation" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.hu.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.hu.po index 06f6bb1f54..cb2960eee1 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.hu.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.hu.po @@ -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" msgstr "Extra behúzás a Case...Else számára" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Extra behúzás az If...Else számára" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Behúzás" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.it.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.it.po index 481b5b2553..4e330aaf91 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.it.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.it.po @@ -651,10 +651,18 @@ msgstr "Indentazione extra per begin/end all'interno delle procedure" msgid "Extra Indent for Case...Else blocks" msgstr "Indentazione extra per blocchi Case...Else" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Indentazione extra per blocchi If...Else" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Indentazione" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ja.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ja.po index 360cedbecf..d4ad8c8858 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ja.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ja.po @@ -650,10 +650,18 @@ msgstr "手続き内での begin/end にインデントを追加する" msgid "Extra Indent for Case...Else blocks" msgstr "case...else ブロックにインデントを追加する" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "if...else ブロックにインデントを追加する" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "インデント" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.lt.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.lt.po index 6c6a4bace7..a420b345fd 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.lt.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.lt.po @@ -650,10 +650,18 @@ msgstr "Papildoma „begin“/„end“ įtrauka procedūrų viduje" msgid "Extra Indent for Case...Else blocks" msgstr "Papildoma „Case...Else“ blokų įtrauka" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Papildoma „If...Else“ blokų įtrauką" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Įtrauka" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pl.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pl.po index 8bfadc98a7..818ba3621b 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pl.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pl.po @@ -650,10 +650,18 @@ msgstr "" msgid "Extra Indent for Case...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pot b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pot index 649518bb25..2a1004e696 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pot +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pot @@ -628,10 +628,18 @@ msgstr "" msgid "Extra Indent for Case...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pt_BR.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pt_BR.po index 01990f8431..f5fdf85e61 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pt_BR.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.pt_BR.po @@ -650,10 +650,18 @@ msgstr "Identação extra para \"begin/end\" dentro de procedimento" msgid "Extra Indent for Case...Else blocks" msgstr "Identação extra para blocos \"Case...Else\"" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Identação extra para blocos \"If...Else\"" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Identação" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ru.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ru.po index dd759cae3f..38d73a0408 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ru.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.ru.po @@ -642,10 +642,18 @@ msgstr "Дополнительный отступ для begin/end в проце msgid "Extra Indent for Case...Else blocks" msgstr "Дополнительный отступ для блоков Case...Else" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Дополнительный отступ для блоков If...Else" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Отступы" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.uk.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.uk.po index 4a97cd0d99..f9048c07a7 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.uk.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.uk.po @@ -653,10 +653,18 @@ msgstr "Додатковий відступ для begin/end в процедур msgid "Extra Indent for Case...Else blocks" msgstr "Додатковий відступ для блоків Case...Else" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "Додатковий відступ для блоків If...Else" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "Відступи" diff --git a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.zh_CN.po b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.zh_CN.po index 36f4094c0d..559fddb1b1 100644 --- a/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.zh_CN.po +++ b/components/jcf2/IdePlugin/lazarus/languages/jcfuiconsts.zh_CN.po @@ -650,10 +650,18 @@ msgstr "" msgid "Extra Indent for Case...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforcaselabels +msgid "Extra Indent for Case labels" +msgstr "" + #: jcfuiconsts.lisindentextraindentforifelseblocks msgid "Extra Indent for If...Else blocks" msgstr "" +#: jcfuiconsts.lisindentextraindentforinterfaceguid +msgid "Extra Indent for interface guid" +msgstr "" + #: jcfuiconsts.lisindentindentation msgid "Indentation" msgstr "缩进(Indentation)" diff --git a/components/jcf2/Process/Indent/Indenter.pas b/components/jcf2/Process/Indent/Indenter.pas index b21c658fad..9dcf3f3903 100644 --- a/components/jcf2/Process/Indent/Indenter.pas +++ b/components/jcf2/Process/Indent/Indenter.pas @@ -467,6 +467,11 @@ begin if IsRunOnProcDecl(pt) then 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; liClassNestingCount := CountClassNesting(pt); @@ -577,13 +582,16 @@ begin if pt.Nestings.GetLevel(nlCaseSelector) > 0 then begin 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 if pt.HasParentNode(nCaseLabel, 6) then Dec(liIndentCount) else if (pt.TokenType in [ttElse, ttOtherwise]) and pt.HasParentNode(nElseCase, 1) then Dec(liIndentCount); - if not FormattingSettings.Indent.IndentCaseElse then + if (not FormattingSettings.Indent.IndentCaseElse) and FormattingSettings.Indent.IndentCaseLabels then begin liIndentCount := liIndentCount - pt.CountParentNodes(nElseCase); end; diff --git a/components/jcf2/Settings/SetIndent.pas b/components/jcf2/Settings/SetIndent.pas index b8cce30ada..5eaa5bdff6 100644 --- a/components/jcf2/Settings/SetIndent.pas +++ b/components/jcf2/Settings/SetIndent.pas @@ -50,9 +50,11 @@ type fbKeepCommentsWithCodeInClassDef: boolean; fbKeepCommentsWithCodeElsewhere: boolean; fbIndentElse: Boolean; + fbIndentCaseLabels: Boolean; fbIndentCaseElse: Boolean; fbIndentNestedTypes: Boolean; fbIndentVarAndConstInClass: Boolean; + fbIndentInterfaceGuid: boolean; protected public @@ -85,7 +87,9 @@ type Read fbKeepCommentsWithCodeElsewhere Write fbKeepCommentsWithCodeElsewhere; property IndentElse: boolean read fbIndentElse write fbIndentElse; + property IndentCaseLabels: boolean read fbIndentCaseLabels write fbIndentCaseLabels; property IndentCaseElse: boolean read fbIndentCaseElse write fbIndentCaseElse; + property IndentInterfaceGuid: boolean read fbIndentInterfaceGuid write fbIndentInterfaceGuid; property IndentNestedTypes: Boolean read fbIndentNestedTypes write fbIndentNestedTypes; property IndentVarAndConstInClass: Boolean read fbIndentVarAndConstInClass write fbIndentVarAndConstInClass; @@ -111,9 +115,11 @@ const REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE = 'KeepCommentsWithCodeElsewhere'; REG_INDENT_ELSE = 'IndentElse'; + REG_INDENT_CASE_LABELS = 'IndentCaseLabels'; REG_INDENT_CASE_ELSE = 'IndentCaseElse'; REG_INDENT_VAR_AND_CONST_IN_CLASS = 'IndentVarAndConstInClass'; REG_INDENT_NESTED_TYPES = 'IndentNestedTypes'; + REG_INDENT_INTERFACE_GUID = 'IndentInterfaceGuid'; constructor TSetIndent.Create; begin @@ -146,10 +152,13 @@ begin pcStream.Read(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, True); fbIndentElse := pcStream.Read(REG_INDENT_ELSE, False); + fbIndentCaseLabels := pcStream.Read(REG_INDENT_CASE_LABELS, True); fbIndentCaseElse := pcStream.Read(REG_INDENT_CASE_ELSE, True); fbIndentNestedTypes := pcStream.Read(REG_INDENT_NESTED_TYPES, False); fbIndentVarAndConstInClass := pcStream.Read(REG_INDENT_VAR_AND_CONST_IN_CLASS, False); + fbIndentInterfaceGuid := pcStream.Read(REG_INDENT_INTERFACE_GUID, True); + end; procedure TSetIndent.WriteToStream(const pcOut: TSettingsOutput); @@ -173,10 +182,12 @@ begin pcOut.Write(REG_KEEP_COMMENTS_WITH_CODE_ELSEWHERE, fbKeepCommentsWithCodeElsewhere); pcOut.Write(REG_INDENT_ELSE, fbIndentElse); + pcOut.Write(REG_INDENT_CASE_LABELS, fbIndentCaseLabels); pcOut.Write(REG_INDENT_CASE_ELSE, fbIndentCaseElse); pcOut.Write(REG_INDENT_NESTED_TYPES, fbIndentNestedTypes); pcOut.Write(REG_INDENT_VAR_AND_CONST_IN_CLASS, fbIndentVarAndConstInClass); + pcOut.Write(REG_INDENT_INTERFACE_GUID, fbIndentInterfaceGuid); end; function TSetIndent.SpacesForIndentLevel(const piLevel: integer): integer; diff --git a/components/jcf2/TestApplication/JCFSettings.cfg b/components/jcf2/TestApplication/JCFSettings.cfg index 6676d400e4..e2277e10da 100644 --- a/components/jcf2/TestApplication/JCFSettings.cfg +++ b/components/jcf2/TestApplication/JCFSettings.cfg @@ -32,9 +32,11 @@ True True False + True True True True + True True diff --git a/components/jcf2/Ui/Settings/frClarifyIndent.lfm b/components/jcf2/Ui/Settings/frClarifyIndent.lfm index c65554ad9e..cfcf695a55 100644 --- a/components/jcf2/Ui/Settings/frClarifyIndent.lfm +++ b/components/jcf2/Ui/Settings/frClarifyIndent.lfm @@ -1,36 +1,38 @@ -inherited fClarifyIndent: TfClarifyIndent - Height = 347 +object fClarifyIndent: TfClarifyIndent + Left = 0 + Height = 426 + Top = 0 Width = 430 - ClientHeight = 347 + ClientHeight = 426 ClientWidth = 430 TabOrder = 0 DesignLeft = 737 DesignTop = 299 - object Label2: TLabel[0] + object Label2: TLabel AnchorSideLeft.Control = Owner AnchorSideTop.Control = edtIndentSpaces AnchorSideTop.Side = asrCenter Left = 6 - Height = 14 - Top = 9 - Width = 118 + Height = 15 + Top = 10 + Width = 131 BorderSpacing.Left = 6 Caption = 'Block indentation spaces' ParentColor = False end - object edtIndentSpaces: TSpinEdit[1] + object edtIndentSpaces: TSpinEdit AnchorSideLeft.Control = Label2 AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Owner - Left = 130 - Height = 21 + Left = 143 + Height = 23 Top = 6 Width = 50 BorderSpacing.Around = 6 MaxValue = 12 TabOrder = 0 end - object gbOptions: TGroupBox[2] + object gbOptions: TGroupBox AnchorSideLeft.Control = Owner AnchorSideTop.Control = edtIndentSpaces AnchorSideTop.Side = asrBottom @@ -39,35 +41,35 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 6 - Height = 308 - Top = 33 + Height = 385 + Top = 35 Width = 418 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Around = 6 Caption = 'Options' - ClientHeight = 308 - ClientWidth = 418 + ClientHeight = 365 + ClientWidth = 414 TabOrder = 1 object cbIndentBeginEnd: TCheckBox AnchorSideLeft.Control = gbOptions AnchorSideTop.Control = eIndentBeginEndSpaces AnchorSideTop.Side = asrCenter Left = 6 - Height = 17 + Height = 19 Top = 8 - Width = 232 + Width = 252 BorderSpacing.Left = 6 BorderSpacing.Bottom = 6 Caption = 'Extra indent for begin/end inside procedures' - OnClick = cbIndentBeginEndClick TabOrder = 0 + OnClick = cbIndentBeginEndClick end object eIndentBeginEndSpaces: TSpinEdit AnchorSideTop.Control = gbOptions AnchorSideRight.Control = gbOptions AnchorSideRight.Side = asrBottom - Left = 348 - Height = 21 + Left = 344 + Height = 23 Top = 6 Width = 50 Anchors = [akTop, akRight] @@ -82,23 +84,23 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = eFirstLevelIndent AnchorSideTop.Side = asrCenter Left = 6 - Height = 17 - Top = 35 - Width = 158 + Height = 19 + Top = 37 + Width = 169 BorderSpacing.Left = 6 BorderSpacing.Bottom = 6 Caption = 'Different indent for first level' - OnClick = cbHasFirstLevelIndentClick TabOrder = 2 + OnClick = cbHasFirstLevelIndentClick end object eFirstLevelIndent: TSpinEdit AnchorSideTop.Control = eIndentBeginEndSpaces AnchorSideTop.Side = asrBottom AnchorSideRight.Control = gbOptions AnchorSideRight.Side = asrBottom - Left = 348 - Height = 21 - Top = 33 + Left = 344 + Height = 23 + Top = 35 Width = 50 Anchors = [akTop, akRight] BorderSpacing.Top = 6 @@ -110,9 +112,9 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = cbHasFirstLevelIndent AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 58 - Width = 260 + Height = 19 + Top = 62 + Width = 292 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 @@ -125,9 +127,9 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = cbKeepWithInProc AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 81 - Width = 239 + Height = 19 + Top = 87 + Width = 271 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 @@ -140,9 +142,9 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = cbKeepWithInGlobals AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 104 - Width = 281 + Height = 19 + Top = 112 + Width = 317 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 @@ -155,9 +157,9 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = cbKeepWithInClassDef AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 127 - Width = 244 + Height = 19 + Top = 137 + Width = 272 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 @@ -170,9 +172,9 @@ inherited fClarifyIndent: TfClarifyIndent AnchorSideTop.Control = cbKeepWithElsewhere AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 150 - Width = 170 + Height = 19 + Top = 162 + Width = 174 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 @@ -182,78 +184,108 @@ inherited fClarifyIndent: TfClarifyIndent end object cbIndentCaseElse: TCheckBox AnchorSideLeft.Control = gbOptions - AnchorSideTop.Control = cbIndentIfElse + AnchorSideTop.Control = cbIndentCaseLabels AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 173 - Width = 186 + Height = 19 + Top = 212 + Width = 192 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 Caption = 'Extra Indent for Case...Else blocks' - TabOrder = 9 + TabOrder = 10 end object cbIndentLibraryProcs: TCheckBox AnchorSideLeft.Control = gbOptions AnchorSideTop.Control = cbIndentCaseElse AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 196 - Width = 168 + Height = 19 + Top = 237 + Width = 181 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 Caption = 'Indent for procedures in library' - TabOrder = 10 + TabOrder = 11 end object cbIndentProcedureBody: TCheckBox AnchorSideLeft.Control = gbOptions AnchorSideTop.Control = cbIndentLibraryProcs AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 219 - Width = 146 + Height = 19 + Top = 262 + Width = 157 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 Caption = 'Indent for procedure body' - TabOrder = 11 + TabOrder = 12 end object cbIndentNestedTypes: TCheckBox AnchorSideLeft.Control = gbOptions AnchorSideTop.Control = cbIndentProcedureBody AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 242 - Width = 116 + Height = 19 + Top = 287 + Width = 121 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 Caption = 'Indent nested types' - TabOrder = 12 + TabOrder = 13 end object cbIndentVarAndConstInClass: TCheckBox AnchorSideLeft.Control = gbOptions AnchorSideTop.Control = cbIndentNestedTypes AnchorSideTop.Side = asrBottom Left = 6 - Height = 17 - Top = 265 - Width = 156 + Height = 19 + Top = 312 + Width = 167 BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 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 diff --git a/components/jcf2/Ui/Settings/frClarifyIndent.pas b/components/jcf2/Ui/Settings/frClarifyIndent.pas index e2b488525a..c520ed0544 100644 --- a/components/jcf2/Ui/Settings/frClarifyIndent.pas +++ b/components/jcf2/Ui/Settings/frClarifyIndent.pas @@ -38,6 +38,8 @@ type { TfClarifyIndent } TfClarifyIndent = class(TAbstractIDEOptionsEditor) + cbIndentCaseLabels: TCheckBox; + cbIndentInterfaceGuid: TCheckBox; Label2: TLabel; edtIndentSpaces: TSpinEdit; gbOptions: TGroupBox; @@ -100,10 +102,12 @@ begin lisIndentKeepSingleLineCommentsWithCodeElsewhere; cbIndentIfElse.Caption := lisIndentExtraIndentForIfElseBlocks; cbIndentCaseElse.Caption := lisIndentExtraIndentForCaseElseBlocks; + cbIndentCaseLabels.Caption := lisIndentExtraIndentForCaseLabels; cbIndentLibraryProcs.Caption := lisIndentIndentForProceduresInLibrary; cbIndentProcedureBody.Caption := lisIndentIndentForProcedureBody; cbIndentNestedTypes.Caption := lisIndentIndentNestedTypes; cbIndentVarAndConstInClass.Caption := lisIndentIndentVarAndConstInClass; + cbIndentInterfaceGuid.Caption := lisIndentExtraIndentForInterfaceGuid; end; {------------------------------------------------------------------------------- @@ -127,11 +131,13 @@ begin cbKeepWithInClassDef.Checked := KeepCommentsWithCodeInClassDef; cbKeepWithElsewhere.Checked := KeepCommentsWithCodeElsewhere; cbIndentIfElse.Checked := IndentElse; + cbIndentCaseLabels.Checked := IndentCaseLabels; cbIndentCaseElse.Checked := IndentCaseElse; cbIndentProcedureBody.Checked := IndentProcedureBody; cbIndentNestedTypes.Checked := IndentNestedTypes; cbIndentVarAndConstInClass.Checked := IndentVarAndConstInClass; + cbIndentInterfaceGuid.Checked := IndentInterfaceGuid; end; cbIndentBeginEndClick(nil); @@ -157,11 +163,13 @@ begin KeepCommentsWithCodeInClassDef := cbKeepWithInClassDef.Checked; KeepCommentsWithCodeElsewhere := cbKeepWithElsewhere.Checked; IndentElse := cbIndentIfElse.Checked; + IndentCaseLabels := cbIndentCaseLabels.Checked; IndentCaseElse := cbIndentCaseElse.Checked; IndentProcedureBody := cbIndentProcedureBody.Checked; IndentNestedTypes := cbIndentNestedTypes.Checked; IndentVarAndConstInClass := cbIndentVarAndConstInClass.Checked; + IndentInterfaceGuid := cbIndentInterfaceGuid.Checked; end; end;