Add document tab "Move to Start" & "Move to End" commands

Fix #13982, fix #9525
pull/14497/head
Don Ho 12 months ago
parent d9d26e5981
commit fa82ca0224

@ -708,6 +708,9 @@ BEGIN
END
POPUP "Move/Clone Current Document"
BEGIN
MENUITEM "Move to Start", IDM_VIEW_GOTO_START
MENUITEM "Move to End", IDM_VIEW_GOTO_END
MENUITEM SEPARATOR
MENUITEM "Move to Other View", IDM_VIEW_GOTO_ANOTHER_VIEW
MENUITEM "Clone to Other View", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
MENUITEM "Move to New Instance", IDM_VIEW_GOTO_NEW_INSTANCE

@ -3239,6 +3239,14 @@ void Notepad_plus::command(int id)
break;
}
case IDM_VIEW_GOTO_START:
_pDocTab->currentTabToStart();
break;
case IDM_VIEW_GOTO_END:
_pDocTab->currentTabToEnd();
break;
case IDM_VIEW_GOTO_ANOTHER_VIEW:
docGotoAnotherEditView(TransferMove);
checkSyncState();
@ -4258,7 +4266,12 @@ void Notepad_plus::command(int id)
case IDM_VIEW_UNFOLD_6:
case IDM_VIEW_UNFOLD_7:
case IDM_VIEW_UNFOLD_8:
case IDM_VIEW_GOTO_START:
case IDM_VIEW_GOTO_END:
case IDM_VIEW_GOTO_ANOTHER_VIEW:
case IDM_VIEW_CLONE_TO_ANOTHER_VIEW:
case IDM_VIEW_GOTO_NEW_INSTANCE:
case IDM_VIEW_LOAD_IN_NEW_INSTANCE:
case IDM_VIEW_SYNSCROLLV:
case IDM_VIEW_SYNSCROLLH:
case IDM_VIEW_TAB1:

@ -552,6 +552,9 @@ BOOL Notepad_plus::notify(SCNotification *notification)
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FULLPATHTOCLIP, TEXT("Copy Full File Path"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_FILENAMETOCLIP, TEXT("Copy Filename"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CURRENTDIRTOCLIP, TEXT("Copy Current Dir. Path"), TEXT("Copy to Clipboard")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_START, TEXT("Move to Start"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_END, TEXT("Move to End"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(0, NULL, TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_ANOTHER_VIEW, TEXT("Move to Other View"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_CLONE_TO_ANOTHER_VIEW, TEXT("Clone to Other View"), TEXT("Move Document")));
itemUnitArray.push_back(MenuItemUnit(IDM_VIEW_GOTO_NEW_INSTANCE, TEXT("Move to New Instance"), TEXT("Move Document")));

@ -280,6 +280,8 @@ static const WinMenuKeyDefinition winKeyDefs[] =
// { VK_NULL, IDM_VIEW_ZOOMIN, false, false, false, nullptr },
// { VK_NULL, IDM_VIEW_ZOOMOUT, false, false, false, nullptr },
// { VK_NULL, IDM_VIEW_ZOOMRESTORE, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_GOTO_START, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_GOTO_END, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_GOTO_ANOTHER_VIEW, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_CLONE_TO_ANOTHER_VIEW, false, false, false, nullptr },
{ VK_NULL, IDM_VIEW_GOTO_NEW_INSTANCE, false, false, false, nullptr },

@ -404,6 +404,29 @@ void TabBarPlus::setColour(COLORREF colour2Set, tabColourIndex i)
doOwnerDrawTab();
}
void TabBarPlus::currentTabToStart()
{
int currentTabIndex = getCurrentTabIndex();
if (currentTabIndex <= 0)
return;
for (int i = currentTabIndex, j = currentTabIndex - 1; j >= 0; --i, --j)
{
exchangeTabItemData(i, j);
}
}
void TabBarPlus::currentTabToEnd()
{
int currentTabIndex = getCurrentTabIndex();
if (currentTabIndex >= _nbItem)
return;
for (int i = currentTabIndex, j = currentTabIndex + 1; j < _nbItem; ++i, ++j)
{
exchangeTabItemData(i, j);
}
}
void TabBarPlus::doVertical()
{

@ -159,14 +159,6 @@ public :
return _doDragNDrop;
};
int getSrcTabIndex() const {
return _nSrcTab;
};
int getTabDraggedIndex() const {
return _nTabDragged;
};
POINT getDraggingPoint() const {
return _draggingPoint;
};
@ -217,9 +209,11 @@ public :
}
static void setColour(COLORREF colour2Set, tabColourIndex i);
virtual int getIndividualTabColour(int tabIndex) = 0;
void currentTabToStart();
void currentTabToEnd();
protected:
// it's the boss to decide if we do the drag N drop
static bool _doDragNDrop;

@ -1230,7 +1230,7 @@ void CommandShortcut::setCategoryFromMenu(HMENU hMenu)
if (_id >= IDM_WINDOW_WINDOWS && _id <= IDM_WINDOW_SORT_FS_DSC)
pNativeSpeaker->getMainMenuEntryName(_category, hMenu, "Window", L"Window");
else if ( _id >= IDM_VIEW_GOTO_ANOTHER_VIEW && _id <= IDM_VIEW_LOAD_IN_NEW_INSTANCE)
else if ( _id >= IDM_VIEW_GOTO_ANOTHER_VIEW && _id <= IDM_VIEW_GOTO_END)
pNativeSpeaker->getMainMenuEntryName(_category, hMenu, "view", L"View");
else if (_id == IDM_EDIT_LTR || _id == IDM_EDIT_RTL)
pNativeSpeaker->getMainMenuEntryName(_category, hMenu, "view", L"View");

@ -396,7 +396,8 @@
#define IDM_VIEW_CLONE_TO_ANOTHER_VIEW 10002
#define IDM_VIEW_GOTO_NEW_INSTANCE 10003
#define IDM_VIEW_LOAD_IN_NEW_INSTANCE 10004
#define IDM_VIEW_GOTO_START 10005
#define IDM_VIEW_GOTO_END 10006
#define IDM_FORMAT (IDM + 5000)
#define IDM_FORMAT_TODOS (IDM_FORMAT + 1)

Loading…
Cancel
Save