2012-07-27, 17:05
Hi,
recently I started working on providing tools for flexible controls placement and sizing (so we can define single set of .xml files that will work well on different aspect ratios).
Now we are limited to <posx>, <posy>, <width> and <height> (which essentially tells xbmc where left/top edge of control should be placed and what width/height should be). While it's ok for single resolution - it doesn't really work well if we will run same .xml on different aspect ratios. Idea here is to extend positioning system so we could:
- be able to specify not only where left/top edge should be - but also where right/bottom edge and where horizontal/vertical center of control should be
- use percentage values that will be converted to concrete value based on parent (that is control group/grouplist/window that our control is directly placed in) size
Above text might doesn't say much, so here's example: look here http://i46.tinypic.com/2ppar7d.jpg and notice what changes were made so it looks good on both 4:3 and 16:9 aspects:
To sum it up:
We plan to be able to define 4 attributes "left", "right", "center", "width" (and "top", "bottom", "center", "height" for horizontal) from which You will be able to pick any combination of 2 and let xbmc to do proper calculation for control placement and sizing. (propably it will be possibly to mix f.e. "left" and "center" but this doesn't seem to make much sense to really use it, but hey - You can)
In case You want to follow some pre-discussion we had before coming to this idea - check here https://github.com/xbmc/xbmc/pull/1208 but please comment about it in this topic as this is better place to do it than github.
recently I started working on providing tools for flexible controls placement and sizing (so we can define single set of .xml files that will work well on different aspect ratios).
Now we are limited to <posx>, <posy>, <width> and <height> (which essentially tells xbmc where left/top edge of control should be placed and what width/height should be). While it's ok for single resolution - it doesn't really work well if we will run same .xml on different aspect ratios. Idea here is to extend positioning system so we could:
- be able to specify not only where left/top edge should be - but also where right/bottom edge and where horizontal/vertical center of control should be
- use percentage values that will be converted to concrete value based on parent (that is control group/grouplist/window that our control is directly placed in) size
Above text might doesn't say much, so here's example: look here http://i46.tinypic.com/2ppar7d.jpg and notice what changes were made so it looks good on both 4:3 and 16:9 aspects:
- Time label on top, play/previous/next and progress control on top panel are cenetered (now we need to adjust posx for both aspect ratios in seperate .xml)
- Panel container's width is stretched to fill entire space (now we need to adjust width for both aspect ratios in seperate .xml)
- (optionally) Scrollbar, settings button and info on top and 4 buttons on bottom button could need to be moved (in case 'r' suffix in <posx> wasn't used)
- You simply define something like this:
or more compactCode:<posx center="50%" />
<width>300</width>
What does it mean? It means that center of control will be placed at 50% of the parent width (which will cause control to be centered and have constant width of 300). Why do we need center="50%" than just saying center="true"? Imagine You'd want center of control to be placed 100 pixels/points from parent's left (or right) edge so You use <posx center="100(r)" width="150"> or center to be in 3/4 of parent's width: <posx center="75%" width="150" />Code:<posx center="50%" width="300" />
- You use:
It means that left edge of control will be placed at position "50" (same as current <posx>50</posx>) and right edge will be placed at "50r", so there will be 50 pixels on left and right no matter how wide window/group is. Width of control will be calculated automaticly.Code:<posx left="50" right="50r" />
- To anchor to the right:
orCode:<posx right="10r" />
<width>200</width>
This is currently possible by usingCode:<posx right="10r" width="200" />
but I imagine not needing to calculate Yourself (200+10)r (easy example here :p but it's not always that easy) could be benificial and should make it easier to read xml - You look what params are used and say: "aha, 'right' and 'width' is defined - this means that control will be aligned/anchored to the right"Code:<posx>210r</posx>
<width>200</width>
To sum it up:
We plan to be able to define 4 attributes "left", "right", "center", "width" (and "top", "bottom", "center", "height" for horizontal) from which You will be able to pick any combination of 2 and let xbmc to do proper calculation for control placement and sizing. (propably it will be possibly to mix f.e. "left" and "center" but this doesn't seem to make much sense to really use it, but hey - You can)
In case You want to follow some pre-discussion we had before coming to this idea - check here https://github.com/xbmc/xbmc/pull/1208 but please comment about it in this topic as this is better place to do it than github.