diff options
author | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-09-15 11:53:40 +0000 |
---|---|---|
committer | Guenter Geiger <ggeiger@users.sourceforge.net> | 2003-09-15 11:53:40 +0000 |
commit | 2b575004921176d43108b47c2b595e8eb80d87fe (patch) | |
tree | c2f88484a464115a6e505839cd979007df50fa3c /gui | |
parent | 1e3891a7e0d3b60e89d0968b14e826ea92c28e15 (diff) |
some bugfixes, GOP still not working
svn path=/trunk/externals/ggee/; revision=968
Diffstat (limited to 'gui')
-rw-r--r-- | gui/button.c | 1 | ||||
-rwxr-xr-x | gui/envgen.c | 2 | ||||
-rw-r--r-- | gui/fatom.h | 21 | ||||
-rw-r--r-- | gui/sliderh.c | 4 | ||||
-rwxr-xr-x | gui/ticker.c | 36 | ||||
-rwxr-xr-x | gui/w_envgen.h | 4 |
6 files changed, 25 insertions, 43 deletions
diff --git a/gui/button.c b/gui/button.c index debea9f..90a21f2 100644 --- a/gui/button.c +++ b/gui/button.c @@ -10,6 +10,7 @@ #pragma warning( disable : 4305 ) #endif +#define IOWIDTH 4 typedef struct _button { diff --git a/gui/envgen.c b/gui/envgen.c index ceaf65f..054d836 100755 --- a/gui/envgen.c +++ b/gui/envgen.c @@ -155,7 +155,7 @@ void envgen_float(t_envgen *x, t_floatarg f) (x->finalvalues[state] - x->finalvalues[state-1])/
(x->duration[state] - x->duration[state-1]);
- val *= val*(x->max - x->min);
+ val *= (x->max - x->min);
outlet_float(x->x_obj.ob_outlet,val);
}
diff --git a/gui/fatom.h b/gui/fatom.h index f261995..cea48c2 100644 --- a/gui/fatom.h +++ b/gui/fatom.h @@ -1,7 +1,7 @@ /* ------------------------ fatom ----------------------------- */ #define x_val a_pos.a_w.w_float -#define DEBUG(x) +#define DEBUG(x) x typedef struct _fatom { @@ -14,6 +14,7 @@ typedef struct _fatom t_symbol* x_sym; t_symbol* x_type; + t_symbol* x_text; int x_max; int x_min; int x_width; @@ -86,6 +87,7 @@ static void draw_handle(t_fatom *x, t_glist *glist, int firsttime) { static void create_widget(t_fatom *x, t_glist *glist) { t_canvas *canvas=glist_getcanvas(glist); + if (!strcmp(x->x_type->s_name,"vslider")) { x->x_rect_width = x->x_width+15; x->x_rect_height = x->x_max-x->x_min+24; @@ -123,10 +125,10 @@ static void create_widget(t_fatom *x, t_glist *glist) x->x_width, x); } else if (!strcmp(x->x_type->s_name,"checkbutton")) { - x->x_rect_width = 30; - x->x_rect_height = 25; + 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\n",canvas,x,x,x,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); } else if (!strcmp(x->x_type->s_name,"hradio")) { int i; x->x_rect_width = 8*20; @@ -159,11 +161,11 @@ static void create_widget(t_fatom *x, t_glist *glist) /* set the start value */ if (!strcmp(x->x_type->s_name,"checkbutton")) { if (x->x_val) - sys_vgui(".x%x.c.s%x select\n",x->x_glist,x,x->x_val); + sys_vgui(".x%x.c.s%x select\n",canvas,x,x->x_val); else - sys_vgui(".x%x.c.s%x deselect\n",x->x_glist,x,x->x_val); + sys_vgui(".x%x.c.s%x deselect\n",canvas,x,x->x_val); } else - sys_vgui(".x%x.c.s%x set %f\n",x->x_glist,x,x->x_val); + sys_vgui(".x%x.c.s%x set %f\n",canvas,x,x->x_val); } @@ -369,12 +371,13 @@ static void fatom_save(t_gobj *z, t_binbuf *b) } -static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h) +static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h,t_symbol* text) { char buf[256]; x->x_glist = canvas_getcurrent(); - + if (text != &s_) x->x_text = text; + else x->x_text = gensym(""); x->a_pos.a_type = A_FLOAT; if (!max) x->x_max = 127; diff --git a/gui/sliderh.c b/gui/sliderh.c index b83f9c7..50671a2 100644 --- a/gui/sliderh.c +++ b/gui/sliderh.c @@ -1,6 +1,6 @@ #include <m_pd.h> #include "g_canvas.h" -#include <ggee.h> + #ifdef NT #pragma warning( disable : 4244 ) @@ -29,7 +29,7 @@ static void *sliderh_new(t_floatarg max, t_floatarg min,t_floatarg h) { t_fatom *x = (t_fatom *)pd_new(sliderh_class); x->x_type = gensym("hslider"); - return fatom_new(x,max,min,h); + return fatom_new(x,max,min,h,&s_); } diff --git a/gui/ticker.c b/gui/ticker.c index abb55b2..4fc3b7f 100755 --- a/gui/ticker.c +++ b/gui/ticker.c @@ -6,6 +6,7 @@ #pragma warning( disable : 4305 ) #endif +#include <stdio.h> #include "fatom.h" /* can we use the normal text save function ?? */ @@ -17,9 +18,9 @@ static void ticker_save(t_gobj *z, t_binbuf *b) t_fatom *x = (t_fatom *)z; - binbuf_addv(b, "ssiis", gensym("#X"),gensym("obj"), + binbuf_addv(b, "ssiiss", gensym("#X"),gensym("obj"), x->x_obj.te_xpix, x->x_obj.te_ypix , - gensym("ticker")); + gensym("ticker"),x->x_text); binbuf_addv(b, ";"); } @@ -29,35 +30,11 @@ static void ticker_bang(t_fatom* x) fatom_float(x,x->x_val); } -static void *ticker_new() +static void *ticker_new(t_symbol* t) { t_fatom *x = (t_fatom *)pd_new(ticker_class); - char buf[256]; - x->x_type = gensym("checkbutton"); - x->x_glist = (t_glist*)NULL; -/* - if (h) x->x_width = h; - else -*/ -/* - if (o) x->x_height = o; - else -*/ - - /* bind to a symbol for ticker callback (later make this based on the - filepath ??) */ - - sprintf(buf,"ticker%x",x); - x->x_sym = gensym(buf); - pd_bind(&x->x_obj.ob_pd, x->x_sym); - -/* pipe startup code to slitk */ - - sys_vgui("proc fatom_cb%x {val} {\n pd [concat ticker%x f $val \\;]\n }\n",x,x); - - outlet_new(&x->x_obj, &s_float); - return (x); + return fatom_new(x,10,0,0,t); } @@ -75,9 +52,10 @@ t_widgetbehavior ticker_widgetbehavior = { void ticker_setup() { ticker_class = class_new(gensym("ticker"), (t_newmethod)ticker_new, 0, - sizeof(t_fatom),0,0); + sizeof(t_fatom),0,A_DEFSYMBOL,0); class_addbang(ticker_class,ticker_bang); fatom_setup_common(ticker_class); + class_addbang(ticker_class, (t_method)ticker_bang); class_setwidget(ticker_class,&ticker_widgetbehavior); } diff --git a/gui/w_envgen.h b/gui/w_envgen.h index ffd699e..c436947 100755 --- a/gui/w_envgen.h +++ b/gui/w_envgen.h @@ -187,11 +187,11 @@ static void envgen_shownum(t_envgen *x) ypos = (int) (x->x_obj.te_ypix + x->w.height);
envgen_delnum(x);
- if (!x->w.grabbed) return;
+ sys_vgui(".x%x.c create text %d %d -text %fx%f -tags %xT\n",
(unsigned int)glist_getcanvas(x->w.glist),
- (int) (xpos+(x->duration[i] * xscale) - 2),
+ (int) (xpos+(x->duration[i] * xscale) + 12),
(int) (ypos - x->finalvalues[i]*yscale - 2),
x->finalvalues[i]*(x->max-x->min),
|