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

Commit b27b180

Browse files
authored
Merge pull request #82 from BdR76/master
Support for Fluent UI and darkmode icons
2 parents 0a0174f + 4beb176 commit b27b180

File tree

12 files changed

+307
-98
lines changed

12 files changed

+307
-98
lines changed

Demo Plugin/NppManagedPluginDemo.sln

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25123.0
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.31402.337
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NppManagedPluginDemo", "NppManagedPluginDemo\NppManagedPluginDemo.csproj", "{EB8FC3A3-93E8-457B-B281-FAFA5119611A}"
77
EndProject
@@ -13,16 +13,19 @@ Global
1313
Release|x86 = Release|x86
1414
EndGlobalSection
1515
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{B976953C-50F6-4F18-A951-4338946511EE}.Debug|x64.ActiveCfg = Debug|x64
17-
{B976953C-50F6-4F18-A951-4338946511EE}.Debug|x64.Build.0 = Debug|x64
18-
{B976953C-50F6-4F18-A951-4338946511EE}.Debug|x86.ActiveCfg = Debug|x86
19-
{B976953C-50F6-4F18-A951-4338946511EE}.Debug|x86.Build.0 = Debug|x86
20-
{B976953C-50F6-4F18-A951-4338946511EE}.Release|x64.ActiveCfg = Release|x64
21-
{B976953C-50F6-4F18-A951-4338946511EE}.Release|x64.Build.0 = Release|x64
22-
{B976953C-50F6-4F18-A951-4338946511EE}.Release|x86.ActiveCfg = Release|x86
23-
{B976953C-50F6-4F18-A951-4338946511EE}.Release|x86.Build.0 = Release|x86
16+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Debug|x64.ActiveCfg = Debug|x64
17+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Debug|x64.Build.0 = Debug|x64
18+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Debug|x86.ActiveCfg = Debug|x86
19+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Debug|x86.Build.0 = Debug|x86
20+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Release|x64.ActiveCfg = Release|x64
21+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Release|x64.Build.0 = Release|x64
22+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Release|x86.ActiveCfg = Release|x86
23+
{EB8FC3A3-93E8-457B-B281-FAFA5119611A}.Release|x86.Build.0 = Release|x86
2424
EndGlobalSection
2525
GlobalSection(SolutionProperties) = preSolution
2626
HideSolutionNode = FALSE
2727
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {4B1FAC52-7C23-4EDF-A9EB-DA9BBF2FA121}
30+
EndGlobalSection
2831
EndGlobal

Demo Plugin/NppManagedPluginDemo/Demo.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,14 @@ class Main
5959
static string sessionFilePath = @"C:\text.session";
6060
static frmGoToLine frmGoToLine = null;
6161
static internal int idFrmGotToLine = -1;
62+
63+
// toolbar icons
6264
static Bitmap tbBmp = Properties.Resources.star;
6365
static Bitmap tbBmp_tbTab = Properties.Resources.star_bmp;
66+
static Icon tbIco = Properties.Resources.star_black_ico;
67+
static Icon tbIcoDM = Properties.Resources.star_white_ico;
6468
static Icon tbIcon = null;
69+
6570
static IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());
6671
static INotepadPPGateway notepad = new NotepadPPGateway();
6772
#endregion
@@ -149,11 +154,22 @@ A maximum of {scrollInfo.nPage} rows is visible at a time.
149154

150155
static internal void SetToolBarIcon()
151156
{
157+
// create struct
152158
toolbarIcons tbIcons = new toolbarIcons();
159+
160+
// add bmp icon
153161
tbIcons.hToolbarBmp = tbBmp.GetHbitmap();
162+
tbIcons.hToolbarIcon = tbIco.Handle; // icon with black lines
163+
tbIcons.hToolbarIconDarkMode = tbIcoDM.Handle; // icon with light grey lines
164+
165+
// convert to c++ pointer
154166
IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons));
155167
Marshal.StructureToPtr(tbIcons, pTbIcons, false);
156-
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON, PluginBase._funcItems.Items[idFrmGotToLine]._cmdID, pTbIcons);
168+
169+
// call Notepad++ api
170+
Win32.SendMessage(PluginBase.nppData._nppHandle, (uint)NppMsg.NPPM_ADDTOOLBARICON_FORDARKMODE, PluginBase._funcItems.Items[idFrmGotToLine]._cmdID, pTbIcons);
171+
172+
// release pointer
157173
Marshal.FreeHGlobal(pTbIcons);
158174
}
159175

Demo Plugin/NppManagedPluginDemo/NppManagedPluginDemo.csproj

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
<AssemblyName>Demo</AssemblyName>
1313
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
1414
<OldToolsVersion>3.5</OldToolsVersion>
15+
<ProjectGuid>{EB8FC3A3-93E8-457B-B281-FAFA5119611A}</ProjectGuid>
1516
</PropertyGroup>
1617
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
1718
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
2021
<OutputPath>bin\Debug</OutputPath>
2122
<DefineConstants>DEBUG;TRACE</DefineConstants>
2223
<ErrorReport>prompt</ErrorReport>
@@ -33,12 +34,12 @@
3334
<FileAlignment>512</FileAlignment>
3435
<PlatformTarget>x86</PlatformTarget>
3536
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
36-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
37+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3738
</PropertyGroup>
3839
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
3940
<DebugSymbols>true</DebugSymbols>
40-
<DebugType>full</DebugType>
41-
<Optimize>false</Optimize>
41+
<DebugType>full</DebugType>
42+
<Optimize>false</Optimize>
4243
<OutputPath>bin\Debug-x64</OutputPath>
4344
<DefineConstants>DEBUG;TRACE</DefineConstants>
4445
<ErrorReport>prompt</ErrorReport>
@@ -55,7 +56,7 @@
5556
<FileAlignment>512</FileAlignment>
5657
<PlatformTarget>x64</PlatformTarget>
5758
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
58-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
59+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
5960
</PropertyGroup>
6061
<PropertyGroup>
6162
<!-- Default values for debugging so it start correct version of Notepad++
@@ -124,6 +125,11 @@
124125
<Compile Include="Properties\Resources.Designer.cs">
125126
<DependentUpon>Resources.resx</DependentUpon>
126127
</Compile>
128+
<Compile Include="Properties\Resources1.Designer.cs">
129+
<AutoGen>True</AutoGen>
130+
<DesignTime>True</DesignTime>
131+
<DependentUpon>Resources.resx</DependentUpon>
132+
</Compile>
127133
</ItemGroup>
128134
<ItemGroup>
129135
<Reference Include="System" />
@@ -137,10 +143,14 @@
137143
</EmbeddedResource>
138144
<EmbeddedResource Include="Properties\Resources.resx">
139145
<SubType>Designer</SubType>
146+
<Generator>ResXFileCodeGenerator</Generator>
147+
<LastGenOutput>Resources1.Designer.cs</LastGenOutput>
140148
</EmbeddedResource>
141149
</ItemGroup>
142150
<ItemGroup>
143151
<Content Include="Properties\star.png" />
152+
<None Include="Properties\star_white.ico" />
153+
<None Include="Properties\star_black.ico" />
144154
<Content Include="Properties\star_bmp.bmp" />
145155
</ItemGroup>
146156
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

Demo Plugin/NppManagedPluginDemo/Properties/Resources.Designer.cs

Lines changed: 100 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo Plugin/NppManagedPluginDemo/Properties/Resources.resx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -112,28 +112,32 @@
112112
<value>2.0</value>
113113
</resheader>
114114
<resheader name="reader">
115-
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116116
</resheader>
117117
<resheader name="writer">
118-
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
120+
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
121121
<data name="star" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
122122
<value>
123-
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
124-
YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAlwSFlzAAALEAAA
125-
CxABrSO9dQAAAi5JREFUOE9j/P//PwMyuJXho8fEzdPIyMJm8p+FVebfn98Mf79+fvLn65cz/75+qtdf
126-
dfISigaQATB8pzhi/d3yuP8XPdT/n9Jl+39SgwGMT+mw/j/rIPf/fKzj/7NhFuuR9YA1f79/k+Ned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doH8
128+
jK7ggrMC0AIIWGergCF/zJj//0Eb6V0Md2tSnsACDOTch20F/58vnPD/x5P7UO3//396fP//w8kNYDmY
129+
l05oMf3fayf7hAEUVTBT71bEQ7XgBufL4uFe2mUlCYx3YDzDDADhi0AFuMCeovj/U+UY/m9TgajdYSr6
130+
n+F6QdgTUDwjG3J/fj9UCwJcmNOPovmEJuP/bYb8TxguxTrsAiUSZANAoY8O7u1Y/3+NEkLNIW22/zu1
131+
OXYxXEr2MAGlMGQDYAF4qq8ebDMIvL56/v9SRYSa7Tqc/zdrsJmAExIoeYJTGFTy9br5/1dYyYOdvF4Z
132+
6GxbebAL5itA5PcCbd+mwQpJSCDi/IQGDlDyBKUwmCErgc49rI6wEcQGuQCkeYsG6+NpCsyIpAzDoOQJ
133+
SmGgRAKKZ5hmUICB/AxyNsxmGEYxAIQP28roHrSVXb/PRvoxKJ5BUbXDgO/xDh3O9Ts0WHRR1f9nAAA9
134+
w3MvSkvduQAAAABJRU5ErkJggg==
135135
</value>
136136
</data>
137+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
138+
<data name="star_black_ico" type="System.Resources.ResXFileRef, System.Windows.Forms">
139+
<value>star_black.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
140+
</data>
137141
<data name="star_bmp" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
138142
<value>
139143
Qk1yAgAAAAAAAHIBAAAoAAAAEAAAABAAAAABAAgAAAAAAAAAAAARCwAAEQsAAE8AAABPAAAAAAAA////
@@ -149,4 +153,7 @@
149153
EQQEECAxLQICAgICAgICNTk9OjMyAgICAgI=
150154
</value>
151155
</data>
156+
<data name="star_white_ico" type="System.Resources.ResXFileRef, System.Windows.Forms">
157+
<value>star_white.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
158+
</data>
152159
</root>

0 commit comments

Comments
 (0)