<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jon Cairns &#187; foobar2000</title>
	<atom:link href="http://joncairns.com/c/foobar2000/feed/" rel="self" type="application/rss+xml" />
	<link>http://joncairns.com</link>
	<description>Web dev, musical experimenter, design enthusiast and committed Christian.</description>
	<lastBuildDate>Tue, 15 May 2012 14:21:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>foobar2000 tutorial complete</title>
		<link>http://joncairns.com/2011/10/foobar2000-tutorial-complete/</link>
		<comments>http://joncairns.com/2011/10/foobar2000-tutorial-complete/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 20:54:54 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=296</guid>
		<description><![CDATA[Just a quick update to say that the foobar2000 tutorial is back up again, and has a whole new set of links. Please let me know if you find any broken links or problems in general &#8211; I haven&#8217;t been &#8230; <a href="http://joncairns.com/2011/10/foobar2000-tutorial-complete/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Just a quick update to say that the foobar2000 tutorial is back up again, and has a whole new set of links. Please let me know if you find any broken links or problems in general &#8211; I haven&#8217;t been through it with a fine tooth comb yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2011/10/foobar2000-tutorial-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foobar2000: 7.3 Creating a PanelsUI layout</title>
		<link>http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 16:37:20 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[panelsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=284</guid>
		<description><![CDATA[In the last section of this PanelsUI tutorial we&#8217;ll go through creating a layout, step-by-step. It would help to have an understanding of PanelsUI code syntax, so check the previous page if you don&#8217;t. 7.3.1 Here&#8217;s one I tried to &#8230; <a href="http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>In the last section of this PanelsUI tutorial we&#8217;ll go through creating a layout, step-by-step. It would help to have an understanding of PanelsUI code syntax, so check the <a href="http://www.joncairns.com/tutorials/foobar/panels2.php">previous page</a> if you don&#8217;t.</em></p>
<h2>7.3.1 Here&#8217;s one I tried to make earlier</h2>
<p>We are going to create this:</p>
<div id="attachment_107" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/foliage.jpg"><img class="size-full wp-image-107" title="Foliage theme for panelsUI" src="http://joncairns.com/wp-content/uploads/2011/09/foliage_small.jpg" alt="Foliage theme for panelsUI" width="300" height="236" /></a><p class="wp-caption-text">Foliage theme for panelsUI</p></div>
<p>It&#8217;s pretty simple, and mediumly (new word) attractive, but it will do.</p>
<h2>7.3.2 New layout</h2>
<p>Firstly, head to the preferences (Ctrl+P), and then to the Display section. Make sure PanelsUI is selected. If it doesn&#8217;t appear in the drop-down menu, you&#8217;ve been a muppet, and have started a PanelsUI tutorial without having PanelsUI. So <a onclick="window.open(this.href); return false;" href="http://panels.fooblog2000.com/">download it</a>. Head to the PanelsUI sub-menu, and create a new layout. Call it something. I called mine &#8220;foliage&#8221;, during a brief lapse of imagination. Now, download my little images pack:</p>
<p><a href="http://www.joncairns.com/dl/foliage.zip">download me please</a></p>
<p>This contains all the images you need for the layout. Unzip it somewhere convenient on your hard drive, such as &#8220;C:\foobar\&#8221;. Now go back to the PanelsUI preferences page, where you created the new layout, and click on the &#8220;User Globals&#8221; button. Then add the line</p>
<pre class="brush: php; light: true; title: ; notranslate">$puts(imgpath,C:\foobar\foliage\)</pre>
<p>on a new line in the box. If you unzipped the images somewhere else, modify the line to show the path of the containing folder. If you can&#8217;t find the user globals page it should look something like this:</p>
<div id="attachment_144" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panelspref1.jpg"><img class="size-full wp-image-144" title="Panels preferences" src="http://joncairns.com/wp-content/uploads/2011/09/panelspref1_small.jpg" alt="Panels preferences" width="300" height="245" /></a><p class="wp-caption-text">Panels global variables</p></div>
<p>This allows us to call on a variable each time we want to find our images folder, rather than writing out &#8220;C\foobar\&#8230;&#8221; each time. You can do this with anything, such as fonts or colours. Since this is a simple layout, we won&#8217;t do any more.</p>
<h2>7.3.3 Writing the code</h2>
<p>Now we&#8217;re going to edit the code for the first time. Click on &#8220;Edit Layout&#8221; on the PanelsUI preferences window, and select all the code from the new box that appears. Delete it. All of it. Show it no mercy. Click apply, and everything will disappear, probably giving you a black screen. The box you have before you contains the information for the layout. Within this section you can &#8220;call&#8221; on other panels, which sometimes have their own edit window, and those panels will be incorporated into the layout. In the top right corner of the edit window you should see something like this:</p>
<p><img class="aligncenter size-full wp-image-142" title="Panel configuration editor" src="http://joncairns.com/wp-content/uploads/2011/09/panelsedit1.jpg" alt="Panel configuration editor" width="300" height="245" /></p>
<p>This box shows you which panels you currently have associated with that layout. Since we&#8217;ve deleted everything, they&#8217;re not doing much, so we can delete them too. Select each one and click delete to the right. Now you have a clean sheet. The first step is going to be adding the background. Write (or copy) the following text:</p>
<pre class="brush: php; title: ; notranslate">
// Background
$drawrect(0,0,%_width%,%_height%,brushcolor-255-255-255 pencolor-null)
$imageabs2(1200,1000,0,0,0,0,$eval(%_width%-1200),$eval(%_height%-1000),$get(imgpath)background.png,)
</pre>
<p>The top tag tells foobar that everything following it is in the &#8220;Background&#8221; category, and therefore doesn&#8217;t need to update dynamically. Saves some processing power. The <span class="code">$drawrect</span> function is a box that fits the entire size of the layout, and creates a white background (as opposed to the default black). This function can confuse people, but it is literally just drawing a rectangle and colouring it in. The <code>$imageabs2</code> function is our background image, and I&#8217;ve used a little bit of maths to place it. The image is 1200 by 1000, and it is positioned at the full width minus 1200 (i.e. the far right edge of the layout) and the full height minus 1000 (i.e. the bottom edge of the layout). So the leaves will always be in the bottom right corner of the layout. This allows us to have a stretchy layout, that still looks good. The <code>$get(imgpath)</code> is referring to the user global that you set earlier, and leads to the image path. Click apply; if the image doesn&#8217;t appear, make sure the user global is correct.</p>
<h2>7.3.4 Adding panels</h2>
<p>Next we&#8217;ll add some panels. This layout uses only three panels: Single Column Playlist, Track Display and Quick Search (see <a title="foobar2000: 3. Components" href="http://joncairns.com/2010/10/foobar2000-3-components/">components</a> page, first two included with panelsUI). Again, the positioning of these panels involves a bit of maths to create a fluid layout that stretches. They need to be under the &#8220;Globals&#8221; tag, so type the following code:</p>
<pre class="brush: php; title: ; notranslate">
// Global
$panel(Playlist,Single Column Playlist,50,45,$eval(4*%_width%/9),$eval(2*%_height%/3),)
</pre>
<p>The single column playlist (named as &#8220;Playlist&#8221; in this case) is positioned at 50px from the left, 45px from the top. The width is 4/9 of the overall width of foobar. The height is 2/3 of the overall height. If the foobar is stretched, the panel will stretch with it. Click &#8220;Apply&#8221; and the following will appear:</p>
<div id="attachment_109" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/foliage2.jpg"><img class="size-full wp-image-109" title="Foliage theme stretched" src="http://joncairns.com/wp-content/uploads/2011/09/foliage2_small.jpg" alt="Foliage theme stretched" width="300" height="217" /></a><p class="wp-caption-text">Foliage theme stretched</p></div>
<p>You should also notice that the panel gets listed in the top right box on the edit panel. If it doesn&#8217;t appear&#8230; something&#8217;s wrong. Er&#8230; email me.</p>
<p>Now, we&#8217;ll add the track display panel, which is a very versatile tool for showing current information, displaying pics, etc.</p>
<pre class="brush: php; light: true; title: ; notranslate">$panel(Display,Track Display,$eval(%_width%/2+30),60,$eval(4*%_width%/9),$eval({2*%_height%/3}-15),)</pre>
<p>This is positioned at half the width plus 30px, and 60px from the top. The width is 4/9 of the width of the foobar, and 2/3 of the height, minus a little bit. Click &#8220;Apply&#8221;. The result will look like this:</p>
<p><a href="http://joncairns.com/wp-content/uploads/2011/09/foliage3.jpg"><img class="aligncenter size-full wp-image-111" title="Foliage completed panels" src="http://joncairns.com/wp-content/uploads/2011/09/foliage3_small.jpg" alt="Foliage completed panels" width="300" height="217" /></a></p>
<p>Pretty, innit? We&#8217;ll make it a bit nicer.</p>
<h2>7.3.5 Single Column Playlist editing</h2>
<p>First we&#8217;ll make some changes to the single column playlist. Select the panel in the top right section of the edit window, and click &#8220;settings&#8221;. You should then see a window that looks like this:</p>
<div id="attachment_158" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/scp.jpg"><img class="size-full wp-image-158" title="Single column playlist editor" src="http://joncairns.com/wp-content/uploads/2011/09/scp_small.jpg" alt="Single column playlist editor" width="300" height="235" /></a><p class="wp-caption-text">Single column playlist editor</p></div>
<p>The only part of the window we&#8217;re interested in is the section called &#8220;layout settings&#8221;. The single column playlist has two sections: the group display and item display. The group display is for showing information such as album and artist title, and the item display shows each track within that group. You can change the height of the items in the top left of the layout settings. The default is 18 pixels, and we want ours to be 21 pixels. You can also change the height of the group display, and it is a multiple of the item height. The default is 2, and we want to have it as 5. Click apply, and you should see the playlist dimensions expand.</p>
<h3>Group display</h3>
<p>Currently the information in the group display is a bit ugly, so we&#8217;ll just start again from scratch. Make sure that the group display button is selected in the layout settings section, and delete all the code. Then add the following code:</p>
<pre class="brush: php; title: ; notranslate">
// Background
$imageabs2(%_width%,400,0,0,0,0,0,0,$get(imgpath)box.PNG,nokeepaspect)
$drawrect(20,$eval(%_height%-10),$eval(%_width%-40),2,brushcolor-null pencolor-50-140-50)
</pre>
<p>As you&#8217;ve probably picked up, the <code>// Background</code> tag means that the following code doesn&#8217;t have to update regularly. The <code>$imageabs</code> function places an image of a rounded-corner box in our group display. The <code>$rect</code> function draws a green line which will just provide a nice green line to underline all the information we&#8217;re about to display. Click apply to see the changes (in fact, just do this whenever you change stuff from now on &#8211; I&#8217;ll stop saying it).</p>
<p>Next we&#8217;ll write out information about the album, such as the artist, album name and genre. It&#8217;s also preferable to show the album artwork, but it depends on 1) whether you have any, and 2) how organised you&#8217;ve been with it. I have all of my album artwork sitting within the folder which contains my music files for that album, and I&#8217;ve always called it &#8220;cover.jpg&#8221;. Others have all their artwork within one folder, and the name of the image is related to the album title. I prefer having everything within one place. If you don&#8217;t have album artwork then just skip this code. Otherwise, write this:</p>
<pre class="brush: php; title: ; notranslate">
// Global
$drawrect(20,10,80,80,pencolor-150-150-150 brushcolor-null)
$alignabs(20,10,80,80,center,middle)no image
$imageabs2(80,80,0,0,0,0,20,10,$replace(%path%,%filename_ext%,cover.*),)
</pre>
<p>The <code>$rect</code> function draws a little grey box where the album artwork will sit, which you should only see if the album artwork is missing. It&#8217;s better than having a white space! The <code>$alignabs</code> function creates an invisible box which you can use to align text with respect to the left and top of the containing box. For instance, this box is 20px from the left, 10px from the top and is 80x80px in size. The text is aligned in the center of the box, and says &#8220;no image&#8221;. Again, this will only appear if there is no image to display. The image function is obviously the one that displays the artwork, but the path is a bit more complicated. The <code>$replace</code> function basically adds &#8220;cover.*&#8221; (where * is an extension wildcard, i.e. jpg, gif, png&#8230;) to the path of the album. If your album artwork is called anything else then just change &#8220;cover&#8221; to whatever. Now we&#8217;ll move on to displaying the album information.</p>
<pre class="brush: php; title: ; notranslate">
// Global
$font(verdana,14,,90-90-90)
$alignabs(110,10,$eval(%_width%-20),%_height%,left,top)
$ifgreater($len(%artist%),$eval({%_width%-150}/10),$padcut(%artist%,$eval({{%_width%-150}/10}-2))...,%artist%)
$char(10)
</pre>
<p>Note &#8211; you only need to write <code>// Global</code> if you didn&#8217;t include the album artwork bit above. Firstly, the <code>$font</code> function sets the font, which I&#8217;ve defined as Verdana, 14pt and a darkish grey. The font will remain as this until it&#8217;s redefined. The <code>$alignabs</code> function draws an invisible box to place the text (see above). If you didn&#8217;t include the album artwork, set the value for x-position (i.e. 110) to about 30. Otherwise, keep it the same.</p>
<p>The next function looks extremely evil, but I&#8217;m actually quite proud of it. It cuts the artist&#8217;s name depending on the width of the box, e.g. &#8220;Dave Matthews Band&#8221; would become &#8220;Dave Matthe&#8230;&#8221; if there isn&#8217;t enough room to display it. Remember that our layout is fluid, so increasing the size of your foobar will increase the size of the single column playlist, and the cutting will adapt automatically. The final function, simply <code>$char(10)</code> is an ASCII character return, meaning new line. Next we&#8217;ll do similar stuff for other information.</p>
<pre class="brush: php; title: ; notranslate">
$font(verdana,12,,90-90-90)
$ifgreater($len(%album%),$eval({%_width%-150}/8),$padcut(%album%,$eval({{%_width%-150}/8}-2))...,%album%)
$char(10)
$font(verdana,8,uppercase,140-140-140)
%genre%
$char(10)
%codec% - %bitrate%kbs
</pre>
<p>These functions have all been covered, and should make sense. They just show the album name, genre and then codec and average bitrate for the album. Now we&#8217;ve finished with the group display.</p>
<h3>Item display</h3>
<p>Next we&#8217;ll move on to the &#8220;item display&#8221; section &#8211; click the appropriate button in the playlist edit window to change. Then delete all the code in the box, and write the following lines in:</p>
<pre class="brush: php; title: ; notranslate">
// Global
$if(%_selected%,$drawrect(12,0,$eval(%_width%-24),0,brushcolor-20-120-20 pencolor-null))
$if(%_focused%,$drawrect(12,0,$eval(%_width%-24),0,brushcolor-null pencolor-SYSCOL-6))
$if(%_selected%,$textcolor(225-255-225),$textcolor(60-60-60))
</pre>
<p>The top <code>$if</code> function draws a green rectangle, almost the width of the playlist, if the item is selected. The second function draws a black outline round an item if it is focused upon, which is slightly different. To see the difference just select several items by clicking on an item, holding SHIFT and clicking on another item. Several are selected, but only one shows the black border. The third function defines the colour of the text when selected (white in this case) and unselected (dark grey). Next bit of code:</p>
<pre class="brush: php; title: ; notranslate">
$imageabs2(%_width%,$eval($meta(TOTALTRACKS)*20+22),0,$eval(%tracknumber%*20),0,0,0,0,$get(imgpath)box.png,nokeepaspect)
$padding(20,3)
$align(right,top)%title%
$align(left,top)%tracknumber%.
</pre>
<p>The image function is pretty complicated here. The image is a round corner green box, and this function draws a little section of it for each of the items. Each item in the single column playlist is treated as an isolated element, so drawing an image will draw that image on each item. But this function offsets the position of the image with each item, and it depends upon the tracknumber and the total number of tracks in the album. If the track number is equal to the total number of tracks then the end of the image is shown, which shows the curved corners (don&#8217;t worry if you don&#8217;t get this).</p>
<p>This is another function I&#8217;m kind of proud of, although the problem is that the image gets squashed or stretched depending on the number of tracks in the album, which isn&#8217;t ideal. Also, if your track information isn&#8217;t complete, for example if you don&#8217;t have the number of tracks in the album (you can add it in the track properties dialogue), it won&#8217;t display properly. The align functions display the track title (on the right) and the track number (on the left).</p>
<p>Congratulations, your single column playlist is complete! It should look like this:</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/scp2.jpg"><img class="size-full wp-image-160" title="Single column playlist editor" src="http://joncairns.com/wp-content/uploads/2011/09/scp2_small.jpg" alt="Single column playlist editor" width="300" height="315" /></a><p class="wp-caption-text">Completed single column playlist editor</p></div>
<p>Finally, in the top right of the single column playlist edit window, where it says &#8220;Edge style&#8221;, change it to &#8220;none&#8221;. Now close the single column playlist edit window, to return to the main edit window.</p>
<h2>7.3.6 Track display editing</h2>
<p>Open the track display panel edit window using the box in the top right corner of the window. You should see this:</p>
<div id="attachment_136" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panels_track.jpg"><img class="size-full wp-image-136" title="Track display panel" src="http://joncairns.com/wp-content/uploads/2011/09/panels_track_small.jpg" alt="Track display panel" width="330" height="327" /></a><p class="wp-caption-text">Track display panel</p></div>
<h3>Song description</h3>
<p>This code makes the track panel look pretty ugly. Delete everything in the central text box, and replace it with the following:</p>
<pre class="brush: php; title: ; notranslate">
$padding(2,4)$alignabs(0,250,%_width%,$eval(%_height%-50),center,top)
$font(Verdana,22,,70-70-70)
$if(%_trackinfo_notrack%,
No track
,
%title%$char(10)
$font(Verdana,15,,80-80-80)%artist%$char(10)
$font(Verdana,15,,90-90-90)%genre%$char(10)
$font(Verdana,10,,100-100-100)%codec% - %bitrate%kbs
)
$imageabs2($eval(%_width%-80),10,0,0,0,0,40,15,$get(imgpath)bar.png,nokeepaspect)
</pre>
<p>I&#8217;ll walk you through it. The first two commands, <code>$padding</code> and <code>$alignabs</code>, are defining the dimensions and position of a bounding box, in which we can put text, etc. The <code>$font</code> command is self-explanatory, and we&#8217;ve seen it before. The <code>$if</code> function works out whether a track is playing, and displays &#8220;No track&#8221; if there isn&#8217;t. Otherwise, it displays the song title, artist, genre and track information in that order. Finally, the <code>$imageabs2</code> function displays the image that we&#8217;ll use for the progress bar.</p>
<h3>Progress bar and artwork</h3>
<p>Adding the progress bar is a relatively complex step, and requires the powerpanels component. This is now pretty hard to get, since the official site seems to have gone down (as of 04/02/2009). However, I will provide a link to it here, and will continue to do so until someone complains:</p>
<p><a href="http://www.joncairns.com/dl/foo_uie_powerpanels.dll">Power Panels foobar component</a></p>
<p>Plonk this in your components folder in the foobar directory, and restart foobar. Go back to the track display edit window as previous, and add the following code:</p>
<pre class="brush: php; title: ; notranslate">
// PerTrack
$drawrect($eval(%_width%/2-100),40,200,200,pencolor-0-100-0 brushcolor-null)
$imageabs2(200,200,0,0,0,0,$eval(%_width%/2-98),44,$replace(%path%,%filename_ext%,cover.*),nokeepaspect)

// PerSecond
$if(%isplaying%,$puts(l,$eval($eval(%_width%-80)*%playback_time_seconds% / %length_seconds%))
$imageabs2(38,39,0,0,0,0,$eval(18+$get(l)),0,$get(imgpath)slider.png,nokeepaspect)
,)
</pre>
<p>The first two functions, i.e. <code>$drawrect</code> and <code>$imageabs2</code>, draw a square border and place the track artwork respectively. The functions under the <code>// Per Second</code> group work out the length of the song, the current position, and place the image of the slider along the progress bar accordingly. You can follow my maths through if you want, but I won&#8217;t.</p>
<p>That&#8217;s all for the track display panel: almost finished! After applying the changes you&#8217;ve just made, your foobar should look pretty close to this:</p>
<div id="attachment_113" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/foliage4.jpg"><img class="size-full wp-image-113" title="The almost finished product" src="http://joncairns.com/wp-content/uploads/2011/09/foliage4_small.jpg" alt="The almost finished product" width="330" height="236" /></a><p class="wp-caption-text">The (almost) finished product</p></div>
<p>Although you probably won&#8217;t be playing anything from Lizard by King Crimson.</p>
<h2>7.3.7 Final adjustments</h2>
<p>Exit the track display edit window, to get to the main configuration window. Here, the most recent things you added were the bits of code that called the track display and single column playlist panels. Everything in this section can be placed after these commands.</p>
<h3>Quick search toolbar</h3>
<p>This requires the Quick Search Toolbar component, which you can download here:</p>
<p><a href="http://www.joncairns.com/dl/foo_uie_quicksearch.dll">Quick Search Toolbar</a></p>
<p>You know what to do. After putting it in your components directory, add the following code to the configuration screen:</p>
<pre class="brush: php; light: true; title: ; notranslate">$panel(Searchbar,Quick Search Toolbar,50,$eval(2*%_height%/3+55),$eval(4*%_width%/9),23,)</pre>
<p>This places a search toolbar underneath the single column playlist. Right click on the toolbar to change the fields that you search for, and use it to quickly grab things from your library. You can edit it in the preferences.</p>
<h3>Some rectangles</h3>
<p>We&#8217;re going to draw some boxes around the playlist and track display. Just add the following code to the configuration window:</p>
<pre class="brush: php; title: ; notranslate">
$drawrect(48,43,$eval(4*%_width%/9+4),2,pencolor-0-100-0 brushcolor-null)
$drawrect(48,$eval(2*%_height%/3+45),$eval(4*%_width%/9+4),2,pencolor-0-100-0 brushcolor-null)
$drawrect(48,45,2,$eval(2*%_height%/3),pencolor-0-100-0 brushcolor-null)
$drawrect($eval(4*%_width%/9+50),45,2,$eval(2*%_height%/3),pencolor-0-100-0 brushcolor-null)
$drawrect($eval(%_width%/2+28),43,$eval(4*%_width%/9+4),2,pencolor-0-100-0 brushcolor-null)
$drawrect($eval(%_width%/2+28),$eval({2*%_height%/3}+45),$eval(4*%_width%/9+4),2, pencolor-0-100-0 brushcolor-null)
$drawrect($eval(%_width%/2+28),45,2,$eval(2*%_height%/3),pencolor-0-100-0 brushcolor-null)
$drawrect($eval(%_width%/2+30+{4*%_width%/9}),45,2,$eval(2*%_height%/3),pencolor-0-100-0 brushcolor-null)
</pre>
<p>Although this may look complicated, it&#8217;s just drawing a series of 2px solid lines, at the edge of the single column playlist and track display panels. It requires a little bit of working out to determine where the edges are, but it&#8217;s a simple idea.</p>
<h3>Power Panel</h3>
<p>Finally, we&#8217;re going to add the power panel, which is an invisible seekbar that can be used to navigate through a track. You have to define the dimensions, but the panel works out all the difficult stuff. The way to use it is to place it underneath the progress bar that we&#8217;ve created for the track display. Put in the following code in the configuration window:</p>
<pre class="brush: php; light: true; title: ; notranslate">$panel(Seekbar,Seek Panel,$eval(%_width%/2+70),70, $eval(4*%_width%/9-80),20,)</pre>
<p>Now play a song, and click anywhere along the progress bar. You should (hopefully) find that the song jumps depending on where you click the bar. If that doesn&#8217;t work, check that the component has been successfully installed (Preferences -&gt; Components -&gt; Seek Panel). If it says it is, send me a message and I&#8217;ll try and figure it out.</p>
<h2>7.3.8 Final words</h2>
<p>You should now have a working PanelsUI skin. It&#8217;s pretty basic, and not particularly pretty. But it does the job! Hopefully I&#8217;ll get round to making some attractive skins, if other stuff doesn&#8217;t get on top of me. Here is the complete PUI file, and the images pack again.</p>
<p><a href="http://www.joncairns.com/dl/foliage.pui">PUI file</a><br />
<a href="http://www.joncairns.com/dl/foliage.zip">Image pack</a></p>
<p><em>All that, just to listen to music?!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foobar2000: 7.2 PanelsUI code</title>
		<link>http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 13:00:23 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[panelsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=275</guid>
		<description><![CDATA[This section goes through the extra, panelsUI specific code. It&#8217;s not exhaustive, but provides enough to be able to create decent layouts, and to gain a general understanding of how it works. This section is pretty large, and potentially confusing, &#8230; <a href="http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="intro">This section goes through the extra, panelsUI specific code. It&#8217;s not exhaustive, but provides enough to be able to create decent layouts, and to gain a general understanding of how it works.</p>
<p>This section is pretty large, and potentially confusing, so you can use these links to jump to any point on the page.</p>
<ol>
<li><a href="#one">Introduction</a></li>
<li><a href="#two">Basic functions</a></li>
<li><a href="#three">Panel function</a></li>
<li><a href="#four">Redraw types</a></li>
<li><a href="#five">Text, font and aligning</a></li>
<li><a href="#six">Buttons</a></li>
<li><a href="#seven">Appearance functions</a></li>
<li><a href="#eight">Persistent variables</a></li>
</ol>
<h2><a name="one"></a>7.2.1 First impressions</h2>
<p>The code for PanelsUI is pretty much the same as the general foobar2000 code. However, there are several extra functions, the introduction of &#8220;persistent variables&#8221; and some usage differences. I&#8217;ll be referring to code for versions 0.13.x on this page, as it is the most stable.</p>
<p>First of all, you need to <a onclick="window.open(this.href); return false;" href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Components_0.9/Panels_UI_%28foo_ui_panels%29/Commands_0.13.x">bookmark this site</a>. It has all of the PanelsUI-specific titleformatting for version 0.13.x (use <a href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Components_0.9/Panels_UI_%28foo_ui_panels%29/Commands">this page</a> for version 0.14.x). You should also bookmark the <a href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:0.9_Track_Info_Panel_Mod_%28foo_uie_trackinfo_mod%29">track info panel wiki page</a>, which gives more useful information. You can find information about the single column playlist <a href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Components_0.9/Panels_UI_%28foo_ui_panels%29/Single_Column_Playlist">here</a>.</p>
<h3>Practical differences</h3>
<p>A very useful difference is that carriage returns, etc. don&#8217;t affect the result of the code. For example, you could have:</p>
<pre class="brush: php; title: ; notranslate">$ifequal (
    a
    b ,
    %result%,
    %alternative_result%
)
</pre>
<p>The spaces will not be read, where they would be normally. This is great, simply because you can lay your code out neatly and make it readable, by separating a long function out across several lines, for example.</p>
<h2><a name="two"></a>7.2.2 Basic functions</h2>
<h3>Mathematical evaluation, $eval(&#8230;)</h3>
<p>In PanelsUI you can use mathematical functions within the <code>$eval(...)</code> function. For example,</p>
<pre class="brush: php; light: true; title: ; notranslate">$eval( 5 * 6 )</pre>
<p>returns 30. The operators that <code>$eval()</code> supports are &#8220;*&#8221; (multiply) &#8220;/&#8221; (divide), &#8220;+&#8221; (add), &#8220;-&#8221; (subtract) and &#8220;@&#8221; (modulus, returns remainder after division). You can use { and } as brackets for mathematical priority. E.g.</p>
<pre class="brush: php; light: true; title: ; notranslate">$eval ( { { 9 / 3 } + 5 } * 2 )</pre>
<p>returns 16.</p>
<h3>Defining position and size</h3>
<p>There are two ways of defining the position or size of an object using PanelsUI.</p>
<p>The first way is to use pixels, which defines an absolute, static value. This is the result of defining a rectangle 400 pixels by 20 pixels, located at 50px from the left hand side and 70px from the top:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-148" title="Pixel dimensions" src="http://joncairns.com/wp-content/uploads/2011/09/pixels.png" alt="Pixel dimensions" width="470" height="115" /></p>
<p>The other method is to use ratios. The width and height of the panel is given by <code>%_width%</code> and <code>%_height%</code>, and these variables return a pixel value. If you combine these with the <code>$eval</code> function (above), you can define position and size as a ratio of the total width and height. For example,</p>
<pre class="brush: php; title: ; notranslate">$eval( %_width% / 3 )</pre>
<p>returns the pixel value of the total width, divided by three. If the total width was 600, it would return 200. This is useful for creating layouts that can be resized without affecting the appearance.</p>
<h2><a name="three"></a>7.2.3 Panel function</h2>
<p>Panels are inserted into code using the following function:</p>
<pre class="brush: php; title: ; notranslate">$panel ( id,
    panel,
    x , y ,
    width, height,
    ,
)
</pre>
<ul>
<li>id is a name of your choice for the panel, which has to be unique, e.g. &#8220;mypanel1&#8243;</li>
<li>panel is the name of the panel, e.g. &#8220;Track Display&#8221; or &#8220;Single Column Playlist&#8221;: the drop-down menus under tools at the top of the window show the panels available</li>
<li>x and y define the position of the panel from the top left corner of the containing panel, in pixels/ratio</li>
<li>width and height define the size of the panel, in pixels/ratio</li>
</ul>
<p>As an example,</p>
<pre class="brush: php; title: ; notranslate">$panel(Playlist,Single Column Playlist,20,20,450,300,)</pre>
<p>creates a playlist panel, 450 x 300 pixels, 20 pixels from the top left corner:</p>
<p><a href="http://joncairns.com/wp-content/uploads/2010/10/panel.png"><img class="aligncenter size-full wp-image-280" title="panel" src="http://joncairns.com/wp-content/uploads/2010/10/panel.png" alt="" width="470" height="327" /></a></p>
<p>Don&#8217;t forget the comma after the panel height. Technically there should be options at the end of the function, but none exist. The function will display nothing if you miss it out though!</p>
<h2><a name="four"></a>7.2.4 Redraw types</h2>
<p>A very important feature of PanelsUI is the redraw function. The redraw types tell foobar how regularly the proceeding code should be updated, i.e. every second, or every track, etc. They appear to be comments, in that they are written after two forward slashes, &#8220;//&#8221;. The redraw types are as follows:</p>
<ul>
<li><code>// Background</code> &#8211; not updated dynamically, use for static objects</li>
<li><code>// Global</code> &#8211; anything that doesn&#8217;t need regular updating can quite happily go here</li>
<li><code>// PerTrack</code> &#8211; information that needs to be updated every track, such as <code>%artist%</code></li>
<li><code>// PerSecond</code> &#8211; information that needs to be updated every second, such as <code>%time%</code></li>
</ul>
<p>These are also helpful for dividing your code up into sections. If your code isn&#8217;t displaying properly, just check that it is under the right redraw heading.</p>
<h2><a name="five"></a>7.2.5 Text, fonts and aligning</h2>
<h3>text</h3>
<p>If the panel supports it (e.g. Track Display panel), you can just write text and it should appear on the panel. You can use titleformatting on the fly, such as &#8220;The artist&#8217;s name is <code>%artist%</code>&#8220;.</p>
<p>For a carriage return, use <code>$char(10)</code>, which is a unicode return.</p>
<h3>font</h3>
<p>Font is defined by the function:</p>
<pre class="brush: php; title: ; notranslate">$font ( font,
    size,
    options,
    colour
)
</pre>
<ul>
<li>font is the name of the font, e.g. &#8220;MS Sans Serif&#8221;</li>
<li>size is the font size, e.g. 13</li>
<li>options can be found on the panelsUI titleformatting page</li>
<li>colour is in RGB format, e.g. 132-35-45</li>
</ul>
<p>An example of this could be:</p>
<pre class="brush: php; title: ; notranslate">$font(Calibri,12,,255-255-255).</pre>
<p>All the text that proceeds this statement will have those properties.</p>
<h3>Align with $ALIGNABS</h3>
<p>Text will be automatically aligned, but if you want to move it to a particular position you can use the <code>$alignabs(...)</code> function. You define an invisible rectangular area, of particular size and position, within which the text will fit. The function follows this format:</p>
<pre class="brush: php; title: ; notranslate">$alignabs ( x , y ,
    width, height,
    h-align, v-align,
)
</pre>
<ul>
<li>x and y define the position of the top left corner of the rectangular area, in pixels/ratio</li>
<li>width and height define the width and height of the rectangular area, in pixels/ratio</li>
<li>h-align defines the horizontal alignment of the text in the rectangle, i.e. left, center or right</li>
<li>v-align defines the vertical alignment of the text in the rectangle, i.e. top, middle or bottom</li>
</ul>
<p>As an example, the following function with text following it:</p>
<pre class="brush: php; title: ; notranslate">$alignabs(50,20,400,200,center,middle)hello</pre>
<p>creates a rectangle at x = 50, y = 20, 400 x 200 pixels, with the text aligned in the center (I&#8217;ve drawn a rectangle around it to show the box):</p>
<div id="attachment_94" class="wp-caption aligncenter" style="width: 505px"><img class="size-full wp-image-94" title="$alignabs example" src="http://joncairns.com/wp-content/uploads/2011/09/alignabs.png" alt="$alignabs example" width="495" height="257" /><p class="wp-caption-text">$alignabs example</p></div>
<p>You can also use <code>$alignrel(h-align, v-align)</code> to quickly realign the text horizontally or vertically.</p>
<h2><a name="six"></a>7.2.6 Buttons</h2>
<p>There are two types of buttons in PanelsUI, font buttons and image buttons. They can be any size, in any position and perform almost any action. This allows for a lot of freedom!</p>
<h3>Image buttons</h3>
<p>Image buttons are created by the following function:</p>
<pre class="brush: php; title: ; notranslate">$button ( x , y ,
    hotspot-x, hotspot-y,
    hotspot-w, hotspot-h,
    image, hover image,
    command,
    options
)
</pre>
<ul>
<li>x and y are the position of the button, in pixels/ratio</li>
<li>hotspot-x and y are the position within the button of the clickable region, leave 0 for whole button to be clickable</li>
<li>hotspot-w and h are the width and height of the clickable region, leave 0 for whole button to be clickable</li>
<li>image and hover image are the paths of the images when unactivated and activated, e.g. &#8220;C:\images\image.jpg&#8221;, without quotes</li>
<li>command refers to the action performed by clicking on the button: the drop-down menus under &#8220;Tools&#8221; at the top of the window show these actions, also go to the panelsUI titleformatting page for special actions</li>
<li>go to the titleformatting page for options, main option is TOOLTIP:&#8221;text&#8221;, providing a mouseover tooltip</li>
</ul>
<p>When your mouse hovers over the button, it will change from the image to the hover image. Clicking it activates the command.</p>
<h3>Text buttons</h3>
<p>Text buttons are created by the following function:</p>
<pre class="brush: php; title: ; notranslate">$button2 ( x , y ,
    hotspot-x, hotspot-y,
    hotspot-w, hotspot-h,
    text, hover text,
    command,
    options
)
</pre>
<ul>
<li>x and y are the position of the button, in pixels/ratio</li>
<li>hotspot-x and y are the position within the button of the clickable region, leave 0 for whole button to be clickable</li>
<li>hotspot-w and h are the width and height of the clickable region, leave 0 for whole button to be clickable</li>
<li>text and hover text refer to the text shown when activated and unactivated</li>
<li>command refers to the action performed by clicking on the button: the drop-down menus under &#8220;Tools&#8221; at the top of the window show these actions, also go to the panelsUI titleformatting page for special actions</li>
<li>go to the titleformatting page for options, main option is TOOLTIP:&#8221;text&#8221;, providing a mouseover tooltip</li>
</ul>
<p>When your mouse hovers over the button, it will change from the text to the hover text. Clicking it activates the command.</p>
<h2><a name="seven"></a>7.2.7 Appearance functions</h2>
<h3>Rectangles</h3>
<p>PanelsUI provides a rectangle draw function, with which you can draw a rectangle of any colour and size, and at any position you choose. The function is written as <code>$drawrect(...)</code>, and follows this format:</p>
<pre class="brush: php; title: ; notranslate">$drawrect ( x , y ,
    a , b ,
    brushcolor-xx pencolor-xx options
)
</pre>
<ul>
<li>x and y define the position of the top left corner of the rectangle, in pixels/ratio</li>
<li>a and b are the width and height of the rectangle, respectively, in pixels/ratio</li>
<li>brushcolor is the fill colour of the rectangle, where &#8220;xx&#8221; can be in the form of &#8220;R-G-B&#8221;, with a 0 to 255 value for each colour, or &#8220;SYSCOL-??&#8221; (two digits)</li>
<li>pencolor is the outline colour of the rectangle, in the same form as brushcolor</li>
<li>see the panelsUI titleformatting reference for all the options</li>
</ul>
<p>An example of this:</p>
<pre class="brush: php; title: ; notranslate">$drawrect( 40 , 40 , 300 , 20 , pencolor-255-0-0 brushcolor-255-255-255 )</pre>
<p>This creates a rectangle 40 pixels from the top left corner of the panel, 300 pixels long by 20 high, with a red outline and white fill:</p>
<p><img class="aligncenter size-full wp-image-154" title="Rectangle with red outline" src="http://joncairns.com/wp-content/uploads/2011/09/rect.png" alt="Rectangle with red outline" width="470" height="93" /></p>
<h3>Images</h3>
<p>PanelsUI has a two brilliant image display functions, written as <code>$imageabs(...)</code> and <code>$imageabs2(...)</code>. They can display an image at a specified size and position, allowing some beautiful layouts if used well. I find that <code>$imageabs2</code> tends to be more reliable, and gives you far more control over your image display, so it&#8217;s best just to use that. It is pretty complicated, but I&#8217;ll try to describe it as well as I can. The format is as follows:</p>
<pre class="brush: php; title: ; notranslate">$imageabs2( a , b ,
    left , down ,
    width, height,
    x , y ,
    path,
    options
)
</pre>
<ul>
<li>a and b define the area taken up by the image, and the image will expand or shrink to fit it</li>
<li>left and down define the position within the image, i.e. left is how many pixels left from the upper left corner, etc. Rarely needed, so setting both to 0 produces no effect</li>
<li>width and height define the cropping width and height. If they are the same as the image size, nothing changes. If they are set to 0 then there is no cropping. If they are set to less than the width or height of the image, the image is cropped to that size</li>
<li>x and y define the position of the top left corner of the image from the top left of the window or panel, in pixels/ratio</li>
<li>path is a reference to the image location on your computer, e.g. &#8220;C:\images\image.jpg&#8221;, without quotes</li>
<li>see the <a onclick="window.open(this.href); return false;" href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:0.9_Track_Info_Panel_Mod_%28foo_uie_trackinfo_mod%29#.24imageabs2">track panel info page</a> for all the options, some include rotating and flipping the image, applying transparency and choosing to retain aspect ratio when resizing</li>
</ul>
<p>An example of this in use would be something like this:</p>
<pre class="brush: php; title: ; notranslate">$imageabs2(250,250,0,0,0,0,20,20,C:\foobar\cdcase.png, nokeepaspect )</pre>
<p>This displays &#8220;cdcase.png&#8221; at 250 x 250 pixels, placed at x = 20, y = 20 in the panel, with no cropping and ignoring aspect ratio:</p>
<div id="attachment_123" class="wp-caption aligncenter" style="width: 373px"><img class="size-full wp-image-123" title="$imageabs2 example" src="http://joncairns.com/wp-content/uploads/2011/09/imageabs2.png" alt="$imageabs2 example" width="363" height="333" /><p class="wp-caption-text">An example of $imageabs2 in use</p></div>
<p>The best way to learn this function is by trying it out with different options and cropping. A good use is in displaying artwork within the single column playlist or track display panel.</p>
<h2><a name="eight"></a>7.2.8 Persistent variables (PVARs)</h2>
<p>PVARs are variables that, dammit, just won&#8217;t go away. If they are assigned a particular value, they have to be explicitly told if that value is to change. In any section of the layout the PVAR can be called upon, and its value will remain consistent. It is useful for creating multiple scenarios within one layout. For instance, you could create a mini-layout and a full-screen layout, and a button click could swap between them. The button click will change the value of the PVAR, and your code will be seperated into two sections, with each section functioning only when the PVAR has a particular value. This may sound confusing, but we&#8217;ll do some practical stuff in the next section so you can pick it up.</p>
<p>A PVAR is defined with the following:</p>
<pre class="brush: php; title: ; notranslate">$setpvar( mypvar, value )</pre>
<p>and recalled with:</p>
<pre class="brush: php; title: ; notranslate">$getpvar( mypvar ).</pre>
<p><strong>Next section:</strong> <a title="foobar2000: 7.3 Creating a PanelsUI layout" href="http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/">7.3 Creating a PanelsUI layout</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foobar2000: 7.1 Finding your way around PanelsUI</title>
		<link>http://joncairns.com/2010/10/foobar2000-7-1-finding-your-way-around-panelsui/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-7-1-finding-your-way-around-panelsui/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 12:57:34 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[panelsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=272</guid>
		<description><![CDATA[This section of the PanelsUI tutorial takes you through the basics of the preferences, and tells you how to make simple changes to the colour scheme. A quick note I know that development for PanelsUI has been paused, quite possibly &#8230; <a href="http://joncairns.com/2010/10/foobar2000-7-1-finding-your-way-around-panelsui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="intro">This section of the PanelsUI tutorial takes you through the basics of the preferences, and tells you how to make simple changes to the colour scheme.</p>
<h2>A quick note</h2>
<p>I know that development for PanelsUI has been paused, quite possibly stopped. Please don&#8217;t email me telling me that my guide is pointless! I still believe this is currently the best UI for foobar, and it is by far the most versatile. There were issues with the 0.14.x release, but the 0.13.x release works beautifully, so you&#8217;ll have very few issues if you use that. And, just in case the developer(s) of panelsUI happen to read this, please start development again!</p>
<h2>Downloading, installing and setting it up</h2>
<p>You can download panelsUI version 0.13.x from <a title="PanelsUI download" onclick="window.open(this.href); return false;" href="http://panels.fooblog2000.com/">here</a>. Place it in your components directory as you would with any other component, and when you next start foobar you should get a dialog asking you to choose your UI. Select panels, and you should see your foobar looking something like this:</p>
<div id="attachment_139" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panels1.png"><img class="size-full wp-image-139" title="PanelsUI default view" src="http://joncairns.com/wp-content/uploads/2011/09/panels1small.png" alt="PanelsUI default view" width="300" height="302" /></a><p class="wp-caption-text">PanelsUI default view</p></div>
<p>Looks pretty naff, I know. But this is merely to throw you off guard, as you have not yet supped the raw power under the bonnet.</p>
<h2>Layout</h2>
<p>The layout is made up of certain panels, such as the &#8220;Track Display&#8221; panel at the top, showing the song title and artist. Just beneath this is the &#8220;Single Column Playlist&#8221;, which shows the queued tracks (or your entire library if unfiltered) organised into albums. Both of these two components come with panelsUI, and are very powerful. The track display panel in particular opens up almost endless possibilities. Below these panels are the buttons and the progress bar (not seek bar yet, as it isn&#8217;t clickable), which are self-explanatory. This layout takes up negligible RAM, but you do pay for it in terms of usability!</p>
<p>With the playlist display, all your tracks are grouped into albums. Each album has a group title on a header or banner, called the &#8220;group display&#8221;, followed by the tracks listed one by one, the &#8220;track display&#8221;. The tracks in an album can be selected by clicking on the header once.</p>
<h2>Settings</h2>
<p>The settings for PanelsUI is in the expected place on the preferences page, in the display tab. Selecting this will produce a window like the following:</p>
<div id="attachment_147" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panelssettings.png"><img class="size-full wp-image-147" title="PanelsUI settings" src="http://joncairns.com/wp-content/uploads/2011/09/panelssettingssmall.png" alt="PanelsUI settings" width="300" height="216" /></a><p class="wp-caption-text">PanelsUI settings</p></div>
<p>Here is where you can choose the layout, and create new ones. You can also define global variables that can be used throughout all sections of the layout. For the moment, we&#8217;ll stick with the default layout and just make a couple of aesthetic changes. Just in case something goes wrong, it&#8217;s best to create a new layout as a copy of the default. Click &#8220;new&#8221; and name your layout, and your layout will be an identical copy of the default layout. Now click &#8220;Edit Layout&#8221; to bring up the editing window.</p>
<h2>What the&#8230;?</h2>
<p>Yes, it looks a little confusing. The first time I opened this up, I gave up on the spot. And I couldn&#8217;t for the life of me find a guide on the internet on how to use it (hence this one)! But after a while I gave it another go, and gradually came to understand it.</p>
<div id="attachment_141" class="wp-caption aligncenter" style="width: 310px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panels2.png"><img class="size-full wp-image-141" title="Panels configuration panel" src="http://joncairns.com/wp-content/uploads/2011/09/panels2small.png" alt="Panels configuration panel" width="300" height="365" /></a><p class="wp-caption-text">Panels configuration panel</p></div>
<p>What you see in front of you is the main layout editing window. From here everything about the layout is controlled. At the top left of the window, under &#8220;Tools&#8221;, are reference tools for things like menu options, available panels and various things that foobar performs. They don&#8217;t actually do anything, they&#8217;re just for jogging your memory for certain options, so you can ignore them for the time being.</p>
<p>To the right of the tools is a display of panels that are included on this layout page. As I showed earlier, there is a track display (called &#8220;Playing&#8221;) and a single column playlist (called &#8220;Playlist2&#8243;). Each of these can be selected, enabling the &#8220;settings&#8221; button to the right. Clicking on settings brings up a similar window, but this window contains the layout for that particular panel.</p>
<div id="attachment_143" class="wp-caption aligncenter" style="width: 480px"><a href="http://joncairns.com/wp-content/uploads/2011/09/panelspanels.png"><img class="size-full wp-image-143" title="Panel configuration" src="http://joncairns.com/wp-content/uploads/2011/09/panelspanels.png" alt="Panel configuration" width="470" height="155" /></a><p class="wp-caption-text">Panel configuration</p></div>
<p>And that&#8217;s how panels works. Code is broken down into sections, with lots of panels performing different jobs and the main layout referring to each of these panels, and placing them at the right place. As you&#8217;ve probably guessed, the main section of the window is taken up by the code, which describes the layout.</p>
<h2>Appearance changes</h2>
<p>Just so that the dullness of the default layout doesn&#8217;t make your eyes bleed much longer, I&#8217;ll give you a few neat little changes to apply. Wherever the word <em>SYSCOL-xx</em> appears, you can replace this with any colour you want (rather than a boring greyish theme). This is done by replacing the word <em>SYSCOL-xx</em> with an RGB value <em>R-G-B</em>, with the dashes. For example, <em>pencolor-SYSCOL-13</em> becomes <em>pencolor-255-255-255</em> for a white border.</p>
<p>Play around with these to find a nice colour scheme. If you want a quick fix, I&#8217;ve made a black and orange themed default layout, which you can get here (click the image):</p>
<div id="attachment_95" class="wp-caption aligncenter" style="width: 509px"><a href="http://joncairns.com/dl/default2.pui"><img class="size-full wp-image-95" title="Black and orange panelsUI theme" src="http://joncairns.com/wp-content/uploads/2011/09/blackorange.png" alt="Black and orange panelsUI theme" width="499" height="166" /></a><p class="wp-caption-text">Download the black and orange panelsUI theme</p></div>
<p>Download this file and move it to your foobar directory, to the PanelsUI folder. Restart foobar, and on the panelsUI main preferences window it should appear in the drop-down layout menu.</p>
<p>In the next section I&#8217;ll go into detail on the code syntax and special panelsUI functions, allowing you to really understand what&#8217;s going on in these windows and giving you the opportunity to make major tweaks.</p>
<p><strong>Next section:</strong> <a title="foobar2000: 7.2 PanelsUI code" href="http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/">7.2 PanelsUI code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-7-1-finding-your-way-around-panelsui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foobar2000: 7. PanelsUI</title>
		<link>http://joncairns.com/2010/10/foobar2000-7-panelsui/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-7-panelsui/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 12:55:59 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[panelsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=257</guid>
		<description><![CDATA[This guide is broken into three parts: 7.1 Finding your way around PanelsUI Provides a basic tutorial on using PanelsUI for the first time, and navigating the various sectionsof the interface Very basic appearance tweaks will be covered 7.2 PanelsUI &#8230; <a href="http://joncairns.com/2010/10/foobar2000-7-panelsui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This guide is broken into three parts:</p>
<ul>
<li><a title="foobar2000: 7.1 Finding your way around PanelsUI" href="http://joncairns.com/2010/10/foobar2000-7-1-finding-your-way-around-panelsui/">7.1 Finding your way around PanelsUI</a>
<ul>
<li>Provides a basic tutorial on using PanelsUI for the first time, and navigating the various sectionsof the interface</li>
<li>Very basic appearance tweaks will be covered</li>
</ul>
</li>
<li><a title="foobar2000: 7.2 PanelsUI code" href="http://joncairns.com/2010/10/foobar2000-7-2-panelsui-code/">7.2 PanelsUI code</a>
<ul>
<li>The code syntax for panelsUI will be explained</li>
<li>The differences between standard title formatting code (see <a title="foobar2000: 6. Code syntax" href="http://joncairns.com/2010/10/foobar2000-6-code-syntax/">previous page</a>) and panelsUI code will be highlighted</li>
<li>Particular focus rectangle, image and button functions</li>
<li>Introduction to persistent variables (PVARs)</li>
</ul>
</li>
<li><a title="foobar2000: 7.3 Creating a PanelsUI layout" href="http://joncairns.com/2010/10/foobar2000-7-3-creating-a-panelsui-layout/">7.3 Creating a layout</a>
<ul>
<li>Creating your first layout with panelsUI and some basic graphics editing</li>
</ul>
</li>
</ul>
<p>A lot of this tutorial is fairly advanced, and if you are new to foobar2000, it is recommended that you start at the <a title="foobar2000: 1. What is it?" href="http://joncairns.com/2010/10/1-what-is-foobar2000/">beginning!</a> Otherwise, onwards&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-7-panelsui/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foobar2000: 6. Code syntax</title>
		<link>http://joncairns.com/2010/10/foobar2000-6-code-syntax/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-6-code-syntax/#comments</comments>
		<pubDate>Tue, 05 Oct 2010 12:27:22 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=260</guid>
		<description><![CDATA[This section goes through the syntax of foobar&#8217;s in-program code. It will allow you to pick up the fundamentals, and hopefully start writing code of your own. Know your friends Before you do anything else, you need to bookmark this &#8230; <a href="http://joncairns.com/2010/10/foobar2000-6-code-syntax/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="intro">This section goes through the syntax of foobar&#8217;s in-program code. It will allow you to pick up the fundamentals, and hopefully start writing code of your own.</p>
<h2>Know your friends</h2>
<p>Before you do anything else, you need to bookmark this site: <a onclick="window.open(this.href); return false;" href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference">http://wiki.hydrogenaudio.org/index.php?title=Foo&#8230;</a>.</p>
<p>There is no chance that you can remember all of the hundreds of functions and field references, and there is no shame in having them all in one handy place. There is also a similar page for panelsUI-specific commands: <a title="foobar2000 commands" onclick="window.open(this.href); return false;" href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Components_0.9/Panels_UI_%28foo_ui_panels%29/Commands" target="_blank">http://wiki.hydrogenaudio.org/index.php?title=Foob&#8230;</a>, but there will be more on panelsUI code later.</p>
<h2>Syntax introduction</h2>
<p>Foobar&#8217;s code is known as &#8220;title formatting&#8221;. The declarations can be divided into two main categories: <span class="bold">field references</span> and<span class="bold"> functions</span>. Field references are things which you can call upon to return a value, such as the name of the artist of the current track or the length of a song. Functions will perform a particular action on something, such as converting a word to uppercase letters or defining a colour.</p>
<p><span class="bold">Field references</span> are within two percentage symbols, e.g. <code>%artist%</code>, which would return the name of the artist. You can find and edit some of these if you go to the properties page of a track, such as <code>%title%, %album%, %genre%</code>, etc.</p>
<p><span class="bold">Functions</span> are written with a dollar symbol beforehand, and brackets enclosing the functionee, e.g. <code>$upper(%artist%)</code>, which would return the name of the artist but in uppercase letters. You can have functions within functions, and field references within functions are essential to editing.</p>
<p><span class="bold;">Strings</span> are also an important concept. They simply mean words, i.e. a string of letters, so, for example, <code>%artist%</code> returns a string.</p>
<p>Sound simple? Well it is, at the moment. This is just the tip of the iceberg, Timmy.</p>
<p>One quick note: I won&#8217;t really be providing any sort of context for the code on this page. This will be about getting you familiar with the way the code works, and I&#8217;ll put it in context on the respective columnsUI and panelsUI pages.</p>
<h2>If statements</h2>
<p>If you are familiar with any programming language then you will know about <em>if statements</em>. I&#8217;ll explain them anyway. They are extremely instrumental in all languages, and allow for programs, or foobars in this case, to make intelligent decisions. They work by saying &#8220;if this is true then I&#8217;ll do this, but if it isn&#8217;t true I&#8217;ll do this instead&#8221;.</p>
<p>Let&#8217;s take the following example: I want one of my columns in my foobar to display the artist name, but if there is no artist then I want it to say &#8220;No Artist&#8221; rather than just saying nothing. Foobar&#8217;s if statement looks like the folloing:</p>
<pre class="brush: php; title: ; notranslate">$if( condition, thendothis, otherwisedothis )</pre>
<p>The statement will always treat the &#8220;condition&#8221; as true or false, 1 or 0, so it needs to be the right kind of variable. So I could put <code>%artist%</code> in the condition part and the evaluate part, and that would be fine. My code will look like this:</p>
<pre class="brush: php; title: ; notranslate">$if(%artist%,%artist%,'No Artist')</pre>
<p>If you are using the default UI or columnsUI, you will have to put words that are in functions (like above, with &#8216;No Artist&#8217;) within single quotes. PanelsUI allows for no quotes.</p>
<p>There are several variants on the if statement with foobar, such as:</p>
<pre class="brush: php; title: ; notranslate">$ifgreater(a,b,one,two)</pre>
<p><em>If a is greater than b then carry out one, otherwise two</em></p>
<pre class="brush: php; title: ; notranslate">$if3(a,b,c,d... else)</pre>
<p><em>This will keep evaluating any arguments until one is found to be true, and then it returns that value; otherwise returns else</em></p>
<p>The other <code>$if</code> related statements can be found on the <a onclick="window.open(this.href); return false;" href="http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#.24if2.28a.2Celse.29">title formatting</a> web page.</p>
<h2>Variables</h2>
<p>Foobar allows for the use of variables, a basic building block of programming. I won&#8217;t spend time explaining what a variable is, but I&#8217;ll give an example. A variable is defined by using the <code>$put</code> or <code>$puts</code> statement, which does what it says: it &#8220;puts&#8221; something (a word, number, field reference, etc.) into storage for later use. You can then recover this variable with the <code>$get</code> statement. The <code>$put</code> or <code>$puts</code> statement works like this:</p>
<pre class="brush: php; title: ; notranslate">$put(myvariable,something)</pre>
<p>&#8220;something&#8221; will then be stored in a variable called &#8220;myvariable&#8221;. To return the variable at any time, we would use <code>$get(myvariable)</code>. This would give the output of &#8220;something&#8221;. E.g.:</p>
<pre class="brush: php; title: ; notranslate">$put(doo,foo)
$put(dah,bar)
get(doo)$get(dah) = foobar</pre>
<p><code>$put</code> and <code>$puts</code> work differently in that <code>$put</code> will always output whatever you give it as well as storing it, whereas <code>$puts</code> will only store it.</p>
<h2>Colours and pretty things</h2>
<p>You can define a colour for text using <code>$rgb(r,g,b,r1,g1,b1)</code>, where <em>r</em>, <em>g</em> and <em>b</em> define the normal colour in red, green and blue and <em>r1</em>, <em>g1</em> and <em>b1</em> define the colour when the text is selected. Useful for specific visual styling. For other methods of defining colours see the title formatting page.</p>
<p>Colours can also be blended using the <code>$blend</code> function:</p>
<pre class="brush: php; title: ; notranslate">$blend(colour1,colour2,x,total)</pre>
<p>where x is however many &#8220;parts&#8221; of colour1 and total is the total number of &#8220;parts&#8221;. Therefore the number of parts of colour2 will be total-x. The result will be a mixture of the two colours, much like mixing a drink. Nine parts gin, one part tonic&#8230;</p>
<p>Strings can have a colour transition applied to them, using the <code>$transition</code> function:</p>
<pre class="brush: php; title: ; notranslate">$transition(string,color1,color2)</pre>
<p>As a bit of an unattractive example, choosing <code>%artist%</code> as the string and the colours as red and blue, you would get something like the following:</p>
<p style="text-align: center;"><img class="size-full wp-image-165 aligncenter" title="Example colour transition" src="http://joncairns.com/wp-content/uploads/2011/09/transition.png" alt="Example colour transition" width="82" height="56" /></p>
<p>Unfortunately, it&#8217;s hard to make that function look good. So go for subtle transitions if you are going to use it.</p>
<h2>String functions</h2>
<p>There are loads. You can do almost anything with your words, if you know how &#8211; this is another great strength of foobar. So check out the title formatting page (I can&#8217;t be bothered to keep putting a link on that, just look at the top) and scroll to the strings bit. Here are some of Jon&#8217;s top string functions:</p>
<ul>
<li><code>$upper(s)</code> &#8211; converts string s to uppercase</li>
<li><code>$len(s)</code> &#8211; calculates length of string</li>
<li><code>$char(x)</code> &#8211; inserts <a onclick="window.open(this.href); return false;" href="http://en.wikipedia.org/wiki/List_of_Unicode_characters">unicode character (list here)</a>, but you need it in decimal mode, so use <a onclick="window.open(this.href); return false;" href="http://rishida.net/scripts/uniview/conversion.php">this site</a></li>
<li><code>$progress(pos,range,len,a,b)</code> &#8211; creates progress bar where <em>pos</em> would be <code>%_time_elapsed_seconds%</code>, <em>range </em>is <code>%_time_total_seconds%</code>, <em>len</em> is how long you want the bar to be, and <em>a</em> and <em>b</em> are characters/strings that will make the physical appearance of the bar</li>
</ul>
<p>There are plenty more, such as functions that cut strings up into pieces, compare two strings to each other and move prefixes such as &#8220;A&#8221; and &#8220;The&#8221; to the end of the string.</p>
<h2>Mathematical/boolean functions</h2>
<p>If it really gets you going, you might like to do a bit of maths while listening to your music. And I&#8217;m happy to report that foobar can accomodate you, you weirdo.</p>
<ul>
<li><code>$add(a,b)</code>, <code>$mul(a,b)</code> &#8211; adds/multiplies a and b</li>
<li><code>$div(a,b)</code>, <code>$sub(a,b)</code> &#8211; divides a by b, subtracts b from a</li>
<li><code>$greater(a,b)</code> &#8211; if <em>a</em> is greater than <em>b</em> returns true (i.e. &#8220;1&#8243;), otherwise false</li>
</ul>
<p>Etc. The others are listed&#8230; guess where?</p>
<p>Boolean functions such as <strong>AND</strong>, <strong>OR</strong>, <strong>NOT</strong> are also supported by foobar.</p>
<h2>Final words</h2>
<p>Well that&#8217;s it my friends. You will soon enjoy a total dive into social isolation as you realise how stupidly addictive it is just to tweak even the tiniest settings of your foobar.</p>
<p>Enjoy.</p>
<p><strong>Next section:</strong> <a title="foobar2000: 7. PanelsUI" href="http://joncairns.com/2010/10/foobar2000-7-panelsui/">7. PanelsUI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-6-code-syntax/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>foobar2000: 5.3 Tweaking ColumnsUI</title>
		<link>http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 13:12:25 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[columnsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=225</guid>
		<description><![CDATA[This section involves the use of in-program code to make tweaks to the appearance and functionality of your foobar. To do this section you will need to be familiar with foobar&#8217;s code syntax. If you aren&#8217;t then take a look &#8230; <a href="http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>This section involves the use of in-program code to make tweaks to the appearance and functionality of your foobar.</em></p>
<p>To do this section you will need to be familiar with foobar&#8217;s code syntax. If you aren&#8217;t then take a look at part 6 first, then come back here.</p>
<h2>Editing the title bar</h2>
<p>We&#8217;ll start off nice and easy. Under the &#8220;main&#8221; tab of ColumnUI&#8217;s preferences, at the bottom of the window, you&#8217;ll find a box entitled &#8220;Main window title format script&#8221;. You can freely edit what it says at the top of your foobar using titleformatting, instead of having just the default &#8220;foobar2000&#8243;. I like to have it display the song title, artist name and the playback time and length, so the script will look like this:</p>
<pre class="brush: php; title: ; notranslate">foobar 2000 - %artist%: %title% '('%playback_time%/%length%')'</pre>
<p>This gives a title bar that looks like this:</p>
<div id="attachment_162" class="wp-caption aligncenter" style="width: 360px"><a href="http://joncairns.com/wp-content/uploads/2011/09/titlebar.png"><img class="size-full wp-image-162" title="Window title bar" src="http://joncairns.com/wp-content/uploads/2011/09/titlebar.png" alt="Window title bar" width="350" height="46" /></a><p class="wp-caption-text">Window title bar</p></div>
<p>The title bar format area will read everything you put in, including spaces, and doesn&#8217;t require quotes for words and most letters. Certain letters such as $ and ( or ) need to be enclosed in apostrophes to show.</p>
<p>At one point I made a little progress bar that appeared in the title bar, and though it can look a bit naff the code would be something like this:</p>
<pre class="brush: php; title: ; notranslate">|$progress(%_time_elapsed_seconds%,%_time_total_seconds%,100,#,-)|</pre>
<div id="attachment_150" class="wp-caption aligncenter" style="width: 480px"><a href="http://joncairns.com/wp-content/uploads/2011/09/progress.png"><img class="size-full wp-image-150" title="Window title progress bar" src="http://joncairns.com/wp-content/uploads/2011/09/progress.png" alt="Window title progress bar" width="470" height="43" /></a><p class="wp-caption-text">Window title progress bar</p></div>
<p>Lovely, no? You can change the length of the bar by changing &#8220;100&#8243; to whatever number you like, and can change the characters that make up the bar.</p>
<p>Would love to hear if you come up with anything inventive and attractive to put in the title bar!</p>
<h2>Global variables</h2>
<p>An important concept in ColumnsUI is the global variable. This works by setting a variable that can be called upon anywhere within the columnsUI appearance preferences. They are set in the globals window, under &#8220;playlist view&#8221;, and in the variables tab:</p>
<div id="attachment_121" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/globals2.png"><img class="size-full wp-image-121" title="Playlist view global variables" src="http://joncairns.com/wp-content/uploads/2011/09/globals2small.png" alt="Playlist view global variables" width="330" height="240" /></a><p class="wp-caption-text">Playlist view global variables</p></div>
<p>Global variables follow the same structure as normal variables, i.e.:</p>
<pre class="brush: php; title: ; notranslate">$set_global(myvariable,something)</pre>
<p>In this case, &#8220;something&#8221; is put into &#8220;myvariable&#8221;. They can then be called by using:</p>
<pre class="brush: php; title: ; notranslate">$get_global(myvariable)</pre>
<p>This is very useful for defining a set of colours that you will use regularly, particularly when it comes to using the &#8220;Columns&#8221; tab (top of the window, I&#8217;ll go through that soon). For instance,</p>
<pre class="brush: php; title: ; notranslate">$set_global(mycolour1,$rgb(233,0,20))</pre>
<p>sets a reddish colour as a global variable &#8220;mycolour1&#8243; that I can call upon any time.</p>
<h2>Columns editing</h2>
<p>This is where columnsUI gets really good. You see all those columns in the columns playlist on your foobar? You can edit all sorts of things about them, such as what they display, their visual style and the way they sort (though I won&#8217;t touch on that, I think they sort fine). On the &#8220;playlist view&#8221; page in preferences head to the &#8220;columns&#8221; tab at the top of the window, and you&#8217;ll see something like this:</p>
<div id="attachment_104" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/columnsview.png"><img class="size-full wp-image-104" title="Columns in playlist view" src="http://joncairns.com/wp-content/uploads/2011/09/columnsviewsmall.png" alt="Columns in playlist view" width="330" height="239" /></a><p class="wp-caption-text">Columns in playlist view</p></div>
<p>Yours, however, will look different as I have a silly number of columns, for different occasions.</p>
<p><em>More coming soon&#8230;hopefully. Although I wrote this about 3 years ago.</em></p>
<p><strong>Next section: </strong><a title="foobar2000: 6. Code syntax" href="http://joncairns.com/2010/10/foobar2000-6-code-syntax/">6. Code Syntax</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foobar2000: 5.2 Creating a ColumnsUI layout</title>
		<link>http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 12:53:58 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[columnsUI]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=220</guid>
		<description><![CDATA[This section of the ColumnsUI tutorial involves creating a basic itunes-style layout, then a more advanced version. Required components To create a basic iTunes layout, the following components (not included with columnsUI) are required: Album art panel (foo_uie_albumart) Music browser &#8230; <a href="http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>This section of the ColumnsUI tutorial involves creating a basic itunes-style layout, then a more advanced version.</em></p>
<h3>Required components</h3>
<p>To create a basic iTunes layout, the following components (not included with columnsUI) are required:</p>
<ul>
<li>Album art panel (<em>foo_uie_albumart</em>)</li>
<li>Music browser (<em>foo_browser</em>)</li>
<li>Quick search toolbar (<em>foo_uie_quicksearch</em>)</li>
</ul>
<p>To create the advanced iTunes layout, the additional components are required:</p>
<ul>
<li>PanelsUI (but you don&#8217;t need to know how to use it!)</li>
<li>Power Panels (foo_uie_powerpanels)</li>
<li>(Optional) Channel spectrum panel (foo_uie_vis_channel_spectrum)</li>
</ul>
<h2>5.2.1 Creating a basic version</h2>
<h3>Basic layout</h3>
<p>Create a new preset in the columns UI preferences window, layout tab. The basic layout is as follows:</p>
<div id="attachment_125" class="wp-caption aligncenter" style="width: 224px"><a href="http://joncairns.com/wp-content/uploads/2011/09/itunes_basic.png"><img class="size-full wp-image-125" title="Basic itunes layout" src="http://joncairns.com/wp-content/uploads/2011/09/itunes_basic.png" alt="Basic itunes layout" width="214" height="295" /></a><p class="wp-caption-text">Basic itunes layout</p></div>
<p>This gives you the shape, though there&#8217;s plenty of tweaking to be done.</p>
<p>Firstly, remove the captions for everything except the playlist switcher, album art and browser panels by clicking on each item in the layout and unclicking &#8220;Show caption&#8221; in the item details menu. Click on the first browser panel in the layout list, and in the item details menu click &#8220;configure&#8221; near the bottom. In the pop-up menu that appears, choose &#8220;Genre&#8221;. Then click &#8220;Use custom title&#8221; and type in &#8220;Genre&#8221;. Do similar things for the next two, but replace genre with artist and then album.</p>
<p>For the album art to work, you need to place the cover image file in the folder that contains the album, and name the file &#8220;folder&#8221;, &#8220;cover&#8221; or &#8220;front&#8221; plus the extension. You can call them something else, but you have to add the name in the album art preferences by right clicking on the panel and moving to the &#8220;Sources&#8221; tab.</p>
<h3>Colours and fonts</h3>
<p>Go to the &#8220;Colours and Fonts&#8221; sub-section of columnsUI preferences, and go to the fonts tab.</p>
<div id="attachment_116" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/fonts.png"><img class="size-full wp-image-116" title="Colours and fonts panel" src="http://joncairns.com/wp-content/uploads/2011/09/fontssmall.png" alt="Colours and fonts panel" width="330" height="82" /></a><p class="wp-caption-text">Colours and fonts panel</p></div>
<p>For the element &#8220;Common (list items)&#8221;, select Custom from the mode selection menu. Then choose Microsoft Sans Serif, 9pt as the font. Do the same for &#8220;Columns Playlist (items)&#8221;, except 8pt.</p>
<p>Under the colours tab, use the following tables to apply the red-green-blue colours for the elements &#8220;Playlist Switcher&#8221; and &#8220;Global&#8221;. For each element you modify, you have to select &#8220;Custom&#8221; from the the mode selection menu.</p>
<table class="foobar" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<th></th>
<td>Foreground:</td>
<td>Background:</td>
</tr>
<tr>
<td>Item:</td>
<td>0-0-0</td>
<td>219-215-240</td>
</tr>
<tr>
<td>Selected item:</td>
<td>255-255-255</td>
<td>71-105-224</td>
</tr>
<tr>
<td>Inactive selected item:</td>
<td><small>0-0-0</small></td>
<td><small>170-170-170</small></td>
</tr>
</tbody>
</table>
<p>Then head to the &#8220;Playlist view&#8221; subsection of Columns UI preferences, and then the &#8220;Globals&#8221; tab, then the &#8220;Style&#8221; sub-tab on that page:</p>
<div id="attachment_122" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/globals.png"><img class="size-full wp-image-122" title="Global style variables" src="http://joncairns.com/wp-content/uploads/2011/09/globalssmall.png" alt="Global style variables" width="330" height="129" /></a><p class="wp-caption-text">Global style variables</p></div>
<p>Select everything in the style window, and replace it with:</p>
<pre class="brush: php; title: ; notranslate">
$ifequal($mod(%playlist_number%,2),0,
$puts(back,$rgb(240,240,255))
,
$puts(back,$rgb(255,255,255))
)
$puts(back-selected,$rgb(80,113,226))
$puts(back-selected-no-focus,$rgb(172,172,172))
$set_style(back,$get(back),$get(back-selected),$get(back-selected-no-focus)))
</pre>
<p>You don&#8217;t need to know what that means yet. It should provide a nice alternating white and very light blue background for the playlist, just like iTunes. Oooh, itunesy.</p>
<h3>Browser</h3>
<p>You can change the colours of the browser panels by going to &#8220;Preferences -&gt; Media -&gt; Browser&#8221;:</p>
<div id="attachment_96" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/browser.png"><img class="size-full wp-image-96" title="Browser playlist panel" src="http://joncairns.com/wp-content/uploads/2011/09/browser_small.png" alt="Browser playlist panel" width="330" height="239" /></a><p class="wp-caption-text">Browser playlist panel</p></div>
<p>Tick the custom selection colours box, and use the following colours to get the right combination:</p>
<table class="foobar" border="1" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td>Hilite Color (Focus)</td>
<td>71-105-224</td>
</tr>
<tr>
<td>Text Color (Focus)</td>
<td>255-255-255</td>
</tr>
<tr>
<td>Hilite Color (Non-Focus)</td>
<td>170-170-170</td>
</tr>
<tr>
<td>Text Color (Non-Focus)</td>
<td>0-0-0</td>
</tr>
</tbody>
</table>
<p>Again, use Microsoft Sans Serif 9pt for font.</p>
<p>You should also select &#8220;Automatically Activate&#8221; on the browser. You can rename the &#8220;*Browser*&#8221; playlist to anything else, such as &#8220;My Music&#8221;. And finally, check &#8220;Hide Column Headers&#8221;, which will mean that all your panel captions are of the same format. This looks especially good in Vista.</p>
<p>One thing I find useful is to map a keyboard shortcut to  refresh the browser contents. When you start using the browser, you narrow your libray down and effectively make your playlist smaller, but you can bring your whole library back by refreshing the browser contents. This can be done in the main menu, or, as is my preference, by mapping a keyboard command to it. This is done in the preferences window, under &#8220;General -&gt; Keyboard Shortcuts&#8221;. Click &#8220;Add New&#8221;, then type in &#8220;refresh&#8221; in the filter box, then select the command. With your new shortcut still selected, put in a suitable keyboard command. Then save.</p>
<h2>5.2.2 Creating a more advanced version</h2>
<p>The finished result will hopefully look something like this:</p>
<div id="attachment_127" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/itunes.png"><img class="size-full wp-image-127" title="iTunes style layout" src="http://joncairns.com/wp-content/uploads/2011/09/itunessmall.png" alt="iTunes style layout" width="330" height="226" /></a><p class="wp-caption-text">iTunes style layout</p></div>
<p>The advanced layout makes use of the &#8220;Track Display&#8221;, which is a component that comes with panelsUI. Having unzipped panelsUI to your components folder, make sure you load your foobar with columnsUI.</p>
<p>Firstly, create the following layout, following with the steps shown in the basic section to configure the panels:</p>
<div id="attachment_124" class="wp-caption aligncenter" style="width: 224px"><a href="http://joncairns.com/wp-content/uploads/2011/09/itunes_advanced.png"><img class="size-full wp-image-124" title="iTunes advanced layout" src="http://joncairns.com/wp-content/uploads/2011/09/itunes_advanced.png" alt="iTunes advanced layout" width="214" height="216" /></a><p class="wp-caption-text">iTunes advanced layout</p></div>
<p>Then download the following rar file containing images (that I&#8217;ve created to mimick iTunes, completely from scratch to avoid copyright issues):</p>
<p><a onclick="window.open(this.href); return false;" href="http://www.joncairns.com/dl/myitunes.rar">Download myitunes.rar</a></p>
<p>Extract this to a memorable directory: I chose C:\foobar\myitunes as the directory for my images, and it will be very easy for you if you do the same, otherwise you will have to follow the steps in italics below. <em>(Edit: how Windows-biased was I back then?)</em></p>
<p>Go to the layout page. For the first track display panel, select it and click configure at the bottom right of the window. You will get a window with lots of code in. Delete all the text in the window that comes up, and copy and paste the code from the following text file:</p>
<p class="center"><a onclick="window.open(this.href); return false;" href="http://www.joncairns.com/dl/trackdisplay1.txt">top track display</a></p>
<p>You will end up with this (hopefully):</p>
<div id="attachment_164" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/trackdisplay.png"><img class="size-full wp-image-164" title="Track display script" src="http://joncairns.com/wp-content/uploads/2011/09/trackdisplaysmall.png" alt="Track display script" width="330" height="272" /></a><p class="wp-caption-text">Track display script</p></div>
<p class="bold">Ignore this if you used C:\foobar\myitunes as the image directory</p>
<p class="indent">At the top of the track display window, there will be a couple of lines starting with &#8220;//&#8221;, which are comments. After that, you will see <code>$puts(path,'C:\foobar\myitunes\')</code>. Here you should replace the directory in quotes with your directory, also in quotes. Then follow the page down to some more comments, where it says &#8220;You also need to change the location of slider.png&#8230;&#8221;. After the comments, wherever you see C:\foobar\myitunes\ you should replace it with your directory.</p>
<h3 class="bold">Ok, stop ignoring now</h3>
<p>Now click &#8220;ok&#8221; on the track display panel window, then &#8220;apply&#8221; on the columnsUI window, and the changes will be made. For the second track display panel use the code from this file:</p>
<p class="center"><a onclick="window.open(this.href); return false;" href="http://www.joncairns.com/dl/trackdisplay2.txt">top trackdisplay</a></p>
<p>Again, replace the directory as required.</p>
<p>If it all works correctly, then that&#8217;s great! Chances are that there could be problems with things in the track displays overlapping or not quite fitting. That&#8217;s because I&#8217;m using a different resolution screen to you &#8211; try this one:</p>
<p class="center"><a href="http://www.joncairns.com/dl/trackdisplay3.txt" target="_blank">top track display &#8211; smaller</a></p>
<p>To configure the spectrum, click on the little button to the left of the seekbar on the top track panel, which will bring up the spectrum meter in default format:</p>
<div id="attachment_166" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/visualbutton.png"><img class="size-full wp-image-166" title="Visual spectrum button" src="http://joncairns.com/wp-content/uploads/2011/09/visualbutton.png" alt="Visual spectrum button" width="330" height="119" /></a><p class="wp-caption-text">Click this to bring up the spectrum analyser</p></div>
<p>Right click on the spectrum in the main foobar window and click configure. Choose a light grey foreground1, and black for foreground2 and background. Check &#8220;transparent background&#8221; and &#8220;bar mode&#8221;, and choose a bar width of 4. It should look like this:</p>
<div id="attachment_167" class="wp-caption aligncenter" style="width: 378px"><a href="http://joncairns.com/wp-content/uploads/2011/09/visualconfig.png"><img class="size-full wp-image-167" title="Spectrum configuration" src="http://joncairns.com/wp-content/uploads/2011/09/visualconfig.png" alt="Spectrum configuration" width="368" height="358" /></a><p class="wp-caption-text">Spectrum configuration</p></div>
<p>That should give you a good iTunes style spectrum meter. Play around with the settings of the spectrum, you can get some great effects.</p>
<p>This brings an end to the iTunes layout tutorial. I hope you&#8217;ve had success! If you haven&#8217;t, email me at <a href="mailto:jon@joncairns.com">jon@joncairns.com</a> and let me know the problem. Next we&#8217;ll look at some advanced tweaking.</p>
<p><strong>Next section:</strong><a title="foobar2000: 5.3 Tweaking ColumnsUI" href="http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/"> 5.3 Tweaking ColumnsUI</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foobar2000: 5.1 Finding your way around ColumnsUI</title>
		<link>http://joncairns.com/2010/10/foobar2000-5-1-getting-started-with-columnsui/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-5-1-getting-started-with-columnsui/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 12:48:14 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[columnsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=217</guid>
		<description><![CDATA[Welcome to the world of ColumnsUI. This section will go through the basics, such as finding your way through the preferences, and creating a simple layout. Getting started When you&#8217;ve unzipped the columns dll to your foobar components directory and &#8230; <a href="http://joncairns.com/2010/10/foobar2000-5-1-getting-started-with-columnsui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><em>Welcome to the world of ColumnsUI. This section will go through the basics, such as finding your way through the preferences, and creating a simple layout.</em></p>
<h2>Getting started</h2>
<p>When you&#8217;ve unzipped the columns dll to your foobar components directory and load foobar for the first time, it will ask you which user interface you would like to use &#8211; choose columns. A dialog will then come up requesting a quick setup. Choose &#8220;Columns Playlist + Playlist Tabs&#8221;, as we&#8217;re going to make a layout similar to the others, and I don&#8217;t want to make it too easy for you. You can use Vista theming if you fancy.</p>
<p>The layout of your foobar will be controlled by from the Preferences, under &#8220;Display -&gt; Columns UI&#8221; tab. When you click on this tab, a page like the following will appear:</p>
<div id="attachment_99" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/columns1.png"><img class="size-full wp-image-99" title="ColumnsUI preferences" src="http://joncairns.com/wp-content/uploads/2011/09/columns1small.png" alt="ColumnsUI preferences" width="330" height="239" /></a><p class="wp-caption-text">ColumnsUI preferences panel</p></div>
<p>This is the main page of the columnsUI preferences. On the main page, you can access various tabs, which are described as follows:</p>
<ul>
<li><span class="bold"><strong>Main</strong> &#8211; </span>Not hugely important, but the FCS/FCL stuff is about importing and exporting layouts. You can also control the transparency of your window, choosing an alpha value between 0 (invisible) and 255 (opaque).</li>
<li><span class="bold"><strong>Layout</strong> &#8211; </span>The overall shape of your foobar is controlled from here, and this page will mostly explain how to use this.</li>
<li><span class="bold"><strong>Status bar</strong> &#8211; </span>This controls the bar shown at the bottom of the window, giving information such as volume, audio codec, bitrate, sample rate, etc.</li>
<li><span class="bold"><strong>Notification area</strong> &#8211; </span>You can use a windows tooltip to give you track information, and this page also controls tray icon properties.</li>
<li><span class="bold"><strong>Filter</strong> &#8211; </span>Ah, don&#8217;t even bother going here yet.</li>
<li><span class="bold"><strong>Artwork</strong> &#8211; </span>Or here. You can get better artwork components anyway.</li>
</ul>
<p>The sub-categories for Columns UI are &#8220;Colours and Fonts&#8221;, &#8220;Playlist switcher&#8221; and &#8220;Playlist view&#8221;, but we&#8217;ll get to those later.</p>
<h2>Creating a layout</h2>
<p>Click on the <span class="bold">layout</span> tab, and you&#8217;ll see something like this:</p>
<div id="attachment_101" class="wp-caption aligncenter" style="width: 340px"><a href="http://joncairns.com/wp-content/uploads/2011/09/columns2.png"><img class="size-full wp-image-101" title="ColumnsUI layout preferences" src="http://joncairns.com/wp-content/uploads/2011/09/columns2small.png" alt="ColumnsUI layout preferences" width="330" height="239" /></a><p class="wp-caption-text">ColumnsUI layout preferences panel</p></div>
<p>We&#8217;re going to create a simple layout, with just a playlist selector on one side of the screen, and a playlist display on the other side. The default preset should be &#8220;Default&#8221;. To create a new layout, click &#8220;New&#8221; next to the preset selector, and create a name (I&#8217;ve inventively called mine &#8220;columns&#8221;, but the name has no effect on the appearance). By default, the box displaying the layout information contains a single panel called &#8220;Columns playlist&#8221;.</p>
<p>ColumnsUI works by using vertical and horizontal splitters to divide up the window, and you can place panels within each section that you create. Therefore, right click on &#8220;Columns Playlist&#8221; to bring up a menu, then go to &#8220;Change base -&gt; Splitters -&gt; Horizontal splitter&#8221;. Then right click on the splitter, and go to &#8220;Insert panel -&gt; Panel -&gt; Playlist switcher&#8221;, then right click on the splitter again and go to &#8220;Inset panels -&gt; Playlist views -&gt; Columns playlist&#8221;. You can find item details for each item on the layout tree, just to the right. You can hide any of the panels, choose not to show the caption, etc.</p>
<p>Click on &#8220;Apply&#8221; and watch your foobar change! There&#8217;s no need to exit the preferences window, as you can click on anything in the main window with it still open <span class="bold;">(if you are ever worried that you&#8217;ve lost the menu, you can use <em>Ctrl+P</em> to bring up the preferences at any time)</span>. Your foobar will be split down the middle with your music on the right, and a playlist organiser showing one or two playlists on the left.</p>
<h2>Using the layout</h2>
<p>On the left, the &#8220;playlist switcher&#8221; will display any saved playlists you have, and you can add new playlists by right clicking on the panel and going to &#8220;new&#8221;. The easiest way to add tracks to a playlist is by selecting them and holding the right mouse button, then moving to the playlist and dropping the files on to it. You can also add them by right clicking on the tracks, and going to &#8220;Edit other&#8221; to find playlist tools.</p>
<p>You can resize splitters by hovering your mouse over the splitter boundaries, an extremely useful property. You can place panels and splitters within other splitters to get some interesting layouts.</p>
<p>You can also move all the buttons and toolbars that are at the top of the window by default. You can do this by navigating to the Main tab of the columns UI preferences and unselecting the &#8220;show toolbars&#8221; box. Then you can place the seekbar, menu, buttons, etc. wherever you like. For example, try the following layout tree, selecting no caption for each item:</p>
<div id="attachment_102" class="wp-caption aligncenter" style="width: 476px"><a href="http://joncairns.com/wp-content/uploads/2011/09/columnslayout.png"><img class="size-full wp-image-102" title="A good columns layout" src="http://joncairns.com/wp-content/uploads/2011/09/columnslayout.png" alt="A good columns layout" width="466" height="363" /></a><p class="wp-caption-text">A good columns layout tree</p></div>
<p>After some resizing, you will have a layout with a playlist switcher on the left, queued tracks on the right, and a seekbar plus toolbar at the bottom. Ha! We have broken the mould of programs with menus at the top.</p>
<p>Have a play around with the layouts, and try different combinations of panels. In the &#8220;Colours and Fonts&#8221; sub-section, you can can completely customise the&#8230; erm&#8230; colours and fonts. It&#8217;s pretty self-explanatory, so mess around with that and see what you get.</p>
<p>When you&#8217;ve got a set-up you can use, click &#8220;Save all&#8221; at the bottom-right of the preferences window.</p>
<p>In the next section, I&#8217;ll go through the steps to create an iTunes-style layout.</p>
<p><strong>Next section:</strong> <a title="foobar2000: 5.2 Creating a ColumnsUI layout" href="http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/">5.2 Creating a ColumnsUI layout </a></p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-5-1-getting-started-with-columnsui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>foobar2000: 5. ColumnsUI</title>
		<link>http://joncairns.com/2010/10/foobar2000-5-columnsui/</link>
		<comments>http://joncairns.com/2010/10/foobar2000-5-columnsui/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 12:46:55 +0000</pubDate>
		<dc:creator>joonty</dc:creator>
				<category><![CDATA[foobar2000]]></category>
		<category><![CDATA[columnsUI]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://joncairns.com/?p=214</guid>
		<description><![CDATA[This guide is broken into three parts: 5.1 Finding your way around ColumnsUI Provides a basic tutorial on using ColumnsUI for the first time, and navigating the columnsUI preferences Goes through the process of creating a simple layout 5.2 Creating &#8230; <a href="http://joncairns.com/2010/10/foobar2000-5-columnsui/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This guide is broken into three parts:</p>
<ul>
<li><a title="foobar2000: 5.1 Finding your way around ColumnsUI" href="http://joncairns.com/2010/10/foobar2000-5-1-getting-started-with-columnsui/">5.1 Finding your way around ColumnsUI</a>
<ul>
<li>Provides a basic tutorial on using ColumnsUI for the first time, and navigating the columnsUI preferences</li>
<li>Goes through the process of creating a simple layout</li>
</ul>
</li>
<li><a title="foobar2000: 5.2 Creating a ColumnsUI layout" href="http://joncairns.com/2010/10/foobar2000-5-2-creating-a-columnsui-layout/">5.2 Creating an iTunes style layout</a>
<ul>
<li>Both a simple and advanced aproach to creating an iTunes style foobar</li>
<li>A look at fonts and colours</li>
<li>Short tutorial on using foo_browser</li>
<li>Image and code downloads for creating the perfect lookalike</li>
</ul>
</li>
<li><a title="foobar2000: 5.3 Tweaking ColumnsUI" href="http://joncairns.com/2010/10/foobar2000-5-3-tweaking-columnsui/">5.3 Code-based tweaks (advanced)</a>
<ul>
<li>Some more loose ends with columnsUI</li>
<li>Editing your toolbar</li>
<li>Changing playlist properties</li>
<li>Using frames, progress bars, etc.</li>
</ul>
</li>
</ul>
<p>The third section involves the use of foobar&#8217;s scripting language, which is explained more in the next section. If you&#8217;re new to this, it&#8217;s advised that you miss it out, and maybe come back to it after looking at the code section.</p>
]]></content:encoded>
			<wfw:commentRss>http://joncairns.com/2010/10/foobar2000-5-columnsui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

