|
5 | 5 |
|
6 | 6 | namespace Kbg.NppPluginNET.PluginInfrastructure
|
7 | 7 | {
|
8 |
| - public interface INotepadPPGateway |
9 |
| - { |
10 |
| - void FileNew(); |
11 |
| - |
12 |
| - string GetCurrentFilePath(); |
13 |
| - unsafe string GetFilePath(int bufferId); |
14 |
| - void SetCurrentLanguage(LangType language); |
15 |
| - } |
16 |
| - |
17 |
| - public class NotepadPPGateway : INotepadPPGateway |
18 |
| - { |
19 |
| - private const int Unused = 0; |
20 |
| - |
21 |
| - public void FileNew() |
22 |
| - { |
23 |
| - Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW); |
24 |
| - } |
25 |
| - |
26 |
| - /// <summary> |
27 |
| - /// Gets the path of the current document. |
28 |
| - /// </summary> |
29 |
| - public string GetCurrentFilePath() |
30 |
| - { |
31 |
| - var path = new StringBuilder(2000); |
32 |
| - Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); |
33 |
| - return path.ToString(); |
34 |
| - } |
35 |
| - |
36 |
| - /// <summary> |
37 |
| - /// Gets the path of the current document. |
38 |
| - /// </summary> |
39 |
| - public unsafe string GetFilePath(int bufferId) |
40 |
| - { |
41 |
| - var path = new StringBuilder(2000); |
42 |
| - Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path); |
43 |
| - return path.ToString(); |
44 |
| - } |
45 |
| - |
46 |
| - public void SetCurrentLanguage(LangType language) |
47 |
| - { |
48 |
| - Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language); |
49 |
| - } |
50 |
| - } |
51 |
| - |
| 8 | + public interface INotepadPPGateway |
| 9 | + { |
| 10 | + void FileNew(); |
| 11 | + |
| 12 | + string GetCurrentFilePath(); |
| 13 | + unsafe string GetFilePath(int bufferId); |
| 14 | + void SetCurrentLanguage(LangType language); |
| 15 | + } |
| 16 | + |
| 17 | + /// <summary> |
| 18 | + /// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment |
| 19 | + /// incomplete. Please help fill in the blanks. |
| 20 | + /// </summary> |
| 21 | + public class NotepadPPGateway : INotepadPPGateway |
| 22 | + { |
| 23 | + private const int Unused = 0; |
| 24 | + |
| 25 | + public void FileNew() |
| 26 | + { |
| 27 | + Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_MENUCOMMAND, Unused, NppMenuCmd.IDM_FILE_NEW); |
| 28 | + } |
| 29 | + |
| 30 | + /// <summary> |
| 31 | + /// Gets the path of the current document. |
| 32 | + /// </summary> |
| 33 | + public string GetCurrentFilePath() |
| 34 | + { |
| 35 | + var path = new StringBuilder(2000); |
| 36 | + Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLCURRENTPATH, 0, path); |
| 37 | + return path.ToString(); |
| 38 | + } |
| 39 | + |
| 40 | + /// <summary> |
| 41 | + /// Gets the path of the current document. |
| 42 | + /// </summary> |
| 43 | + public unsafe string GetFilePath(int bufferId) |
| 44 | + { |
| 45 | + var path = new StringBuilder(2000); |
| 46 | + Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETFULLPATHFROMBUFFERID, bufferId, path); |
| 47 | + return path.ToString(); |
| 48 | + } |
| 49 | + |
| 50 | + public void SetCurrentLanguage(LangType language) |
| 51 | + { |
| 52 | + Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language); |
| 53 | + } |
| 54 | + } |
52 | 55 | }
|
0 commit comments