diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 2d9a897b..f3879b9b 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -415,6 +415,22 @@ BEGIN MENUITEM "Move to New Instance", IDM_VIEW_GOTO_NEW_INSTANCE MENUITEM "Open in New Instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE END + + POPUP "Tab" + BEGIN + MENUITEM "1st Tab" IDM_VIEW_TAB1 + MENUITEM "2nd Tab" IDM_VIEW_TAB2 + MENUITEM "3rd Tab" IDM_VIEW_TAB3 + MENUITEM "4th Tab" IDM_VIEW_TAB4 + MENUITEM "5th Tab" IDM_VIEW_TAB5 + MENUITEM "6th Tab" IDM_VIEW_TAB6 + MENUITEM "7th Tab" IDM_VIEW_TAB7 + MENUITEM "8th Tab" IDM_VIEW_TAB8 + MENUITEM "9th Tab" IDM_VIEW_TAB9 + MENUITEM SEPARATOR + MENUITEM "Next Tab" IDM_VIEW_TAB_NEXT + MENUITEM "Previous Tab" IDM_VIEW_TAB_PREV + END MENUITEM "Word wrap", IDM_VIEW_WRAP MENUITEM "Focus on Another View", IDM_VIEW_SWITCHTO_OTHER_VIEW MENUITEM "Hide Lines", IDM_VIEW_HIDELINES diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 9e012182..9ee57ca3 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -399,6 +399,54 @@ void Notepad_plus::command(int id) } } break; + + case IDM_VIEW_TAB1: + case IDM_VIEW_TAB2: + case IDM_VIEW_TAB3: + case IDM_VIEW_TAB4: + case IDM_VIEW_TAB5: + case IDM_VIEW_TAB6: + case IDM_VIEW_TAB7: + case IDM_VIEW_TAB8: + case IDM_VIEW_TAB9: + { + const int index = id - IDM_VIEW_TAB1; + BufferID buf = _pDocTab->getBufferByIndex(index); + if(buf == BUFFER_INVALID) + { + // No buffer at chosen index, select the very last buffer instead. + const int last_index = _pDocTab->getItemCount() - 1; + if(last_index > 0) + switchToFile(_pDocTab->getBufferByIndex(last_index)); + } + else + switchToFile(buf); + } + break; + + case IDM_VIEW_TAB_NEXT: + { + const int current_index = _pDocTab->getCurrentTabIndex(); + const int last_index = _pDocTab->getItemCount() - 1; + if(current_index < last_index) + switchToFile(_pDocTab->getBufferByIndex(current_index + 1)); + else + switchToFile(_pDocTab->getBufferByIndex(0)); // Loop around. + } + break; + + case IDM_VIEW_TAB_PREV: + { + const int current_index = _pDocTab->getCurrentTabIndex(); + if(current_index > 0) + switchToFile(_pDocTab->getBufferByIndex(current_index - 1)); + else + { + const int last_index = _pDocTab->getItemCount() - 1; + switchToFile(_pDocTab->getBufferByIndex(last_index)); // Loop around. + } + } + break; case IDM_EDIT_DELETE: _pEditView->execute(WM_CLEAR); @@ -2521,6 +2569,17 @@ void Notepad_plus::command(int id) case IDM_VIEW_GOTO_ANOTHER_VIEW: case IDM_VIEW_SYNSCROLLV: case IDM_VIEW_SYNSCROLLH: + case IDM_VIEW_TAB1: + case IDM_VIEW_TAB2: + case IDM_VIEW_TAB3: + case IDM_VIEW_TAB4: + case IDM_VIEW_TAB5: + case IDM_VIEW_TAB6: + case IDM_VIEW_TAB7: + case IDM_VIEW_TAB8: + case IDM_VIEW_TAB9: + case IDM_VIEW_TAB_NEXT: + case IDM_VIEW_TAB_PREV: case IDC_PREV_DOC : case IDC_NEXT_DOC : case IDM_SEARCH_GOPREVMARKER1 : diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index f3a72a50..830c108b 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -203,6 +203,17 @@ WinMenuKeyDefinition winKeyDefs[] = { {VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, NULL}, {VK_NULL, IDM_VIEW_SYNSCROLLH, false, false, false, NULL}, {VK_F8, IDM_VIEW_SWITCHTO_OTHER_VIEW, false, false, false, NULL}, + {VK_NUMPAD1,IDM_VIEW_TAB1, true, false, false, NULL}, + {VK_NUMPAD2,IDM_VIEW_TAB2, true, false, false, NULL}, + {VK_NUMPAD3,IDM_VIEW_TAB3, true, false, false, NULL}, + {VK_NUMPAD4,IDM_VIEW_TAB4, true, false, false, NULL}, + {VK_NUMPAD5,IDM_VIEW_TAB5, true, false, false, NULL}, + {VK_NUMPAD6,IDM_VIEW_TAB6, true, false, false, NULL}, + {VK_NUMPAD7,IDM_VIEW_TAB7, true, false, false, NULL}, + {VK_NUMPAD8,IDM_VIEW_TAB8, true, false, false, NULL}, + {VK_NUMPAD9,IDM_VIEW_TAB9, true, false, false, NULL}, + {VK_NEXT, IDM_VIEW_TAB_NEXT, true, false, false, NULL}, + {VK_PRIOR, IDM_VIEW_TAB_PREV, true, false, false, NULL}, {VK_NULL, IDM_FORMAT_TODOS, false, false, false, NULL}, {VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, NULL}, diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.h b/PowerEditor/src/WinControls/TabBar/TabBar.h index fc8374ce..144f3214 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.h +++ b/PowerEditor/src/WinControls/TabBar/TabBar.h @@ -76,6 +76,11 @@ public: int getCurrentTabIndex() const { return ::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0); }; + + int getItemCount() const { + return ::SendMessage(_hSelf, TCM_GETITEMCOUNT, 0, 0); + } + void deletItemAt(size_t index); void deletAllItem() { diff --git a/PowerEditor/src/localization.cpp b/PowerEditor/src/localization.cpp index ab93b0f4..363161f6 100644 --- a/PowerEditor/src/localization.cpp +++ b/PowerEditor/src/localization.cpp @@ -194,9 +194,9 @@ MenuPosition menuPos[] = { { 3, 4, -1, "view-showSymbol"}, { 3, 5, -1, "view-zoom"}, { 3, 6, -1, "view-moveCloneDocument"}, - { 3, 15, -1, "view-collapseLevel"}, - { 3, 16, -1, "view-uncollapseLevel"}, - { 3, 20, -1, "view-project"}, + { 3, 16, -1, "view-collapseLevel"}, + { 3, 17, -1, "view-uncollapseLevel"}, + { 3, 21, -1, "view-project"}, { 4, 5, -1, "encoding-characterSets"}, { 4, 5, 0, "encoding-arabic"}, diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 871a7147..3bd9afb8 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -275,6 +275,18 @@ #define IDM_VIEW_PROJECT_PANEL_3 (IDM_VIEW + 83) #define IDM_VIEW_FUNC_LIST (IDM_VIEW + 84) + + #define IDM_VIEW_TAB1 (IDM_VIEW + 86) + #define IDM_VIEW_TAB2 (IDM_VIEW + 87) + #define IDM_VIEW_TAB3 (IDM_VIEW + 88) + #define IDM_VIEW_TAB4 (IDM_VIEW + 89) + #define IDM_VIEW_TAB5 (IDM_VIEW + 90) + #define IDM_VIEW_TAB6 (IDM_VIEW + 91) + #define IDM_VIEW_TAB7 (IDM_VIEW + 92) + #define IDM_VIEW_TAB8 (IDM_VIEW + 93) + #define IDM_VIEW_TAB9 (IDM_VIEW + 94) + #define IDM_VIEW_TAB_NEXT (IDM_VIEW + 95) + #define IDM_VIEW_TAB_PREV (IDM_VIEW + 96) #define IDM_VIEW_GOTO_ANOTHER_VIEW 10001 #define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002