Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit e6e5bd9

Browse files
author
Savas Ziplies
committed
Merge remote-tracking branch 'remotes/upstream/master'
2 parents be235a9 + a9c4474 commit e6e5bd9

File tree

5 files changed

+99
-57
lines changed

5 files changed

+99
-57
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ This is a fork of UFO's plugin package updated for VS2015
3737
* https://github.com/zkirkland/FirstUpper
3838
* https://github.com/kbilsted/NppPluginCutNCopyLine
3939
* https://github.com/kbilsted/NppPluginRebaseAssister
40+
* https://github.com/nea/MarkdownViewerPlusPlus
4041

42+
If your plugin is not on the list, please make a PR with a link to it.. :-)
43+
4144

4245
## How to start coding plugins
4346

Visual Studio Project Template C#/PluginInfrastructure/IScintillaGateway.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,14 +886,14 @@ public interface IScintillaGateway
886886
int GetTextLength();
887887

888888
/// <summary>Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184)</summary>
889-
int GetDirectFunction();
889+
IntPtr GetDirectFunction();
890890

891891
/// <summary>
892892
/// Retrieve a pointer value to use as the first argument when calling
893893
/// the function returned by GetDirectFunction.
894894
/// (Scintilla feature 2185)
895895
/// </summary>
896-
int GetDirectPointer();
896+
IntPtr GetDirectPointer();
897897

898898
/// <summary>Set to overtype (true) or insert mode. (Scintilla feature 2186)</summary>
899899
void SetOvertype(bool overtype);
@@ -1511,10 +1511,10 @@ public interface IScintillaGateway
15111511
void SetViewEOL(bool visible);
15121512

15131513
/// <summary>Retrieve a pointer to the document object. (Scintilla feature 2357)</summary>
1514-
int GetDocPointer();
1514+
IntPtr GetDocPointer();
15151515

15161516
/// <summary>Change the document object used. (Scintilla feature 2358)</summary>
1517-
void SetDocPointer(int pointer);
1517+
void SetDocPointer(IntPtr pointer);
15181518

15191519
/// <summary>Set which document modification events are sent to the container. (Scintilla feature 2359)</summary>
15201520
void SetModEventMask(int mask);
@@ -1993,15 +1993,15 @@ public interface IScintillaGateway
19931993
/// characters in the document.
19941994
/// (Scintilla feature 2520)
19951995
/// </summary>
1996-
int GetCharacterPointer();
1996+
IntPtr GetCharacterPointer();
19971997

19981998
/// <summary>
19991999
/// Return a read-only pointer to a range of characters in the document.
20002000
/// May move the gap so that the range is contiguous, but will only move up
20012001
/// to rangeLength bytes.
20022002
/// (Scintilla feature 2643)
20032003
/// </summary>
2004-
int GetRangePointer(int position, int rangeLength);
2004+
IntPtr GetRangePointer(int position, int rangeLength);
20052005

20062006
/// <summary>
20072007
/// Return a position which, to avoid performance costs, should not be within

Visual Studio Project Template C#/PluginInfrastructure/ScintillaGateway.cs

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,21 +1818,19 @@ public int GetTextLength()
18181818
}
18191819

18201820
/// <summary>Retrieve a pointer to a function that processes messages for this Scintilla. (Scintilla feature 2184)</summary>
1821-
public int GetDirectFunction()
1821+
public IntPtr GetDirectFunction()
18221822
{
1823-
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, Unused, Unused);
1824-
return (int) res;
1823+
return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTFUNCTION, Unused, Unused);
18251824
}
18261825

18271826
/// <summary>
18281827
/// Retrieve a pointer value to use as the first argument when calling
18291828
/// the function returned by GetDirectFunction.
18301829
/// (Scintilla feature 2185)
18311830
/// </summary>
1832-
public int GetDirectPointer()
1831+
public IntPtr GetDirectPointer()
18331832
{
1834-
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, Unused, Unused);
1835-
return (int) res;
1833+
return Win32.SendMessage(scintilla, SciMsg.SCI_GETDIRECTPOINTER, Unused, Unused);
18361834
}
18371835

18381836
/// <summary>Set to overtype (true) or insert mode. (Scintilla feature 2186)</summary>
@@ -3009,14 +3007,13 @@ public void SetViewEOL(bool visible)
30093007
}
30103008

30113009
/// <summary>Retrieve a pointer to the document object. (Scintilla feature 2357)</summary>
3012-
public int GetDocPointer()
3010+
public IntPtr GetDocPointer()
30133011
{
3014-
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, Unused, Unused);
3015-
return (int) res;
3012+
return Win32.SendMessage(scintilla, SciMsg.SCI_GETDOCPOINTER, Unused, Unused);
30163013
}
30173014

30183015
/// <summary>Change the document object used. (Scintilla feature 2358)</summary>
3019-
public void SetDocPointer(int pointer)
3016+
public void SetDocPointer(IntPtr pointer)
30203017
{
30213018
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_SETDOCPOINTER, Unused, pointer);
30223019
}
@@ -3953,10 +3950,9 @@ public void CopyAllowLine()
39533950
/// characters in the document.
39543951
/// (Scintilla feature 2520)
39553952
/// </summary>
3956-
public int GetCharacterPointer()
3953+
public IntPtr GetCharacterPointer()
39573954
{
3958-
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, Unused, Unused);
3959-
return (int) res;
3955+
return Win32.SendMessage(scintilla, SciMsg.SCI_GETCHARACTERPOINTER, Unused, Unused);
39603956
}
39613957

39623958
/// <summary>
@@ -3965,10 +3961,9 @@ public int GetCharacterPointer()
39653961
/// to rangeLength bytes.
39663962
/// (Scintilla feature 2643)
39673963
/// </summary>
3968-
public int GetRangePointer(int position, int rangeLength)
3964+
public IntPtr GetRangePointer(int position, int rangeLength)
39693965
{
3970-
IntPtr res = Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, position, rangeLength);
3971-
return (int) res;
3966+
return Win32.SendMessage(scintilla, SciMsg.SCI_GETRANGEPOINTER, position, rangeLength);
39723967
}
39733968

39743969
/// <summary>

Visual Studio Project Template C#/PluginInfrastructure/Scintilla_iface.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public struct ScNotificationHeader
2626
/// <summary>
2727
/// CtrlID of the window issuing the notification
2828
/// </summary>
29-
public uint IdFrom;
29+
public IntPtr IdFrom;
3030

3131
/// <summary>
3232
/// The SCN_* notification Code
@@ -46,8 +46,8 @@ public struct ScNotification
4646
public int Length; /* SCN_MODIFIED */
4747
public int LinesAdded; /* SCN_MODIFIED */
4848
public int Message; /* SCN_MACRORECORD */
49-
public uint wParam; /* SCN_MACRORECORD */
50-
public int lParam; /* SCN_MACRORECORD */
49+
public IntPtr wParam; /* SCN_MACRORECORD */
50+
public IntPtr lParam; /* SCN_MACRORECORD */
5151

5252
/// <summary>
5353
/// 0-based index

Visual Studio Project Template C#/PluginInfrastructure/Win32.cs

Lines changed: 76 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public enum ScrollInfoBar
8585
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
8686
/// </summary>
8787
[DllImport("user32")]
88-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, NppMenuCmd lParam);
88+
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
8989

9090
/// <summary>
9191
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -94,7 +94,7 @@ public enum ScrollInfoBar
9494
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
9595
/// </summary>
9696
[DllImport("user32")]
97-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam);
97+
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam);
9898

9999
/// <summary>
100100
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -103,7 +103,7 @@ public enum ScrollInfoBar
103103
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
104104
/// </summary>
105105
[DllImport("user32")]
106-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam);
106+
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
107107

108108
/// <summary>
109109
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
@@ -112,123 +112,167 @@ public enum ScrollInfoBar
112112
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
113113
/// </summary>
114114
[DllImport("user32")]
115-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, out int lParam);
115+
public static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, out IntPtr lParam);
116116

117117
/// <summary>
118118
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
119119
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
120120
/// If gateways are missing or incomplete, please help extend them and send your code to the project
121121
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
122122
/// </summary>
123-
[DllImport("user32")]
124-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, int lParam);
123+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, NppMenuCmd lParam)
124+
{
125+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr((uint)lParam));
126+
}
127+
125128
/// <summary>
126129
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
127130
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
128131
/// If gateways are missing or incomplete, please help extend them and send your code to the project
129132
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
130133
/// </summary>
134+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, IntPtr lParam)
135+
{
136+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
137+
}
131138

132139
/// <summary>
133140
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
134141
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
135142
/// If gateways are missing or incomplete, please help extend them and send your code to the project
136143
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
137144
/// </summary>
138-
[DllImport("user32")]
139-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType lParam);
145+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, int lParam)
146+
{
147+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr(lParam));
148+
}
140149

141150
/// <summary>
142151
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
143152
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
144153
/// If gateways are missing or incomplete, please help extend them and send your code to the project
145154
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
146155
/// </summary>
147-
[DllImport("user32")]
148-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam);
156+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, out int lParam)
157+
{
158+
IntPtr outVal;
159+
IntPtr retval = SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), out outVal);
160+
lParam = outVal.ToInt32();
161+
return retval;
162+
}
149163

150164
/// <summary>
151165
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
152166
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
153167
/// If gateways are missing or incomplete, please help extend them and send your code to the project
154168
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
155169
/// </summary>
156-
[DllImport("user32")]
157-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
170+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, int lParam)
171+
{
172+
return SendMessage(hWnd, (UInt32)Msg, wParam, new IntPtr(lParam));
173+
}
158174

159175
/// <summary>
160176
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
161177
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
162178
/// If gateways are missing or incomplete, please help extend them and send your code to the project
163179
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
164180
/// </summary>
165-
[DllImport("user32")]
166-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam);
181+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam)
182+
{
183+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
184+
}
167185

168186
/// <summary>
169187
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
170188
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
171189
/// If gateways are missing or incomplete, please help extend them and send your code to the project
172190
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
173191
/// </summary>
174-
[DllImport("user32")]
175-
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, [MarshalAs(UnmanagedType.LPWStr)] StringBuilder lParam);
176-
192+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)] string lParam)
193+
{
194+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
195+
}
177196

178-
// TODO KBG Experimental
179197
/// <summary>
180198
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
181199
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
182200
/// If gateways are missing or incomplete, please help extend them and send your code to the project
183201
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
184202
/// </summary>
185-
[DllImport("user32")]
186-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, IntPtr lParam);
203+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, int lParam)
204+
{
205+
return SendMessage(hWnd, (UInt32)Msg, wParam, new IntPtr(lParam));
206+
}
207+
187208
/// <summary>
188209
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
189210
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
190211
/// If gateways are missing or incomplete, please help extend them and send your code to the project
191212
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
192213
/// </summary>
193-
[DllImport("user32")]
194-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, int lParam);
195-
214+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, IntPtr lParam)
215+
{
216+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
217+
}
196218

197219
/// <summary>
198220
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
199221
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
200222
/// If gateways are missing or incomplete, please help extend them and send your code to the project
201223
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
202224
/// </summary>
203-
[DllImport("user32")]
204-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, IntPtr lParam);
225+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, string lParam)
226+
{
227+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
228+
}
205229

206230
/// <summary>
207231
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
208232
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
209233
/// If gateways are missing or incomplete, please help extend them and send your code to the project
210234
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
211235
/// </summary>
212-
[DllImport("user32")]
213-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, string lParam);
236+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] StringBuilder lParam)
237+
{
238+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), lParam);
239+
}
214240

215241
/// <summary>
216242
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
217243
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
218244
/// If gateways are missing or incomplete, please help extend them and send your code to the project
219245
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
220246
/// </summary>
221-
[DllImport("user32")]
222-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, [MarshalAs(UnmanagedType.LPStr)] StringBuilder lParam);
247+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, int lParam)
248+
{
249+
return SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), new IntPtr(lParam));
250+
}
223251

224252
/// <summary>
225253
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
226254
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
227255
/// If gateways are missing or incomplete, please help extend them and send your code to the project
228256
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
229257
/// </summary>
230-
[DllImport("user32")]
231-
public static extern IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, int wParam, int lParam);
258+
public static IntPtr SendMessage(IntPtr hWnd, SciMsg Msg, IntPtr wParam, IntPtr lParam)
259+
{
260+
return SendMessage(hWnd, (UInt32)Msg, wParam, lParam);
261+
}
262+
263+
/// <summary>
264+
/// You should try to avoid calling this method in your plugin code. Rather use one of the gateways such as
265+
/// <see cref="ScintillaGateway"/> or <see cref="NotepadPPGateway"/>.
266+
/// If gateways are missing or incomplete, please help extend them and send your code to the project
267+
/// at https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net
268+
/// </summary>
269+
public static IntPtr SendMessage(IntPtr hWnd, uint Msg, int wParam, ref LangType lParam)
270+
{
271+
IntPtr outVal;
272+
IntPtr retval = SendMessage(hWnd, (UInt32)Msg, new IntPtr(wParam), out outVal);
273+
lParam = (LangType)outVal;
274+
return retval;
275+
}
232276

233277
public const int MAX_PATH = 260;
234278

@@ -266,4 +310,4 @@ public enum ScrollInfoBar
266310
[DllImport("user32")]
267311
public static extern int GetScrollInfo(IntPtr hwnd, int nBar, ref ScrollInfo scrollInfo);
268312
}
269-
}
313+
}

0 commit comments

Comments
 (0)