From 5e9ce28202773de7cc189507e30e4759c8bbf625 Mon Sep 17 00:00:00 2001 From: Guenter Geiger Date: Sun, 25 Jul 2004 15:01:14 +0000 Subject: Finally fixed the GOP behaviour svn path=/trunk/externals/ggee/; revision=1891 --- gui/button.c | 4 ++-- gui/fatom.c | 11 ----------- gui/fatom.h | 31 +++++++++++++++++++++++++++---- gui/ticker.c | 2 +- gui/toddle.c | 9 +++++++-- 5 files changed, 37 insertions(+), 20 deletions(-) (limited to 'gui') diff --git a/gui/button.c b/gui/button.c index a83f242..ce3703a 100644 --- a/gui/button.c +++ b/gui/button.c @@ -127,10 +127,10 @@ static void button_drawme(t_button *x, t_glist *glist, int firsttime) DEBUG(post("drawme %d",firsttime);) if (firsttime) { DEBUG(post("glist %x canvas %x",x->x_glist,canvas);) - if (x->x_glist != canvas) { + // if (x->x_glist != canvas) { create_widget(x,glist); x->x_glist = canvas; - } + // } sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n", canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),x->x_glist,x,x); diff --git a/gui/fatom.c b/gui/fatom.c index e71dd27..8c7ea44 100644 --- a/gui/fatom.c +++ b/gui/fatom.c @@ -1,20 +1,9 @@ #include #include "g_canvas.h" -#include - -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - #include "fatom.h" - static t_class *fatom_class; - - - void fatom_setup() { post("fatom setup"); fatom_class = class_new(gensym("fatom"), (t_newmethod)fatom_new, 0, diff --git a/gui/fatom.h b/gui/fatom.h index 8b2c457..785f600 100644 --- a/gui/fatom.h +++ b/gui/fatom.h @@ -21,6 +21,8 @@ typedef struct _fatom int x_max; /* maximum value of a_pos (x_val) */ int x_min; /* minimum value of a_pos (x_val) */ int x_width; /* width of widget (e.g x_rect_height + 15 for hslider, x_rect_width + 15 for slider) */ + t_symbol* x_color; + t_symbol* x_bgcolor; } t_fatom; /* widget helper functions */ @@ -103,11 +105,17 @@ static void create_widget(t_fatom *x, t_glist *glist) -repeatinterval 20 \ -from %d -to %d \ -width %d \ + -bg %s \ + -activebackground %s \ + -troughcolor %s \ -command fatom_cb%x\n",canvas,x, x->x_max-x->x_min+14, x->x_max, x->x_min, x->x_width, + x->x_color->s_name, + x->x_color->s_name, + x->x_bgcolor->s_name, x); } else if (!strcmp(x->x_type->s_name,"hslider")) { x->x_rect_width = x->x_max-x->x_min + 24; @@ -121,17 +129,29 @@ static void create_widget(t_fatom *x, t_glist *glist) -repeatinterval 20 \ -from %d -to %d \ -width %d \ + -bg %s \ + -activebackground %s \ + -troughcolor %s \ -command fatom_cb%x\n",canvas,x, x->x_max-x->x_min+14, x->x_min, x->x_max, x->x_width, + x->x_color->s_name, + x->x_color->s_name, + x->x_bgcolor->s_name, x); } else if (!strcmp(x->x_type->s_name,"checkbutton")) { x->x_rect_width = 32; x->x_rect_height = 28; sys_vgui("checkbutton .x%x.c.s%x \ - -command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -text \"%s\"\n",canvas,x,x,x,x,x->x_text->s_name); + -command { fatom_cb%x $fatom_val%x} -variable fatom_val%x -text \"%s\" \ + -bg %s \ + -activebackground %s \ + \n",canvas,x,x,x,x, + x->x_text->s_name, + x->x_color->s_name, + x->x_bgcolor->s_name); } else if (!strcmp(x->x_type->s_name,"hradio")) { int i; x->x_rect_width = 8*20; @@ -178,12 +198,12 @@ static void create_widget(t_fatom *x, t_glist *glist) static void fatom_drawme(t_fatom *x, t_glist *glist, int firsttime) { - t_canvas *canvas=x->x_glist;//glist_getcanvas(glist); + t_canvas *canvas=glist_getcanvas(glist);// x->x_glist;//glist_getcanvas(glist); DEBUG(post("drawme %d",firsttime);) if (firsttime) { DEBUG(post("glist %x canvas %x",x->x_glist,canvas)); create_widget(x,glist); - + x->x_glist = canvas; sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x -tags %xS\n", canvas,text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)+2,x->x_glist,x,x); @@ -390,7 +410,10 @@ static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h,t x->x_min = min; if (h) x->x_width = h; else x->x_width = 15; - + + + x->x_color = gensym("grey"); + x->x_bgcolor = gensym("grey"); /* bind to a symbol for slider callback (later make this based on the filepath ??) */ diff --git a/gui/ticker.c b/gui/ticker.c index 74fa325..214ff53 100755 --- a/gui/ticker.c +++ b/gui/ticker.c @@ -20,7 +20,7 @@ static void ticker_save(t_gobj *z, t_binbuf *b) binbuf_addv(b, "ssiiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , - gensym("ticker"),x->x_text); + gensym("ticker"),x->x_text,x->x_max,x->x_width); binbuf_addv(b, ";"); } diff --git a/gui/toddle.c b/gui/toddle.c index 32d7e3b..04a8f41 100755 --- a/gui/toddle.c +++ b/gui/toddle.c @@ -323,11 +323,16 @@ static void toddle_setwidget(void) toddle_widgetbehavior.w_activatefn = toddle_activate; toddle_widgetbehavior.w_deletefn = toddle_delete; toddle_widgetbehavior.w_visfn = toddle_vis; -#if (PD_VERSION_MINOR > 31) toddle_widgetbehavior.w_clickfn = toddle_newclick; +#if (PD_MINOR_VERSION < 37) toddle_widgetbehavior.w_propertiesfn = NULL; -#endif toddle_widgetbehavior.w_savefn = toddle_save; +#endif + +#if PD_MINOR_VERSION >= 37 + class_setsavefn(toddle_class,&toddle_save); +#endif + } -- cgit v1.2.1