12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- using System;
- namespace Demo
- {
- partial 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)
- {
- var 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
- }
- }
|