Skip to content

Commit

Permalink
Add keyboard shortcuts for switching to panels
Browse files Browse the repository at this point in the history
Close #8719, close #8720
  • Loading branch information
Uhf7 authored and donho committed Aug 19, 2020
1 parent b072479 commit 0fe971c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 5 deletions.
5 changes: 5 additions & 0 deletions PowerEditor/installer/nativeLang/english.xml
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@
<Item id="44080" name="Toggle Document Map"/>
<Item id="44084" name="Toggle Function List"/>
<Item id="50005" name="Toggle macro recording"/>
<Item id="44104" name="Switch to Project Panel 1"/>
<Item id="44105" name="Switch to Project Panel 2"/>
<Item id="44106" name="Switch to Project Panel 3"/>
<Item id="44107" name="Switch to Folder as Workspace"/>
<Item id="44108" name="Switch to Function List"/>
</MainCommandNames>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
Expand Down
5 changes: 5 additions & 0 deletions PowerEditor/installer/nativeLang/english_customizable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,11 @@
<Item id="44080" name="Toggle Document Map"/>
<Item id="44084" name="Toggle Function List"/>
<Item id="50005" name="Toggle macro recording"/>
<Item id="44104" name="Switch to Project Panel 1"/>
<Item id="44105" name="Switch to Project Panel 2"/>
<Item id="44106" name="Switch to Project Panel 3"/>
<Item id="44107" name="Switch to Folder as Workspace"/>
<Item id="44108" name="Switch to Function List"/>
</MainCommandNames>
</ShortcutMapper>
<ShortcutMapperSubDialg title="Shortcut">
Expand Down
3 changes: 0 additions & 3 deletions PowerEditor/src/Notepad_plus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6217,9 +6217,6 @@ void Notepad_plus::launchFunctionList()
}

_pFuncList->display();
_pFuncList->reload();

_pEditView->getFocus();
}


Expand Down
32 changes: 30 additions & 2 deletions PowerEditor/src/NppCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions PowerEditor/src/Parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
6 changes: 6 additions & 0 deletions PowerEditor/src/menuCmdID.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0fe971c

Please sign in to comment.