Skip to content

Commit

Permalink
Add alot more N++ messages
Browse files Browse the repository at this point in the history
Related: #41
  • Loading branch information
dail8859 committed Dec 15, 2016
1 parent 52c787d commit bf97e7b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Npp/Notepad_plus_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, W
// Returns active Buffer

#define NPPM_RELOADBUFFERID (NPPMSG + 61)
// VOID NPPM_RELOADBUFFERID(0, 0)
// BOOL NPPM_RELOADBUFFERID(INT bufferID, BOOL alertOrNot)
// Reloads Buffer
// wParam: Buffer to reload
// lParam: 0 if no alert, else alert
Expand Down
44 changes: 36 additions & 8 deletions src/NppIFaceTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,12 +486,15 @@ static std::vector<IFaceConstant> ifaceConstants = {
{ "L_XML", L_XML },
{ "L_YAML", L_YAML },
{ "MAIN_VIEW", MAIN_VIEW },
{ "MODELESSDIALOGADD", MODELESSDIALOGADD },
{ "MODELESSDIALOGREMOVE", MODELESSDIALOGREMOVE },
{ "NPPM_GETAPPDATAPLUGINSALLOWED", NPPM_GETAPPDATAPLUGINSALLOWED },
{ "NPPM_GETBUFFERLANGTYPE", NPPM_GETBUFFERLANGTYPE },
{ "NPPM_GETCURRENTBUFFERID", NPPM_GETCURRENTBUFFERID },
{ "NPPM_GETCURRENTCOLUMN", NPPM_GETCURRENTCOLUMN },
{ "NPPM_GETCURRENTLANGTYPE", NPPM_GETCURRENTLANGTYPE },
{ "NPPM_GETCURRENTLINE", NPPM_GETCURRENTLINE },
{ "NPPM_GETCURRENTNATIVELANGENCODING", NPPM_GETCURRENTNATIVELANGENCODING },
{ "NPPM_GETCURRENTVIEW", NPPM_GETCURRENTVIEW },
{ "NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR", NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR },
{ "NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR", NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR },
Expand All @@ -504,6 +507,12 @@ static std::vector<IFaceConstant> ifaceConstants = {
{ "NPPM_SETCURRENTLANGTYPE", NPPM_SETCURRENTLANGTYPE },
{ "NPPM_SETEDITORBORDEREDGE", NPPM_SETEDITORBORDEREDGE },
{ "PRIMARY_VIEW", PRIMARY_VIEW },
{ "STATUSBAR_CUR_POS", STATUSBAR_CUR_POS },
{ "STATUSBAR_DOC_SIZE", STATUSBAR_DOC_SIZE },
{ "STATUSBAR_DOC_TYPE", STATUSBAR_DOC_TYPE },
{ "STATUSBAR_EOF_FORMAT", STATUSBAR_EOF_FORMAT },
{ "STATUSBAR_TYPING_MODE", STATUSBAR_TYPING_MODE },
{ "STATUSBAR_UNICODE_TYPE", STATUSBAR_UNICODE_TYPE },
{ "SECOND_VIEW", SECOND_VIEW },
{ "SUB_VIEW", SUB_VIEW },
{ "WV_95", WV_95 },
Expand All @@ -525,46 +534,65 @@ static std::vector<IFaceConstant> ifaceConstants = {

static std::vector<IFaceFunction> ifaceFunctions = {
{ "ActivateDoc", NPPM_ACTIVATEDOC, iface_void, { iface_int, iface_int } },
{ "DocSwitcherDisableColumn", NPPM_DOCSWITCHERDISABLECOLUMN, iface_void, { iface_void, iface_bool } },
{ "DoOpen", NPPM_DOOPEN, iface_bool, { iface_void, iface_tstring } },
{ "DmmViewOtherTab", NPPM_DMMVIEWOTHERTAB, iface_void, { iface_void, iface_tstring } },
{ "GetBufferIDFromPos", NPPM_GETBUFFERIDFROMPOS, iface_int, { iface_int, iface_int } },
{ "GetCurrentDirectory", NPPM_GETCURRENTDIRECTORY, iface_void, { iface_length, iface_tstringresult } },
{ "GetCurrentDocIndex", NPPM_GETCURRENTDOCINDEX, iface_int, { iface_void, iface_int } },
{ "GetCurrentWord", NPPM_GETCURRENTWORD, iface_void, { iface_length, iface_tstringresult } },
{ "GetExtPart", NPPM_GETEXTPART, iface_void, { iface_length, iface_tstringresult } },
{ "GetFileName", NPPM_GETFILENAME, iface_void, { iface_length, iface_tstringresult } },
{ "GetFullCurrentPath", NPPM_GETFULLCURRENTPATH, iface_void, { iface_length, iface_tstringresult } },
{ "GetFullPathFromBufferID", NPPM_GETFULLPATHFROMBUFFERID, iface_void, { iface_int, iface_tstringresult} },
{ "GetNamePart", NPPM_GETNAMEPART, iface_void, { iface_length, iface_tstringresult } },
{ "GetNbOpenFiles", NPPM_GETNBOPENFILES, iface_int, { iface_void, iface_int } },
{ "GetNbSessionFiles", NPPM_GETNBSESSIONFILES, iface_int, { iface_void, iface_tstring } },
{ "GetNppDirectory", NPPM_GETNPPDIRECTORY, iface_void, { iface_length, iface_tstringresult } },
{ "GetNppFullFilePath", NPPM_GETNPPFULLFILEPATH, iface_void, { iface_length, iface_tstringresult } },
{ "GetPluginsConfigDir", NPPM_GETPLUGINSCONFIGDIR, iface_void, { iface_length, iface_tstringresult } },
//{ "GetPosFromBufferID", NPPM_GETPOSFROMBUFFERID, iface_int, { iface_int, iface_int } },
//{ "HideTabBar", NPPM_HIDETABBAR, iface_bool, { iface_void, iface_bool } },
//{ "IsTabBarHidden", NPPM_ISTABBARHIDDEN, iface_bool, { iface_void, iface_void } },
//{ "LaunchFindInFilesDlg", NPPM_LAUNCHFINDINFILESDLG, iface_void, { iface_tstring, iface_tstring } },
//{ "LoadSession", NPPM_LOADSESSION, iface_void, { iface_void, iface_tstring } },
{ "GetPosFromBufferID", NPPM_GETPOSFROMBUFFERID, iface_int, { iface_int, iface_int } },
{ "HideMenu", NPPM_HIDEMENU, iface_bool, { iface_void, iface_bool } },
{ "HideStatusBar", NPPM_HIDESTATUSBAR, iface_bool, { iface_void, iface_bool } },
{ "HideTabBar", NPPM_HIDETABBAR, iface_bool, { iface_void, iface_bool } },
{ "HideToolBar", NPPM_HIDETOOLBAR, iface_bool, { iface_void, iface_bool } },
{ "IsDocSwitcherShown", NPPM_ISDOCSWITCHERSHOWN, iface_bool, { iface_void, iface_void } },
{ "IsMenuHidden", NPPM_ISMENUHIDDEN, iface_bool, { iface_void, iface_void } },
{ "IsStatusBarHidden", NPPM_ISSTATUSBARHIDDEN, iface_bool, { iface_void, iface_void } },
{ "IsTabBarHidden", NPPM_ISTABBARHIDDEN, iface_bool, { iface_void, iface_void } },
{ "IsToolBarHidden", NPPM_ISTOOLBARHIDDEN, iface_bool, { iface_void, iface_void } },
{ "LaunchFindInFilesDlg", NPPM_LAUNCHFINDINFILESDLG, iface_void, { iface_tstring, iface_tstring} },
{ "LoadSession", NPPM_LOADSESSION, iface_void, { iface_void, iface_tstring } },
{ "MakeCurrentBufferDirty", NPPM_MAKECURRENTBUFFERDIRTY, iface_void, { iface_void, iface_void } },
{ "MenuCommand", NPPM_MENUCOMMAND, iface_void, { iface_void, iface_int } },
{ "ReloadBufferID", NPPM_RELOADBUFFERID, iface_bool, { iface_int, iface_bool } },
{ "ReloadFile", NPPM_RELOADFILE, iface_int, { iface_bool, iface_tstring } },
{ "SaveAllFiles", NPPM_SAVEALLFILES, iface_bool, { iface_void, iface_void } },
{ "SaveCurrentFile", NPPM_SAVECURRENTFILE, iface_bool, { iface_void, iface_void } },
{ "SaveCurrentFileAs", NPPM_SAVECURRENTFILEAS, iface_bool, { iface_bool, iface_tstring } },
{ "SaveFile", NPPM_SAVEFILE, iface_void, {iface_void, iface_tstring} },
//{ "SaveCurrentSession", NPPM_SAVECURRENTSESSION, iface_void, { iface_void, iface_tstring } },
{ "SaveCurrentSession", NPPM_SAVECURRENTSESSION, iface_void, { iface_void, iface_tstring } },
{ "SaveFile", NPPM_SAVEFILE, iface_void, { iface_void, iface_tstring} },
{ "SetEditorBorderEdge", NPPM_SETEDITORBORDEREDGE, iface_void, { iface_void, iface_bool} },
{ "SetSmoothFont", NPPM_SETSMOOTHFONT, iface_void, { iface_void, iface_bool} },
{ "ShowDocSwitcher", NPPM_SHOWDOCSWITCHER, iface_void, { iface_void, iface_bool} },
{ "SwitchToFile", NPPM_SWITCHTOFILE, iface_bool, { iface_void, iface_tstring } },
{ "TriggerTabbarContextMenu", NPPM_TRIGGERTABBARCONTEXTMENU, iface_void, { iface_int, iface_int } },
};

static std::vector<IFaceProperty> ifaceProperties = {
{ "AppDataPluginsAllowed", NPPM_GETAPPDATAPLUGINSALLOWED, 0, iface_bool, iface_void },
{ "BufferLangType", NPPM_GETBUFFERLANGTYPE, NPPM_SETBUFFERLANGTYPE, iface_int, iface_int },
{ "CurrentBufferID", NPPM_GETCURRENTBUFFERID, 0, iface_int, iface_void },
{ "CurrentColumn", NPPM_GETCURRENTCOLUMN, 0, iface_position, iface_void },
//{ "CurrentLangType", NPPM_GETCURRENTLANGTYPE, NPPM_SETCURRENTLANGTYPE, iface_int, iface_void },
// { "CurrentLangType", NPPM_GETCURRENTLANGTYPE, NPPM_SETCURRENTLANGTYPE, iface_int, iface_void },
{ "CurrentLine", NPPM_GETCURRENTLINE, 0, iface_int, iface_void },
{ "CurrentView", NPPM_GETCURRENTVIEW, 0, iface_int, iface_void },
{ "DefaultBackgroundColor", NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR, 0, iface_colour, iface_void },
{ "DefaultForegroundColor", NPPM_GETEDITORDEFAULTFOREGROUNDCOLOR, 0, iface_colour, iface_void },
{ "LanguageDescription", NPPM_GETLANGUAGEDESC, 0, iface_tstringresult, iface_int },
{ "LanguageName", NPPM_GETLANGUAGENAME, 0, iface_tstringresult, iface_int },
{ "NativeLangEncoding", NPPM_GETCURRENTNATIVELANGENCODING, 0, iface_int, iface_void },
{ "StatusBar", 0, NPPM_SETSTATUSBAR, iface_tstring, iface_int},
{ "Version", NPPM_GETNPPVERSION, 0, iface_int, iface_void },
{ "WindowsVersion", NPPM_GETWINDOWSVERSION, 0, iface_int, iface_void },
};
Expand Down
6 changes: 3 additions & 3 deletions src/SciTE/LuaExtension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ static int iface_function_helper(lua_State *L, const IFaceFunction &func) {

char *stringResult = 0;
wchar_t *wstringResult = 0;
tstring nppstrparam;
tstring nppstrparams[2]; // 2 in case both params are tstrings
enum stringResultType { none, string, tstring } needStringResult = none;
int loopParamCount = 2;

Expand All @@ -1011,8 +1011,8 @@ static int iface_function_helper(lua_State *L, const IFaceFunction &func) {
params[i] = SptrFromString(s ? s : "");
} else if (func.paramType[i] == iface_tstring) {
const char *s = lua_tostring(L, arg++);
nppstrparam = GUI::StringFromUTF8(s ? s : "");
params[i] = reinterpret_cast<sptr_t>(nppstrparam.c_str());
nppstrparams[i] = GUI::StringFromUTF8(s ? s : "");
params[i] = reinterpret_cast<sptr_t>(nppstrparams[i].c_str());
} else if (func.paramType[i] == iface_keymod) {
int keycode = static_cast<int>(luaL_checkinteger(L, arg++)) & 0xFFFF;
int modifiers = static_cast<int>(luaL_checkinteger(L, arg++)) & (SCMOD_SHIFT|SCMOD_CTRL|SCMOD_ALT);
Expand Down

0 comments on commit bf97e7b

Please sign in to comment.