#!/bin/bash
#Pmusic
#Copyright 2012,2013,2014
#Sigmund Berglund

export TEXTDOMAIN=pmusic

case "$1" in
-nowplaying)
	. $APPDIR/themes/$THEME/themerc #get color definition by theme
	echo '
	<svg version="1.1" width="2000" height="50">
	  <defs>
		<linearGradient id="LG_01" x1="0" y1="-50" x2="14" y2="80" gradientUnits="userSpaceOnUse">
		  <stop style="stop-color:#717D71;stop-opacity:1" offset="0"/>
		  <stop style="stop-color:#717D71;stop-opacity:0" offset="1"/>
		</linearGradient>
	  </defs>
	  <rect width="2000" height="50" style="fill:url(#LG_01);fill-opacity:0.5"/>
	  <ellipse cx="0" cy="-500" rx="1000" ry="534" style="fill:#333333;opacity:0.08"/> 
	  <text x="7" y="27" style="fill:'$COLOR_TEXT_NOWPLAYING';font-family:DejaVu;font-size:22;">
		'"${2}"'
	  </text>
	  <text x="8" y="46" style="fill:'$COLOR_TEXT_NOWPLAYING'; font-family:DejaVu;font-size:10;fill-opacity:0.7">
		'"${3}"'
	  </text>
	</svg>' | sed 's/&/&amp;/g' > $WORKDIR/status.svg
	;;
-splash)
	echo '
	<svg version="1.1" width="600" height="200">
	  <defs>
		<linearGradient id="LG_01" x1="0" y1="0" x2="400" y2="400" gradientUnits="userSpaceOnUse">
		  <stop style="stop-color:#000000;stop-opacity:1" offset="0" />
		  <stop style="stop-color:#000000;stop-opacity:0" offset="1" />
		</linearGradient>
	  </defs>
	  <rect style="fill:url(#LG_01)" width="600" height="250"/>
	  <svg width="250" height="250" x="-60" y="-30">
	   <g style="opacity:0.3">
        '"`grep -vF '<?xml' /usr/share/icons/hicolor/scalable/apps/pmusic.svg`"'
	   </g>
	  </svg>
	  <text x="100" y="40" style="fill:#407D3E;font-family:DejaVu;font-weight:Bold;font-size:24;stroke-opacity:0.5;stroke:#9ACF9A;text-anchor:middle;">
		 pMusic '"$VERSION"'
	  </text>
	</svg>' > $WORKDIR/splash.svg
	echo '<pixmap space-expand="false" space-fill="false"><input file>'$WORKDIR'/splash.svg</input></pixmap>'
	;;
-heading)
	. $APPDIR/themes/$THEME/themerc #get color definition by theme
	echo '
	<svg version="1.1" width="2000" height="200">
	  <defs>
		<linearGradient id="LG_01" x1="0" y1="-30" x2="30" y2="90" gradientUnits="userSpaceOnUse">
		  <stop style="stop-color:#233D26;stop-opacity:1" offset="0" />
		  <stop style="stop-color:#233D26;stop-opacity:0" offset="1" />
		</linearGradient>
	  </defs>

	  <svg width="250" height="250" x="-60" y="-30" >
	   <g style="opacity:0.6">
        '"`grep -vF '<?xml' /usr/share/icons/hicolor/scalable/apps/pmusic.svg`"'
	   </g>
	  </svg>

	  <rect style="fill:url(#LG_01)" width="2000" height="200"/>
	  <text x="24" y="35"
		 style="fill:'$COLOR_TEXT_HEADING_FILL';font-family:DejaVu;font-weight:bold;font-size:24;stroke:'$COLOR_TEXT_HEADING_STROKE';stroke-width:0.5pt">
		 '"$2"'
	  </text>
	</svg>' > $WORKDIR/heading.svg

	echo '
	<vbox>
	 <hbox spacing="0" height="75" scrollable="true" space-expand="true" space-fill="true" vscrollbar-policy="2" hscrollbar-policy="2">
	  <eventbox name="svgheading">
	   <hbox space-expand="true" space-fill="true">
		<text space-expand="true" space-fill="true"><label>""</label></text>
	   </hbox>
	  </eventbox>
	 </hbox>
	</vbox>'
	;;

esac