Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8369
Modified Files:
Tag: impd_0_37
g_all_guis.c g_all_guis.h g_bang.c g_hdial.c g_hslider.c
g_numbox.c g_toggle.c u_object.tk
Log Message:
moving more code to the Tcl side
Index: g_all_guis.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v
retrieving revision 1.1.1.4.2.4.2.3
retrieving revision 1.1.1.4.2.4.2.4
diff -C2 -d -r1.1.1.4.2.4.2.3 -r1.1.1.4.2.4.2.4
*** g_all_guis.c 7 Mar 2004 19:38:13 -0000 1.1.1.4.2.4.2.3
--- g_all_guis.c 10 Mar 2004 06:00:11 -0000 1.1.1.4.2.4.2.4
***************
*** 12,15 ****
--- 12,16 ----
#include <ctype.h>
#include "m_pd.h"
+ #include "m_imp.h"
#include "g_canvas.h"
#include "t_tk.h"
***************
*** 29,38 ****
int iemgui_color_hex[]=
{
! 16579836, 10526880, 4210752, 16572640, 16572608,
! 16579784, 14220504, 14220540, 14476540, 16308476,
! 14737632, 8158332, 2105376, 16525352, 16559172,
! 15263784, 1370132, 2684148, 3952892, 16003312,
! 12369084, 6316128, 0, 9177096, 5779456,
! 7874580, 2641940, 17488, 5256, 5767248
};
--- 30,39 ----
int iemgui_color_hex[]=
{
! 0xfcfcfc, 0xa0a0a0, 0x404040, 0xfce0e0, 0xfce0c0,
! 0xfcfcc8, 0xd8fcd8, 0xd8fcfc, 0xdce4fc, 0xf8d8fc,
! 0xe0e0e0, 0x7c7c7c, 0x202020, 0xfc2828, 0xfcac44,
! 0xe8e828, 0x14e814, 0x28f4f4, 0x3c50fc, 0xf430f0,
! 0xbcbcbc, 0x606060, 0x000000, 0x8c0808, 0x583000,
! 0x782814, 0x285014, 0x004450, 0x001488, 0x580050
};
***************
*** 194,197 ****
--- 195,207 ----
}
+ void iemgui_new_getnames2(t_iemgui *iemgui, int i, t_symbol *snd, t_symbol *rcv, t_symbol *lab)
+ {
+ iemgui->x_snd = snd?snd:gensym("empty"); iemgui->x_snd_unexpanded = 0;
+ iemgui->x_rcv = rcv?rcv:gensym("empty"); iemgui->x_rcv_unexpanded = 0;
+ iemgui->x_lab = lab?lab:gensym("empty"); iemgui->x_lab_unexpanded = 0;
+ iemgui->x_binbufindex = i;
+ iemgui->x_labelbindex = i+3;
+ }
+
/* convert symbols in "$" form to the expanded symbols */
void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
***************
*** 324,335 ****
{
t_symbol *snd;
! int pargc, tail_len, nth_arg, sndable=1, oldsndrcvable=0;
! t_atom *pargv;
!
! if(iemgui->x_fsf.x_rcv_able)
! oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
! if(iemgui->x_fsf.x_snd_able)
! oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
if(!strcmp(s->s_name, "empty")) sndable = 0;
snd = iemgui_raute2dollar(s);
--- 334,341 ----
{
t_symbol *snd;
! int sndable=1, oldsndrcvable=0;
+ if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
+ if(iemgui->x_fsf.x_snd_able) oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
if(!strcmp(s->s_name, "empty")) sndable = 0;
snd = iemgui_raute2dollar(s);
***************
*** 338,342 ****
post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name,
iemgui->x_snd->s_name);
-
iemgui->x_fsf.x_snd_able = sndable;
iemgui_verify_snd_ne_rcv(iemgui);
--- 344,347 ----
***************
*** 347,358 ****
{
t_symbol *rcv;
! int pargc, tail_len, nth_arg, rcvable=1, oldsndrcvable=0;
! t_atom *pargv;
!
! if(iemgui->x_fsf.x_rcv_able)
! oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
! if(iemgui->x_fsf.x_snd_able)
! oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
if(!strcmp(s->s_name, "empty")) rcvable = 0;
rcv = iemgui_raute2dollar(s);
--- 352,359 ----
{
t_symbol *rcv;
! int rcvable=1, oldsndrcvable=0;
+ if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG;
+ if(iemgui->x_fsf.x_snd_able) oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
if(!strcmp(s->s_name, "empty")) rcvable = 0;
rcv = iemgui_raute2dollar(s);
***************
*** 381,392 ****
void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
{
! t_symbol *lab;
! int pargc, tail_len, nth_arg;
! t_atom *pargv;
!
! lab = iemgui_raute2dollar(s);
iemgui->x_lab_unexpanded = lab;
iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
-
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
--- 382,388 ----
void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
{
! t_symbol *lab = iemgui_raute2dollar(s);
iemgui->x_lab_unexpanded = lab;
iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
***************
*** 657,661 ****
case 'S': case 's': if (!IS_A_SYMBOL(argv,i)) goto err;
break;
! case '?': break; /* skip */
case ';': optional=1; break;
default: post("WARNING: bug using pd_scanargs()"); goto err; /* WHAT? */
--- 653,657 ----
case 'S': case 's': if (!IS_A_SYMBOL(argv,i)) goto err;
break;
! case '?': case 'a': break; /* skip */
case ';': optional=1; break;
default: post("WARNING: bug using pd_scanargs()"); goto err; /* WHAT? */
***************
*** 684,687 ****
--- 680,694 ----
*p = atom_getsymbolarg(i,argc,argv);
} break;
+ case 'a': {
+ t_symbol **p = va_arg(val,t_symbol**);
+ if (IS_A_SYMBOL(argv,i))
+ *p = atom_getsymbolarg(i,argc,argv);
+ else if (IS_A_FLOAT(argv,i)) {
+ char str[80];
+ sprintf(str, "%d", (int)atom_getintarg(i,argc,argv));
+ *p = gensym(str);
+ } else *p = gensym("empty");
+
+ } break;
default: post("WARNING: bug using pd_scanargs()"); goto err; /* WHAT? */
}
***************
*** 694,695 ****
--- 701,714 ----
return 0;
}
+
+ void pd_upload(t_gobj *self) {
+ t_binbuf *buf = binbuf_new();
+ t_class *c = self->g_pd;
+ int n;
+ char *s;
+ c->c_savefn(self,buf);
+ binbuf_gettext(buf,&s,&n);
+ sys_vgui("update_object %x {%s}\n",self,s);
+ binbuf_free(buf);
+ free(s);
+ }
Index: g_all_guis.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.h,v
retrieving revision 1.1.1.4.2.2.2.2
retrieving revision 1.1.1.4.2.2.2.3
diff -C2 -d -r1.1.1.4.2.2.2.2 -r1.1.1.4.2.2.2.3
*** g_all_guis.h 7 Mar 2004 19:38:13 -0000 1.1.1.4.2.2.2.2
--- g_all_guis.h 10 Mar 2004 06:00:11 -0000 1.1.1.4.2.2.2.3
***************
*** 186,191 ****
int x_pos;
int x_val;
! int x_center;
! int x_thick;
int x_lin0_log1;
int x_steady;
--- 186,191 ----
int x_pos;
int x_val;
! int x_center; /* unused in vslider */
! int x_thick; /* unused in vslider */
int x_lin0_log1;
int x_steady;
***************
*** 193,197 ****
double x_max;
double x_k;
! } t_hslider;
typedef struct _hdial
--- 193,197 ----
double x_max;
double x_k;
! } t_hslider /*, t_vslider */;
typedef struct _hdial
***************
*** 203,207 ****
int x_number;
t_atom x_at[2];
! } t_hdial;
typedef struct _toggle
--- 203,207 ----
int x_number;
t_atom x_at[2];
! } t_hdial /*, t_vdial */;
typedef struct _toggle
***************
*** 220,235 ****
} t_my_canvas;
- typedef struct _vslider
- {
- t_iemgui x_gui;
- int x_pos;
- int x_val;
- int x_lin0_log1;
- int x_steady;
- double x_min;
- double x_max;
- double x_k;
- } t_vslider;
-
typedef struct _vu
{
--- 220,223 ----
***************
*** 260,273 ****
} t_my_numbox;
- typedef struct _vdial
- {
- t_iemgui x_gui;
- int x_on;
- int x_on_old;
- int x_change;
- int x_number;
- t_atom x_at[2];
- } t_vdial;
-
#define t_vradio t_vdial
#define t_hradio t_hdial
--- 248,251 ----
***************
*** 298,301 ****
--- 276,280 ----
EXTERN t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv);
EXTERN void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv);
+ EXTERN void iemgui_new_getnames2(t_iemgui *iemgui, int i, t_symbol *snd, t_symbol *rcv, t_symbol *lab);
EXTERN void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym);
EXTERN void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym);
***************
*** 332,333 ****
--- 311,313 ----
EXTERN int pd_scanargs(int argc, t_atom *argv, char *format, ...);
+ EXTERN void pd_upload(t_gobj *self);
Index: g_bang.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_bang.c,v
retrieving revision 1.1.1.3.2.2.2.5
retrieving revision 1.1.1.3.2.2.2.6
diff -C2 -d -r1.1.1.3.2.2.2.5 -r1.1.1.3.2.2.2.6
*** g_bang.c 8 Mar 2004 12:32:38 -0000 1.1.1.3.2.2.2.5
--- g_bang.c 10 Mar 2004 06:00:11 -0000 1.1.1.3.2.2.2.6
***************
*** 29,32 ****
--- 29,36 ----
t_canvas *canvas=glist_getcanvas(glist);
switch(mode) {
+ default:{
+ pd_upload((t_gobj *)x);
+ sys_vgui("bang_draw %x .x%x.c\n", x, canvas);
+ }
case IEM_GUI_DRAW_MODE_UPDATE:
if(glist_isvisible(glist))
***************
*** 40,52 ****
sys_vgui("bang_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
break;
! default:{
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
! sys_vgui("bang_draw .x%x.c %x %d %d %d %d %d %d #%6.6x {%s} %d %d {%s %d bold} #%6.6x\n",
! canvas, x, xpos, ypos, x->x_gui.x_w, x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able, x->x_gui.x_bcol,
! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
! x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol);
! }}}
/* ------------------------ bng widgetbehaviour----------------------------- */
--- 44,48 ----
sys_vgui("bang_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
break;
! }}
/* ------------------------ bng widgetbehaviour----------------------------- */
***************
*** 278,298 ****
fthold= IEM_BNG_DEFAULTHOLDFLASHTIME;
int fstyle=0, isa=0;
!
x->x_gui.x_ldx=0;
x->x_gui.x_ldy=-6;
!
! if (pd_scanargs(argc,argv,"iiii???iiiiiii",
! &a,&fthold,&ftbreak,&isa,
&x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,
! &fs,&bflcol[0],&bflcol[1],&bflcol[2]))
! {
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iemgui_new_getnames(&x->x_gui, 4, argv);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
! }
! else {
! iemgui_new_getnames(&x->x_gui, 4, 0);
! }
!
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
x->x_gui.x_fsf.x_snd_able = 1;
--- 274,287 ----
fthold= IEM_BNG_DEFAULTHOLDFLASHTIME;
int fstyle=0, isa=0;
! t_symbol *srl[3]={0,0,0};
x->x_gui.x_ldx=0;
x->x_gui.x_ldy=-6;
! pd_scanargs(argc,argv,"iiiiaaaiiiiiii",
! &a,&fthold,&ftbreak,&isa,&srl[0],&srl[1],&srl[2],
&x->x_gui.x_ldx,&x->x_gui.x_ldy,&fstyle,
! &fs,&bflcol[0],&bflcol[1],&bflcol[2]);
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
! iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]);
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
x->x_gui.x_fsf.x_snd_able = 1;
***************
*** 306,310 ****
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
-
if (x->x_gui.x_fsf.x_rcv_able)
pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
--- 295,298 ----
Index: g_hdial.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hdial.c,v
retrieving revision 1.1.1.4.2.2.2.5
retrieving revision 1.1.1.4.2.2.2.6
diff -C2 -d -r1.1.1.4.2.2.2.5 -r1.1.1.4.2.2.2.6
*** g_hdial.c 8 Mar 2004 12:32:38 -0000 1.1.1.4.2.2.2.5
--- g_hdial.c 10 Mar 2004 06:00:11 -0000 1.1.1.4.2.2.2.6
***************
*** 32,104 ****
}
! static void hradio_draw_update(t_hradio *x, t_glist *glist)
{
if(glist_isvisible(glist)) {
t_canvas *canvas=glist_getcanvas(glist);
sys_vgui("radio_set .x%x.c %x %d\n",canvas,x,x->x_on);
}
! }
!
! static void hradio_draw_new(t_hradio *x, t_glist *glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
! int n=x->x_number;
! int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w*(isvert(x)?1:x->x_number);
! int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h*(isvert(x)?x->x_number:1);
! sys_vgui("radio_draw .x%x.c %x %d %d %d %d %d %d %d %d #%6.6x\n",
! canvas, x, x1, y1, x2-x1, y2-y1,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,
! isvert(x),x->x_number,x->x_gui.x_bcol);
! sys_vgui("radio_set .x%x.c %x %d\n",canvas,x,x->x_on);
! sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
! -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n",
! canvas, x1+x->x_gui.x_ldx, y1+x->x_gui.x_ldy,
! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
! x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x);
! }
!
! static void hradio_draw_move(t_hradio *x, t_glist *glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
! int n=x->x_number;
! int x1=text_xpix(&x->x_gui.x_obj, glist), x2=x1+x->x_gui.x_w*(isvert(x)?1:x->x_number);
! int y1=text_ypix(&x->x_gui.x_obj, glist), y2=y1+x->x_gui.x_h*(isvert(x)?x->x_number:1);
! sys_vgui("radio_draw .x%x.c %x %d %d %d %d %d %d %d %d #%6.6x\n",
! canvas, x, x1, y1, x2, y2,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,
! isvert(x), x->x_number,x->x_gui.x_bcol);
! sys_vgui("radio_set .x%x.c %x %d\n",canvas,x,x->x_on);
! sys_vgui(".x%x.c coords %xLABEL %d %d\n",
! canvas, x, x1+x->x_gui.x_ldx, y1+x->x_gui.x_ldy);
! }
!
! static void hradio_draw_erase(t_hradio* x, t_glist* glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("radio_erase .x%x.c %x\n", canvas, x);
! sys_vgui(".x%x.c delete %xLABEL\n", canvas, x);
! }
!
! static void hradio_draw_config(t_hradio* x, t_glist* glist)
! {
! hradio_draw_new(x,glist);
! }
!
! static void hradio_draw_select(t_hradio* x, t_glist* glist)
! {
! t_canvas *canvas=glist_getcanvas(glist);
sys_vgui("bluebox_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
! }
!
! static void hradio_draw(t_hradio *x, t_glist *glist, int mode)
! {
! if (mode == IEM_GUI_DRAW_MODE_UPDATE) hradio_draw_update(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_MOVE) hradio_draw_move(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_NEW) hradio_draw_new(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_SELECT) hradio_draw_select(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_ERASE) hradio_draw_erase(x, glist);
! else if(mode == IEM_GUI_DRAW_MODE_CONFIG) hradio_draw_config(x, glist);
! else if(mode >= IEM_GUI_DRAW_MODE_IO) hradio_draw_move(x, glist);
! }
/* ------------------------ hdl widgetbehaviour----------------------------- */
--- 32,57 ----
}
! static void hradio_draw(t_hradio *x, t_glist *glist, int mode)
{
+ t_canvas *canvas=glist_getcanvas(glist);
+ switch(mode) {
+ case IEM_GUI_DRAW_MODE_UPDATE:
if(glist_isvisible(glist)) {
t_canvas *canvas=glist_getcanvas(glist);
sys_vgui("radio_set .x%x.c %x %d\n",canvas,x,x->x_on);
}
! break;
! case IEM_GUI_DRAW_MODE_SELECT:
sys_vgui("bluebox_select .x%x.c %xBASE %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
! break;
! case IEM_GUI_DRAW_MODE_ERASE:
! sys_vgui("radio_erase %x .x%x.c\n", x, canvas);
! break;
! default:
! pd_upload((t_gobj *)x);
! sys_vgui("radio_draw %x .x%x.c\n", x, canvas);
! sys_vgui("radio_set .x%x.c %x %d\n",canvas,x,x->x_on);
! break;
! }}
/* ------------------------ hdl widgetbehaviour----------------------------- */
***************
*** 434,448 ****
int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
! char str[144];
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
! if(pd_scanargs(argc,argv,"iiFi???iiFiiiii",
! &a,&chg,&num,&ldx,&ldy,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on))
{
! iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
! iemgui_new_getnames(&x->x_gui, 4, argv);
! iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
}
else iemgui_new_getnames(&x->x_gui, 4, 0);
--- 387,403 ----
int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
! t_symbol *srl[3]={0,0,0};
! int isa,fstyle;
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
! if(pd_scanargs(argc,argv,"iiiiaaaiiiiiiii",
! &a,&chg,&isa,&num,&srl[0],&srl[1],&srl[2],
! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on))
{
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
}
else iemgui_new_getnames(&x->x_gui, 4, 0);
***************
*** 457,473 ****
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
! if(num < 1)
! num = 1;
! if(num > IEM_RADIO_MAX)
! num = IEM_RADIO_MAX;
x->x_number = num;
! if(on < 0)
! on = 0;
! if(on >= x->x_number)
! on = x->x_number - 1;
! if(x->x_gui.x_isa.x_loadinit)
! x->x_on = on;
! else
! x->x_on = 0;
x->x_on_old = x->x_on;
x->x_change = (chg==0)?0:1;
--- 412,421 ----
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
! if(num < 1) num = 1;
! if(num > IEM_RADIO_MAX) num = IEM_RADIO_MAX;
x->x_number = num;
! if(on < 0) on = 0;
! if(on >= x->x_number) on = x->x_number - 1;
! x->x_on = x->x_gui.x_isa.x_loadinit ? on : 0;
x->x_on_old = x->x_on;
x->x_change = (chg==0)?0:1;
***************
*** 476,481 ****
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
! if(fs < 4)
! fs = 4;
x->x_gui.x_fontsize = fs;
x->x_gui.x_w = iemgui_clip_size(a);
--- 424,428 ----
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
! if(fs < 4) fs = 4;
x->x_gui.x_fontsize = fs;
x->x_gui.x_w = iemgui_clip_size(a);
Index: g_hslider.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_hslider.c,v
retrieving revision 1.1.1.3.2.2.2.5
retrieving revision 1.1.1.3.2.2.2.6
diff -C2 -d -r1.1.1.3.2.2.2.5 -r1.1.1.3.2.2.2.6
*** g_hslider.c 8 Mar 2004 12:32:38 -0000 1.1.1.3.2.2.2.5
--- g_hslider.c 10 Mar 2004 06:00:11 -0000 1.1.1.3.2.2.2.6
***************
*** 49,61 ****
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d %d #%6.6x\n",
! canvas, x, xpos, ypos, x->x_gui.x_w, x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,isvert(x),x->x_gui.x_bcol);
sys_vgui("slider_set .x%x.c %x %d %d #%6.6x\n", canvas, x, x->x_val, isvert(x),x->x_gui.x_fcol);
- sys_vgui(".x%x.c create text %d %d -text {%s} -anchor w \
- -font {%s %d bold} -fill #%6.6x -tags %xLABEL\n",
- canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy,
- strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
- x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x);
}
--- 49,55 ----
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
! pd_upload(x);
! sys_vgui("slider_draw %x .x%x.c\n", x, canvas);
sys_vgui("slider_set .x%x.c %x %d %d #%6.6x\n", canvas, x, x->x_val, isvert(x),x->x_gui.x_fcol);
}
***************
*** 65,74 ****
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("slider_draw .x%x.c %x %d %d %d %d %d %d %d #%6.6x\n",
! canvas, x, xpos, ypos, xpos+x->x_gui.x_w, ypos+x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,isvert(x),x->x_gui.x_bcol);
sys_vgui("slider_set .x%x.c %x %d %d #%6.6x\n", canvas, x, x->x_val,isvert(x), x->x_gui.x_fcol);
- sys_vgui(".x%x.c coords %xLABEL %d %d\n",
- canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy);
}
--- 59,65 ----
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
! pd_upload((t_gobj *)x);
! sys_vgui("slider_draw %x .x%x.c\n", x, canvas);
sys_vgui("slider_set .x%x.c %x %d %d #%6.6x\n", canvas, x, x->x_val,isvert(x), x->x_gui.x_fcol);
}
***************
*** 77,81 ****
t_canvas *canvas=glist_getcanvas(glist);
sys_vgui("slider_erase .x%x.c %x\n", canvas, x);
- sys_vgui(".x%x.c delete %xLABEL\n", canvas, x);
}
--- 68,71 ----
***************
*** 83,88 ****
{
t_canvas *canvas=glist_getcanvas(glist);
- int xpos=text_xpix(&x->x_gui.x_obj, glist);
- int ypos=text_ypix(&x->x_gui.x_obj, glist);
sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize,
--- 73,76 ----
***************
*** 487,492 ****
int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1, fs=8;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
! char str[144];
t_hslider *x;
if (s==gensym("hsl") || s==gensym("hslider")) {
x = (t_hslider *)pd_new(hslider_class);
--- 475,481 ----
int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1, fs=8;
double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1);
! int isa,fstyle;
t_hslider *x;
+ t_symbol *srl[3]={0,0,0};
if (s==gensym("hsl") || s==gensym("hslider")) {
x = (t_hslider *)pd_new(hslider_class);
***************
*** 498,507 ****
iem_inttofstyle(&x->x_gui.x_fsf, 0);
! if(pd_scanargs(argc,argv,"iiffiF???iiFiiiii?;?",
! &w,&h,&min,&max,&lilo,&ldx,&ldy,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v))
{
! iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
! iemgui_new_getnames(&x->x_gui, 6, argv);
! iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
}
else iemgui_new_getnames(&x->x_gui, 6, 0);
--- 487,497 ----
iem_inttofstyle(&x->x_gui.x_fsf, 0);
! if(pd_scanargs(argc,argv,"iiffiiaaaiiiiiiii?;?",
! &w,&h,&min,&max,&lilo,&isa,
! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v))
{
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iemgui_new_getnames2(&x->x_gui, 4, srl[0], srl[1], srl[2]);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
}
else iemgui_new_getnames(&x->x_gui, 6, 0);
Index: g_numbox.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_numbox.c,v
retrieving revision 1.1.1.4.2.2.2.3
retrieving revision 1.1.1.4.2.2.2.4
diff -C2 -d -r1.1.1.4.2.2.2.3 -r1.1.1.4.2.2.2.4
*** g_numbox.c 8 Mar 2004 12:32:38 -0000 1.1.1.4.2.2.2.3
--- g_numbox.c 10 Mar 2004 06:00:11 -0000 1.1.1.4.2.2.2.4
***************
*** 161,168 ****
t_canvas *canvas=glist_getcanvas(glist);
! sys_vgui("numbox_draw .x%x.c %x %d %d %d %d %d %d\n",
! canvas, x, xpos, ypos, x->x_numwidth, x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,
! IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol);
sys_vgui(
".x%x.c create line %d %d %d %d %d %d -fill #%6.6x -tags %xBASE2\n",
--- 161,166 ----
t_canvas *canvas=glist_getcanvas(glist);
! pd_upload(x);
! sys_vgui("numbox_draw %x .x%x.c\n", x, canvas);
sys_vgui(
".x%x.c create line %d %d %d %d %d %d -fill #%6.6x -tags %xBASE2\n",
***************
*** 189,197 ****
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
!
! sys_vgui("numbox_draw .x%x.c %xBASE %d %d %d %d %d %d #%6.6x #%6.6x\n",
! canvas, x, xpos, ypos, xpos + x->x_numwidth, ypos + x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able,
! IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol);
sys_vgui(".x%x.c coords %xBASE2 %d %d %d %d %d %d\n",
canvas, x, xpos, ypos,
--- 187,192 ----
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
! pd_upload(x);
! sys_vgui("numbox_draw %x .x%x.c\n", x, canvas);
sys_vgui(".x%x.c coords %xBASE2 %d %d %d %d %d %d\n",
canvas, x, xpos, ypos,
***************
*** 664,674 ****
double min=-1.0e+37, max=1.0e+37,v=0.0;
char str[144];
!
! if(pd_scanargs(argc,argv,"iiffiF???ii?iiiif*",&w,&h,&min,&max,&lilo,
! &ldx,&ldy,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v))
{
! iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
! iemgui_new_getnames(&x->x_gui, 6, argv);
! iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
}
else iemgui_new_getnames(&x->x_gui, 6, 0);
--- 659,672 ----
double min=-1.0e+37, max=1.0e+37,v=0.0;
char str[144];
! int isa,fstyle;
! t_symbol *srl[3]={0,0,0};
!
! if(pd_scanargs(argc,argv,"iiffiiaaaiiiiiiif*",
! &w,&h,&min,&max,&lilo,&isa,&srl[0],&srl[1],&srl[2],
! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&v))
{
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iemgui_new_getnames2(&x->x_gui, 6, srl[0], srl[1], srl[2]);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
}
else iemgui_new_getnames(&x->x_gui, 6, 0);
***************
*** 681,692 ****
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
! if(x->x_gui.x_isa.x_loadinit)
! x->x_val = v;
! else
! x->x_val = 0.0;
if(lilo != 0) lilo = 1;
x->x_lin0_log1 = lilo;
! if(log_height < 10)
! log_height = 10;
x->x_log_height = log_height;
if (!strcmp(x->x_gui.x_snd->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
--- 679,686 ----
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
! x->x_val = x->x_gui.x_isa.x_loadinit ? v : 0.0;
if(lilo != 0) lilo = 1;
x->x_lin0_log1 = lilo;
! if(log_height < 10) log_height = 10;
x->x_log_height = log_height;
if (!strcmp(x->x_gui.x_snd->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
Index: g_toggle.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_toggle.c,v
retrieving revision 1.1.1.3.2.2.2.4
retrieving revision 1.1.1.3.2.2.2.5
diff -C2 -d -r1.1.1.3.2.2.2.4 -r1.1.1.3.2.2.2.5
*** g_toggle.c 8 Mar 2004 12:32:38 -0000 1.1.1.3.2.2.2.4
--- g_toggle.c 10 Mar 2004 06:00:11 -0000 1.1.1.3.2.2.2.5
***************
*** 29,39 ****
t_canvas *canvas=glist_getcanvas(glist);
switch(mode) {
case IEM_GUI_DRAW_MODE_UPDATE:
! if(glist_isvisible(glist)) {
! sys_vgui(".x%x.c itemconfigure %xX1 -fill #%6.6x\n", canvas, x,
! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol));
! sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x,
! (x->x_on!=0.0)?x->x_gui.x_fcol:pd_bluify(x->x_gui.x_bcol));
! }
break;
case IEM_GUI_DRAW_MODE_ERASE:
--- 29,40 ----
t_canvas *canvas=glist_getcanvas(glist);
switch(mode) {
+ default:{
+ pd_upload((t_gobj *)x);
+ sys_vgui("toggle_draw %x .x%x.c\n", x, canvas);
+ /* fallthru */
+ }
case IEM_GUI_DRAW_MODE_UPDATE:
! if(glist_isvisible(glist))
! sys_vgui("toggle_set %x .x%x.c %d\n", x, canvas, x->x_on!=0.0);
break;
case IEM_GUI_DRAW_MODE_ERASE:
***************
*** 43,55 ****
sys_vgui("toggle_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
break;
! default:{
! int xpos=text_xpix(&x->x_gui.x_obj, glist);
! int ypos=text_ypix(&x->x_gui.x_obj, glist);
! sys_vgui("toggle_draw .x%x.c %x %d %d %d %d %d %d #%6.6x {%s} %d %d {%s %d bold} #%6.6x\n",
! canvas, x, xpos, ypos, x->x_gui.x_w, x->x_gui.x_h,
! !x->x_gui.x_fsf.x_rcv_able, !x->x_gui.x_fsf.x_snd_able, x->x_gui.x_bcol,
! strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
! x->x_gui.x_ldx, x->x_gui.x_ldy, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol);
! }}}
/* ------------------------ tgl widgetbehaviour----------------------------- */
--- 44,48 ----
sys_vgui("toggle_select .x%x.c %x %d\n", canvas, x, x->x_gui.x_fsf.x_selected);
break;
! }}
/* ------------------------ tgl widgetbehaviour----------------------------- */
***************
*** 70,74 ****
int bflcol[3];
t_symbol *srl[3];
-
iemgui_save(&x->x_gui, srl, bflcol);
binbuf_addv(b, "ssiisiisssiiiiiiiff", gensym("#X"),gensym("obj"),
--- 63,66 ----
***************
*** 229,245 ****
char str[144];
int fstyle=0, isa=0;
!
! if(pd_scanargs(argc,argv,"ii???iiiiiiii;?",
! &a,&isa,&ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on))
! {
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iemgui_new_getnames(&x->x_gui, 2, argv);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
! }
! else iemgui_new_getnames(&x->x_gui, 2, 0);
if((argc == 14)&&IS_A_FLOAT(argv,13))
nonzero = (float)atom_getfloatarg(13, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)toggle_draw;
-
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
--- 221,234 ----
char str[144];
int fstyle=0, isa=0;
! t_symbol *srl[3]={0,0,0};
! pd_scanargs(argc,argv,"iiaaaiiiiiiii;?",
! &a,&isa,&srl[0],&srl[1],&srl[2],
! &ldx,&ldy,&fstyle,&fs,&bflcol[0],&bflcol[1],&bflcol[2],&on);
! iem_inttosymargs(&x->x_gui.x_isa, isa);
! iem_inttofstyle(&x->x_gui.x_fsf, fstyle);
! iemgui_new_getnames2(&x->x_gui, 2, srl[0], srl[1], srl[2]);
if((argc == 14)&&IS_A_FLOAT(argv,13))
nonzero = (float)atom_getfloatarg(13, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)toggle_draw;
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
***************
*** 260,264 ****
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
-
if(fs < 4) fs = 4;
x->x_gui.x_fontsize = fs;
--- 249,252 ----
Index: u_object.tk
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -C2 -d -r1.1.2.6 -r1.1.2.7
*** u_object.tk 8 Mar 2004 12:32:38 -0000 1.1.2.6
--- u_object.tk 10 Mar 2004 06:00:11 -0000 1.1.2.7
***************
*** 16,19 ****
--- 16,69 ----
}
+ set palette {
+ #fcfcfc #a0a0a0 #404040 #fce0e0 #fce0c0
+ #fcfcc8 #d8fcd8 #d8fcfc #dce4fc #f8d8fc
+ #e0e0e0 #7c7c7c #202020 #fc2828 #fcac44
+ #e8e828 #14e814 #28f4f4 #3c50fc #f430f0
+ #bcbcbc #606060 #000000 #8c0808 #583000
+ #782814 #285014 #004450 #001488 #580050
+ }
+
+ proc parse_color {c} {
+ #puts "parse_color: $c"
+ regsub {;$} $c {} c
+ if {$c<0} {
+ set r [expr 4*(((-$c)>> 0)&63)]
+ set g [expr 4*(((-$c)>> 6)&63)]
+ set b [expr 4*(((-$c)>>12)&63)]
+ return [format #%02x%02x%02x $r $g $b]
+ } {
+ return "huh"
+ }
+ }
+
+ ############ data transfer
+
+ # abstract classes
+ set fields1 {foo bar x1 y1 class}
+ set fields2 {snd rcv lab ldx ldy fstyle fs col0 col1 col2}
+
+ # real classes
+ set fields(tgl) [eval list $fields1 w isa $fields2 on nonzero]
+ set fields(bng) [eval list $fields1 w hold break isa $fields2]
+ set fields(nbx) [eval list $fields1 w h min max is_log isa $fields2 val log_height]
+ set fields(hsl) [eval list $fields1 w h min max is_log isa $fields2 val steady]
+ set fields(hradio) [eval list $fields1 w change isa n $fields2 on]
+ set fields(vsl) $fields(hsl)
+ set fields(vradio) $fields(hradio)
+
+ proc update_object {x d} {
+ global data
+ global fields
+ set class [lindex $d 4]
+ #puts "CLASS=$class"
+ #if {[llength $fields] != [llength $d]} {huh}
+ set i 0
+ foreach f $fields($class) {
+ set data($x:$f) [lindex $d $i]
+ incr i
+ }
+ }
+
############ rendering
***************
*** 178,185 ****
}
! proc numbox_draw {canvas tag x1 y1 xs ys ins outs} {
global look
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
if {[llength [$canvas gettags $tag]] != 0} {
--- 228,242 ----
}
! proc numbox_draw {tag canvas} {
global look
+ global data
+ set x1 $data($tag:x1)
+ set y1 $data($tag:y1)
+ set xs [expr 10*$data($tag:w)]
+ set ys $data($tag:h)
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
+ set ins [expr [string compare $data($tag:snd) empty]==0]
+ set outs [expr [string compare $data($tag:snd) empty]==0]
set points [list $x1 $y1 [expr $x2-4] $y1 $x2 [expr $y1+4] $x2 $y2 $x1 $y2]
if {[llength [$canvas gettags $tag]] != 0} {
***************
*** 244,253 ****
}
! proc radio_draw {canvas tag x1 y1 xs ys ins outs orient number colour} {
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
if {$orient} {set size $ys} {set size $xs}
! set size [expr $size/$number]
! for {set i 0} {$i<$number} {incr i} {
if {$isnew} {
$canvas create rectangle \
--- 301,322 ----
}
! proc radio_draw {tag canvas} {
! global data
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
+ switch $data($tag:class) {hradio {set orient 0} vradio {set orient 1}}
+ set x1 $data($tag:x1)
+ set y1 $data($tag:y1)
+ set n $data($tag:n)
+ set xs [expr $data($tag:w)*($orient?1:$n)]
+ set ys [expr $data($tag:w)*($orient?$n:1)]
+ set x2 [expr $x1+$xs]
+ set y2 [expr $y1+$ys]
+ set ins [expr [string compare $data($tag:snd) empty]==0]
+ set outs [expr [string compare $data($tag:snd) empty]==0]
+ set colour [parse_color $data($tag:col0)]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
if {$orient} {set size $ys} {set size $xs}
! set size [expr $size/$n]
! for {set i 0} {$i<$n} {incr i} {
if {$isnew} {
$canvas create rectangle \
***************
*** 262,265 ****
--- 331,335 ----
if {$orient} {set y1 [expr $y1+$size]} {set x1 [expr $x1+$size]}
}
+ label_draw $tag $canvas
}
***************
*** 269,279 ****
}
! proc radio_erase {canvas tag} {
bluebox_erase $canvas ${tag}BASE
$canvas delete ${tag}BUT
}
! proc slider_draw {canvas tag x1 y1 xs ys ins outs orient colour} {
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
if {$isnew} {
--- 339,358 ----
}
! proc radio_erase {tag canvas} {
bluebox_erase $canvas ${tag}BASE
$canvas delete ${tag}BUT
}
! proc slider_draw {tag canvas} {
! set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
! global data
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
+ set x1 $data($tag:x1)
+ set y1 $data($tag:y1)
+ set xs $data($tag:w)
+ set ys $data($tag:h)
+ set ins [expr [string compare $data($tag:snd) empty]==0]
+ set outs [expr [string compare $data($tag:snd) empty]==0]
+ set colour [parse_color $data($tag:col0)]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
if {$isnew} {
***************
*** 282,285 ****
--- 361,365 ----
-outline #000000 -fill [darker $color]
}
+ label_draw $tag $canvas
}
***************
*** 315,322 ****
}
! proc bang_draw {canvas tag x1 y1 xs ys ins outs colour label ldx ldy lfont lcolor} {
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
io_draw $canvas $tag $x1 $y1 $xs $ys $ins $outs
--- 395,432 ----
}
! proc label_draw {tag canvas} {
! global data
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
+ set x1 $data($tag:x1)
+ set y1 $data($tag:y1)
+ set lx [expr $x1+$data($tag:ldx)]
+ set ly [expr $y1+$data($tag:ldy)]
+ set label $data($tag:lab); switch $label { empty { set label "" }}
+ set lfont [list \
+ [lindex {courier helvetica times} $data($tag:fstyle)] \
+ $data($tag:fs) bold]
+ set lcolor [parse_color $data($tag:col2)]
+ if {$isnew} {
+ $canvas create text $lx $ly -text $label -anchor w \
+ -font $lfont -fill $lcolor -tags ${tag}LABEL
+ } {
+ $canvas coords ${tag}LABEL $lx $ly
+ $canvas itemconfigure ${tag}LABEL -text $label -anchor w \
+ -font $lfont -fill $lcolor
+ }
+ }
+
+ proc bang_draw {tag canvas} {
+ global data
+ set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
+ set x1 $data($tag:x1)
+ set y1 $data($tag:y1)
+ set xs $data($tag:w)
+ set ys $data($tag:w)
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
+ set ins [expr [string compare $data($tag:snd) empty]==0]
+ set outs [expr [string compare $data($tag:snd) empty]==0]
+ set colour [parse_color $data($tag:col0)]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
io_draw $canvas $tag $x1 $y1 $xs $ys $ins $outs
***************
*** 324,337 ****
$canvas create oval \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \
! -fill [bluify $colour] -tags ${tag}BUT
! $canvas create text [expr $x1+$ldx] [expr $y1+$ldy] -text $label -anchor w \
! -font $lfont -fill $lcolor -tags ${tag}LABEL
} {
$canvas coords ${tag}BUT \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]
- $canvas coords ${tag}LABEL [expr $x1+$ldx] [expr $y1+$ldy]
- $canvas itemconfigure ${tag}LABEL -text $label -anchor w \
- -font $lfont -fill $lcolor
}
}
--- 434,443 ----
$canvas create oval \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2] \
! -fill [bluify #ffffff] -tags ${tag}BUT
} {
$canvas coords ${tag}BUT \
[expr $x1+2] [expr $y1+2] [expr $x2-2] [expr $y2-2]
}
+ label_draw $tag $canvas
}
***************
*** 346,360 ****
}
! proc toggle_draw {canvas tag x1 y1 xs ys ins outs colour label ldx ldy lfont lcolor} {
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
io_draw $canvas $tag $x1 $y1 $xs $ys $ins $outs
set w 1
- set on 0
if {$xs >= 30} {set w 2}
if {$xs >= 60} {set w 3}
! if {$on} {set fill #ffff00} {set fill [bluify $colour]}
set x3 [expr $x1+$w+2]
set y3 [expr $y1+$w+2]
--- 452,473 ----
}
! proc toggle_draw {tag canvas} {
! global data
! set x1 $data($tag:x1)
! set y1 $data($tag:y1)
! set xs $data($tag:w)
! set ys $data($tag:w)
set x2 [expr $x1+$xs]
set y2 [expr $y1+$ys]
+ set ins [expr [string compare $data($tag:snd) empty]==0]
+ set outs [expr [string compare $data($tag:snd) empty]==0]
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
+ set colour [parse_color $data($tag:col0)]
bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
io_draw $canvas $tag $x1 $y1 $xs $ys $ins $outs
set w 1
if {$xs >= 30} {set w 2}
if {$xs >= 60} {set w 3}
! set fill [bluify $colour]
set x3 [expr $x1+$w+2]
set y3 [expr $y1+$w+2]
***************
*** 365,371 ****
$canvas create line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill -tags ${tag}X2
} {
! $canvas coords ${tag}X1 $x3 $y3 $x4 $y4
! $canvas coords ${tag}X2 $x3 $y4 $x4 $y3
}
}
--- 478,492 ----
$canvas create line $x3 $y4 [expr $x4+1] [expr $y3-1] -width $w -fill $fill -tags ${tag}X2
} {
! $canvas coords ${tag}X1 $x3 $y3 [expr $x4+1] [expr $y4+1]
! $canvas coords ${tag}X2 $x3 $y4 [expr $x4+1] [expr $y3-1]
}
+ label_draw $tag $canvas
+ toggle_set $tag $canvas $data($tag:on)
+ }
+
+ proc toggle_set {tag canvas v} {
+ if {$v} {set fill #000000} {set fill [bluify #ffffff]}
+ $canvas itemconfigure ${tag}X1 -fill $fill
+ $canvas itemconfigure ${tag}X2 -fill $fill
}
***************
*** 380,385 ****
}
! proc vu_draw {canvas tag x1 y1 xs ys ins outs colour label ldx ldy lfont lcolor} {
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
! bluebox_draw $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
}
--- 501,516 ----
}
! proc vu_draw {tag canvas} {
set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
! set x1 $data($tag:x1)
! set y1 $data($tag:y1)
! set xs $data($tag:w)
! set ys $data($tag:w)
! set x2 [expr $x1+$xs]
! set y2 [expr $y1+$ys]
! set ins [expr [string compare $data($tag:snd) empty]==0]
! set outs [expr [string compare $data($tag:snd) empty]==0]
! set isnew [expr [llength [$canvas gettags ${tag}BASE]] == 0]
! set colour [parse_color $data($tag:col0)]
! bluebox_draw $tag $canvas ${tag}BASE $x1 $y1 $xs $ys $ins $outs $colour
}