mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 18:59:06 +02:00
IDE, SourceEditor: Implement "Close tabs on right". Issue #0029929
git-svn-id: trunk@60016 -
This commit is contained in:
parent
fe756b5c1b
commit
781767973e
@ -666,7 +666,7 @@ const
|
||||
);
|
||||
|
||||
const
|
||||
EditorOptsFormatVersion = 12;
|
||||
EditorOptsFormatVersion = 13;
|
||||
{ * Changes in Version 6:
|
||||
- ColorSchemes now have a Global settings part.
|
||||
Language specific changes must save UseSchemeGlobals=False (Default is true)
|
||||
@ -686,6 +686,8 @@ const
|
||||
* Changes in Version 12:
|
||||
Used in Colorscheme/Version
|
||||
Colors for MarkupFoldColor can now have gaps (before unset colors were filtered)
|
||||
* Changes in Version 13:
|
||||
CtrlMiddleTabClickClosesOthers was replaced by MiddleTabClickClosesOthersModifier
|
||||
}
|
||||
EditorMouseOptsFormatVersion = 1;
|
||||
{ * Changes in Version 6:
|
||||
@ -1378,6 +1380,8 @@ type
|
||||
FBlockTabIndent: Integer;
|
||||
FCompletionLongLineHintInMSec: Integer;
|
||||
FCompletionLongLineHintType: TSynCompletionLongHintType;
|
||||
FMiddleTabClickClosesOthersModifier: TShiftState;
|
||||
FMiddleTabClickClosesToRightModifier: TShiftState;
|
||||
FMultiCaretDefaultColumnSelectMode: TSynPluginMultiCaretDefaultMode;
|
||||
FMultiCaretDefaultMode: TSynPluginMultiCaretDefaultMode;
|
||||
FMultiCaretDeleteSkipLineBreak: Boolean;
|
||||
@ -1718,7 +1722,11 @@ type
|
||||
|
||||
// Multi window
|
||||
property CtrlMiddleTabClickClosesOthers: Boolean
|
||||
read FCtrlMiddleTabClickClosesOthers write FCtrlMiddleTabClickClosesOthers default True;
|
||||
read FCtrlMiddleTabClickClosesOthers write FCtrlMiddleTabClickClosesOthers stored False default True;
|
||||
property MiddleTabClickClosesOthersModifier: TShiftState
|
||||
read FMiddleTabClickClosesOthersModifier write FMiddleTabClickClosesOthersModifier default [ssCtrl];
|
||||
property MiddleTabClickClosesToRightModifier: TShiftState
|
||||
read FMiddleTabClickClosesToRightModifier write FMiddleTabClickClosesToRightModifier default [];
|
||||
|
||||
property ShowFileNameInCaption: Boolean
|
||||
read FShowFileNameInCaption write FShowFileNameInCaption default False;
|
||||
@ -4668,6 +4676,8 @@ begin
|
||||
|
||||
// Multi window
|
||||
FCtrlMiddleTabClickClosesOthers := True;
|
||||
FMiddleTabClickClosesOthersModifier := [ssCtrl];
|
||||
FMiddleTabClickClosesToRightModifier := [];
|
||||
FShowFileNameInCaption := False;
|
||||
|
||||
// Comment
|
||||
@ -4942,6 +4952,9 @@ begin
|
||||
on E: Exception do
|
||||
DebugLn('[TEditorOptions.Load] ERROR: ', e.Message);
|
||||
end;
|
||||
if FileVersion < 13 then
|
||||
if not CtrlMiddleTabClickClosesOthers then // user set option to false
|
||||
MiddleTabClickClosesOthersModifier := [];
|
||||
end;
|
||||
|
||||
procedure TEditorOptions.Save;
|
||||
|
@ -21,15 +21,15 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 173
|
||||
Top = 242
|
||||
Height = 138
|
||||
Top = 277
|
||||
Width = 509
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 173
|
||||
ClientHeight = 138
|
||||
ClientWidth = 509
|
||||
TabOrder = 0
|
||||
object listAccessType: TCheckListBox
|
||||
@ -52,7 +52,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Height = 50
|
||||
Top = 165
|
||||
Top = 138
|
||||
Width = 509
|
||||
Align = alClient
|
||||
BevelOuter = bvNone
|
||||
@ -75,7 +75,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
Cursor = crVSplit
|
||||
Left = 0
|
||||
Height = 5
|
||||
Top = 160
|
||||
Top = 138
|
||||
Width = 509
|
||||
Align = alTop
|
||||
ResizeAnchor = akTop
|
||||
@ -89,7 +89,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 3
|
||||
Top = 135
|
||||
Top = 170
|
||||
Width = 60
|
||||
BorderSpacing.Bottom = 6
|
||||
end
|
||||
@ -100,7 +100,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 70
|
||||
Height = 15
|
||||
Top = 129
|
||||
Top = 164
|
||||
Width = 166
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Bottom = 6
|
||||
@ -118,7 +118,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 246
|
||||
Height = 3
|
||||
Top = 135
|
||||
Top = 170
|
||||
Width = 275
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 10
|
||||
@ -131,7 +131,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 65
|
||||
Top = 150
|
||||
Top = 185
|
||||
Width = 509
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
@ -195,7 +195,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 221
|
||||
Top = 256
|
||||
Width = 521
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Caption = 'lblAccessType'
|
||||
@ -249,7 +249,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 6
|
||||
Height = 102
|
||||
Height = 137
|
||||
Top = 21
|
||||
Width = 509
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
@ -259,7 +259,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
BorderSpacing.Bottom = 6
|
||||
BevelOuter = bvNone
|
||||
ChildSizing.ControlsPerLine = 2
|
||||
ClientHeight = 102
|
||||
ClientHeight = 137
|
||||
ClientWidth = 509
|
||||
TabOrder = 2
|
||||
object chkShowCloseBtn: TCheckBox
|
||||
@ -315,19 +315,6 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
Caption = 'chkUseTabHistory'
|
||||
TabOrder = 3
|
||||
end
|
||||
object chkCtrlMiddleCloseOthers: TCheckBox
|
||||
AnchorSideLeft.Control = pnlNBTabs
|
||||
AnchorSideTop.Control = chkHideSingleTab
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 19
|
||||
Top = 38
|
||||
Width = 159
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaLeftTop
|
||||
Caption = 'chkCtrlMiddleCloseOthers'
|
||||
TabOrder = 4
|
||||
end
|
||||
object CenterLabel: TLabel
|
||||
AnchorSideLeft.Control = pnlNBTabs
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
@ -348,7 +335,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
Top = 38
|
||||
Width = 89
|
||||
Caption = 'chkMultiLine'
|
||||
TabOrder = 5
|
||||
TabOrder = 4
|
||||
end
|
||||
object EditorTabPositionLabel: TLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
@ -356,7 +343,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 6
|
||||
Height = 15
|
||||
Top = 83
|
||||
Top = 64
|
||||
Width = 121
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'EditorTabPositionLabel'
|
||||
@ -369,26 +356,94 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 79
|
||||
Top = 60
|
||||
Width = 150
|
||||
BorderSpacing.Left = 5
|
||||
BorderSpacing.Top = 3
|
||||
ItemHeight = 15
|
||||
Style = csDropDownList
|
||||
TabOrder = 6
|
||||
TabOrder = 5
|
||||
end
|
||||
object chkShowFileNameInCaption: TCheckBox
|
||||
AnchorSideLeft.Control = pnlNBTabs
|
||||
AnchorSideTop.Control = chkCtrlMiddleCloseOthers
|
||||
AnchorSideTop.Control = chkHideSingleTab
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 19
|
||||
Top = 57
|
||||
Top = 38
|
||||
Width = 170
|
||||
BorderSpacing.CellAlignHorizontal = ccaLeftTop
|
||||
BorderSpacing.CellAlignVertical = ccaLeftTop
|
||||
Caption = 'chkShowFileNameInCaption'
|
||||
TabOrder = 6
|
||||
end
|
||||
object cgCloseOther: TCheckGroup
|
||||
AnchorSideLeft.Control = pnlNBTabs
|
||||
AnchorSideTop.Control = EditorTabPositionCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 5
|
||||
Height = 51
|
||||
Top = 86
|
||||
Width = 134
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 5
|
||||
BorderSpacing.Top = 3
|
||||
Caption = 'cgCloseOther'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 31
|
||||
ClientWidth = 130
|
||||
Columns = 3
|
||||
Items.Strings = (
|
||||
'Shift'
|
||||
'Ctrl'
|
||||
'Alt'
|
||||
)
|
||||
TabOrder = 7
|
||||
Data = {
|
||||
03000000020202
|
||||
}
|
||||
end
|
||||
object cgCloseRight: TCheckGroup
|
||||
AnchorSideLeft.Control = chkMultiLine
|
||||
AnchorSideTop.Control = EditorTabPositionCheckBox
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 260
|
||||
Height = 51
|
||||
Top = 86
|
||||
Width = 134
|
||||
AutoFill = True
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 5
|
||||
BorderSpacing.Top = 3
|
||||
Caption = 'cgCloseRight'
|
||||
ChildSizing.LeftRightSpacing = 6
|
||||
ChildSizing.TopBottomSpacing = 6
|
||||
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
|
||||
ChildSizing.EnlargeVertical = crsHomogenousChildResize
|
||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 3
|
||||
ClientHeight = 31
|
||||
ClientWidth = 130
|
||||
Columns = 3
|
||||
Items.Strings = (
|
||||
'Shift'
|
||||
'Ctrl'
|
||||
'Alt'
|
||||
)
|
||||
TabOrder = 8
|
||||
Data = {
|
||||
03000000020202
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -43,9 +43,10 @@ type
|
||||
Bevel2a: TBevel;
|
||||
Bevel2: TBevel;
|
||||
CenterLabel: TLabel;
|
||||
cgCloseOther: TCheckGroup;
|
||||
cgCloseRight: TCheckGroup;
|
||||
chkShowFileNameInCaption: TCheckBox;
|
||||
chkMultiLine: TCheckBox;
|
||||
chkCtrlMiddleCloseOthers: TCheckBox;
|
||||
chkUseTabHistory: TCheckBox;
|
||||
chkShowCloseBtn: TCheckBox;
|
||||
chkShowNumbers: TCheckBox;
|
||||
@ -148,7 +149,6 @@ begin
|
||||
chkShowNumbers.Caption := dlgTabNumbersNotebook;
|
||||
chkShowCloseBtn.Caption := dlgCloseButtonsNotebook;
|
||||
chkUseTabHistory.Caption := dlgUseTabsHistory;
|
||||
chkCtrlMiddleCloseOthers.Caption := dlgCtrlMiddleTabCloseOtherPages;
|
||||
chkShowFileNameInCaption.Caption := dlgShowFileNameInCaption;
|
||||
chkMultiLine.Caption := dlgSourceEditTabMultiLine;
|
||||
EditorTabPositionCheckBox.Items.Add(lisNotebookTabPosTop);
|
||||
@ -156,7 +156,8 @@ begin
|
||||
EditorTabPositionCheckBox.Items.Add(lisNotebookTabPosLeft);
|
||||
EditorTabPositionCheckBox.Items.Add(lisNotebookTabPosRight);
|
||||
EditorTabPositionLabel.Caption := dlgNotebookTabPos;
|
||||
|
||||
cgCloseOther.Caption := dlgMiddleTabCloseOtherPagesMod;
|
||||
cgCloseRight.Caption := dlgMiddleTabCloseRightPagesMod;
|
||||
end;
|
||||
|
||||
procedure TEditorMultiWindowOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
@ -170,7 +171,13 @@ begin
|
||||
chkShowNumbers.Checked := ShowTabNumbers;
|
||||
chkShowCloseBtn.Checked := ShowTabCloseButtons and chkShowCloseBtn.Enabled;
|
||||
chkUseTabHistory.Checked := UseTabHistory;
|
||||
chkCtrlMiddleCloseOthers.Checked := CtrlMiddleTabClickClosesOthers;
|
||||
cgCloseOther.Checked[0] := ssShift in MiddleTabClickClosesOthersModifier;
|
||||
cgCloseOther.Checked[1] := ssCtrl in MiddleTabClickClosesOthersModifier;
|
||||
cgCloseOther.Checked[2] := ssAlt in MiddleTabClickClosesOthersModifier;
|
||||
cgCloseRight.Checked[0] := ssShift in MiddleTabClickClosesToRightModifier;
|
||||
cgCloseRight.Checked[1] := ssCtrl in MiddleTabClickClosesToRightModifier;
|
||||
cgCloseRight.Checked[2] := ssAlt in MiddleTabClickClosesToRightModifier;
|
||||
|
||||
chkShowFileNameInCaption.Checked := ShowFileNameInCaption;
|
||||
chkMultiLine.Checked := MultiLineTab;
|
||||
EditorTabPositionCheckBox.ItemIndex := TabPosToIndex[TabPosition];
|
||||
@ -199,7 +206,16 @@ begin
|
||||
ShowTabNumbers := chkShowNumbers.Checked;
|
||||
ShowTabCloseButtons := chkShowCloseBtn.Checked;
|
||||
UseTabHistory := chkUseTabHistory.Checked;
|
||||
CtrlMiddleTabClickClosesOthers := chkCtrlMiddleCloseOthers.Checked;
|
||||
|
||||
MiddleTabClickClosesOthersModifier := [];
|
||||
if cgCloseOther.Checked[0] then MiddleTabClickClosesOthersModifier := MiddleTabClickClosesOthersModifier + [ssShift];
|
||||
if cgCloseOther.Checked[1] then MiddleTabClickClosesOthersModifier := MiddleTabClickClosesOthersModifier + [ssCtrl];
|
||||
if cgCloseOther.Checked[2] then MiddleTabClickClosesOthersModifier := MiddleTabClickClosesOthersModifier + [ssAlt];
|
||||
MiddleTabClickClosesToRightModifier := [];
|
||||
if cgCloseRight.Checked[0] then MiddleTabClickClosesToRightModifier := MiddleTabClickClosesToRightModifier + [ssShift];
|
||||
if cgCloseRight.Checked[1] then MiddleTabClickClosesToRightModifier := MiddleTabClickClosesToRightModifier + [ssCtrl];
|
||||
if cgCloseRight.Checked[2] then MiddleTabClickClosesToRightModifier := MiddleTabClickClosesToRightModifier + [ssAlt];
|
||||
|
||||
ShowFileNameInCaption := chkShowFileNameInCaption.Checked;
|
||||
MultiLineTab := chkMultiLine.Checked;
|
||||
TabPosition := TabIndexToPos[EditorTabPositionCheckBox.ItemIndex];
|
||||
|
@ -1636,7 +1636,8 @@ resourcestring
|
||||
dlgScrollHint = 'Show scroll hint';
|
||||
lisShowSpecialCharacters = 'Show special characters';
|
||||
dlgCloseButtonsNotebook = 'Show close buttons in notebook';
|
||||
dlgCtrlMiddleTabCloseOtherPages = 'Ctrl-middle-click on tab closes all others';
|
||||
dlgMiddleTabCloseOtherPagesMod = 'Middle-click-modifier to close all other tabs';
|
||||
dlgMiddleTabCloseRightPagesMod = 'Middle-click-modifier to close tabs on the right';
|
||||
dlgShowFileNameInCaption = 'Show file name in caption';
|
||||
dlgSourceEditTabMultiLine = 'Multiline tabs';
|
||||
dlgHideSingleTabInNotebook = 'Hide tab in single page windows';
|
||||
@ -2814,6 +2815,7 @@ resourcestring
|
||||
uemProcedureJump = 'Procedure Jump';
|
||||
uemClosePage = '&Close Page';
|
||||
uemCloseOtherPages = 'Close All &Other Pages';
|
||||
uemCloseOtherPagesRight = 'Close Pages on the &Right';
|
||||
uemLockPage = '&Lock Page';
|
||||
uemCopyToNewWindow = 'Clone to New Window';
|
||||
uemCopyToOtherWindow = 'Clone to Other Window';
|
||||
|
@ -475,7 +475,7 @@ type
|
||||
procedure SrcNotebookFileOpenAtCursor(Sender: TObject);
|
||||
procedure SrcNotebookFileSave(Sender: TObject);
|
||||
procedure SrcNotebookFileSaveAs(Sender: TObject);
|
||||
procedure SrcNotebookFileClose(Sender: TObject; InvertedClose: boolean);
|
||||
procedure SrcNotebookFileClose(Sender: TObject; ACloseOptions: TCloseSrcEditorOptions);
|
||||
procedure SrcNotebookFindDeclaration(Sender: TObject);
|
||||
procedure SrcNotebookInitIdentCompletion(Sender: TObject;
|
||||
JumpToError: boolean; out Handled, Abort: boolean);
|
||||
@ -3146,12 +3146,13 @@ begin
|
||||
mnuNewFormClicked(Sender);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.SrcNotebookFileClose(Sender: TObject; InvertedClose: boolean);
|
||||
procedure TMainIDE.SrcNotebookFileClose(Sender: TObject;
|
||||
ACloseOptions: TCloseSrcEditorOptions);
|
||||
var
|
||||
PageIndex: LongInt;
|
||||
SrcNoteBook: TSourceNotebook;
|
||||
begin
|
||||
if InvertedClose then begin
|
||||
if ACloseOptions * [ceoCloseOthers, ceoCloseOthersOnRightSide] <> [] then begin
|
||||
if Sender is TTabSheet then begin
|
||||
SrcNoteBook := SourceEditorManager.SourceWindowWithPage(TTabSheet(Sender));
|
||||
if SrcNoteBook = nil then exit;
|
||||
@ -3162,7 +3163,7 @@ begin
|
||||
PageIndex := SrcNoteBook.PageIndex;
|
||||
end;
|
||||
// Close all but the active editor
|
||||
InvertedFileClose(PageIndex, SrcNoteBook);
|
||||
InvertedFileClose(PageIndex, SrcNoteBook, ceoCloseOthersOnRightSide in ACloseOptions);
|
||||
end
|
||||
else
|
||||
mnuCloseClicked(Sender); // close only the clicked source editor
|
||||
|
@ -562,6 +562,8 @@ type
|
||||
{ TSourceNotebook }
|
||||
|
||||
TJumpHistoryAction = (jhaBack, jhaForward, jhaViewWindow);
|
||||
TCloseSrcEditorOption = (ceoCloseOthers, ceoCloseOthersOnRightSide);
|
||||
TCloseSrcEditorOptions = set of TCloseSrcEditorOption;
|
||||
|
||||
TOnJumpToHistoryPoint = procedure(out NewCaretXY: TPoint;
|
||||
out NewTopLine: integer;
|
||||
@ -571,7 +573,7 @@ type
|
||||
AEditor: TSourceEditor; DeleteForwardHistory: boolean) of object;
|
||||
TOnMovingPage = procedure(Sender: TObject;
|
||||
OldPageIndex, NewPageIndex: integer) of object;
|
||||
TOnCloseSrcEditor = procedure(Sender: TObject; InvertedClose: boolean) of object;
|
||||
TOnCloseSrcEditor = procedure(Sender: TObject; ACloseOptions: TCloseSrcEditorOptions) of object;
|
||||
TOnShowHintForSource = procedure(SrcEdit: TSourceEditor;
|
||||
CaretPos: TPoint; AutoShown: Boolean) of object;
|
||||
TOnInitIdentCompletion = procedure(Sender: TObject; JumpToError: boolean;
|
||||
@ -797,7 +799,7 @@ type
|
||||
procedure EndAutoFocusLock;
|
||||
protected
|
||||
procedure CloseTabClicked(Sender: TObject);
|
||||
procedure CloseClicked(Sender: TObject; CloseOthers: Boolean = False);
|
||||
procedure CloseClicked(Sender: TObject; CloseOptions: TCloseSrcEditorOptions = []);
|
||||
procedure ToggleFormUnitClicked(Sender: TObject);
|
||||
procedure ToggleObjectInspClicked(Sender: TObject);
|
||||
|
||||
@ -1213,6 +1215,7 @@ type
|
||||
private
|
||||
// Context-Menu
|
||||
procedure CloseOtherPagesClicked(Sender: TObject);
|
||||
procedure CloseRightPagesClicked(Sender: TObject);
|
||||
procedure ReadOnlyClicked(Sender: TObject);
|
||||
procedure ToggleLineNumbersClicked(Sender: TObject);
|
||||
procedure ToggleI18NForLFMClicked(Sender: TObject);
|
||||
@ -1353,6 +1356,7 @@ var
|
||||
SrcEditMenuOpenFileAtCursor: TIDEMenuCommand;
|
||||
SrcEditMenuClosePage: TIDEMenuCommand;
|
||||
SrcEditMenuCloseOtherPages: TIDEMenuCommand;
|
||||
SrcEditMenuCloseOtherPagesToRight: TIDEMenuCommand;
|
||||
// bookmarks
|
||||
SrcEditMenuNextBookmark: TIDEMenuCommand;
|
||||
SrcEditMenuPrevBookmark: TIDEMenuCommand;
|
||||
@ -1535,6 +1539,8 @@ begin
|
||||
'Close Page', uemClosePage, nil, @ExecuteIdeMenuClick, nil, 'menu_close');
|
||||
SrcEditMenuCloseOtherPages := RegisterIDEMenuCommand(AParent,
|
||||
'Close All Other Pages',uemCloseOtherPages, nil, @ExecuteIdeMenuClick);
|
||||
SrcEditMenuCloseOtherPagesToRight := RegisterIDEMenuCommand(AParent,
|
||||
'Close Pages To the Right',uemCloseOtherPagesRight, nil, @ExecuteIdeMenuClick);
|
||||
|
||||
{$IFnDEF SingleSrcWindow}
|
||||
// Lock Editor
|
||||
@ -8319,8 +8325,13 @@ end;
|
||||
|
||||
procedure TSourceNotebook.CloseTabClicked(Sender: TObject);
|
||||
begin
|
||||
CloseClicked(Sender,
|
||||
(GetKeyState(VK_CONTROL) < 0) and EditorOpts.CtrlMiddleTabClickClosesOthers);
|
||||
if GetKeyShiftState * [ssShift, ssCtrl, ssAlt] = EditorOpts.MiddleTabClickClosesOthersModifier then
|
||||
CloseClicked(Sender, [ceoCloseOthers])
|
||||
else
|
||||
if GetKeyShiftState * [ssShift, ssCtrl, ssAlt] = EditorOpts.MiddleTabClickClosesToRightModifier then
|
||||
CloseClicked(Sender, [ceoCloseOthersOnRightSide])
|
||||
else
|
||||
CloseClicked(Sender, []);
|
||||
end;
|
||||
|
||||
function TSourceNotebook.GetEditors(Index:integer):TSourceEditor;
|
||||
@ -8355,10 +8366,11 @@ begin
|
||||
Result:=nil;
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.CloseClicked(Sender: TObject; CloseOthers: Boolean);
|
||||
procedure TSourceNotebook.CloseClicked(Sender: TObject;
|
||||
CloseOptions: TCloseSrcEditorOptions);
|
||||
Begin
|
||||
if assigned(Manager) and Assigned(Manager.OnCloseClicked) then
|
||||
Manager.OnCloseClicked(Sender, CloseOthers);
|
||||
Manager.OnCloseClicked(Sender, CloseOptions);
|
||||
end;
|
||||
|
||||
procedure TSourceNotebook.ToggleFormUnitClicked(Sender: TObject);
|
||||
@ -8598,9 +8610,15 @@ begin
|
||||
if (Button = mbMiddle) then
|
||||
begin
|
||||
TabIndex:=FNotebook.IndexOfPageAt(X, Y);
|
||||
if TabIndex>=0 then
|
||||
CloseClicked(NoteBookPage[TabIndex],
|
||||
(GetKeyState(VK_CONTROL) < 0) and EditorOpts.CtrlMiddleTabClickClosesOthers);
|
||||
if TabIndex>=0 then begin
|
||||
if GetKeyShiftState * [ssShift, ssCtrl, ssAlt] = EditorOpts.MiddleTabClickClosesOthersModifier then
|
||||
CloseClicked(NoteBookPage[TabIndex], [ceoCloseOthers])
|
||||
else
|
||||
if GetKeyShiftState * [ssShift, ssCtrl, ssAlt] = EditorOpts.MiddleTabClickClosesToRightModifier then
|
||||
CloseClicked(NoteBookPage[TabIndex], [ceoCloseOthersOnRightSide])
|
||||
else
|
||||
CloseClicked(NoteBookPage[TabIndex], []);
|
||||
end;
|
||||
end else
|
||||
if (Button = mbRight) then
|
||||
begin
|
||||
@ -10674,6 +10692,7 @@ begin
|
||||
{%region *** Pages section ***}
|
||||
SrcEditMenuClosePage.Command := GetCommand(ecClose);
|
||||
SrcEditMenuCloseOtherPages.OnClick := @SourceEditorManager.CloseOtherPagesClicked;
|
||||
SrcEditMenuCloseOtherPagesToRight.OnClick := @SourceEditorManager.CloseRightPagesClicked;
|
||||
|
||||
{$IFnDEF SingleSrcWindow}
|
||||
SrcEditMenuEditorLock.Command := GetCommand(ecLockEditor);
|
||||
@ -11306,7 +11325,13 @@ end;
|
||||
procedure TSourceEditorManager.CloseOtherPagesClicked(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnCloseClicked) then
|
||||
OnCloseClicked(Sender, True);
|
||||
OnCloseClicked(Sender, [ceoCloseOthers]);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.CloseRightPagesClicked(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnCloseClicked) then
|
||||
OnCloseClicked(Sender, [ceoCloseOthersOnRightSide]);
|
||||
end;
|
||||
|
||||
procedure TSourceEditorManager.ReadOnlyClicked(Sender: TObject);
|
||||
|
@ -229,7 +229,7 @@ function CloseProject: TModalResult;
|
||||
procedure OpenProject(aMenuItem: TIDEMenuItem);
|
||||
function CompleteLoadingProjectInfo: TModalResult;
|
||||
procedure CloseAll;
|
||||
procedure InvertedFileClose(PageIndex: LongInt; SrcNoteBook: TSourceNotebook);
|
||||
procedure InvertedFileClose(PageIndex: LongInt; SrcNoteBook: TSourceNotebook; CloseOnRightSideOnly: Boolean = False);
|
||||
// designer
|
||||
function DesignerUnitIsVirtual(aLookupRoot: TComponent): Boolean;
|
||||
function CheckLFMInEditor(LFMUnitInfo: TUnitInfo; Quiet: boolean): TModalResult;
|
||||
@ -4258,7 +4258,8 @@ begin
|
||||
PkgBoss.DoCloseAllPackageEditors;
|
||||
end;
|
||||
|
||||
procedure InvertedFileClose(PageIndex: LongInt; SrcNoteBook: TSourceNotebook);
|
||||
procedure InvertedFileClose(PageIndex: LongInt; SrcNoteBook: TSourceNotebook;
|
||||
CloseOnRightSideOnly: Boolean);
|
||||
// close all source editors except the clicked
|
||||
var
|
||||
Ed: TSourceEditor;
|
||||
@ -4270,7 +4271,11 @@ begin
|
||||
// Collect changed editors, except the active one, into a list and maybe save them.
|
||||
for i := 0 to SrcNoteBook.EditorCount - 1 do begin
|
||||
Ed := SrcNoteBook.Editors[i];
|
||||
if (i <> PageIndex) and CheckEditorNeedsSave(Ed, True) then
|
||||
if ( (i > PageIndex) or // to right
|
||||
( (i <> PageIndex) and not CloseOnRightSideOnly )
|
||||
) and
|
||||
CheckEditorNeedsSave(Ed, True)
|
||||
then
|
||||
EditorList.Add(Ed);
|
||||
end;
|
||||
if AskToSaveEditors(EditorList) <> mrOK then Exit;
|
||||
@ -4282,7 +4287,11 @@ begin
|
||||
try
|
||||
repeat
|
||||
i:=SrcNoteBook.PageCount-1;
|
||||
if i=PageIndex then dec(i);
|
||||
if i=PageIndex then
|
||||
if CloseOnRightSideOnly then
|
||||
break
|
||||
else
|
||||
dec(i);
|
||||
if i<0 then break;
|
||||
if CloseEditorFile(SrcNoteBook.FindSourceEditorWithPageIndex(i),[])<>mrOk then exit;
|
||||
if i<PageIndex then PageIndex:=i;
|
||||
|
Loading…
Reference in New Issue
Block a user