<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE displaychannel SYSTEM "../../../dtd/displaychannel.dtd">

<displaychannel x="0" y="0" width="100%" height="100%" fadetime="{fadetime}" shifttime="{shifttime}" shiftmode="slowed" shifttype="bottom">

    <background>
        <area x="0" y="75%" width="100%" height="25%" layer="1">
            <drawimage imagetype="skinpart" path="background_displaychannel" x="0" y="0" width="100%" height="100%" />
        </area>
    </background>

    <channelinfo>
        <area x="0" y="80%" width="20%" height="20%" layer="2">
            <drawimage cache="true" condition="{channellogoexists}" imagetype="channellogo" path="{channelid}" width="80%" height="80%" align="center" valign="center" />
        </area>
        <area x="0" y="76%" width="20%" height="5%" layer="2">
            <drawtext align="center" y="0" width="100%" fontsize="{areaheight}*{channelnamefontsize}/100" font="{regular}" color="{fontdefault}" text="{channelnumber}  {channelname}" />
        </area>
    </channelinfo>

    <epginfo>
        <!-- current schedule -->
        <area x="67%" y="76%" width="13%" height="10%" layer="2">
            <drawtext align="right" valign="center" fontsize="{areaheight}*{startstopfontsize}/100" font="{bold}" color="{fontactive}" text="{currentstart} - {currentstop}" />
        </area>
        <areascroll condition="{scrollepg}++empty{currentsubtitle}" scrollelement="title" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="fast" x="20%" y="76%" width="47%" height="10%" layer="2">
            <drawtext name="title" x="0" valign="center" fontsize="{areaheight}*{epgtextfontsizelarge}/100" width="100%" font="{regular}" color="{fontdefault}" text="{currenttitle}" />
        </areascroll>
        <areascroll condition="{scrollepg}++isset{currentsubtitle}" scrollelement="title" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="fast" x="20%" y="76%" width="47%" height="10%" layer="2">
            <drawtext name="title" x="0" y="{areaheight}*{epgtextposy}/100" fontsize="{areaheight}*{epgtextfontsize}/100" width="100%" font="{regular}" color="{fontdefault}" text="{currenttitle}" />
        </areascroll>
        <areascroll condition="{scrollepg}++isset{currentsubtitle}" scrollelement="subtitle" mode="forthandback" orientation="horizontal" delay="1000" scrollspeed="fast" x="20%" y="76%" width="50%" height="10%" layer="3">
            <drawtext name="subtitle" x="0" y="{areaheight}*{epgsubtextposy}/100" fontsize="{areaheight}*{epgsubtextfontsize}/100" width="100%" font="{regular}" color="{fontdefault}" text="{currentsubtitle}" />
        </areascroll>
        <area condition="not{scrollepg}" x="20%" y="76%" width="47%" height="10%" layer="2">
            <drawtext condition="isset{currentsubtitle}" x="0" y="{areaheight}*{epgtextposy}/100" fontsize="{areaheight}*{epgtextfontsize}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{currenttitle}" />
            <drawtext condition="isset{currentsubtitle}" x="0" y="{areaheight}*{epgsubtextposy}/100" fontsize="{areaheight}*{epgsubtextfontsize}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{currentsubtitle}" />
            <drawtext condition="empty{currentsubtitle}" x="0" valign="center" fontsize="{areaheight}*{epgtextfontsizelarge}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{currenttitle}" />
        </area>
        <area x="70%" y="83%" width="10%" height="3%" layer="2">
            <drawtext align="right" y="0" fontsize="100%" font="{regular}" color="{fontactive}" text="+{currentremaining} min" />
        </area>
        <!-- next schedule -->
        <area x="20%" y="88%" width="60%" height="10%" layer="2">
            <drawtext name="startstop" align="right" valign="center" fontsize="{areaheight}*{startstopfontsize}/100" font="{bold}" color="{fontdefault}" text="{nextstart} - {nextstop}" />
            <drawtext condition="isset{nextsubtitle}" x="0" y="{areaheight}*{epgtextposy}/100" fontsize="{areaheight}*{epgtextfontsize}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{nexttitle}" />
            <drawtext condition="isset{nextsubtitle}" x="0" y="{areaheight}*{epgsubtextposy}/100" fontsize="{areaheight}*{epgsubtextfontsize}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{nextsubtitle}" />
            <drawtext condition="empty{nextsubtitle}" x="0" valign="center" fontsize="{areaheight}*{epgtextfontsizelarge}/100" width="{areawidth} - {width(startstop)} - 10" font="{regular}" color="{fontdefault}" text="{nexttitle}" />
        </area>
    </epginfo>

    <progressbar>
        <area background="true" x="20%" y="86%" width="60%" height="2%" layer="2">
            <fill color="{progressbarback}" />
        </area>
        <area x="20%" y="86%" width="60%" height="2%" layer="3">
            <drawrectangle x="0" y="0" width="{areawidth}*{elapsed}/{duration}" height="100%" color="{progressbar}" />
        </area>
    </progressbar>

    <statusinfo>
        <area x="60%" y="96%" width="39%" height="4%" layer="2">
            <!-- Dolby / Stereo -->
            <drawrectangle x="{areawidth} - 4*{areaheight}*16/9 - 9" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle x="{areawidth} - 4*{areaheight}*16/9 - 9 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="dolby" condition="{isDolby}" x="{areawidth} - 4*{areaheight}*16/9 - 9 + {areaheight}*16/9/2 - {width(dolby)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="Dolby" />
            <drawtext name="stereo" condition="not{isDolby}" x="{areawidth} - 4*{areaheight}*16/9 - 9 + {areaheight}*16/9/2 - {width(stereo)}/2" valign="center" fontsize="60%" font="{regular}" color="{icontextactive}" text="Stereo" />
            <!-- Encrypted / FTA -->
            <drawrectangle x="{areawidth} - 5*{areaheight}*16/9 - 12" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle x="{areawidth} - 5*{areaheight}*16/9 - 12 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="enc" condition="{isEncrypted}" x="{areawidth} - 5*{areaheight}*16/9 - 12 + {areaheight}*16/9/2 - {width(enc)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="ENC" />
            <drawtext name="fta" condition="not{isEncrypted}" x="{areawidth} - 5*{areaheight}*16/9 - 12 + {areaheight}*16/9/2 - {width(fta)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="FTA" />
            <!-- Videotext -->
            <drawrectangle condition="{hasVT}" x="{areawidth} - 6*{areaheight}*16/9 - 15" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle condition="not{hasVT}" x="{areawidth} - 6*{areaheight}*16/9 - 15" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextinactive}" />
            <drawrectangle x="{areawidth} - 6*{areaheight}*16/9 - 15 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="vt" condition="{hasVT}" x="{areawidth} - 6*{areaheight}*16/9 - 15 + {areaheight}*16/9/2 - {width(vt)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="TXT" />
            <drawtext condition="not{hasVT}" x="{areawidth} - 6*{areaheight}*16/9 - 15 + {areaheight}*16/9/2 - {width(vt)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextinactive}" text="TXT" />
            <!-- Recording -->
            <drawrectangle condition="{isRecording}" x="{areawidth} - 7*{areaheight}*16/9 - 18" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextalert}" />
            <drawrectangle condition="{isRecording}" x="{areawidth} - 7*{areaheight}*16/9 - 18 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="rec" condition="{isRecording}" animtype="blink" animfreq="1000" x="{areawidth} - 7*{areaheight}*16/9 - 18 + {areaheight}*16/9/2 - {width(rec)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextalert}" text="REC" />
        </area>
    </statusinfo>

    <screenresolution>
        <area x="60%" y="96%" width="39%" height="4%" layer="2">
            <!-- Widescreen -->
            <drawrectangle condition="{isWideScreen}" x="{areawidth} - {areaheight}*16/9" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle condition="not{isWideScreen}" x="{areawidth} - {areaheight}*16/9" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextinactive}" />
            <drawrectangle x="{areawidth} - {areaheight}*16/9 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="wide" condition="{isWideScreen}" x="{areawidth} - {areaheight}*16/9 + {areaheight}*16/9/2 - {width(wide)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="WIDE" />
            <drawtext condition="not{isWideScreen}" x="{areawidth} - {areaheight}*16/9 + {areaheight}*16/9/2 - {width(wide)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextinactive}" text="WIDE" />
            <!-- Resolution -->
            <drawrectangle x="{areawidth} - 2*{areaheight}*16/9 - 3" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle x="{areawidth} - 2*{areaheight}*16/9 - 3 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="sd576i" condition="strequal({resolution}, 'sd576i')" x="{areawidth} - 2*{areaheight}*16/9 - 3 + {areaheight}*16/9/2 - {width(sd576i)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="576i" />
            <drawtext name="hd720p" condition="strequal({resolution}, 'hd720p')" x="{areawidth} - 2*{areaheight}*16/9 - 3 + {areaheight}*16/9/2 - {width(sd576i)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="720p" />
            <drawtext name="hd1080i" condition="strequal({resolution}, 'hd1080i')" x="{areawidth} - 2*{areaheight}*16/9 - 3 + {areaheight}*16/9/2 - {width(hd1080i)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="1080i" />
            <drawtext name="sd480i" condition="strequal({resolution}, 'sd480i')" x="{areawidth} - 2*{areaheight}*16/9 - 3 + {areaheight}*16/9/2 - {width(sd576i)}/2" valign="center" fontsize="65%" font="{regular}" color="{icontextactive}" text="480i" />
            <!-- SD / HD -->
            <drawrectangle x="{areawidth} - 3*{areaheight}*16/9 - 6" y="0" width="{areaheight}*16/9" height="{areaheight}" color="{icontextactive}" />
            <drawrectangle x="{areawidth} - 3*{areaheight}*16/9 - 6 + 1" y="1" width="{areaheight}*16/9 - 2" height="{areaheight} - 2" color="00000000" />
            <drawtext name="enc" condition="{isHD}" x="{areawidth} - 3*{areaheight}*16/9 - 6 + {areaheight}*16/9/2 - {width(enc)}/2" valign="center" fontsize="70%" font="{regular}" color="{icontextactive}" text="HDTV" />
            <drawtext name="fta" condition="not{isHD}" x="{areawidth} - 3*{areaheight}*16/9 - 6 + {areaheight}*16/9/2 - {width(fta)}/2" valign="center" fontsize="70%" font="{regular}" color="{icontextactive}" text="SDTV" />
        </area>
    </screenresolution>

    <channelgroup>
        <area x="0" y="75%" width="80%" height="25%" layer="2">
            <drawimage condition="{prevAvailable}" imagetype="icon" path="arrow-left" x="{areawidth}*0.3 - {areaheight}/3" valign="center" width="{areaheight}/3" height="{areaheight}/3"/>
            <drawimage condition="{nextAvailable}" imagetype="icon" path="arrow-right" x="70%" valign="center" width="{areaheight}/3" height="{areaheight}/3"/>
            <drawtextbox x="30%" width="40%" align="center" valign="center" font="{regular}" fontsize="30%" color="{fontactive}" text="{group}" maxlines="2" />
            <drawtextbox condition="{prevAvailable}" x="0" width="{areawidth}*0.3 - {areaheight}/3" align="center" valign="center" font="{regular}" fontsize="20%" color="{fontdefault}" text="{prevgroup}" maxlines="2" />
            <drawtextbox condition="{nextAvailable}" x="{areawidth}*0.7 + {areaheight}/3" width="{areawidth}*0.3 - {areaheight}/3" align="center" valign="center" font="{regular}" fontsize="20%" color="{fontdefault}" text="{nextgroup}" maxlines="2" />
        </area>
    </channelgroup>

    <currentweather>
        <area x="80%" y="76%" width="19%" height="5%" layer="2">
            <drawtext name="temperature" align="right" y="0" fontsize="100%" font="{regular}" color="{fontdefault}" text="{temperature}°C" />
            <drawimage imagetype="icon" path="{icon}" x="{posx(temperature)} - {areaheight}" valign="center" width="0.8*{areaheight}" height="0.8*{areaheight}"/>
        </area>
    </currentweather>

    <scrapercontent shifttime="{shifttime}" shifttype="top" shiftmode="slowed">
        <area condition="{isbanner}" x="0" y="0" width="{areaheight}*0.13*{mediawidth}/{mediaheight}" height="13%" layer="2">
            <drawimage imagetype="image" path="{mediapath}" align="center" valign="center" width="{areawidth}" height="{areaheight}"/>
        </area>
        <area condition="not{isbanner}" x="0" y="0" width="{areaheight}*0.5*{mediawidth}/{mediaheight}" height="50%" layer="2">
            <drawimage imagetype="image" path="{mediapath}" x="5" y="5" width="{areawidth}-10" height="{areaheight}-10"/>
        </area>
    </scrapercontent>

    <time>
        <area x="80%" y="80%" width="20%" height="15%" layer="2">
            <drawtext name="clock" x="11%" valign="center" fontsize="70%" font="{digital}" color="{fontdefault}" text="{hour}:{printf('%02d', min)}" />
            <drawtext name="clocksec" x="{posx(clock)} + {width(clock)}" y="{areaheight}/2 -  {height(clocksec)}/2 + {height(clock)}/2 - {height(clocksec)}/2 - 5" fontsize="50%" font="{digital}" color="{fontdefault}" text=":{printf('%02d', sec)}" />
        </area>
    </time>

    <message>
        <area x="10%" y="80%" width="80%" height="15%" layer="6">
            <fill color="{messageback}" />
        </area>
        <area x="10%" y="80%" width="80%" height="15%" layer="7">
            <drawimage condition="{status}" imagetype="icon" path="info" width="{areaheight}*0.8" height="80%" x="5%" valign="center" />
            <drawimage condition="{info}" imagetype="icon" path="info" width="{areaheight}*0.8" height="80%" x="5%" valign="center" />
            <drawimage condition="{warning}" imagetype="icon" path="warning" width="{areaheight}*0.8" height="80%" x="5%" valign="center" />
            <drawimage condition="{error}" imagetype="icon" path="error" width="{areaheight}*0.8" height="80%" x="5%" valign="center" />
            <drawtext align="center" valign="center" fontsize="{areaheight}*{messagemenusize}/100" font="{regular}" color="{fontdefault}" text="{text}" />
        </area>        
    </message>

</displaychannel>
