mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Show list of all open tabs as a menu
(cherry picked from commit fc76f3016c)
This commit is contained in:
parent
4b8c0e59bc
commit
5c1e40c192
6 changed files with 67 additions and 2 deletions
|
|
@ -2841,6 +2841,13 @@ object frmMain: TfrmMain
|
|||
Caption = 'Save all shown columns to file'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actShowTabsList: TAction
|
||||
Tag = 21
|
||||
Category = 'Tabs'
|
||||
Caption = 'Show Tabs List'
|
||||
Hint = 'Show list of all open tabs'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
end
|
||||
object pmHotList: TPopupMenu
|
||||
Images = imgLstDirectoryHotlist
|
||||
|
|
|
|||
|
|
@ -259,6 +259,8 @@
|
|||
{"hash":124093428,"name":"tfrmmain.actloadlist.caption","sourcebytes":[76,111,97,100,32,76,105,115,116],"value":"Load List"},
|
||||
{"hash":228327845,"name":"tfrmmain.actloadlist.hint","sourcebytes":[76,111,97,100,32,108,105,115,116,32,111,102,32,102,105,108,101,115,47,102,111,108,100,101,114,115,32,102,114,111,109,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,116,101,120,116,32,102,105,108,101],"value":"Load list of files/folders from the specified text file"},
|
||||
{"hash":230704005,"name":"tfrmmain.actsavefiledetailstofile.caption","sourcebytes":[83,97,118,101,32,97,108,108,32,115,104,111,119,110,32,99,111,108,117,109,110,115,32,116,111,32,102,105,108,101],"value":"Save all shown columns to file"},
|
||||
{"hash":104763204,"name":"tfrmmain.actshowtabslist.caption","sourcebytes":[83,104,111,119,32,84,97,98,115,32,76,105,115,116],"value":"Show Tabs List"},
|
||||
{"hash":154792195,"name":"tfrmmain.actshowtabslist.hint","sourcebytes":[83,104,111,119,32,108,105,115,116,32,111,102,32,97,108,108,32,111,112,101,110,32,116,97,98,115],"value":"Show list of all open tabs"},
|
||||
{"hash":310020,"name":"tfrmmain.tbedit.caption","sourcebytes":[69,100,105,116],"value":"Edit"},
|
||||
{"hash":78392485,"name":"tfrmmain.tbdelete.caption","sourcebytes":[68,101,108,101,116,101],"value":"Delete"},
|
||||
{"hash":1140,"name":"tfrmmain.tbchangedir.caption","sourcebytes":[67,68],"value":"CD"},
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ type
|
|||
|
||||
TfrmMain = class(TAloneForm, IFormCommands)
|
||||
actAddPlugin: TAction;
|
||||
actShowTabsList: TAction;
|
||||
actSaveFileDetailsToFile: TAction;
|
||||
actLoadList: TAction;
|
||||
actExtractFiles: TAction;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ type
|
|||
end;
|
||||
|
||||
const
|
||||
NUMBEROFCOMMANDS = 461;
|
||||
NUMBEROFCOMMANDS = 465;
|
||||
|
||||
//jcf:format=off
|
||||
COMMANDS_LIST_TC: array[1..NUMBEROFCOMMANDS] of TTCommandEquivalence =
|
||||
|
|
@ -434,6 +434,10 @@ const
|
|||
(TCCommand: 'cm_ToggleLockDcaCurrentTab'; TCIcon: -1; DCCommand: ''; DCParameters: '' ), //Same but with dir changes allowed
|
||||
(TCCommand: 'cm_ExchangeWithTabs'; TCIcon: 37; DCCommand: ''; DCParameters: '' ), //Swap all Tabs
|
||||
(TCCommand: 'cm_GoToLockedDir'; TCIcon: -1; DCCommand: ''; DCParameters: '' ), //Go to the base dir of locked tab
|
||||
(TCCommand: 'cm_SrcTabsList'; TCIcon: -1; DCCommand: 'cm_ShowTabsList'; DCParameters: '' ), //Source: Show list of all open tabs
|
||||
(TCCommand: 'cm_TrgTabsList'; TCIcon: -1; DCCommand: 'cm_ShowTabsList'; DCParameters: 'side=inactive'), //Target: Show list of all open tabs
|
||||
(TCCommand: 'cm_LeftTabsList'; TCIcon: -1; DCCommand: 'cm_ShowTabsList'; DCParameters: 'side=left' ), //Left: Show list of all open tabs
|
||||
(TCCommand: 'cm_RightTabsList'; TCIcon: -1; DCCommand: 'cm_ShowTabsList'; DCParameters: 'side=right' ), //Right: Show list of all open tabs
|
||||
(TCCommand: 'cm_SrcActivateTab1'; TCIcon: -1; DCCommand: 'cm_ActivateTabByIndex'; DCParameters: 'index=1' ), //Activate first tab
|
||||
(TCCommand: 'cm_SrcActivateTab2'; TCIcon: -1; DCCommand: 'cm_ActivateTabByIndex'; DCParameters: 'index=2' ), //Activate second tab
|
||||
(TCCommand: 'cm_SrcActivateTab3'; TCIcon: -1; DCCommand: 'cm_ActivateTabByIndex'; DCParameters: 'index=3' ), //(Source window)
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ type
|
|||
|
||||
const
|
||||
{ Default hotkey list version number }
|
||||
hkVersion = 61;
|
||||
hkVersion = 62;
|
||||
// 54 - In "Viewer" context, added the "W" for "cm_WrapText", "4" for "cm_ShowAsDec", "8" for "cm_ShowOffice".
|
||||
// 53 - In "Main" context, change shortcut "Alt+`" to "Alt+0" for the "cm_ActivateTabByIndex".
|
||||
// 52 - In "Main" context, add shortcut "Ctrl+Shift+B" for "cm_FlatViewSel".
|
||||
|
|
@ -1106,6 +1106,7 @@ begin
|
|||
AddIfNotExists(['Ctrl+PgDn'],[],'cm_OpenArchive');
|
||||
AddIfNotExists(['Ctrl+PgUp'],[],'cm_ChangeDirToParent');
|
||||
AddIfNotExists(['Ctrl+Alt+Enter'],[],'cm_ShellExecute');
|
||||
AddIfNotExists(['Ctrl+Shift+A'],[],'cm_ShowTabsList');
|
||||
AddIfNotExists(['Ctrl+Shift+B'],[],'cm_FlatViewSel');
|
||||
AddIfNotExists(['Ctrl+Shift+C'],[],'cm_CopyFullNamesToClip');
|
||||
AddIfNotExists(['Ctrl+Shift+D'],[],'cm_ConfigDirHotList');
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ type
|
|||
private
|
||||
FCommands: TFormCommands;
|
||||
FOriginalNumberOfTabs: integer;
|
||||
FTabsMenu: TPopupMenu;
|
||||
|
||||
// Helper routines
|
||||
procedure TryGetParentDir(FileView: TFileView; var SelectedFiles: TFiles);
|
||||
|
|
@ -76,6 +77,7 @@ type
|
|||
procedure DoCopySelectedFileNamesToClipboard(FileView: TFileView; TypeOfCopy: TCopyFileNamesToClipboard; const Params: array of string);
|
||||
procedure DoNewTab(Notebook: TFileViewNotebook);
|
||||
procedure DoRenameTab(Page: TFileViewPage);
|
||||
procedure DoTabMenuClick(Sender: TObject);
|
||||
procedure DoContextMenu(Panel: TFileView; X, Y: Integer; Background: Boolean; UserWishForContextMenu:TUserWishForContextMenu = uwcmComplete);
|
||||
procedure DoTransferPath(SourceFrame: TFileView; TargetNotebook: TFileViewNotebook); overload;
|
||||
procedure DoTransferPath(SourcePage: TFileViewPage; TargetPage: TFileViewPage; FromActivePanel: Boolean);
|
||||
|
|
@ -213,6 +215,7 @@ type
|
|||
procedure cm_PrevTab(const Params: array of string);
|
||||
procedure cm_MoveTabLeft(const Params: array of string);
|
||||
procedure cm_MoveTabRight(const Params: array of string);
|
||||
procedure cm_ShowTabsList(const Params: array of string);
|
||||
procedure cm_ActivateTabByIndex(const Params: array of string);
|
||||
procedure cm_SaveTabs(const Params: array of string);
|
||||
procedure cm_LoadTabs(const Params: array of string);
|
||||
|
|
@ -701,6 +704,13 @@ begin
|
|||
Page.PermanentTitle := sCaption;
|
||||
end;
|
||||
|
||||
procedure TMainCommands.DoTabMenuClick(Sender: TObject);
|
||||
var
|
||||
MenuItem: TMenuItem absolute Sender;
|
||||
begin
|
||||
TFileViewNotebook(FTabsMenu.PopupComponent).ActivateTabByIndex(MenuItem.Tag);
|
||||
end;
|
||||
|
||||
procedure TMainCommands.DoOpenVirtualFileSystemList(Panel: TFileView);
|
||||
var
|
||||
FileSource: IFileSource;
|
||||
|
|
@ -1764,6 +1774,46 @@ begin
|
|||
PageIndex:= PageIndex + 1;
|
||||
end;
|
||||
|
||||
procedure TMainCommands.cm_ShowTabsList(const Params: array of string);
|
||||
var
|
||||
ARect: TRect;
|
||||
Param: String;
|
||||
Index: Integer;
|
||||
AValue: String;
|
||||
APoint: TPoint;
|
||||
MenuItem: TMenuItem;
|
||||
ANotebook: TFileViewNotebook;
|
||||
begin
|
||||
ANotebook:= frmMain.ActiveNotebook;
|
||||
for Param in Params do
|
||||
begin
|
||||
if GetParamValue(Param, 'side', AValue) then
|
||||
begin
|
||||
if AValue = 'left' then ANotebook:= frmMain.LeftTabs
|
||||
else if AValue = 'right' then ANotebook:= frmMain.RightTabs
|
||||
else if AValue = 'inactive' then ANotebook:= frmMain.NotActiveNotebook;
|
||||
end
|
||||
end;
|
||||
if (FTabsMenu = nil) then
|
||||
begin
|
||||
FTabsMenu:= TPopupMenu.Create(Self);
|
||||
end;
|
||||
FTabsMenu.Items.Clear;
|
||||
FTabsMenu.PopupComponent:= ANotebook;
|
||||
for Index:= 0 to ANotebook.PageCount - 1 do
|
||||
begin
|
||||
MenuItem:= TMenuItem.Create(FTabsMenu);
|
||||
MenuItem.Tag:= Index;
|
||||
MenuItem.Caption:= ANotebook.Page[Index].Caption;
|
||||
MenuItem.OnClick:= @DoTabMenuClick;
|
||||
FTabsMenu.Items.Add(MenuItem);
|
||||
end;
|
||||
ARect:= ANotebook.TabRect(ANotebook.PageIndex);
|
||||
APoint:= Classes.Point(ARect.Left, ARect.Bottom);
|
||||
APoint:= ANotebook.ClientToScreen(APoint);
|
||||
FTabsMenu.PopUp(APoint.X, APoint.Y);
|
||||
end;
|
||||
|
||||
procedure TMainCommands.cm_ActivateTabByIndex(const Params: array of string);
|
||||
var
|
||||
Param: String;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue