Help - Search - Members - Calendar
Full Version: Getting started with the latest ui_extension API
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
upNorth
I'm really struggling with the new ui_extension API. I actually managed to create a panel with the previous version, but now I'm totally lost. Ok, the last time I did actually do a whole lot of copy&paste and find&replace, but it worked, and I learned alot from it.

What I'm trying to do at the moment, is merging foo_static_panel and foo_vis_vu_meter to make a VU meter panel. The problem, is that I can't find anything useful to look at. It's jsut not enough consistency between different ui extensions. Either they're too different (toolbars vs panels, single instance vs multiple instance), or too simple or too complicated. There is just no simple panel that actually do something, but at the same time not everything imaginable.

I realize I'm probably in over my head here, and I'm not really familiar enough with the terminology either, but I'm sure I could make things work if I just had a plain and simple panel to look at. Having said that, foo_static_panel is just too simple, as it doesn't do anything that I find useful, and the "static" part of the name just adds to my confusion, as that is also a reserved word.

The favour I would like to ask instead of a posting alot of questions, is if anyone could just add a single button to foo_static_panel and make it perform one simple action. Like changing the text "moo" to "moomoo" or something. Just to show me how the resource file is utilized in combination with the new new ui_extension API (I don't really need this kind of interaction to make a vu_meter panel, but I think it would help anyway).

Two specific questions:
1) Most of the things foo_vis_vu_meter does, it does using "g_wnd" as a parameter (a window handle?), defined at the start of the code. I really don't see the equivalent in foo_static_panel. Meaning I need the link between the vu_meter code and my panel or something (what should I use instead of g_wnd?).

2) Should this be a toolbar or a panel? Or is visualizations it's own category? I'm talking about in the code, not just where it is placed in e.g. the context menu.

Some random thoughts/plans:
-I would like my panel to support multiple instances for future use.
-Not support dock/undock, as it complicates things.


If you've read this far, thanks! smile.gif Last but not least, I just want to state that I don't want anyone to provide me with the finished product (vu_meter_panel). I just need to get the basic structure of a multiple instance panel, with simple functionality, established.
foosion
A fairly simple, yet useful panel is the history toolbar in foo_history. The drawback is that it doesn't use a dialog template but a toolbar control.

QUOTE(upNorth @ Jan 31 2005, 12:42 AM)
1) Most of the things foo_vis_vu_meter does, it does using "g_wnd" as a parameter (a window handle?), defined at the start of the code. I really don't see the equivalent in foo_static_panel. Meaning I need the link between the vu_meter code and my panel or something (what should I use instead of g_wnd?).
*
Firstly, I'd advise you to use the UI extension implementation helper, in the create_window method you'd have to call the function that creates the VU meter dialog. You have to remove the border and make the dialog a child dialog in the resource editor, look at dialog templates for config pages, if you need an example.

QUOTE(upNorth @ Jan 31 2005, 12:42 AM)
2) Should this be a toolbar or a panel? Or is visualizations it's own category? I'm talking about in the code, not just where it is placed in e.g. the context menu.
*
Visualizations should be placed in the "Visualizations" category. As for the extension type, I'd make a visualization have both the TYPE_TOOLBAR and TYPE_PANEL flags, or only TYPE_PANEL if its height exceeds the normal toolbar height by a fair amount. The VU meter dialog template would not fit IMO; however if one would show only one of the bars without the labels below, then it would fit.

QUOTE(upNorth @ Jan 31 2005, 12:42 AM)
-I would like my panel to support multiple instances for future use.
*
Slightly more complicated, as you'll have to multiplex the visualization service. To do so, remove the global HWND variable, and replace it with a list of handles of active windows. Then update the windows in this list from the visualization class using uPostMessage.

QUOTE(upNorth @ Jan 31 2005, 12:42 AM)
-Not support dock/undock, as it complicates things.
*
Also not really needed IMO.
upNorth
Thanks so much for your answer. I wouldn't say I understand this now, but at least I think I'm getting closer to having a piece of code that will actually compile. Probably just to discover that it doesn't really work at all, as I'm struggling with how to create my window/dialog/toolbar/panel (as you probably understand, I don't really know what I'm doing, or what I'm looking for).

Anyway, at the moment I get the following error using your UI extension implementation helper:
CODE
error C2065: 'UET_TOOLBAR' : undeclared identifier

at this line
CODE
class toolbar_extension_history : public ui_extension_base_t< UET_TOOLBAR, UEM_MULTIPLE > {

Any idea?
foosion
There is a newer version of said helper class in recent versions of the UI extension API; among other things the names of some flags have changed.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.