Skip to content

Commit

Permalink
add icons for dark mode
Browse files Browse the repository at this point in the history
there are still bugs in switching from light to dark mode
where the icons disappear for some reason.
  • Loading branch information
molsonkiko committed Aug 24, 2023
1 parent 0c93e42 commit d077fb6
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 12 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,24 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

- If there's a validation error inside of an `anyOf` list of schemas (i.e. JSON doesn't validate under *any* of the schemas), the error message is rather uninformative, and says only "the JSON didn't validate under any of the schemas", but not *why* it didn't validate.
- *(Note to future devs)*: Resist the temptation to fool around with the StringBuilder initial capacity for the ToString method of `Dtype.STR` JNodes. I tried, and it doesn't help performance.
- Mark dark mode icons that look less out of place

### To Be Fixed

- Improve Alt-key accelerators in forms. They don't seem to work right for some reason.
- When a tree viewer is refreshed using JSON from a file with a different name, the title of the docking form that the user sees doesn't change to reflect the new file. For example, a tree viewer is opened up for `foo.json` and then refreshed with a buffer named `bar.json`, and the title of the docking form still reads `Json Tree View for foo.json`.
- This is also true if a file with a tree viewer is renamed, e.g., the file `foo.json` is renamed to `bar.json`, but the tree viewer still says `Json Tree View for foo.json`.
- Fix problem where icons disappear when going from light mode to dark mode (until Notepad++ is closed; does not persist after restart)

## [5.7.0] - (UNRELEASED) YYYY-MM-DD

### Added

1. Toolbar icons for [JSON pretty-print, JSON compress](/docs/README.md#json-formatting), treeview, and [path to current position](/docs/README.md#path-to-current-position). Fix [issue 36](https://github.com/molsonkiko/JsonToolsNppPlugin/issues/36).

### Fixed

1. [Sort form](/docs/README.md#sort-form) previously did not follow Notepad++ styling on startup.

## [5.6.0] - 2023-08-18

Expand Down
1 change: 1 addition & 0 deletions JsonToolsNppPlugin/Forms/SortForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public SortForm()
InitializeComponent();
SortMethodBox.SelectedIndex = 0;
remesParser = new RemesParser();
FormStyle.ApplyStyle(this, Main.settings.use_npp_styling);
//OutputFormatBox.SelectedIndex = 0;
}

Expand Down
4 changes: 4 additions & 0 deletions JsonToolsNppPlugin/JsonToolsNppPlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@
<ItemGroup>
<!-- icons and such -->
<Content Include="Properties\star_bmp.bmp" />
<None Include="Resources\json tree toolbar1.ico" />
<None Include="Resources\json pretty print toolbar1.ico" />
<None Include="Resources\json path to position toolbar1.ico" />
<None Include="Resources\json compress toolbar1.ico" />
<None Include="Resources\json tree toolbar.ico" />
<None Include="Resources\json compress toolbar.ico" />
<None Include="Resources\json pretty print toolbar.ico" />
Expand Down
14 changes: 7 additions & 7 deletions JsonToolsNppPlugin/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,23 @@ static internal void CommandMenuInit()

static internal void SetToolBarIcons()
{
var iconInfo = new (Bitmap, Icon, int)[]
var iconInfo = new (Bitmap bmp, Icon icon, Icon iconDarkMode, int id)[]
{
(PluginNetResources.json_tree_toolbar_bmp, PluginNetResources.json_tree_toolbar, jsonTreeId),
(PluginNetResources.json_compress_toolbar_bmp, PluginNetResources.json_compress_toolbar, compressId),
(PluginNetResources.json_path_to_position_toolbar_bmp, PluginNetResources.json_path_to_position_toolbar, pathToPositionId),
(PluginNetResources.json_pretty_print_toolbar_bmp, PluginNetResources.json_pretty_print_toolbar, prettyPrintId),
(PluginNetResources.json_tree_toolbar_bmp, PluginNetResources.json_tree_toolbar, PluginNetResources.json_tree_toolbar1,jsonTreeId),
(PluginNetResources.json_compress_toolbar_bmp, PluginNetResources.json_compress_toolbar, PluginNetResources.json_compress_toolbar1, compressId),
(PluginNetResources.json_pretty_print_toolbar_bmp, PluginNetResources.json_pretty_print_toolbar, PluginNetResources.json_pretty_print_toolbar1, prettyPrintId),
(PluginNetResources.json_path_to_position_toolbar_bmp, PluginNetResources.json_path_to_position_toolbar, PluginNetResources.json_path_to_position_toolbar1, pathToPositionId),
};

foreach ((Bitmap bmp, Icon icon, int funcId) in iconInfo)
foreach ((Bitmap bmp, Icon icon, Icon iconDarkMode, int funcId) in iconInfo)
{
// create struct
toolbarIcons tbIcons = new toolbarIcons();

// add bmp icon
tbIcons.hToolbarBmp = bmp.GetHbitmap();
tbIcons.hToolbarIcon = icon.Handle;
tbIcons.hToolbarIconDarkMode = icon.Handle; //
tbIcons.hToolbarIconDarkMode = iconDarkMode.Handle;

// convert to c++ pointer
IntPtr pTbIcons = Marshal.AllocHGlobal(Marshal.SizeOf(tbIcons));
Expand Down
4 changes: 2 additions & 2 deletions JsonToolsNppPlugin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly: AssemblyVersion("5.6.0.1")]
[assembly: AssemblyFileVersion("5.6.0.1")]
[assembly: AssemblyVersion("5.6.0.2")]
[assembly: AssemblyFileVersion("5.6.0.2")]
12 changes: 12 additions & 0 deletions JsonToolsNppPlugin/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,36 @@
<data name="json_compress_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json compress toolbar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_compress_toolbar1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json compress toolbar1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_compress_toolbar_bmp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json compress toolbar bmp.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_path_to_position_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json path to position toolbar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_path_to_position_toolbar1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json path to position toolbar1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_path_to_position_toolbar_bmp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json path to position toolbar bmp.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_pretty_print_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json pretty print toolbar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_pretty_print_toolbar1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json pretty print toolbar1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_pretty_print_toolbar_bmp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json pretty print toolbar bmp.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_tree_toolbar" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json tree toolbar.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_tree_toolbar1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json tree toolbar1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="json_tree_toolbar_bmp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\json tree toolbar bmp.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
40 changes: 40 additions & 0 deletions JsonToolsNppPlugin/Properties/Resources1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file modified JsonToolsNppPlugin/Resources/json path to position icon.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified JsonToolsNppPlugin/Resources/json path to position toolbar bmp.bmp
Binary file not shown.
Binary file modified JsonToolsNppPlugin/Resources/json path to position toolbar.ico
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 changes: 9 additions & 3 deletions JsonToolsNppPlugin/Resources/json-tools icons.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ magick "object type icon.png" "object type icon.ico"
magick "string type icon.png" "string type icon.ico"
magick "null type icon.png" "null type icon.ico"

: add toolbar icons
: add toolbar bitmaps
magick "json pretty print icon.png" -resize 20x20 "json pretty print toolbar bmp.bmp"
magick "json compress icon.png" -resize 20x20 "json compress toolbar bmp.bmp"
magick "json path to position icon.png" -resize 20x20 "json path to position toolbar bmp.bmp"
magick "json tree icon.png" -resize 20x20 "json tree toolbar bmp.bmp"

: add toolbar bitmaps
: add toolbar icons
magick "json pretty print icon.png" -resize 20x20 "json pretty print toolbar.ico"
magick "json compress icon.png" -resize 20x20 "json compress toolbar.ico"
magick "json path to position icon.png" -resize 20x20 "json path to position toolbar.ico"
magick "json tree icon.png" -resize 20x20 "json tree toolbar.ico"
magick "json tree icon.png" -resize 20x20 "json tree toolbar.ico"

: add darkmode icons
magick "json pretty print icon.png" -resize 20x20 "json pretty print toolbar1.ico"
magick "json compress icon.png" -resize 20x20 "json compress toolbar1.ico"
magick "json path to position icon.png" -resize 20x20 "json path to position toolbar1.ico"
magick "json tree icon.png" -resize 20x20 "json tree toolbar1.ico"

0 comments on commit d077fb6

Please sign in to comment.