Patchou's Cabana

The personal blog of Patchou

MCT Documentation – Logging and Settings

< back to Media Center Themer’s documentation index

This page should answer some of the remaining start-up questions you may have about this
software and prepare you to do more with the themer in following help
sections. There’s not much to it anyway and you can always contact me directly or on forums if you need more information. After that, the remaining sections will show you how to change Media Center’s resources such as strings ands menus.

Use the Log Luke

One file that’s not yet been covered in this documentation is called MediaCenterThemer Log.txt. You’ll find it in the same directory as the configuration and schema files (%PROGRAMDATA%\Media Center Themer). It is generated every time Media Center is run on your computer and can be used for two reasons: detect problems with Media Center Themer and find out about text color/attributes in use in Media Center. Here is a quick example of what the log file looks like:

0430 11/04/08 15:41:40| ---- Session started ----
0430 11/04/08 15:41:40| Loading themer dll
0430 11/04/08 15:41:40| Process launched (x64): "C:\Windows\ehome\ehshell.exe" 
0430 11/04/08 15:41:40| Theme loaded successfully from "C:\ProgramData\Media Center Themer\MCTDefault.xml"
0430 11/04/08 15:41:40| Initialization was a success
0430 11/04/08 15:41:42| [diagnostic] Text format in use: RGB(151,217,255), 44pt, "Segoe Media Center Light"
0430 11/04/08 15:41:42| [diagnostic] Text format in use: RGB(242,242,242), 44pt, "Segoe Media Center Light"
0430 11/04/08 15:41:42| [diagnostic] Text format in use: RGB(242,242,242), 23pt, "Segoe Media Center"
0430 11/04/08 15:41:48| [diagnostic] Legacy string color in use: RGB(151,217,255)
0430 11/04/08 15:41:48| [diagnostic] Legacy string color in use: RGB(242,242,242)
0430 11/04/08 15:41:52| Unloading themer dll
0430 11/04/08 15:41:52| ---- Session ended ----

The “Session started” line will appear every time Media Center is started. It will be followed by different kinds of informative messages: the ones that should interest you the most are those prefixed with “[diagnostic]“. As you’ve seen in this documentation, Media Center Themer heavily relies on pre-existing conditions to do its work and you may have wondered how you’re supposed to know that a specific text is displayed with a color such as rgb(151,217,255) : well, wonder no more :-). While running, Media Center Themer logs all the different combinations of text formatting that Media Center uses to display something on screen. For that reason, the log file should be your first source of information while theming Media Center, especially if you want to do a good job and do specific customizations here and there to ensure your theme is at its best.

In the log above, you can see that the first 3 diagnostic lines start with “Text format in use:”. These parameters can be used as conditions in the Text sub-elements of TextFormat in your configuration file and were logged when the welcome screen of Media Center was displayed. To generate this example, I then entered the general settings of Media Center which caused the next 2 diagnostic lines to be generated. Because the text is located in the settings pages of Media Center, the lines start with “Legacy text color in use:” which is an indication that you’ll have to add your conditional attributes in the LegacyText sub-elements of TextFormat to change the color of this text.

When a window from an add-on is displayed, you’ll see something like that in your log:

1f98 11/04/08 15:56:13| Process launched (x64): "C:\Windows\eHome\ehExtHost.exe" 11128 d70f6e30-0cec-4ea2-9166-9f8e83ee0880 3 False
1f98 11/04/08 15:56:14| [diagnostic] Text format in use: RGB(2,166,212), 48pt, "Segoe Media Center Light"
1f98 11/04/08 15:56:14| [diagnostic] Text format in use: RGB(2,166,212), 19pt, "Segoe Media Center"
1f98 11/04/08 15:56:14| [diagnostic] Text format in use: RGB(242,242,242), 18pt, "Segoe Media Center Semibold"

Notice the very first piece of text at the beginning of the line: “1f98″. It uniquely identifies each of the different processes launched by Media Center. You can use it as an indication that a given text format was generated by an add-on and not the main Media Center process. If that doesn’t mean much to you, don’t worry: text formatting is defined the same way for Media Center and all its add-ons, you don’t need to create special entries in your configuration file for add-ons that use colors already used by Media Center itself. When the conditions defined in aText element match the text displayed anywhere in the software, new attributes will be applied whether the text is coming from Media Center or any third party add-on (provided of course that the add-on is properly integrated in Media Center’s user interface and is not a third party program launched in a different executable).

Registry Settings

The last piece of configuration for this program can be found in the Windows registry. After installation, the following key is created in your registry and is essential for the software to run properly:

HKEY_LOCAL_MACHINE\SOFTWARE\Patchou\Media Center Themer (same location on both x86 and x64 systems)

Among the many values available, here are the ones you should know about and modify if needed. Note that these settings are only loaded when Media Center is started (so you will need to restart Media Center for changes to apply).

  • EnableThemer: this is a master switch. If set to 0, the entire Media Center Themer software will be disabled.
  • LogTextFormat: this controls if [diagnostic] messages appear in the log for text formats (colors). Set to 0 to disable this feature and save a bit of processing power and memory.
  • LogResources: this controls [diagnostic] messages for resources as well as resource extraction to files. Set to 1 to enable this feature to help you customize the look of Media Center.
  • LogStrings: this controls [diagnostic] messages for strings and messages loaded by the user interface. Set to 1
    to enable this feature to help you modify the text displayed in Media Center.
  • ProcessAddons: by default Media Center Themer processes all the Media Center add-ons it can detect. If you only wish to customize Media Center itself, set this value to 0.
  • ThemeFile: the configuration file loaded by Media Center Themer. By default, the value is “MCTDefault.xml” and the file gets loaded from the application’s data directory. It is recommended to create a new file for your theme, with a new name, and modify this registry setting accordingly. A complete path can be specified to load a configuration file from another directory.

Command Line

Some advanced users may prefer the flexibility of using command line parameters to specify some parameters for the themer. These parameters can be specified when launching Media Center with “ehshell.exe”. Note that command line parameters will only apply to the Media Center’s main program, add-ons will only use the registry settings (they are run in different processes).

  • /EnableThemer=n. See the EnableThemer registry setting.
  • /LogTextFormat=n. See the LogTextFormat registry setting.
  • /LogResources=n. See the LogResources registry setting.
  • /LogStrings=n. See the LogStrings registry setting.
  • /ThemeFile=”theme.xml”. See the ThemeFile registry setting.

It’s finally time to learn how to change the pictures used by Media Center. This will be the last topic of the Get Started section of
this documentation.

MCT Documentation – New Theme & Formatting

< back to Media Center Themer’s documentation index

Once you’ve tried changing the default colors defined in Media Center Themer a couple of time, questions like "how can I change another color I see in Media Center?", "how can I start my own theme?" or "how do I specify a different font for my text?" may pop into your head. This page intends to answer these questions for you.

The XML Schema

In the previous section of this documentation, you’ve seen how to change the color of the text. You also read about changing the font and using more conditions for your new attributes: let’s see how to actually use all these attributes. Almost everything that controls the behavior of Media Center Themer can be specified in the configuration XML file. The matching documentation for this file can be found in MCTSchema.xsd, an XML schema file. If you’re not familiar with xsd/dtd files, you should lnow that they’re used primarily to validate an XML file. For example, if you were to add a<Blablabla> element anywhere in the configuration file of Media Center Themer and try to validate it with an XML editor, you would get an error telling you that element <Blablabla> is unknown and cannot be defined.

Every element and attribute supported by Media Center Themer is described in the schema’s documentation (included in the documentation distributed with the software). For instance, here’s a list of the attributes you can set in the Text elements of TextFormat:

  • <Text>attributes
    • Color: Original color of the text. Needs to be expressed as RGB(r,g,b) where r, g and b are values between 0 and 255. No alpha channel can be specified (all transparency levels will match).
    • Font: Original name of the font used to display the text. Can also be an internal name only used by Media Center.
    • Height: Original size of the text, in points (pt).
  • <Replace> attributes in <Text>
    • Color: New color of the text. Needs to be expressed as RGB(r,g,b) where r, g and b are values between 0 and 255. No alpha channel can be specified, Media Center will apply transparency independently of this attribute.
    • Font: New font for the text. This needs to be a font currently registered in the system.
    • Height: New size for the text, in points (pt).
    • Bold: Set to “true” to display the text in bold.

Your Own Theme File

Before continuing with this documentation, it is highly recommended that you create a new file for your theme. MCTDefault.xml is, as its name implies, a file with default values. As such, it is susceptible to be replaced when Media Center Themer is upgraded, removed when the themer is uninstalled, etc… for these reasons, using a file with a different name will insure that your work is safe from external alterations. Here are the steps to perform:

  • Open a file explorer and navigate to Media Center Themer’s data directory C:\ProgramData\Media Center Themer).
  • Create a directory for your theme. For the example, we’ll call it MyTheme.
  • Copy MCTDefault.xml in your new theme’s directory (C:\ProgramData\Media Center Themer\MyTheme).
  • Rename the file in the theme’s directory to something else, for example MyThemeFile.xml.

Your new theme is now ready to be used. You’ll soon fill your directory with pictures and other files related to your theme. To instruct Media Center Themer to load your the new file instead of the default one, open the registry editor, navigate to "HKEY_LOCAL_MACHINE\SOFTWARE\Patchou\Media Center Themer" and change the ThemeFile value to "MyTheme\MyThemeFile.xml" (the path to your theme file, relative to Media Center Themer’s own data directory). You can start Media Center to ensure all is working as expected.

Text Formatting – Mixing Conditions

Let’s start with a simple example:, you want to change the color of all the text displayed with the font “Segoe Media Center Light” to red. To achieve this, you would add the following element at the top of your configuration file:

<Text Font="Segoe Media Center Light">
	<Replace Color="rgb(255,0,0)"/>
</Text>

If you start Media Center in Windows 7 with these parameters in your configuration file, you should see all the big menu titles on the welcome screen displayed in red. Now, let’s say you only want the currently selected menu to be displayed in red. Because the current menu is displayed by default in white (242,242,242) while the other menus are displayed by default in light blue (151,217,255), all you would need to do is add an extra condition on the text color, like this:

<Text Color="rgb(242,242,242)" Font="Segoe Media Center Light">
	<Replace Color="rgb(255,0,0)"/>
</Text>

Just remember that different Text blocks never combine, the first one found with a matching condition is the only one used for each given piece of text. For instance, if you wanted to change the color of all the text displayed in light blue to green and have the remaining “Segoe Media Center Light” text displayed in red, you would need to write your conditions in this order:

<Text Color="rgb(151,217,255)">
	<Replace Color="rgb(0,255,0)"/>
</Text>
<Text Font="Segoe Media Center Light">
	<Replace Color="rgb(255,0,0)"/>
</Text>

If you run Media Center with these parameters, you will see that all the menu titles are green (replaced from light blue) with the exception of the currently selected menu that’s red (only remaining text on the welcome screen displayed with the “Segoe Media Center Light” font). Now, if you invert those two Text elements and restart Media Center, you will see that all the titles are now displayed in red. That’s because the first condition is now “is the text displayed with Segoe Media Center Light?” and as this applies to both selected and non-selected menu items, the color red is applied immediately and no other condition is analyzed. To see more examples of possible combinations, check out the Samples page.

All you need to do now is read the logging & settings page and you’ll be ready to change the remaining resources of Media Center.

MCT Documentation – How to use this?

< back to Media Center Themer’s documentation index

In order to change the appearance of the text in Media Center, you’ll need to create/edit XML configuration files for Media Center Themer. After a clean installation, you’ll find the following files in the “Media Center Themer” sub-directory of %PROGRAMDATA% which is a hidden directory in Windows by default (so the default directory is C:\ProgramData\Media Center Themer) :

  • MCTDefault.xml : the default configuration file loaded and used by Media Center Themer.
  • MCTSchema.xsd : the XML Schema that can be paired with any XML configuration file to validate their structure.

For now, forget about the schema file and concentrate on MCTDefault.xml. If you haven’t run Media Center since you installed Media Center Themer, give it a try now. By default, the configuration file contains several entries that adds some flowers in the background and transforms most of the text of Media Center to various shades of green. If green is not what you see after a fresh installation, then there may be a problem with your installation or system configuration.

Once you’ve confirmed that the software is working as intended, open the configuration file in the XML editor of your choice or, if you don’t have any, in a text editor like notepad. Two main “sections” of text should be immediately visible: one in an element called <TextFormat>, and another one in <Resources>. In the first element you’ll find several sub-elements called <Text> and <LegacyText> that specify color codes. Both define new text attributes for Media Center and should be understood in the same manner. Here’s a quick definition of how those elements are used:

  • TextFormat:
    • Text: most of the text displayed by Media Center will use attributes defined in these elements. This includes titles on the home screen and almost all the text displayed in Music, Pictures, and third-party add-ons. Text elements can be used to redefine the color of a text, its font name, font size, and even add a “bold” attribute.
    • LegacyText: some of the older parts of the software still use a different method to display text on the screen. You’ll find that to be true in most of the settings pages of Media Center. LegacyText elements can be used to redefine the color of all legacy text strings, using the same attributes-based condition system used by Text elements.
  • Resources: this is where pictures and user-interface structure data (MCML) can be replaced. More about that is explained later in the documentation, for now, let’s concentrate on colors.

The Text Elements of TextFormat

In this documentation, you’ll start learning how to theme Media Center by modifying some of its text formatting. It may look less exciting than modifying pictures and menus but it’s an important step nonetheless. Don’t worry, pages are short and you’ll learn quickly. Let’s take a look at the content of the Text elements of the TextFormat section as provided in the default MCTDefault.xml configuration file:

<TextFormat>
	<!-- Color: OffWhite -->
	<Text Color="rgb(242,242,242)">
		<Replace Color="rgb(130,240,130)"/>
	</Text>

	<!-- Color: LightBlue -->
	<Text Color="rgb(151,217,255)">
		<Replace Color="rgb(80,200,80)"/>
	</Text>

	<!-- Color: MediumBlue -->
	<Text Color="rgb(2,166,212)">
		<Replace Color="rgb(10,160,10)"/>
	</Text>

	...
</TextFormat>

Three distinctive Text blocks can be seen, each one identifying a color name in its comments. These comments are for reference only and have no impact on the final result. In Media Center’s resources, OffWhite is a color defined as “242,242,242″, LightBlue is defined as “151,217,255″, etc… for each of these definitions in the configuration file, there is a matching Replace child element. It is in this element that you can define new attributes for the text to be displayed.

Here is how it works: when Media Center is loaded, the entire configuration file is loaded and analyzed by Media Center Themer. Then, each time some text needs to be drawn by Media Center, its attributes are checked against every validText element previously loaded. Each element is analyzed sequentially, from top to bottom, all its attributes are considered to be required conditions. In the example shown above, the only conditions you can see in each case are colors: in the first block, the condition is “color must be equal to rgb(242,242,242)”. If there’s a match, the new attributes defined in the Replace sub-element are applied and no other Text element is analyzed (different blocks aren’t combined). So the entire first Text element can finally be read as: “if the color of the text is equal to rgb(242,242,242), then replace it with rgb(130,240,130)”.

You can define as many Text elements as you need for your theme, just remember that only one can be used for each given text. This means that in general, complex conditions involving several attributes should be placed first, before general conditions (more about that in the next section of this documentation). For example, you could choose to apply a specific color only to text that is by default white and of a specific size (for the main menu window), or change the size of all the text that is using a specific font. Note that color must always be defined as “rgb(x,y,z)” values in the XML and all Red, Green and Blue channels need to have values between 0 and 255 inclusive. Alpha channels are not supported in the parameters, Media Center Themer will simply apply the original transparency level coming from Media Center itself, for consistency reasons.

The LegacyText Elements of TextFormat

Now let’s see what the LegacyText elements looks like:

<TextFormat>
	...

	<!-- Legacy text (settings). Color: OffWhite -->
	<LegacyText Color="rgb(242,242,242)">
		<Replace Color="rgb(115,200,110)" />
	</LegacyText>

	<!-- Legacy text (settings). Color: LightBlue -->
	<LegacyText Color="rgb(151,217,255)">
		<Replace Color="rgb(70,150,60)"/>
	</LegacyText>
</TextFormat>

If you’ve understood how Text elements works, then this should be no mystery. The same kind of color condition is used for each of the two LegacyText elements and the Replace child elements are defined exactly the same way. The main difference, which you can’t see here, is the number of attributes available: when working with legacy text (again, that’s the text displayed in most of the settings windows of Media Center and some other windows such as the default music search page), only color attributes can be specified in and out. No font can be added as condition attributes or replacement attributes, as seen in the schema’s documentation. The end result of these conditions combined with the ones above from TextFormat is the complete customization of Media Center’s main colors. Try to remove one or the other and launch Media Center to see the difference.

Now that you’ve seen how both elements work, give them a try by changing the “rgb” values inside the Replace elements. All you need to do is restart Media Center to see the changes. Before continuing with the rest of this documentation, you should feel comfortable with these values and their effects in Media Center. By default, only two colors are overridden¬†by LegacyText elements, compared to three¬†by Text elements. In both cases, they shouldn’t be seen as an exhaustive list of the colors displayed by Media Center. Next stop: New Theme & Text Formatting.

  • Archive

  • Categories

  • Blogroll