From 0fe971ca8888f97f17381d1a5520a7b383eac617 Mon Sep 17 00:00:00 2001 From: Udo Hoffmann Date: Sun, 16 Aug 2020 11:39:53 +0200 Subject: [PATCH] Add keyboard shortcuts for switching to panels Close #8719, close #8720 --- PowerEditor/installer/nativeLang/english.xml | 5 +++ .../nativeLang/english_customizable.xml | 5 +++ PowerEditor/src/Notepad_plus.cpp | 3 -- PowerEditor/src/NppCommands.cpp | 32 +++++++++++++++++-- PowerEditor/src/Parameters.cpp | 5 +++ PowerEditor/src/menuCmdID.h | 6 ++++ 6 files changed, 51 insertions(+), 5 deletions(-) diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml index 117360e9a..c2284e3fb 100644 --- a/PowerEditor/installer/nativeLang/english.xml +++ b/PowerEditor/installer/nativeLang/english.xml @@ -571,6 +571,11 @@ + + + + + diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml index 6e191c11f..32091674b 100644 --- a/PowerEditor/installer/nativeLang/english_customizable.xml +++ b/PowerEditor/installer/nativeLang/english_customizable.xml @@ -571,6 +571,11 @@ + + + + + diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index cc7f955ea..e79c75f6a 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -6217,9 +6217,6 @@ void Notepad_plus::launchFunctionList() } _pFuncList->display(); - _pFuncList->reload(); - - _pEditView->getFocus(); } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index bec2ab212..feec82d84 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -719,7 +719,19 @@ void Notepad_plus::command(int id) } break; + case IDM_VIEW_SWITCHTO_PROJECT_PANEL_1: + case IDM_VIEW_SWITCHTO_PROJECT_PANEL_2: + case IDM_VIEW_SWITCHTO_PROJECT_PANEL_3: + { + ProjectPanel** pp [] = {&_pProjectPanel_1, &_pProjectPanel_2, &_pProjectPanel_3}; + int idx = id - IDM_VIEW_SWITCHTO_PROJECT_PANEL_1; + launchProjectPanel(id - IDM_VIEW_SWITCHTO_PROJECT_PANEL_1 + IDM_VIEW_PROJECT_PANEL_1, pp [idx], idx); + } + break; + + case IDM_VIEW_FILEBROWSER: + case IDM_VIEW_SWITCHTO_FILEBROWSER: { if (_pFileBrowser == nullptr) // first launch, check in params to open folders { @@ -734,7 +746,7 @@ void Notepad_plus::command(int id) } else { - if (not _pFileBrowser->isClosed()) + if (!_pFileBrowser->isClosed() && (id != IDM_VIEW_SWITCHTO_FILEBROWSER)) { _pFileBrowser->display(false); _pFileBrowser->setClosed(true); @@ -776,9 +788,25 @@ void Notepad_plus::command(int id) } break; + case IDM_VIEW_SWITCHTO_FUNC_LIST: + { + if (_pFuncList && _pFuncList->isVisible()) + { + _pFuncList->getFocus(); + } + else + { + checkMenuItem(IDM_VIEW_FUNC_LIST, true); + _toolBar.setCheck(IDM_VIEW_FUNC_LIST, true); + launchFunctionList(); + _pFuncList->setClosed(false); + } + } + break; + case IDM_VIEW_FUNC_LIST: { - if (_pFuncList && (not _pFuncList->isClosed())) + if (_pFuncList && (!_pFuncList->isClosed())) { _pFuncList->display(false); _pFuncList->setClosed(true); diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index d0a47428d..2593e0b41 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -302,6 +302,11 @@ static const WinMenuKeyDefinition winKeyDefs[] = { VK_NULL, IDM_VIEW_FILEBROWSER, false, false, false, TEXT("Toggle Folder as Workspace") }, { VK_NULL, IDM_VIEW_DOC_MAP, false, false, false, TEXT("Toggle Document Map") }, { VK_NULL, IDM_VIEW_FUNC_LIST, false, false, false, TEXT("Toggle Function List") }, + { VK_NULL, IDM_VIEW_SWITCHTO_PROJECT_PANEL_1, false, false, false, TEXT("Switch to Project Panel 1") }, + { VK_NULL, IDM_VIEW_SWITCHTO_PROJECT_PANEL_2, false, false, false, TEXT("Switch to Project Panel 2") }, + { VK_NULL, IDM_VIEW_SWITCHTO_PROJECT_PANEL_3, false, false, false, TEXT("Switch to Project Panel 3") }, + { VK_NULL, IDM_VIEW_SWITCHTO_FILEBROWSER, false, false, false, TEXT("Switch to Folder as Workspace") }, + { VK_NULL, IDM_VIEW_SWITCHTO_FUNC_LIST, false, false, false, TEXT("Switch to Function List") }, { VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, nullptr }, { VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, nullptr }, { VK_R, IDM_EDIT_RTL, true, true, false, nullptr }, diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index eb827a30c..4d7383663 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -357,6 +357,12 @@ #define IDM_VIEW_IN_EDGE (IDM_VIEW + 102) #define IDM_VIEW_IN_IE (IDM_VIEW + 103) + #define IDM_VIEW_SWITCHTO_PROJECT_PANEL_1 (IDM_VIEW + 104) + #define IDM_VIEW_SWITCHTO_PROJECT_PANEL_2 (IDM_VIEW + 105) + #define IDM_VIEW_SWITCHTO_PROJECT_PANEL_3 (IDM_VIEW + 106) + #define IDM_VIEW_SWITCHTO_FILEBROWSER (IDM_VIEW + 107) + #define IDM_VIEW_SWITCHTO_FUNC_LIST (IDM_VIEW + 108) + #define IDM_VIEW_GOTO_ANOTHER_VIEW 10001 #define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002 #define IDM_VIEW_GOTO_NEW_INSTANCE 10003