Add commands for moving the current file tab Forward/Backward
Closes #1864, closes #2033pull/2033/merge
parent
f6e47cd536
commit
9cf45dea29
|
@ -475,6 +475,9 @@ BEGIN
|
|||
MENUITEM SEPARATOR
|
||||
MENUITEM "Next Tab", IDM_VIEW_TAB_NEXT
|
||||
MENUITEM "Previous Tab", IDM_VIEW_TAB_PREV
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Move Tab Forward", IDM_VIEW_TAB_MOVEFORWARD
|
||||
MENUITEM "Move Tab Backward", IDM_VIEW_TAB_MOVEBACKWARD
|
||||
END
|
||||
MENUITEM "Word wrap", IDM_VIEW_WRAP
|
||||
MENUITEM "Focus on Another View", IDM_VIEW_SWITCHTO_OTHER_VIEW
|
||||
|
|
|
@ -668,6 +668,53 @@ void Notepad_plus::command(int id)
|
|||
}
|
||||
break;
|
||||
|
||||
case IDM_VIEW_TAB_MOVEFORWARD:
|
||||
case IDM_VIEW_TAB_MOVEBACKWARD:
|
||||
{
|
||||
const int currentTabIndex = _pDocTab->getCurrentTabIndex();
|
||||
const int lastTabIndex = _pDocTab->getItemCount() - 1;
|
||||
int newTabIndex = currentTabIndex;
|
||||
|
||||
if (id == IDM_VIEW_TAB_MOVEFORWARD)
|
||||
{
|
||||
if (currentTabIndex >= lastTabIndex)
|
||||
return;
|
||||
++newTabIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentTabIndex < 1)
|
||||
return;
|
||||
--newTabIndex;
|
||||
}
|
||||
|
||||
TCITEM tciMove, tciShift;
|
||||
tciMove.mask = tciShift.mask = TCIF_IMAGE | TCIF_TEXT | TCIF_PARAM;
|
||||
|
||||
const int strSizeMax = 256;
|
||||
TCHAR strMove[strSizeMax];
|
||||
TCHAR strShift[strSizeMax];
|
||||
|
||||
tciMove.pszText = strMove;
|
||||
tciMove.cchTextMax = strSizeMax;
|
||||
|
||||
tciShift.pszText = strShift;
|
||||
tciShift.cchTextMax = strSizeMax;
|
||||
|
||||
::SendMessage(_pDocTab->getHSelf(), TCM_GETITEM, currentTabIndex, reinterpret_cast<LPARAM>(&tciMove));
|
||||
|
||||
::SendMessage(_pDocTab->getHSelf(), TCM_GETITEM, newTabIndex, reinterpret_cast<LPARAM>(&tciShift));
|
||||
::SendMessage(_pDocTab->getHSelf(), TCM_SETITEM, currentTabIndex, reinterpret_cast<LPARAM>(&tciShift));
|
||||
|
||||
::SendMessage(_pDocTab->getHSelf(), TCM_SETITEM, newTabIndex, reinterpret_cast<LPARAM>(&tciMove));
|
||||
|
||||
::SendMessage(_pDocTab->getHSelf(), TCM_SETCURSEL, newTabIndex, 0);
|
||||
|
||||
// Notify plugins that the document order has changed
|
||||
::SendMessage(_pDocTab->getHParent(), NPPM_INTERNAL_DOCORDERCHANGED, 0, newTabIndex);
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_EDIT_DELETE:
|
||||
_pEditView->execute(WM_CLEAR);
|
||||
break;
|
||||
|
@ -2968,6 +3015,8 @@ void Notepad_plus::command(int id)
|
|||
case IDM_VIEW_TAB9:
|
||||
case IDM_VIEW_TAB_NEXT:
|
||||
case IDM_VIEW_TAB_PREV:
|
||||
case IDM_VIEW_TAB_MOVEFORWARD:
|
||||
case IDM_VIEW_TAB_MOVEBACKWARD:
|
||||
case IDC_PREV_DOC :
|
||||
case IDC_NEXT_DOC :
|
||||
case IDM_SEARCH_GOPREVMARKER1 :
|
||||
|
|
|
@ -251,6 +251,8 @@ static const WinMenuKeyDefinition winKeyDefs[] =
|
|||
{VK_NUMPAD9, IDM_VIEW_TAB9, true, false, false, nullptr},
|
||||
{VK_NEXT, IDM_VIEW_TAB_NEXT, true, false, false, nullptr},
|
||||
{VK_PRIOR, IDM_VIEW_TAB_PREV, true, false, false, nullptr},
|
||||
{VK_NEXT, IDM_VIEW_TAB_MOVEFORWARD, true, false, true, nullptr},
|
||||
{VK_PRIOR, IDM_VIEW_TAB_MOVEBACKWARD, true, false, true, nullptr},
|
||||
|
||||
{VK_NULL, IDM_FORMAT_TODOS, false, false, false, nullptr},
|
||||
{VK_NULL, IDM_FORMAT_TOUNIX, false, false, false, nullptr},
|
||||
|
|
|
@ -340,6 +340,8 @@
|
|||
#define IDM_VIEW_TAB_NEXT (IDM_VIEW + 95)
|
||||
#define IDM_VIEW_TAB_PREV (IDM_VIEW + 96)
|
||||
#define IDM_VIEW_MONITORING (IDM_VIEW + 97)
|
||||
#define IDM_VIEW_TAB_MOVEFORWARD (IDM_VIEW + 98)
|
||||
#define IDM_VIEW_TAB_MOVEBACKWARD (IDM_VIEW + 99)
|
||||
|
||||
#define IDM_VIEW_GOTO_ANOTHER_VIEW 10001
|
||||
#define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002
|
||||
|
|
Loading…
Reference in New Issue