Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Thank You for your continued support and contributions!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  vertical progressbar
« previous next »
  • Print
Pages: [1] 2

Author Topic: vertical progressbar  (Read 3340 times)

Offline Arzhur

  • Member
  • *
  • Posts: 17
vertical progressbar
« on: June 12, 2011, 07:43:20 AM »
I read again and again the CustomWPS page and I still don't understand how it must be written...

I want to have a vertical volume bar located in this area:
%V(90,90,4,90,0)
starting from the bottom and growing up using this bmp:
%pb(0,0,90,4,volumebar.bmp,vertical)
but no way to make it work, all I have is a failsafe wps...

My bmp is of course a 90 px heignt and 4 px width picture, is it correct?

Thanks for your advices.
Logged

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: vertical progressbar
« Reply #1 on: June 12, 2011, 08:28:02 AM »
If I read the documentation, it seems to suggest that:

Code: [Select]
%V(90,90,4,90,0)
%xl(A,volumebar.bmp,0,0)
%pb(0,0,90,4,volumebar.bmp,vertical,image,A)

Should work...but I see no point in the "image" option at all...if you can specify a filename to load as the bar image, then I cannot for the life of my understand why the "image" param is needed at all.
I don't have the time to test this presently, it would be interesting to see the answer for:

a: Why doesn't your initial code "just work", and
b: why give the option to specify a filename *and* an optional image param that loads an identifier for an image.

Assuming the syntax in your original code snippet is valid, which one wins? the filename.bmp, or the "image,<identifier" params?


[St.]
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #2 on: June 12, 2011, 10:22:47 AM »
Not exactly what you wrote, finally after trying again and again this works :

#### Volume Bar
%V(90,38,4,-,0)
%pv(0,0,4,90,volumebar.bmp,vertical)

I just missed the pv instruction...
Logged

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: vertical progressbar
« Reply #3 on: June 12, 2011, 11:06:12 AM »
Whoops...kinda ashamed I didn't pick up on that myself.

I could clearly see from your comments that you wanted a *volume* bar, oh well...sigh.
I also should have noticed the out-of-bounds image.

Regardless, this has me wondering about a few things now. In particular the reason for the "image" parameter. It seems to me that this param is totally needless (if the syntax in CustonWPS is to be believed).
For a scenario, it would seem to me that:

Code: [Select]
%V(0,0,100,100,-)
%xl(foo,0,0,another_image.bmp)
%pv(0,0,100,100,image.bmp,vertical,image,foo)

Is perfectly valid...but, in this case (I don't even know if this parses, I can't check right now) what image is used, "image.bmp" or "another_image.bmp"?

The same scenario could be used but with "-" in place of "image.bmp"...what would be drawn, the default bar or "another_image.bmp"?


[St.]
« Last Edit: June 12, 2011, 11:08:53 AM by [St.] »
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: vertical progressbar
« Reply #4 on: June 12, 2011, 10:06:50 PM »
Quote from: [St.] on June 12, 2011, 11:06:12 AM
Regardless, this has me wondering about a few things now. In particular the reason for the "image" parameter. It seems to me that this param is totally needless (if the syntax in CustonWPS is to be believed).
[St.]

CustomWPS is a bit outdate apparently and badly worded. The first non-number param will be used as the filename if it doesnt match any of the options, it can be missing completly though. (..., filename.bmp, some, option, list) is IMO harder to understand than (..., image, image_id, some, option, list) if you bare in mind that option list can be provided in any order.
If no image id or filename is given the inbuilt one will be used.
If the 'image' option is used it will override image.bmp (even if - is used there)


Think of the filename as keeping backwards compatability. I'm going to fix CustomWPS to reflect this.,
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #5 on: June 13, 2011, 03:44:22 AM »
To maintain backward compatibility say the doc...

Anyway this syntax works, and y keep it.

Now how can I use a progress bar for the battery?
Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: vertical progressbar
« Reply #6 on: June 13, 2011, 04:03:02 AM »
use bl instead of pv
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #7 on: June 13, 2011, 04:31:56 AM »
OK thanks, so is the following code correct?

#### Battery Bar
%V(149,85,11,43,0)
%?bc<%x(C,batterycharge.bmp,0,0)|%bl(0,0,11,43,batterybar.bmp,vertical)>

On the simulator I only have the batterycharge.bmp displaying, the battery bar doesn't appear anymore, what was correct with only
%bl(0,0,11,43,batterybar.bmp,vertical)
Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: vertical progressbar
« Reply #8 on: June 13, 2011, 04:35:33 AM »
pretty sure that %x() is comepltyl illegal.
errm, change it to %xd() and %xl(), you cant put %x() inside a conditional and expect it to work. sorry :)
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #9 on: June 13, 2011, 06:03:42 AM »
OK so this code:

%xl(C,batterycharge.bmp,0,0)
#### Battery Bar
%V(149,85,11,43,0)
%?bc<%xd(C)|%bl(0,0,11,43,batterybar.bmp,vertical)>

works for the Battery Bar but how can I check if the batterycharge will be displayed, it seems that the simulator doesn't show such an event...

Anyway thanks a lot for your help, hope I'll be able to upload some wps soon...
Logged

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: vertical progressbar
« Reply #10 on: June 13, 2011, 12:09:26 PM »
Just a suggestion, but I like to add a "charged" condition too...

By detecting if the charger is plugged and charging is currently false, we can safely assume the device is charged:

Code: [Select]
%?bp<%?bc<foo|bar>|baz>

foo: charger is present, we are currently charging.
bar: charger is present, we are no longer charging. safe to assume the device is charged.
baz: charger not present, cannot be charging...display something else like battery information.



[St.]
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #11 on: June 13, 2011, 02:37:09 PM »
Mmmm I should have warned you, I'm not English, and not a developper. So I must apologize but I haven't understand a single word of your post...
Logged

Offline [Saint]

  • Rockbox Expert
  • Member
  • *
  • Posts: 1662
  • Hayden Pearce
    • Google+
Re: vertical progressbar
« Reply #12 on: June 13, 2011, 08:54:53 PM »
Ok, my apologies.

What I was saying is that in addition to displaying an image or notification when the player is charging, I also like to display an image or notification when the player is fully charged and it is time to remove the charger.
I shall write full working example here:


Code: [Select]
# Preload the needed images:
%xl(battery,battery_image.bmp,0,0)
%xl(charging,charging_image.bmp,0,0)
%xl(charged,charged_image.bmp,0,0)
#
# Viewport
%V(0,0,100,10,-)
%?bp<%?bc<%xd(charging)|%xd(charged)>|%bl(0,0,100,10,battery_image.bmp,vertical)>


The conditional statement above can be described like this:

Code: [Select]
Is the charger present?

          Yes: Are we charging?

                                        Yes: We are charging - display 'charging_image.bmp'.

                                        No:  Charging completed - display 'charged_image.bmp'.

          No: Charger not present - display our battery bar.

I hope that this helps to explain the code example. Please ask if you have any more questions about this or anything else...



[St.]
Logged
Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

Offline Arzhur

  • Member
  • *
  • Posts: 17
Re: vertical progressbar
« Reply #13 on: June 15, 2011, 03:49:05 AM »
Quote from: [St.] on June 13, 2011, 08:54:53 PM
Ok, my apologies.

Never mind, I just don't know speaking foobar language  :D

Now it is perfectly clear for me and a very nice idea, that I immediatly applied, and that work just perfectly, except that as my battery is fully charged, I have to wait to check if the charging image is displayed.

Another question, is it possible to determine the language setting, to change the image dependind on this? I mean having a fr_battery and a en_battery set, as my images are verticals, I must display the text as an image, so it will not be translated.

Thanks
Logged

Offline JdGordon

  • Member
  • *
  • Posts: 1817
  • Constantly breaking stuff
Re: vertical progressbar
« Reply #14 on: June 15, 2011, 03:51:54 AM »
sure :) Check CustomWPS on the wiki.... use the (IIRC) %St() tag
Logged


Using PMs to annoy devs about bugs/patches is not a good way to have the issue looked at.

  • Print
Pages: [1] 2
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Theming and Appearance Customization
| | |-+  vertical progressbar
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.077 seconds with 14 queries.