aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/fatom.h29
-rwxr-xr-xgui/slider.c1
-rwxr-xr-xgui/state.c8
-rwxr-xr-xgui/w_envgen.h10
4 files changed, 26 insertions, 22 deletions
diff --git a/gui/fatom.h b/gui/fatom.h
index 5aed2dc..f261995 100644
--- a/gui/fatom.h
+++ b/gui/fatom.h
@@ -155,6 +155,16 @@ static void create_widget(t_fatom *x, t_glist *glist)
-from 127 -to 0 \
-command fatom_cb%x\n",canvas,x,x);
}
+
+ /* 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);
+ else
+ sys_vgui(".x%x.c.s%x deselect\n",x->x_glist,x,x->x_val);
+ } else
+ sys_vgui(".x%x.c.s%x set %f\n",x->x_glist,x,x->x_val);
+
}
@@ -163,14 +173,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=glist_getcanvas(glist);
+ t_canvas *canvas=x->x_glist;//glist_getcanvas(glist);
DEBUG(post("drawme %d",firsttime);)
if (firsttime) {
- DEBUG(post("glist %x canvas %x",x->x_glist,canvas);)
- if (x->x_glist != canvas) {
- create_widget(x,glist);
- x->x_glist = canvas;
- }
+ DEBUG(post("glist %x canvas %x",x->x_glist,canvas));
+ create_widget(x,glist);
+
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);
@@ -324,6 +332,7 @@ static void fatom_float(t_fatom* x,t_floatarg f)
{
x->x_val = f;
+ if (glist_isvisible(x->x_glist)) {
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,f);
@@ -331,6 +340,7 @@ static void fatom_float(t_fatom* x,t_floatarg f)
sys_vgui(".x%x.c.s%x deselect\n",x->x_glist,x,f);
} else
sys_vgui(".x%x.c.s%x set %f\n",x->x_glist,x,f);
+ }
outlet_float(x->x_obj.ob_outlet,f);
}
@@ -362,7 +372,7 @@ 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)
{
char buf[256];
- x->x_glist = (t_glist*)NULL;
+ x->x_glist = canvas_getcurrent();
x->a_pos.a_type = A_FLOAT;
@@ -375,11 +385,6 @@ static void *fatom_new(t_fatom* x,t_floatarg max, t_floatarg min, t_floatarg h)
else x->x_width = 15;
-/*
- if (o) x->x_height = o;
- else
-*/
-
/* bind to a symbol for slider callback (later make this based on the
filepath ??) */
diff --git a/gui/slider.c b/gui/slider.c
index 06f9637..ecb3bf6 100755
--- a/gui/slider.c
+++ b/gui/slider.c
@@ -6,6 +6,7 @@
#pragma warning( disable : 4305 )
#endif
+#include <stdio.h>
#include "fatom.h"
/* can we use the normal text save function ?? */
diff --git a/gui/state.c b/gui/state.c
index b865587..dedd9ab 100755
--- a/gui/state.c
+++ b/gui/state.c
@@ -214,12 +214,12 @@ void state_load(t_state *x)
!strcmp(class_getname(a->te_pd),"hsl" ) */
) {
if (TATOM(a)->a_type == A_SYMBOL) {
- fscanf(fp,"%s",name);
+ if (fscanf(fp,"%s",name)<=0) continue;
if (strcmp(name,EMPTYSYMBOL))
vmess((t_pd*)a,gensym("set"),"s",gensym(name));
}
else {
- fscanf(fp,"%f",&in);
+ if (fscanf(fp,"%f",&in)<=0) continue;
vmess((t_pd*)a,&s_float,"f",in);
}
}
@@ -234,7 +234,7 @@ void state_load(t_state *x)
fscanf(fp,"%f",&in);
end = in;
- fscanf(fp,"%f",&val);
+ if (fscanf(fp,"%f",&val)<=0) continue;
SETFLOAT(ilist,val);
for (i=1 ;i <= end;i++) {
fscanf(fp,"%f",&dur);
@@ -243,7 +243,7 @@ void state_load(t_state *x)
SETFLOAT(ilist+2*i,val);
}
pd_typedmess((t_pd*)a,&s_list,2*end+1,ilist);
- post("ok %d",end);
+ // post("ok %d",end);
}
diff --git a/gui/w_envgen.h b/gui/w_envgen.h
index de8a907..12fd511 100755
--- a/gui/w_envgen.h
+++ b/gui/w_envgen.h
@@ -253,12 +253,10 @@ void envgen_erase(t_envgen* x,t_glist* glist)
sys_vgui(".x%x.c delete %pP\n",
glist_getcanvas(glist), x);
- n = 1;
-
- while (n--) {
- sys_vgui(".x%x.c delete %xi%d\n",glist_getcanvas(glist),x,n);
- sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n);
- }
+ sys_vgui(".x%x.c delete %xi0\n",glist_getcanvas(glist),x,n);
+ sys_vgui(".x%x.c delete %xo0\n",glist_getcanvas(glist),x,n);
+ sys_vgui(".x%x.c delete %xo1\n",glist_getcanvas(glist),x,n);
+
envgen_delete_doodles(x,glist);
}