mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 16:56:03 +02:00
SourceEditor: Allow tabs at top, left, right, bottom. Issue #15905 Based on patch by Flávio Etrusco
git-svn-id: trunk@23848 -
This commit is contained in:
parent
963759090b
commit
7d68d5d48b
@ -37,7 +37,7 @@ uses
|
||||
// RTL, FCL
|
||||
Classes, SysUtils,
|
||||
// LCL
|
||||
Controls, Graphics, LCLProc, FileUtil, LResources, Forms,
|
||||
Controls, ExtCtrls, Graphics, LCLProc, FileUtil, LResources, Forms,
|
||||
// synedit
|
||||
SynEdit, SynEditAutoComplete, SynEditHighlighter, SynEditHighlighterFoldBase, SynEditKeyCmds,
|
||||
SynEditStrConst, SynEditMarkupBracket, SynEditMarkupHighAll, SynEditMarkupWordGroup,
|
||||
@ -852,6 +852,7 @@ type
|
||||
fFindTextAtCursor: Boolean;
|
||||
fShowTabCloseButtons: Boolean;
|
||||
fShowTabNumbers: Boolean;
|
||||
fTabPosition: TTabPosition;
|
||||
fSynEditOptions: TSynEditorOptions;
|
||||
fSynEditOptions2: TSynEditorOptions2;
|
||||
fUndoAfterSave: Boolean;
|
||||
@ -983,6 +984,8 @@ type
|
||||
property ShowTabCloseButtons: Boolean
|
||||
read fShowTabCloseButtons write fShowTabCloseButtons;
|
||||
property ShowTabNumbers: Boolean read fShowTabNumbers write fShowTabNumbers;
|
||||
property TabPosition: TTabPosition
|
||||
read fTabPosition write fTabPosition default tpTop;
|
||||
property UndoAfterSave: Boolean read fUndoAfterSave
|
||||
write fUndoAfterSave default True;
|
||||
property FindTextAtCursor: Boolean
|
||||
@ -2374,6 +2377,7 @@ begin
|
||||
|
||||
// General options
|
||||
fShowTabCloseButtons := True;
|
||||
fTabPosition := tpTop;
|
||||
FCopyWordAtCursorOnCopyNone := True;
|
||||
FShowGutterHints := True;
|
||||
fBlockIndent := 2;
|
||||
@ -2632,6 +2636,8 @@ begin
|
||||
'EditorOptions/General/Editor/ShowTabCloseButtons', True);
|
||||
fShowTabNumbers :=
|
||||
XMLConfig.GetValue('EditorOptions/General/Editor/ShowTabNumbers', False);
|
||||
fTabPosition := tpTop;
|
||||
XMLConfig.ReadObject('EditorOptions/General/Editor/', self, self, 'TabPosition');
|
||||
FCopyWordAtCursorOnCopyNone :=
|
||||
XMLConfig.GetValue(
|
||||
'EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone', True);
|
||||
@ -2874,6 +2880,7 @@ begin
|
||||
, fShowTabCloseButtons, True);
|
||||
XMLConfig.SetDeleteValue('EditorOptions/General/Editor/ShowTabNumbers'
|
||||
, fShowTabNumbers, False);
|
||||
XMLConfig.WriteObject('EditorOptions/General/Editor/', self, nil, 'TabPosition');
|
||||
XMLConfig.SetDeleteValue(
|
||||
'EditorOptions/General/Editor/CopyWordAtCursorOnCopyNone',
|
||||
FCopyWordAtCursorOnCopyNone, True);
|
||||
|
@ -1,8 +1,9 @@
|
||||
inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
||||
Height = 186
|
||||
Width = 459
|
||||
ClientHeight = 186
|
||||
ClientWidth = 459
|
||||
Height = 232
|
||||
Width = 460
|
||||
ClientHeight = 232
|
||||
ClientWidth = 460
|
||||
TabOrder = 0
|
||||
Visible = False
|
||||
DesignLeft = 138
|
||||
DesignTop = 138
|
||||
@ -12,9 +13,9 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
||||
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 156
|
||||
Height = 14
|
||||
Height = 16
|
||||
Top = 161
|
||||
Width = 127
|
||||
Width = 142
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'EditorTrimSpaceTypeLabel'
|
||||
ParentColor = False
|
||||
@ -29,7 +30,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
||||
Left = 0
|
||||
Height = 152
|
||||
Top = 0
|
||||
Width = 459
|
||||
Width = 460
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
@ -52,12 +53,38 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
||||
AnchorSideTop.Control = EditorOptionsGroupBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 21
|
||||
Height = 23
|
||||
Top = 158
|
||||
Width = 150
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 13
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
object EditorTabPositionCheckBox: TComboBox[3]
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 187
|
||||
Width = 150
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
object EditorTabPositionLabel: TLabel[4]
|
||||
AnchorSideLeft.Control = EditorTrimSpaceTypeCheckBox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = EditorTabPositionCheckBox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 156
|
||||
Height = 16
|
||||
Top = 190
|
||||
Width = 142
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'EditorTrimSpaceTypeLabel'
|
||||
ParentColor = False
|
||||
end
|
||||
end
|
||||
|
@ -35,7 +35,9 @@ type
|
||||
TEditorGeneralMiscOptionsFrame = class(TAbstractIDEOptionsEditor)
|
||||
EditorTrimSpaceTypeCheckBox: TComboBox;
|
||||
EditorOptionsGroupBox: TCheckGroup;
|
||||
EditorTabPositionCheckBox: TComboBox;
|
||||
EditorTrimSpaceTypeLabel: TLabel;
|
||||
EditorTabPositionLabel: TLabel;
|
||||
procedure EditorOptionsGroupBoxItemClick(Sender: TObject; Index: integer);
|
||||
private
|
||||
FDialog: TAbstractOptionsEditorDialog;
|
||||
@ -86,9 +88,16 @@ begin
|
||||
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypeCaretMove);
|
||||
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypePosOnly);
|
||||
EditorTrimSpaceTypeLabel.Caption := dlgTrimSpaceTypeCaption;
|
||||
EditorTabPositionCheckBox.Items.Add(dlgNotebookTabPosTop);
|
||||
EditorTabPositionCheckBox.Items.Add(dlgNotebookTabPosBottom);
|
||||
EditorTabPositionCheckBox.Items.Add(dlgNotebookTabPosLeft);
|
||||
EditorTabPositionCheckBox.Items.Add(dlgNotebookTabPosRight);
|
||||
EditorTabPositionLabel.Caption := dlgNotebookTabPos;
|
||||
end;
|
||||
|
||||
procedure TEditorGeneralMiscOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
const
|
||||
TabPosToIndex : Array [TTabPosition] of Integer = (0, 1, 2, 3);
|
||||
begin
|
||||
with AOptions as TEditorOptions do
|
||||
begin
|
||||
@ -104,6 +113,7 @@ begin
|
||||
Checked[6] := ShowTabNumbers;
|
||||
end;
|
||||
EditorTrimSpaceTypeCheckBox.ItemIndex := ord(TrimSpaceType);
|
||||
EditorTabPositionCheckBox.ItemIndex := TabPosToIndex[TabPosition];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -117,6 +127,8 @@ procedure TEditorGeneralMiscOptionsFrame.WriteSettings(AOptions: TAbstractIDEOpt
|
||||
TEditorOptions(AOptions).SynEditOptions := TEditorOptions(AOptions).SynEditOptions - [AnOption];
|
||||
end;
|
||||
|
||||
const
|
||||
TabIndexToPos : Array [0..3] of TTabPosition = (tpTop, tpBottom, tpLeft, tpRight);
|
||||
begin
|
||||
with AOptions as TEditorOptions do
|
||||
begin
|
||||
@ -132,6 +144,7 @@ begin
|
||||
SynEditOptions2 := SynEditOptions2 - [eoFoldedCopyPaste];
|
||||
ShowTabNumbers := EditorOptionsGroupBox.Checked[6];
|
||||
TrimSpaceType := TSynEditStringTrimmingType(EditorTrimSpaceTypeCheckBox.ItemIndex);
|
||||
TabPosition := TabIndexToPos[EditorTabPositionCheckBox.ItemIndex];
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -1200,6 +1200,11 @@ resourcestring
|
||||
lisShowSpecialCharacters = 'Show special characters';
|
||||
dlgCloseButtonsNotebook = 'Show close buttons in notebook';
|
||||
dlgTabNumbersNotebook = 'Show tab numbers in notebook';
|
||||
dlgNotebookTabPos = 'Positoon for source-notebook tabs';
|
||||
dlgNotebookTabPosTop = 'Top';
|
||||
dlgNotebookTabPosBottom = 'Bottom';
|
||||
dlgNotebookTabPosLeft = 'Left';
|
||||
dlgNotebookTabPosRight = 'Right';
|
||||
dlgShowScrollHint = 'Show scroll hint';
|
||||
dlgShowGutterHints = 'Show gutter hints';
|
||||
dlgSmartTabs = 'Smart tabs';
|
||||
|
@ -4535,6 +4535,7 @@ Begin
|
||||
Options:=Options+[nboShowCloseButtons]
|
||||
else
|
||||
Options:=Options-[nboShowCloseButtons];
|
||||
TabPosition := EditorOpts.TabPosition;
|
||||
OnPageChanged := @NotebookPageChanged;
|
||||
OnCloseTabClicked:=@CloseTabClicked;
|
||||
OnMouseDown:=@NotebookMouseDown;
|
||||
@ -7168,6 +7169,7 @@ Begin
|
||||
NoteBook.Options:=NoteBook.Options+[nboShowCloseButtons]
|
||||
else
|
||||
NoteBook.Options:=NoteBook.Options-[nboShowCloseButtons];
|
||||
Notebook.TabPosition := EditorOpts.TabPosition;
|
||||
end;
|
||||
|
||||
SourceCompletionTimer.Interval:=EditorOpts.AutoDelayInMSec;
|
||||
|
Loading…
Reference in New Issue
Block a user