diff --git a/.gitignore b/.gitignore index 3e983e5..54384b9 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ arm64/ vs.proj/.vs/ vs.proj/x64/ vs.proj/ARM64 -vs.proj/Debug/ -vs.proj/Release/ +vs.proj/Win32/ UpgradeLog.htm vs.proj/NppPluginConverter.vcxproj.user vs.proj/NppPluginConverter.exp @@ -18,4 +17,6 @@ vs.proj/NppPluginConverter.lib *.exp *.aps *.bak +*.log +*.tlog vs.proj/NppConverter.lib \ No newline at end of file diff --git a/source/DockingFeature/Docking.h b/source/DockingFeature/Docking.h index 32e2075..0a3918b 100644 --- a/source/DockingFeature/Docking.h +++ b/source/DockingFeature/Docking.h @@ -1,5 +1,5 @@ // This file is part of Notepad++ project -// Copyright (C)2022 Don HO +// Copyright (C)2025 Don HO // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -15,8 +15,9 @@ // along with this program. If not, see . -#ifndef DOCKING_H -#define DOCKING_H +#pragma once + +#include // ATTENTION : It's a part of interface header, so don't include the others header here @@ -35,6 +36,7 @@ #define DWS_ICONTAB 0x00000001 // Icon for tabs are available #define DWS_ICONBAR 0x00000002 // Icon for icon bar are available (currently not supported) #define DWS_ADDINFO 0x00000004 // Additional information are in use +#define DWS_USEOWNDARKMODE 0x00000008 // Use plugin's own dark mode #define DWS_PARAMSALL (DWS_ICONTAB|DWS_ICONBAR|DWS_ADDINFO) // default docking values for first call of plugin @@ -45,31 +47,29 @@ #define DWS_DF_FLOATING 0x80000000 // default state is floating -typedef struct { - HWND hClient; // client Window Handle - TCHAR *pszName; // name of plugin (shown in window) - int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID +struct tTbData { + HWND hClient = nullptr; // client Window Handle + const wchar_t* pszName = nullptr; // name of plugin (shown in window) + int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID // user modifications - UINT uMask; // mask params: look to above defines - HICON hIconTab; // icon for tabs - TCHAR *pszAddInfo; // for plugin to display additional informations + UINT uMask = 0; // mask params: look to above defines + HICON hIconTab = nullptr; // icon for tabs + const wchar_t* pszAddInfo = nullptr; // for plugin to display additional information // internal data, do not use !!! - RECT rcFloat; // floating position - int iPrevCont; // stores the privious container (toggling between float and dock) - const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin -} tTbData; + RECT rcFloat = {}; // floating position + int iPrevCont = 0; // stores the privious container (toggling between float and dock) + const wchar_t* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin +}; -typedef struct { - HWND hWnd; // the docking manager wnd - RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs -} tDockMgr; +struct tDockMgr { + HWND hWnd = nullptr; // the docking manager wnd + RECT rcRegion[DOCKCONT_MAX] = {{}}; // position of docked dialogs +}; #define HIT_TEST_THICKNESS 20 #define SPLITTER_WIDTH 4 - -#endif // DOCKING_H diff --git a/source/DockingFeature/dockingResource.h b/source/DockingFeature/dockingResource.h index 9d0e5bc..e593faa 100644 --- a/source/DockingFeature/dockingResource.h +++ b/source/DockingFeature/dockingResource.h @@ -1,6 +1,6 @@ -//this file is part of docking functionality for Notepad++ -//Copyright (C)2006 Jens Lorenz -// +// This file is part of Notepad++ project +// Copyright (C)2006 Jens Lorenz + // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or @@ -14,9 +14,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// Contribution by Don HO +// Date of Contribution: 2025-05-14 +// Description of Contribution: Minor change -#ifndef DOCKING_RESOURCE_H -#define DOCKING_RESOURCE_H +#pragma once + +#define DM_NOFOCUSWHILECLICKINGCAPTION L"NOFOCUSWHILECLICKINGCAPTION" #define IDD_PLUGIN_DLG 103 #define IDC_EDIT1 1000 @@ -31,33 +35,25 @@ #define IDC_BTN_CAPTION 1050 #define DMM_MSG 0x5000 - #define DMM_CLOSE (DMM_MSG + 1) - #define DMM_DOCK (DMM_MSG + 2) - #define DMM_FLOAT (DMM_MSG + 3) - #define DMM_DOCKALL (DMM_MSG + 4) - #define DMM_FLOATALL (DMM_MSG + 5) - #define DMM_MOVE (DMM_MSG + 6) - #define DMM_UPDATEDISPINFO (DMM_MSG + 7) - #define DMM_GETIMAGELIST (DMM_MSG + 8) - #define DMM_GETICONPOS (DMM_MSG + 9) - #define DMM_DROPDATA (DMM_MSG + 10) - #define DMM_MOVE_SPLITTER (DMM_MSG + 11) - #define DMM_CANCEL_MOVE (DMM_MSG + 12) - #define DMM_LBUTTONUP (DMM_MSG + 13) + #define DMM_CLOSE (DMM_MSG + 1) + #define DMM_DOCK (DMM_MSG + 2) + #define DMM_FLOAT (DMM_MSG + 3) + #define DMM_DOCKALL (DMM_MSG + 4) + #define DMM_FLOATALL (DMM_MSG + 5) + #define DMM_MOVE (DMM_MSG + 6) + #define DMM_UPDATEDISPINFO (DMM_MSG + 7) + //#define DMM_GETIMAGELIST (DMM_MSG + 8) + //#define DMM_GETICONPOS (DMM_MSG + 9) + #define DMM_DROPDATA (DMM_MSG + 10) + #define DMM_MOVE_SPLITTER (DMM_MSG + 11) + #define DMM_CANCEL_MOVE (DMM_MSG + 12) + #define DMM_LBUTTONUP (DMM_MSG + 13) #define DMN_FIRST 1050 - #define DMN_CLOSE (DMN_FIRST + 1) - //nmhdr.code = DWORD(DMN_CLOSE, 0)); - //nmhdr.hwndFrom = hwndNpp; - //nmhdr.idFrom = ctrlIdNpp; - - #define DMN_DOCK (DMN_FIRST + 2) - #define DMN_FLOAT (DMN_FIRST + 3) - //nmhdr.code = DWORD(DMN_XXX, int newContainer); - //nmhdr.hwndFrom = hwndNpp; - //nmhdr.idFrom = ctrlIdNpp; - - - -#endif //DOCKING_RESOURCE_H + #define DMN_CLOSE (DMN_FIRST + 1) + #define DMN_DOCK (DMN_FIRST + 2) + #define DMN_FLOAT (DMN_FIRST + 3) + #define DMN_SWITCHIN (DMN_FIRST + 4) + #define DMN_SWITCHOFF (DMN_FIRST + 5) + #define DMN_FLOATDROPPED (DMN_FIRST + 6) diff --git a/source/Notepad_plus_msgs.h b/source/Notepad_plus_msgs.h index aa3636a..bc45fbd 100644 --- a/source/Notepad_plus_msgs.h +++ b/source/Notepad_plus_msgs.h @@ -23,11 +23,10 @@ #pragma once #include -#include enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER,\ - L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA, \ + L_ASP, L_SQL, L_VB, L_JS_EMBEDDED, L_CSS, L_PERL, L_PYTHON, L_LUA, \ L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\ L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\ L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\ @@ -39,8 +38,9 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ L_MMIXAL, L_NIM, L_NNCRONTAB, L_OSCRIPT, L_REBOL, \ L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\ L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD,\ - // Don't use L_JS, use L_JAVASCRIPT instead - // The end of enumated language type, so it should be always at the end + L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, \ + // Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead + // The end of enumerated language type, so it should be always at the end L_EXTERNAL}; enum class ExternalLexerAutoIndentMode { Standard, C_Like, Custom }; enum class MacroStatus { Idle, RecordInProgress, RecordingStopped, PlayingBack }; @@ -83,9 +83,9 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // lParam[in]: iViewType - could be PRIMARY_VIEW (value 1), SECOND_VIEW (value 2) or ALL_OPEN_FILES (value 0) // return the number of opened files - #define NPPM_GETOPENFILENAMES (NPPMSG + 8) - // BOOL NPPM_GETOPENFILENAMES(TCHAR** fileNames, int nbFileNames) - // Get the open files full paths of both views. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. + #define NPPM_GETOPENFILENAMES_DEPRECATED (NPPMSG + 8) + // BOOL NPPM_GETOPENFILENAMES_DEPRECATED(wchar_t** fileNames, int nbFileNames) - DEPRECATED: It is kept for the compatibility. Use NPPM_GETBUFFERIDFROMPOS & NPPM_GETFULLPATHFROMBUFFERID instead. + // Get the open files full paths of both views. User is responsible to allocate a big enough fileNames array by using NPPM_GETNBOPENFILES. // wParam[out]: fileNames - array of file path // lParam[in]: nbFileNames is the number of file path. // return value: The number of files copied into fileNames array @@ -103,24 +103,24 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // return hDlg (HWND) on success, NULL on failure #define NPPM_GETNBSESSIONFILES (NPPMSG + 13) - // int NPPM_GETNBSESSIONFILES (BOOL* pbIsValidXML, TCHAR* sessionFileName) + // int NPPM_GETNBSESSIONFILES (BOOL* pbIsValidXML, wchar_t* sessionFileName) // Get the number of files to load in the session sessionFileName. sessionFileName should be a full path name of an xml file. // wParam[out]: pbIsValidXML, if the lParam pointer is null, then this parameter will be ignored. TRUE if XML is valid, otherwise FALSE. // lParam[in]: sessionFileName is XML session full path // return value: The number of files in XML session file #define NPPM_GETSESSIONFILES (NPPMSG + 14) - // NPPM_GETSESSIONFILES (TCHAR** sessionFileArray, TCHAR* sessionFileName) + // BOOL NPPM_GETSESSIONFILES (wchar_t** sessionFileArray, wchar_t* sessionFileName) // the files' full path name from a session file. // wParam[out]: sessionFileArray is the array in which the files' full path of the same group are written. To allocate the array with the proper size, send message NPPM_GETNBSESSIONFILES. // lParam[in]: sessionFileName is XML session full path // Return FALSE on failure, TRUE on success - + #define NPPM_SAVESESSION (NPPMSG + 15) struct sessionInfo { - TCHAR* sessionFilePathName; // Full session file path name to be saved + wchar_t* sessionFilePathName; // Full session file path name to be saved int nbFile; // Size of "files" array - number of files to be saved in session - TCHAR** files; // Array of file name (full path) to be saved in session + wchar_t** files; // Array of file name (full path) to be saved in session }; // NPPM_SAVESESSION(0, sessionInfo* si) // Creates an session file for a defined set of files. @@ -130,22 +130,22 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Returns sessionFileName on success, NULL otherwise #define NPPM_SAVECURRENTSESSION (NPPMSG + 16) - // TCHAR* NPPM_SAVECURRENTSESSION(0, TCHAR* sessionFileName) + // wchar_t* NPPM_SAVECURRENTSESSION(0, wchar_t* sessionFileName) // Saves the current opened files in Notepad++ as a group of files (session) as an xml file. // wParam: 0 (not used) // lParam[in]: sessionFileName is the xml full path name // Returns sessionFileName on success, NULL otherwise - #define NPPM_GETOPENFILENAMESPRIMARY (NPPMSG + 17) - // BOOL NPPM_GETOPENFILENAMESPRIMARY(TCHAR** fileNames, int nbFileNames) + #define NPPM_GETOPENFILENAMESPRIMARY_DEPRECATED (NPPMSG + 17) + // BOOL NPPM_GETOPENFILENAMESPRIMARY_DEPRECATED(wchar_t** fileNames, int nbFileNames) - DEPRECATED: It is kept for the compatibility. Use NPPM_GETBUFFERIDFROMPOS & NPPM_GETFULLPATHFROMBUFFERID instead. // Get the open files full paths of main view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. // wParam[out]: fileNames - array of file path // lParam[in]: nbFileNames is the number of file path. // return value: The number of files copied into fileNames array - #define NPPM_GETOPENFILENAMESSECOND (NPPMSG + 18) - // BOOL NPPM_GETOPENFILENAMESSECOND(TCHAR** fileNames, int nbFileNames) + #define NPPM_GETOPENFILENAMESSECOND_DEPRECATED (NPPMSG + 18) + // BOOL NPPM_GETOPENFILENAMESSECOND_DEPRECATED(wchar_t** fileNames, int nbFileNames) - DEPRECATED: It is kept for the compatibility. Use NPPM_GETBUFFERIDFROMPOS & NPPM_GETFULLPATHFROMBUFFERID instead. // Get the open files full paths of sub-view. User is responsible to allocate an big enough fileNames array by using NPPM_GETNBOPENFILES. // wParam[out]: fileNames - array of file path // lParam[in]: nbFileNames is the number of file path. @@ -160,7 +160,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_DESTROYSCINTILLAHANDLE_DEPRECATED (NPPMSG + 21) // BOOL NPPM_DESTROYSCINTILLAHANDLE_DEPRECATED(0, HWND hScintilla) - DEPRECATED: It is kept for the compatibility. - // Notepad++ will deallocate every createed Scintilla control on exit, this message returns TRUE but does nothing. + // Notepad++ will deallocate every created Scintilla control on exit, this message returns TRUE but does nothing. // wParam: 0 (not used) // lParam[in]: hScintilla is Scintilla handle // Return TRUE @@ -178,7 +178,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // int NPPM_GETCURRENTDOCINDEX(0, int inView) // Get the current index of the given view. // wParam: 0 (not used) - // lParam[in]: inView, should be 0 (main view) or 1 (sub-view) + // lParam[in]: inView, should be 0 (main view) or 1 (sub-view) // Return -1 if the view is invisible (hidden), otherwise is the current index. #define NPPM_SETSTATUSBAR (NPPMSG + 24) @@ -188,7 +188,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define STATUSBAR_EOF_FORMAT 3 #define STATUSBAR_UNICODE_TYPE 4 #define STATUSBAR_TYPING_MODE 5 - // BOOL NPPM_SETSTATUSBAR(int whichPart, TCHAR *str2set) + // BOOL NPPM_SETSTATUSBAR(int whichPart, wchar_t *str2set) // Set string in the specified field of a statusbar. // wParam[in]: whichPart for indicating the statusbar part you want to set. It can be only the above value (0 - 5) // lParam[in]: str2set is the string you want to write to the part of statusbar. @@ -208,7 +208,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Changes current buffer in view to UTF-8. // wParam[in]: inView - main view (0) or sub-view (1) // lParam: 0 (not used) - // return new UniMode, with the following value: + // return new UniMode, with the following value: // 0: ANSI // 1: UTF-8 with BOM // 2: UTF-16 Big Ending with BOM @@ -229,11 +229,11 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // BOOL NPPM_ACTIVATEDOC(int inView, int index2Activate) // Switch to the document by the given view and index. // wParam[in]: inView - main view (0) or sub-view (1) - // lParam[in]: index2Activate - index (in the view indicated above) where is the document to be activated + // lParam[in]: index2Activate - index (in the view indicated above) where is the document to be activated // Return TRUE #define NPPM_LAUNCHFINDINFILESDLG (NPPMSG + 29) - // BOOL NPPM_LAUNCHFINDINFILESDLG(TCHAR * dir2Search, TCHAR * filtre) + // BOOL NPPM_LAUNCHFINDINFILESDLG(wchar_t * dir2Search, wchar_t * filtre) // Launch Find in Files dialog and set "Find in" directory and filters with the given arguments. // wParam[in]: if dir2Search is not NULL, it will be set as working directory in which Notepad++ will search // lParam[in]: if filtre is not NULL, filtre string will be set into filter field @@ -241,23 +241,23 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_DMMSHOW (NPPMSG + 30) // BOOL NPPM_DMMSHOW(0, HWND hDlg) - // Show the dialog which was previously regeistered by NPPM_DMMREGASDCKDLG. + // Show the dialog which was previously registered by NPPM_DMMREGASDCKDLG. // wParam: 0 (not used) // lParam[in]: hDlg is the handle of dialog to show // Return TRUE #define NPPM_DMMHIDE (NPPMSG + 31) // BOOL NPPM_DMMHIDE(0, HWND hDlg) - // Hide the dialog which was previously regeistered by NPPM_DMMREGASDCKDLG. + // Hide the dialog which was previously registered by NPPM_DMMREGASDCKDLG. // wParam: 0 (not used) - // lParam[in]: hDlg is the handle of dialog to hide + // lParam[in]: hDlg is the handle of dialog to hide // Return TRUE #define NPPM_DMMUPDATEDISPINFO (NPPMSG + 32) // BOOL NPPM_DMMUPDATEDISPINFO(0, HWND hDlg) // Redraw the dialog. // wParam: 0 (not used) - // lParam[in]: hDlg is the handle of dialog to redraw + // lParam[in]: hDlg is the handle of dialog to redraw // Return TRUE #define NPPM_DMMREGASDCKDLG (NPPMSG + 33) @@ -265,36 +265,36 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Pass the necessary dockingData to Notepad++ in order to make your dialog dockable. // wParam: 0 (not used) // lParam[in]: pData is the pointer of tTbData. Please check tTbData structure in "Docking.h" - // Minimum informations which needs to be filled out are hClient, pszName, dlgID, uMask and pszModuleName. - // Notice that rcFloatand iPrevCont shouldn't be filled. They are used internally. + // Minimum information which needs to be filled out are hClient, pszName, dlgID, uMask and pszModuleName. + // Notice that rcFloat and iPrevCont shouldn't be filled. They are used internally. // Return TRUE #define NPPM_LOADSESSION (NPPMSG + 34) - // BOOL NPPM_LOADSESSION(0, TCHAR* sessionFileName) + // BOOL NPPM_LOADSESSION(0, wchar_t* sessionFileName) // Open all files of same session in Notepad++ via a xml format session file sessionFileName. // wParam: 0 (not used) - // lParam[in]: sessionFileName is the full file path of session file to reload + // lParam[in]: sessionFileName is the full file path of session file to reload // Return TRUE #define NPPM_DMMVIEWOTHERTAB (NPPMSG + 35) - // BOOL WM_DMM_VIEWOTHERTAB(0, TCHAR* name) - // Show the plugin dialog (switch to plugin tab) with the given name. + // BOOL WM_DMM_VIEWOTHERTAB(0, wchar_t* name) + // Show the plugin dialog (switch to plugin tab) with the given name. // wParam: 0 (not used) // lParam[in]: name should be the same value as previously used to register the dialog (pszName of tTbData) // Return TRUE #define NPPM_RELOADFILE (NPPMSG + 36) - // BOOL NPPM_RELOADFILE(BOOL withAlert, TCHAR *filePathName2Reload) - // Reload the document which matches with the given filePathName2switch. + // BOOL NPPM_RELOADFILE(BOOL withAlert, wchar_t *filePathName2Reload) + // Reload the document which matches with the given filePathName2Reload. // wParam: 0 (not used) - // lParam[in]: filePathName2Reload is the full file path of document to reload - // Return TRUE + // lParam[in]: filePathName2Reload is the full file path of document to reload + // Return TRUE if reloading file succeeds, otherwise FALSE #define NPPM_SWITCHTOFILE (NPPMSG + 37) - // BOOL NPPM_SWITCHTOFILE(0, TCHAR* filePathName2switch) + // BOOL NPPM_SWITCHTOFILE(0, wchar_t* filePathName2switch) // Switch to the document which matches with the given filePathName2switch. // wParam: 0 (not used) - // lParam[in]: filePathName2switch is the full file path of document to switch + // lParam[in]: filePathName2switch is the full file path of document to switch // Return TRUE #define NPPM_SAVECURRENTFILE (NPPMSG + 38) @@ -336,10 +336,10 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Get OS (Windows) version. // wParam: 0 (not used) // lParam: 0 (not used) - // Return enum winVer, which is defined at the begining of this file + // Return enum winVer, which is defined at the beginning of this file #define NPPM_DMMGETPLUGINHWNDBYNAME (NPPMSG + 43) - // HWND NPPM_DMMGETPLUGINHWNDBYNAME(const TCHAR *windowName, const TCHAR *moduleName) + // HWND NPPM_DMMGETPLUGINHWNDBYNAME(const wchar_t *windowName, const wchar_t *moduleName) // Retrieve the dialog handle corresponds to the windowName and moduleName. You may need this message if you want to communicate with another plugin "dockable" dialog. // wParam[in]: windowName - if windowName is NULL, then the first found window handle which matches with the moduleName will be returned // lParam[in] : moduleName - if moduleName is NULL, then return value is NULL @@ -360,22 +360,22 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Return a proc address or NULL #define NPPM_GETPLUGINSCONFIGDIR (NPPMSG + 46) - // int NPPM_GETPLUGINSCONFIGDIR(int strLen, TCHAR *str) + // int NPPM_GETPLUGINSCONFIGDIR(int strLen, wchar_t *str) // Get user's plugin config directory path. It's useful if plugins want to save/load parameters for the current user // wParam[in]: strLen is length of allocated buffer in which directory path is copied // lParam[out] : str is the allocated buffere. User should call this message twice - - // The 1st call with "str" be NULL to get the required number of TCHAR (not including the terminating nul character) + // The 1st call with "str" be NULL to get the required number of wchar_t (not including the terminating nul character) // The 2nd call to allocate "str" buffer with the 1st call's return value + 1, then call it again to get the path - // Return value: The 1st call - the number of TCHAR to copy. + // Return value: The 1st call - the number of wchar_t to copy. // The 2nd call - FALSE on failure, TRUE on success #define NPPM_MSGTOPLUGIN (NPPMSG + 47) struct CommunicationInfo { - long internalMsg; // an integer defined by plugin Y, known by plugin X, identifying the message being sent. - const TCHAR * srcModuleName; // the complete module name (with the extesion .dll) of caller (plugin X). - void* info; // defined by plugin, the informations to be exchanged between X and Y. It's a void pointer so it should be defined by plugin Y and known by plugin X. + long internalMsg; // an integer defined by plugin Y, known by plugin X, identifying the message being sent. + const wchar_t * srcModuleName; // the complete module name (with the extension .dll) of caller (plugin X). + void* info; // defined by plugin, the information to be exchanged between X and Y. It's a void pointer so it should be defined by plugin Y and known by plugin X. }; - // BOOL NPPM_MSGTOPLUGIN(TCHAR *destModuleName, CommunicationInfo *info) + // BOOL NPPM_MSGTOPLUGIN(wchar_t *destModuleName, CommunicationInfo *info) // Send a private information to a plugin with given plugin name. This message allows the communication between 2 plugins. // For example, plugin X can execute a command of plugin Y if plugin X knows the command ID and the file name of plugin Y. // wParam[in]: destModuleName is the destination complete module file name (with the file extension ".dll") @@ -405,9 +405,9 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // return value: // HIWORD(returned_value) is major part of version: the 1st number // LOWORD(returned_value) is minor part of version: the 3 last numbers - // + // // ADD_ZERO_PADDING == TRUE - // + // // version | HIWORD | LOWORD //------------------------------ // 8.9.6.4 | 8 | 964 @@ -415,10 +415,10 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // 6.9 | 6 | 900 // 6.6.6 | 6 | 660 // 13.6.6.6 | 13 | 666 - // - // + // + // // ADD_ZERO_PADDING == FALSE - // + // // version | HIWORD | LOWORD //------------------------------ // 8.9.6.4 | 8 | 964 @@ -445,23 +445,23 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // int NPPM_GETPOSFROMBUFFERID(UINT_PTR bufferID, int priorityView) // Get document position (VIEW and INDEX) from a buffer ID, according priorityView. // wParam[in]: BufferID of document - // lParam[in]: priorityView is the target VIEW. However, if the given bufferID cannot be found in the target VIEW, the other VIEW will be searched. + // lParam[in]: priorityView is the target VIEW. However, if the given bufferID cannot be found in the target VIEW, the other VIEW will be searched. // Return -1 if the bufferID non existing, else return value contains VIEW & INDEX: // // VIEW takes 2 highest bits and INDEX (0 based) takes the rest (30 bits) // Here's the values for the view: // MAIN_VIEW 0 // SUB_VIEW 1 - // + // // if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly #define NPPM_GETFULLPATHFROMBUFFERID (NPPMSG + 58) - // int NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, TCHAR* fullFilePath) + // int NPPM_GETFULLPATHFROMBUFFERID(UINT_PTR bufferID, wchar_t* fullFilePath) // Get full path file name from a bufferID (the pointer of buffer). // wParam[in]: bufferID - // lParam[out]: fullFilePath - User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character), + // lParam[out]: fullFilePath - User should call it with fullFilePath be NULL to get the number of wchar_t (not including the nul character), // allocate fullFilePath with the return values + 1, then call it again to get full path file name - // Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy + // Return -1 if the bufferID non existing, otherwise the number of wchar_t copied/to copy #define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59) // UINT_PTR NPPM_GETBUFFERIDFROMPOS(int index, int iView) @@ -503,7 +503,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Get encoding from the document with the given bufferID // wParam[in]: BufferID to get encoding from // lParam: 0 (not used) - // returns -1 on error, otherwise UniMode, with the following value: + // returns -1 on error, otherwise UniMode, with the following value: // 0: ANSI // 1: UTF-8 with BOM // 2: UTF-16 Big Ending with BOM @@ -526,7 +526,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Get the EOL format of the document with given bufferID. // wParam[in]: BufferID to get EolType format from // lParam: 0 (not used) - // Returned value is -1 on error, otherwize EolType format: + // Returned value is -1 on error, otherwise EolType format: // 0: Windows (CRLF) // 1: Macos (CR) // 2: Unix (LF) @@ -584,13 +584,13 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_GETSHORTCUTBYCMDID (NPPMSG + 76) // BOOL NPPM_GETSHORTCUTBYCMDID(int cmdID, ShortcutKey* sk) // Get your plugin command current mapped shortcut into sk via cmdID. - // wParam[in]: cmdID is your plugin command ID + // wParam[in]: cmdID is your plugin command ID // lParam[out]: sk is a pointer of ShortcutKey strcture which will receive the requested CMD shortcut. It should be allocated in the plugin before being used. // For ShortcutKey strcture, see in "PluginInterface.h". You may need it after getting NPPN_READY notification. // return value: TRUE if this function call is successful and shortcut is enable, otherwise FALSE #define NPPM_DOOPEN (NPPMSG + 77) - // BOOL NPPM_DOOPEN(0, const TCHAR* fullPathName2Open) + // BOOL NPPM_DOOPEN(0, const wchar_t* fullPathName2Open) // Open a file with given fullPathName2Open. // If fullPathName2Open has been already opened in Notepad++, the it will be activated and becomes the current document. // wParam: 0 (not used) @@ -598,7 +598,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // The return value is TRUE if the operation is successful, otherwise FALSE #define NPPM_SAVECURRENTFILEAS (NPPMSG + 78) - // BOOL NPPM_SAVECURRENTFILEAS (BOOL saveAsCopy, const TCHAR* filename) + // BOOL NPPM_SAVECURRENTFILEAS (BOOL saveAsCopy, const wchar_t* filename) // Save the current activated document. // wParam[in]: saveAsCopy must be either FALSE to save, or TRUE to save a copy of the current filename ("Save a Copy As..." action) // lParam[in]: filename indicates the full file path name to be saved @@ -626,14 +626,14 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // wParam[in]: numberRequested is the number of ID you request for the reservation // lParam[out]: startNumber will be set to the initial command ID if successful // Returns: TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful - // + // // Example: If a plugin needs 4 menu item ID, the following code can be used: - // + // // int idBegin; // BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATECMDID, 4, &idBegin); - // + // // if isAllocatedSuccessful is TRUE, and value of idBegin is 46581 - // then menu iten ID 46581, 46582, 46583 and 46584 are preserved by Notepad++, and they are safe to be used by the plugin. + // then menu item ID 46581, 46582, 46583 and 46584 are preserved by Notepad++, and they are safe to be used by the plugin. #define NPPM_ALLOCATEMARKER (NPPMSG + 82) // BOOL NPPM_ALLOCATEMARKER(int numberRequested, int* startNumber) @@ -642,33 +642,33 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // wParam[in]: numberRequested is the number of ID you request for the reservation // lParam[out]: startNumber will be set to the initial command ID if successful // Return TRUE if successful, FALSE otherwise. startNumber will also be set to 0 if unsuccessful - // + // // Example: If a plugin needs 3 marker ID, the following code can be used: - // + // // int idBegin; // BOOL isAllocatedSuccessful = ::SendMessage(nppData._nppHandle, NPPM_ALLOCATEMARKER, 3, &idBegin); - // - // if isAllocatedSuccessful is TRUE, and value of idBegin is 16 + // + // if isAllocatedSuccessful is TRUE, and value of idBegin is 16 // then marker ID 16, 17 and 18 are preserved by Notepad++, and they are safe to be used by the plugin. #define NPPM_GETLANGUAGENAME (NPPMSG + 83) - // int NPPM_GETLANGUAGENAME(LangType langType, TCHAR* langName) + // int NPPM_GETLANGUAGENAME(LangType langType, wchar_t* langName) // Get programming language name from the given language type (enum LangType). // wParam[in]: langType is the number of LangType - // lParam[out]: langName is the buffer to recieve the language name string + // lParam[out]: langName is the buffer to receive the language name string // 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) + // INT NPPM_GETLANGUAGEDESC(int langType, wchar_t *langDesc) // Get programming language short description from the given language type (enum LangType) // wParam[in]: langType is the number of LangType - // lParam[out]: langDesc is the buffer to recieve the language description string + // lParam[out]: langDesc is the buffer to receive the language description string // 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 @@ -744,7 +744,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Return TRUE #define NPPM_SAVEFILE (NPPMSG + 94) - // BOOL NPPM_SAVEFILE(0, const TCHAR *fileNameToSave) + // BOOL NPPM_SAVEFILE(0, const wchar_t *fileNameToSave) // Save the file (opened in Notepad++) with the given full file name path. // wParam: 0 (not used) // lParam[in]: fileNameToSave must be the full file path for the file to be saved. @@ -765,20 +765,20 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // return value: TRUE if function call is successful, otherwise FALSE #define NPPM_GETPLUGINHOMEPATH (NPPMSG + 97) - // int NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR* pluginRootPath) + // int NPPM_GETPLUGINHOMEPATH(size_t strLen, wchar_t* pluginRootPath) // Get plugin home root path. It's useful if plugins want to get its own path by appending which is the name of plugin without extension part. // wParam[in]: strLen - size of allocated buffer "pluginRootPath" - // lParam[out]: pluginRootPath - Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character), + // lParam[out]: pluginRootPath - Users should call it with pluginRootPath be NULL to get the required number of wchar_t (not including the terminating nul character), // allocate pluginRootPath buffer with the return value + 1, then call it again to get the path. - // Return the number of TCHAR copied/to copy, 0 on copy failed + // Return the number of wchar_t copied/to copy, 0 on copy failed #define NPPM_GETSETTINGSONCLOUDPATH (NPPMSG + 98) - // int NPPM_GETSETTINGSCLOUDPATH(size_t strLen, TCHAR *settingsOnCloudPath) + // int NPPM_GETSETTINGSCLOUDPATH(size_t strLen, wchar_t *settingsOnCloudPath) // Get settings on cloud path. It's useful if plugins want to store its settings on Cloud, if this path is set. // wParam[in]: strLen - size of allocated buffer "settingsOnCloudPath" - // lParam[out]: settingsOnCloudPath - Users should call it with settingsOnCloudPath be NULL to get the required number of TCHAR (not including the terminating nul character), + // lParam[out]: settingsOnCloudPath - Users should call it with settingsOnCloudPath be NULL to get the required number of wchar_t (not including the terminating nul character), // allocate settingsOnCloudPath buffer with the return value + 1, then call it again to get the path. - // Returns the number of TCHAR copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path. + // Returns the number of wchar_t copied/to copy. If the return value is 0, then this path is not set, or the "strLen" is not enough to copy the path. #define NPPM_SETLINENUMBERWIDTHMODE (NPPMSG + 99) #define LINENUMWIDTH_DYNAMIC 0 @@ -811,20 +811,20 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Return TRUE #define NPPM_GETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 103) - // BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const TCHAR* languageName, ExternalLexerAutoIndentMode* autoIndentMode) + // BOOL NPPM_GETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode* autoIndentMode) // Get ExternalLexerAutoIndentMode for an installed external programming language. // wParam[in]: languageName is external language name to search - // lParam[out]: autoIndentMode could recieve one of three following values + // lParam[out]: autoIndentMode could receive one of three following values // - Standard (0) means Notepad++ will keep the same TAB indentation between lines; // - C_Like (1) means Notepad++ will perform a C-Language style indentation for the selected external language; // - Custom (2) means a Plugin will be controlling auto-indentation for the current language. // returned values: TRUE for successful searches, otherwise FALSE. #define NPPM_SETEXTERNALLEXERAUTOINDENTMODE (NPPMSG + 104) - // BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const TCHAR* languageName, ExternalLexerAutoIndentMode autoIndentMode) + // BOOL NPPM_SETEXTERNALLEXERAUTOINDENTMODE(const wchar_t* languageName, ExternalLexerAutoIndentMode autoIndentMode) // Set ExternalLexerAutoIndentMode for an installed external programming language. // wParam[in]: languageName is external language name to set - // lParam[in]: autoIndentMode could recieve one of three following values + // lParam[in]: autoIndentMode could receive one of three following values // - Standard (0) means Notepad++ will keep the same TAB indentation between lines; // - C_Like (1) means Notepad++ will perform a C-Language style indentation for the selected external language; // - Custom (2) means a Plugin will be controlling auto-indentation for the current language. @@ -886,17 +886,17 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/NppDarkMode.h#L32 #define NPPM_GETCURRENTCMDLINE (NPPMSG + 109) - // int NPPM_GETCURRENTCMDLINE(size_t strLen, TCHAR *commandLineStr) + // int NPPM_GETCURRENTCMDLINE(size_t strLen, wchar_t *commandLineStr) // Get the Current Command Line string. - // Users should call it with commandLineStr as NULL to get the required number of TCHAR (not including the terminating nul character), + // Users should call it with commandLineStr as NULL to get the required number of wchar_t (not including the terminating nul character), // allocate commandLineStr buffer with the return value + 1, then call it again to get the current command line string. // wParam[in]: strLen is "commandLineStr" buffer length - // lParam[out]: commandLineStr recieves all copied command line string - // Return the number of TCHAR copied/to copy + // lParam[out]: commandLineStr receives all copied command line string + // Return the number of wchar_t copied/to copy #define NPPM_CREATELEXER (NPPMSG + 110) - // void* NPPM_CREATELEXER(0, const TCHAR* lexer_name) + // void* NPPM_CREATELEXER(0, const wchar_t* lexer_name) // Get the ILexer pointer created by Lexilla. Call the lexilla "CreateLexer()" function to allow plugins to set the lexer for a Scintilla instance created by NPPM_CREATESCINTILLAHANDLE. // wParam: 0 (not used) // lParam[in]: lexer_name is the name of the lexer @@ -904,7 +904,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_GETBOOKMARKID (NPPMSG + 111) // int NPPM_GETBOOKMARKID(0, 0) - // Get the bookmark ID - use this API to get bookmark ID dynamically that garantees you get always the right bookmark ID even it's been changed through the different versions. + // Get the bookmark ID - use this API to get bookmark ID dynamically that guarantees you get always the right bookmark ID even it's been changed through the different versions. // wParam: 0 (not used) // lParam: 0 (not used) // Return bookmark ID @@ -924,7 +924,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Might not work properly in C# plugins. // wParam[in]: dmFlags has 2 possible value dmfInit (0x0000000BUL) & dmfHandleChange (0x0000000CUL) - see above definition // lParam[in]: hwnd is the dialog handle of plugin - Docking panels don't need to call NPPM_DARKMODESUBCLASSANDTHEME - // Returns succesful combinations of flags. + // Returns successful combinations of flags. // Examples: // @@ -963,8 +963,82 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // if isAllocatedSuccessful is TRUE, and value of idBegin is 7 // then indicator ID 7 is preserved by Notepad++, and it is safe to be used by the plugin. + #define NPPM_GETTABCOLORID (NPPMSG + 114) + // int NPPM_GETTABCOLORID(int view, int tabIndex) + // Get the tab color ID with given tab index and view. + // wParam[in]: view - main view (0) or sub-view (1) or -1 (active view) + // lParam[in]: tabIndex - index (in the view indicated above). -1 for currently active tab + // Return tab color ID which contains the following values: 0 (yellow), 1 (green), 2 (blue), 3 (orange), 4 (pink) or -1 (no color) + // + // Note: there's no symmetric command NPPM_SETTABCOLORID. Plugins can use NPPM_MENUCOMMAND to set current tab color with the desired tab color ID. + + #define NPPM_SETUNTITLEDNAME (NPPMSG + 115) + // BOOL NPPM_SETUNTITLEDNAME(BufferID id, const wchar_t* newName) + // Rename the tab name for an untitled tab. + // wParam[in]: id - BufferID of the tab. -1 for currently active tab + // lParam[in]: newName - the desired new name of the tab + // Return TRUE upon success; FALSE upon failure + + #define NPPM_GETNATIVELANGFILENAME (NPPMSG + 116) + // int NPPM_GETNATIVELANGFILENAME(size_t strLen, char* nativeLangFileName) + // Get the Current native language file name string. Use it after getting NPPN_READY notification to find out which native language is used. + // Users should call it with nativeLangFileName as NULL to get the required number of char (not including the terminating nul character), + // allocate language file name string buffer with the return value + 1, then call it again to get the current native language file name string. + // If there's no localization file applied, the returned value is 0. + // wParam[in]: strLen is "language file name string" buffer length + // lParam[out]: language file name string receives all copied native language file name string + // Return the number of char copied/to copy + + #define NPPM_ADDSCNMODIFIEDFLAGS (NPPMSG + 117) + // BOOL NPPM_ADDSCNMODIFIEDFLAGS(0, unsigned long scnModifiedFlags2Add) + // Add the necessary SCN_MODIFIED flags so that your plugin will receive the SCN_MODIFIED notification for these events, enabling your specific treatments. + // By default, Notepad++ only forwards SCN_MODIFIED with the following 5 flags/events: + // SC_MOD_DELETETEXT | SC_MOD_INSERTTEXT | SC_PERFORMED_UNDO | SC_PERFORMED_REDO | SC_MOD_CHANGEINDICATOR to plugins. + // If your plugin needs to process other SCN_MODIFIED events, you should add the required flags by sending this message to Notepad++. You can send it immediately after receiving NPPN_READY, + // or only when your plugin needs to listen to specific events (to avoid penalizing Notepad++'s performance). Just ensure that the message is sent only once. + // wParam: 0 (not used) + // lParam[in]: scnModifiedFlags2Add - Scintilla SCN_MODIFIED flags to add. + // Return TRUE + // + // Example: + // + // extern "C" __declspec(dllexport) void beNotified(SCNotification* notifyCode) + // { + // switch (notifyCode->nmhdr.code) + // { + // case NPPN_READY: + // { + // // Add SC_MOD_BEFOREDELETE and SC_MOD_BEFOREINSERT to listen to the 2 events of SCN_MODIFIED + // ::SendMessage(nppData._nppHandle, NPPM_ADDSCNMODIFIEDFLAGS, 0, SC_MOD_BEFOREDELETE | SC_MOD_BEFOREINSERT); + // } + // break; + // ... + // } + // ... + // } + + #define NPPM_GETTOOLBARICONSETCHOICE (NPPMSG + 118) + // BOOL NPPM_GETTOOLBARICONSETCHOICE(0, 0) + // Get Notepad++ toolbar icon set choice (Fluent UI: small, Fluent UI: large, Filled Fluent UI: small, Filled Fluent UI: large and Standard icons: small. + // wParam: 0 (not used) + // lParam: 0 (not used) + // Return toolbar icon set choice as an integer value. Here are 5 possible values: + // 0 (Fluent UI: small), 1 (Fluent UI: large), 2 (Filled Fluent UI: small), 3 (Filled Fluent UI: large) and 4 (Standard icons: small). + + #define NPPM_GETNPPSETTINGSDIRPATH (NPPMSG + 119) + // int NPPM_GETNPPSETTINGSDIRPATH(size_t strLen, wchar_t *settingsDirPath) + // Get path for the active Notepad++ settings: it will use -settingsDir path if that's defined; if not, it will use Cloud directory if that's defined; + // if not, it will use the AppData settings directory, or finally the installation path. This allows plugins to have one interface to find out + // where the active Notepad++ settings are stored, whichever location they are currently set to. + // wParam[in]: strLen - size of allocated buffer "settingsDirPath" + // lParam[out]: settingsDirPath - Users should call it with settingsDirPath be NULL to get the required number of wchar_t (not including the terminating nul character), + // allocate settingsDirPath buffer with the return value + 1, then call it again to get the path. + // Returns the number of wchar_t copied/to copy. If the return value is 0, then the "strLen" is not enough to copy the path, or the settings path could not be determined. + // + // Note: This message is for the active Notepad++ configuration location. If you are looking for the settings directory for plugins (...\Plugins\Config\), + // use NPPM_GETPLUGINSCONFIGDIR instead. - // For RUNCOMMAND_USER +// For RUNCOMMAND_USER #define VAR_NOT_RECOGNIZED 0 #define FULL_CURRENT_PATH 1 #define CURRENT_DIRECTORY 2 @@ -991,11 +1065,11 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; #define NPPM_GETNPPFULLFILEPATH (RUNCOMMAND_USER + NPP_FULL_FILE_PATH) #define NPPM_GETFILENAMEATCURSOR (RUNCOMMAND_USER + GETFILENAMEATCURSOR) #define NPPM_GETCURRENTLINESTR (RUNCOMMAND_USER + CURRENT_LINESTR) - // BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, TCHAR *str) + // BOOL NPPM_GETXXXXXXXXXXXXXXXX(size_t strLen, wchar_t *str) // Get XXX string operations. // wParam[in]: strLen is the allocated array size - // lParam[out]: str is the allocated TCHAR array - // The return value is TRUE when get generic_string operation success, otherwise FALSE (allocated array size is too small) + // lParam[out]: str is the allocated wchar_t array + // The return value is TRUE when get std::wstring operation success, otherwise FALSE (allocated array size is too small) #define NPPM_GETCURRENTLINE (RUNCOMMAND_USER + CURRENT_LINE) @@ -1016,7 +1090,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; // Notification code #define NPPN_FIRST 1000 - #define NPPN_READY (NPPN_FIRST + 1) // To notify plugins that all the procedures of launchment of notepad++ are done. + #define NPPN_READY (NPPN_FIRST + 1) // To notify plugins that all the initialization for launching Notepad++ is complete. //scnNotification->nmhdr.code = NPPN_READY; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = 0; @@ -1047,7 +1121,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; //scnNotification->nmhdr.idFrom = BufferID; #define NPPN_FILEBEFORESAVE (NPPN_FIRST + 7) // To notify plugins that the current file is about to be saved - //scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN; + //scnNotification->nmhdr.code = NPPN_FILEBEFORESAVE; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = BufferID; @@ -1077,7 +1151,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; //scnNotification->nmhdr.idFrom = currentBufferID; #define NPPN_SHORTCUTREMAPPED (NPPN_FIRST + 13) // To notify plugins that plugin command shortcut is remapped. - //scnNotification->nmhdr.code = NPPN_SHORTCUTSREMAPPED; + //scnNotification->nmhdr.code = NPPN_SHORTCUTREMAPPED; //scnNotification->nmhdr.hwndFrom = ShortcutKeyStructurePointer; //scnNotification->nmhdr.idFrom = cmdID; //where ShortcutKeyStructurePointer is pointer of struct ShortcutKey: @@ -1089,12 +1163,12 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; //}; #define NPPN_FILEBEFORELOAD (NPPN_FIRST + 14) // To notify plugins that the current file is about to be loaded - //scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN; + //scnNotification->nmhdr.code = NPPN_FILEBEFORELOAD; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = NULL; #define NPPN_FILELOADFAILED (NPPN_FIRST + 15) // To notify plugins that file open operation failed - //scnNotification->nmhdr.code = NPPN_FILEOPENFAILED; + //scnNotification->nmhdr.code = NPPN_FILELOADFAILED; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = BufferID; @@ -1163,12 +1237,52 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 }; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = 0; - #define NPPN_CMDLINEPLUGINMSG (NPPN_FIRST + 28) // To notify plugins that the new argument for plugins (via '-pluginMessage="YOUR_PLUGIN_ARGUMENT"' in command line) is available + #define NPPN_CMDLINEPLUGINMSG (NPPN_FIRST + 28) // To notify plugins that there are plugin arguments pluginMessage (wchar_t*) is available //scnNotification->nmhdr.code = NPPN_CMDLINEPLUGINMSG; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = pluginMessage; //where pluginMessage is pointer of type wchar_t + // + // User can pass arguments to plugins via command line argument using: + // -pluginMessage="PLUGIN1_ARG1=V1;PLUGIN1_ARG2=V2;PLUGIN2_ARG=V;..." + // + // The full string (wchar_t*) will be delivered to all plugins via the NPPN_CMDLINEPLUGINMSG notification. Each plugins can parse and extract the arguments relevant to itself. + // + // To avoid the collisions among plugins, the following protocol should be followed: + // 1. Each plugin must use its unique namespace (its folder name in plugins directory) as a prefix for its argument names. + // 2. The symbol ';' must be used as the delimiter between arguments when there are 2 or more arguments in the pluginMessage string. + // 3. The symbol '=' must be used as delimiter between argument names and their values. + // + // Example (via the command line): + // -pluginMessage="NppExecScriptPath=C:\Program Files\Notepad++\plugins\NppExec\init.py;NppExecArg2=arg2Value;mimeToolsSettings=disable;pluginYInfo=show" + // + // Interpretation: + // - Plugin "NppExec" processes: NppExecScriptPath=C:\Program Files\Notepad++\plugins\NppExec\init.py & NppExecArg2=arg2Value + // - Plugin "mimeTools" processes: mimeToolsSettings=disable + // - Plugin "pluginY" processes: pluginYInfo=show #define NPPN_EXTERNALLEXERBUFFER (NPPN_FIRST + 29) // To notify lexer plugins that the buffer (in idFrom) is just applied to a external lexer //scnNotification->nmhdr.code = NPPN_EXTERNALLEXERBUFFER; //scnNotification->nmhdr.hwndFrom = hwndNpp; //scnNotification->nmhdr.idFrom = BufferID; //where pluginMessage is pointer of type wchar_t + + #define NPPN_GLOBALMODIFIED (NPPN_FIRST + 30) // To notify plugins that the current document is just modified by Replace All action. + // For solving the performance issue (from v8.6.4), Notepad++ doesn't trigger SCN_MODIFIED during Replace All action anymore. + // As a result, the plugins which monitor SCN_MODIFIED should also monitor NPPN_GLOBALMODIFIED. + // This notification is implemented in Notepad++ v8.6.5. + //scnNotification->nmhdr.code = NPPN_GLOBALMODIFIED; + //scnNotification->nmhdr.hwndFrom = BufferID; + //scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero + + #define NPPN_NATIVELANGCHANGED (NPPN_FIRST + 31) // To notify plugins that the current native language is just changed to another one. + // Use NPPM_GETNATIVELANGFILENAME to get current native language file name. + // Use NPPM_GETMENUHANDLE(NPPPLUGINMENU, 0) to get submenu "Plugins" handle (HMENU) + //scnNotification->nmhdr.code = NPPN_NATIVELANGCHANGED; + //scnNotification->nmhdr.hwndFrom = hwndNpp + //scnNotification->nmhdr.idFrom = 0; // preserved for the future use, must be zero + + #define NPPN_TOOLBARICONSETCHANGED (NPPN_FIRST + 32) // To notify plugins that toolbar icon set selection has changed + //scnNotification->nmhdr.code = NPPN_TOOLBARICONSETCHANGED; + //scnNotification->nmhdr.hwndFrom = hwndNpp; + //scnNotification->nmhdr.idFrom = iconSetChoice; + // where iconSetChoice could be 1 of 5 possible values: + // 0 (Fluent UI: small), 1 (Fluent UI: large), 2 (Filled Fluent UI: small), 3 (Filled Fluent UI: large) and 4 (Standard icons: small). diff --git a/source/PluginDefinition.cpp b/source/PluginDefinition.cpp index e5c44ab..0b617a1 100644 --- a/source/PluginDefinition.cpp +++ b/source/PluginDefinition.cpp @@ -386,8 +386,9 @@ void ascii2hex(bool insertSpace, bool isMaj, size_t nbCharPerLine) } const char *format = ""; - int val = selText.getChar(i); - if (val == -1) + bool isBufferOverflowed = false; + size_t val = selText.getChar(i, isBufferOverflowed); + if (isBufferOverflowed) { delete [] pDestText; return; diff --git a/source/PluginDefinition.h b/source/PluginDefinition.h index 26efa09..bf95dd0 100644 --- a/source/PluginDefinition.h +++ b/source/PluginDefinition.h @@ -148,9 +148,13 @@ class SelectedString { return _selEndPos; }; - int getChar(size_t i) { - if (i >= (_selEndPos-_selStartPos)) - return -1; + size_t getChar(size_t i, bool& isBufferOverflowed) { + isBufferOverflowed = false; + if (i >= (_selEndPos - _selStartPos)) + { + isBufferOverflowed = true; + return 0; + } return _str[i]; }; diff --git a/source/PluginInterface.h b/source/PluginInterface.h index 416a362..0a95422 100644 --- a/source/PluginInterface.h +++ b/source/PluginInterface.h @@ -1,5 +1,5 @@ // This file is part of Notepad++ project -// Copyright (C)2024 Don HO +// Copyright (C)2025 Don HO // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ #include "Notepad_plus_msgs.h" -typedef const TCHAR * (__cdecl * PFUNCGETNAME)(); +typedef const wchar_t * (__cdecl * PFUNCGETNAME)(); struct NppData { @@ -52,7 +52,7 @@ const int menuItemSize = 64; struct FuncItem { - TCHAR _itemName[menuItemSize] = { '\0' }; + wchar_t _itemName[menuItemSize] = { '\0' }; PFUNCPLUGINCMD _pFunc = nullptr; int _cmdID = 0; bool _init2Check = false; @@ -63,7 +63,7 @@ typedef FuncItem * (__cdecl * PFUNCGETFUNCSARRAY)(int *); // You should implement (or define an empty function body) those functions which are called by Notepad++ plugin manager extern "C" __declspec(dllexport) void setInfo(NppData); -extern "C" __declspec(dllexport) const TCHAR * getName(); +extern "C" __declspec(dllexport) const wchar_t * getName(); extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *); extern "C" __declspec(dllexport) void beNotified(SCNotification *); extern "C" __declspec(dllexport) LRESULT messageProc(UINT Message, WPARAM wParam, LPARAM lParam); diff --git a/source/Scintilla.h b/source/Scintilla.h index 95fcf9b..db768a8 100644 --- a/source/Scintilla.h +++ b/source/Scintilla.h @@ -62,7 +62,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_SETUNDOCOLLECTION 2012 #define SCI_SELECTALL 2013 #define SCI_SETSAVEPOINT 2014 -#define SCI_GETSTYLEDTEXT 2015 +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL,SCI_GETSTYLEDTEXTFULL and SCI_FORMATRANGEFULL and corresponding defines/structs +//#define SCI_GETSTYLEDTEXT 2015 #define SCI_GETSTYLEDTEXTFULL 2778 #define SCI_CANREDO 2016 #define SCI_MARKERLINEFROMHANDLE 2017 @@ -166,6 +168,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_MARKNUM_FOLDERSUB 29 #define SC_MARKNUM_FOLDER 30 #define SC_MARKNUM_FOLDEROPEN 31 +#define SC_MASK_HISTORY 0x01E00000 #define SC_MASK_FOLDERS 0xFE000000 #define SCI_MARKERDEFINE 2040 #define SCI_MARKERSETFORE 2041 @@ -281,6 +284,17 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_STYLESETHOTSPOT 2409 #define SCI_STYLESETCHECKMONOSPACED 2254 #define SCI_STYLEGETCHECKMONOSPACED 2255 +#define SC_STRETCH_ULTRA_CONDENSED 1 +#define SC_STRETCH_EXTRA_CONDENSED 2 +#define SC_STRETCH_CONDENSED 3 +#define SC_STRETCH_SEMI_CONDENSED 4 +#define SC_STRETCH_NORMAL 5 +#define SC_STRETCH_SEMI_EXPANDED 6 +#define SC_STRETCH_EXPANDED 7 +#define SC_STRETCH_EXTRA_EXPANDED 8 +#define SC_STRETCH_ULTRA_EXPANDED 9 +#define SCI_STYLESETSTRETCH 2258 +#define SCI_STYLEGETSTRETCH 2259 #define SCI_STYLESETINVISIBLEREPRESENTATION 2256 #define SCI_STYLEGETINVISIBLEREPRESENTATION 2257 #define SC_ELEMENT_LIST 0 @@ -295,6 +309,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_ELEMENT_SELECTION_SECONDARY_BACK 15 #define SC_ELEMENT_SELECTION_INACTIVE_TEXT 16 #define SC_ELEMENT_SELECTION_INACTIVE_BACK 17 +#define SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_TEXT 18 +#define SC_ELEMENT_SELECTION_INACTIVE_ADDITIONAL_BACK 19 #define SC_ELEMENT_CARET 40 #define SC_ELEMENT_CARET_ADDITIONAL 41 #define SC_ELEMENT_CARET_LINE_BACK 50 @@ -339,6 +355,21 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_GETCHARACTERCATEGORYOPTIMIZATION 2721 #define SCI_BEGINUNDOACTION 2078 #define SCI_ENDUNDOACTION 2079 +#define SCI_GETUNDOSEQUENCE 2799 +#define SCI_GETUNDOACTIONS 2790 +#define SCI_SETUNDOSAVEPOINT 2791 +#define SCI_GETUNDOSAVEPOINT 2792 +#define SCI_SETUNDODETACH 2793 +#define SCI_GETUNDODETACH 2794 +#define SCI_SETUNDOTENTATIVE 2795 +#define SCI_GETUNDOTENTATIVE 2796 +#define SCI_SETUNDOCURRENT 2797 +#define SCI_GETUNDOCURRENT 2798 +#define SCI_PUSHUNDOACTIONTYPE 2800 +#define SCI_CHANGELASTUNDOACTIONTEXT 2801 +#define SCI_GETUNDOACTIONTYPE 2802 +#define SCI_GETUNDOACTIONPOSITION 2803 +#define SCI_GETUNDOACTIONTEXT 2804 #define INDIC_PLAIN 0 #define INDIC_SQUIGGLE 1 #define INDIC_TT 2 @@ -432,6 +463,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_AUTOCGETAUTOHIDE 2119 #define SC_AUTOCOMPLETE_NORMAL 0 #define SC_AUTOCOMPLETE_FIXED_SIZE 1 +#define SC_AUTOCOMPLETE_SELECT_FIRST_ITEM 2 #define SCI_AUTOCSETOPTIONS 2638 #define SCI_AUTOCGETOPTIONS 2639 #define SCI_AUTOCSETDROPRESTOFWORD 2270 @@ -444,6 +476,10 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_AUTOCGETMAXWIDTH 2209 #define SCI_AUTOCSETMAXHEIGHT 2210 #define SCI_AUTOCGETMAXHEIGHT 2211 +#define SCI_AUTOCSETSTYLE 2109 +#define SCI_AUTOCGETSTYLE 2120 +#define SCI_AUTOCSETIMAGESCALE 2815 +#define SCI_AUTOCGETIMAGESCALE 2816 #define SCI_SETINDENT 2122 #define SCI_GETINDENT 2123 #define SCI_SETUSETABS 2124 @@ -491,14 +527,12 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCFIND_REGEXP 0x00200000 #define SCFIND_POSIX 0x00400000 #define SCFIND_CXX11REGEX 0x00800000 - -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL,SCI_GETSTYLEDTEXTFULL and SCI_FORMATRANGEFULL and corresponding defines/structs //#define SCI_FINDTEXT 2150 #define SCI_FINDTEXTFULL 2196 - -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL,SCI_GETSTYLEDTEXTFULL and SCI_FORMATRANGEFULL and corresponding defines/structs //#define SCI_FORMATRANGE 2151 #define SCI_FORMATRANGEFULL 2777 #define SC_CHANGE_HISTORY_DISABLED 0 @@ -507,6 +541,13 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_CHANGE_HISTORY_INDICATORS 4 #define SCI_SETCHANGEHISTORY 2780 #define SCI_GETCHANGEHISTORY 2781 +#define SC_UNDO_SELECTION_HISTORY_DISABLED 0 +#define SC_UNDO_SELECTION_HISTORY_ENABLED 1 +#define SC_UNDO_SELECTION_HISTORY_SCROLL 2 +#define SCI_SETUNDOSELECTIONHISTORY 2782 +#define SCI_GETUNDOSELECTIONHISTORY 2783 +#define SCI_SETSELECTIONSERIALIZED 2784 +#define SCI_GETSELECTIONSERIALIZED 2785 #define SCI_GETFIRSTVISIBLELINE 2152 #define SCI_GETLINE 2153 #define SCI_GETLINECOUNT 2154 @@ -518,9 +559,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_GETMODIFY 2159 #define SCI_SETSEL 2160 #define SCI_GETSELTEXT 2161 - -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL,SCI_GETSTYLEDTEXTFULL and SCI_FORMATRANGEFULL and corresponding defines/structs //#define SCI_GETTEXTRANGE 2162 #define SCI_GETTEXTRANGEFULL 2039 #define SCI_HIDESELECTION 2163 @@ -530,6 +570,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_LINEFROMPOSITION 2166 #define SCI_POSITIONFROMLINE 2167 #define SCI_LINESCROLL 2168 +#define SCI_SCROLLVERTICAL 2817 #define SCI_SCROLLCARET 2169 #define SCI_SCROLLRANGE 2569 #define SCI_REPLACESEL 2170 @@ -745,7 +786,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_CANCEL 2325 #define SCI_DELETEBACK 2326 #define SCI_TAB 2327 +#define SCI_LINEINDENT 2813 #define SCI_BACKTAB 2328 +#define SCI_LINEDEDENT 2814 #define SCI_NEWLINE 2329 #define SCI_FORMFEED 2330 #define SCI_VCHOME 2331 @@ -969,6 +1012,9 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SCI_SETLAYOUTTHREADS 2775 #define SCI_GETLAYOUTTHREADS 2776 #define SCI_COPYALLOWLINE 2519 +#define SCI_CUTALLOWLINE 2810 +#define SCI_SETCOPYSEPARATOR 2811 +#define SCI_GETCOPYSEPARATOR 2812 #define SCI_GETCHARACTERPOINTER 2520 #define SCI_GETRANGEPOINTER 2643 #define SCI_GETGAPPOSITION 2644 @@ -1094,6 +1140,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP #define SC_TECHNOLOGY_DIRECTWRITE 1 #define SC_TECHNOLOGY_DIRECTWRITERETAIN 2 #define SC_TECHNOLOGY_DIRECTWRITEDC 3 +#define SC_TECHNOLOGY_DIRECT_WRITE_1 4 #define SCI_SETTECHNOLOGY 2630 #define SCI_GETTECHNOLOGY 2631 #define SCI_CREATELOADER 2632 @@ -1309,43 +1356,37 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. * So older code that treats Scintilla as a RichEdit will work. */ -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs -/* -struct Sci_CharacterRange { - Sci_PositionCR cpMin; - Sci_PositionCR cpMax; -}; -*/ +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//struct Sci_CharacterRange { +// Sci_PositionCR cpMin; +// Sci_PositionCR cpMax; +//}; struct Sci_CharacterRangeFull { Sci_Position cpMin; Sci_Position cpMax; }; -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs -/* -struct Sci_TextRange { - struct Sci_CharacterRange chrg; - char *lpstrText; -}; -*/ +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//struct Sci_TextRange { +// struct Sci_CharacterRange chrg; +// char *lpstrText; +//}; struct Sci_TextRangeFull { struct Sci_CharacterRangeFull chrg; char *lpstrText; }; -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs -/* -struct Sci_TextToFind { - struct Sci_CharacterRange chrg; - const char *lpstrText; - struct Sci_CharacterRange chrgText; -}; -*/ +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//struct Sci_TextToFind { +// struct Sci_CharacterRange chrg; +// const char *lpstrText; +// struct Sci_CharacterRange chrgText; +//}; struct Sci_TextToFindFull { struct Sci_CharacterRangeFull chrg; @@ -1365,17 +1406,15 @@ struct Sci_Rectangle { /* This structure is used in printing and requires some of the graphics types * from Platform.h. Not needed by most client code. */ -// Deprecated by Notepad++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html) -// Please use Sci_Position, SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs -/* -struct Sci_RangeToFormat { - Sci_SurfaceID hdc; - Sci_SurfaceID hdcTarget; - struct Sci_Rectangle rc; - struct Sci_Rectangle rcPage; - struct Sci_CharacterRange chrg; -}; -*/ +//deprecated by N++ 2GB+ support via new scintilla interfaces from 5.2.3 (see https://www.scintilla.org/ScintillaHistory.html), +//please use SCI_GETTEXTRANGEFULL, SCI_FINDTEXTFULL, and SCI_FORMATRANGEFULL and corresponding defines/structs +//struct Sci_RangeToFormat { +// Sci_SurfaceID hdc; +// Sci_SurfaceID hdcTarget; +// struct Sci_Rectangle rc; +// struct Sci_Rectangle rcPage; +// struct Sci_CharacterRange chrg; +//}; struct Sci_RangeToFormatFull { Sci_SurfaceID hdc; @@ -1387,7 +1426,7 @@ struct Sci_RangeToFormatFull { #ifndef __cplusplus /* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This - * is not required in C++ code and actually seems to break ScintillaEditPy */ + * is not required in C++ code and has caused problems in the past. */ typedef struct Sci_NotifyHeader Sci_NotifyHeader; typedef struct SCNotification SCNotification; #endif @@ -1405,10 +1444,12 @@ struct SCNotification { Sci_NotifyHeader nmhdr; Sci_Position position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ - /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ + /* SCN_MARGINRIGHTCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, */ + /* SCN_CALLTIPCLICK, */ /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ - /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ + /* SCN_USERLISTSELECTION, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ + /* SCN_AUTOCSELECTIONCHANGE */ int ch; /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ @@ -1416,10 +1457,12 @@ struct SCNotification { int modifiers; /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ + /* SCN_MARGINCLICK, SCN_MARGINRIGHTCLICK */ int modificationType; /* SCN_MODIFIED */ const char *text; - /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ + /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_URIDROPPED, */ + /* SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, SCN_AUTOCSELECTIONCHANGE */ Sci_Position length; /* SCN_MODIFIED */ Sci_Position linesAdded; /* SCN_MODIFIED */ @@ -1429,15 +1472,15 @@ struct SCNotification { Sci_Position line; /* SCN_MODIFIED */ int foldLevelNow; /* SCN_MODIFIED */ int foldLevelPrev; /* SCN_MODIFIED */ - int margin; /* SCN_MARGINCLICK */ - int listType; /* SCN_USERLISTSELECTION */ + int margin; /* SCN_MARGINCLICK, SCN_MARGINRIGHTCLICK */ + int listType; /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTIONCHANGE */ int x; /* SCN_DWELLSTART, SCN_DWELLEND */ int y; /* SCN_DWELLSTART, SCN_DWELLEND */ int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ int updated; /* SCN_UPDATEUI */ int listCompletionMethod; - /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ + /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION */ int characterSource; /* SCN_CHARADDED */ }; diff --git a/source/menuCmdID.h b/source/menuCmdID.h index 58a2a39..7c21dde 100644 --- a/source/menuCmdID.h +++ b/source/menuCmdID.h @@ -1,5 +1,5 @@ // This file is part of Notepad++ project -// Copyright (C)2024 Don HO +// Copyright (C)2025 Don HO // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -43,14 +43,15 @@ #define IDM_FILE_OPEN_FOLDER (IDM_FILE + 19) #define IDM_FILE_OPEN_CMD (IDM_FILE + 20) #define IDM_FILE_RESTORELASTCLOSEDFILE (IDM_FILE + 21) - #define IDM_FILE_OPENFOLDERASWORSPACE (IDM_FILE + 22) + #define IDM_FILE_OPENFOLDERASWORKSPACE (IDM_FILE + 22) #define IDM_FILE_OPEN_DEFAULT_VIEWER (IDM_FILE + 23) #define IDM_FILE_CLOSEALL_UNCHANGED (IDM_FILE + 24) #define IDM_FILE_CONTAININGFOLDERASWORKSPACE (IDM_FILE + 25) + #define IDM_FILE_CLOSEALL_BUT_PINNED (IDM_FILE + 26) // IMPORTANT: If list above is modified, you have to change the following values: // To be updated if new menu item(s) is (are) added in menu "File" - #define IDM_FILEMENU_LASTONE IDM_FILE_CONTAININGFOLDERASWORKSPACE + #define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_BUT_PINNED // 0 based position of command "Exit" including the bars in the file menu // and without counting "Recent files history" items @@ -109,12 +110,12 @@ #define IDM_MACRO_SAVECURRENTMACRO (IDM_EDIT + 25) #define IDM_EDIT_RTL (IDM_EDIT + 26) #define IDM_EDIT_LTR (IDM_EDIT + 27) - #define IDM_EDIT_SETREADONLY (IDM_EDIT + 28) + #define IDM_EDIT_TOGGLEREADONLY (IDM_EDIT + 28) #define IDM_EDIT_FULLPATHTOCLIP (IDM_EDIT + 29) #define IDM_EDIT_FILENAMETOCLIP (IDM_EDIT + 30) #define IDM_EDIT_CURRENTDIRTOCLIP (IDM_EDIT + 31) #define IDM_MACRO_RUNMULTIMACRODLG (IDM_EDIT + 32) - #define IDM_EDIT_CLEARREADONLY (IDM_EDIT + 33) + #define IDM_EDIT_TOGGLESYSTEMREADONLY (IDM_EDIT + 33) #define IDM_EDIT_COLUMNMODE (IDM_EDIT + 34) #define IDM_EDIT_BLOCK_COMMENT_SET (IDM_EDIT + 35) #define IDM_EDIT_BLOCK_UNCOMMENT (IDM_EDIT + 36) @@ -181,6 +182,8 @@ #define IDM_EDIT_MULTISELECTNEXTMATCHCASEWHOLEWORD (IDM_EDIT + 97) #define IDM_EDIT_MULTISELECTUNDO (IDM_EDIT + 98) #define IDM_EDIT_MULTISELECTSSKIP (IDM_EDIT + 99) + #define IDM_EDIT_SORTLINES_LOCALE_ASCENDING (IDM_EDIT + 100) + #define IDM_EDIT_SORTLINES_LOCALE_DESCENDING (IDM_EDIT + 101) #define IDM_EDIT_AUTOCOMPLETE (50000 + 0) #define IDM_EDIT_AUTOCOMPLETE_CURRENTFILE (50000 + 1) @@ -274,33 +277,33 @@ #define IDM_VIEW (IDM + 4000) //#define IDM_VIEW_TOOLBAR_HIDE (IDM_VIEW + 1) - #define IDM_VIEW_TOOLBAR_REDUCE (IDM_VIEW + 2) - #define IDM_VIEW_TOOLBAR_ENLARGE (IDM_VIEW + 3) - #define IDM_VIEW_TOOLBAR_STANDARD (IDM_VIEW + 4) - #define IDM_VIEW_REDUCETABBAR (IDM_VIEW + 5) - #define IDM_VIEW_LOCKTABBAR (IDM_VIEW + 6) - #define IDM_VIEW_DRAWTABBAR_TOPBAR (IDM_VIEW + 7) - #define IDM_VIEW_DRAWTABBAR_INACIVETAB (IDM_VIEW + 8) + //#define IDM_VIEW_TOOLBAR_REDUCE (IDM_VIEW + 2) + //#define IDM_VIEW_TOOLBAR_ENLARGE (IDM_VIEW + 3) + //#define IDM_VIEW_TOOLBAR_STANDARD (IDM_VIEW + 4) + //#define IDM_VIEW_REDUCETABBAR (IDM_VIEW + 5) + //#define IDM_VIEW_LOCKTABBAR (IDM_VIEW + 6) + //#define IDM_VIEW_DRAWTABBAR_TOPBAR (IDM_VIEW + 7) + //#define IDM_VIEW_DRAWTABBAR_INACTIVETAB (IDM_VIEW + 8) #define IDM_VIEW_POSTIT (IDM_VIEW + 9) #define IDM_VIEW_FOLDALL (IDM_VIEW + 10) #define IDM_VIEW_DISTRACTIONFREE (IDM_VIEW + 11) - #define IDM_VIEW_LINENUMBER (IDM_VIEW + 12) - #define IDM_VIEW_SYMBOLMARGIN (IDM_VIEW + 13) - #define IDM_VIEW_FOLDERMAGIN (IDM_VIEW + 14) - #define IDM_VIEW_FOLDERMAGIN_SIMPLE (IDM_VIEW + 15) - #define IDM_VIEW_FOLDERMAGIN_ARROW (IDM_VIEW + 16) - #define IDM_VIEW_FOLDERMAGIN_CIRCLE (IDM_VIEW + 17) - #define IDM_VIEW_FOLDERMAGIN_BOX (IDM_VIEW + 18) + //#define IDM_VIEW_LINENUMBER (IDM_VIEW + 12) + //#define IDM_VIEW_SYMBOLMARGIN (IDM_VIEW + 13) + //#define IDM_VIEW_FOLDERMARGIN (IDM_VIEW + 14) + //#define IDM_VIEW_FOLDERMARGIN_SIMPLE (IDM_VIEW + 15) + //#define IDM_VIEW_FOLDERMARGIN_ARROW (IDM_VIEW + 16) + //#define IDM_VIEW_FOLDERMARGIN_CIRCLE (IDM_VIEW + 17) + //#define IDM_VIEW_FOLDERMARGIN_BOX (IDM_VIEW + 18) #define IDM_VIEW_ALL_CHARACTERS (IDM_VIEW + 19) #define IDM_VIEW_INDENT_GUIDE (IDM_VIEW + 20) - #define IDM_VIEW_CURLINE_HILITING (IDM_VIEW + 21) + //#define IDM_VIEW_CURLINE_HILITING (IDM_VIEW + 21) #define IDM_VIEW_WRAP (IDM_VIEW + 22) #define IDM_VIEW_ZOOMIN (IDM_VIEW + 23) #define IDM_VIEW_ZOOMOUT (IDM_VIEW + 24) #define IDM_VIEW_TAB_SPACE (IDM_VIEW + 25) #define IDM_VIEW_EOL (IDM_VIEW + 26) - #define IDM_VIEW_TOOLBAR_REDUCE_SET2 (IDM_VIEW + 27) - #define IDM_VIEW_TOOLBAR_ENLARGE_SET2 (IDM_VIEW + 28) + //#define IDM_VIEW_TOOLBAR_REDUCE_SET2 (IDM_VIEW + 27) + //#define IDM_VIEW_TOOLBAR_ENLARGE_SET2 (IDM_VIEW + 28) #define IDM_VIEW_UNFOLDALL (IDM_VIEW + 29) #define IDM_VIEW_FOLD_CURRENT (IDM_VIEW + 30) #define IDM_VIEW_UNFOLD_CURRENT (IDM_VIEW + 31) @@ -310,17 +313,17 @@ #define IDM_VIEW_SYNSCROLLV (IDM_VIEW + 35) #define IDM_VIEW_SYNSCROLLH (IDM_VIEW + 36) //#define IDM_VIEW_EDGENONE (IDM_VIEW + 37) - #define IDM_VIEW_DRAWTABBAR_CLOSEBOTTUN (IDM_VIEW + 38) - #define IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE (IDM_VIEW + 39) - #define IDM_VIEW_REFRESHTABAR (IDM_VIEW + 40) + //#define IDM_VIEW_DRAWTABBAR_CLOSEBOTTUN (IDM_VIEW + 38) + //#define IDM_VIEW_DRAWTABBAR_DBCLK2CLOSE (IDM_VIEW + 39) + //#define IDM_VIEW_REFRESHTABAR (IDM_VIEW + 40) #define IDM_VIEW_WRAP_SYMBOL (IDM_VIEW + 41) #define IDM_VIEW_HIDELINES (IDM_VIEW + 42) - #define IDM_VIEW_DRAWTABBAR_VERTICAL (IDM_VIEW + 43) - #define IDM_VIEW_DRAWTABBAR_MULTILINE (IDM_VIEW + 44) + //#define IDM_VIEW_DRAWTABBAR_VERTICAL (IDM_VIEW + 43) + //#define IDM_VIEW_DRAWTABBAR_MULTILINE (IDM_VIEW + 44) //#define IDM_VIEW_DOCCHANGEMARGIN (IDM_VIEW + 45) - #define IDM_VIEW_LWDEF (IDM_VIEW + 46) - #define IDM_VIEW_LWALIGN (IDM_VIEW + 47) - #define IDM_VIEW_LWINDENT (IDM_VIEW + 48) + //#define IDM_VIEW_LWDEF (IDM_VIEW + 46) + //#define IDM_VIEW_LWALIGN (IDM_VIEW + 47) + #define IDM_PINTAB (IDM_VIEW + 48) #define IDM_VIEW_SUMMARY (IDM_VIEW + 49) #define IDM_VIEW_FOLD (IDM_VIEW + 50) @@ -468,7 +471,6 @@ #define IDM_FORMAT_KOI8R_CYRILLIC (IDM_FORMAT_ENCODE + 48) #define IDM_FORMAT_ENCODE_END IDM_FORMAT_KOI8R_CYRILLIC - //#define IDM_FORMAT_CONVERT 200 #define IDM_LANG (IDM + 6000) #define IDM_LANGSTYLE_CONFIG_DLG (IDM_LANG + 1) @@ -559,12 +561,17 @@ #define IDM_LANG_MSSQL (IDM_LANG + 86) #define IDM_LANG_GDSCRIPT (IDM_LANG + 87) #define IDM_LANG_HOLLYWOOD (IDM_LANG + 88) - + #define IDM_LANG_GOLANG (IDM_LANG + 89) + #define IDM_LANG_RAKU (IDM_LANG + 90) + #define IDM_LANG_TOML (IDM_LANG + 91) + #define IDM_LANG_SAS (IDM_LANG + 92) + #define IDM_LANG_ERRORLIST (IDM_LANG + 93) + #define IDM_LANG_EXTERNAL (IDM_LANG + 165) #define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 179) #define IDM_LANG_USER (IDM_LANG + 180) //46180: Used for translation - #define IDM_LANG_USER_LIMIT (IDM_LANG + 210) //46210: Ajust with IDM_LANG_USER + #define IDM_LANG_USER_LIMIT (IDM_LANG + 210) //46210: Adjust with IDM_LANG_USER #define IDM_LANG_USER_DLG (IDM_LANG + 250) //46250: Used for translation #define IDM_LANG_OPENUDLDIR (IDM_LANG + 300) #define IDM_LANG_UDLCOLLECTION_PROJECT_SITE (IDM_LANG + 301) @@ -578,7 +585,7 @@ #define IDM_FORUM (IDM_ABOUT + 4) //#define IDM_PLUGINSHOME (IDM_ABOUT + 5) #define IDM_UPDATE_NPP (IDM_ABOUT + 6) - #define IDM_WIKIFAQ (IDM_ABOUT + 7) + //#define IDM_WIKIFAQ (IDM_ABOUT + 7) //#define IDM_HELP (IDM_ABOUT + 8) #define IDM_CONFUPDATERPROXY (IDM_ABOUT + 9) #define IDM_CMDLINEARGUMENTS (IDM_ABOUT + 10) @@ -588,11 +595,11 @@ #define IDM_SETTING (IDM + 8000) // #define IDM_SETTING_TAB_SIZE (IDM_SETTING + 1) -// #define IDM_SETTING_TAB_REPLCESPACE (IDM_SETTING + 2) +// #define IDM_SETTING_TAB_REPLACESPACE (IDM_SETTING + 2) // #define IDM_SETTING_HISTORY_SIZE (IDM_SETTING + 3) // #define IDM_SETTING_EDGE_SIZE (IDM_SETTING + 4) #define IDM_SETTING_IMPORTPLUGIN (IDM_SETTING + 5) - #define IDM_SETTING_IMPORTSTYLETHEMS (IDM_SETTING + 6) + #define IDM_SETTING_IMPORTSTYLETHEMES (IDM_SETTING + 6) #define IDM_SETTING_TRAYICON (IDM_SETTING + 8) #define IDM_SETTING_SHORTCUT_MAPPER (IDM_SETTING + 9) #define IDM_SETTING_REMEMBER_LAST_SESSION (IDM_SETTING + 10) @@ -636,6 +643,8 @@ #define IDM_WINDOW_SORT_FT_DSC (IDR_WINDOWS_MENU + 7) #define IDM_WINDOW_SORT_FS_ASC (IDR_WINDOWS_MENU + 8) #define IDM_WINDOW_SORT_FS_DSC (IDR_WINDOWS_MENU + 9) + #define IDM_WINDOW_SORT_FD_ASC (IDR_WINDOWS_MENU + 10) + #define IDM_WINDOW_SORT_FD_DSC (IDR_WINDOWS_MENU + 11) #define IDM_WINDOW_MRU_FIRST (IDR_WINDOWS_MENU + 20) #define IDM_WINDOW_MRU_LIMIT (IDR_WINDOWS_MENU + 59) #define IDM_WINDOW_COPY_NAME (IDM_WINDOW_MRU_LIMIT + 1) diff --git a/vs.proj/NppPluginConverter.vcxproj b/vs.proj/NppPluginConverter.vcxproj index b605f1f..f8de603 100644 --- a/vs.proj/NppPluginConverter.vcxproj +++ b/vs.proj/NppPluginConverter.vcxproj @@ -97,24 +97,33 @@ true + $(Configuration)\ + $(Platform)\$(Configuration)\ true + x64\$(Configuration)\ + $(Platform)\$(Configuration)\ true + x64\$(Configuration)\ + $(Platform)\$(Configuration)\ false ..\bin\ + $(Platform)\$(Configuration)\ false ..\bin64\ + $(Platform)\$(Configuration)\ false ..\arm64\ + $(Platform)\$(Configuration)\