Skip to content

Commit 25cdb25

Browse files
committed
- added appveyor.yml with preparation for automatic github deloyment, just release builds are possible by available nmake makefile
- updated npp include files to v3.1 from https://github.com/npp-plugins/plugintemplate, modified PluginInterface.h to include menuCmdID.h as before - changed makefile for x64 build - updated bufferid references from INT -> LRESULT - fixed issue https://notepad-plus-plus.org/community/topic/12558/session-manager-issue by usage of fix from https://github.com/pnedev/npp-session-manager
1 parent 407cded commit 25cdb25

File tree

10 files changed

+268
-87
lines changed

10 files changed

+268
-87
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ X=src\xml
1616

1717
# http://msdn.microsoft.com/en-us/library/fwkeyyhe.aspx
1818
CXX=cl
19-
CXXFLAGS=/O2 /EHs /GR- /MT /nologo /W3 /WX- /Gd /Gm- /Fo$O\ /fp:fast /wd4995 \
19+
CXXFLAGS=/O2 /EHs /GR- /MT /nologo /W3 /WX- /Gd /Gm- /Fo$O\ /fp:fast \
2020
/errorReport:none /Zc:wchar_t /DWIN32 /DNDEBUG /D_WINDOWS /D_USRDLL \
2121
/D_WINDLL /DUNICODE /D_UNICODE /c
2222

2323
# http://msdn.microsoft.com/en-us/library/y0zzbyt4.aspx
2424
LD=link
2525
LIBS=user32.lib shell32.lib
2626
LDFLAGS=/DLL /nologo /OUT:$O\$(PRJ).dll /INCREMENTAL:NO /MANIFEST:NO \
27-
/MACHINE:X86 /ERRORREPORT:NONE
27+
/ERRORREPORT:NONE
2828

2929
RC=rc
3030
RCFLAGS=/nologo /fo$O\$(PRJ).res

appveyor.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
version: 1.4.2.{build}
2+
image: Visual Studio 2017
3+
4+
environment:
5+
matrix:
6+
- PlatformToolset: v140_xp
7+
- PlatformToolset: v141_xp
8+
9+
platform:
10+
- x64
11+
- x86
12+
13+
configuration:
14+
- Release
15+
- Debug
16+
17+
install:
18+
- if "%platform%"=="x64" set archi=amd64
19+
- if "%platform%"=="x86" set archi=x86
20+
- if "%PlatformToolset%"=="v140_xp" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %archi%
21+
- if "%PlatformToolset%"=="v141_xp" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %archi%
22+
23+
build_script:
24+
- cd "%APPVEYOR_BUILD_FOLDER%"
25+
- nmake
26+
27+
after_build:
28+
- cd "%APPVEYOR_BUILD_FOLDER%"
29+
- ps: >-
30+
Push-AppveyorArtifact "obj\SessionMgr.dll" -FileName SessionMgr.dll
31+
32+
if ($env:CONFIGURATION -eq "Release" -and $env:PLATFORMTOOLSET -eq "v140_xp") {
33+
$ZipFileName = "SessionMgr_$($env:APPVEYOR_REPO_TAG_NAME)_$env:PLATFORM.zip"
34+
7z a $ZipFileName "obj\SessionMgr.dll"
35+
}
36+
37+
artifacts:
38+
- path: SessionMgr_*.zip
39+
name: releases
40+
41+
deploy:
42+
provider: GitHub
43+
auth_token:
44+
secure: PhNXrhw03Z0rJZssX/UYyoIofw669wU1GBy/hGq+WJPCXd7mbxDu6Il32Rx0LBH6
45+
artifact: releases
46+
draft: false
47+
prerelease: false
48+
force_update: true
49+
on:
50+
appveyor_repo_tag: true
51+
PlatformToolset: v140_xp
52+
configuration: Release

src/DllMain.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extern "C" __declspec(dllexport) void setInfo(NppData nppd)
6868

6969
extern "C" __declspec(dllexport) LPCWSTR getName()
7070
{
71-
return app_getName();
71+
return PLUGIN_FULL_NAME;
7272
}
7373

7474
extern "C" __declspec(dllexport) FuncItem* getFuncsArray(INT *pnbFuncItems)

src/Properties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ void updateSessionFromGlobal(LPWSTR sesFile)
284284
/** Updates document properties from global file properties.
285285
When an existing document is added to a session, its bookmarks and
286286
firstVisibleLine are updated from the global properties. */
287-
void updateDocumentFromGlobal(INT bufferId)
287+
void updateDocumentFromGlobal(LRESULT bufferId)
288288
{
289289
LPSTR mbPathname;
290290
WCHAR pathname[MAX_PATH];

src/Properties.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace prp {
3636

3737
void updateGlobalFromSession(LPWSTR sesFile);
3838
void updateSessionFromGlobal(LPWSTR sesFile);
39-
void updateDocumentFromGlobal(INT bufferId);
39+
void updateDocumentFromGlobal(LRESULT bufferId);
4040

4141
} // end namespace NppPlugin::prp
4242

src/SessionMgr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ vector<Session> _sessions; ///< stores info on sessions read from disk
4141
INT _sesCurIdx; ///< current session index
4242
INT _sesPrvIdx; ///< previous session index
4343
INT _sesDefIdx; ///< default session index
44-
INT _bidFileOpened; ///< bufferId from most recent NPPN_FILEOPENED
45-
INT _bidBufferActivated; ///< XXX experimental. bufferId from most recent NPPN_BUFFERACTIVATED
44+
LRESULT _bidFileOpened; ///< bufferId from most recent NPPN_FILEOPENED
45+
LRESULT _bidBufferActivated; ///< XXX experimental. bufferId from most recent NPPN_BUFFERACTIVATED
4646
bool _appReady; ///< if false, plugin should do nothing
4747
bool _sesLoading; ///< if true, a session is loading
4848
bool _fileOpenedFromCmdLine;

src/npp/Notepad_plus_msgs.h

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// version 2 of the License, or (at your option) any later version.
88
//
99
// Note that the GPL places important restrictions on "derived works", yet
10-
// it does not provide a detailed definition of that term. To avoid
11-
// misunderstandings, we consider an application to constitute a
10+
// it does not provide a detailed definition of that term. To avoid
11+
// misunderstandings, we consider an application to constitute a
1212
// "derivative work" for the purpose of this license if it does any of the
13-
// following:
13+
// following:
1414
// 1. Integrates source code from Notepad++.
1515
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
1616
// installer, such as those produced by InstallShield.
@@ -29,22 +29,26 @@
2929
#ifndef NOTEPAD_PLUS_MSGS_H
3030
#define NOTEPAD_PLUS_MSGS_H
3131

32+
#include <windows.h>
33+
#include <tchar.h>
3234

3335
enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
3436
L_HTML, L_XML, L_MAKEFILE, L_PASCAL, L_BATCH, L_INI, L_ASCII, L_USER,\
35-
L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA,\
37+
L_ASP, L_SQL, L_VB, L_JS, L_CSS, L_PERL, L_PYTHON, L_LUA, \
3638
L_TEX, L_FORTRAN, L_BASH, L_FLASH, L_NSIS, L_TCL, L_LISP, L_SCHEME,\
3739
L_ASM, L_DIFF, L_PROPS, L_PS, L_RUBY, L_SMALLTALK, L_VHDL, L_KIX, L_AU3,\
3840
L_CAML, L_ADA, L_VERILOG, L_MATLAB, L_HASKELL, L_INNO, L_SEARCHRESULT,\
3941
L_CMAKE, L_YAML, L_COBOL, L_GUI4CLI, L_D, L_POWERSHELL, L_R, L_JSP,\
40-
L_COFFEESCRIPT,\
42+
L_COFFEESCRIPT, L_JSON, L_JAVASCRIPT, L_FORTRAN_77,\
43+
// Don't use L_JS, use L_JAVASCRIPT instead
4144
// The end of enumated language type, so it should be always at the end
4245
L_EXTERNAL};
43-
enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81};
4446

47+
enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10};
4548

4649

47-
//Here you can find how to use these messages : http://notepad-plus.sourceforge.net/uk/plugins-HOWTO.php
50+
51+
//Here you can find how to use these messages : http://docs.notepad-plus-plus.org/index.php/Messages_And_Notifications
4852
#define NPPMSG (WM_USER + 1000)
4953

5054
#define NPPM_GETCURRENTSCINTILLA (NPPMSG + 4)
@@ -76,7 +80,7 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
7680

7781
#define NPPM_GETOPENFILENAMESPRIMARY (NPPMSG + 17)
7882
#define NPPM_GETOPENFILENAMESSECOND (NPPMSG + 18)
79-
83+
8084
#define NPPM_CREATESCINTILLAHANDLE (NPPMSG + 20)
8185
#define NPPM_DESTROYSCINTILLAHANDLE (NPPMSG + 21)
8286
#define NPPM_GETNBUSERLANG (NPPMSG + 22)
@@ -103,7 +107,7 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
103107
//ascii file to unicode
104108
//int NPPM_ENCODESCI(MAIN_VIEW/SUB_VIEW, 0)
105109
//return new unicodeMode
106-
110+
107111
#define NPPM_DECODESCI (NPPMSG + 27)
108112
//unicode file to ascii
109113
//int NPPM_DECODESCI(MAIN_VIEW/SUB_VIEW, 0)
@@ -162,7 +166,7 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
162166
//HWND WM_DMM_GETPLUGINHWNDBYNAME(const TCHAR *windowName, const TCHAR *moduleName)
163167
// if moduleName is NULL, then return value is NULL
164168
// if windowName is NULL, then the first found window handle which matches with the moduleName will be returned
165-
169+
166170
#define NPPM_MAKECURRENTBUFFERDIRTY (NPPMSG + 44)
167171
//BOOL NPPM_MAKECURRENTBUFFERDIRTY(0, 0)
168172

@@ -187,13 +191,13 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
187191
// uncomment //#include "menuCmdID.h"
188192
// in the beginning of this file then use the command symbols defined in "menuCmdID.h" file
189193
// to access all the Notepad++ menu command items
190-
194+
191195
#define NPPM_TRIGGERTABBARCONTEXTMENU (NPPMSG + 49)
192196
//void NPPM_TRIGGERTABBARCONTEXTMENU(int view, int index2Activate)
193197

194198
#define NPPM_GETNPPVERSION (NPPMSG + 50)
195199
// int NPPM_GETNPPVERSION(0, 0)
196-
// return version
200+
// return version
197201
// ex : v4.6
198202
// HIWORD(version) == 4
199203
// LOWORD(version) == 6
@@ -213,26 +217,26 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
213217
// Return VIEW|INDEX from a buffer ID. -1 if the bufferID non existing
214218
// if priorityView set to SUB_VIEW, then SUB_VIEW will be search firstly
215219
//
216-
// VIEW takes 2 highest bits and INDEX (0 based) takes the rest (30 bits)
220+
// VIEW takes 2 highest bits and INDEX (0 based) takes the rest (30 bits)
217221
// Here's the values for the view :
218222
// MAIN_VIEW 0
219223
// SUB_VIEW 1
220224

221225
#define NPPM_GETFULLPATHFROMBUFFERID (NPPMSG + 58)
222226
// INT NPPM_GETFULLPATHFROMBUFFERID(INT bufferID, TCHAR *fullFilePath)
223-
// Get full path file name from a bufferID.
227+
// Get full path file name from a bufferID.
224228
// Return -1 if the bufferID non existing, otherwise the number of TCHAR copied/to copy
225229
// User should call it with fullFilePath be NULL to get the number of TCHAR (not including the nul character),
226230
// allocate fullFilePath with the return values + 1, then call it again to get full path file name
227231

228232
#define NPPM_GETBUFFERIDFROMPOS (NPPMSG + 59)
229-
// INT NPPM_GETBUFFERIDFROMPOS(INT index, INT iView)
233+
// LRESULT NPPM_GETBUFFERIDFROMPOS(INT index, INT iView)
230234
// wParam: Position of document
231235
// lParam: View to use, 0 = Main, 1 = Secondary
232236
// Returns 0 if invalid
233237

234238
#define NPPM_GETCURRENTBUFFERID (NPPMSG + 60)
235-
// INT NPPM_GETCURRENTBUFFERID(0, 0)
239+
// LRESULT NPPM_GETCURRENTBUFFERID(0, 0)
236240
// Returns active Buffer
237241

238242
#define NPPM_RELOADBUFFERID (NPPMSG + 61)
@@ -363,15 +367,15 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
363367
// Get programing language name from the given language type (LangType)
364368
// Return value is the number of copied character / number of character to copy (\0 is not included)
365369
// You should call this function 2 times - the first time you pass langName as NULL to get the number of characters to copy.
366-
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time
370+
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGENAME function the 2nd time
367371
// by passing allocated buffer as argument langName
368372

369373
#define NPPM_GETLANGUAGEDESC (NPPMSG + 84)
370374
// INT NPPM_GETLANGUAGEDESC(int langType, TCHAR *langDesc)
371375
// Get programing language short description from the given language type (LangType)
372376
// Return value is the number of copied character / number of character to copy (\0 is not included)
373377
// You should call this function 2 times - the first time you pass langDesc as NULL to get the number of characters to copy.
374-
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time
378+
// You allocate a buffer of the length of (the number of characters + 1) then call NPPM_GETLANGUAGEDESC function the 2nd time
375379
// by passing allocated buffer as argument langDesc
376380

377381
#define NPPM_SHOWDOCSWITCHER (NPPMSG + 85)
@@ -403,6 +407,17 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
403407
// INT NPPM_GETEDITORDEFAULTBACKGROUNDCOLOR(0, 0)
404408
// Return: current editor default background color. You should convert the returned value in COLORREF
405409

410+
#define NPPM_SETSMOOTHFONT (NPPMSG + 92)
411+
// VOID NPPM_SETSMOOTHFONT(0, BOOL setSmoothFontOrNot)
412+
413+
#define NPPM_SETEDITORBORDEREDGE (NPPMSG + 93)
414+
// VOID NPPM_SETEDITORBORDEREDGE(0, BOOL withEditorBorderEdgeOrNot)
415+
416+
#define NPPM_SAVEFILE (NPPMSG + 94)
417+
// VOID NPPM_SAVEFILE(0, const TCHAR *fileNameToSave)
418+
419+
#define NPPM_DISABLEAUTOUPDATE (NPPMSG + 95) // 2119 in decimal
420+
// VOID NPPM_DISABLEAUTOUPDATE(0, 0)
406421

407422
#define RUNCOMMAND_USER (WM_USER + 3000)
408423
#define NPPM_GETFULLCURRENTPATH (RUNCOMMAND_USER + FULL_CURRENT_PATH)
@@ -468,12 +483,12 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
468483
//scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
469484
//scnNotification->nmhdr.hwndFrom = hwndNpp;
470485
//scnNotification->nmhdr.idFrom = BufferID;
471-
486+
472487
#define NPPN_FILEBEFORESAVE (NPPN_FIRST + 7) // To notify plugins that the current file is about to be saved
473488
//scnNotification->nmhdr.code = NPPN_FILEBEFOREOPEN;
474489
//scnNotification->nmhdr.hwndFrom = hwndNpp;
475490
//scnNotification->nmhdr.idFrom = BufferID;
476-
491+
477492
#define NPPN_FILESAVED (NPPN_FIRST + 8) // To notify plugins that the current file is just saved
478493
//scnNotification->nmhdr.code = NPPN_FILESAVED;
479494
//scnNotification->nmhdr.hwndFrom = hwndNpp;
@@ -541,4 +556,44 @@ enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV
541556
//scnNotification->nmhdr.hwndFrom = NULL;
542557
//scnNotification->nmhdr.idFrom = BufferID;
543558

559+
#define NPPN_BEFORESHUTDOWN (NPPN_FIRST + 19) // To notify plugins that Npp shutdown has been triggered, files have not been closed yet
560+
//scnNotification->nmhdr.code = NPPN_BEFORESHUTDOWN;
561+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
562+
//scnNotification->nmhdr.idFrom = 0;
563+
564+
#define NPPN_CANCELSHUTDOWN (NPPN_FIRST + 20) // To notify plugins that Npp shutdown has been cancelled
565+
//scnNotification->nmhdr.code = NPPN_CANCELSHUTDOWN;
566+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
567+
//scnNotification->nmhdr.idFrom = 0;
568+
569+
#define NPPN_FILEBEFORERENAME (NPPN_FIRST + 21) // To notify plugins that file is to be renamed
570+
//scnNotification->nmhdr.code = NPPN_FILEBEFORERENAME;
571+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
572+
//scnNotification->nmhdr.idFrom = BufferID;
573+
574+
#define NPPN_FILERENAMECANCEL (NPPN_FIRST + 22) // To notify plugins that file rename has been cancelled
575+
//scnNotification->nmhdr.code = NPPN_FILERENAMECANCEL;
576+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
577+
//scnNotification->nmhdr.idFrom = BufferID;
578+
579+
#define NPPN_FILERENAMED (NPPN_FIRST + 23) // To notify plugins that file has been renamed
580+
//scnNotification->nmhdr.code = NPPN_FILERENAMED;
581+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
582+
//scnNotification->nmhdr.idFrom = BufferID;
583+
584+
#define NPPN_FILEBEFOREDELETE (NPPN_FIRST + 24) // To notify plugins that file is to be deleted
585+
//scnNotification->nmhdr.code = NPPN_FILEBEFOREDELETE;
586+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
587+
//scnNotification->nmhdr.idFrom = BufferID;
588+
589+
#define NPPN_FILEDELETEFAILED (NPPN_FIRST + 25) // To notify plugins that file deletion has failed
590+
//scnNotification->nmhdr.code = NPPN_FILEDELETEFAILED;
591+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
592+
//scnNotification->nmhdr.idFrom = BufferID;
593+
594+
#define NPPN_FILEDELETED (NPPN_FIRST + 26) // To notify plugins that file has been deleted
595+
//scnNotification->nmhdr.code = NPPN_FILEDELETED;
596+
//scnNotification->nmhdr.hwndFrom = hwndNpp;
597+
//scnNotification->nmhdr.idFrom = BufferID;
598+
544599
#endif //NOTEPAD_PLUS_MSGS_H

src/npp/PluginInterface.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
// version 2 of the License, or (at your option) any later version.
88
//
99
// Note that the GPL places important restrictions on "derived works", yet
10-
// it does not provide a detailed definition of that term. To avoid
11-
// misunderstandings, we consider an application to constitute a
10+
// it does not provide a detailed definition of that term. To avoid
11+
// misunderstandings, we consider an application to constitute a
1212
// "derivative work" for the purpose of this license if it does any of the
13-
// following:
13+
// following:
1414
// 1. Integrates source code from Notepad++.
1515
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
1616
// installer, such as those produced by InstallShield.
@@ -45,7 +45,8 @@ const int nbChar = 64;
4545

4646
typedef const TCHAR * (__cdecl * PFUNCGETNAME)();
4747

48-
struct NppData {
48+
struct NppData
49+
{
4950
HWND _nppHandle;
5051
HWND _scintillaMainHandle;
5152
HWND _scintillaSecondHandle;
@@ -57,14 +58,16 @@ typedef void (__cdecl * PBENOTIFIED)(SCNotification *);
5758
typedef LRESULT (__cdecl * PMESSAGEPROC)(UINT Message, WPARAM wParam, LPARAM lParam);
5859

5960

60-
struct ShortcutKey {
61+
struct ShortcutKey
62+
{
6163
bool _isCtrl;
6264
bool _isAlt;
6365
bool _isShift;
6466
UCHAR _key;
6567
};
6668

67-
struct FuncItem {
69+
struct FuncItem
70+
{
6871
TCHAR _itemName[nbChar];
6972
PFUNCPLUGINCMD _pFunc;
7073
int _cmdID;
@@ -81,8 +84,8 @@ extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *);
8184
extern "C" __declspec(dllexport) void beNotified(SCNotification *);
8285
extern "C" __declspec(dllexport) LRESULT messageProc(UINT Message, WPARAM wParam, LPARAM lParam);
8386

84-
#ifdef UNICODE
87+
// This API return always true now, since Notepad++ isn't compiled in ANSI mode anymore
8588
extern "C" __declspec(dllexport) BOOL isUnicode();
86-
#endif //UNICODE
89+
8790

8891
#endif //PLUGININTERFACE_H

0 commit comments

Comments
 (0)