This repository has been archived by the owner on Mar 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
NppPluginNETBase.cs
46 lines (43 loc) · 1.81 KB
/
NppPluginNETBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
namespace NppPluginNET
{
class PluginBase
{
#region " Fields "
internal static NppData nppData;
internal static FuncItems _funcItems = new FuncItems();
#endregion
#region " Helper "
internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer)
{
SetCommand(index, commandName, functionPointer, new ShortcutKey(), false);
}
internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut)
{
SetCommand(index, commandName, functionPointer, shortcut, false);
}
internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, bool checkOnInit)
{
SetCommand(index, commandName, functionPointer, new ShortcutKey(), checkOnInit);
}
internal static void SetCommand(int index, string commandName, NppFuncItemDelegate functionPointer, ShortcutKey shortcut, bool checkOnInit)
{
FuncItem funcItem = new FuncItem();
funcItem._cmdID = index;
funcItem._itemName = commandName;
if (functionPointer != null)
funcItem._pFunc = new NppFuncItemDelegate(functionPointer);
if (shortcut._key != 0)
funcItem._pShKey = shortcut;
funcItem._init2Check = checkOnInit;
_funcItems.Add(funcItem);
}
internal static IntPtr GetCurrentScintilla()
{
int curScintilla;
Win32.SendMessage(nppData._nppHandle, NppMsg.NPPM_GETCURRENTSCINTILLA, 0, out curScintilla);
return (curScintilla == 0) ? nppData._scintillaMainHandle : nppData._scintillaSecondHandle;
}
#endregion
}
}