[NEW] Add 2 plugins messages NPPM_GETLANGUAGENAME & NPPM_GETLANGUAGEDESC.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@775 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2011-06-15 23:38:36 +00:00
parent b32e972221
commit 8bae5fcf0f
2 changed files with 32 additions and 0 deletions

View File

@ -330,6 +330,22 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
// Allocates a marker number to a plugin
// Returns: TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful
#define NPPM_GETLANGUAGENAME (NPPMSG + 83)
// INT NPPM_GETLANGUAGENAME(int langType, TCHAR *langName)
// Get programing language name from the given language type (LangType)
// Return value is the number of copied character / number of character to copy (\0 is not included)
// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy.
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time
// by passing allocated buffer as argument langName
#define NPPM_GETLANGUAGEDESC (NPPMSG + 84)
// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc)
// Get programing language short description from the given language type (LangType)
// Return value is the number of copied character / number of character to copy (\0 is not included)
// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy.
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time
// by passing allocated buffer as argument langDesc
#define RUNCOMMAND_USER (WM_USER + 3000)
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
#define NPPM_GETCURRENTDIRECTORY (RUNCOMMAND_USER + CURRENT_DIRECTORY)

View File

@ -1770,6 +1770,22 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_GETLANGUAGENAME:
{
generic_string langName = getLangDesc((LangType)wParam, false);
if (lParam)
lstrcpy((LPTSTR)lParam, langName.c_str());
return langName.length();
}
case NPPM_GETLANGUAGEDESC:
{
generic_string langDesc = getLangDesc((LangType)wParam, true);
if (lParam)
lstrcpy((LPTSTR)lParam, langDesc.c_str());
return langDesc.length();
}
case WM_INITMENUPOPUP:
{
_windowsMenu.initPopupMenu((HMENU)wParam, _pDocTab);