IDE, SynEdit: New options for auto scroll on edit

git-svn-id: trunk@63217 -
This commit is contained in:
martin 2020-05-23 22:54:52 +00:00
parent 6ad0380fb1
commit aefa3215f8
4 changed files with 453 additions and 7 deletions

View File

@ -1416,6 +1416,8 @@ type
FPasExtendedKeywordsMode: Boolean;
FHideSingleTabInWindow: Boolean;
FPasStringKeywordMode: TSynPasStringMode;
FScrollOnEditLeftOptions: TSynScrollOnEditLeftOptions;
FScrollOnEditRightOptions: TSynScrollOnEditRightOptions;
FTopInfoView: boolean;
{$IFDEF WinIME}
FUseMinimumIme: Boolean;
@ -1809,6 +1811,10 @@ type
property StringBreakEnabled: Boolean read FStringBreakEnabled write FStringBreakEnabled;
property StringBreakAppend: String read FStringBreakAppend write FStringBreakAppend;
property StringBreakPrefix: String read FStringBreakPrefix write FStringBreakPrefix;
// Scroll
property ScrollOnEditLeftOptions: TSynScrollOnEditLeftOptions read FScrollOnEditLeftOptions write FScrollOnEditLeftOptions;
property ScrollOnEditRightOptions: TSynScrollOnEditRightOptions read FScrollOnEditRightOptions write FScrollOnEditRightOptions;
end;
var
@ -4626,6 +4632,8 @@ var
begin
inherited Create;
InitLocale;
FScrollOnEditLeftOptions := TSynScrollOnEditLeftOptions.Create;
FScrollOnEditRightOptions := TSynScrollOnEditRightOptions.Create;
ConfFileName := AppendPathDelim(GetPrimaryConfigPath) + EditOptsConfFileName;
CopySecondaryConfigFile(EditOptsConfFileName);
@ -4676,6 +4684,8 @@ begin
FUserMouseSettings.Free;
FTempMouseSettings.Free;
FreeAndNil(FDefaultValues);
FreeAndNil(FScrollOnEditLeftOptions);
FreeAndNil(FScrollOnEditRightOptions);
inherited Destroy;
end;
@ -6116,6 +6126,9 @@ begin
ASynEdit.RightGutter.LineOverviewPart.MouseActions.Assign(FUserMouseSettings.GutterActionsOverView);
ASynEdit.RightGutter.LineOverviewPart.MouseActionsForMarks.Assign(FUserMouseSettings.GutterActionsOverViewMarks);
end;
ASynEdit.ScrollOnEditLeftOptions.Assign(ScrollOnEditLeftOptions);
ASynEdit.ScrollOnEditRightOptions.Assign(ScrollOnEditRightOptions);
finally
ASynEdit.EndUpdate;
end;

View File

@ -1,14 +1,14 @@
object EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
Left = 0
Height = 232
Height = 397
Top = 0
Width = 460
ClientHeight = 232
ClientHeight = 397
ClientWidth = 460
TabOrder = 0
Visible = False
DesignLeft = 138
DesignTop = 138
DesignLeft = 225
DesignTop = 65
object EditorTrimSpaceTypeLabel: TLabel
AnchorSideLeft.Control = EditorTrimSpaceTypeComboBox
AnchorSideLeft.Side = asrBottom
@ -17,7 +17,7 @@ object EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
Left = 156
Height = 15
Top = 29
Width = 141
Width = 137
BorderSpacing.Left = 6
Caption = 'EditorTrimSpaceTypeLabel'
ParentColor = False
@ -63,4 +63,354 @@ object EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
Style = csDropDownList
TabOrder = 1
end
object Panel1: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = DBRigthScroll
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 75
Top = 75
Width = 448
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
BevelOuter = bvNone
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 3
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 75
ClientWidth = 448
TabOrder = 2
object Panel2: TPanel
Left = 0
Height = 23
Top = 0
Width = 229
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 229
TabOrder = 0
object lbLeftDist: TLabel
Left = 0
Height = 15
Top = 0
Width = 50
Caption = 'lbLeftDist'
ParentColor = False
end
object edLeftDist: TSpinEdit
Left = 159
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel3: TPanel
Left = 235
Height = 23
Top = 0
Width = 213
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 213
TabOrder = 1
object lbLeftDistP: TLabel
Left = 0
Height = 15
Top = 0
Width = 57
Caption = 'lbLeftDistP'
ParentColor = False
end
object edLeftDistP: TSpinEdit
Left = 143
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel4: TPanel
Left = 0
Height = 23
Top = 26
Width = 229
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 229
TabOrder = 2
object lbLeftAdd: TLabel
Left = 0
Height = 15
Top = 0
Width = 52
Caption = 'lbLeftAdd'
ParentColor = False
end
object edLeftAdd: TSpinEdit
Left = 159
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object PnlLeftAddP: TPanel
Left = 235
Height = 23
Top = 26
Width = 213
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 213
TabOrder = 3
object lbLeftAddP: TLabel
Left = 0
Height = 15
Top = 0
Width = 59
Caption = 'lbLeftAddP'
ParentColor = False
end
object edLeftAddP: TSpinEdit
Left = 143
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel6: TPanel
Left = 0
Height = 23
Top = 52
Width = 229
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 229
TabOrder = 4
object lbLeftAddMax: TLabel
Left = 0
Height = 15
Top = 0
Width = 75
Caption = 'lbLeftAddMax'
ParentColor = False
end
object edLeftAddMax: TSpinEdit
Left = 159
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
end
object DBRigthScroll: TDividerBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = EditorTrimSpaceTypeComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 54
Width = 448
Caption = 'DBLeftScroll'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Font.Style = [fsBold]
ParentFont = False
end
object DBLeftScroll: TDividerBevel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 15
Top = 156
Width = 448
Caption = 'DBRightScroll'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
Font.Style = [fsBold]
ParentFont = False
end
object Panel7: TPanel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = DBLeftScroll
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
Left = 6
Height = 75
Top = 177
Width = 448
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6
BevelOuter = bvNone
ChildSizing.HorizontalSpacing = 6
ChildSizing.VerticalSpacing = 3
ChildSizing.EnlargeHorizontal = crsScaleChilds
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 2
ClientHeight = 75
ClientWidth = 448
TabOrder = 3
object Panel8: TPanel
Left = 0
Height = 23
Top = 0
Width = 240
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 240
TabOrder = 0
object lbRightDist: TLabel
Left = 0
Height = 15
Top = 0
Width = 58
Caption = 'lbRightDist'
ParentColor = False
end
object edRightDist: TSpinEdit
Left = 170
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel9: TPanel
Left = 246
Height = 23
Top = 0
Width = 202
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 202
TabOrder = 1
object lbRightDistP: TLabel
Left = 0
Height = 15
Top = 0
Width = 65
Caption = 'lbRightDistP'
ParentColor = False
end
object edRightDistP: TSpinEdit
Left = 132
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel10: TPanel
Left = 0
Height = 23
Top = 26
Width = 240
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 240
TabOrder = 2
object lbRightAdd: TLabel
Left = 0
Height = 15
Top = 0
Width = 60
Caption = 'lbRightAdd'
ParentColor = False
end
object edRightAdd: TSpinEdit
Left = 170
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel11: TPanel
Left = 246
Height = 23
Top = 26
Width = 202
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 202
TabOrder = 3
object lbRightAddP: TLabel
Left = 0
Height = 15
Top = 0
Width = 67
Caption = 'lbRightAddP'
ParentColor = False
end
object edRightAddP: TSpinEdit
Left = 132
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
object Panel12: TPanel
Left = 0
Height = 23
Top = 52
Width = 240
AutoSize = True
BevelOuter = bvNone
ClientHeight = 23
ClientWidth = 240
TabOrder = 4
object lbRightAddMax: TLabel
Left = 0
Height = 15
Top = 0
Width = 83
Caption = 'lbRightAddMax'
ParentColor = False
end
object edRightAddMax: TSpinEdit
Left = 170
Height = 23
Top = 0
Width = 70
Align = alRight
TabOrder = 0
end
end
end
end

View File

@ -32,11 +32,11 @@ interface
uses
// LCL
LCLProc, StdCtrls, ExtCtrls,
LCLProc, StdCtrls, ExtCtrls, Spin,
// SynEdit
SynEdit, SynEditTextTrimmer,
// IdeIntf
IDEOptionsIntf, IDEOptEditorIntf,
IDEOptionsIntf, IDEOptEditorIntf, DividerBevel, CheckBoxThemed,
// IDE
EditorOptions, LazarusIDEStrConsts, editor_general_options;
@ -44,9 +44,42 @@ type
{ TEditorGeneralMiscOptionsFrame }
TEditorGeneralMiscOptionsFrame = class(TAbstractIDEOptionsEditor)
DBRigthScroll: TDividerBevel;
DBLeftScroll: TDividerBevel;
EditorTrimSpaceTypeComboBox: TComboBox;
EditorOptionsGroupBox: TCheckGroup;
EditorTrimSpaceTypeLabel: TLabel;
lbLeftDist: TLabel;
lbLeftDistP: TLabel;
lbLeftAdd: TLabel;
lbLeftAddP: TLabel;
lbLeftAddMax: TLabel;
lbRightDist: TLabel;
lbRightDistP: TLabel;
lbRightAdd: TLabel;
lbRightAddP: TLabel;
lbRightAddMax: TLabel;
Panel1: TPanel;
Panel10: TPanel;
Panel11: TPanel;
Panel12: TPanel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
Panel6: TPanel;
Panel7: TPanel;
Panel8: TPanel;
Panel9: TPanel;
edLeftDist: TSpinEdit;
edLeftDistP: TSpinEdit;
edLeftAdd: TSpinEdit;
edLeftAddP: TSpinEdit;
edLeftAddMax: TSpinEdit;
edRightDist: TSpinEdit;
edRightDistP: TSpinEdit;
edRightAdd: TSpinEdit;
edRightAddP: TSpinEdit;
edRightAddMax: TSpinEdit;
procedure EditorOptionsGroupBoxItemClick(Sender: TObject; {%H-}Index: integer);
private
FDialog: TAbstractOptionsEditorDialog;
@ -97,6 +130,19 @@ begin
EditorTrimSpaceTypeComboBox.Items.Add(dlgTrimSpaceTypeCaretMove);
EditorTrimSpaceTypeComboBox.Items.Add(dlgTrimSpaceTypePosOnly);
EditorTrimSpaceTypeLabel.Caption := dlgTrimSpaceTypeCaption;
DBLeftScroll.Caption := lisDynPkgAutoScrollOnDeletePa;
lbLeftDist.Caption := lisDynPkgTriggerOnMinCharsVis;
lbLeftDistP.Caption := lisDynPkgTriggerOnMinCharsOfW;
lbLeftAdd.Caption := lisDynPkgAmountToScrollIn;
lbLeftAddP.Caption := lisDynPkgAmountToScrollIn2;
lbLeftAddMax.Caption := lisDynPkgAmountToScrollInMax;
DBRigthScroll.Caption := lisDynPkgAutoScrollOnTypePast;
lbRightDist.Caption := lisDynPkgTriggerOnMinCharsVis;
lbRightDistP.Caption := lisDynPkgTriggerOnMinCharsOfW;
lbRightAdd.Caption := lisDynPkgAmountToScrollIn;
lbRightAddP.Caption := lisDynPkgAmountToScrollIn2;
lbRightAddMax.Caption := lisDynPkgAmountToScrollInMax;
end;
procedure TEditorGeneralMiscOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
@ -114,6 +160,21 @@ begin
{$IFDEF WinIME}
Checked[5] := UseMinimumIme;
{$ENDIF}
with ScrollOnEditLeftOptions do begin
edLeftDist.Value := KeepBorderDistance;
edLeftDistP.Value := KeepBorderDistancePercent;
edLeftAdd.Value := ScrollExtraColumns;
edLeftAddP.Value := ScrollExtraPercent;
edLeftAddMax.Value := ScrollExtraMax;
end;
with ScrollOnEditRightOptions do begin
edRightDist.Value := KeepBorderDistance;
edRightDistP.Value := KeepBorderDistancePercent;
edRightAdd.Value := ScrollExtraColumns;
edRightAddP.Value := ScrollExtraPercent;
edRightAddMax.Value := ScrollExtraMax;
end;
end;
EditorTrimSpaceTypeComboBox.ItemIndex := ord(TrimSpaceType);
end;
@ -145,6 +206,21 @@ begin
{$IFDEF WinIME}
UseMinimumIme := EditorOptionsGroupBox.Checked[5];
{$ENDIF}
with ScrollOnEditLeftOptions do begin
KeepBorderDistance := edLeftDist.Value;
KeepBorderDistancePercent := edLeftDistP.Value;
ScrollExtraColumns := edLeftAdd.Value;
ScrollExtraPercent := edLeftAddP.Value;
ScrollExtraMax := edLeftAddMax.Value;
end;
with ScrollOnEditRightOptions do begin
KeepBorderDistance := edRightDist.Value;
KeepBorderDistancePercent := edRightDistP.Value;
ScrollExtraColumns := edRightAdd.Value;
ScrollExtraPercent := edRightAddP.Value;
ScrollExtraMax := edRightAddMax.Value;
end;
end;
end;

View File

@ -6631,6 +6631,13 @@ resourcestring
lisDebugOptionsFrmDebuggerBackend = 'Debugger Backend:';
lisDebugOptionsFrmUseIDEDebugger = '-- Use IDE default Debugger --';
lisDebugOptionsFrmUnknownDebuggerBacke = 'Unknown Debugger backend "%s"';
lisDynPkgAutoScrollOnDeletePa = 'Auto Scroll on delete past left border';
lisDynPkgAutoScrollOnTypePast = 'Auto Scroll on type past right border';
lisDynPkgTriggerOnMinCharsVis = 'Trigger on min chars visible';
lisDynPkgTriggerOnMinCharsOfW = 'Trigger on min chars (% of width)';
lisDynPkgAmountToScrollIn = 'Amount to scroll in';
lisDynPkgAmountToScrollIn2 = 'Amount to scroll in (%)';
lisDynPkgAmountToScrollInMax = 'Amount to scroll in (Max)';
implementation