[Rejected] WITHDRAWN - include global defines xml files (2nd attempt) (1 Viewer)

ajp8164

Portal Pro
January 9, 2008
575
1,166
Atlanta, GA
Home Country
United States of America United States of America
EDIT: I wish to withdraw this implementation. I'll post a new one soon... Thanks!

-----

This is a second attempt to have this feature accepted. I have made corrections that address the concerns for the original patch being rejected. The <include> tag must now appear in the <window> node.

-----

This patch allows for skin developers to create one or more xml files that contain only <define> nodes. This is useful for centralizing the definitions for colors, design screen sizes and other parameters used in controls. Without this feature skin designers either hard code the values into controls or create defines in every xml file. Either way, this leaves the skin designer (or re-designer) with a lot of work to switch the values of these control parameters.

Below is a sample xml skin file that contains only defines (the name of the file is arbitrary) and an example of how to consume this file in another xml skin file. I have bolded the reference to defines.xml and highlighted in red the use of a specific define (screenWidth).

Note that the <include> for defines.xml must appear inside the <window> node. This implementation allows you to have both an included defines xml file and a set of defines locally specified inside the target skin file (e.g., timeTextColor in this case BasicHome.xml). The implementation aggregates the defines from both files.

defines.xml:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
	[COLOR="Red"]<define>#screenWidth:1366</define>[/COLOR]
	<define>#screenHeight:768</define>
	<define>#screenTitleTextColor:FFFFFFFF</define>
</window>

BasicHome.xml: (a sample consumer of defines.xml)
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<window>
	<id>35</id>
	<defaultcontrol>1</defaultcontrol>
	<allowoverlay>no</allowoverlay>
	<disabletopbar>yes</disabletopbar>	

	[B]<include>defines.xml</include>[/B]
	<define>#timeTextColor:FFFFFFFF</define>

	<controls>	

		<include>common.background.xml</include>
		
	    <!-- MAIN MENU BAR -->
		<control>
			<type>image</type>
			<id>999</id>
			[COLOR="Red"]<width>#screenWidth</width>[/COLOR]
			<height>84</height>
			<texture>menubar.png</texture>
		</control>
...
 

catavolt

Design Group Manager
  • Team MediaPortal
  • August 13, 2007
    14,427
    10,454
    Königstein (Taunus)
    Home Country
    Germany Germany
    If you put all necessary <define>s into the reference.xml, you have a central point. What I found out during my time of skinning that the interpretation of a lot of <define>s in a skin slow down the skin peformance significantly.
     

    ajp8164

    Portal Pro
    January 9, 2008
    575
    1,166
    Atlanta, GA
    Home Country
    United States of America United States of America
    Ah ha! I did not know that about the references.xml... I will reorganize my work and if it works like I expect then I will withdraw this patch... by the way - is there a way to create "include-able" chunks of controls that can be centralized - for instance, xbmc has an includes.xml file in which you can define things like common animations etc. that can be included into all relevant controls. Can you do this in MP? Can I do this with styles??


    If you put all necessary <define>s into the reference.xml, you have a central point. What I found out during my time of skinning that the interpretation of a lot of <define>s in a skin slow down the skin peformance significantly.
     

    ajp8164

    Portal Pro
    January 9, 2008
    575
    1,166
    Atlanta, GA
    Home Country
    United States of America United States of America
    I just tried to add defines to references.xml and I ended up with xml parse errors. In looking at the code there is no implementation in the parsing of the references.xml file that can read defines. As I understand that performance issues may be a consideration I would like to have this capability and it should be left up to the skinner as to what they think the best skin implementation should be. If there are in fact serious performance issues with lots of defines then there may be a better implementation for caching defines that could be looked at in the future - if it becomes an issue then I will certainly step up and help to resolve it. In the mean time I will withdraw this implementation in favor of rewriting it to take advantage of the existing references.xml file; I'll create an implementation that allows the references.xml file to contain defines to make them available during control construction in the factory.

    Does this sound reasonable?

    -Andy
     

    Users who are viewing this thread

    Top Bottom