![]() |
#1 |
Junior Member
Join Date: Aug 2022
Posts: 20
|
Skin support for plugin window controls
Hello! I am writing my own plugin. It creates own window. The resource dialog fits nicely into the new window. But here is the problem - all controls do not have a skin support:
How to fix it? |
![]() |
![]() |
![]() |
#2 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
I'm assuming you've already checked the source code for the example embedded window plugin here: http://forums.winamp.com/showthread.php?t=322114
If you can, post your source code in a zip or 7z archive so I can see if I can find any obvious errors. |
![]() |
![]() |
![]() |
#3 | |
Junior Member
Join Date: Aug 2022
Posts: 20
|
Quote:
But all I could find was the need to handle messages of embedded dialog proc like this: code: Now it works correct. Is everything right here? ![]() Another one offtopic question: I added the plugin menu item to Winamp main menu using InsertMenuItem() function with text and shortcut: code: By handling WM_COMMAND I process menu click. And it works. But when I press Alt+B shortcut associated with menu item - nothing happens. How to fix this? |
|
![]() |
![]() |
![]() |
#4 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
I could have SWORN I downloaded that example plugin a long time ago but I still can't find it.
However, you can use the following for an example: http://forums.winamp.com/showthread....83#post3215083 It should have everything you need to learn standard skinning support. It also contains an example for shortcut handling. Unfortunately, there is no native skinning support for radio buttons and checkboxes. Your edit box doesn't look right. Before going on a tare, check the example I provided for that. |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Aug 2022
Posts: 20
|
thinktink, thanks for example!
I have added this code: code: on init(): code: except WASABI_API_CREATEDIALOGW I still use: CreateDialogParam(... code: code: But when I press Alt+A nothing happens. Hotkey not work. Maybe I something missed? |
![]() |
![]() |
![]() |
#6 | ||
Junior Member
Join Date: Aug 2022
Posts: 20
|
Another one question: thinktink, your project compiled succesfully, but when I try to compile my project compiler throws error:
Quote:
Quote:
![]() |
||
![]() |
![]() |
![]() |
#7 | |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Quote:
I do it with: code: |
|
![]() |
![]() |
![]() |
#8 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Have you subclassed the Winamp main HWND and checking WM_COMMAND/WM_SYSCOMMAND in there or are you checking inside your own embed wnd's DlgProc instead? If you can't subclass Winamp's main HWND then you can also check inside a Windows Hook (see SetWindowsHookEx in the MSDN for usage).
|
![]() |
![]() |
![]() |
#9 | |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Quote:
Open "gen_yourplugin" Property Pages Select: All Configurations Go to: Configuration Properties -> C/C++ -> General Inspect "Additional Include Directories" and make sure the subfolders in the Winamp SDK folder labeled "Wasabi", "Agave", and "Winamp" are being included. |
|
![]() |
![]() |
![]() |
#10 | |
Junior Member
Join Date: Aug 2022
Posts: 20
|
I didn't generate value for MY_PLUGINMENU_ID. Just assign a value:
code: Quote:
![]() code: instead of: code: I also made a mistake here ![]() code: instead of: code: But I found a bug in your code too ![]() code: At this moment, the GetWindowLongPtr() function will return 0x00 because the parent window no longer exists. You can verify it using debugger. Therefore, this code should be moved to the parent window's dialog proc into the WM_DESTROY handler. But now it's time to return to the main question of the topic. I opened your "gen_classicart" project and edited the resource dialog: I placed some controls - button, text label and a edit control. Compile and run it in Winamp: ![]() It looks like skin support isn't working for controls. I didn't modify source code except GEN_INIT_FAILURE replace with 1 (I didn't find a definition). So how to theme the controls? |
|
![]() |
![]() |
![]() |
#11 | |||
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Quote:
Quote:
Trying to "unsubclass" a shared window is problematic at best as not all plugins are guaranteed to be loaded and unloaded in the correct order to prevent subclass procedure chain breaks, which is very bad. If your subclass proceedure is unloaded (by dint of your plugin being unloaded) before the window it's connected to is destroyed it will cause Access Violations when the (now non-existent) procedure is called. Quote:
PHP Code:
PHP Code:
|
|||
![]() |
![]() |
![]() |
#12 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Found it!
I finally found the example package.
Attached. |
![]() |
![]() |
![]() |
#13 | |||
Junior Member
Join Date: Aug 2022
Posts: 20
|
Thanks!
Quote:
Quote:
![]() It's weird but I downloaded Winamp SDK 5.5 from here https://download.nullsoft.com/winamp...WA5.55_SDK.exe and Winamp/gen.h file contains only #define GEN_INIT_SUCCESS 0. While looking through your code and using the debugger, I found another one bug. Looks like it's a winamp bug. Look at this code: code: As I marked, this block runs 4 times when track changing or when you press ffwd/rwd. I think you need to handle another notification to monitor the track change. Offtopic. In Visual Studio 2012 I set configuration to "Release" and compiled my plugin dll. But Winamp loads it only on my PC. I sent it to another PC and also tried it on a virtual system using the latest Winamp, but in these cases Winamp doesn't load my plugin. In the "Preferences" window I see "NOT LOADED" message. And log file \AppData\Roaming\Winamp\winamp.log contains error: Quote:
What other project settings do I need to set to compile my plugin to distribute it on other PCs? |
|||
![]() |
![]() |
![]() |
#14 | ||||
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
You're welcome.
Quote:
It's definitely an improvement but not entirely correct, it looks like there's a white border around what looks like edit controls, which is not part of the selected skin. The checkboxes also aren't completely skinned, but as I said before, there's currently no native support for skinning checkboxes or radio buttons. Quote:
PHP Code:
Quote:
Quote:
|
||||
![]() |
![]() |
![]() |
#15 | |||
Junior Member
Join Date: Aug 2022
Posts: 20
|
Quote:
On my last screenshot I overridden its WM_PAINT handler and did ownerdraw checkbox painting. Should it look different? How? Quote:
I used code to get skin HBITMAP and save it to file: code: And skin HBITMAP contains this: ![]() As we can see, there glyphs for push-button and scrollbar are only. By the way, where is this image stored? In what file? I looked through all the graphic and resources files in the Winamp folder but didn't find these glyphs. Quote:
![]() Here we can see specific themed borders at the bottom and right side of EDIT control. I tried to change the styles of the control, but I could not get such borders. Is the source code of Jump to File plugin available? I can't find it. I would be able to see the implementation of the edit control. |
|||
![]() |
![]() |
![]() |
#16 | |||||
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|||||
![]() |
![]() |
![]() |
#17 | |||
Junior Member
Join Date: Aug 2022
Posts: 20
|
Why?
What is the toggle buttons? Quote:
Quote:
code: But it doesn't look like it in Jump to File window: ![]() As you can see there is no bottom and right side borders. I also noticed that button with BS_OWNERDRAW style flickers when switching between the plugin window and the main window and back. I also have set the WS_CLIPSIBLINGS and WS_CLIPCHILDREN styles for the button's parent window (i.e. for the dialog). But with this: code: or with this: code: button flickers: ![]() However, in the JTF plugin window, the buttons do not blink! However, despite the fact that JTF's buttons have BS_OWNERDRAW style, their parent window (dialog) does not receive WM_DRAWITEM message (I see it in Spy++). But why?? According to documentation: Quote:
|
|||
![]() |
![]() |
![]() |
#18 |
Junior Member
Join Date: Aug 2022
Posts: 20
|
Ok, so how do I get or calculate the text color for an inactive button?
For example, for a Bento skin the inactive text color should be: 91, 94, 95: And for Winamp Modern Skin - 147, 149, 155 I checked all colors that WADlg_getColor() function returns. There is no such colors! Also I checked the contents of the skin bitmap (IPC_GET_GENSKINBITMAP). There is no such colors also. It's like the text color for an inactive button is calculated by some formula. I found the formula inside wa_dlg.h file: PHP Code:
fg = 210, 210, 210 bg = 51, 55, 56 colour = (210+51)/2, (210+55)/2, (210+56)/2 = 130, 132, 133 When DrawText() with this color, then we will see: ![]() Similarly for Winamp Modern: fg = 255, 255, 255 bg = 127, 135, 149 colour = (255+127)/2, (255+135)/2, (255+149)/2 = 191, 195, 202 When DrawText() with this color, then we will see: ![]() As you can see, this is an incorrect calculation formula. For example in JTF plugin inactive buttons has the correct text color. So how do you calculate the correct color values for inactive text? |
![]() |
![]() |
![]() |
#19 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
I'm working on an unauthorized update to the example plugin originally created by DrO with skinned controls and menus. It should answer a number of questions. Just need a little time.
|
![]() |
![]() |
![]() |
#20 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Hope this helps... |
![]() |
![]() |
![]() |
#21 |
Junior Member
Join Date: Aug 2022
Posts: 20
|
Despite some errors in your code, the principle of skinning the controls is clear.
In short, in order to skin the controls, the developer needs to either draw them completely (owner drawing) or use a wrapper functions from wa_dlg.h, or request the API of the media library plugin to perform the skinning of the controls. I also noticed that when using Media library API you must also use the WADlg_DrawChildWindowBorders() function for drawing borders, because Media library API does not draw it. It's strange that drawing borders is not part of skinning support of the Media library API. To perform skinning of the edit control, I tried to use the media library API: PHP Code:
As you can see the required bit SWS_USESKINFONT is set. ![]() The only way to set the correct font for an edit control is to create a font and set it with WM_SETFONT for Edit control and not set SWS_USESKINFONT bit in mlsw.style. I just don't understand why SWS_USESKINFONT bit doesn't work. |
![]() |
![]() |
![]() |
#22 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
If you can, please mark the errors so that I can correct them.
|
![]() |
![]() |
![]() |
#23 |
Junior Member
Join Date: Aug 2022
Posts: 20
|
I tested your plugin (embedded window) and found that WADlg_DrawChildWindowBorders() function draws wrong borders for edit control. It draws one extra pixel:
![]() To fix this I changed the WADlg_DrawChildWindowBorders() function code a bit: PHP Code:
For my purposes I have fixed it. Also when switching the focus between winamp windows, the edit control's borders are flickers. Combobox cannot have a style CBS_DROPDOWNLIST because winamp doesn't skin the combobox's button. It should be set CBS_DROPDOWN style instead. PHP Code:
|
![]() |
![]() |
![]() |
#24 |
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Version 1.3 (unauthorized) now available.
Changes:
Attached. |
![]() |
![]() |
![]() |
#25 | |||
Forum King
Join Date: May 2009
Location: No longer on the streets of Kings County, CA.
Posts: 3,219
|
Quote:
Quote:
Quote:
Fixed in version 1.3. Thank you. |
|||
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|