From d53815d5d52bb9a065e34eb80ab04cfc717e303d Mon Sep 17 00:00:00 2001 From: ondrej Date: Sun, 27 Mar 2016 17:32:12 +0000 Subject: [PATCH] ide: source notebook: add option to show editor file name in caption git-svn-id: trunk@52071 - --- ide/editoroptions.pp | 10 ++ ide/frames/editor_multiwindow_options.lfm | 111 ++++++++++++---------- ide/frames/editor_multiwindow_options.pas | 4 + ide/lazarusidestrconsts.pas | 1 + ide/sourceeditor.pp | 15 ++- 5 files changed, 89 insertions(+), 52 deletions(-) diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index fa71febd68..829f95a86d 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -1386,6 +1386,7 @@ type // Multi window FMultiWinEditAccessOrder: TEditorOptionsEditAccessOrderList; FCtrlMiddleTabClickClosesOthers: Boolean; + FShowFileNameInCaption: Boolean; // Comment Continue FAnsiCommentContinueEnabled: Boolean; @@ -1627,6 +1628,9 @@ type property CtrlMiddleTabClickClosesOthers: Boolean read FCtrlMiddleTabClickClosesOthers write FCtrlMiddleTabClickClosesOthers default True; + property ShowFileNameInCaption: Boolean + read FShowFileNameInCaption write FShowFileNameInCaption default False; + // Commend Continue property AnsiCommentContinueEnabled: Boolean read FAnsiCommentContinueEnabled write FAnsiCommentContinueEnabled; @@ -4549,6 +4553,7 @@ begin // Multi window FCtrlMiddleTabClickClosesOthers := True; + FShowFileNameInCaption := False; // Comment FAnsiCommentContinueEnabled := False; @@ -4765,6 +4770,9 @@ begin FMarkupCurWordNoTimer := XMLConfig.GetValue( 'EditorOptions/Display/MarkupCurrentWord/NoTimer', False); + FShowFileNameInCaption := + XMLConfig.GetValue( + 'EditorOptions/Display/ShowFileNameInCaption', False); // Code Tools options fAutoBlockCompletion := @@ -4952,6 +4960,8 @@ begin FMarkupCurWordTrim, True); XMLConfig.SetDeleteValue('EditorOptions/Display/MarkupCurrentWord/NoTimer', FMarkupCurWordNoTimer, False); + XMLConfig.SetDeleteValue('EditorOptions/Display/ShowFileNameInCaption', + FShowFileNameInCaption, False); // Code Tools options XMLConfig.SetDeleteValue('EditorOptions/CodeTools/AutoBlockCompletion' diff --git a/ide/frames/editor_multiwindow_options.lfm b/ide/frames/editor_multiwindow_options.lfm index 22c1f853c9..7179602079 100644 --- a/ide/frames/editor_multiwindow_options.lfm +++ b/ide/frames/editor_multiwindow_options.lfm @@ -21,15 +21,15 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 6 - Height = 212 - Top = 203 + Height = 173 + Top = 242 Width = 509 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Left = 6 BorderSpacing.Top = 6 BorderSpacing.Right = 6 BevelOuter = bvNone - ClientHeight = 212 + ClientHeight = 173 ClientWidth = 509 TabOrder = 0 object listAccessType: TCheckListBox @@ -62,7 +62,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame TabOrder = 1 object lblAccessTypeDesc: TLabel Left = 0 - Height = 13 + Height = 15 Top = 0 Width = 509 Align = alTop @@ -89,7 +89,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 3 - Top = 105 + Top = 135 Width = 60 BorderSpacing.Bottom = 6 end @@ -99,8 +99,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideTop.Control = pnlNBTabs AnchorSideTop.Side = asrBottom Left = 70 - Height = 13 - Top = 100 + Height = 15 + Top = 129 Width = 166 BorderSpacing.Left = 10 BorderSpacing.Bottom = 6 @@ -118,7 +118,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Side = asrBottom Left = 246 Height = 3 - Top = 105 + Top = 135 Width = 275 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 10 @@ -130,8 +130,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 59 - Top = 119 + Height = 65 + Top = 150 Width = 509 Anchors = [akTop, akLeft, akRight] AutoSize = True @@ -139,12 +139,12 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 BevelOuter = bvNone - ClientHeight = 59 + ClientHeight = 65 ClientWidth = 509 TabOrder = 1 object lblAccessOrder: TLabel Left = 0 - Height = 13 + Height = 15 Top = 0 Width = 509 Align = alTop @@ -160,8 +160,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom Left = 0 - Height = 17 - Top = 19 + Height = 19 + Top = 21 Width = 509 Anchors = [akTop, akLeft, akRight] Caption = 'radioAccessOrderEdit' @@ -177,8 +177,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Control = Panel1 AnchorSideRight.Side = asrBottom Left = 0 - Height = 17 - Top = 36 + Height = 19 + Top = 40 Width = 509 Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 6 @@ -194,8 +194,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 - Height = 13 - Top = 184 + Height = 15 + Top = 221 Width = 521 Anchors = [akTop, akLeft, akRight] Caption = 'lblAccessType' @@ -209,7 +209,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Side = asrBottom Left = 0 Height = 3 - Top = 5 + Top = 6 Width = 60 BorderSpacing.Bottom = 6 end @@ -218,7 +218,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = Owner Left = 70 - Height = 13 + Height = 15 Top = 0 Width = 125 BorderSpacing.Left = 10 @@ -237,7 +237,7 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Side = asrBottom Left = 205 Height = 3 - Top = 5 + Top = 6 Width = 316 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 10 @@ -249,8 +249,8 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 6 - Height = 75 - Top = 19 + Height = 102 + Top = 21 Width = 509 Anchors = [akTop, akLeft, akRight] AutoSize = True @@ -259,16 +259,16 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame BorderSpacing.Bottom = 6 BevelOuter = bvNone ChildSizing.ControlsPerLine = 2 - ClientHeight = 75 + ClientHeight = 102 ClientWidth = 509 TabOrder = 2 object chkShowCloseBtn: TCheckBox AnchorSideLeft.Control = pnlNBTabs AnchorSideTop.Control = pnlNBTabs Left = 0 - Height = 17 + Height = 19 Top = 0 - Width = 102 + Width = 115 BorderSpacing.CellAlignHorizontal = ccaLeftTop BorderSpacing.CellAlignVertical = ccaLeftTop Caption = 'chkShowCloseBtn' @@ -279,9 +279,9 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = pnlNBTabs Left = 255 - Height = 17 + Height = 19 Top = 0 - Width = 102 + Width = 117 BorderSpacing.CellAlignHorizontal = ccaLeftTop BorderSpacing.CellAlignVertical = ccaLeftTop Caption = 'chkShowNumbers' @@ -293,9 +293,9 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Side = asrBottom Left = 0 - Height = 17 - Top = 17 - Width = 101 + Height = 19 + Top = 19 + Width = 116 BorderSpacing.CellAlignHorizontal = ccaLeftTop BorderSpacing.CellAlignVertical = ccaLeftTop Caption = 'chkHideSingleTab' @@ -307,9 +307,9 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideTop.Control = chkShowNumbers AnchorSideTop.Side = asrBottom Left = 255 - Height = 17 - Top = 17 - Width = 104 + Height = 19 + Top = 19 + Width = 116 BorderSpacing.CellAlignHorizontal = ccaLeftTop BorderSpacing.CellAlignVertical = ccaLeftTop Caption = 'chkUseTabHistory' @@ -320,9 +320,9 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideTop.Control = chkHideSingleTab AnchorSideTop.Side = asrBottom Left = 0 - Height = 17 - Top = 34 - Width = 140 + Height = 19 + Top = 38 + Width = 159 BorderSpacing.CellAlignHorizontal = ccaLeftTop BorderSpacing.CellAlignVertical = ccaLeftTop Caption = 'chkCtrlMiddleCloseOthers' @@ -344,9 +344,9 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideTop.Control = chkUseTabHistory AnchorSideTop.Side = asrBottom Left = 255 - Height = 17 - Top = 34 - Width = 75 + Height = 19 + Top = 38 + Width = 89 Caption = 'chkMultiLine' TabOrder = 5 end @@ -354,10 +354,10 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = EditorTabPositionCheckBox AnchorSideTop.Side = asrCenter - Left = 156 - Height = 13 - Top = 58 - Width = 108 + Left = 6 + Height = 15 + Top = 83 + Width = 121 BorderSpacing.Left = 6 Caption = 'EditorTabPositionLabel' ParentColor = False @@ -365,17 +365,30 @@ object EditorMultiWindowOptionsFrame: TEditorMultiWindowOptionsFrame object EditorTabPositionCheckBox: TComboBox AnchorSideLeft.Control = EditorTabPositionLabel AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = chkCtrlMiddleCloseOthers + AnchorSideTop.Control = chkShowFileNameInCaption AnchorSideTop.Side = asrBottom - Left = 0 - Height = 21 - Top = 54 + Left = 132 + Height = 23 + Top = 79 Width = 150 BorderSpacing.Left = 5 BorderSpacing.Top = 3 - ItemHeight = 13 + ItemHeight = 15 Style = csDropDownList TabOrder = 6 end + object chkShowFileNameInCaption: TCheckBox + AnchorSideLeft.Control = pnlNBTabs + AnchorSideTop.Control = chkCtrlMiddleCloseOthers + AnchorSideTop.Side = asrBottom + Left = 0 + Height = 19 + Top = 57 + Width = 170 + BorderSpacing.CellAlignHorizontal = ccaLeftTop + BorderSpacing.CellAlignVertical = ccaLeftTop + Caption = 'chkShowFileNameInCaption' + TabOrder = 7 + end end end diff --git a/ide/frames/editor_multiwindow_options.pas b/ide/frames/editor_multiwindow_options.pas index 421b632833..f0f23c8dba 100644 --- a/ide/frames/editor_multiwindow_options.pas +++ b/ide/frames/editor_multiwindow_options.pas @@ -38,6 +38,7 @@ type Bevel2a: TBevel; Bevel2: TBevel; CenterLabel: TLabel; + chkShowFileNameInCaption: TCheckBox; chkMultiLine: TCheckBox; chkCtrlMiddleCloseOthers: TCheckBox; chkUseTabHistory: TCheckBox; @@ -143,6 +144,7 @@ begin chkShowCloseBtn.Caption := dlgCloseButtonsNotebook; chkUseTabHistory.Caption := dlgUseTabsHistory; chkCtrlMiddleCloseOthers.Caption := dlgCtrlMiddleTabCloseOtherPages; + chkShowFileNameInCaption.Caption := dlgShowFileNameInCaption; chkMultiLine.Caption := dlgSourceEditTabMultiLine; EditorTabPositionCheckBox.Items.Add(lisNotebookTabPosTop); EditorTabPositionCheckBox.Items.Add(lisNotebookTabPosBottom); @@ -164,6 +166,7 @@ begin chkShowCloseBtn.Checked := ShowTabCloseButtons and chkShowCloseBtn.Enabled; chkUseTabHistory.Checked := UseTabHistory; chkCtrlMiddleCloseOthers.Checked := CtrlMiddleTabClickClosesOthers; + chkShowFileNameInCaption.Checked := ShowFileNameInCaption; chkMultiLine.Checked := MultiLineTab; EditorTabPositionCheckBox.ItemIndex := TabPosToIndex[TabPosition]; end; @@ -192,6 +195,7 @@ begin ShowTabCloseButtons := chkShowCloseBtn.Checked; UseTabHistory := chkUseTabHistory.Checked; CtrlMiddleTabClickClosesOthers := chkCtrlMiddleCloseOthers.Checked; + ShowFileNameInCaption := chkShowFileNameInCaption.Checked; MultiLineTab := chkMultiLine.Checked; TabPosition := TabIndexToPos[EditorTabPositionCheckBox.ItemIndex]; end; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index afb1e4de07..d3698ac2cf 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -1581,6 +1581,7 @@ resourcestring lisShowSpecialCharacters = 'Show special characters'; dlgCloseButtonsNotebook = 'Show close buttons in notebook'; dlgCtrlMiddleTabCloseOtherPages = 'Ctrl-middle-click on tab closes all others'; + dlgShowFileNameInCaption = 'Show file name in caption'; dlgSourceEditTabMultiLine = 'Multiline tabs'; dlgHideSingleTabInNotebook = 'Hide tab in single page windows'; dlgTabNumbersNotebook = 'Show tab numbers in notebook'; diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index ed41167f36..240ec8cd7a 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -7272,7 +7272,14 @@ begin if i>= 0 then PageIndex := i; dec(FFocusLock); - SourceEditorManager.ActiveSourceWindow := self; + SourceEditorManager.ActiveSourceWindow := Self; + if EditorOpts.ShowFileNameInCaption then + begin + if ActiveEditor<>nil then + Caption := FBaseCaption+' - '+ActiveEditor.FileName + else + Caption := FBaseCaption; + end; end; procedure TSourceNotebook.CheckCurrentCodeBufferChanged; @@ -7395,10 +7402,12 @@ begin exit; end; if (PageCount = 1) and (EditorOpts.HideSingleTabInWindow) then begin - Caption := FBaseCaption + ': ' + NotebookPages[0]; + if not EditorOpts.ShowFileNameInCaption then + Caption := FBaseCaption + ': ' + NotebookPages[0]; FNotebook.ShowTabs := False; end else begin - Caption := FBaseCaption; + if not EditorOpts.ShowFileNameInCaption then + Caption := FBaseCaption; FNotebook.ShowTabs := (Manager=nil) or Manager.ShowTabs; end; end;