Skip to content

Commit 95b1cc8

Browse files
committed
update to N++ 8.9.8 interfaces
1 parent 9a683b8 commit 95b1cc8

26 files changed

Lines changed: 261 additions & 42 deletions

NppPlugin/include/Common.h

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,13 @@
2020
#include <windows.h>
2121

2222
#include <commctrl.h>
23-
#include <tchar.h>
2423

2524
#include <algorithm>
2625
#include <locale>
27-
#include <sstream>
2826
#include <string>
2927
#include <unordered_set>
3028
#include <vector>
3129

32-
#if defined(_MSC_VER)
33-
#pragma deprecated(PathFileExists) // Use doesFileExist, doesDirectoryExist or doesPathExist (for file or directory) instead.
34-
#pragma deprecated(PathIsDirectory) // Use doesDirectoryExist instead.
35-
#endif
36-
37-
3830

3931
std::wstring folderBrowser(HWND parent, const std::wstring & title = L"", int outputCtrlID = 0, const wchar_t *defaultStr = NULL);
4032
std::wstring getFolderName(HWND parent, const wchar_t *defaultDir = NULL);
@@ -63,6 +55,7 @@ void writeFileContent(const wchar_t *file2write, const char *content2write);
6355
bool matchInList(const wchar_t *fileName, const std::vector<std::wstring> & patterns);
6456
bool matchInExcludeDirList(const wchar_t* dirName, const std::vector<std::wstring>& patterns, size_t level);
6557
bool allPatternsAreExclusion(const std::vector<std::wstring>& patterns);
58+
HRESULT openInExplorerAndSelect(const wchar_t* path);
6659

6760
class WcharMbcsConvertor final
6861
{
@@ -162,8 +155,8 @@ std::wstring GetLastErrorAsString(DWORD errorCode = 0);
162155
std::wstring intToString(int val);
163156
std::wstring uintToString(unsigned int val);
164157

165-
HWND CreateToolTip(int toolID, HWND hDlg, HINSTANCE hInst, const PWSTR pszText, bool isRTL);
166-
HWND CreateToolTipRect(int toolID, HWND hWnd, HINSTANCE hInst, const PWSTR pszText, const RECT rc);
158+
HWND createToolTip(int toolID, HWND hDlg, HINSTANCE hInst, wchar_t* pszText, bool isRTL);
159+
HWND createToolTipRect(int toolID, HWND hWnd, HINSTANCE hInst, wchar_t* pszText, const RECT rc);
167160

168161
bool isCertificateValidated(const std::wstring & fullFilePath, const std::wstring & subjectName2check);
169162
bool isAssoCommandExisting(LPCWSTR FullPathName);
@@ -212,6 +205,8 @@ bool isWin32NamespacePrefixedFileName(const std::wstring& fileName);
212205
bool isWin32NamespacePrefixedFileName(const wchar_t* szFileName);
213206
bool isUnsupportedFileName(const std::wstring& fileName);
214207
bool isUnsupportedFileName(const wchar_t* szFileName);
208+
bool isUncPath(const std::wstring& path);
209+
bool isUncFileUrl(const std::wstring& url);
215210

216211
class Version final
217212
{
@@ -353,3 +348,6 @@ class ScopedCOMInit final // never use this in DllMain
353348
ScopedCOMInit(const ScopedCOMInit&) = delete;
354349
ScopedCOMInit& operator=(const ScopedCOMInit&) = delete;
355350
};
351+
352+
353+
bool needsElevation4Access(const std::wstring& path2check, bool bWriteAccess);

NppPlugin/include/Docking.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#define DWS_DF_FLOATING 0x80000000 // default state is floating
4848

4949

50-
struct tTbData {
50+
typedef struct DockedWidgetData { // DockedWidget data (old name: tTbData)
5151
HWND hClient = nullptr; // client Window Handle
5252
const wchar_t* pszName = nullptr; // name of plugin (shown in window)
5353
int dlgID = 0; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
@@ -57,11 +57,20 @@ struct tTbData {
5757
HICON hIconTab = nullptr; // icon for tabs
5858
const wchar_t* pszAddInfo = nullptr; // for plugin to display additional information
5959

60-
// internal data, do not use !!!
61-
RECT rcFloat = {}; // floating position
62-
int iPrevCont = 0; // stores the privious container (toggling between float and dock)
63-
const wchar_t* pszModuleName = nullptr; // it's the plugin file name. It's used to identify the plugin
64-
};
60+
// internal data, do not use !!! (rcFloat, iPrevCont only)
61+
RECT rcFloat = {}; // floating position
62+
int iPrevCont = 0; // stores the privious container (toggling between float and dock)
63+
64+
// REQUIRED: must be set by the plugin, NOT internal data.
65+
// This must be the plugin's own DLL file name (e.g. L"NppPluginDemo.dll"),
66+
// including the ".dll" extension - not the panel's display title, and not an arbitrary identifier string.
67+
// Notepad++'s Docking Manager uses this file name to locate and reload the plugin's DLL, and to re-open/re-dock this panel on the next startup.
68+
// The value is persisted verbatim as the "pluginName" attribute of the <PluginDlg> element in the user's config.xml, e.g.:
69+
// <PluginDlg pluginName="NppPluginDemo.dll" id="16" curr="1" prev="-1" isVisible="yes" />
70+
// If this is left null/empty or set incorrectly, the panel will fail to restore its docked position/visibility across restarts.
71+
const wchar_t* pszModuleName = nullptr;
72+
73+
} DockedWidgetData, tTbData;
6574

6675

6776
struct tDockMgr {

NppPlugin/include/DockingDlgInterface.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class DockingDlgInterface : public StaticDialog
4444
_moduleName = ::PathFindFileName(temp);
4545
}
4646

47-
virtual void create(tTbData* data, bool isRTL = false) {
47+
virtual void create(DockedWidgetData* data, bool isRTL = false) {
4848
assert(data != nullptr);
4949
StaticDialog::create(_dlgID, isRTL);
5050
wchar_t temp[MAX_PATH];
@@ -62,7 +62,7 @@ class DockingDlgInterface : public StaticDialog
6262
data->pszAddInfo = nullptr;
6363
}
6464

65-
virtual void create(tTbData* data, std::array<int, 3> iconIDs, bool isRTL = false) {
65+
virtual void create(DockedWidgetData* data, std::array<int, 3> iconIDs, bool isRTL = false) {
6666
create(data, isRTL);
6767
_iconIDs = iconIDs;
6868
}

NppPlugin/include/Notepad_plus_msgs.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +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+
// Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead
2930
L_ASP, L_SQL, L_VB, L_JS_EMBEDDED, L_CSS, L_PERL, L_PYTHON, L_LUA, \
3031
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
3132
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
@@ -38,8 +39,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
3839
L_MMIXAL, L_NIM, L_NNCRONTAB, L_OSCRIPT, L_REBOL, \
3940
L_REGISTRY, L_RUST, L_SPICE, L_TXT2TAGS, L_VISUALPROLOG,\
4041
L_TYPESCRIPT, L_JSON5, L_MSSQL, L_GDSCRIPT, L_HOLLYWOOD,\
41-
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, \
42-
// Don't use L_JS_EMBEDDED, use L_JAVASCRIPT instead
42+
L_GOLANG, L_RAKU, L_TOML, L_SAS, L_ERRORLIST, L_ESCSEQ,\
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 };
@@ -261,10 +261,10 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
261261
// Return TRUE
262262

263263
#define NPPM_DMMREGASDCKDLG (NPPMSG + 33)
264-
// BOOL NPPM_DMMREGASDCKDLG(0, tTbData* pData)
264+
// BOOL NPPM_DMMREGASDCKDLG(0, DockedWidgetData* pData)
265265
// Pass the necessary dockingData to Notepad++ in order to make your dialog dockable.
266266
// wParam: 0 (not used)
267-
// lParam[in]: pData is the pointer of tTbData. Please check tTbData structure in "Docking.h"
267+
// lParam[in]: pData is the pointer of DockedWidgetData (old name "tTbData"). Please check DockedWidgetData structure in "Docking.h"
268268
// Minimum information which needs to be filled out are hClient, pszName, dlgID, uMask and pszModuleName.
269269
// Notice that rcFloat and iPrevCont shouldn't be filled. They are used internally.
270270
// Return TRUE
@@ -280,7 +280,7 @@ enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
280280
// BOOL WM_DMM_VIEWOTHERTAB(0, wchar_t* name)
281281
// Show the plugin dialog (switch to plugin tab) with the given name.
282282
// wParam: 0 (not used)
283-
// lParam[in]: name should be the same value as previously used to register the dialog (pszName of tTbData)
283+
// lParam[in]: name should be the same value as previously used to register the dialog (pszName of DockedWidgetData)
284284
// Return TRUE
285285

286286
#define NPPM_RELOADFILE (NPPMSG + 36)

NppPlugin/include/NppDarkMode.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ namespace NppDarkMode
149149
HBRUSH getHotEdgeBrush();
150150
HBRUSH getDisabledEdgeBrush();
151151

152+
HBRUSH getDarkerTextBrush();
153+
152154
HPEN getDarkerTextPen();
153155
HPEN getEdgePen();
154156
HPEN getHotEdgePen();
@@ -235,4 +237,7 @@ namespace NppDarkMode
235237
LRESULT onCtlColorDlgStaticText(HDC hdc, bool isTextEnabled);
236238
LRESULT onCtlColorDlgLinkText(HDC hdc, bool isTextEnabled = true);
237239
LRESULT onCtlColorListbox(WPARAM wParam, LPARAM lParam);
240+
241+
int darkMessageBoxW(HWND hWnd, LPCWSTR lpText, LPCWSTR lpCaption, UINT uType);
242+
BOOL darkChooseColorW(LPCHOOSECOLORW cc);
238243
}

NppPlugin/include/SciLexer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@
763763
#define SCE_ASM_STRINGEOL 13
764764
#define SCE_ASM_EXTINSTRUCTION 14
765765
#define SCE_ASM_COMMENTDIRECTIVE 15
766+
#define SCE_ASM_STRINGBACKQUOTE 16
766767
#define SCE_F_DEFAULT 0
767768
#define SCE_F_COMMENT 1
768769
#define SCE_F_NUMBER 2
@@ -1522,6 +1523,7 @@
15221523
#define SCE_PAS_CHARACTER 12
15231524
#define SCE_PAS_OPERATOR 13
15241525
#define SCE_PAS_ASM 14
1526+
#define SCE_PAS_MULTILINESTRING 15
15251527
#define SCE_SORCUS_DEFAULT 0
15261528
#define SCE_SORCUS_COMMAND 1
15271529
#define SCE_SORCUS_PARAMETER 2

NppPlugin/include/Scintilla.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
8080
#define SCI_SETVIEWWS 2021
8181
#define SCTD_LONGARROW 0
8282
#define SCTD_STRIKEOUT 1
83+
#define SCTD_CONTROLCHAR 2
8384
#define SCI_GETTABDRAWMODE 2698
8485
#define SCI_SETTABDRAWMODE 2699
8586
#define SCI_POSITIONFROMPOINT 2022
@@ -871,6 +872,7 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
871872
#define SC_STATUS_OK 0
872873
#define SC_STATUS_FAILURE 1
873874
#define SC_STATUS_BADALLOC 2
875+
#define SC_STATUS_OUTSIDE_DOCUMENT 3
874876
#define SC_STATUS_WARN_START 1000
875877
#define SC_STATUS_WARN_REGEX 1001
876878
#define SCI_SETSTATUS 2382
@@ -1269,6 +1271,8 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
12691271
#define SC_UPDATE_SELECTION 0x2
12701272
#define SC_UPDATE_V_SCROLL 0x4
12711273
#define SC_UPDATE_H_SCROLL 0x8
1274+
#define SC_UPDATE_TEXT 0x10
1275+
#define SC_UPDATE_LINE_COUNT 0x20
12721276
#define SCEN_CHANGE 768
12731277
#define SCEN_SETFOCUS 512
12741278
#define SCEN_KILLFOCUS 256
@@ -1340,6 +1344,10 @@ typedef sptr_t (*SciFnDirectStatus)(sptr_t ptr, unsigned int iMessage, uptr_t wP
13401344
#define SCN_MARGINRIGHTCLICK 2031
13411345
#define SCN_AUTOCSELECTIONCHANGE 2032
13421346
#ifndef SCI_DISABLE_PROVISIONAL
1347+
#define SCALE_TECHNIQUE_DEFAULT 0
1348+
#define SCALE_TECHNIQUE_PIXEL_ALIGNED 1
1349+
#define SCI_SETSCALETECHNIQUE 2820
1350+
#define SCI_GETSCALETECHNIQUE 2821
13431351
#define SC_BIDIRECTIONAL_DISABLED 0
13441352
#define SC_BIDIRECTIONAL_L2R 1
13451353
#define SC_BIDIRECTIONAL_R2L 2
@@ -1447,7 +1455,7 @@ struct SCNotification {
14471455
Sci_Position position;
14481456
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
14491457
/* SCN_MARGINRIGHTCLICK, SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, */
1450-
/* SCN_CALLTIPCLICK, */
1458+
/* SCN_UPDATEUI, SCN_CALLTIPCLICK, */
14511459
/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
14521460
/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
14531461
/* SCN_USERLISTSELECTION, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */

NppPlugin/include/menuCmdID.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@
4848
#define IDM_FILE_CLOSEALL_UNCHANGED (IDM_FILE + 24)
4949
#define IDM_FILE_CONTAININGFOLDERASWORKSPACE (IDM_FILE + 25)
5050
#define IDM_FILE_CLOSEALL_BUT_PINNED (IDM_FILE + 26)
51+
#define IDM_FILE_OPEN_POWERSHELL (IDM_FILE + 27)
5152
// IMPORTANT: If list above is modified, you have to change the following values:
5253

5354
// To be updated if new menu item(s) is (are) added in menu "File"
54-
#define IDM_FILEMENU_LASTONE IDM_FILE_CLOSEALL_BUT_PINNED
55+
#define IDM_FILEMENU_LASTONE IDM_FILE_OPEN_POWERSHELL
5556

5657
// 0 based position of command "Exit" including the bars in the file menu
5758
// and without counting "Recent files history" items
@@ -155,8 +156,8 @@
155156
#define IDM_EDIT_SENTENCECASE_BLEND (IDM_EDIT + 70)
156157
#define IDM_EDIT_INVERTCASE (IDM_EDIT + 71)
157158
#define IDM_EDIT_RANDOMCASE (IDM_EDIT + 72)
158-
#define IDM_EDIT_OPENASFILE (IDM_EDIT + 73)
159-
#define IDM_EDIT_OPENINFOLDER (IDM_EDIT + 74)
159+
#define IDM_EDIT_OPENSELECTEDFILETOEDIT (IDM_EDIT + 73)
160+
#define IDM_EDIT_OPENSELECTEDFILEFOLDERINEXPLORER (IDM_EDIT + 74)
160161
#define IDM_EDIT_SEARCHONINTERNET (IDM_EDIT + 75)
161162
#define IDM_EDIT_CHANGESEARCHENGINE (IDM_EDIT + 76)
162163
#define IDM_EDIT_REMOVE_CONSECUTIVE_DUP_LINES (IDM_EDIT + 77)
@@ -307,7 +308,7 @@
307308
#define IDM_VIEW_ZOOMOUT (IDM_VIEW + 24)
308309
#define IDM_VIEW_TAB_SPACE (IDM_VIEW + 25)
309310
#define IDM_VIEW_EOL (IDM_VIEW + 26)
310-
//#define IDM_VIEW_TOOLBAR_REDUCE_SET2 (IDM_VIEW + 27)
311+
#define IDM_VIEW_ZOOM_SYNC (IDM_VIEW + 27)
311312
//#define IDM_VIEW_TOOLBAR_ENLARGE_SET2 (IDM_VIEW + 28)
312313
#define IDM_VIEW_UNFOLDALL (IDM_VIEW + 29)
313314
#define IDM_VIEW_FOLD_CURRENT (IDM_VIEW + 30)
@@ -571,6 +572,7 @@
571572
#define IDM_LANG_TOML (IDM_LANG + 91)
572573
#define IDM_LANG_SAS (IDM_LANG + 92)
573574
#define IDM_LANG_ERRORLIST (IDM_LANG + 93)
575+
#define IDM_LANG_ESCSEQ (IDM_LANG + 94)
574576

575577
#define IDM_LANG_EXTERNAL (IDM_LANG + 165)
576578
#define IDM_LANG_EXTERNAL_LIMIT (IDM_LANG + 179)
@@ -630,6 +632,7 @@
630632
#define IDM_TOOL_SHA512_GENERATEINTOCLIPBOARD (IDM_TOOL + 12)
631633

632634
#define IDM_EXECUTE (IDM + 9000)
635+
#define IDM_EXECUTE_VALIDATE_SHORTCUTSXML (IDM_EXECUTE + 1)
633636

634637
#define IDM_SYSTRAYPOPUP (IDM + 3100)
635638
#define IDM_SYSTRAYPOPUP_ACTIVATE (IDM_SYSTRAYPOPUP + 1)

NppPlugin/src/NppDarkModeDummy.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,17 @@ namespace NppDarkMode
7272
return reinterpret_cast<LRESULT>(NppDarkMode::getDarkerBackgroundBrush());
7373
}
7474

75+
76+
77+
// code adapted from https://github.com/ozone10/win32-darkmodelib
78+
int darkMessageBoxW(
79+
HWND hWnd,
80+
LPCWSTR lpText,
81+
LPCWSTR lpCaption,
82+
UINT uType
83+
)
84+
{
85+
return ::MessageBoxW(hWnd, lpText, lpCaption, uType);
86+
}
87+
7588
}

NppPlugin/src/StaticDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent, WORD fon
370370
{
371371
std::wstring errMsg = L"CreateDialogParam() return NULL.\rGetLastError(): ";
372372
errMsg += GetLastErrorAsString();
373-
::MessageBox(NULL, errMsg.c_str(), L"In StaticDialog::create()", MB_OK);
373+
NppDarkMode::darkMessageBoxW(nullptr, errMsg.c_str(), L"In StaticDialog::create()", MB_OK);
374374
return;
375375
}
376376

0 commit comments

Comments
 (0)