From 24c71c8cee6fc4c942f8c7f6c5cfe5ceedbf8ff2 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 7 Dec 2013 01:43:35 +0000 Subject: [PATCH] [NEW_FEATURE] Add 2 new commands: Open containing folder and Open cmd. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1156 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.rc | 7 ++- PowerEditor/src/NppBigSwitch.cpp | 11 ---- PowerEditor/src/NppCommands.cpp | 95 +++++------------------------ PowerEditor/src/NppNotification.cpp | 3 + PowerEditor/src/menuCmdID.h | 2 + PowerEditor/src/shortcuts.xml | 2 - 6 files changed, 26 insertions(+), 94 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 18366126c..50c1e802f 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -51,7 +51,7 @@ BEGIN VALUE "FileDescription", "Notepad++ : a free (GNU) source code editor\0" VALUE "FileVersion", VERSION_VALUE VALUE "InternalName", "npp.exe\0" - VALUE "LegalCopyright", "Copyleft 1998-2006 by Don HO\0" + VALUE "LegalCopyright", "Copyleft 1998-2013 by Don HO\0" VALUE "OriginalFilename", "Notepad++.exe\0" VALUE "ProductName", "Notepad++\0" VALUE "ProductVersion", VERSION_VALUE @@ -210,6 +210,11 @@ BEGIN BEGIN MENUITEM "&New", IDM_FILE_NEW MENUITEM "&Open...", IDM_FILE_OPEN + POPUP "Open Folder" + BEGIN + MENUITEM "Open Containing Folder", IDM_FILE_OPEN_FOLDER + MENUITEM "Open cmd", IDM_FILE_OPEN_CMD + END MENUITEM "Re&load from Disk", IDM_FILE_RELOAD MENUITEM "&Save", IDM_FILE_SAVE MENUITEM "Save &As...", IDM_FILE_SAVEAS diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 0bdff9600..e552dc217 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -480,13 +480,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa { char *fileNamesA = (char *)pCopyData->lpData; CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams(); -#ifdef UNICODE WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const wchar_t *fileNamesW = wmc->char2wchar(fileNamesA, CP_ACP); loadCommandlineParams(fileNamesW, &cmdLineParams); -#else - loadCommandlineParams(fileNamesA, &cmdLineParams); -#endif break; } @@ -494,14 +490,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa { wchar_t *fileNamesW = (wchar_t *)pCopyData->lpData; CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams(); - -#ifdef UNICODE loadCommandlineParams(fileNamesW, &cmdLineParams); -#else - WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); - const char *fileNamesA = wmc->wchar2char(fileNamesW, CP_ACP); - loadCommandlineParams(fileNamesA, &cmdLineParams); -#endif break; } } diff --git a/PowerEditor/src/NppCommands.cpp b/PowerEditor/src/NppCommands.cpp index 29a3ebec2..2d4683f41 100644 --- a/PowerEditor/src/NppCommands.cpp +++ b/PowerEditor/src/NppCommands.cpp @@ -67,6 +67,20 @@ void Notepad_plus::command(int id) } break; + case IDM_FILE_OPEN_FOLDER: + { + Command cmd(TEXT("explorer /select,$(FULL_CURRENT_PATH)")); + cmd.run(_pPublicInterface->getHSelf()); + } + break; + + case IDM_FILE_OPEN_CMD: + { + Command cmd(TEXT("cmd /K cd /d $(CURRENT_DIRECTORY)")); + cmd.run(_pPublicInterface->getHSelf()); + } + break; + case IDM_FILE_RELOAD: fileReload(); break; @@ -1936,82 +1950,6 @@ void Notepad_plus::command(int id) } break; } - /* - case (IDM_FORMAT_WIN_1250 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1251 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1252 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1253 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1254 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1255 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1256 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1257 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_WIN_1258 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_1 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_2 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_3 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_4 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_5 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_6 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_7 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_8 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_9 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_10 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_11 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_13 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_14 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_15 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_ISO_8859_16 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_437 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_720 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_737 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_775 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_850 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_852 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_855 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_857 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_858 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_860 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_861 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_862 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_863 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_865 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_866 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_DOS_869 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_BIG5 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_GB2312 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_SHIFT_JIS + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_KOREAN_WIN + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_EUC_KR + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_TIS_620 + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_MAC_CYRILLIC + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_KOI8U_CYRILLIC + IDM_FORMAT_CONVERT): - case (IDM_FORMAT_KOI8R_CYRILLIC + IDM_FORMAT_CONVERT): - { - int index = id - IDM_FORMAT_CONVERT - IDM_FORMAT_ENCODE; - - EncodingMapper *em = EncodingMapper::getInstance(); - int newEncoding = em->getEncodingFromIndex(index); - if (newEncoding == -1) - { - return; - } - - Buffer *buf = _pEditView->getCurrentBuffer(); - UniMode um = buf->getUnicodeMode(); - int oldEncoding = buf->getEncoding(); - - if (oldEncoding == newEncoding) - return; - - if (oldEncoding != -1) - { - //do warning - } - buf->setEncoding(newEncoding); - - break; - } -*/ case IDM_SETTING_IMPORTPLUGIN : { @@ -2180,13 +2118,10 @@ void Notepad_plus::command(int id) { char *authorName = "«J¤µ§^"; HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME); -#ifdef UNICODE + WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5); ::SetWindowText(hItem, authorNameW); -#else - ::SetWindowText(hItem, authorName); -#endif } } } diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index 995fd4b5c..e0a2804d6 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -341,6 +341,9 @@ BOOL Notepad_plus::notify(SCNotification *notification) itemUnitArray.push_back(MenuItemUnit(IDM_FILE_RELOAD, TEXT("Reload"))); itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, TEXT("Print"))); itemUnitArray.push_back(MenuItemUnit(0, NULL)); + itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_FOLDER, TEXT("Open Containing Folder"))); + itemUnitArray.push_back(MenuItemUnit(IDM_FILE_OPEN_CMD, TEXT("Open cmd"))); + itemUnitArray.push_back(MenuItemUnit(0, NULL)); itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_SETREADONLY, TEXT("Read-Only"))); itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CLEARREADONLY, TEXT("Clear Read-Only Flag"))); itemUnitArray.push_back(MenuItemUnit(0, NULL)); diff --git a/PowerEditor/src/menuCmdID.h b/PowerEditor/src/menuCmdID.h index 833ca1489..e5016126d 100644 --- a/PowerEditor/src/menuCmdID.h +++ b/PowerEditor/src/menuCmdID.h @@ -51,6 +51,8 @@ #define IDM_FILE_DELETE (IDM_FILE + 16) #define IDM_FILE_RENAME (IDM_FILE + 17) #define IDM_FILE_CLOSEALL_TORIGHT (IDM_FILE + 18) + #define IDM_FILE_OPEN_FOLDER (IDM_FILE + 19) + #define IDM_FILE_OPEN_CMD (IDM_FILE + 20) // To be updated if new menu item(s) is (are) added in menu "File" #define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_TORIGHT diff --git a/PowerEditor/src/shortcuts.xml b/PowerEditor/src/shortcuts.xml index 605014e75..c28b94653 100644 --- a/PowerEditor/src/shortcuts.xml +++ b/PowerEditor/src/shortcuts.xml @@ -16,8 +16,6 @@ http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD) $(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) $(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst - explorer $(CURRENT_DIRECTORY) - cmd /K cd /d $(CURRENT_DIRECTORY) outlook /a "$(FULL_CURRENT_PATH)"