path: root/lib/skin_parser
AgeCommit message (Collapse)AuthorFilesLines
2022-05-02Fix some non-portable alignment valuesAidan MacDonald1-2/+2
UBSan reports an avalanche of unaligned pointer bugs stemming from hardcoded 4-byte alignments used in certain places. Use sizeof(long) instead to align to the machine word size. Change-Id: I28e505212462c5268afa24e95df3a103ac3e2213
2021-08-05lib/skin_parser check that malloc succeededWilliam Wilgus1-0/+5
Change-Id: I32db233a53b0f693f815cf96bcbe6711c366e5b3
2020-09-04skin_parser: Modernize Makefile.Dominik Riebeling1-10/+17
- Avoid use of uname, instead ask the compiler about the binaries it creates. - Move platform specific commands used into functions. - Replace use of echo with make functions. Change-Id: I365f656e02ddb90ee91ae60fec1230b4aaaf224f
2020-07-24[3/4] Completely remove HWCODEC supportSolomon Peachy1-1/+1
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-05-04skins: Fix buffer overflow in skin_error_format_message()Solomon Peachy1-1/+1
Change-Id: I54849866c163f2ec7ab9c9f76cfe1b267a4bee56
2015-01-11Limit more variables to file scopeThomas Jarosch2-5/+5
Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
2015-01-08Clarify usb_powered() and fix some code.Amaury Pouly2-2/+2
Either by mistake or because its meaning changed, usb_powered() doesn't mean what the name suggest, so clarify its meaning by renaming it to usb_powered_only. So use of usb_powered() are replaced by usb_inserted() when it makes more sense. Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8 Reviewed-on: Reviewed-by: Amaury Pouly <>
2015-01-05Fix yellowThomas Jarosch4-40/+41
Change-Id: I8685198c208b5324b09b5ad59f7379502e9ed977
2015-01-05Make thirty functions static to reduce binary sizeThomas Jarosch4-10/+10
If any of those functions should be (unused) API functions, they can easily be turned back once really needed. Detected using a new cppcheck check that uses the internal symbol database to catch functions that are only used in the current file. Change-Id: Ic2b1e5b8020b76397f11cefc4e205f3b7ac1f184
2014-07-21add supports for x,y value in percentage to several tags.Chiwen Chang1-7/+6
including BAR_PARAMS, %xl, %dr, %T,%St, %xl and %Cl Change-Id: I0811ebfff5f83085481dcbf08f97b7223f677bfe Reviewed-on: Reviewed-by: Jonathan Gordon <>
2013-02-27more error handling for checkwpsJonathan Gordon1-0/+10
Change-Id: I03055d045c0a8e0e63e17b290cc71c54a8dc3634
2013-02-26checkwps: show a helpful error if the parser callback errors outJonathan Gordon3-1/+11
Change-Id: Ie3e35292ba8d74f0ff3d1bb3483a5e83aae0e6b6
2013-02-08Fix Theme Editor build.Dominik Riebeling1-1/+1
The skin_parser now needs __PCTOOL__ set to build libskin_parser.a properly for use with the Theme Editor. Change-Id: I48a518fa296cc8ec5d0e3022baaedd796afe7c5f
2012-12-099 segment bitmap drawing:Jonathan Gordon2-0/+2
Use %x9(id) to draw an image in the whole current viewport using the 9 segment drawer (which draws the corners as normal and *tiles* the middle segments to the needed width/height). Future work is to make it scale instead of tile Change-Id: Ic3ed1cad93f96091694801eb442e0da5a2401203
2012-07-29skin_engine: Support percentages for viewport positioningJonathan Gordon4-8/+24
%V(0,50%,75%,50%,-) - make a viewport at x=0, y=half the lcd height, 75% lcd width and the remaining height (the other half) of the lcd. Change-Id: If26ccb65e8dc52c9225f3fd6d7b222d770add0f0 Reviewed-on: Reviewed-by: Thomas Martitz <> Tested-by: Thomas Martitz <> Reviewed-by: Jonathan Gordon <>
2012-07-05skin_engine: Allow the %St() (setting) skin tag be used as a barJonathan Gordon2-2/+4
%St(<setting name>) or %St(<bar tags>, setting, <setting name>) Change-Id: I71396d683634d4d1ad2357018c4029ecb4229677
2012-07-05skin_engine: Fix a obscure parser bugJonathan Gordon1-2/+2
Tag params where a [] group is followed (but not immediatly) by a * will not parse correctly. e.g [si]iii|s* will attempt to find an 'i' after the second s instead of looping s's Change-Id: I3982f726b6539818f8332334b263b673259f98ef
2012-04-22skin_engine: rework the parser to be closer to the langauge grammar.Jonathan Gordon3-80/+57
The parser was unconditionally scanning things which it thought were conditional/enum lists (or tag arg lists) when they couldn't possibly be (i.e < inside a param which should be valid). This change fixes it (i.e %?and(%if(%pv, <, -50), %if(%mp, >i, 1)) is perfectly valid now. This *may* break your exsiting skins if you were using %if with < or > Change-Id: Ia24dbdf0b11fc7d8a735c1111d648c3bebd68ac6
2012-04-17Revert "skin_engine: rework the parser to be closer to the langauge grammar."Thomas Martitz3-57/+80
This reverts commit ec8b21eef8b2fe1bd02f335dbc0dfbf05c2deff2 which was pushed by accident. Change-Id: I1aaedf6876d0448a100dc582b79f1293d021bac1 Reviewed-on: Reviewed-by: Thomas Martitz <>
2012-04-17skin_engine: rework the parser to be closer to the langauge grammar.Jonathan Gordon3-80/+57
The parser was unconditionally scanning things which it thought were conditional/enum lists (or tag arg lists) when they couldn't possibly be (i.e < inside a param which should be valid). This change fixes it (i.e %?and(%if(%pv, <, -50), %if(%mp, > 1)) is perfectly valid now. This *may* break your exsiting skins if you were using %if with < or > Change-Id: Ibcb42bc6bb78908f79de024b61276b91b1ce02a0 Reviewed-on: Reviewed-by: Thomas Martitz <>
2012-03-26build system: unify/simplify library handling a bit.Thomas Martitz1-8/+8
libs in $ROOT/lib now add to $(CORE_LIBS) and $(EXTRA_LIBS) and are automatically linked by the core and codecs/plugins respectively. Change-Id: Iff482c792a8c8142718f6a16a450c6e2f1497c9a
2012-03-15skin_engine: Reenable skin debugging in the sim (use --debugwps)Jonathan Gordon3-5/+5
Change-Id: I2881edda45cd3ea69f5284d93bc93c47bb63b3f2
2012-03-15skin_engine: New tag to draw a rectangle (optionally with a gradient)Jonathan Gordon2-0/+3
%dr(x, y, width, height, [colour1[, colour2]]): x,y - viewport relative pixel coordinates to start the rectangle. width, height - obvious. can be '-' to fill the viewport if both colours are left out the viewports foreground colour will be used if one colour is specified it will fill the rectangle that colour. if both colours are specified it will gradient fill the rectangle. Change-Id: Iad451e99ded663bc7c5d182443659db7d909b388
2012-02-29Call skinlist_set_cfg() unconditionally, i.e. also if do_refresh==falseFrank Gevaerts1-1/+1
This call is cheap (except if the list config changes, but then it should be called anyway), and do_refresh isn't always set appropriately, e.g. when the screen has just changed, which could cause the list config to be null at bad times, which caused the standard list to be shown instead of the desired skinned list. Change-Id: I47dd2552d6d1062456ede4529c4891e80a8159ea Reviewed-on: Reviewed-by: Frank Gevaerts <>
2012-02-29skin_engine: ease the restrictions on %x/%xlJonathan Gordon1-2/+2
%x and %xl only require the id and filename now. If you leave off the x,y it will default to 0,0. If you want to use the default x,y you can still put in the num_subimages param on the end (e.g %xl(a, file, 3) ) Change-Id: I8eff793dfdd037e302ace8deec9dc16dcea264a7
2012-02-28skin_engine: Clean up %x() handling - beware theme issuesJonathan Gordon1-1/+1
Internally remove some hacks around how %x() is handled. %x() inside the default viewport will no longer work if other viewports are used, so if you are using viewports and %x() make sure it is in a viewport! Change-Id: I8ecab805d55fc0f8476ff0516cba38e23400aa20
2012-02-28lcd/skin_engine: Add the ability to draw onto the backdrop layerJonathan Gordon2-1/+3
The framebuffer the lcd driver uses can now be changed on the fly which means that regular lcd_* drawing functions can draw onto the "backdrop" buffer. The skin engine can use this to create layered effects. Add the tag %VB to a viewport to draw that viewport onto the backdrop layer. If you want to draw an image onto the backdrop framebuffer use %x(backdrop filename) instead of %X() inside a viewport with %VB. Change-Id: I741498e2af6d4f2d78932cabe8942317893e7cfc
2012-02-25Add %LR and %LC to get at the current row and columm in skinned lists.Frank Gevaerts2-0/+4
This allows list items to be rendered differently depending on their on-screen position, allowing things like gradients or nonlinear alignment Change-Id: I1d9c080f97e83707f0e80f57abc762cb2b94f6ed
2012-02-26FS#12586 - Modify %ss to be able to use numbers for conditionalsJonathan Gordon1-1/+1
i.e %?ss(1,1,%cM)<|one|two|three|...|> or %xd(numbers, %ss(1,1%cM) Change-Id: I74ecb3f253f3be1fd270f75c0ef79addd364a7de
2012-02-21skin engine: Add 'touch' command to the %vs() tagJonathan Gordon1-1/+1
%vs(label, touch, -) will reset the timeout for the variable without changing the variables value. Change-Id: Idba03f454a82ac7460bb53a4de3aa6903656c585
2012-02-21skin engine: Make %vs() dynamic so it updated every screen updateJonathan Gordon1-1/+1
This makes it easier to use %?vl() (variable last changed) in a sensible manner. Change-Id: I0bf9ae24bc4516d2fd5691af236cc4439a0863c8
2012-02-14Fix FS#12585 - bar tags stopped workingJonathan Gordon1-1/+1
Change-Id: I9e466bcc407a3fda06d8a9f9c6f39afef592824e
2012-02-07skin engine: New logical 'and' and 'or' tags to evaluate multiple tags in a ↵Jonathan Gordon3-27/+39
single conditional. Use these tags to stop having multiple conditionals.. e.g: OLD: %?C<%?Ia<something>> NEW: %?and(%C, %Ia)<something> Change-Id: Ia3bbe4611cf808e87dcd1b1147181461fa08294a
2012-02-01skin parser: Allow the first character after conditional seperators to be \nJonathan Gordon1-1/+10
This hopefully makes difficult conditionals more easy to read: i.e OLD: %?bp<%?bc<%xd(Ba)|%xd(Bb)>|%?bl<|%xd(Bc)|%xd(Bd)|%xd(Be)|%xd(Bf)|%xd(Bg)|%xd(Bh)|%xd(Bi)|%xd(Bj)>> NEW: %?bp< %?bc< %xd(Ba)|%xd(Bb) >| %?bl<|%xd(Bc)|%xd(Bd)| %xd(Be)|%xd(Bf)| %xd(Bg)|%xd(Bh)| %xd(Bi)|%xd(Bj) > > Change-Id: Ic89d2c95562b27e7427c3a5d528340f9aec55cf2
2012-02-01skin parser: skip \t characters at the begining of lines to allow for more ↵Jonathan Gordon1-0/+5
readable skins Change-Id: I8f3154d17807ad202fc65d462e85da2195ce605c
2011-11-15Use buflib for all skin engine allocations.Jonathan Gordon5-163/+165
Massive thanks to Michael Chicoine and other testers for finding the early bugs. This removes all skin memory limitations git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-10-16Fix FS#12320 - need substitute to /.rockbox/skin_buffer_size.txtThomas Martitz1-15/+16
Since recent skin engine related commits images aren't stored on the skin buffer anymore. The buffer was decreased accordingly. Now some themes used that buffer more for tokens than images and are now broken. To fix, increase the max token count, while optimizing the two most often allocated structs for size (so no net ram usage increase). git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-10-08de-tabifyNils Wallménius1-39/+39
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-25Add a simple perl script to display info about what is allocating skin buffer.Jonathan Gordon3-0/+50
To use it enable DEBUG_SKIN_ALLOCATIONS in skin_buffer.h and pipe the rockboxui output to the script git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-25Partial fix for FS#12289 - comment lines would waste lots of buffer space. ↵Jonathan Gordon1-3/+23
Still not perfect but should get 90+% of comments completly ignored now. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-18Add "%LN" tag to retrieve the list item number of the current item. This ↵Frank Gevaerts2-0/+2
allows e.g. putting item numbers in skinned lists. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-11Rework how the skin gets the list item text to save some ram. Also allow the ↵Jonathan Gordon1-2/+2
%LI and %LT tags to take 2 optional parameters to get a different items text/icon: %LT(offset, nowrap) - get the text for the "being drawn"+offset item (offset being + or -). if the second param is "nowrap" (Without quotes) the text will be blank if the item would need to wrap. Same for the icon e.g: %LT(-1) %LT << %LT(1, nowrap) will display: Four Five << Six (or nothing if Five is the last item) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-11New tag %ss() which lets you get a substring of another tag.Jonathan Gordon2-1/+4
%ss(start, length, tag) - i.e %ss(0,1,%TL) will get the first letter of the current lines text. use - for the length to get the rest of the tag (e.g %ss(1,-,%TL) will get everything after the first letter). git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-06Lists can now be completly draw using the skin engine!Jonathan Gordon2-0/+12
due to lack of user feedback the actual tags may change, hopefully not though. The way it works is the skin specifies a rectangle and a viewport label. For each item in the list that is being displayed all viewports with the specified label are drawn. However, instead of the viewport x/y position being offset from the top left corner like normal they are offset from the rectangle position in the list (so think of them as child-viewports of the rectangle which moves). Normally the rectangle will move down the screen to show a normal list, this can be changed to move across the screen in a grid pattern. The UI viewport is used to bound the items (i.e %Vi() ) Scrolling is completly disabled in all items except the currently selected item. This works well in combination with the %cs tag to show differently styled lists based on the current screen :) New tags: %LT - Get the current items text %LI - Get the current items icon number %Lc - Use as a conditional to determine if the current item is the selected item %LB - BAR TAG to show the scroll bar, params/options like other bar types. It still needs a bit of work though. Use as a conditional to find out if the bar is actually needed %Lb(viewport, width, height [,tile]) - specify the viewport label to draw for each item and the size of each item. if the last param is 'tile' it will form a grid instead of a list %?cs<%Lb(a,100,20)|> %V(0,0,10,-,1)%Vf(aabbcc) %?LB<%LB(0,0,10,185, invert)> %Vi(-,10,0,-,-35,1) %Vl(a,5,5,160,12,1) %s%?Lc<%Vg(00ffaa, ff0000, 000000)%Vs(gradient)%>%>%>%ac>zzzzzzz %LT zzzzz%s%?Lc<%ar%<%<%<> %V(0,185,-,-,1) %s%LT git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-08-14New skin tags: %Vs() to set the text style and %Vg() to get the viewports ↵Jonathan Gordon2-0/+4
gradient colours %Vs(mode[, param]) : mode can be "invert", "color" (where param is the colour to use", "clear" to disable the current style, "gradient" where param is the number of lines the gradient should draw over. %Vg(start colour, end colour, [text colour]), if this tag isnt used the list selection colours from the settings will set the gradient colours git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-05-01Fix further 'variable set but not used' warnings reported from GCC 4.6.0.Andree Buschmann1-3/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-04-17Remove duplicate #include in skin_parser.cBertrik Sikken1-1/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-27Skin variables for touchscreen targets (origional implementation by Jens Theeß)Jonathan Gordon2-1/+10
%vs(name, [set|inc|dec], value [,max]) - name is the id, set sets the value, inc increments by value, dec decrements by value %vg(name) - get the current value %vl(name [,timeout]) - 'has it changed in [timeout]'? values start at 1 and are all reset to 1 on skin load git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-05Theme Editor: make cross compiling on OS X work.Dominik Riebeling1-1/+2
The attempt to detect if building a fat library is necessary for libskin_parser makes cross compiling fail on OS X. Allow overriding the target platform for libskin_parser to fix that. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-01Add an ability to set a setting to a specific value with a touchscreen action.Jonathan Gordon1-2/+2
example: %T(0,0,20,12, setting_set, repeat, off) That will set the repeat mode to "off" when it is pressed. "setting_set" is the action name "repeat" is the name of the setting in the config files "off" is the value to set it to (same values as the legal values in the config files) Not all settings are supported, outright unsupported settings will fail to parse. Some settings might not work too well if they don't apply instantly (Any that work well int he quickscreen should work well here) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657