application icongmusicbrowser

This is an old revision of the document!


Very rough and incomplete draft, better than nothing

General syntax

{Group mygroupid}
opt1 = value1
opt2 = value2
object1_name : type(opt1=val1,opt2=val2)
object2_name : type(opt1=val1,opt2=val2)

or

{Column mycolumnid}
opt1 = value1
opt2 = value2
object1_name : type(opt1=val1,opt2=val2)
object2_name : type(opt1=val1,opt2=val2)

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

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, set the required row height for this column, the actual row height will be the maximum of all the columns requested heights

all options are optional except title

Objects

For Group skin definitions, the type can be preceded by + or - to only draw the object when the group is expanded (+) or collapsed (-), this is just a convenience, the same can be achieved with the hide option and the $_expanded variable

All objects options, except “children”, are expressions evaluated before drawing Some of the options may also be evaluated at group/column initialization if they are needed (to evaluate head,… for groups and hreq and baseline calculation for columns). At initialization if option “init_name” exists it will be used instead of option “name”. For example : the height of a text with markup='<big>$title</big>' won't be correctly computed at init because $title will be an empty string. Using init_markup='<big>anything</big>' will correct this.

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 hide
  • line : x1 y1 x2 y2 color hide

align/pack objects and their options

Apart from blalign (align the base line of text elements), 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

generic objects 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/bottom), used to align the object in its allocated space (h and w) hide : if true the object is hidden (⇒ width and height equal to 0)

text

draws text

  • text OR markup : plain text or pango markup to draw, in the markup option, variable strings should be escaped using the pesc() function.
  • 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/width needed to draw the text +2*xpad or +2*ypad

aapic

draws the artist or album picture

  • aa : 'album' or 'artist'
  • aakey : artist or album name
  • picsize : size in pixels, the picture will be resized to fit, respecting ratio
  • picnb : (will be renamed) 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 ~/.gmusicbrowser/layouts/
  • resize : (optional) if 's' resize to fill the space allocated (by w and h) (more possible values FIXME document)
  • 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 'menu' (default), 'small_toolbar', 'large-toolbar', 'button' 'dnd' 'dialog'. these sizes are defined by the gtk options
  • icon : icon name, can be an array ref containing multiple icon names (example : ['gtk-media-play','gtk-media-stop'] )

rect

draws a rectangle at x,y of width w and height h, filled if “filled” is true, with the color “color” which can be a color name or hexadecimal (#000 or #000000)

line

draws a line from x1,y1 to x2,y2 with color “color” (same as above)

Expressions

(not finished, lots of variable and functions to add)
They consist of “values” separated by “operators”.
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 “()”. Strings are delimited by simple quotes ('), there is no variable interpolation for now. 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 : if($x>10, 'x is >10', $x>5, 'x is >5', 'x is ⇐ 5')
  • 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: playmarkup('a_markup') will be transformed to '<span weight=“bold”>a_markup</span>' if the song is currently playing. Equivalent to if($playing,'<span '.playmarkup.'a_markup</span>','a_markup')
  • 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)

currently allowed perl functions (more to come) : ucfirst uc lc abs int sprintf substr length index join warn

examples:

'year is '.if(%year>2000,'after 2000 : ', 'before 2000 :').$year

4 kinds of variable :

  • $name : song/group variables
    • for columns : title artist album date year track disc comment playcount ufile upath version rating channel samprate bitrate filetype size genre label lastplay added modif length progress playing playicon labelicons queued
    • for groups : title year length (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 “above” the current one. ie : if the songs are grouped by artist then album, the artist group will have a depth of 0, and the album group will have a depth of 1.
    • $_odd : true if the row is odd-numbered
  • name:option : the value of the object option/property, this delays the evaluation of the expression until that object option/property has been evaluated

example : title:h is the height of the title object

  • name : options of the column/group, will be user-editable, currently the columns have these predefined options :
    • playmarkup : string that can be inserted in a span property of a pango markup (default to 'weight=“bold”'), used to set the playing row apart, using the playmarkup function is better in most case
    • ypad and xpad : default space between rows and columns
customization/songtree.1189959243.txt.gz · Last modified: 2022/05/23 01:30 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0