-
Notifications
You must be signed in to change notification settings - Fork 205
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
Prettify Open popup menu #740
Comments
Not sure the impact of this change. |
I'm sorry. I forget that Notepad2 DPI aware program. static HBITMAP getBitmapForFile(LPCWSTR path)
} |
It seems more code is needed:
per https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setmenuitembitmaps. also create bitmap for each file looks slow when some of them have same extension. |
Ok! You are right. The solution: case WM_DESTROY: // New function.
} |
Another one variant with cache... The solution: case WM_DESTROY: struct BitmapCache { static HBITMAP getBitmapForFile(LPCWSTR path) {
} |
And one more thing... When you click in MRU popup menu at non existing file, Notepad offers to create new file. The solution: |
Committed the change as 2bdc014 with minor change to avoid use after free for MRU_DeleteFileFromStore(pFileMRU, path);
MRU_Delete(pFileMRU, index); |
Dear Zufu Liu! Will you add getBitmapForFile() function(cached variant) to Notepad2? |
Yes, but with 32 ( |
Hi @Sergy2001, can you give email and name to author the change? |
Committed the change as 361920b. |
Hello Zufu Liu! My name is Serg(in French manner) or Sergio(in Italian manner). You can use just Sergy. About transparency. Transparency: BITMAPINFO bmi = { sizeof(BITMAPINFOHEADER), bitmapSize, bitmapSize, 1, 32, BI_RGB, bitmapSize * bitmapSize * 4, { 0 } }; //bitmapHash->bitmap = CreateCompatibleBitmap(dcDesktop, bitmapSize, bitmapSize); // Cache bitmap. |
Use |
Solution. Comment lines in my function: add those: And it will work with transparency. I've already tried it. And it works. |
I mean some like following, the file icon in menu doesn't change back color to light blue on selecting like it in Windows explorer (or it's right click menu), it still has the
|
I understand what you mean. But in my build it works correctly. struct BitmapCache { static HBITMAP getBitmapForFile(LPCWSTR path) {
} |
…n menu, issue #740. Patch by @Sergy2001
Thanks Serg 👍, it works now. |
Thank you for your patience. |
Dear Zufu Liu!
Would you be so kindly to add this function:
static HBITMAP getBitmapForFile(LPCWSTR path)
{
HBITMAP bitmap = nullptr;
SHFILEINFO sfi = { 0 };
HIMAGELIST imageList = (HIMAGELIST)SHGetFileInfo(path, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_USEFILEATTRIBUTES | SHGFI_SYSICONINDEX | SHGFI_SMALLICON);
}
to Notepad2.c
And add line
SetMenuItemBitmaps(subMenu, i + IDM_RECENT_HISTORY_START, MF_BITMAP | MF_BYCOMMAND, getBitmapForFile(path), nullptr);
after (5350) AppendMenu(subMenu, MF_STRING, i + IDM_RECENT_HISTORY_START, path);
I hope It will prettify your Notepad2.
And please add snippets support?
Thanks.
The text was updated successfully, but these errors were encountered: