ADD: Editor - block indent option

This commit is contained in:
Alexander Koblov 2022-11-13 16:28:34 +03:00
commit 4d80ae37ec
5 changed files with 78 additions and 38 deletions

View file

@ -359,6 +359,7 @@ begin
FontOptionsToFont(gFonts[dcfEditor], Editor.Font);
Editor.TabWidth := gEditorSynEditTabWidth;
Editor.RightEdge := gEditorSynEditRightEdge;
Editor.BlockIndent := gEditorSynEditBlockIndent;
end;
procedure TfrmEditor.actExecute(Sender: TObject);

View file

@ -1,8 +1,8 @@
inherited frmOptionsEditor: TfrmOptionsEditor
Height = 513
Width = 586
Width = 601
ClientHeight = 513
ClientWidth = 586
ClientWidth = 601
ParentShowHint = False
ShowHint = True
DesignLeft = 117
@ -141,39 +141,69 @@ inherited frmOptionsEditor: TfrmOptionsEditor
ParentColor = False
end
object chkRightEdge: TCheckBox
AnchorSideLeft.Control = edTabWidth
AnchorSideLeft.Control = seeBlockIndent
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblTabWidth
AnchorSideTop.Side = asrCenter
Left = 189
Height = 24
Top = 119
Width = 113
Left = 363
Height = 23
Top = 120
Width = 108
BorderSpacing.Left = 12
Caption = 'Right margin:'
Color = clDefault
ParentColor = False
TabOrder = 2
TabOrder = 3
end
object seeRightEdge: TSpinEditEx
AnchorSideLeft.Control = chkRightEdge
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = edTabWidth
AnchorSideTop.Side = asrCenter
Left = 306
Height = 28
Top = 117
Width = 129
Left = 475
Height = 36
Top = 113
Width = 103
BorderSpacing.Left = 4
MaxLength = 0
TabOrder = 3
TabOrder = 4
MaxValue = 512
MinValue = 16
NullValue = 0
Value = 80
end
object lblBlockIndent: TLabel
AnchorSideLeft.Control = edTabWidth
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = lblTabWidth
AnchorSideTop.Side = asrCenter
Left = 164
Height = 19
Top = 122
Width = 80
BorderSpacing.Left = 12
Caption = 'Block indent:'
ParentColor = False
end
object seeBlockIndent: TSpinEditEx
AnchorSideLeft.Control = lblBlockIndent
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = edTabWidth
AnchorSideTop.Side = asrCenter
Left = 248
Height = 36
Top = 113
Width = 103
BorderSpacing.Left = 4
MaxLength = 0
TabOrder = 2
MaxValue = 20
NullValue = 0
Value = 0
end
end
inherited pmPathHelper: TPopupMenu[9]
left = 424
top = 8
Left = 424
Top = 8
end
end

View file

@ -1,21 +1,22 @@
{"version":1,"strings":[
{"hash":40124019,"name":"tfrmoptionseditor.gbinternaleditor.caption","sourcebytes":[73,110,116,101,114,110,97,108,32,101,100,105,116,111,114,32,111,112,116,105,111,110,115],"value":"Internal editor options"},
{"hash":162766773,"name":"tfrmoptionseditor.chkautoindent.hint","sourcebytes":[65,108,108,111,119,115,32,116,111,32,105,110,100,101,110,116,32,116,104,101,32,99,97,114,101,116,44,32,119,104,101,110,32,110,101,119,32,108,105,110,101,32,105,115,32,99,114,101,97,116,101,100,32,119,105,116,104,32,60,69,110,116,101,114,62,44,32,119,105,116,104,32,116,104,101,32,115,97,109,101,32,97,109,111,117,110,116,32,111,102,32,108,101,97,100,105,110,103,32,119,104,105,116,101,32,115,112,97,99,101,32,97,115,32,116,104,101,32,112,114,101,99,101,100,105,110,103,32,108,105,110,101],"value":"Allows to indent the caret, when new line is created with <Enter>, with the same amount of leading white space as the preceding line"},
{"hash":80503108,"name":"tfrmoptionseditor.chkautoindent.caption","sourcebytes":[65,117,116,111,32,73,110,100,101,110,116],"value":"Auto Indent"},
{"hash":108628419,"name":"tfrmoptionseditor.chktrimtrailingspaces.hint","sourcebytes":[65,117,116,111,32,100,101,108,101,116,101,32,116,114,97,105,108,105,110,103,32,115,112,97,99,101,115,44,32,116,104,105,115,32,97,112,112,108,105,101,115,32,111,110,108,121,32,116,111,32,101,100,105,116,101,100,32,108,105,110,101,115],"value":"Auto delete trailing spaces, this applies only to edited lines"},
{"hash":214387443,"name":"tfrmoptionseditor.chktrimtrailingspaces.caption","sourcebytes":[68,101,108,101,116,101,32,116,114,97,105,108,105,110,103,32,115,112,97,99,101,115],"value":"Delete trailing spaces"},
{"hash":23065182,"name":"tfrmoptionseditor.chkscrollpastendline.hint","sourcebytes":[65,108,108,111,119,115,32,99,97,114,101,116,32,116,111,32,103,111,32,105,110,116,111,32,101,109,112,116,121,32,115,112,97,99,101,32,98,101,121,111,110,100,32,101,110,100,45,111,102,45,108,105,110,101,32,112,111,115,105,116,105,111,110],"value":"Allows caret to go into empty space beyond end-of-line position"},
{"hash":261134869,"name":"tfrmoptionseditor.chkscrollpastendline.caption","sourcebytes":[67,97,114,101,116,32,112,97,115,116,32,101,110,100,32,111,102,32,108,105,110,101],"value":"Caret past end of line"},
{"hash":86627171,"name":"tfrmoptionseditor.chkshowspecialchars.hint","sourcebytes":[83,104,111,119,115,32,115,112,101,99,105,97,108,32,99,104,97,114,97,99,116,101,114,115,32,102,111,114,32,115,112,97,99,101,115,32,97,110,100,32,116,97,98,117,108,97,116,105,111,110,115],"value":"Shows special characters for spaces and tabulations"},
{"hash":140737907,"name":"tfrmoptionseditor.chkshowspecialchars.caption","sourcebytes":[83,104,111,119,32,115,112,101,99,105,97,108,32,99,104,97,114,97,99,116,101,114,115],"value":"Show special characters"},
{"hash":245290889,"name":"tfrmoptionseditor.chktabstospaces.hint","sourcebytes":[67,111,110,118,101,114,116,115,32,116,97,98,32,99,104,97,114,97,99,116,101,114,115,32,116,111,32,97,32,115,112,101,99,105,102,105,101,100,32,110,117,109,98,101,114,32,111,102,32,115,112,97,99,101,32,99,104,97,114,97,99,116,101,114,115,32,40,119,104,101,110,32,101,110,116,101,114,105,110,103,41],"value":"Converts tab characters to a specified number of space characters (when entering)"},
{"hash":245861139,"name":"tfrmoptionseditor.chktabstospaces.caption","sourcebytes":[85,115,101,32,115,112,97,99,101,115,32,105,110,115,116,101,97,100,32,116,97,98,32,99,104,97,114,97,99,116,101,114,115],"value":"Use spaces instead tab characters"},
{"hash":253069796,"name":"tfrmoptionseditor.chktabindent.hint","sourcebytes":[87,104,101,110,32,97,99,116,105,118,101,32,60,84,97,98,62,32,97,110,100,32,60,83,104,105,102,116,43,84,97,98,62,32,97,99,116,32,97,115,32,98,108,111,99,107,32,105,110,100,101,110,116,44,32,117,110,105,110,100,101,110,116,32,119,104,101,110,32,116,101,120,116,32,105,115,32,115,101,108,101,99,116,101,100],"value":"When active <Tab> and <Shift+Tab> act as block indent, unindent when text is selected"},
{"hash":127944307,"name":"tfrmoptionseditor.chktabindent.caption","sourcebytes":[84,97,98,32,105,110,100,101,110,116,115,32,98,108,111,99,107,115],"value":"Tab indents blocks"},
{"hash":145722565,"name":"tfrmoptionseditor.chksmarttabs.hint","sourcebytes":[87,104,101,110,32,117,115,105,110,103,32,60,84,97,98,62,32,107,101,121,44,32,99,97,114,101,116,32,119,105,108,108,32,103,111,32,116,111,32,116,104,101,32,110,101,120,116,32,110,111,110,45,115,112,97,99,101,32,99,104,97,114,97,99,116,101,114,32,111,102,32,116,104,101,32,112,114,101,118,105,111,117,115,32,108,105,110,101],"value":"When using <Tab> key, caret will go to the next non-space character of the previous line"},
{"hash":157287443,"name":"tfrmoptionseditor.chksmarttabs.caption","sourcebytes":[83,109,97,114,116,32,84,97,98,115],"value":"Smart Tabs"},
{"hash":61127412,"name":"tfrmoptionseditor.edtabwidth.hint","sourcebytes":[80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,116,104,101,32,34,83,109,97,114,116,32,84,97,98,115,34,32,111,112,116,105,111,110,32,116,97,107,101,115,32,112,114,101,99,101,100,101,110,99,101,32,111,118,101,114,32,116,104,101,32,116,97,98,117,108,97,116,105,111,110,32,116,111,32,98,101,32,112,101,114,102,111,114,109,101,100],"value":"Please note that the \"Smart Tabs\" option takes precedence over the tabulation to be performed"},
{"hash":61127412,"name":"tfrmoptionseditor.lbltabwidth.hint","sourcebytes":[80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,116,104,101,32,34,83,109,97,114,116,32,84,97,98,115,34,32,111,112,116,105,111,110,32,116,97,107,101,115,32,112,114,101,99,101,100,101,110,99,101,32,111,118,101,114,32,116,104,101,32,116,97,98,117,108,97,116,105,111,110,32,116,111,32,98,101,32,112,101,114,102,111,114,109,101,100],"value":"Please note that the \"Smart Tabs\" option takes precedence over the tabulation to be performed"},
{"hash":131735034,"name":"tfrmoptionseditor.lbltabwidth.caption","sourcebytes":[84,97,98,32,119,105,100,116,104,58],"value":"Tab width:"},
{"hash":192227930,"name":"tfrmoptionseditor.chkrightedge.caption","sourcebytes":[82,105,103,104,116,32,109,97,114,103,105,110,58],"value":"Right margin:"}
]}
{"version":1,"strings":[
{"hash":40124019,"name":"tfrmoptionseditor.gbinternaleditor.caption","sourcebytes":[73,110,116,101,114,110,97,108,32,101,100,105,116,111,114,32,111,112,116,105,111,110,115],"value":"Internal editor options"},
{"hash":162766773,"name":"tfrmoptionseditor.chkautoindent.hint","sourcebytes":[65,108,108,111,119,115,32,116,111,32,105,110,100,101,110,116,32,116,104,101,32,99,97,114,101,116,44,32,119,104,101,110,32,110,101,119,32,108,105,110,101,32,105,115,32,99,114,101,97,116,101,100,32,119,105,116,104,32,60,69,110,116,101,114,62,44,32,119,105,116,104,32,116,104,101,32,115,97,109,101,32,97,109,111,117,110,116,32,111,102,32,108,101,97,100,105,110,103,32,119,104,105,116,101,32,115,112,97,99,101,32,97,115,32,116,104,101,32,112,114,101,99,101,100,105,110,103,32,108,105,110,101],"value":"Allows to indent the caret, when new line is created with <Enter>, with the same amount of leading white space as the preceding line"},
{"hash":80503108,"name":"tfrmoptionseditor.chkautoindent.caption","sourcebytes":[65,117,116,111,32,73,110,100,101,110,116],"value":"Auto Indent"},
{"hash":108628419,"name":"tfrmoptionseditor.chktrimtrailingspaces.hint","sourcebytes":[65,117,116,111,32,100,101,108,101,116,101,32,116,114,97,105,108,105,110,103,32,115,112,97,99,101,115,44,32,116,104,105,115,32,97,112,112,108,105,101,115,32,111,110,108,121,32,116,111,32,101,100,105,116,101,100,32,108,105,110,101,115],"value":"Auto delete trailing spaces, this applies only to edited lines"},
{"hash":214387443,"name":"tfrmoptionseditor.chktrimtrailingspaces.caption","sourcebytes":[68,101,108,101,116,101,32,116,114,97,105,108,105,110,103,32,115,112,97,99,101,115],"value":"Delete trailing spaces"},
{"hash":23065182,"name":"tfrmoptionseditor.chkscrollpastendline.hint","sourcebytes":[65,108,108,111,119,115,32,99,97,114,101,116,32,116,111,32,103,111,32,105,110,116,111,32,101,109,112,116,121,32,115,112,97,99,101,32,98,101,121,111,110,100,32,101,110,100,45,111,102,45,108,105,110,101,32,112,111,115,105,116,105,111,110],"value":"Allows caret to go into empty space beyond end-of-line position"},
{"hash":261134869,"name":"tfrmoptionseditor.chkscrollpastendline.caption","sourcebytes":[67,97,114,101,116,32,112,97,115,116,32,101,110,100,32,111,102,32,108,105,110,101],"value":"Caret past end of line"},
{"hash":86627171,"name":"tfrmoptionseditor.chkshowspecialchars.hint","sourcebytes":[83,104,111,119,115,32,115,112,101,99,105,97,108,32,99,104,97,114,97,99,116,101,114,115,32,102,111,114,32,115,112,97,99,101,115,32,97,110,100,32,116,97,98,117,108,97,116,105,111,110,115],"value":"Shows special characters for spaces and tabulations"},
{"hash":140737907,"name":"tfrmoptionseditor.chkshowspecialchars.caption","sourcebytes":[83,104,111,119,32,115,112,101,99,105,97,108,32,99,104,97,114,97,99,116,101,114,115],"value":"Show special characters"},
{"hash":245290889,"name":"tfrmoptionseditor.chktabstospaces.hint","sourcebytes":[67,111,110,118,101,114,116,115,32,116,97,98,32,99,104,97,114,97,99,116,101,114,115,32,116,111,32,97,32,115,112,101,99,105,102,105,101,100,32,110,117,109,98,101,114,32,111,102,32,115,112,97,99,101,32,99,104,97,114,97,99,116,101,114,115,32,40,119,104,101,110,32,101,110,116,101,114,105,110,103,41],"value":"Converts tab characters to a specified number of space characters (when entering)"},
{"hash":245861139,"name":"tfrmoptionseditor.chktabstospaces.caption","sourcebytes":[85,115,101,32,115,112,97,99,101,115,32,105,110,115,116,101,97,100,32,116,97,98,32,99,104,97,114,97,99,116,101,114,115],"value":"Use spaces instead tab characters"},
{"hash":253069796,"name":"tfrmoptionseditor.chktabindent.hint","sourcebytes":[87,104,101,110,32,97,99,116,105,118,101,32,60,84,97,98,62,32,97,110,100,32,60,83,104,105,102,116,43,84,97,98,62,32,97,99,116,32,97,115,32,98,108,111,99,107,32,105,110,100,101,110,116,44,32,117,110,105,110,100,101,110,116,32,119,104,101,110,32,116,101,120,116,32,105,115,32,115,101,108,101,99,116,101,100],"value":"When active <Tab> and <Shift+Tab> act as block indent, unindent when text is selected"},
{"hash":127944307,"name":"tfrmoptionseditor.chktabindent.caption","sourcebytes":[84,97,98,32,105,110,100,101,110,116,115,32,98,108,111,99,107,115],"value":"Tab indents blocks"},
{"hash":145722565,"name":"tfrmoptionseditor.chksmarttabs.hint","sourcebytes":[87,104,101,110,32,117,115,105,110,103,32,60,84,97,98,62,32,107,101,121,44,32,99,97,114,101,116,32,119,105,108,108,32,103,111,32,116,111,32,116,104,101,32,110,101,120,116,32,110,111,110,45,115,112,97,99,101,32,99,104,97,114,97,99,116,101,114,32,111,102,32,116,104,101,32,112,114,101,118,105,111,117,115,32,108,105,110,101],"value":"When using <Tab> key, caret will go to the next non-space character of the previous line"},
{"hash":157287443,"name":"tfrmoptionseditor.chksmarttabs.caption","sourcebytes":[83,109,97,114,116,32,84,97,98,115],"value":"Smart Tabs"},
{"hash":61127412,"name":"tfrmoptionseditor.edtabwidth.hint","sourcebytes":[80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,116,104,101,32,34,83,109,97,114,116,32,84,97,98,115,34,32,111,112,116,105,111,110,32,116,97,107,101,115,32,112,114,101,99,101,100,101,110,99,101,32,111,118,101,114,32,116,104,101,32,116,97,98,117,108,97,116,105,111,110,32,116,111,32,98,101,32,112,101,114,102,111,114,109,101,100],"value":"Please note that the \"Smart Tabs\" option takes precedence over the tabulation to be performed"},
{"hash":61127412,"name":"tfrmoptionseditor.lbltabwidth.hint","sourcebytes":[80,108,101,97,115,101,32,110,111,116,101,32,116,104,97,116,32,116,104,101,32,34,83,109,97,114,116,32,84,97,98,115,34,32,111,112,116,105,111,110,32,116,97,107,101,115,32,112,114,101,99,101,100,101,110,99,101,32,111,118,101,114,32,116,104,101,32,116,97,98,117,108,97,116,105,111,110,32,116,111,32,98,101,32,112,101,114,102,111,114,109,101,100],"value":"Please note that the \"Smart Tabs\" option takes precedence over the tabulation to be performed"},
{"hash":131735034,"name":"tfrmoptionseditor.lbltabwidth.caption","sourcebytes":[84,97,98,32,119,105,100,116,104,58],"value":"Tab width:"},
{"hash":192227930,"name":"tfrmoptionseditor.chkrightedge.caption","sourcebytes":[82,105,103,104,116,32,109,97,114,103,105,110,58],"value":"Right margin:"},
{"hash":125778010,"name":"tfrmoptionseditor.lblblockindent.caption","sourcebytes":[66,108,111,99,107,32,105,110,100,101,110,116,58],"value":"Block indent:"}
]}

View file

@ -3,7 +3,7 @@
-------------------------------------------------------------------------
Tools options page for the editor tool
Copyright (C) 2006-2019 Alexander Koblov (alexx2000@mail.ru)
Copyright (C) 2006-2022 Alexander Koblov (alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -37,6 +37,7 @@ type
TfrmOptionsEditor = class(TfrmOptionsToolBase)
gbInternalEditor: TGroupBox;
chkRightEdge: TCheckBox;
lblBlockIndent: TLabel;
pnlBooleanOptions: TPanel;
chkAutoIndent: TCheckBox;
chkTrimTrailingSpaces: TCheckBox;
@ -48,6 +49,7 @@ type
edTabWidth: TEdit;
chkSmartTabs: TCheckBox;
seeRightEdge: TSpinEditEx;
seeBlockIndent: TSpinEditEx;
protected
procedure Init; override;
procedure Load; override;
@ -90,6 +92,7 @@ begin
chkSmartTabs.Checked := eoSmartTabs in gEditorSynEditOptions;
chkRightEdge.Checked := not (eoHideRightMargin in gEditorSynEditOptions);
edTabWidth.Text := IntToStr(gEditorSynEditTabWidth);
seeBlockIndent.Value := gEditorSynEditBlockIndent;
seeRightEdge.Value := gEditorSynEditRightEdge;
end;
@ -115,6 +118,7 @@ begin
UpdateOptionFromBool(chkSmartTabs.Checked, eoSmartTabs);
edTabWidth.Text := IntToStr(StrToIntDef(edTabWidth.Text,8));
gEditorSynEditTabWidth := StrToIntDef(edTabWidth.Text,8);
gEditorSynEditBlockIndent := seeBlockIndent.Value;
gEditorSynEditRightEdge := seeRightEdge.Value;
if LastEditorUsedForConfiguration<>nil then
LastEditorUsedForConfiguration.LoadGlobalOptions;

View file

@ -643,7 +643,8 @@ var
gEditWaitTime: Integer;
gEditorSynEditOptions: TSynEditorOptions;
gEditorSynEditTabWidth,
gEditorSynEditRightEdge: Integer;
gEditorSynEditRightEdge,
gEditorSynEditBlockIndent: Integer;
{ Differ }
gDifferIgnoreCase,
@ -2065,6 +2066,7 @@ begin
gEditorSynEditOptions := SYNEDIT_DEFAULT_OPTIONS;
gEditorSynEditTabWidth := 8;
gEditorSynEditRightEdge := 80;
gEditorSynEditBlockIndent := 2;
{ Differ }
gDifferIgnoreCase := False;
@ -3169,6 +3171,7 @@ begin
gEditorSynEditOptions := TSynEditorOptions(GetValue(Node, 'SynEditOptions', Integer(gEditorSynEditOptions)));
gEditorSynEditTabWidth := GetValue(Node, 'SynEditTabWidth', gEditorSynEditTabWidth);
gEditorSynEditRightEdge := GetValue(Node, 'SynEditRightEdge', gEditorSynEditRightEdge);
gEditorSynEditBlockIndent := GetValue(Node, 'SynEditBlockIndent', gEditorSynEditBlockIndent);
end;
{ Differ }
@ -3792,6 +3795,7 @@ begin
SetValue(Node, 'SynEditOptions', Integer(gEditorSynEditOptions));
SetValue(Node, 'SynEditTabWidth', gEditorSynEditTabWidth);
SetValue(Node, 'SynEditRightEdge', gEditorSynEditRightEdge);
SetValue(Node, 'SynEditBlockIndent', gEditorSynEditBlockIndent);
{ Differ }
Node := FindNode(Root, 'Differ',True);