Rockbox Technical Forums

Rockbox Development => Feature Ideas => Topic started by: Biont on November 03, 2009, 12:40:21 PM

Title: Custom actions/tags for touchscreen targets
Post by: Biont on November 03, 2009, 12:40:21 PM
After playing around with touch themes for some time, I find one thing really missing in the skin engine:

The ability to use(/define) custom tags/actions on the WPS. Having a bunch of those would allow for all kinds of cool things like popup menus, maybe different window sizes or even customization of the WPS (i.e. load a different set of images)

My main concern are the popup menus. So far, there are only 2 feasible ways of creating a popup menu and both come with big downsides:

 - Using the %Tl tag, which can only be controlled with a timeout. And please correct me if I'm wrong, but there is no way to assign a specific area in which this tag works. That means the menu would pop up everytime you touch the screen anywhere, which sucks :)
Also, you can't close it, but have to wait until the timer runs out instead.


 - Drawing the menu when playback is paused. I used this way on my first theme, because you have much more control over when the menu appears and disappears. You can add a close-button (which is nothing more than another play-button ;D) and then it goes away and playback starts again. The obvious downside is: You have to stop playback, which is very annoying if you're going to the file/playlist browser through that menu, because the selected song only starts playing after closing the menu >:(



If we had some custom actions/tags, this would be no problem at all. They could work like the repmode command and %mm tag.


%Cta|2-4|  defines cta (custom tag a) with 2-4 values to cycle through

%T|...|cta| cycles through the values

%?cta<...>  could then be used for almost anything


I think implementing this would open up lots of possibilities for touchscreen WPS.

As I said: Popup-menus, resizable windows/menus, switching from simple to advanced mode, different image sets (a theme could come in different looks and colors, how awesome is that?) and perhaps alot more I just can't think of right now.


The only problem is - you guessed it - I can't code. That's why I hope that you'll like this idea and that maybe someone feels like coding it.


(sorry for my bad english)
Title: Re: Custom actions/tags for touchscreen targets
Post by: JdGordon on November 18, 2009, 03:26:03 PM
wierd.. I thuoght I replied to this ages ago :p

This idea would be pretty simple to implement and most probably would be accepted, it just needs someone to do it.

In fact I did implement this a while ago, but it was rejected because I used the browse button to change the tag's value instead of the touchscreen (which I still think is the correct way to do it on button targets)...

hmm... maybe I'll do this after removing the statusbar...
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on November 19, 2009, 08:53:28 AM
That would be soo very great :P.

I can't wait to play around with these tags. They sure would be an essential feature for future touch themes. And they are a perfect match for the idea you posted here (which I really really like):
http://forums.rockbox.org/index.php?topic=23124.0
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on January 05, 2010, 02:04:54 PM
Any news on this?
Title: Re: Custom actions/tags for touchscreen targets
Post by: JdGordon on January 05, 2010, 02:28:15 PM
nope
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 07, 2010, 01:10:37 PM
I submitted a patch for this: http://www.rockbox.org/tracker/task/11084
@Biont: I can provide a patched build if you'd like to test the patch. I'd love to hear feedback on this.
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 07, 2010, 04:39:35 PM
You just made me a very happy person :)

I'd love to try it out, but I think a patched simulator would be of more use for testing and theming. I hope that's not too much hassle.

Man I'm really excited now.
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 08, 2010, 03:14:22 AM
No problem at all! I'll post a patched simulator once I get home from work. You're on Windows, I suppose?
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 08, 2010, 05:02:23 AM
Yep



I had another idea for these tags. It should be possible to do something like this:

%T|...|%vda0|

(%vd as JdGordon suggested it should be called that way)

This button gives the variable 'a' the value 0 instead of cycling through the given values.
If 0 means "off", you could close a popup menu directly although it might have lots of values to cycle through. Also, it would give more control over the behaviour of a theme in general.
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 08, 2010, 09:11:31 AM
Yes, setting the value in addition to toggling sounds like a useful extension. I'd like to use a different name of the touch action than vd, since toggling or setting a variable is conceptionally different from displaying/querying the value with %vd. I currenty use vt for "variable toggle". We could change that to vs for "variable set".
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 08, 2010, 11:58:40 AM
That does make sense, yes. Dunno which one sounds better, though  ;)
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 08, 2010, 03:32:10 PM
Sorry it took so long, here's the simulator: http://www.theess.de/assets/files/buildsim.zip

This includes the updated patch (see FS#11084). Tags are:
Code: [Select]
%vl|identifier|number of states|
%vd'identifier'

Touch-Action is:
Code: [Select]
vs'identifier'[value]
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 09, 2010, 12:56:52 PM
Thank you very much!!

I already spent 3 hours getting used to the tags and writing a new theme and I must say I'm having loads of fun :)


Another idea: Cycle backwards. It might not be the most important thing there is, but I'm sure it wouldn't hurt being able to do it.



I'm currently trying to realize some basic WPS customization from within the WPS. Keeping track of the viewports to display pretty much blows my mind atm, but I hope I'll get it done.

But saving the values in a file so it can be reloaded on the next startup would go too far, right?

EDIT:

This is fun:


(http://img205.imageshack.us/img205/3389/dump100310162215.jpg)
3 custom buttons and the "wps menu"

(http://img687.imageshack.us/img687/9867/dump100310162228.jpg)
change settings in the menu (currently only button config and screen menu)

(http://img709.imageshack.us/img709/6458/dump100310162202.jpg)
and change the behaviour of the 3 custom buttons (each of them can cycle through a set of different functions)
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 11, 2010, 04:59:58 AM
Wow, that's far out!
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 11, 2010, 09:46:11 AM
Those customizable buttons are the main reason I came up with the idea of saving the values in some sort of config file (or the .wps itself, if that's possible)

This patch is already so amazing that I'm having a hard time thinking about basic stuff that might be missing.
All I can come up with are these far-fetched ideas (apart from cycling backwards)

Also nice to have: setting values conditionally and/or being able to have multiple actions in one touch area.

That would be very useful in cases when I'd like to open a new popup while there are others currently active. You'd either need to close them first or cause a big mess :) So what would be great is something like this:

%?vda<...|%vsb0%vsc0%Vda|...|...>

or

%T|0|0|40|40|vsa1
%T|0|0|40|40|vsb0
%T|0|0|40|40|vsc0

I'm not sure which way would be better and I also don't know if both wouldn't require a huge amount of extra coding (the same for saving the values). I'm just writing down ideas here ;)

EDIT: I am aware that there's no need to go crazy on this patch. It already has loads of potential as it is now :D

Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 11, 2010, 11:43:40 AM
Thanks for your feedback Biont, you're really coming back with crazy ideas!

Stuff like conditional viewports, setting variables, setting variables conditionally, and using multiple actions in one touch-region, is taking the WPS format in a new direction. It is evolving from a simple and declarative template language into a turing-complete imperative programming language. This isn't necessarily a bad thing, but I'd like to take it slowly.

So I propose to collect a list of wanted features concerning theme variables, and use-cases for them.

So far we have this:

Setting theme variables
Set variables from touch-regions and use them as conditionals. A variable can be cycled (forward only) or set to a given value.
Proposed tags: %vl, %vd, touch-action vs
Use cases:

Touch-action for cycling a var backwards
Proposed tags:
Use cases:

Saving/loading the state of a variable
Proposed tags:
Use cases:

Multiple actions (especially "vs") for one touch-region
Proposed tags:
Use cases:

Hm, aren't multiple actions already supported by using multiple touch-regions with the same bounds in one viewport? Or is only one of them triggered?
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 11, 2010, 12:22:00 PM
It seems that none of them are triggered, if 2 touch actions are at the same place (and in the same viewport)
However, you can have one action for click and one for hold at the same place, but that is not what we want.

Cycling backwards in combination with normal cycling could be useful for arrow keys. Once there are more that 3 different viewports to display/cycle through, this might help navigating in the WPS.

AA, song info, playlist viewer are already 3 viewports. Let's add a separate file info, settings display (equalizer, crossfeed, etc.) and a WPS configuration menu (like for my customizable buttons in the test theme) and cycling through them in 1 direction quickly becomes painful if you just want to get back to the AA after viewing the song info.

1 click on the cycle backwards button and you're there.

I know it would possibly make more sense to have 6 different buttons that trigger their respective viewport directly, but 6 buttons also eat up lots of screen space.
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 11, 2010, 04:27:54 PM
How about this for cycling:

vs'identifier'<+|-|number>
vsa+ cycles forwards
vsa- cycles backwards
vsa1 sets a to 1

Btw, we just had a discussion on irc about the wps syntax and possible future directions. The devs don't like menus in the wps all that much, they prefer themeable menus. So don't hold your breath for e.g. saving state from the wps. Let's focus on getting the variables patch finalized and into the svn first!
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 11, 2010, 05:29:07 PM
Sounds good.

...and I totally agree with you about not going too far in the first step. I guess a smaller patch that only introduces a couple of tags that hurt noone is far more likely to be accepted than complete custom variable madness :)

And getting this into the main build sure is more important than 2-3 fancy extra features. This could be the most important touchscreen-related development since the introduction of absolute-point mode itself.

Title: Re: Custom actions/tags for touchscreen targets
Post by: JdGordon on March 12, 2010, 12:58:04 AM
that looks really good, I'm interested to see where this patch ends up :)
saving the variables is almost certainly a NoDo though, even sharing them between skins (sbs and wps for example) is unlikly to be wanted.
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 12, 2010, 05:37:30 PM
JdGordon, thanks for your input  :)
I updated the patch to support cycling forwards and backwards and uploaded a new simulator build to my page.
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on March 14, 2010, 04:42:32 PM
This looks pretty much perfect now. :D

I hope it's accepted by the devs
Title: Re: Custom actions/tags for touchscreen targets
Post by: punkt on March 14, 2010, 04:57:14 PM
I'll write a a few lines for the manual explaining the new tags tomorrow or so, and then the patch is done, I guess.

Edit:
Stuff for the manual is done, so I guess the patch is finished.
Hm, is there any way to make this useful for non-touch targets?
Title: Re: Custom actions/tags for touchscreen targets
Post by: Biont on October 31, 2010, 06:53:20 PM
Any news on this? I guess the patch doesn't work anymore after the skin breaking change