IDE: Add option to auto-continue comments

git-svn-id: trunk@39605 -
This commit is contained in:
martin 2012-12-20 23:35:24 +00:00
parent c69c62ab78
commit 650f60c596
5 changed files with 1053 additions and 30 deletions

View File

@ -1252,6 +1252,29 @@ type
FMultiWinEditAccessOrder: TEditorOptionsEditAccessOrderList;
FCtrlMiddleTabClickClosesOthers: Boolean;
// Comment Continue
FAnsiCommentContinueEnabled: Boolean;
FAnsiCommentMatch: String;
FAnsiCommentMatchMode: TSynCommentMatchMode;
FAnsiCommentPrefix: String;
FAnsiIndentMode: TSynCommentIndentFlags;
FAnsiIndentAlignMax: integer;
FCurlyCommentContinueEnabled: Boolean;
FCurlyCommentMatch: String;
FCurlyCommentMatchMode: TSynCommentMatchMode;
FCurlyCommentPrefix: String;
FCurlyIndentMode: TSynCommentIndentFlags;
FCurlyIndentAlignMax: integer;
FSlashCommentContinueEnabled: Boolean;
FSlashCommentMatch: String;
FSlashCommentMatchMode: TSynCommentMatchMode;
FSlashCommentPrefix: String;
FSlashIndentMode: TSynCommentIndentFlags;
FSlashCommentExtend: TSynCommentExtendMode;
FSlashIndentAlignMax: integer;
FDefaultValues: TEditorOptions;
public
@ -1447,6 +1470,48 @@ type
// Multi window
property CtrlMiddleTabClickClosesOthers: Boolean
read FCtrlMiddleTabClickClosesOthers write FCtrlMiddleTabClickClosesOthers default True;
// Commend Continue
property AnsiCommentContinueEnabled: Boolean
read FAnsiCommentContinueEnabled write FAnsiCommentContinueEnabled;
property AnsiCommentMatch: String
read FAnsiCommentMatch write FAnsiCommentMatch;
property AnsiCommentPrefix: String
read FAnsiCommentPrefix write FAnsiCommentPrefix;
property AnsiCommentMatchMode: TSynCommentMatchMode
read FAnsiCommentMatchMode write FAnsiCommentMatchMode;
property AnsiIndentMode: TSynCommentIndentFlags
read FAnsiIndentMode write FAnsiIndentMode;
property AnsiIndentAlignMax: integer
read FAnsiIndentAlignMax write FAnsiIndentAlignMax;
property CurlyCommentContinueEnabled: Boolean
read FCurlyCommentContinueEnabled write FCurlyCommentContinueEnabled;
property CurlyCommentMatch: String
read FCurlyCommentMatch write FCurlyCommentMatch;
property CurlyCommentPrefix: String
read FCurlyCommentPrefix write FCurlyCommentPrefix;
property CurlyCommentMatchMode: TSynCommentMatchMode
read FCurlyCommentMatchMode write FCurlyCommentMatchMode;
property CurlyIndentMode: TSynCommentIndentFlags
read FCurlyIndentMode write FCurlyIndentMode;
property CurlyIndentAlignMax: integer
read FCurlyIndentAlignMax write FCurlyIndentAlignMax;
property SlashCommentContinueEnabled: Boolean
read FSlashCommentContinueEnabled write FSlashCommentContinueEnabled;
property SlashCommentMatch: String
read FSlashCommentMatch write FSlashCommentMatch;
property SlashCommentPrefix: String
read FSlashCommentPrefix write FSlashCommentPrefix;
property SlashCommentMatchMode: TSynCommentMatchMode
read FSlashCommentMatchMode write FSlashCommentMatchMode;
property SlashIndentMode: TSynCommentIndentFlags
read FSlashIndentMode write FSlashIndentMode;
property SlashCommentExtend: TSynCommentExtendMode
read FSlashCommentExtend write FSlashCommentExtend;
property SlashIndentAlignMax: integer
read FSlashIndentAlignMax write FSlashIndentAlignMax;
end;
const
@ -3756,6 +3821,41 @@ begin
// Multi window
FCtrlMiddleTabClickClosesOthers := True;
// Comment
FAnsiCommentContinueEnabled := False;
FAnsiCommentMatch := '^\s?(\*)';
FAnsiCommentMatchMode := scmMatchAtAsterisk;
FAnsiCommentPrefix := '$1';
FAnsiIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
FAnsiIndentAlignMax := 40;
FCurlyCommentContinueEnabled := False;
FCurlyCommentMatch := '^\s?(\*)';
FCurlyCommentMatchMode := scmMatchAfterOpening;
FCurlyCommentPrefix := '$1';
FCurlyIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
FCurlyIndentAlignMax := 40;
FSlashCommentContinueEnabled := False;
FSlashCommentMatch := '^\s?(\*)';
FSlashCommentMatchMode := scmMatchAfterOpening;
FSlashCommentPrefix := '$1';
FSlashIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
FSlashCommentExtend := sceMatching;
FSlashIndentAlignMax := 40;
end;
procedure TEditorOptions.Load;
@ -4672,6 +4772,7 @@ procedure TEditorOptions.GetSynEditSettings(ASynEdit: TSynEdit;
// if SimilarEdit is given it is used for speed up
var
MarkCaret: TSynEditMarkupHighlightAllCaret;
b: TSynBeautifierPascal;
begin
// general options
ASynEdit.Options := fSynEditOptions;
@ -4679,6 +4780,58 @@ begin
ASynEdit.BlockIndent := fBlockIndent;
ASynEdit.BlockTabIndent := FBlockTabIndent;
(ASynEdit.Beautifier as TSynBeautifier).IndentType := fBlockIndentType;
if ASynEdit.Beautifier is TSynBeautifierPascal then begin
b := ASynEdit.Beautifier as TSynBeautifierPascal;
if FAnsiCommentContinueEnabled then begin
b.AnsiCommentMode := sccPrefixMatch;
b.AnsiIndentMode := FAnsiIndentMode;
b.AnsiMatch := FAnsiCommentMatch;
b.AnsiPrefix := FAnsiCommentPrefix;
b.AnsiMatchLine := sclMatchPrev;
b.AnsiMatchMode := AnsiCommentMatchMode;
b.AnsiCommentIndent := sbitCopySpaceTab;
b.AnsiIndentFirstLineMax := AnsiIndentAlignMax;
end
else begin
b.AnsiCommentMode := sccNoPrefix;
b.AnsiIndentMode := [];
end;
if FCurlyCommentContinueEnabled then begin
b.BorCommentMode := sccPrefixMatch;
b.BorIndentMode := FCurlyIndentMode;
b.BorMatch := FCurlyCommentMatch;
b.BorPrefix := FCurlyCommentPrefix;
b.BorMatchLine := sclMatchPrev;
b.BorMatchMode := CurlyCommentMatchMode;
b.BorCommentIndent := sbitCopySpaceTab;
b.BorIndentFirstLineMax := CurlyIndentAlignMax;
end
else begin
b.BorCommentMode := sccNoPrefix;
b.BorIndentMode := [];
end;
if FSlashCommentContinueEnabled then begin
b.SlashCommentMode := sccPrefixMatch;
b.SlashIndentMode := FSlashIndentMode;
b.SlashMatch := FSlashCommentMatch;
b.SlashPrefix := FSlashCommentPrefix;
b.SlashMatchLine := sclMatchPrev;
b.SlashMatchMode := SlashCommentMatchMode;
b.SlashCommentIndent := sbitCopySpaceTab;
b.ExtendSlashCommentMode := FSlashCommentExtend;
b.SlashIndentFirstLineMax := SlashIndentAlignMax;
end
else begin
b.SlashCommentMode := sccNoPrefix;
b.SlashIndentMode := [];
end;
end;
ASynEdit.TrimSpaceType := FTrimSpaceType;
ASynEdit.TabWidth := fTabWidth;
ASynEdit.BracketHighlightStyle := FBracketHighlightStyle;

View File

@ -1,10 +1,10 @@
object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
Left = 0
Height = 442
Height = 499
Top = 0
Width = 434
ClientHeight = 442
ClientWidth = 434
Width = 433
ClientHeight = 499
ClientWidth = 433
TabOrder = 0
Visible = False
DesignLeft = 664
@ -14,7 +14,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BlockIndentComboBox
AnchorSideTop.Side = asrCenter
Left = 324
Left = 322
Height = 15
Top = 137
Width = 91
@ -27,7 +27,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TabWidthsComboBox
AnchorSideTop.Side = asrCenter
Left = 324
Left = 322
Height = 15
Top = 31
Width = 85
@ -40,7 +40,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BlockIndentTypeComboBox
AnchorSideTop.Side = asrCenter
Left = 324
Left = 322
Height = 15
Top = 90
Width = 114
@ -49,13 +49,13 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
ParentColor = False
end
object BlockIndentComboBox: TComboBox
AnchorSideLeft.Control = CenterLabel1
AnchorSideTop.Control = lblBlockIndentKeys
AnchorSideBottom.Control = TabWidthsComboBox
Left = 218
Left = 216
Height = 23
Top = 133
Width = 100
BorderSpacing.Left = 6
BorderSpacing.Top = 3
ItemHeight = 15
Items.Strings = (
@ -68,14 +68,15 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
OnChange = ComboboxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown
TabOrder = 0
TabOrder = 6
end
object TabWidthsComboBox: TComboBox
AnchorSideLeft.Control = CenterLabel1
AnchorSideTop.Control = TabsGroupDivider
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 218
Left = 216
Height = 23
Top = 27
Width = 100
@ -96,60 +97,77 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = IndentsGroupDivider
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CenterLabel1
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 86
Width = 132
Width = 201
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Right = 10
Caption = 'AutoIndentCheckBox'
OnChange = AutoIndentCheckBoxChange
TabOrder = 2
TabOrder = 3
end
object TabIndentBlocksCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = lblBlockIndentShortcut
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CenterLabel1
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 166
Width = 160
Width = 201
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 10
Caption = 'TabIndentBlocksCheckBox'
OnChange = TabIndentBlocksCheckBoxChange
TabOrder = 3
TabOrder = 7
end
object SmartTabsCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TabsToSpacesCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CenterLabel1
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 46
Width = 128
Width = 201
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Right = 10
Caption = 'SmartTabsCheckBox'
OnChange = SmartTabsCheckBoxChange
TabOrder = 4
TabOrder = 2
end
object TabsToSpacesCheckBox: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TabsGroupDivider
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CenterLabel1
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 27
Width = 147
Width = 201
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
BorderSpacing.Right = 10
Caption = 'TabsToSpacesCheckBox'
OnChange = TabsToSpacesCheckBoxChange
TabOrder = 5
TabOrder = 0
end
object BlockIndentTypeComboBox: TComboBox
AnchorSideLeft.Control = CenterLabel1
AnchorSideTop.Control = AutoIndentCheckBox
AnchorSideBottom.Control = TabWidthsComboBox
Left = 218
Left = 216
Height = 23
Top = 86
Width = 100
@ -159,7 +177,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown
Style = csDropDownList
TabOrder = 6
TabOrder = 4
end
object AutoIndentLink: TLabel
AnchorSideLeft.Control = AutoIndentCheckBox
@ -182,7 +200,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
object CenterLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 217
Left = 216
Height = 1
Top = -513
Width = 1
@ -196,7 +214,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
Left = 0
Height = 15
Top = 6
Width = 434
Width = 433
Caption = 'TabsGroupDivider'
Autosize = True
Anchors = [akTop, akLeft, akRight]
@ -205,10 +223,11 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
ParentFont = False
end
object BlockTabIndentComboBox: TComboBox
AnchorSideLeft.Control = CenterLabel1
AnchorSideTop.Control = BlockIndentComboBox
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = TabWidthsComboBox
Left = 218
Left = 216
Height = 23
Top = 159
Width = 100
@ -222,14 +241,14 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
OnChange = ComboboxOnChange
OnExit = ComboBoxOnExit
OnKeyDown = ComboboxOnKeyDown
TabOrder = 7
TabOrder = 5
end
object BlockTabIndentLabel: TLabel
AnchorSideLeft.Control = BlockTabIndentComboBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = BlockTabIndentComboBox
AnchorSideTop.Side = asrCenter
Left = 324
Left = 322
Height = 15
Top = 163
Width = 91
@ -277,7 +296,7 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
Left = 0
Height = 15
Top = 71
Width = 434
Width = 433
Caption = 'IndentsGroupDivider'
Autosize = True
Anchors = [akTop, akLeft, akRight]
@ -298,4 +317,546 @@ object EditorIndentOptionsFrame: TEditorIndentOptionsFrame
Caption = 'lblBlockIndentShortcut'
ParentColor = False
end
object CommentsGroupDivider: TDividerBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = TabIndentBlocksCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 15
Top = 191
Width = 433
Caption = 'CommentsGroupDivider'
Autosize = True
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
Font.Style = [fsBold]
ParentFont = False
end
object ToolBar1: TToolBar
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CommentsGroupDivider
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 25
Top = 206
Width = 433
Align = alNone
Anchors = [akTop, akLeft, akRight]
AutoSize = True
Caption = 'ToolBar1'
EdgeBorders = [ebBottom]
ShowCaptions = True
TabOrder = 8
object tbAnsi: TToolButton
Left = 1
Top = 0
AutoSize = True
Caption = 'tbAnsi'
Down = True
Grouped = True
OnClick = tbAnsiClick
Style = tbsCheck
end
object tbCurly: TToolButton
Tag = 1
Left = 43
Top = 0
AutoSize = True
Caption = 'tbCurly'
Grouped = True
OnClick = tbAnsiClick
Style = tbsCheck
end
object tbShlash: TToolButton
Tag = 2
Left = 90
Top = 0
AutoSize = True
Caption = 'tbShlash'
Grouped = True
OnClick = tbAnsiClick
Style = tbsCheck
end
end
object CenterLabel1: TLabel
AnchorSideLeft.Control = Owner
AnchorSideLeft.Side = asrCenter
Left = 216
Height = 1
Top = 0
Width = 1
ParentColor = False
end
object Notebook1: TNotebook
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = ToolBar1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 0
Height = 142
Top = 231
Width = 433
PageIndex = 0
Anchors = [akTop, akLeft, akRight]
TabOrder = 9
TabStop = True
object AnsiPage: TPage
object cbAnsiEnableAutoContinue: TCheckBox
AnchorSideLeft.Control = AnsiPage
AnchorSideRight.Control = AnsiCenterLabel
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 3
Width = 201
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 10
Caption = 'cbAnsiEnableAutoContinue'
OnChange = cbAnsiEnableAutoContinueChange
TabOrder = 0
end
object lbAnsiMatch: TLabel
AnchorSideLeft.Control = AnsiPage
AnchorSideTop.Control = edAnsiMatch
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 36
Width = 67
BorderSpacing.Left = 6
Caption = 'lbAnsiMatch'
ParentColor = False
end
object edAnsiMatch: TEdit
AnchorSideLeft.Control = lbAnsiMatch
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbAnsiEnableAutoContinue
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AnsiCenterLabel
AnchorSideRight.Side = asrBottom
Left = 79
Height = 23
Top = 32
Width = 128
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 10
BorderSpacing.Right = 10
Constraints.MinWidth = 50
TabOrder = 1
end
object lbAnsiPrefix: TLabel
AnchorSideLeft.Control = AnsiPage
AnchorSideTop.Control = edAnsiPrefix
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 65
Width = 62
BorderSpacing.Left = 6
Caption = 'lbAnsiPrefix'
ParentColor = False
end
object edAnsiPrefix: TEdit
AnchorSideLeft.Control = edAnsiMatch
AnchorSideTop.Control = edAnsiMatch
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AnsiCenterLabel
AnchorSideRight.Side = asrBottom
Left = 79
Height = 23
Top = 61
Width = 128
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 10
Constraints.MinWidth = 50
TabOrder = 2
end
object cbAnsiMatchMode: TComboBox
AnchorSideLeft.Control = AnsiCenterLabel
AnchorSideTop.Control = edAnsiMatch
AnchorSideRight.Control = AnsiPage
AnchorSideRight.Side = asrBottom
Left = 216
Height = 23
Top = 32
Width = 207
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
Style = csDropDownList
TabOrder = 3
end
object AnsiCenterLabel: TLabel
AnchorSideLeft.Control = AnsiPage
AnchorSideLeft.Side = asrCenter
Left = 216
Height = 1
Top = 0
Width = 1
ParentColor = False
end
object cbAnsiIndentMode: TComboBox
AnchorSideLeft.Control = AnsiCenterLabel
AnchorSideTop.Control = edAnsiPrefix
AnchorSideRight.Control = AnsiPage
AnchorSideRight.Side = asrBottom
Left = 216
Height = 23
Top = 61
Width = 207
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
OnChange = cbAnsiIndentModeChange
Style = csDropDownList
TabOrder = 4
end
object edAnsiAlignMax: TSpinEdit
AnchorSideLeft.Control = AnsiPage
AnchorSideTop.Control = lbAnsiAlignMax
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 23
Top = 108
Width = 100
BorderSpacing.Left = 6
BorderSpacing.Top = 3
MaxValue = 999
TabOrder = 5
end
object lbAnsiAlignMax: TLabel
AnchorSideLeft.Control = AnsiPage
AnchorSideTop.Control = edAnsiPrefix
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = AnsiPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 90
Width = 427
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'lbAnsiAlignMax'
ParentColor = False
WordWrap = True
end
end
object CurlyPage: TPage
object cbCurlyEnableAutoContinue: TCheckBox
AnchorSideLeft.Control = CurlyPage
AnchorSideRight.Control = CurlyCenterLabel
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 3
Width = 197
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 10
Caption = 'cbCurlyEnableAutoContinue'
OnChange = cbCurlyEnableAutoContinueChange
TabOrder = 0
end
object lbCurlyMatch: TLabel
AnchorSideLeft.Control = CurlyPage
AnchorSideTop.Control = edCurlyMatch
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 36
Width = 67
BorderSpacing.Left = 6
Caption = 'lbCurlyMatch'
ParentColor = False
end
object edCurlyMatch: TEdit
AnchorSideLeft.Control = lbCurlyMatch
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbCurlyEnableAutoContinue
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CurlyCenterLabel
AnchorSideRight.Side = asrBottom
Left = 79
Height = 23
Top = 32
Width = 124
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 10
BorderSpacing.Right = 10
TabOrder = 1
end
object lbCurlyPrefix: TLabel
AnchorSideLeft.Control = CurlyPage
AnchorSideTop.Control = edCurlyPrefix
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 65
Width = 62
BorderSpacing.Left = 6
Caption = 'lbCurlyPrefix'
ParentColor = False
end
object edCurlyPrefix: TEdit
AnchorSideLeft.Control = edCurlyMatch
AnchorSideTop.Control = edCurlyMatch
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CurlyCenterLabel
AnchorSideRight.Side = asrBottom
Left = 79
Height = 23
Top = 61
Width = 124
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 10
TabOrder = 2
end
object cbCurlyMatchMode: TComboBox
AnchorSideLeft.Control = CurlyCenterLabel
AnchorSideTop.Control = edCurlyMatch
AnchorSideRight.Control = CurlyPage
AnchorSideRight.Side = asrBottom
Left = 212
Height = 23
Top = 32
Width = 203
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
Style = csDropDownList
TabOrder = 3
end
object CurlyCenterLabel: TLabel
AnchorSideLeft.Control = CurlyPage
AnchorSideLeft.Side = asrCenter
Left = 212
Height = 1
Top = 0
Width = 1
ParentColor = False
end
object cbCurlyIndentMode: TComboBox
AnchorSideLeft.Control = CurlyCenterLabel
AnchorSideTop.Control = edCurlyPrefix
AnchorSideRight.Control = CurlyPage
AnchorSideRight.Side = asrBottom
Left = 212
Height = 23
Top = 61
Width = 203
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
OnChange = cbCurlyIndentModeChange
Style = csDropDownList
TabOrder = 4
end
object edCurlyAlignMax: TSpinEdit
AnchorSideLeft.Control = CurlyPage
AnchorSideTop.Control = lbCurlyAlignMax
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 23
Top = 108
Width = 100
BorderSpacing.Left = 6
BorderSpacing.Top = 3
MaxValue = 999
TabOrder = 5
end
object lbCurlyAlignMax: TLabel
AnchorSideLeft.Control = CurlyPage
AnchorSideTop.Control = edCurlyPrefix
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CurlyPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 90
Width = 427
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'lbCurlyAlignMax'
ParentColor = False
WordWrap = True
end
end
object SlashPage: TPage
object cbSlashEnableAutoContinue: TCheckBox
AnchorSideLeft.Control = SlashPage
AnchorSideRight.Control = SlashCenterLabel
AnchorSideRight.Side = asrBottom
Left = 6
Height = 19
Top = 3
Width = 197
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 3
BorderSpacing.Right = 10
Caption = 'cbSlashEnableAutoContinue'
OnChange = cbSlashEnableAutoContinueChange
TabOrder = 0
end
object lbSlashMatch: TLabel
AnchorSideLeft.Control = SlashPage
AnchorSideTop.Control = edSlashMatch
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 36
Width = 71
BorderSpacing.Left = 6
Caption = 'lbSlashMatch'
ParentColor = False
end
object edSlashMatch: TEdit
AnchorSideLeft.Control = lbSlashMatch
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = cbSlashEnableAutoContinue
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SlashCenterLabel
AnchorSideRight.Side = asrBottom
Left = 83
Height = 23
Top = 32
Width = 120
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 10
BorderSpacing.Right = 10
TabOrder = 1
end
object lbSlashPrefix: TLabel
AnchorSideLeft.Control = SlashPage
AnchorSideTop.Control = edSlashPrefix
AnchorSideTop.Side = asrCenter
Left = 6
Height = 15
Top = 65
Width = 66
BorderSpacing.Left = 6
Caption = 'lbSlashPrefix'
ParentColor = False
end
object edSlashPrefix: TEdit
AnchorSideLeft.Control = edSlashMatch
AnchorSideTop.Control = edSlashMatch
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SlashCenterLabel
AnchorSideRight.Side = asrBottom
Left = 83
Height = 23
Top = 61
Width = 120
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
BorderSpacing.Right = 10
TabOrder = 2
end
object cbSlashMatchMode: TComboBox
AnchorSideLeft.Control = SlashCenterLabel
AnchorSideTop.Control = edSlashMatch
AnchorSideRight.Control = SlashPage
AnchorSideRight.Side = asrBottom
Left = 212
Height = 23
Top = 32
Width = 203
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
Style = csDropDownList
TabOrder = 3
end
object SlashCenterLabel: TLabel
AnchorSideLeft.Control = SlashPage
AnchorSideLeft.Side = asrCenter
Left = 212
Height = 1
Top = 0
Width = 1
ParentColor = False
end
object cbSlashIndentMode: TComboBox
AnchorSideLeft.Control = SlashCenterLabel
AnchorSideTop.Control = edSlashPrefix
AnchorSideRight.Control = SlashPage
AnchorSideRight.Side = asrBottom
Left = 212
Height = 23
Top = 61
Width = 203
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 10
ItemHeight = 15
OnChange = cbSlashIndentModeChange
Style = csDropDownList
TabOrder = 4
end
object cbSlashExtend: TComboBox
AnchorSideLeft.Control = SlashCenterLabel
AnchorSideTop.Control = SlashPage
AnchorSideRight.Control = SlashPage
AnchorSideRight.Side = asrBottom
Left = 212
Height = 23
Top = 3
Width = 203
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 3
BorderSpacing.Right = 10
ItemHeight = 15
Style = csDropDownList
TabOrder = 6
end
object edSlashAlignMax: TSpinEdit
AnchorSideLeft.Control = SlashPage
AnchorSideTop.Control = lbSlashAlignMax
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 6
Height = 23
Top = 108
Width = 100
BorderSpacing.Left = 6
BorderSpacing.Top = 3
MaxValue = 999
TabOrder = 5
end
object lbSlashAlignMax: TLabel
AnchorSideLeft.Control = SlashPage
AnchorSideTop.Control = edSlashPrefix
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = SlashPage
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 90
Width = 427
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Top = 6
Caption = 'lbSlashAlignMax'
ParentColor = False
WordWrap = True
end
end
end
end

View File

@ -25,8 +25,8 @@ unit editor_indent_options;
interface
uses
Classes, SysUtils, LCLProc, LCLType, StdCtrls, Controls, ExtCtrls, Graphics, Forms,
EditorOptions, LazarusIDEStrConsts, IDEProcs, KeyMapping, editor_keymapping_options,
Classes, SysUtils, LCLProc, LCLType, StdCtrls, Controls, ExtCtrls, Graphics, Forms, ComCtrls,
Spin, EditorOptions, LazarusIDEStrConsts, IDEProcs, KeyMapping, editor_keymapping_options,
IDEOptionsIntf, SynEdit, SynBeautifier, SynHighlighterPas, SynEditKeyCmds, DividerBevel;
type
@ -42,7 +42,49 @@ type
BlockIndentLabel: TLabel;
AutoIndentCheckBox: TCheckBox;
AutoIndentTypeLabel: TLabel;
cbSlashExtend: TComboBox;
CenterLabel1: TLabel;
CommentsGroupDivider: TDividerBevel;
lblBlockIndentShortcut: TLabel;
AnsiCenterLabel: TLabel;
cbAnsiEnableAutoContinue: TCheckBox;
edAnsiMatch: TEdit;
edAnsiPrefix: TEdit;
lbAnsiMatch: TLabel;
lbAnsiPrefix: TLabel;
cbAnsiMatchMode: TComboBox;
cbAnsiIndentMode: TComboBox;
lbAnsiAlignMax: TLabel;
edAnsiAlignMax: TSpinEdit;
CurlyCenterLabel: TLabel;
cbCurlyEnableAutoContinue: TCheckBox;
edCurlyMatch: TEdit;
edCurlyPrefix: TEdit;
lbCurlyMatch: TLabel;
lbCurlyPrefix: TLabel;
cbCurlyMatchMode: TComboBox;
cbCurlyIndentMode: TComboBox;
lbCurlyAlignMax: TLabel;
edCurlyAlignMax: TSpinEdit;
SlashCenterLabel: TLabel;
cbSlashEnableAutoContinue: TCheckBox;
edSlashMatch: TEdit;
edSlashPrefix: TEdit;
lbSlashMatch: TLabel;
lbSlashPrefix: TLabel;
cbSlashMatchMode: TComboBox;
cbSlashIndentMode: TComboBox;
lbSlashAlignMax: TLabel;
edSlashAlignMax: TSpinEdit;
Notebook1: TNotebook;
AnsiPage: TPage;
CurlyPage: TPage;
SlashPage: TPage;
TabsGroupDivider: TDividerBevel;
AutoIndentLink: TLabel;
CenterLabel:TLabel;
@ -53,11 +95,21 @@ type
TabsToSpacesCheckBox: TCheckBox;
TabWidthsComboBox: TComboBox;
TabWidthsLabel: TLabel;
ToolBar1: TToolBar;
tbAnsi: TToolButton;
tbCurly: TToolButton;
tbShlash: TToolButton;
procedure AutoIndentCheckBoxChange(Sender: TObject);
procedure AutoIndentLinkClick(Sender: TObject);
procedure AutoIndentLinkMouseEnter(Sender: TObject);
procedure AutoIndentLinkMouseLeave(Sender: TObject);
procedure BlockIndentLinkClick(Sender: TObject);
procedure cbAnsiEnableAutoContinueChange(Sender: TObject);
procedure cbAnsiIndentModeChange(Sender: TObject);
procedure cbCurlyEnableAutoContinueChange(Sender: TObject);
procedure cbCurlyIndentModeChange(Sender: TObject);
procedure cbSlashEnableAutoContinueChange(Sender: TObject);
procedure cbSlashIndentModeChange(Sender: TObject);
procedure ComboboxOnChange(Sender: TObject);
procedure ComboboxOnKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
@ -65,6 +117,7 @@ type
procedure SmartTabsCheckBoxChange(Sender: TObject);
procedure TabIndentBlocksCheckBoxChange(Sender: TObject);
procedure TabsToSpacesCheckBoxChange(Sender: TObject);
procedure tbAnsiClick(Sender: TObject);
private
FDefaultBookmarkImages: TImageList;
FDialog: TAbstractOptionsEditorDialog;
@ -132,12 +185,77 @@ begin
TabIndentBlocksCheckBox.Caption := dlgTabIndent;
AutoIndentLink.Caption := dlgAutoIndentLink;
// Comments
CommentsGroupDivider.Caption := dlgCommentIndentGroupOptions;
tbAnsi.Caption := dlgAnsiCommentTab;
tbCurly.Caption := dlgCurlyCommentTab;
tbShlash.Caption := dlgSlashCommentTab;
Notebook1.AutoSize := True;
cbAnsiEnableAutoContinue.Caption := dlgCommentContinue;
lbAnsiMatch.Caption := dlgCommentContinueMatch;
lbAnsiPrefix.Caption := dlgCommentContinuePrefix;
lbAnsiAlignMax.Caption := dlgCommentAlignMaxToken;
cbAnsiMatchMode.Items.Clear;
cbAnsiMatchMode.Items.Add(Format(dlgCommentContinueMatchText, ['(*']));
cbAnsiMatchMode.Items.Add(Format(dlgCommentContinueMatchToken, ['(*']));
cbAnsiMatchMode.Items.Add(Format(dlgCommentContinueMatchLine, ['(*']));
cbAnsiMatchMode.Items.Add(dlgCommentContinueMatchAsterisk);
cbAnsiIndentMode.Items.Clear;
cbAnsiIndentMode.Items.Add(dlgCommentContinuePrefixIndDefault);
cbAnsiIndentMode.Items.Add(dlgCommentContinuePrefixIndMatch);
cbAnsiIndentMode.Items.Add(dlgCommentContinuePrefixIndNone);
cbCurlyEnableAutoContinue.Caption := dlgCommentContinue;
lbCurlyMatch.Caption := dlgCommentContinueMatch;
lbCurlyPrefix.Caption := dlgCommentContinuePrefix;
lbCurlyAlignMax.Caption := dlgCommentAlignMaxToken;
cbCurlyMatchMode.Items.Clear;
cbCurlyMatchMode.Items.Add(Format(dlgCommentContinueMatchText, ['{']));
cbCurlyMatchMode.Items.Add(Format(dlgCommentContinueMatchToken, ['{']));
cbCurlyMatchMode.Items.Add(Format(dlgCommentContinueMatchLine, ['{']));
cbCurlyIndentMode.Items.Clear;
cbCurlyIndentMode.Items.Add(dlgCommentContinuePrefixIndDefault);
cbCurlyIndentMode.Items.Add(dlgCommentContinuePrefixIndMatch);
cbCurlyIndentMode.Items.Add(dlgCommentContinuePrefixIndNone);
cbSlashEnableAutoContinue.Caption := dlgCommentContinue;
lbSlashMatch.Caption := dlgCommentContinueMatch;
lbSlashPrefix.Caption := dlgCommentContinuePrefix;
lbSlashAlignMax.Caption := dlgCommentAlignMaxToken;
cbSlashMatchMode.Items.Clear;
cbSlashMatchMode.Items.Add(Format(dlgCommentContinueMatchText, ['//']));
cbSlashMatchMode.Items.Add(Format(dlgCommentContinueMatchToken, ['//']));
cbSlashMatchMode.Items.Add(Format(dlgCommentContinueMatchLine, ['//']));
cbSlashIndentMode.Items.Clear;
cbSlashIndentMode.Items.Add(dlgCommentContinuePrefixIndDefault);
cbSlashIndentMode.Items.Add(dlgCommentContinuePrefixIndMatch);
cbSlashIndentMode.Items.Add(dlgCommentContinuePrefixIndNone);
cbSlashExtend.Items.Clear;
cbSlashExtend.Items.Add(dlgCommentShlashExtendMatch);
cbSlashExtend.Items.Add(dlgCommentShlashExtendMatchSplit);
cbSlashExtend.Items.Add(dlgCommentShlashExtendAlways);
cbSlashExtend.Items.Add(dlgCommentShlashExtendAlwaysSplit);
end;
procedure TEditorIndentOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
var
i: integer;
K: TKeyCommandRelation;
const
MatchModeToIdx: array [TSynCommentMatchMode] of integer = (0,1,2,3);
ExtendModeToIdx: array [TSynCommentExtendMode] of integer = (3,2,3,0,1);
begin
with AOptions as TEditorOptions do
begin
@ -165,6 +283,51 @@ begin
if k <> nil then
lblBlockIndentShortcut.Caption := lblBlockIndentShortcut.Caption +
KeyAndShiftStateToEditorKeyString(k.ShortcutA);
cbAnsiEnableAutoContinue.Checked := AnsiCommentContinueEnabled;
edAnsiMatch.Text := AnsiCommentMatch;
edAnsiPrefix.Text := AnsiCommentPrefix;
cbAnsiMatchMode.ItemIndex := MatchModeToIdx[AnsiCommentMatchMode];
edAnsiAlignMax.Value := AnsiIndentAlignMax;
if sciNone in AnsiIndentMode
then cbAnsiIndentMode.ItemIndex := 2
else if sciAlignOpen in AnsiIndentMode
then cbAnsiIndentMode.ItemIndex := 1
else cbAnsiIndentMode.ItemIndex := 0;
cbAnsiEnableAutoContinueChange(nil);
cbAnsiIndentModeChange(nil);
cbCurlyEnableAutoContinue.Checked := CurlyCommentContinueEnabled;
edCurlyMatch.Text := CurlyCommentMatch;
edCurlyPrefix.Text := CurlyCommentPrefix;
cbCurlyMatchMode.ItemIndex := MatchModeToIdx[CurlyCommentMatchMode];
edCurlyAlignMax.Value := CurlyIndentAlignMax;
if sciNone in CurlyIndentMode
then cbCurlyIndentMode.ItemIndex := 2
else if sciAlignOpen in CurlyIndentMode
then cbCurlyIndentMode.ItemIndex := 1
else cbCurlyIndentMode.ItemIndex := 0;
cbCurlyEnableAutoContinueChange(nil);
cbCurlyIndentModeChange(nil);
cbSlashEnableAutoContinue.Checked := SlashCommentContinueEnabled;
edSlashMatch.Text := SlashCommentMatch;
edSlashPrefix.Text := SlashCommentPrefix;
cbSlashMatchMode.ItemIndex := MatchModeToIdx[SlashCommentMatchMode];
edSlashAlignMax.Value := SlashIndentAlignMax;
if sciNone in SlashIndentMode
then cbSlashIndentMode.ItemIndex := 2
else if sciAlignOpen in SlashIndentMode
then cbSlashIndentMode.ItemIndex := 1
else cbSlashIndentMode.ItemIndex := 0;
cbSlashExtend.ItemIndex := ExtendModeToIdx[SlashCommentExtend];
cbSlashEnableAutoContinueChange(nil);
cbSlashIndentModeChange(nil);
end;
end;
@ -188,6 +351,9 @@ procedure TEditorIndentOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions)
var
i: integer;
const
IdxToMatchMode: array [0..3] of TSynCommentMatchMode = (scmMatchAfterOpening,scmMatchOpening,scmMatchWholeLine,scmMatchAtAsterisk);
IdxToExtendMode: array [0..3] of TSynCommentExtendMode= (sceMatching,sceMatchingSplitLine,sceAlways,sceSplitLine);
begin
with AOptions as TEditorOptions do
begin
@ -219,6 +385,55 @@ begin
BlockTabIndent := i;
BlockIndentType := TSynBeautifierIndentType(BlockIndentTypeComboBox.ItemIndex);
AnsiCommentContinueEnabled := cbAnsiEnableAutoContinue.Checked;
AnsiCommentMatch := edAnsiMatch.Text;
AnsiCommentPrefix := edAnsiPrefix.Text;
AnsiCommentMatchMode := IdxToMatchMode[cbAnsiMatchMode.ItemIndex];
AnsiIndentAlignMax := edAnsiAlignMax.Value;
case cbAnsiIndentMode.ItemIndex of
0: AnsiIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
1: AnsiIndentMode := [sciAlignOpen, sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
2: AnsiIndentMode := [sciNone];
end;
CurlyCommentContinueEnabled := cbCurlyEnableAutoContinue.Checked;
CurlyCommentMatch := edCurlyMatch.Text;
CurlyCommentPrefix := edCurlyPrefix.Text;
CurlyCommentMatchMode := IdxToMatchMode[cbCurlyMatchMode.ItemIndex];
CurlyIndentAlignMax := edCurlyAlignMax.Value;
case cbCurlyIndentMode.ItemIndex of
0: CurlyIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
1: CurlyIndentMode := [sciAlignOpen, sciAddTokenLen, sciAddPastTokenIndent];
2: CurlyIndentMode := [sciNone];
end;
SlashCommentContinueEnabled := cbSlashEnableAutoContinue.Checked;
SlashCommentMatch := edSlashMatch.Text;
SlashCommentPrefix := edSlashPrefix.Text;
SlashCommentMatchMode := IdxToMatchMode[cbSlashMatchMode.ItemIndex];
SlashIndentAlignMax := edSlashAlignMax.Value;
case cbSlashIndentMode.ItemIndex of
0: SlashIndentMode := [sciAddTokenLen, sciAddPastTokenIndent,
sciAlignOnlyTokenLen, sciAlignOnlyPastTokenIndent,
sciMatchOnlyPastTokenIndent
];
1: SlashIndentMode := [sciAlignOpen, sciAddTokenLen, sciAddPastTokenIndent];
2: SlashIndentMode := [sciNone];
end;
SlashCommentExtend := IdxToExtendMode[cbSlashExtend.ItemIndex];
end;
end;
@ -306,6 +521,55 @@ begin
col.SelectByIdeCommand(ecBlockIndent);
end;
procedure TEditorIndentOptionsFrame.cbAnsiEnableAutoContinueChange(Sender: TObject);
begin
edAnsiMatch.Enabled := cbAnsiEnableAutoContinue.Checked;
edAnsiPrefix.Enabled := cbAnsiEnableAutoContinue.Checked;
cbAnsiMatchMode.Enabled := cbAnsiEnableAutoContinue.Checked;
cbAnsiIndentMode.Enabled := cbAnsiEnableAutoContinue.Checked;
end;
procedure TEditorIndentOptionsFrame.cbAnsiIndentModeChange(Sender: TObject);
begin
case cbAnsiIndentMode.ItemIndex of
1: lbAnsiAlignMax.Caption := dlgCommentAlignMaxToken;
else lbAnsiAlignMax.Caption := dlgCommentAlignMaxDefault;
end;
end;
procedure TEditorIndentOptionsFrame.cbCurlyEnableAutoContinueChange(Sender: TObject);
begin
edCurlyMatch.Enabled := cbCurlyEnableAutoContinue.Checked;
edCurlyPrefix.Enabled := cbCurlyEnableAutoContinue.Checked;
cbCurlyMatchMode.Enabled := cbCurlyEnableAutoContinue.Checked;
cbCurlyIndentMode.Enabled := cbCurlyEnableAutoContinue.Checked;
end;
procedure TEditorIndentOptionsFrame.cbCurlyIndentModeChange(Sender: TObject);
begin
case cbCurlyIndentMode.ItemIndex of
1: lbCurlyAlignMax.Caption := dlgCommentAlignMaxToken;
else lbCurlyAlignMax.Caption := dlgCommentAlignMaxDefault;
end;
end;
procedure TEditorIndentOptionsFrame.cbSlashEnableAutoContinueChange(Sender: TObject);
begin
edSlashMatch.Enabled := cbSlashEnableAutoContinue.Checked;
edSlashPrefix.Enabled := cbSlashEnableAutoContinue.Checked;
cbSlashMatchMode.Enabled := cbSlashEnableAutoContinue.Checked;
cbSlashIndentMode.Enabled := cbSlashEnableAutoContinue.Checked;
cbSlashExtend.Enabled := cbSlashEnableAutoContinue.Checked;
end;
procedure TEditorIndentOptionsFrame.cbSlashIndentModeChange(Sender: TObject);
begin
case cbSlashIndentMode.ItemIndex of
1: lbSlashAlignMax.Caption := dlgCommentAlignMaxToken;
else lbSlashAlignMax.Caption := dlgCommentAlignMaxDefault;
end;
end;
procedure TEditorIndentOptionsFrame.ComboboxOnKeyDown(
Sender: TObject; var Key: Word; Shift: TShiftState);
begin
@ -363,6 +627,11 @@ begin
SetPreviewOption(TabsToSpacesCheckBox.Checked, eoTabsToSpaces);
end;
procedure TEditorIndentOptionsFrame.tbAnsiClick(Sender: TObject);
begin
Notebook1.PageIndex := TComponent(Sender).Tag;
end;
function TEditorIndentOptionsFrame.DefaultBookmarkImages: TImageList;
var
i: integer;

View File

@ -1345,6 +1345,7 @@ resourcestring
dlgScrollGroupOptions = 'Scrolling';
dlgIndentsTabsGroupOptions = 'Tabs';
dlgIndentsIndentGroupOptions = 'Indent';
dlgCommentIndentGroupOptions = 'Comments';
dlgMouseGroupOptions = 'Mouse:';
dlgCursorGroupOptions = 'Cursor';
dlgBlockGroupOptions = 'Selection';
@ -1381,6 +1382,27 @@ resourcestring
dlgTabsToSpaces = 'Tabs to spaces';
dlgTabIndent = 'Tab indents blocks';
dlgTrimTrailingSpaces = 'Trim trailing spaces';
dlgAnsiCommentTab = 'Ansi (* *)';
dlgCurlyCommentTab = 'Curly { }';
dlgSlashCommentTab = 'Slash //';
dlgCommentContinue = 'Prefix comments on linebreak';
dlgCommentContinueMatch = 'Match current line';
dlgCommentContinuePrefix = 'Prefix new line';
dlgCommentAlignMaxDefault = 'Set default to token pos on 2nd line, if open token before or at column:';
dlgCommentAlignMaxToken = 'Limit indent to';
dlgCommentContinueMatchText = 'Match text after token "%s"';
dlgCommentContinueMatchToken = 'Match text including token "%s"';
dlgCommentContinueMatchLine = 'Match whole line';
dlgCommentContinueMatchAsterisk = 'Match text including "*" of token "(*"';
dlgCommentContinuePrefixIndDefault = 'Align Prefix at indent of previous line';
dlgCommentContinuePrefixIndMatch = 'Align Prefix below start of comment on first comment line';
dlgCommentContinuePrefixIndNone = 'Do not indent prefix';
dlgCommentShlashExtendMatch = 'Extend, if matched';
dlgCommentShlashExtendMatchSplit = 'Extend, if matched and caret in the middle of text (not at EOL)';
dlgCommentShlashExtendAlways = 'Extend, if matched or not matched';
dlgCommentShlashExtendAlwaysSplit = 'Extend, if matched or not matched (not at EOL)';
dlgUndoAfterSave = 'Undo after save';
dlgFindTextatCursor = 'Find text at cursor';
dlgUseSyntaxHighlight = 'Use syntax highlight';

View File

@ -54,7 +54,7 @@ uses
SynEditMiscClasses, SynEditMarkupHighAll, SynEditMarks,
SynBeautifier, LazSynEditText,
SynPluginSyncronizedEditBase, SourceSynEditor, SynMacroRecorder,
SynExportHTML,
SynExportHTML, SynHighlighterPas,
// Intf
SrcEditorIntf, MenuIntf, LazIDEIntf, PackageIntf, IDEHelpIntf, IDEImagesIntf,
IDEWindowIntf, ProjectIntf,
@ -1284,6 +1284,7 @@ var
SourceCompletionTimer: TIdleTimer = nil;
SourceCompletionCaretXY: TPoint;
AWordCompletion: TWordCompletion = nil;
PasBeautifier: TSynBeautifierPascal;
function dbgs(AFlag: TSourceNotebookUpdateFlag): string; overload;
begin
@ -2566,6 +2567,8 @@ Begin
PageName := ASharedEditor.PageName;
FEditor.ShareTextBufferFrom(ASharedEditor.EditorComponent);
FEditor.Highlighter := ASharedEditor.EditorComponent.Highlighter;
if ASharedEditor.EditorComponent.Beautifier is TSynBeautifierPascal then
FEditor.Beautifier := ASharedEditor.EditorComponent.Beautifier;
end;
FEditPlugin := TSynEditPlugin1.Create(FEditor);
@ -3959,10 +3962,14 @@ end;
procedure TSourceEditor.SetSyntaxHighlighterType(
ASyntaxHighlighterType: TLazSyntaxHighlighter);
var
HlIsPas, OldHlIsPas: Boolean;
begin
if (ASyntaxHighlighterType=fSyntaxHighlighterType)
and ((FEditor.Highlighter<>nil) = EditorOpts.UseSyntaxHighlight) then exit;
OldHlIsPas := FEditor.Highlighter is TSynPasSyn;
HlIsPas := False;
if EditorOpts.UseSyntaxHighlight
then begin
if Highlighters[ASyntaxHighlighterType]=nil then begin
@ -3970,10 +3977,19 @@ begin
EditorOpts.CreateSyn(ASyntaxHighlighterType);
end;
FEditor.Highlighter:=Highlighters[ASyntaxHighlighterType];
HlIsPas := FEditor.Highlighter is TSynPasSyn;
end
else
FEditor.Highlighter:=nil;
if (OldHlIsPas <> HlIsPas) then begin
if HlIsPas then
FEditor.Beautifier := PasBeautifier
else
FEditor.Beautifier := nil; // use default
EditorOpts.GetSynEditSettings(FEditor, nil);
end;
FSyntaxHighlighterType:=ASyntaxHighlighterType;
SourceNotebook.UpdateActiveEditColors(FEditor);
end;
@ -8260,6 +8276,7 @@ begin
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do
Highlighters[h]:=nil;
IDESearchInText:=@SearchInText;
PasBeautifier := TSynBeautifierPascal.Create(nil);
end;
procedure InternalFinal;
@ -8268,6 +8285,7 @@ begin
for h:=Low(TLazSyntaxHighlighter) to High(TLazSyntaxHighlighter) do
FreeThenNil(Highlighters[h]);
FreeThenNil(aWordCompletion);
FreeAndNil(PasBeautifier);
end;
{ TSourceEditorManagerBase }