Skip to content

Commit 079e51e

Browse files
committed
Update N++ plugin platform to v0.94.00
1 parent edf6591 commit 079e51e

17 files changed

Lines changed: 97 additions & 27 deletions

CodeStats/PluginInfrastructure/ClikeStringArray.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33
using System.Collections.Generic;
44
using System.Runtime.InteropServices;

CodeStats/PluginInfrastructure/DllExport/DllExportAttribute.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33
using System.Runtime.InteropServices;
44

CodeStats/PluginInfrastructure/DllExport/NppPlugin.DllExport.targets

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
<Target Name="AfterBuild"
66
DependsOnTargets="GetFrameworkPaths"
77
>
8+
<PropertyGroup>
9+
<!-- LibToolPath is optional - it's needed to debug C++, but you can still debug the C# code without it
10+
If you don't have the C++ toolchain installed this is missing, but then you can't' debug C++ anyway -->
11+
<LibToolPath Condition="Exists('$(DevEnvDir)\..\..\VC\bin')">$(DevEnvDir)\..\..\VC\bin</LibToolPath>
12+
</PropertyGroup>
813
<DllExportTask Platform="$(Platform)"
914
PlatformTarget="$(PlatformTarget)"
1015
CpuType="$(CpuType)"
@@ -17,7 +22,23 @@
1722
ProjectDirectory="$(MSBuildProjectDirectory)"
1823
InputFileName="$(TargetPath)"
1924
FrameworkPath="$(TargetedFrameworkDir);$(TargetFrameworkDirectory)"
25+
LibToolPath="$(LibToolPath)"
2026
LibToolDllPath="$(DevEnvDir)"
2127
SdkPath="$(SDK40ToolsPath)"/>
28+
29+
<!-- $(MSBuildProgramFiles32) points to the 32 bit program files dir.
30+
On 32 bit windows usually C:\Program Files\
31+
On 64 bit windows usually C:\Program Files (x86)\
32+
$(ProgramW6432) points to the 64bit Program Files (on 32 bit windows it is blank) -->
33+
<Copy
34+
SourceFiles="$(TargetPath)"
35+
DestinationFolder="$(MSBuildProgramFiles32)\Notepad++\plugins\"
36+
Condition="Exists('$(MSBuildProgramFiles32)\Notepad++\plugins\') AND '$(Platform)'=='x86'"
37+
ContinueOnError="false" />
38+
<Copy
39+
SourceFiles="$(TargetPath)"
40+
DestinationFolder="$(ProgramW6432)\Notepad++\plugins\"
41+
Condition="Exists('$(ProgramW6432)\Notepad++\plugins\') AND '$(Platform)'=='x64'"
42+
ContinueOnError="false" />
2243
</Target>
2344
</Project>

CodeStats/PluginInfrastructure/Docking_h.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
//
33
// This file should stay in sync with the CPP project file
44
// "notepad-plus-plus/PowerEditor/src/WinControls/DockingWnd/Docking.h"

CodeStats/PluginInfrastructure/GatewayDomain.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33
using System.Runtime.InteropServices;
44
using System.Text;
@@ -16,11 +16,11 @@ public class Colour
1616
public readonly int Red, Green, Blue;
1717

1818
public Colour(int rgb)
19-
{
20-
Red = rgb ^ 0xFF;
21-
Green = rgb ^ 0x00FF;
22-
Blue = rgb ^ 0x0000FF;
23-
}
19+
{
20+
Red = rgb & 0xFF;
21+
Green = (rgb >> 8) & 0xFF;
22+
Blue = (rgb >> 16) & 0xFF;
23+
}
2424

2525
/// <summary>
2626
///
@@ -43,7 +43,7 @@ public Colour(int red, int green, int blue)
4343

4444
public int Value
4545
{
46-
get { return Red + (Blue << 8 ) + (Green << 16); }
46+
get { return Red + (Green << 8) + (Blue << 16); }
4747
}
4848
}
4949

CodeStats/PluginInfrastructure/IScintillaGateway.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33
using static Kbg.NppPluginNET.PluginInfrastructure.Win32;
44

CodeStats/PluginInfrastructure/MenuCmdID_h.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
//
33
// This file should stay in sync with the CPP project file
44
// "notepad-plus-plus/PowerEditor/src/menuCmdID.h"

CodeStats/PluginInfrastructure/Msgs_h.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
//
33
// This file should stay in sync with the CPP project file
44
// "notepad-plus-plus/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h"
@@ -519,6 +519,28 @@ public enum NppMsg : uint
519519
/// </summary>
520520
NPPM_SAVEFILE = Constants.NPPMSG + 94,
521521

522+
/// <summary>
523+
/// VOID NPPM_DISABLEAUTOUPDATE(0, 0)
524+
/// </summary>
525+
NPPM_DISABLEAUTOUPDATE = Constants.NPPMSG + 95, // 2119 in decimal
526+
527+
/// <summary>
528+
/// BOOL NPPM_REMOVESHORTCUTASSIGNMENT(int cmdID)
529+
/// removes the assigned shortcut mapped to cmdID
530+
/// returned value : TRUE if function call is successful, otherwise FALSE
531+
/// </summary>
532+
NPPM_REMOVESHORTCUTBYCMDID = Constants.NPPMSG + 96, // 2120 in decimal
533+
534+
/// <summary>
535+
/// INT NPPM_GETPLUGINHOMEPATH(size_t strLen, TCHAR *pluginRootPath)
536+
/// Get plugin home root path. It's useful if plugins want to get its own path
537+
/// by appending <pluginFolderName> which is the name of plugin without extension part.
538+
/// Returns the number of TCHAR copied/to copy.
539+
/// Users should call it with pluginRootPath be NULL to get the required number of TCHAR (not including the terminating nul character),
540+
/// allocate pluginRootPath buffer with the return value + 1, then call it again to get the path.
541+
/// </summary>
542+
NPPM_GETPLUGINHOMEPATH = Constants.NPPMSG + 97,
543+
522544
RUNCOMMAND_USER = Constants.WM_USER + 3000,
523545
NPPM_GETFULLCURRENTPATH = RUNCOMMAND_USER + FULL_CURRENT_PATH,
524546
NPPM_GETCURRENTDIRECTORY = RUNCOMMAND_USER + CURRENT_DIRECTORY,

CodeStats/PluginInfrastructure/NotepadPPGateway.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33
using System.Text;
44
using NppPluginNET.PluginInfrastructure;
@@ -12,7 +12,9 @@ public interface INotepadPPGateway
1212
string GetCurrentFilePath();
1313
unsafe string GetFilePath(int bufferId);
1414
void SetCurrentLanguage(LangType language);
15-
}
15+
string GetCurrentFileName();
16+
string GetCurrentDirectory();
17+
}
1618

1719
/// <summary>
1820
/// This class holds helpers for sending messages defined in the Msgs_h.cs file. It is at the moment
@@ -51,7 +53,29 @@ public void SetCurrentLanguage(LangType language)
5153
{
5254
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint) NppMsg.NPPM_SETCURRENTLANGTYPE, Unused, (int) language);
5355
}
54-
}
56+
57+
/// <summary>
58+
/// Returns the response from NPPM_GETCURRENTDIRECTORY
59+
/// </summary>
60+
/// <returns></returns>
61+
public string GetCurrentDirectory()
62+
{
63+
var path = new StringBuilder(Win32.MAX_PATH);
64+
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETCURRENTDIRECTORY, 0, path);
65+
return path.ToString();
66+
}
67+
68+
/// <summary>
69+
/// Returns the response from NPPM_GETFILENAME
70+
/// </summary>
71+
/// <returns></returns>
72+
public string GetCurrentFileName()
73+
{
74+
var fileName = new StringBuilder(Win32.MAX_PATH);
75+
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_GETFILENAME, 0, fileName);
76+
return fileName.ToString();
77+
}
78+
}
5579

5680
/// <summary>
5781
/// This class holds helpers for sending messages defined in the Resource_h.cs file. It is at the moment

CodeStats/PluginInfrastructure/NppPluginNETBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NPP plugin platform for .Net v0.93.96 by Kasper B. Graversen etc.
1+
// NPP plugin platform for .Net v0.94.00 by Kasper B. Graversen etc.
22
using System;
33

44
namespace Kbg.NppPluginNET.PluginInfrastructure

0 commit comments

Comments
 (0)