Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
customization:songtree [2007/10/10 00:47] – added documentation for user-editable group settings squentin | customization:songtree [2022/05/23 01:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | This page describe how to customize the SongTree, a new widget introduced in version 0.962 \\ | ||
+ | An example of a SongTree can be seen in this [[http:// | ||
+ | |||
+ | Very rough and incomplete draft, better than nothing | ||
+ | |||
+ | ====== Overview ====== | ||
+ | ===== Groups ===== | ||
+ | In a SongTree, the songs are grouped together when they share a common tag (example : same album). Groups can be in turn grouped together (example : same artist). | ||
+ | |||
+ | Groups appearances are customizable by " | ||
+ | |||
+ | All groups of a level share the same values for these six options (head, tail, left, right, vmin, vcollapse), they are evaluated only once, after the grouping configuration is changed. | ||
+ | |||
+ | The skin also defines objects, that will be drawn around the songs/inner groups. | ||
+ | |||
+ | ===== Columns ===== | ||
+ | The columns in a SongTree are also customizable in much the same way as groups. But instead of the head/ | ||
+ | |||
+ | ====== General syntax ====== | ||
+ | These definitions can be put in any layout file, ie : a .layout text file in ~/ | ||
+ | |||
+ | {Group mygroupid} | ||
+ | opt1 = value1 | ||
+ | opt2 = value2 | ||
+ | object1_name : type(opt1=val1, | ||
+ | object2_name : type(opt1=val1, | ||
+ | option1_name : type(opt1=val1, | ||
+ | |||
+ | or | ||
+ | {Column mycolumnid} | ||
+ | opt1 = value1 | ||
+ | opt2 = value2 | ||
+ | object1_name : type(opt1=val1, | ||
+ | object2_name : type(opt1=val1, | ||
+ | |||
+ | Examples can be seen in the ' | ||
+ | |||
+ | |||
+ | ====== Groups ====== | ||
+ | |||
+ | {Group NameOfTheSkin} | ||
+ | options : | ||
+ | * head, tail, left, right | ||
+ | define the number of pixel around the songs | ||
+ | * vmin defines a minimun height the group will have (if there is only a few songs) | ||
+ | * vcollapse defines the height that will be given to the group in collapsed mode | ||
+ | all 6 values default to 0, they are expression evaluated at group initialization | ||
+ | |||
+ | * title : name used in the grouping edition dialog, default to NameOfTheSkin | ||
+ | |||
+ | ====== Columns ====== | ||
+ | |||
+ | {Column NameOfTheSkin} | ||
+ | options : | ||
+ | * title : title used in the column header | ||
+ | * menutitle : longer version of the title used in the column menu | ||
+ | * sort : sort applied to the list when the column header button is pressed (currently space separated keywords, may change in the future) | ||
+ | * width : default column width in pixel | ||
+ | * songbl : |-separated list of objects which will be baseline-aligned with other columns (->will determine the y option for these objects) | ||
+ | * hreq : expression evaluated at column initialization, | ||
+ | all options are optional except title | ||
+ | |||
+ | |||
+ | ====== Objects ====== | ||
+ | |||
+ | For Group skin definitions, | ||
+ | |||
+ | All objects options, except " | ||
+ | Some of the options may also be evaluated at group/ | ||
+ | |||
+ | Most options have a reasonable default value, they also compute some other values that can be used, for example text/ | ||
+ | |||
+ | |||
+ | |||
+ | ===== align/pack objects and their options ===== | ||
+ | Apart from blalign, they are for convenience only as the same result can be achieved without them. | ||
+ | they have a special option : children, which contains a |-separated list of objects. This option is a constant string, it is not evaluated. | ||
+ | * xpack x pad | ||
+ | * ypack y pad | ||
+ | * xalign align x ref | ||
+ | * yalign align y ref | ||
+ | * blalign y ref | ||
+ | |||
+ | xpack and ypack are used to pack objects horizontally or vertically, start at x, and separated by a padding of pad pixels. | ||
+ | example : '' | ||
+ | |||
+ | xalign and yalign are used to align objects together, for example, '' | ||
+ | |||
+ | blalign is used to align text object so that their baseline is align even if the text have different font/size. | ||
+ | example : '' | ||
+ | |||
+ | ===== drawn objects and their options ===== | ||
+ | |||
+ | * text : x y w h markup text rotate hide xpad ypad pad xalign yalign | ||
+ | * aapic : picsize aa aakey picnb hide xpad ypad pad xalign yalign | ||
+ | * picture : x y w h file resize crop hide xpad ypad pad xalign yalign | ||
+ | * icon : x y w h size icon hide xpad ypad pad xalign yalign | ||
+ | * rect : x y w h color filled width hide | ||
+ | * line : x1 y1 x2 y2 color width | ||
+ | |||
+ | common options : | ||
+ | * x and y : x and y position, default to 0. if negative, the value is added to $_w or $_h | ||
+ | * w and h : width and height | ||
+ | * xpad, ypad and pad : padding around the object, xpad and ypad default to the value of pad | ||
+ | * xalign and yalign : value between 0 (left/top) and 1 (right/ | ||
+ | * hide : if true the object is hidden (=> width and height equal to 0) | ||
+ | |||
+ | ==== text ==== | ||
+ | draws text | ||
+ | * text OR markup : plain text or [[http:// | ||
+ | * rotate : can be 0, 90, 180 or 270 (ignored except with very recent Gtk2 bindings (>1.146 (stable branch) or >1.154 (unstable branch) due to a bug ) | ||
+ | * h and w default to the the height/ | ||
+ | |||
+ | ==== aapic ==== | ||
+ | draws the artist or album picture | ||
+ | * aa : ' | ||
+ | * aakey : artist or album name | ||
+ | * picsize : size in pixels, the picture will be resized to fit, respecting ratio | ||
+ | * aanb : artist number when multiple artist | ||
+ | |||
+ | ==== picture ==== | ||
+ | draws a picture, can be cropped and resized | ||
+ | * file : path and filename, if the path is relative, look in ~/ | ||
+ | * resize : (optional) if ' | ||
+ | * crop : (optional) option to crop the picture read, format : x_y_w_h | ||
+ | |||
+ | ==== icon ==== | ||
+ | draws an icon or multiple icons | ||
+ | * size : icon size, one of ' | ||
+ | * icon : icon name, can be an array ref containing multiple icon names (example : '' | ||
+ | ==== rect ==== | ||
+ | draws a rectangle at x,y of width w and height h, filled if " | ||
+ | |||
+ | ==== line ==== | ||
+ | draws a line from x1,y1 to x2,y2 with color " | ||
+ | |||
+ | ===== user-editable group settings ===== | ||
+ | Groups can define some settings that can easily be changed by user, for example for choosing a color, font, text ... | ||
+ | There are different types of settings, the type only affect the interface that the user will use to edit it. | ||
+ | the syntax is : | ||
+ | option1_name : type(default=' | ||
+ | |||
+ | * type is one of OptionText, OptionColor, | ||
+ | * name is the name that will be displayed in the GUI, use option1_name by default. | ||
+ | * OptionNumber needs a few parameters : min, | ||
+ | * OptionCombo possible values are defined by the parameter list, ' | ||
+ | |||
+ | example : | ||
+ | mytext : OptionText(default=' | ||
+ | text1: text(text=mytext) | ||
+ | will allow the user to change the text that the object ' | ||
+ | |||
+ | more complex example : | ||
+ | mytext | ||
+ | mycolor : OptionColor(default=' | ||
+ | myfont | ||
+ | myhide | ||
+ | title: text( markup='< | ||
+ | |||
+ | |||
+ | ====== Expressions ====== | ||
+ | **(not finished, lots of variable and functions to add)** \\ | ||
+ | They consist of " | ||
+ | Values can be one of the 4 kinds of variables, a function, a numerical value, or a string. Variables and functions can be preceded by -(negative) or ! (not). Functions are followed by a list of ,-separated arguments between " | ||
+ | Values between [ ] will create an array reference. | ||
+ | |||
+ | operators are : != == <= >= - + . % * / < > && || x eq lt gt cmp le ge ne or xor and , \\ | ||
+ | functions : | ||
+ | * if : if the first argument is true, return the second, else the third. If more than three arguments, this is repeated, ie : '' | ||
+ | * pesc : escape its argument so it can be used in a pango markup | ||
+ | * playmarkup : (for columns) if the song is the playing song, return its argument between the playing markup, else just return the argument. ie: '' | ||
+ | * max & min : return the maximum or minimum of the arguments | ||
+ | * not : return the negation of its argument, same as ! | ||
+ | * average : return the average of its arguments (not rounded, may change) | ||
+ | * formattime : to format time, the first parameter is the standard time format string, the second parameter is the number of seconds since epoch and the third optional parameter is the value when the number of seconds is 0, which is the value of $lastplay_ when the song has never been played, example : formattime(' | ||
+ | currently allowed perl functions (more to come) : ucfirst uc lc abs int sprintf substr length index join warn \\ | ||
+ | |||
+ | examples: | ||
+ | 'year is ' | ||
+ | |||
+ | |||
+ | 4 kinds of variable : | ||
+ | |||
+ | * $name : song/group variables | ||
+ | * for columns : title | ||
+ | * for groups : title year length artist album disc genres labels nbsongs (more will be added) | ||
+ | |||
+ | |||
+ | * $_name : other context variables | ||
+ | * $_w : total width | ||
+ | * $_h : total height | ||
+ | * $_expanded : if the group is expanded or not | ||
+ | * $_state : state of the row, can be selected, active or normal. As Groups can't be selected yet, it's only useful for columns | ||
+ | * $_depth : number of groups " | ||
+ | * $_odd : true if the row is odd-numbered | ||
+ | |||
+ | * name:option : the value of the object option/ | ||
+ | |||
+ | * name : options of the column/ | ||
+ | * playmarkup : string that can be inserted in a span property of a pango markup (default to ''' | ||
+ | * ypad and xpad : default space between rows and columns | ||