Skip to content

Commit 96d8a58

Browse files
committed
- update to N++ 8.8.5
- added getSettingsDirPath()
1 parent 8a55b66 commit 96d8a58

File tree

6 files changed

+100
-10
lines changed

6 files changed

+100
-10
lines changed

NppPlugin/include/Common.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <string>
2020
#include <sstream>
2121
#include <windows.h>
22+
#include <commctrl.h>
2223
#include <iso646.h>
2324
#include <cstdint>
2425
#include <unordered_set>
@@ -168,6 +169,7 @@ std::wstring stringTakeWhileAdmissable(const std::wstring& input, const std::wst
168169
double stodLocale(const std::wstring& str, _locale_t loc, size_t* idx = NULL);
169170

170171
bool str2Clipboard(const std::wstring &str2cpy, HWND hwnd);
172+
std::wstring strFromClipboard();
171173
class Buffer;
172174
bool buf2Clipboard(const std::vector<Buffer*>& buffers, bool isFullPath, HWND hwnd);
173175

@@ -296,3 +298,45 @@ bool doesPathExist(const wchar_t* path, DWORD milliSec2wait = 0, bool* isTimeout
296298
bool isWindowVisibleOnAnyMonitor(const RECT& rectWndIn);
297299

298300
bool isCoreWindows();
301+
302+
303+
#define IDT_HIDE_TOOLTIP 1001
304+
305+
class ControlInfoTip final
306+
{
307+
public:
308+
ControlInfoTip() {};
309+
~ControlInfoTip() {
310+
if (_hWndInfoTip) {
311+
hide();
312+
}
313+
};
314+
bool init(HINSTANCE hInst, HWND ctrl2attached, HWND ctrl2attachedParent, const std::wstring& tipStr, bool isRTL, unsigned int remainTimeMillisecond = 0, int maxWidth = 200); // remainTimeMillisecond = 0: no timeout
315+
316+
bool isValid() const {
317+
return _hWndInfoTip != nullptr;
318+
};
319+
320+
HWND getTipHandle() const {
321+
return _hWndInfoTip;
322+
};
323+
324+
enum showPosition {beginning, middle, end};
325+
void show(showPosition pos = middle) const;
326+
327+
void hide();
328+
329+
private:
330+
HWND _hWndInfoTip = nullptr;
331+
TOOLINFO _toolInfo = {};
332+
333+
ControlInfoTip(const ControlInfoTip&) = delete;
334+
ControlInfoTip& operator=(const ControlInfoTip&) = delete;
335+
};
336+
337+
338+
#define NPP_UAC_SAVE_SIGN L"#UAC-SAVE#"
339+
#define NPP_UAC_SETFILEATTRIBUTES_SIGN L"#UAC-SETFILEATTRIBUTES#"
340+
#define NPP_UAC_MOVEFILE_SIGN L"#UAC-MOVEFILE#"
341+
#define NPP_UAC_CREATEEMPTYFILE_SIGN L"#UAC-CREATEEMPTYFILE#"
342+
DWORD invokeNppUacOp(std::wstring& strCmdLineParams);

NppPlugin/include/Notepad_plus_msgs.h

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is part of Notepad++ project
2-
// Copyright (C)2024 Don HO <[email protected]>
2+
// Copyright (C)2025 Don HO <[email protected]>
33

44
// This program is free software: you can redistribute it and/or modify
55
// it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
2626

2727
enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
2828
L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER,\
29-
L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA, \
29+
L_ASP, L_SQL, L_VB, L_JS_EMBEDDED, L_CSS, L_PERL, L_PYTHON, L_LUA, \
3030
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
3131
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
3232
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
@@ -39,7 +39,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
3939
L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\
4040
L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD,\
4141
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, \
42-
// Don't use L_JS, use L_JAVASCRIPT instead
42+
// Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead
4343
// The end of enumerated language type, so it should be always at the end
4444
L_EXTERNAL};
4545
enum class ExternalLexerAutoIndentMode { Standard, C_Like, Custom };
@@ -1025,7 +1025,20 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
10251025
// Return toolbar icon set choice as an integer value. Here are 5 possible values:
10261026
// 0 (Fluent UI: small), 1 (Fluent UI: large), 2 (Filled Fluent UI: small), 3 (Filled Fluent UI: large) and 4 (Standard icons: small).
10271027

1028-
// For RUNCOMMAND_USER
1028+
#define NPPM_GETNPPSETTINGSDIRPATH (NPPMSG + 119)
1029+
// int NPPM_GETNPPSETTINGSDIRPATH(size_t strLen, wchar_t *settingsDirPath)
1030+
// 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;
1031+
// if not, it will use the AppData settings directory, or finally the installation path. This allows plugins to have one interface to find out
1032+
// where the active Notepad++ settings are stored, whichever location they are currently set to.
1033+
// wParam[in]: strLen - size of allocated buffer "settingsDirPath"
1034+
// 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),
1035+
// allocate settingsDirPath buffer with the return value + 1, then call it again to get the path.
1036+
// 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.
1037+
//
1038+
// Note: This message is for the active Notepad++ configuration location. If you are looking for the settings directory for plugins (...\Plugins\Config\),
1039+
// use NPPM_GETPLUGINSCONFIGDIR instead.
1040+
1041+
// For RUNCOMMAND_USER
10291042
#define VAR_NOT_RECOGNIZED 0
10301043
#define FULL_CURRENT_PATH 1
10311044
#define CURRENT_DIRECTORY 2
@@ -1224,10 +1237,28 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
12241237
//scnNotification->nmhdr.hwndFrom = hwndNpp;
12251238
//scnNotification->nmhdr.idFrom = 0;
12261239

1227-
#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
1240+
#define NPPN_CMDLINEPLUGINMSG (NPPN_FIRST + 28) // To notify plugins that there are plugin arguments pluginMessage (wchar_t*) is available
12281241
//scnNotification->nmhdr.code = NPPN_CMDLINEPLUGINMSG;
12291242
//scnNotification->nmhdr.hwndFrom = hwndNpp;
12301243
//scnNotification->nmhdr.idFrom = pluginMessage; //where pluginMessage is pointer of type wchar_t
1244+
//
1245+
// User can pass arguments to plugins via command line argument using:
1246+
// -pluginMessage="PLUGIN1_ARG1=V1;PLUGIN1_ARG2=V2;PLUGIN2_ARG=V;..."
1247+
//
1248+
// 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.
1249+
//
1250+
// To avoid the collisions among plugins, the following protocol should be followed:
1251+
// 1. Each plugin must use its unique namespace (its folder name in plugins directory) as a prefix for its argument names.
1252+
// 2. The symbol ';' must be used as the delimiter between arguments when there are 2 or more arguments in the pluginMessage string.
1253+
// 3. The symbol '=' must be used as delimiter between argument names and their values.
1254+
//
1255+
// Example (via the command line):
1256+
// -pluginMessage="NppExecScriptPath=C:\Program Files\Notepad++\plugins\NppExec\init.py;NppExecArg2=arg2Value;mimeToolsSettings=disable;pluginYInfo=show"
1257+
//
1258+
// Interpretation:
1259+
// - Plugin "NppExec" processes: NppExecScriptPath=C:\Program Files\Notepad++\plugins\NppExec\init.py & NppExecArg2=arg2Value
1260+
// - Plugin "mimeTools" processes: mimeToolsSettings=disable
1261+
// - Plugin "pluginY" processes: pluginYInfo=show
12311262

12321263
#define NPPN_EXTERNALLEXERBUFFER (NPPN_FIRST + 29) // To notify lexer plugins that the buffer (in idFrom) is just applied to a external lexer
12331264
//scnNotification->nmhdr.code = NPPN_EXTERNALLEXERBUFFER;

NppPlugin/include/menuCmdID.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,10 @@
594594

595595

596596
#define IDM_SETTING (IDM + 8000)
597-
// #define IDM_SETTING_TAB_SIZE (IDM_SETTING + 1)
598-
// #define IDM_SETTING_TAB_REPLACESPACE (IDM_SETTING + 2)
599-
// #define IDM_SETTING_HISTORY_SIZE (IDM_SETTING + 3)
600-
// #define IDM_SETTING_EDGE_SIZE (IDM_SETTING + 4)
597+
// #define IDM_SETTING_TAB_SIZE (IDM_SETTING + 1)
598+
// #define IDM_SETTING_TAB_REPLACESPACE (IDM_SETTING + 2)
599+
// #define IDM_SETTING_HISTORY_SIZE (IDM_SETTING + 3)
600+
// #define IDM_SETTING_EDGE_SIZE (IDM_SETTING + 4)
601601
#define IDM_SETTING_IMPORTPLUGIN (IDM_SETTING + 5)
602602
#define IDM_SETTING_IMPORTSTYLETHEMES (IDM_SETTING + 6)
603603
#define IDM_SETTING_TRAYICON (IDM_SETTING + 8)
@@ -643,6 +643,8 @@
643643
#define IDM_WINDOW_SORT_FT_DSC (IDR_WINDOWS_MENU + 7)
644644
#define IDM_WINDOW_SORT_FS_ASC (IDR_WINDOWS_MENU + 8)
645645
#define IDM_WINDOW_SORT_FS_DSC (IDR_WINDOWS_MENU + 9)
646+
#define IDM_WINDOW_SORT_FD_ASC (IDR_WINDOWS_MENU + 10)
647+
#define IDM_WINDOW_SORT_FD_DSC (IDR_WINDOWS_MENU + 11)
646648
#define IDM_WINDOW_MRU_FIRST (IDR_WINDOWS_MENU + 20)
647649
#define IDM_WINDOW_MRU_LIMIT (IDR_WINDOWS_MENU + 59)
648650
#define IDM_WINDOW_COPY_NAME (IDM_WINDOW_MRU_LIMIT + 1)

PythonScript/src/NotepadPlusWrapper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,13 @@ boost::python::str NotepadPlusWrapper::getSettingsOnCloudPath()
486486
return boost::python::str(const_cast<const char *>(WcharMbcsConverter::tchar2char(result).get()));
487487
}
488488

489+
boost::python::str NotepadPlusWrapper::getSettingsDirPath()
490+
{
491+
LRESULT size = callNotepad(NPPM_GETNPPSETTINGSDIRPATH, 0, NULL);
492+
wchar_t* result(new wchar_t[size + 1]);
493+
callNotepad(NPPM_GETNPPSETTINGSDIRPATH, size + 1, reinterpret_cast<LPARAM>(result));
494+
return boost::python::str(const_cast<const char*>(WcharMbcsConverter::tchar2char(result).get()));
495+
}
489496

490497
intptr_t NotepadPlusWrapper::getBookMarkID()
491498
{

PythonScript/src/NotepadPlusWrapper.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,8 @@ enum MenuCommands
636636
NPPIDM_WINDOW_SORT_FT_DSC = IDM_WINDOW_SORT_FT_DSC,
637637
NPPIDM_WINDOW_SORT_FS_ASC = IDM_WINDOW_SORT_FS_ASC,
638638
NPPIDM_WINDOW_SORT_FS_DSC = IDM_WINDOW_SORT_FS_DSC,
639+
NPPIDM_WINDOW_SORT_FD_ASC = IDM_WINDOW_SORT_FD_ASC,
640+
NPPIDM_WINDOW_SORT_FD_DSC = IDM_WINDOW_SORT_FD_DSC,
639641
NPPIDM_WINDOW_MRU_FIRST = IDM_WINDOW_MRU_FIRST,
640642
NPPIDM_WINDOW_MRU_LIMIT = IDM_WINDOW_MRU_LIMIT,
641643
NPPIDM_WINDOW_COPY_NAME = IDM_WINDOW_COPY_NAME,
@@ -719,6 +721,8 @@ class NotepadPlusWrapper
719721

720722
boost::python::str getSettingsOnCloudPath();
721723

724+
boost::python::str getSettingsDirPath();
725+
722726
intptr_t getBookMarkID();
723727

724728
void menuCommand(int commandID);

PythonScript/src/NotepadPython.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ void export_notepad()
159159
.value("ASP", L_ASP)
160160
.value("SQL", L_SQL)
161161
.value("VB", L_VB)
162-
.value("JS", L_JS)
162+
.value("JS", L_JS_EMBEDDED)
163163
.value("CSS", L_CSS)
164164
.value("PERL", L_PERL)
165165
.value("PYTHON", L_PYTHON)
@@ -861,6 +861,8 @@ void export_notepad()
861861
.value("WINDOW_SORT_FT_DSC", NPPIDM_WINDOW_SORT_FT_DSC)
862862
.value("WINDOW_SORT_FS_ASC", NPPIDM_WINDOW_SORT_FS_ASC)
863863
.value("WINDOW_SORT_FS_DSC", NPPIDM_WINDOW_SORT_FS_DSC)
864+
.value("WINDOW_SORT_FD_ASC", NPPIDM_WINDOW_SORT_FD_ASC)
865+
.value("WINDOW_SORT_FD_DSC", NPPIDM_WINDOW_SORT_FD_DSC)
864866
.value("WINDOW_MRU_FIRST", NPPIDM_WINDOW_MRU_FIRST)
865867
.value("WINDOW_MRU_LIMIT", NPPIDM_WINDOW_MRU_LIMIT)
866868
.value("WINDOW_COPY_NAME", NPPIDM_WINDOW_COPY_NAME)

0 commit comments

Comments
 (0)