application icongmusicbrowser

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
customization:songtree [2007/09/18 03:05] – Added an overview, a description of the align/pack objects, and a few small things. squentincustomization: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 the ([[http://squentin.free.fr/gmusicbrowser/devel.html|current "devel" version]]). \\ +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://squentin.free.fr/gmusicbrowser/screenshots/songtree_example.png|screenshot]].+An example of a SongTree can be seen in this [[http://gmusicbrowser.org/screenshots/songtree_example.png|screenshot]].
  
 Very rough and incomplete draft, better than nothing Very rough and incomplete draft, better than nothing
Line 25: Line 25:
   object1_name : type(opt1=val1,opt2=val2)   object1_name : type(opt1=val1,opt2=val2)
   object2_name : type(opt1=val1,opt2=val2)   object2_name : type(opt1=val1,opt2=val2)
 +  option1_name : type(opt1=val1,opt2=val2)
  
 or or
Line 34: Line 35:
  
 Examples can be seen in the 'layouts' file of the current devel version. Examples can be seen in the 'layouts' file of the current devel version.
 +
  
 ====== Groups ====== ====== Groups ======
Line 44: Line 46:
   * vcollapse defines the height that will be given to the group in collapsed mode   * 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 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 ====== ====== Columns ======
Line 56: Line 60:
   * 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   * 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 all options are optional except title
 +
  
 ====== Objects ====== ====== Objects ======
Line 67: Line 72:
  
  
-===== 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 ===== ===== align/pack objects and their options =====
Line 87: Line 85:
 example : ''xpack(x=5,pad=2,children=text1|icon1)'' example : ''xpack(x=5,pad=2,children=text1|icon1)''
  
-xalign and yalign are used to align objects together, for example, ''xalign(x=100,align=1,children=text1|text2)'' will compute a x value for text1 and text2 such that they are right-aligned at x=100, align=.5 would center them around x=100. The option ref is by default equal to align, it defines where is the x. For example ''align(x=100,align=1,ref=0,children=text1|text2)'' will right-align text1 and text2 but rather than ending at x=100 as before, the wider will begin at x=100. //Note that due a line commented by mistake, it doesn't work with the current version (v0.9611), it will work in the next one.//+xalign and yalign are used to align objects together, for example, ''xalign(x=100,align=1,children=text1|text2)'' will compute a x value for text1 and text2 such that they are right-aligned at x=100, align=.5 would center them around x=100. The option ref is by default equal to align, it defines where is the x. For example ''align(x=100,align=1,ref=0,children=text1|text2)'' will right-align text1 and text2 but rather than ending at x=100 as before, the wider will begin at x=100.
  
 blalign is used to align text object so that their baseline is align even if the text have different font/size. blalign is used to align text object so that their baseline is align even if the text have different font/size.
 example : ''blalign(y=10,children=text1|text2)'' will compute a y for text1 and text2 so that their baseline are aligned, the heighest text will have a y of 10. The option ref default to 0, it defines the reference point of the y value, ref=0 means the top of the string, ref=1 means the bottom. example : ''blalign(y=10,children=text1|text2)'' will compute a y for text1 and text2 so that their baseline are aligned, the heighest text will have a y of 10. The option ref default to 0, it defines the reference point of the y value, ref=0 means the top of the string, ref=1 means the bottom.
  
-===== generic objects options ===== +===== drawn objects and their 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 +  * text : x y w h markup text rotate hide xpad ypad pad xalign yalign 
-xpad, ypad and pad : padding around the object, xpad and ypad default to the value of pad +  * aapic : picsize aa aakey picnb hide xpad ypad pad xalign yalign 
-xalign and yalign : value between 0 (left/top) and 1 (right/bottom), used to align the object in its allocated space (h and w) +  * picture : x y w h file resize crop hide xpad ypad pad xalign yalign 
-hide : if true the object is hidden (=> width and height equal to 0)+  * 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         hide 
 + 
 +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/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 ==== ==== text ====
Line 123: Line 130:
   * icon : icon name, can be an array ref containing multiple icon names (example : ''['gtk-media-play','gtk-media-stop']'' )   * icon : icon name, can be an array ref containing multiple icon names (example : ''['gtk-media-play','gtk-media-stop']'' )
 ==== rect ==== ==== 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)+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), the line width is width, 1 by default
  
 ==== line ==== ==== line ====
 draws a line from x1,y1 to x2,y2 with color "color" (same as above) draws a line from x1,y1 to x2,y2 with color "color" (same as above)
  
 +===== 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='default value',name='an optional name',opt1=val1)
 +
 +  * type is one of OptionText, OptionColor, OptionFont, OptionBoolean, OptionNumber, OptionCombo.
 +  * name is the name that will be displayed in the GUI, use option1_name by default.
 +  * OptionNumber needs a few parameters : min,max,step,digits. min is the minimum value, max is the maximum value, step is increment/decrement used when editing, digits is the number of decimals.
 +  * OptionCombo possible values are defined by the parameter list, '|' is used as a separator. example list='value1|value2|value3 with \' & \| characters|value4'
 +
 +example : 
 +  mytext : OptionText(default='some text',name='name of the option')
 +  text1: text(text=mytext)
 +will allow the user to change the text that the object 'text1' will display.
  
 +more complex example :
 +  mytext  : OptionText(default='some text',name='some text')
 +  mycolor : OptionColor(default='blue',name='Title color')
 +  myfont  : OptionFont(default='Arial 20',name='font')
 +  myhide  : OptionBoolean(default=0,name='hide')
 +  title: text( markup='<span font_desc="'.myfont.'" foreground="'.mycolor.'">'.pesc(mytext).'</span>', hide=myhide)
  
  
Line 145: Line 173:
   * not : return the negation of its argument, same as !   * not : return the negation of its argument, same as !
   * average : return the average of its arguments (not rounded, may change)   * 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('%F',$lastplay_,'never')
 currently allowed perl functions (more to come) : ucfirst uc lc abs int sprintf substr length index join warn \\ currently allowed perl functions (more to come) : ucfirst uc lc abs int sprintf substr length index join warn \\
  
 examples: examples:
-  'year is '.if(%year>2000,'after 2000 : ', 'before 2000 :').$year+  'year is '.if($year>2000,'after 2000 : ', 'before 2000 :').$year
  
  
Line 154: Line 183:
  
   * $name : song/group variables   * $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 columns : title   artist  album  date  year  track  disc  comment compilation  playcount  ufile  upath  version  rating  channel  samprate  bitrate  filetype  size  genre  label  lastplay  added  modif  length  progress  playing  playicon  labelicons queued length_ lastplay_ added_ modif_ \\ length_ lastplay_ added_ modif_ are raw values in seconds that can be formatted differently using the function formattime or sprintf 
-    * for groups : title year length (more will be added)+    * for groups : title year length artist album disc genres labels nbsongs (more will be added)
  
  
Line 166: Line 195:
     * $_odd : true if the row is odd-numbered     * $_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 +  * name:option : the value of the object option/property, this delays the evaluation of the expression until that object option/property has been evaluated. \\ e.g.  title:h is the height of the title object
-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 :   * name : options of the column/group, will be user-editable, currently the columns have these predefined options :
customization/songtree.1190077539.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