One recurrent need among those who want to customize their Media Center interface is the need to change the start menu. Some menu items need to go, others have to be re-ordered, etc… the Personalize every Label section of this documentation already explained how to rename the menus by changing their corresponding string. In this page, you will learn how to make much more with these menus.
The Built-In Start Menu
The default start menu of Media Center consists of several entries such as Movies, Pictures, Music and Sports. Various add-ons such as MyMovies and TotalMedia Theatre can also add their own menu strip in there to simplify access to their own features. Overall, the start menu of Media Center is easy to use, pretty much complete, and tends to make people like Media Center in the first place. However, despite its many qualities, flexibility is somewhat lacking: users can’t re-order the default (built-in) menu items or hide the ones they don’t want to see. As you probably guessed already, this is where Media Center Themer can be of help.
In the schema’s documentation, take a look at the MediaCenterThemer\StartMenu\Builtin element. You’ll notice that it contains named elements for each of the built-in menus of Media Center: Extras, Movies, Pictures, etc… most of these elements can also include a collection of MenuItem sub-elements that identify individual items in each of the menus (for example, Pictures as PictureLibrary, PlayFavorites, VideoLibrary, etc…). Here are the two main attributes that can be defined for each of these elements:
- Visible: true by default, If set to false, the menu or menu item will be removed from the start menu. Note: this attribute can’t be used to force show a menu hidden by Media Center itself (for non-supported features on a given system).
- Order: a number between 1 and 100. If specified, the menu or menu item will be re-organized according to this value.
Here’s an example of code taken from Sample 5 that shows how all this translated in the real world:
<StartMenu> <Builtin> <Extras Visible="false"/> <Music Order="2"/> <TV Order="1"/> <Tasks> <MenuItem Name="Shutdown" Visible="false"/> <MenuItem Name="Settings" Visible="false"/> <MenuItem Name="Synchronize" Order="1"/> </Tasks> </Builtin> </StartMenu>
Let’s see how it works: first, the Extras menu is hidden using the Visible attribute. Then, the position of the Music and TV menus is changed using the Order attribute. As you can see, TV will be displayed first, Music will be displayed second. Any other menu that does not include an Order attribute will be displayed in its original order, following all the menus that have been modified with Order. That means that the position of Music could be set 2 or 20, it wouldn’t change the fact that, in our example, it would be displayed second. If you want to completely re-order the start menu, you’ll need to specify a new order value for each of the menus or menu items that are in it.
The Tasks menu is kept visible and at its original position, however, its sub-menu items are modified. <MenuItem> elements also have a Visible and an Order attribute, in addition to a mandatory Name attribute that identifies each menu item individually. The list of allowed values for this attribute varies with each menu and is listed in the schema’s documentation. In the example, above, both the Shutdown and Settings entries are hidden and Synchronize is moved in front of everything else on the line. If you want to re-order the menus added by external add-ons, use <Addon1> to <Addon5> in the Builtin list. These elements work the same way as the others such as <Music>, except that their sub-menu items can’t be modified individually.
This simple set of attributes allows you to entirely re-organize your start menu. if you’re interested in theming menus, you should take this opportunity to experiment with that code before moving on to other subjects.
Adding a New Menu Strip
Now that you know how to move things around in the start menu, let’s see how to add your own entries into it. Take a look at the sample of code below:
<StartMenu> <Builtin></Builtin> <Custom Title="My Theme Menu"> <MenuItem Name="Display web site" HideToolbar="true"> <Image>Logged Resources\ehres.dll\rcdata\SKITTLE.BOTTOM.PIECE.PNG</Image> <Link>http://www.patchou.com/projects/media-center-themer/</Link> </MenuItem> <MenuItem Name="Launch calculator"> <Image>Logged Resources\ehres.dll\rcdata\STARTMENU.QUICKLINK.PICTURES.PLAYFAVS.FOCUS.PNG</Image> <Program>%windir%\system32\calc.exe</Program> <PlayingDirective>pause</PlayingDirective> </MenuItem> </Custom> </StartMenu>
Custom menu items can do two main things: launch external programs, and display web pages inside Media Center. A third, more advanced option also allows you to execute any add-on-defined entry-point (see below). In the example above, the first menu item demonstrates how to show a web page. This can be particularly useful to access a web site on your internal network for various reasons (video content, security/camera monitoring, etc…). It’s a quick and easy way to extend the features of Media Center. The second menu item launches the Window’s calculator program and pauses the video/music that may be currently playing. When the program terminates (in this case, when the user closes the calculator), Media Center Themer automatically restores Media Center’s own window to its original position. Thanks to a proxy created specifically for this purpose, you can also use batch files (.bat) or any other script that does not requires user-interaction to execute more than one program at a time.
The Custom element of StartMenu is defined with a single attribute: Title. As its name implies, the Title attribute defines the label of your new menu strip. If you’re wondering how this menu will be ordered, consider Media Center Themer as working like any other add-on installed. To change the order of that menu, you’ll need to edit one of the Addon sub-elements of Builtin (see above). For now, let’s concentrate on the MenuItem elements shown in the example. Here is a list of their main attributes and elements:
- Name attribute: label used to display the menu item in the start menu.
- Image element: path to a picture file used to represent the menu in the start menu.
- Link element: URL of an http web page to display when the menu item is selected.
- Program element: path to a local executable file to launch when the menu item is selected.
Customize your New Menu
The four values presented above will allow you to add most of what you want to add into Media Center’s menu. Note that in that code sample, the pictures used for the menu items come from resources extracted from Media Center, as seen in the Change the Pictures page. In real scenarios, you’ll want to use pictures bundled with your own XML theme file. If you launch Media Center with this data, you’ll see a new "My Theme Menu" menu in the main list, with two sub-menu items. As for the ordering of the menu-items, they’re simply added in the same order as they are listed in your XML file.
If you feel like doing more with your menu items, here’s a list of additional attributes and elements you can use:
- HideToolbar attribute: when used with a link to a web page, the navigation toolbar normally displayed at the bottom right corner of the screen is hidden.
- ImageInactive element: Media Center will automatically generate a “grayed-out” version of the picture you specify in Image. If you want to specify your own, use this element.
- PlayingDirective element: can be set to “close”, “pause”, “stop” or “mute”. That command that will be sent to Media Center to affect the currently playing media when the menu item is selected.
- Addin and AddinContext elements: a special value used to send a command to any other installed add-in. For advanced users only.
Remember that Link, Program and Addin are all mutually exclusive. As always, you can find the full list of elements and attributes, with proper documentation, in the schema’s documentation. Always refer to it and, when possible, use a proper XML editor to validate your file. This will save you long hours of bug tracking. If you have more time to do some reading and you have mastered every other subjects covered by this documentation, the final User-Interface section of this documentation will keep you occupied for a while.