Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make metapath DPI Awareness #46

Closed
zufuliu opened this issue Aug 31, 2018 · 37 comments · Fixed by #604
Closed

Make metapath DPI Awareness #46

zufuliu opened this issue Aug 31, 2018 · 37 comments · Fixed by #604

Comments

@zufuliu
Copy link
Owner

zufuliu commented Aug 31, 2018

No description provided.

@CzBiX
Copy link

CzBiX commented Oct 17, 2019

Not a win32 developer, but can it be fixed by one line build configuration?

@zufuliu
Copy link
Owner Author

zufuliu commented Oct 17, 2019

metapath currently use

<gdiScaling>true</gdiScaling>

https://docs.microsoft.com/en-us/windows/win32/sbscs/application-manifests#gdiscaling

Any way, Notepad2 and metapath don't have high-DPI image resources (except for metapath's toolbar, see issue #89).

@zufuliu zufuliu added Hi-DPI 📂matepath ui 🌐i18n Localization/Internationalization labels Jan 7, 2023
@zufuliu zufuliu added this to the v4.23.03 milestone Jan 9, 2023
@zufuliu zufuliu pinned this issue Jan 9, 2023
@zufuliu
Copy link
Owner Author

zufuliu commented Jan 9, 2023

A rough workflow (no time limit) to implement this and fix blur toolbar and file list on 4K monitor:

zufuliu added a commit that referenced this issue Jan 10, 2023
@zufuliu
Copy link
Owner Author

zufuliu commented Jan 11, 2023

@Matteo-Nigro you can make other sized toolbar bitmap in recent days, I'm planing to port DPI awareness code after Spring Festival (in February), thanks.

@Matteo-Nigro
Copy link
Contributor

Ok, would we practically have to use the svg to create the various pngs in the right size? Would the dimensions be the same as we used for Notepad2?

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 11, 2023

Yes just use exiting svg in images/metapath folder (you could redesign them when feel it's better). dimensions are same with Notepad2 (currently only 16x16). make_all_metapath_toolbar_bitmap() is already for use.

@Matteo-Nigro
Copy link
Contributor

Perhaps some of the icons could be taken from among the new ones in Notepad, just to give linearity in the style of the rest the existing ones might be fine already...

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 11, 2023

Yeah, give two app same icon style is good, metapath's current icon were built from Visual Studio 2017 Image Library in issue #89.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 11, 2023

@Matteo-Nigro I'm sorry, just realized that Hi-DPI toolbar image is not required for porting DPI awareness code (that's how Notepad2 was developed in the past with the only 16px image), they are only needed for testing on 4K monitor after @WanderMax is back from Spring Festival (in February), so you can relax and make these images in recent weeks (or just in February as here still have enough time for v4.23.03).

Following are some incomplete suggestions if you are going to make same styled icon as Noteapd2 and use existing Notepad2's svg:

  • Use better image name than current unchanged Visual Studio Image Library name, e.g. from toolbar tooltip string table:
    https://github.com/zufuliu/notepad2/blob/f7e5396cdcf8f3acda4ac64d035e5755c092923d/metapath/src/metapath.rc#L491-L506
  • Place svg directly into images folder instead of images\metapath folder (it will be renamed to images\metapath_v1 after move out metapath.svg, and only used for backup v1 toolbar image made by @rmarquis in issue metapath icon are ugly #89). exported png also directly goes into images\16x16, images\24x24, etc. folders.
  • Current make_metapath_toolbar_bitmap() will be renamed as make_metapath_v1_toolbar_bitmap() with images = f'images/metapath/{size}x{size}' changed into images = f'images/metapath_v1/{size}x{size}'. so you need to copy it as make_metapath_toolbar_bitmap() and change images = f'images/metapath/{size}x{size}' to images = f'images/{size}x{size}' (similar to make_notepad2_toolbar_bitmap(size)) and update image names in the array.
  • Please at me, when you finished icon design, so I can do these renaming and code changes for you.

@Matteo-Nigro
Copy link
Contributor

OK I'll start preparing the work and let you know when I'm ready. 😉

@Matteo-Nigro
Copy link
Contributor

Hi @zufuliu , I was checking that among the icons in the various folders of both notepad2 and metapath there seem to be some that are not used... While I'm sorting out the files, should I delete them?

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 13, 2023

Please list used files you found, so we can discuss them.

@Matteo-Nigro
Copy link
Contributor

For metapath are used all except these that do not appear in the toolbar:

  • DeleteFilter.svg
  • RestoreFromRecycleBin.svg

In Notepad2 I found these icons perhaps superfluous:

  • OpenFolder_16x.svg and .png -> Replaced by Open.svg
  • pin-angle.svg and pin-angle-16x.png-> Replaced by AlwaysOnTop.svg
  • Prev2_16x.svg and .png -> Not used in the toolbar

@Matteo-Nigro
Copy link
Contributor

In the meantime I redid all the icons even the ones maybe not needed.... Some being identical to those in Notepad2 I reused them keeping the filename used in Notepad2 so as not to have 2 files the same but named differently just to adhere to the metapath description. I have already exported the pngs in the various sizes as well, so I could potentially be ready for the next step..

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 13, 2023

all _16x.svg were taken (or modified from) from Visual Studio Image Libaray 2017 (including all metapaths' toolbar images).

DeleteFilter.svg is in use (see make_matapath_toolbar_bitmap()), RestoreFromRecycleBin.svg is indeed unused (just used to make RecycleBin.svg).

OpenFolder_16x.svg is used for generate res\OpenFolder.bmp (for both Notepad2 and metapath, e.g. on Notepad2's "Tools -> Run Command" or "File -> Launch -> Command" dialog), so the bmp needs regenerating and test on the dialog.

Prev2_16x.svg and Next2_16x.svg is used for res\Prev.bmp and res\Next.bmp (used on Customize Schemes dialog), you can make new svg (e.g. Prev.svg and Next.svg) to be used as replacement, so we can get ride of Visual Studio Image Libaray (to reduce one third party license, then no need to make metapath_v1 backups) after metapath's new toolbar images (and replacement svg, ) been committed (note: Bookmark_16x.svg and Bookmark2_16x.svg are unused).

I will add a commit to delete Bootstrap's pin-angle.svg, pin-angle-16x.png and the license text later.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 13, 2023

OpenFolder_16x.svg, pin-angle.svg, Bookmark_16x.svg and Bookmark2_16x.svg (and their corresponding png) removed by 4da008c.

@Matteo-Nigro
Copy link
Contributor

Hi @zufuliu , do you think I can reuse the back and forward icons of metapath also for Notepad2 or vice versa? On the other hand it is still 2 arrows only represented in a different style. This would allow us to delete 2 more files.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 14, 2023

Resue is good, but please post a screenshot here to see result on Scheme Settings dialog. current Prev.bmp and Next.bmp are very small (they have color depth 4) and scale well on large scaling settings (you can change your monitor's scaling settings and compare the scaled result).

@Matteo-Nigro
Copy link
Contributor

Certainly before any changes are made, I will update you with a comment here. I am sure I can achieve a good result while keeping the weight the same. As soon as I have a moment today I'll do the tests and post the screenshots.

@Matteo-Nigro
Copy link
Contributor

Matteo-Nigro commented Jan 16, 2023

Hi @zufuliu, I will probably upload the screenshots today...I got ahead of myself with other things as well. Only question, in the Customize schemes window (in Notepad2) it seems that the buttons can't accept bmp of size other than 16x9. I should have them take 16x16 instead.... I've tried changing the button size from the .rc file but the image still doesn't display... do you have any ideas?

image

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 16, 2023

Maybe other thing (likely the bmp it self) is wrong:
next-style

https://github.com/zufuliu/notepad2/blob/924eb78fa9ced17531e5a1dc372c909a9365945d/src/Styles.c#L4186-L4187

with MakeBitmapButton(hwnd, IDC_NEXTSTYLE, g_hInstance, IDB_OPEN_FOLDER);

You can just use the 32-bit bmp here and see if it works, then use MS Paint to save the png as 16-bit bitmap and try again.

@Matteo-Nigro
Copy link
Contributor

I had saved the bmp at 4bit as you had done to limit the weight.. I'll try other colour depths.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 16, 2023

@Matteo-Nigro seems it's my fail, it's bit depth 4 and 16 color bitmap.
Paint-SaveAs-4Bit-16Color

save "Prev2_16x.png" and "Next2_16x.png" with MS Paint as 16 color bitmap should produce same bitmap as res\Prev.bmp and res\Prev.bmp.

@Matteo-Nigro
Copy link
Contributor

Thanks @zufuliu! As promised here's the screenshot of the new metapath toolbar and how the buttons I mentioned before look like using the icons already present. If you like them I will continue with the work and give you the PR.

image

P.S. I would say that the python script should be ok too I had to modify it for the new paths and icon names.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 17, 2023

@Matteo-Nigro Looks OK to me 👍
seems there still have some images from VS Image Library.

@Matteo-Nigro
Copy link
Contributor

Yes some of the icons have been only slightly tweaked and they look pretty much like the originals.... If we want to totally get rid of the licenses I can try to change them a little bit to get away from the originals... What icons do you suggest to vary?

@Matteo-Nigro
Copy link
Contributor

Matteo-Nigro commented Jan 17, 2023

I was thinking in the meantime (since they practically mean the same thing) to merge the Launch and Run icons into one, this would not only reduce the number of icons but also change their appearance.

Launch

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 17, 2023

If redesign takes time, then we can just keep them (as it's free), current Prev.bmp and Next.bmp scales well than the thin arrows in your screenshot.

Run (on the Run dialog for both Notepad2 and metapath) is terminal (command prompt) + busy/wait cursor, if it's hard to made, use the triangle Run image is fine.

@Matteo-Nigro
Copy link
Contributor

It wouldn't take too much time so much small changes can significantly change the icon making it for all intents and purposes different... For Prev.bmp and Next.bmp I can try making the lines thicker and see how they react to different sizes...

For the Run and Launch icon I put in my previous comment (which I later edited) a proposal of what a merger of the 2 icons might look like. Otherwise we can leave them as they are or if you have ideas I can design it....

Other than that since you were thinking of changing the folder tree regarding images, could you already do that in the branch develop? Otherwise if I do the PR there is a risk that there are redundancies or duplicate images (given the different paths)

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 17, 2023

OK, Launch image (already a terminal) can be used to replace the triangle Run (metapath's toolbar) and Run.ico in both.
Prev.bmp and Next.bmp can be kept as is (without change at the moment, as we still use VS Image).

following is current image folder structure in develop branch:
images-dev

I think to make the PR minimum, images only used by metapath still put into images\metapath folder, images used by Notepad2 still put into images folder, unused images in images\metapath folder (both svg and png) can be deleted. make_metapath_toolbar_bitmap() need updated to take images from both images\nxn (for shared images) and images\metapath\nxn folders.

@Matteo-Nigro
Copy link
Contributor

Well @zufuliu, I remain possibly available if there is anything to be fixed....:muscle:

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 17, 2023

@Matteo-Nigro Thank you, I'd say metapath's toolbar image resources is done. probable you can work on issue #585 (e.g. replace Run.ico with a small one made from 32x32\Launch.png, following is a 4KiB Run.ico!).
Run

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 18, 2023

Loading toolbar image for current DPI and auto scale toolbar image implemented by c7b580f. It's still unknown whether file list icon blur is fixed or not (Notepad2's "Recent File", "Select Scheme" and "Customize Scheme" dialogs may have same problem on 4K monitor).

@Matteo-Nigro, @WanderMax, @elfsimulate please help test latest metapath built from develop branch when you have time, thanks.

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 30, 2023

Hi @WanderMax, is latest version (e.g. at https://github.com/zufuliu/notepad2/actions/runs/4043139548) of metapath works on your 4K monitor?

@WanderMax
Copy link
Contributor

metapath main UI looks pretty good now, file list and toolbar is sharp and clean as below
image
icon in metapath options needs HD remastered
image
image

@zufuliu
Copy link
Owner Author

zufuliu commented Jan 30, 2023

@WanderMax thank you 👍, old style icon on dialog is tracked in issue #585.

@elfsimulate can you take time to test latest metapath (e.g. from https://github.com/zufuliu/notepad2/actions/runs/4043139548) on two monitors (check whether toolbar is disappeared on moving between them)?

@VoilierBleu VoilierBleu linked a pull request Jan 30, 2023 that will close this issue
@zufuliu
Copy link
Owner Author

zufuliu commented Jan 31, 2023

develop branch is merged into main, further development will be on main branch.

@zufuliu zufuliu unpinned this issue Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants