Re: [Further-devel] Plugins: xmms/launcher

From: Evan Martin (eeyem@u.washington.edu)
Date: Fri May 25 2001 - 18:06:20 PDT


On Sat, May 26, 2001 at 01:30:20AM +0100, Chris Ball wrote:
> - evas_move(evas, edate, dpy_width - text_width - 5, clock_height);
> + evas_move(evas, edate, dpy_width - text_width - 5, clock_height + 10);

Ideally, this'll all be covered by the configuration system, eventually.

> -#define TIME_FORMAT "%I:%M"
> +#define TIME_FORMAT "%I:%M%P"
>
> -#define CLOCK_FONT "georgia", 20
> +#define CLOCK_FONT "tahomabd", 20

As will this, but I'm leaving it at the current setting for now.

> + while (fscanf(fp, "%s %s", exec, icon) != EOF) {
> + printf("exec: %s\t icon: %s\n", exec, icon);
> + add_icon(exec, icon, x, y);
> + x += 50;
> + }

Hm... I don't think this will work. Each fscanf overwrites the buffer,
and you're passing the address of the buffer to each icon.

Also, how will this handle command lines with spaces?
I'll commit a modified version of this.

> +static void update_time() {
> + char buffer[1024];
> + int minutes, seconds;
> + double w, h;
> +
> + minutes = xmms_remote_get_output_time(0) / 60000;
> + seconds = (xmms_remote_get_output_time(0) / 1000) % 60;
> + sprintf(buffer, "%d:%02d", minutes, seconds);
> + evas_set_text(evas, etime, buffer);
> + evas_get_geometry(evas, etime, NULL, NULL, &w, &h);
> + evas_move(evas, etime, dpy_width - w, dpy_height - h - 30);
> + furtherp_add_event(1000, update_time, NULL);
> +}

This looks good, though some sort of progress bar might be more
appropriate.
Maybe I'll play with some of the gradient functions...

> +static void wheel_volume(void *data, Evas e, Evas_Object o, int b, int x, int y) {
> + gint cur_vol, new_vol;
>
> + if (b == 4) {
> + cur_vol = xmms_remote_get_main_volume(0);
> + new_vol = cur_vol + (cur_vol * 0.1);
> + xmms_remote_set_main_volume(0, new_vol);
> + }
> + if (b == 5) {
> + cur_vol = xmms_remote_get_main_volume(0);
> + new_vol = cur_vol - (cur_vol * 0.1);
> + xmms_remote_set_main_volume(0, new_vol);
> + }
> +}

And this can be simplified a bit, but I'll commit something like it.
Thanks for this bit-- I've been wishing I had something like this. :)

Notice that because cur_vol always moves by 10% of its current value, it
will be impossible to get it to 0. Depending on how XMMS interprets the
volume argument, we should either move logarithmically or linearly.

> + ewheel = evas_add_rectangle(evas);
> + evas_set_color(evas, ewheel, 255, 255, 255, 0);
> + evas_move(evas, ewheel, x, y);
> + evas_resize(evas, ewheel, plugin_width, plugin_height);
> + evas_callback_add(evas, ewheel,
> + CALLBACK_MOUSE_UP, wheel_volume, NULL);
> + evas_show(evas, ewheel);

Does this work? Or is the additional code in each of the buttons
necessary?

I wish I could somehow proxy the mouse click through some sort of
transparent box over the entire plugin... then we'd just need to attach
the wheel_volume function to one function.

Thanks for the patch!

-- 
Evan Martin - martine@speakeasy.org
 http://www.speakeasy.org/~martine

_______________________________________________ Further-devel mailing list Further-devel@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/further-devel



This archive was generated by hypermail 2.1.2 : Sun Nov 11 2001 - 14:16:15 PST