[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
This commit is contained in:
Don Ho 2013-12-07 01:43:35 +00:00
parent 4a90b305bb
commit 24c71c8cee
6 changed files with 26 additions and 94 deletions

View File

@ -51,7 +51,7 @@ BEGIN
VALUE "FileDescription", "Notepad++ : a free (GNU) source code editor\0" VALUE "FileDescription", "Notepad++ : a free (GNU) source code editor\0"
VALUE "FileVersion", VERSION_VALUE VALUE "FileVersion", VERSION_VALUE
VALUE "InternalName", "npp.exe\0" 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 "OriginalFilename", "Notepad++.exe\0"
VALUE "ProductName", "Notepad++\0" VALUE "ProductName", "Notepad++\0"
VALUE "ProductVersion", VERSION_VALUE VALUE "ProductVersion", VERSION_VALUE
@ -210,6 +210,11 @@ BEGIN
BEGIN BEGIN
MENUITEM "&New", IDM_FILE_NEW MENUITEM "&New", IDM_FILE_NEW
MENUITEM "&Open...", IDM_FILE_OPEN 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 "Re&load from Disk", IDM_FILE_RELOAD
MENUITEM "&Save", IDM_FILE_SAVE MENUITEM "&Save", IDM_FILE_SAVE
MENUITEM "Save &As...", IDM_FILE_SAVEAS MENUITEM "Save &As...", IDM_FILE_SAVEAS

View File

@ -480,13 +480,9 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
char *fileNamesA = (char *)pCopyData->lpData; char *fileNamesA = (char *)pCopyData->lpData;
CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams(); CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams();
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t *fileNamesW = wmc->char2wchar(fileNamesA, CP_ACP); const wchar_t *fileNamesW = wmc->char2wchar(fileNamesA, CP_ACP);
loadCommandlineParams(fileNamesW, &cmdLineParams); loadCommandlineParams(fileNamesW, &cmdLineParams);
#else
loadCommandlineParams(fileNamesA, &cmdLineParams);
#endif
break; break;
} }
@ -494,14 +490,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
{ {
wchar_t *fileNamesW = (wchar_t *)pCopyData->lpData; wchar_t *fileNamesW = (wchar_t *)pCopyData->lpData;
CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams(); CmdLineParams & cmdLineParams = pNppParam->getCmdLineParams();
#ifdef UNICODE
loadCommandlineParams(fileNamesW, &cmdLineParams); loadCommandlineParams(fileNamesW, &cmdLineParams);
#else
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const char *fileNamesA = wmc->wchar2char(fileNamesW, CP_ACP);
loadCommandlineParams(fileNamesA, &cmdLineParams);
#endif
break; break;
} }
} }

View File

@ -67,6 +67,20 @@ void Notepad_plus::command(int id)
} }
break; 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: case IDM_FILE_RELOAD:
fileReload(); fileReload();
break; break;
@ -1936,82 +1950,6 @@ void Notepad_plus::command(int id)
} }
break; 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 : case IDM_SETTING_IMPORTPLUGIN :
{ {
@ -2180,13 +2118,10 @@ void Notepad_plus::command(int id)
{ {
char *authorName = "«J¤µ§^"; char *authorName = "«J¤µ§^";
HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME); HWND hItem = ::GetDlgItem(_aboutDlg.getHSelf(), IDC_AUTHOR_NAME);
#ifdef UNICODE
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance(); WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5); const wchar_t *authorNameW = wmc->char2wchar(authorName, NPP_CP_BIG5);
::SetWindowText(hItem, authorNameW); ::SetWindowText(hItem, authorNameW);
#else
::SetWindowText(hItem, authorName);
#endif
} }
} }
} }

View File

@ -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_RELOAD, TEXT("Reload")));
itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, TEXT("Print"))); itemUnitArray.push_back(MenuItemUnit(IDM_FILE_PRINT, TEXT("Print")));
itemUnitArray.push_back(MenuItemUnit(0, NULL)); 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_SETREADONLY, TEXT("Read-Only")));
itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CLEARREADONLY, TEXT("Clear Read-Only Flag"))); itemUnitArray.push_back(MenuItemUnit(IDM_EDIT_CLEARREADONLY, TEXT("Clear Read-Only Flag")));
itemUnitArray.push_back(MenuItemUnit(0, NULL)); itemUnitArray.push_back(MenuItemUnit(0, NULL));

View File

@ -51,6 +51,8 @@
#define IDM_FILE_DELETE (IDM_FILE + 16) #define IDM_FILE_DELETE (IDM_FILE + 16)
#define IDM_FILE_RENAME (IDM_FILE + 17) #define IDM_FILE_RENAME (IDM_FILE + 17)
#define IDM_FILE_CLOSEALL_TORIGHT (IDM_FILE + 18) #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" // To be updated if new menu item(s) is (are) added in menu "File"
#define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_TORIGHT #define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_TORIGHT

View File

@ -16,8 +16,6 @@
<Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command> <Command name="Wikipedia Search" Ctrl="no" Alt="yes" Shift="no" Key="114">http://en.wikipedia.org/wiki/Special:Search?search=$(CURRENT_WORD)</Command>
<Command name="Open file" Ctrl="no" Alt="yes" Shift="no" Key="116">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)</Command> <Command name="Open file" Ctrl="no" Alt="yes" Shift="no" Key="116">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD)</Command>
<Command name="Open in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst</Command> <Command name="Open in another instance" Ctrl="no" Alt="yes" Shift="no" Key="117">$(NPP_DIRECTORY)\notepad++.exe $(CURRENT_WORD) -nosession -multiInst</Command>
<Command name="Open containing folder" Ctrl="no" Alt="no" Shift="no" Key="0">explorer $(CURRENT_DIRECTORY)</Command>
<Command name="Open current dir cmd" Ctrl="no" Alt="no" Shift="no" Key="0">cmd /K cd /d $(CURRENT_DIRECTORY)</Command>
<Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a &quot;$(FULL_CURRENT_PATH)&quot;</Command> <Command name="Send via Outlook" Ctrl="yes" Alt="yes" Shift="yes" Key="79">outlook /a &quot;$(FULL_CURRENT_PATH)&quot;</Command>
</UserDefinedCommands> </UserDefinedCommands>
<PluginCommands /> <PluginCommands />