[NEW_FEATURE] (Author: Andreas Jonsson) Add new feature: Shortcut Ctrl+NumPad to access the tab directly.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1096 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-08-03 00:19:06 +00:00
parent 75166f6596
commit e172c69700
6 changed files with 106 additions and 3 deletions

View File

@ -415,6 +415,22 @@ BEGIN
MENUITEM "Move to New Instance", IDM_VIEW_GOTO_NEW_INSTANCE MENUITEM "Move to New Instance", IDM_VIEW_GOTO_NEW_INSTANCE
MENUITEM "Open in New Instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE MENUITEM "Open in New Instance", IDM_VIEW_LOAD_IN_NEW_INSTANCE
END 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 "Word wrap", IDM_VIEW_WRAP
MENUITEM "Focus on Another View", IDM_VIEW_SWITCHTO_OTHER_VIEW MENUITEM "Focus on Another View", IDM_VIEW_SWITCHTO_OTHER_VIEW
MENUITEM "Hide Lines", IDM_VIEW_HIDELINES MENUITEM "Hide Lines", IDM_VIEW_HIDELINES

View File

@ -399,6 +399,54 @@ void Notepad_plus::command(int id)
} }
} }
break; 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: case IDM_EDIT_DELETE:
_pEditView->execute(WM_CLEAR); _pEditView->execute(WM_CLEAR);
@ -2521,6 +2569,17 @@ void Notepad_plus::command(int id)
case IDM_VIEW_GOTO_ANOTHER_VIEW: case IDM_VIEW_GOTO_ANOTHER_VIEW:
case IDM_VIEW_SYNSCROLLV: case IDM_VIEW_SYNSCROLLV:
case IDM_VIEW_SYNSCROLLH: 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_PREV_DOC :
case IDC_NEXT_DOC : case IDC_NEXT_DOC :
case IDM_SEARCH_GOPREVMARKER1 : case IDM_SEARCH_GOPREVMARKER1 :

View File

@ -203,6 +203,17 @@ WinMenuKeyDefinition winKeyDefs[] = {
{VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, NULL}, {VK_NULL, IDM_VIEW_SYNSCROLLV, false, false, false, NULL},
{VK_NULL, IDM_VIEW_SYNSCROLLH, 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_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_TODOS, false, false, false, NULL},
{VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, NULL}, {VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, NULL},

View File

@ -76,6 +76,11 @@ public:
int getCurrentTabIndex() const { int getCurrentTabIndex() const {
return ::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0); return ::SendMessage(_hSelf, TCM_GETCURSEL, 0, 0);
}; };
int getItemCount() const {
return ::SendMessage(_hSelf, TCM_GETITEMCOUNT, 0, 0);
}
void deletItemAt(size_t index); void deletItemAt(size_t index);
void deletAllItem() { void deletAllItem() {

View File

@ -194,9 +194,9 @@ MenuPosition menuPos[] = {
{ 3, 4, -1, "view-showSymbol"}, { 3, 4, -1, "view-showSymbol"},
{ 3, 5, -1, "view-zoom"}, { 3, 5, -1, "view-zoom"},
{ 3, 6, -1, "view-moveCloneDocument"}, { 3, 6, -1, "view-moveCloneDocument"},
{ 3, 15, -1, "view-collapseLevel"}, { 3, 16, -1, "view-collapseLevel"},
{ 3, 16, -1, "view-uncollapseLevel"}, { 3, 17, -1, "view-uncollapseLevel"},
{ 3, 20, -1, "view-project"}, { 3, 21, -1, "view-project"},
{ 4, 5, -1, "encoding-characterSets"}, { 4, 5, -1, "encoding-characterSets"},
{ 4, 5, 0, "encoding-arabic"}, { 4, 5, 0, "encoding-arabic"},

View File

@ -275,6 +275,18 @@
#define IDM_VIEW_PROJECT_PANEL_3 (IDM_VIEW + 83) #define IDM_VIEW_PROJECT_PANEL_3 (IDM_VIEW + 83)
#define IDM_VIEW_FUNC_LIST (IDM_VIEW + 84) #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_GOTO_ANOTHER_VIEW 10001
#define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002 #define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002