diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index b77432803..163be12a9 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -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) diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 61092c264..2f4b9bead 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -1769,6 +1769,22 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa nppGUI._autoUpdateOpt._doAutoUpdate = false; 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: {