mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 16:19:24 +01:00
IDE, SynEdit: introduce block-indent by tab. issue #0020256
git-svn-id: trunk@33382 -
This commit is contained in:
parent
4600e3eb2f
commit
4ca8f0c158
@ -351,6 +351,7 @@ type
|
||||
procedure WMVScroll(var Msg: {$IFDEF SYN_LAZARUS}TLMScroll{$ELSE}TWMScroll{$ENDIF}); message WM_VSCROLL;
|
||||
private
|
||||
FBlockIndent: integer;
|
||||
FBlockTabIndent: integer;
|
||||
FCaret: TSynEditCaret;
|
||||
FInternalCaret: TSynEditCaret;
|
||||
FScreenCaret: TSynEditScreenCaret;
|
||||
@ -477,6 +478,7 @@ type
|
||||
function GetPaintLockOwner: TSynEditBase;
|
||||
function GetPlugin(Index: Integer): TSynEditPlugin;
|
||||
function GetTextBetweenPoints(aStartPoint, aEndPoint: TPoint): String;
|
||||
procedure SetBlockTabIndent(AValue: integer);
|
||||
procedure SetDefSelectionMode(const AValue: TSynSelectionMode);
|
||||
procedure SetFoldState(const AValue: String);
|
||||
procedure SetMouseActions(const AValue: TSynEditMouseActions);
|
||||
@ -922,7 +924,8 @@ type
|
||||
read GetTrimSpaceType write SetTrimSpaceType;
|
||||
property BookMarkOptions: TSynBookMarkOpt
|
||||
read fBookMarkOpt write fBookMarkOpt;
|
||||
property BlockIndent: integer read fBlockIndent write SetBlockIndent default 2;
|
||||
property BlockIndent: integer read FBlockIndent write SetBlockIndent default 2;
|
||||
property BlockTabIndent: integer read FBlockTabIndent write SetBlockTabIndent default 0;
|
||||
property ExtraCharSpacing: integer
|
||||
read fExtraCharSpacing write SetExtraCharSpacing default 0;
|
||||
property ExtraLineSpacing: integer
|
||||
@ -1012,6 +1015,7 @@ type
|
||||
property Align;
|
||||
property Beautifier;
|
||||
property BlockIndent;
|
||||
property BlockTabIndent;
|
||||
property BorderSpacing;
|
||||
{$IFNDEF SYN_LAZARUS}
|
||||
property Ctl3D;
|
||||
@ -1193,9 +1197,9 @@ type
|
||||
|
||||
TSynEditUndoIndent = class(TSynEditUndoItem)
|
||||
public
|
||||
FPosY1, FPosY2, FCnt: Integer;
|
||||
FPosY1, FPosY2, FCnt, FTabCnt: Integer;
|
||||
public
|
||||
constructor Create(APosY, EPosY, ACnt: Integer);
|
||||
constructor Create(APosY, EPosY, ACnt, ATabCnt: Integer);
|
||||
function PerformUndo(Caller: TObject): Boolean; override;
|
||||
end;
|
||||
|
||||
@ -1292,11 +1296,12 @@ end;
|
||||
|
||||
{ TSynEditUndoIndent }
|
||||
|
||||
constructor TSynEditUndoIndent.Create(APosY, EPosY, ACnt: Integer);
|
||||
constructor TSynEditUndoIndent.Create(APosY, EPosY, ACnt, ATabCnt: Integer);
|
||||
begin
|
||||
FPosY1 := APosY;
|
||||
FPosY2 := EPosY;
|
||||
FCnt := ACnt;
|
||||
FCnt := ACnt;
|
||||
FTabCnt := ATabCnt;
|
||||
end;
|
||||
|
||||
function TSynEditUndoIndent.PerformUndo(Caller: TObject): Boolean;
|
||||
@ -1446,6 +1451,12 @@ begin
|
||||
Result := FInternalBlockSelection.SelText;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SetBlockTabIndent(AValue: integer);
|
||||
begin
|
||||
if FBlockTabIndent = AValue then Exit;
|
||||
FBlockTabIndent := AValue;
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.SetDefSelectionMode(const AValue: TSynSelectionMode);
|
||||
begin
|
||||
FBlockSelection.SelectionMode := AValue; // Includes active
|
||||
@ -5172,10 +5183,13 @@ begin
|
||||
SetCaretAndSelection(LogicalToPhysicalPos(Point(1,TSynEditUndoIndent(Item).FPosY1)),
|
||||
Point(1, TSynEditUndoIndent(Item).FPosY1), Point(2, TSynEditUndoIndent(Item).FPosY2),
|
||||
smNormal);
|
||||
x := fBlockIndent;
|
||||
fBlockIndent := TSynEditUndoIndent(Item).FCnt;
|
||||
x := FBlockIndent;
|
||||
y := FBlockTabIndent;
|
||||
FBlockIndent := TSynEditUndoIndent(Item).FCnt;
|
||||
FBlockTabIndent := TSynEditUndoIndent(Item).FTabCnt;
|
||||
DoBlockIndent;
|
||||
fBlockIndent := x;
|
||||
FBlockIndent := x;
|
||||
FBlockTabIndent := y;
|
||||
end
|
||||
else
|
||||
if Item.ClassType = TSynEditUndoUnIndent then
|
||||
@ -5263,7 +5277,7 @@ end;
|
||||
procedure TCustomSynEdit.UndoItem(Item: TSynEditUndoItem);
|
||||
var
|
||||
Line, OldText: PChar;
|
||||
y, Len, Len2: integer;
|
||||
y, Len, Len2, LenT: integer;
|
||||
|
||||
function GetLeadWSLen : integer;
|
||||
var
|
||||
@ -5283,14 +5297,16 @@ begin
|
||||
begin
|
||||
// add to redo list
|
||||
fRedoList.AddChange(TSynEditUndoIndent.Create(TSynEditUndoIndent(Item).FPosY1,
|
||||
TSynEditUndoIndent(Item).FPosY2, TSynEditUndoIndent(Item).FCnt));
|
||||
TSynEditUndoIndent(Item).FPosY2, TSynEditUndoIndent(Item).FCnt, TSynEditUndoIndent(Item).FTabCnt));
|
||||
// quick unintend (must all be spaces, as inserted...)
|
||||
fRedoList.Lock;
|
||||
Len2 := TSynEditUndoIndent(Item).FCnt;
|
||||
LenT := TSynEditUndoIndent(Item).FTabCnt;
|
||||
for y := TSynEditUndoUnIndent(Item).FPosY1 to TSynEditUndoUnIndent(Item).FPosY2 do begin
|
||||
Line := PChar(FTheLinesView[y - 1]);
|
||||
Len := GetLeadWSLen;
|
||||
FTheLinesView.EditDelete(Len+1-Len2, y, Len2);
|
||||
FTheLinesView.EditDelete(1, y, LenT);
|
||||
end;
|
||||
fRedoList.Unlock;
|
||||
end
|
||||
@ -7824,7 +7840,7 @@ var
|
||||
BB,BE : TPoint;
|
||||
Line : PChar;
|
||||
Len, e, y: integer;
|
||||
Spaces: String;
|
||||
Spaces, Tabs: String;
|
||||
|
||||
function GetLeadWSLen : integer;
|
||||
var
|
||||
@ -7853,7 +7869,8 @@ begin
|
||||
else e := BE.y;
|
||||
end;
|
||||
|
||||
Spaces := StringOfChar(#32, fBlockIndent);
|
||||
Spaces := StringOfChar(#32, FBlockIndent);
|
||||
Tabs := StringOfChar( #9, FBlockTabIndent);
|
||||
fUndoList.Lock;
|
||||
fRedoList.Lock;
|
||||
try
|
||||
@ -7862,13 +7879,14 @@ begin
|
||||
Line := PChar(FTheLinesView[y - 1]);
|
||||
Len := GetLeadWSLen;
|
||||
FTheLinesView.EditInsert(Len + 1, y, Spaces);
|
||||
FTheLinesView.EditInsert(1, y, Tabs);
|
||||
end;
|
||||
finally
|
||||
fUndoList.Unlock;
|
||||
fRedoList.Unlock;
|
||||
end;
|
||||
|
||||
fUndoList.AddChange(TSynEditUndoIndent.Create(BB.Y, e, fBlockIndent));
|
||||
fUndoList.AddChange(TSynEditUndoIndent.Create(BB.Y, e, FBlockIndent, FBlockTabIndent));
|
||||
finally
|
||||
FTrimmedLinesView.ForceTrim; // Otherwise it may reset the block
|
||||
FCaret.LineBytePos := FBlockSelection.EndLineBytePos;
|
||||
@ -7885,6 +7903,7 @@ var
|
||||
FullStrToDelete: PChar;
|
||||
Line: PChar;
|
||||
Len, LogP1, PhyP1, LogP2, PhyP2, y, StrToDeleteLen, e : integer;
|
||||
i, i2, j: Integer;
|
||||
SomethingDeleted : Boolean;
|
||||
HasTab: Boolean;
|
||||
|
||||
@ -7970,6 +7989,25 @@ begin
|
||||
if LogP1 - LogP2 > 0 then
|
||||
FTheLinesView.EditDelete(LogP2, y, LogP1 - LogP2);
|
||||
SomethingDeleted := SomethingDeleted or (LogP1 - LogP2 > 0);
|
||||
|
||||
// Todo: create FullTabStrToDelete for tabs
|
||||
fUndoList.Unlock;
|
||||
fRedoList.Unlock;
|
||||
Line := PChar(FTheLinesView[y - 1]);
|
||||
j := 0;
|
||||
for i := 1 to FBlockTabIndent do begin
|
||||
i2 := fTabWidth;
|
||||
while (i2 > 0) and (Line[j] = #32) do begin
|
||||
dec(i2);
|
||||
inc(j);
|
||||
end;
|
||||
if (i2 > 0) and (Line[j] = #9) then inc(j);
|
||||
end;
|
||||
if j > 0 then
|
||||
FTheLinesView.EditDelete(1, y, j);
|
||||
fUndoList.Lock;
|
||||
fRedoList.Lock;
|
||||
|
||||
end;
|
||||
|
||||
fUndoList.Unlock;
|
||||
|
||||
@ -930,6 +930,7 @@ type
|
||||
|
||||
TEditorOptions = class(TAbstractIDEEnvironmentOptions)
|
||||
private
|
||||
FBlockTabIndent: Integer;
|
||||
FCompletionLongLineHintInMSec: Integer;
|
||||
FCompletionLongLineHintType: TSynCompletionLongHintType;
|
||||
FPasExtendedKeywordsMode: Boolean;
|
||||
@ -1077,6 +1078,8 @@ type
|
||||
write FShowGutterHints;
|
||||
property BlockIndent: Integer
|
||||
read fBlockIndent write fBlockIndent default 2;
|
||||
property BlockTabIndent: Integer
|
||||
read FBlockTabIndent write FBlockTabIndent default 0;
|
||||
property BlockIndentType: TSynBeautifierIndentType
|
||||
read fBlockIndentType write fBlockIndentType default sbitCopySpaceTab;
|
||||
property TrimSpaceType: TSynEditStringTrimmingType
|
||||
@ -3062,6 +3065,7 @@ begin
|
||||
FCopyWordAtCursorOnCopyNone := True;
|
||||
FShowGutterHints := True;
|
||||
fBlockIndent := 2;
|
||||
FBlockTabIndent := 0;
|
||||
fBlockIndentType := sbitSpace;
|
||||
FTrimSpaceType := settEditLine;
|
||||
fUndoLimit := 32767;
|
||||
@ -3189,6 +3193,8 @@ begin
|
||||
'EditorOptions/General/Editor/UseSyntaxHighlight', True);
|
||||
fBlockIndent :=
|
||||
XMLConfig.GetValue('EditorOptions/General/Editor/BlockIndent', 2);
|
||||
FBlockTabIndent :=
|
||||
XMLConfig.GetValue('EditorOptions/General/Editor/BlockTabIndent', 0);
|
||||
fBlockIndentType := GetSynBeautifierIndentType
|
||||
(XMLConfig.GetValue('EditorOptions/General/Editor/BlockIndentType',
|
||||
'SpaceIndent'));
|
||||
@ -3397,6 +3403,8 @@ begin
|
||||
, fUseSyntaxHighlight, True);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/BlockIndent'
|
||||
, fBlockIndent, 2);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/BlockTabIndent'
|
||||
, FBlockTabIndent, 0);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/BlockIndentType'
|
||||
, GetSynBeautifierIndentName(fBlockIndentType), 'SpaceIndent');
|
||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/SpaceTrimType'
|
||||
@ -3978,6 +3986,7 @@ begin
|
||||
ASynEdit.Options := fSynEditOptions;
|
||||
ASynEdit.Options2 := fSynEditOptions2;
|
||||
ASynEdit.BlockIndent := fBlockIndent;
|
||||
ASynEdit.BlockTabIndent := FBlockTabIndent;
|
||||
(ASynEdit.Beautifier as TSynBeautifier).IndentType := fBlockIndentType;
|
||||
ASynEdit.TrimSpaceType := FTrimSpaceType;
|
||||
ASynEdit.TabWidth := fTabWidth;
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
Height = 423
|
||||
Height = 442
|
||||
Width = 434
|
||||
ClientHeight = 423
|
||||
ClientHeight = 442
|
||||
ClientWidth = 434
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
DesignLeft = 295
|
||||
DesignTop = 212
|
||||
@ -13,9 +12,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = BlockIndentComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 112
|
||||
Height = 18
|
||||
Top = 232
|
||||
Width = 109
|
||||
Height = 16
|
||||
Top = 252
|
||||
Width = 92
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BlockIndentLabel'
|
||||
ParentColor = False
|
||||
@ -26,9 +25,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = TabWidthsComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 324
|
||||
Height = 18
|
||||
Top = 232
|
||||
Width = 98
|
||||
Height = 16
|
||||
Top = 154
|
||||
Width = 86
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'TabWidthsLabel'
|
||||
ParentColor = False
|
||||
@ -39,9 +38,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = UndoLimitComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 324
|
||||
Height = 18
|
||||
Top = 27
|
||||
Width = 100
|
||||
Height = 16
|
||||
Top = 24
|
||||
Width = 85
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'UndoLimitLabel'
|
||||
ParentColor = False
|
||||
@ -51,10 +50,10 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = BlockIndentTypeComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 112
|
||||
Height = 18
|
||||
Top = 263
|
||||
Width = 137
|
||||
Left = 324
|
||||
Height = 16
|
||||
Top = 192
|
||||
Width = 118
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BlockIndentTypeLabel'
|
||||
ParentColor = False
|
||||
@ -65,13 +64,14 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = TabWidthsComboBox
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 228
|
||||
Height = 23
|
||||
Top = 249
|
||||
Width = 100
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'0'
|
||||
'1'
|
||||
'2'
|
||||
'4'
|
||||
@ -83,15 +83,17 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
TabOrder = 0
|
||||
end
|
||||
object TabWidthsComboBox: TComboBox[5]
|
||||
AnchorSideLeft.Control = SmartTabsCheckBox
|
||||
AnchorSideTop.Control = BlockIndentComboBox
|
||||
AnchorSideLeft.Control = UndoLimitComboBox
|
||||
AnchorSideTop.Control = IndentsTabsGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 27
|
||||
Top = 228
|
||||
Height = 23
|
||||
Top = 151
|
||||
Width = 100
|
||||
ItemHeight = 0
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'1'
|
||||
'2'
|
||||
@ -109,11 +111,11 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = UndoGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 27
|
||||
Top = 23
|
||||
Height = 23
|
||||
Top = 21
|
||||
Width = 100
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'32767'
|
||||
'4096'
|
||||
@ -129,9 +131,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = UndoAfterSaveCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 44
|
||||
Width = 158
|
||||
Height = 19
|
||||
Top = 40
|
||||
Width = 134
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'GroupUndoCheckBox'
|
||||
OnChange = GroupUndoCheckBoxChange
|
||||
@ -142,9 +144,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = UndoGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 23
|
||||
Width = 182
|
||||
Height = 19
|
||||
Top = 21
|
||||
Width = 151
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'UndoAfterSaveCheckBox'
|
||||
@ -155,9 +157,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = ScrollGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 94
|
||||
Width = 191
|
||||
Height = 19
|
||||
Top = 86
|
||||
Width = 161
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'ScrollPastEndFileCheckBox'
|
||||
@ -169,9 +171,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = AlwaysVisibleCursorCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 379
|
||||
Width = 197
|
||||
Height = 19
|
||||
Top = 356
|
||||
Width = 165
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'ScrollPastEndLineCheckBox'
|
||||
OnChange = ScrollPastEndLineCheckBoxChange
|
||||
@ -182,9 +184,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = ScrollGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 94
|
||||
Width = 191
|
||||
Height = 19
|
||||
Top = 86
|
||||
Width = 158
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'ScrollByOneLessCheckBox'
|
||||
OnChange = ScrollByOneLessCheckBoxChange
|
||||
@ -195,9 +197,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = ScrollPastEndFileCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 115
|
||||
Width = 176
|
||||
Height = 19
|
||||
Top = 105
|
||||
Width = 149
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'HalfPageScrollCheckBox'
|
||||
OnChange = HalfPageScrollCheckBoxChange
|
||||
@ -205,14 +207,13 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
end
|
||||
object AutoIndentCheckBox: TCheckBox[13]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = IndentsTabsGroupDivider
|
||||
AnchorSideTop.Control = SmartTabsCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 165
|
||||
Width = 155
|
||||
Height = 19
|
||||
Top = 189
|
||||
Width = 132
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'AutoIndentCheckBox'
|
||||
OnChange = AutoIndentCheckBoxChange
|
||||
TabOrder = 9
|
||||
@ -222,35 +223,38 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = AutoIndentLink
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 204
|
||||
Width = 187
|
||||
Height = 19
|
||||
Top = 227
|
||||
Width = 160
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
Caption = 'TabIndentBlocksCheckBox'
|
||||
OnChange = TabIndentBlocksCheckBoxChange
|
||||
TabOrder = 10
|
||||
end
|
||||
object SmartTabsCheckBox: TCheckBox[15]
|
||||
AnchorSideLeft.Control = UndoLimitComboBox
|
||||
AnchorSideTop.Control = IndentsTabsGroupDivider
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = TabsToSpacesCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 165
|
||||
Width = 153
|
||||
BorderSpacing.Top = 6
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 170
|
||||
Width = 128
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'SmartTabsCheckBox'
|
||||
OnChange = SmartTabsCheckBoxChange
|
||||
TabOrder = 11
|
||||
end
|
||||
object TabsToSpacesCheckBox: TCheckBox[16]
|
||||
AnchorSideLeft.Control = SmartTabsCheckBox
|
||||
AnchorSideTop.Control = SmartTabsCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = IndentsTabsGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 186
|
||||
Width = 173
|
||||
Left = 6
|
||||
Height = 19
|
||||
Top = 151
|
||||
Width = 147
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'TabsToSpacesCheckBox'
|
||||
OnChange = TabsToSpacesCheckBoxChange
|
||||
TabOrder = 12
|
||||
@ -260,9 +264,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = CaretGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 316
|
||||
Width = 165
|
||||
Height = 19
|
||||
Top = 299
|
||||
Width = 140
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'KeepCursorXCheckBox'
|
||||
@ -274,9 +278,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = KeepCursorXCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 337
|
||||
Width = 191
|
||||
Height = 19
|
||||
Top = 318
|
||||
Width = 158
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'PersistentCursorCheckBox'
|
||||
OnChange = PersistentCursorCheckBoxChange
|
||||
@ -287,9 +291,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = PersistentCursorCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 358
|
||||
Width = 211
|
||||
Height = 19
|
||||
Top = 337
|
||||
Width = 178
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'AlwaysVisibleCursorCheckBox'
|
||||
OnChange = AlwaysVisibleCursorCheckBoxChange
|
||||
@ -300,9 +304,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = CaretGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 316
|
||||
Width = 220
|
||||
Height = 19
|
||||
Top = 299
|
||||
Width = 182
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'CursorSkipsSelectionCheckBox'
|
||||
OnChange = CursorSkipsSelectionCheckBoxChange
|
||||
@ -312,9 +316,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideLeft.Control = CursorSkipsSelectionCheckBox
|
||||
AnchorSideTop.Control = AlwaysVisibleCursorCheckBox
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 358
|
||||
Width = 281
|
||||
Height = 19
|
||||
Top = 337
|
||||
Width = 236
|
||||
Caption = 'HomeKeyJumpsToNearestStartCheckBox'
|
||||
OnChange = HomeKeyJumpsToNearestStartCheckBoxChange
|
||||
TabOrder = 17
|
||||
@ -323,25 +327,22 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideLeft.Control = HomeKeyJumpsToNearestStartCheckBox
|
||||
AnchorSideTop.Control = ScrollPastEndLineCheckBox
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 379
|
||||
Width = 266
|
||||
Height = 19
|
||||
Top = 356
|
||||
Width = 223
|
||||
Caption = 'EndKeyJumpsToNearestStartCheckBox'
|
||||
OnChange = EndKeyJumpsToNearestStartCheckBoxChange
|
||||
TabOrder = 18
|
||||
end
|
||||
object BlockIndentTypeComboBox: TComboBox[23]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = BlockIndentComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideLeft.Control = UndoLimitComboBox
|
||||
AnchorSideTop.Control = AutoIndentCheckBox
|
||||
AnchorSideBottom.Control = TabWidthsComboBox
|
||||
Left = 6
|
||||
Height = 29
|
||||
Top = 258
|
||||
Left = 218
|
||||
Height = 23
|
||||
Top = 189
|
||||
Width = 100
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
ItemHeight = 0
|
||||
ItemHeight = 15
|
||||
ItemWidth = 200
|
||||
OnChange = ComboboxOnChange
|
||||
OnExit = ComboBoxOnExit
|
||||
@ -354,9 +355,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = BlockGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 21
|
||||
Top = 429
|
||||
Width = 183
|
||||
Height = 19
|
||||
Top = 402
|
||||
Width = 152
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'PersistentBlockCheckBox'
|
||||
@ -368,9 +369,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = BlockGroupDivider
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 429
|
||||
Width = 179
|
||||
Height = 19
|
||||
Top = 402
|
||||
Width = 152
|
||||
BorderSpacing.Top = 6
|
||||
Caption = 'OverwriteBlockCheckBox'
|
||||
OnChange = OverwriteBlockCheckBoxChange
|
||||
@ -380,9 +381,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideLeft.Control = CursorSkipsSelectionCheckBox
|
||||
AnchorSideTop.Control = PersistentCursorCheckBox
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 337
|
||||
Width = 182
|
||||
Height = 19
|
||||
Top = 318
|
||||
Width = 154
|
||||
Caption = 'CursorSkipsTabCheckBox'
|
||||
OnChange = CursorSkipsTabCheckBoxChange
|
||||
TabOrder = 22
|
||||
@ -393,9 +394,9 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Cursor = crHandPoint
|
||||
Left = 24
|
||||
Height = 18
|
||||
Top = 186
|
||||
Width = 96
|
||||
Height = 16
|
||||
Top = 208
|
||||
Width = 83
|
||||
BorderSpacing.Left = 18
|
||||
Caption = 'AutoIndentLink'
|
||||
Font.Color = clBlue
|
||||
@ -420,7 +421,7 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Height = 15
|
||||
Top = 0
|
||||
Width = 434
|
||||
Caption = 'UndoGroupDivider'
|
||||
@ -436,8 +437,8 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 71
|
||||
Height = 15
|
||||
Top = 65
|
||||
Width = 434
|
||||
Caption = 'ScrollGroupDivider'
|
||||
Autosize = True
|
||||
@ -453,8 +454,8 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 142
|
||||
Height = 15
|
||||
Top = 130
|
||||
Width = 434
|
||||
Caption = 'IndentsTabsGroupDivider'
|
||||
Autosize = True
|
||||
@ -465,13 +466,13 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
end
|
||||
object CaretGroupDivider: TDividerBevel[32]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = BlockIndentTypeComboBox
|
||||
AnchorSideTop.Control = BlockIndentComboBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 293
|
||||
Height = 15
|
||||
Top = 278
|
||||
Width = 434
|
||||
Caption = 'CaretGroupDivider'
|
||||
Autosize = True
|
||||
@ -487,8 +488,8 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 17
|
||||
Top = 406
|
||||
Height = 15
|
||||
Top = 381
|
||||
Width = 434
|
||||
Caption = 'BlockGroupDivider'
|
||||
Autosize = True
|
||||
@ -502,10 +503,44 @@ inherited EditorGeneralOptionsFrame: TEditorGeneralOptionsFrame
|
||||
AnchorSideTop.Control = ScrollByOneLessCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 218
|
||||
Height = 21
|
||||
Top = 115
|
||||
Width = 87
|
||||
Height = 19
|
||||
Top = 105
|
||||
Width = 75
|
||||
Caption = 'Scroll Hint'
|
||||
TabOrder = 23
|
||||
end
|
||||
object BlockTabIndentComboBox: TComboBox[35]
|
||||
AnchorSideLeft.Control = UndoLimitComboBox
|
||||
AnchorSideTop.Control = TabIndentBlocksCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = TabWidthsComboBox
|
||||
Left = 218
|
||||
Height = 23
|
||||
Top = 249
|
||||
Width = 100
|
||||
BorderSpacing.Top = 3
|
||||
ItemHeight = 15
|
||||
Items.Strings = (
|
||||
'0'
|
||||
'1'
|
||||
'2'
|
||||
)
|
||||
OnChange = ComboboxOnChange
|
||||
OnExit = ComboBoxOnExit
|
||||
OnKeyDown = ComboboxOnKeyDown
|
||||
TabOrder = 24
|
||||
end
|
||||
object BlockTabIndentLabel: TLabel[36]
|
||||
AnchorSideLeft.Control = BlockTabIndentComboBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = BlockIndentComboBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 324
|
||||
Height = 16
|
||||
Top = 252
|
||||
Width = 92
|
||||
BorderSpacing.Around = 6
|
||||
Caption = 'BlockIndentLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
|
||||
@ -35,6 +35,8 @@ type
|
||||
|
||||
TEditorGeneralOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
BlockIndentComboBox: TComboBox;
|
||||
BlockTabIndentComboBox: TComboBox;
|
||||
BlockTabIndentLabel: TLabel;
|
||||
BlockIndentTypeComboBox: TComboBox;
|
||||
BlockIndentLabel: TLabel;
|
||||
AutoIndentCheckBox: TCheckBox;
|
||||
@ -138,7 +140,8 @@ begin
|
||||
FDialog := ADialog;
|
||||
|
||||
BlockIndentLabel.Caption := dlgBlockIndent;
|
||||
BlockIndentTypeLabel.Caption := dlgBlockIndent;
|
||||
BlockTabIndentLabel.Caption := dlgBlockTabIndent;
|
||||
BlockIndentTypeLabel.Caption := dlgAutoIndentType;
|
||||
BlockIndentTypeComboBox.Items.Add(dlgBlockIndentTypeSpace);
|
||||
BlockIndentTypeComboBox.Items.Add(dlgBlockIndentTypeCopy);
|
||||
BlockIndentTypeComboBox.Items.Add(dlgBlockIndentTypePos);
|
||||
@ -189,6 +192,7 @@ begin
|
||||
with AOptions as TEditorOptions do
|
||||
begin
|
||||
SetComboBoxText(BlockIndentComboBox, IntToStr(BlockIndent), cstCaseInsensitive);
|
||||
SetComboBoxText(BlockTabIndentComboBox, IntToStr(BlockTabIndent), cstCaseInsensitive);
|
||||
SetComboBoxText(TabWidthsComboBox, IntToStr(TabWidth), cstCaseInsensitive);
|
||||
BlockIndentTypeComboBox.ItemIndex := ord(BlockIndentType);
|
||||
|
||||
@ -283,11 +287,19 @@ begin
|
||||
TabWidth := i;
|
||||
|
||||
i := StrToIntDef(BlockIndentComboBox.Text, 2);
|
||||
if i < 1 then
|
||||
i := 1;
|
||||
if i < 0 then
|
||||
i := 0;
|
||||
if i > 20 then
|
||||
i := 20;
|
||||
BlockIndent := i;
|
||||
|
||||
i := StrToIntDef(BlockTabIndentComboBox.Text, 0);
|
||||
if i < 0 then
|
||||
i := 0;
|
||||
if i > 20 then
|
||||
i := 20;
|
||||
BlockTabIndent := i;
|
||||
|
||||
BlockIndentType := TSynBeautifierIndentType(BlockIndentTypeComboBox.ItemIndex);
|
||||
|
||||
// cursor
|
||||
@ -405,12 +417,23 @@ begin
|
||||
if Sender = BlockIndentComboBox then
|
||||
begin
|
||||
NewVal := StrToIntDef(BlockIndentComboBox.Text, PreviewEdits[1].BlockIndent);
|
||||
// Todo: min/max
|
||||
SetComboBoxText(BlockIndentComboBox, IntToStr(NewVal), cstCaseInsensitive);
|
||||
for a := Low(PreviewEdits) to High(PreviewEdits) do
|
||||
if PreviewEdits[a] <> nil then
|
||||
PreviewEdits[a].BlockIndent := NewVal;
|
||||
end
|
||||
else
|
||||
if Sender = BlockTabIndentComboBox then
|
||||
begin
|
||||
NewVal := StrToIntDef(BlockTabIndentComboBox.Text, PreviewEdits[1].BlockTabIndent);
|
||||
// Todo: min/max
|
||||
SetComboBoxText(BlockTabIndentComboBox, IntToStr(NewVal), cstCaseInsensitive);
|
||||
for a := Low(PreviewEdits) to High(PreviewEdits) do
|
||||
if PreviewEdits[a] <> nil then
|
||||
PreviewEdits[a].BlockTabIndent := NewVal;
|
||||
end
|
||||
else
|
||||
if Sender = TabWidthsComboBox then
|
||||
begin
|
||||
NewVal := StrToIntDef(TabWidthsComboBox.Text, PreviewEdits[1].TabWidth);
|
||||
|
||||
@ -1407,7 +1407,9 @@ resourcestring
|
||||
dlgHighlightLeftOfCursor = 'Left Of Cursor';
|
||||
dlgHighlightRightOfCursor = 'Right Of Cursor';
|
||||
gldHighlightBothSidesOfCursor = 'On Both Sides';
|
||||
dlgBlockIndent = 'Block indent';
|
||||
dlgBlockIndent = 'Block indent (spaces)';
|
||||
dlgBlockTabIndent = 'Block indent (tabs)';
|
||||
dlgAutoIndentType = 'Auto indent';
|
||||
dlgBlockIndentType = 'Indent method';
|
||||
dlgBlockIndentTypeSpace = 'Spaces';
|
||||
dlgBlockIndentTypeCopy = 'Space/tab as prev Line';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user