^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DEVELOPERS' WORKSHOP: Media Kit Basics: Muxamania Part 1:
  The Media Control Panel Application
By Owen Smith -- <orpheus@be.com>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This week I've cooked up one of several Media Kit goodies
that was requested at the BeDC. It's a node, completely
encapsulated in a media add-on, that allows you to select
one of several inputs to pass to the output.

This code works with the upcoming beta release, genki/5.
Go grab it from:

<ftp://ftp.be.com/pub/samples/media_kit/Selector.zip>

In this article, I'll illustrate how to create a simple UI
for the node. In the next installment, I plan to show you
how the node handles buffers and manages connections.

In Selector, I want users to be able to select the input
they want routed to the output. But, since the acrid smoke
from BeDC preparations still hasn't cleared from my Kube, I
don't want to spend a lot of time working on the UI. I'm
looking for the simplest fire-and-forget mechanism I can
come up with.

In this case, BMediaRoster::StartControlPanel() is
definitely the answer. It's designed to take care of all
the details of running a UI for our node, with no sticky
residue. Unless your node says otherwise, StartControlPanel
simply launches your add-on as an application. The ID of the
node that you're editing will be passed to the newly
launched application as a command line argument.

There's one piece that is left for you, the add-on writer,
to fill in: you must determine what the add-on does once
it's launched. Generally, this involves displaying a window
containing controls for editing the node.

I've created a simple class to do most of the work for you:
MediaControlPanelApp. This BApplication-derived class does
the following:

* It parses the command line to get the node IDs that will
  be passed to it, and launches control panels for each of
  the nodes it's editing.

* It keeps track of all currently running control panels,
  and quits when all control panels have been closed.

* It provides a virtual function CreateControlPanel() (not
  related to BMediaRoster::StartControlPanel()!) which
  gets called when a new control panel must be created for
  a node. By default, it creates a simple window that
  shrinkwraps around the default media theme's view for
  the node. However, you can override this function to
  create custom BWindows for your own kinds of nodes if
  you wish.

Now, what does it take to get this awesome functionality in
your add-on?

int main()
{
	MediaControlPanelApp app;
	app.Run();
	return 0;
}

.. Not too much, I guess.

In conclusion, I'd like to extend greetings to all of the
developers I managed to meet in person at the BeDC. Even
jacked up on a week's worth of Dew and adrenaline, I somehow
managed to relax a bit (especially after the presentations
were over!), and it was a singular treat for me to hang out
with you, the people that make this job really worthwhile.
