Commit 8cf05889 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

refactored scalehandle and fixed tcl error about '-fill'

parent c3b1ffa0
......@@ -892,3 +892,78 @@ char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj)
else return("bogus");
}
//----------------------------------------------------------------
// SCALEHANDLE COMMON CODE
// in all 20 cases :
// [bng], [tgl], [hradio], [vradio], [hsl], [vsl], [cnv], [nbx], [vu]
// for both scale & label, plus canvas' scale & move.
void scalehandle_bind(t_scalehandle *h) {
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
h->h_pathname, h->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
h->h_pathname, h->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
h->h_pathname, h->h_bindsym->s_name);
}
// in 18 cases only, because canvas does not fit the pattern below.
// this works only on iemgui, and also, canvas has no label handle and has a motion handle
void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py,
const char *nlet_tag, const char *class_tag) {
char tags[128]; // BNG may need up to 100 chars in 64-bit mode, for example
t_iemgui *x = (t_iemgui *)h->h_master;
//if (!nlet_tag) nlet_tag = iem_get_tag(canvas, (t_iemgui *)x);
const char *cursor = h->h_scale ? "bottom_right_corner" : "crosshair";
int sx = h->h_scale ? SCALEHANDLE_WIDTH : LABELHANDLE_WIDTH;
int sy = h->h_scale ? SCALEHANDLE_HEIGHT : LABELHANDLE_HEIGHT;
//int px = h->h_scale ? (x->x_gui.x_w-1) : x->x_gui.x_ldx;
//int py = h->h_scale ? (x->x_gui.x_h-1) : x->x_gui.x_ldy;
//printf("scalehandle_draw_select(x%lx,x%lx,%d,%d,\"%s\",\"%s\")\n",h,canvas,px,py,nlet_tag,class_tag);
if (h->h_scale ? x->scale_vis : x->label_vis)
scalehandle_draw_erase(h,canvas);
// sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 "
sys_vgui("canvas %s -width %d -height %d -bg #0080ff -bd 0 "
"-cursor %s\n", h->h_pathname, sx, sy, cursor);
// there was a %lxBNG tag (or similar) in every scalehandle,
// but it didn't seem to be used —mathieu
if (h->h_scale) {
sprintf(tags,"%lx%s %lxSCALE iemgui %s",
(long)x,class_tag,(long)x,nlet_tag);
} else {
//sprintf(tags,"%lx%s %lxLABEL %lxLABELH iemgui %s", // causes unknown option "-fill"
sprintf(tags,"%lx%s %lxLABELH iemgui %s",
(long)x,class_tag,(long)x,nlet_tag);
}
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d "
"-window %s -tags {%s}\n", canvas, x->x_obj.te_xpix+px-sx, x->x_obj.te_ypix+py-sy,
sx, sy, h->h_pathname, tags);
scalehandle_bind(h);
if (h->h_scale) x->scale_vis = 1;
else x->label_vis = 1;
}
void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas) {
sys_vgui("destroy %s\n", h->h_pathname);
sys_vgui(".x%lx.c delete %lx%s\n", canvas, h->h_master, h->h_scale ? "SCALE" : "LABELH");
}
void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas) {
/*if (x->x_fsf.x_selected)
{
scalehandle_draw_erase((t_scalehandle *)(x->x_handle),canvas);
scalehandle_draw_erase((t_scalehandle *)(x->x_lhandle),canvas);
}*/
if (x->scale_vis) {
scalehandle_draw_erase((t_scalehandle *)(x->x_handle),canvas);
x->scale_vis = 0;
}
if (x->label_vis) {
scalehandle_draw_erase((t_scalehandle *)(x->x_lhandle),canvas);
x->label_vis = 0;
}
}
......@@ -404,3 +404,9 @@ EXTERN int iem_fstyletoint(t_iem_fstyle_flags *fstylep);
EXTERN char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj);
EXTERN void canvas_apply_setundo(t_canvas *x, t_gobj *y);
// scalehandle code, as refactored by Mathieu
EXTERN void scalehandle_bind(t_scalehandle *h);
EXTERN void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py, const char *nlet_tag, const char *class_tag);
EXTERN void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas);
EXTERN void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas);
......@@ -45,6 +45,7 @@ void bng_draw_update(t_gobj *xgobj, t_glist *glist)
sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n",
glist_getcanvas(glist), x,
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
//vcanvas_itemconf(glist,x,"BUT","-fill",x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
}
x->x_gui.x_changed = x->x_flashed;
}
......@@ -156,15 +157,7 @@ void bng_draw_erase(t_bng* x, t_glist* glist)
t_canvas *canvas=glist_getcanvas(glist);
sys_vgui(".x%lx.c delete %lxBNG\n", canvas, x);
sys_vgui(".x%lx.c dtag all %lxBNG\n", canvas, x);
if (x->x_gui.x_fsf.x_selected)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
scalehandle_draw_erase2(&x->x_gui,glist);
/*
sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x);
sys_vgui(".x%lx.c delete %lxBUT\n", canvas, x);
......@@ -264,62 +257,10 @@ void bng_draw_select(t_bng* x, t_glist* glist)
sys_vgui(".x%lx.c itemconfigure %lxLABEL "
"-fill $pd_colors(selection)\n", canvas, x);
if (x->x_gui.scale_vis)
{
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxBNG iemgui %s}\n",
canvas,
x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
x->x_gui.scale_vis = 1;
scalehandle_draw_select(sh,canvas,x->x_gui.x_w-1,x->x_gui.x_h-1,nlet_tag,"BNG");
if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
{
if (x->x_gui.label_vis)
{
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxLABEL %lxLABELH %lxBNG iemgui %s}\n",
canvas,
x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> "
"{pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> "
"{pd [concat %s _motion %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
x->x_gui.label_vis = 1;
scalehandle_draw_select(lh,canvas,x->x_gui.x_ldx,x->x_gui.x_ldy,nlet_tag,"BNG");
}
}
sys_vgui(".x%lx.c addtag selected withtag %lxBNG\n", canvas, x);
......@@ -333,12 +274,7 @@ void bng_draw_select(t_bng* x, t_glist* glist)
sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n",
canvas, x, x->x_gui.x_lcol);
sys_vgui(".x%lx.c dtag %lxBNG selected\n", canvas, x);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
x->x_gui.scale_vis = 0;
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
x->x_gui.label_vis = 0;
scalehandle_draw_erase2(&x->x_gui,glist);
}
//}
}
......
......@@ -737,6 +737,7 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
sprintf(sh->h_pathname, ".x%lx.h%lx", (t_int)x, (t_int)sh);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete GOP_resblob\n", x);
sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) "
"-bd 0 -cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
......@@ -747,13 +748,7 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
x->gl_ymargin + 3 + x->gl_pixheight - SCALEHANDLE_HEIGHT - 4,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
scalehandle_bind(sh);
//Drawing and Binding Move_Blob for GOP
sprintf(mh->h_pathname, ".x%lx.h%lx", (t_int)x, (t_int)mh);
......@@ -768,14 +763,7 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
x->gl_ymargin + 2 ,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
mh->h_pathname, x, x);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
mh->h_pathname, mh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
mh->h_pathname, mh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
mh->h_pathname, mh->h_bindsym->s_name);
scalehandle_bind(mh);
}
else
{
......
......@@ -160,15 +160,7 @@ void hradio_draw_erase(t_hradio* x, t_glist* glist)
sys_vgui(".x%lx.c delete %lxHRDO\n", canvas, x);
sys_vgui(".x%lx.c dtag all %lxHRDO\n", canvas, x);
if (x->x_gui.x_fsf.x_selected)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
scalehandle_draw_erase2(&x->x_gui,glist);
/*
for(i=0; i<n; i++)
{
......@@ -288,66 +280,10 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
"-fill $pd_colors(selection)\n",
canvas, x);
if (x->x_gui.scale_vis)
{
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxHRDO %s iemgui}\n",
canvas, x->x_gui.x_obj.te_xpix +
x->x_gui.x_w * x->x_number - SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix +
x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> "
"{pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> "
"{pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
x->x_gui.scale_vis = 1;
scalehandle_draw_select(sh,canvas,x->x_gui.x_w*x->x_number-1,x->x_gui.x_h-1,nlet_tag,"HRDO");
if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
{
if (x->x_gui.label_vis)
{
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxLABEL %lxLABELH %lxHRDO %s iemgui}\n",
canvas, x->x_gui.x_obj.te_xpix +
x->x_gui.x_ldx - LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix +
x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> "
"{pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> "
"{pd [concat %s _motion %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
x->x_gui.label_vis = 1;
scalehandle_draw_select(lh,canvas,x->x_gui.x_ldx,x->x_gui.x_ldy,nlet_tag,"HRDO");
}
}
......@@ -363,12 +299,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
}
sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n",
canvas, x, x->x_gui.x_lcol);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
x->x_gui.scale_vis = 0;
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
x->x_gui.label_vis = 0;
scalehandle_draw_erase2(&x->x_gui,glist);
}
//}
}
......@@ -376,7 +307,6 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
static void hradio__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx,
t_floatarg yyy)
{
t_hradio *x = (t_hradio *)(sh->h_master);
if (xxx)
......
......@@ -165,15 +165,7 @@ static void hslider_draw_erase(t_hslider* x,t_glist* glist)
sys_vgui(".x%lx.c delete %lxHSLDR\n", canvas, x);
sys_vgui(".x%lx.c dtag all %lxHSLDR\n", canvas, x);
if (x->x_gui.x_fsf.x_selected)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
scalehandle_draw_erase2(&x->x_gui,glist);
/*
sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x);
sys_vgui(".x%lx.c delete %lxKNOB\n", canvas, x);
......@@ -267,67 +259,10 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
"-fill $pd_colors(selection)\n",
canvas, x);
if (x->x_gui.scale_vis)
{
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxHSLDR %s}\n",
canvas, x->x_gui.x_obj.te_xpix +
x->x_gui.x_w + 5 - SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix +
x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> "
"{pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> "
"{pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
x->x_gui.scale_vis = 1;
scalehandle_draw_select(sh,canvas,x->x_gui.x_w+5-1,x->x_gui.x_h-1,nlet_tag,"HSLDR");
if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
{
if (x->x_gui.label_vis)
{
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) "
"-bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxLABEL %lxLABELH %lxHSLDR %s}\n",
canvas, x->x_gui.x_obj.te_xpix +
x->x_gui.x_ldx - LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix +
x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> "
"{pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> "
"{pd [concat %s _click 0 0 0 \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> "
"{pd [concat %s _motion %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
x->x_gui.label_vis = 1;
scalehandle_draw_select(lh,canvas,x->x_gui.x_ldx,x->x_gui.x_ldy,nlet_tag,"HSLDR");
}
}
......@@ -340,12 +275,8 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist)
sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill #%6.6x\n",
canvas, x, x->x_gui.x_lcol);
sys_vgui(".x%lx.c dtag %lxHSLDR selected\n", canvas, x);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
x->x_gui.scale_vis = 0;
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
x->x_gui.label_vis = 0;
scalehandle_draw_erase2(&x->x_gui,glist);
}
//}
}
......
......@@ -102,15 +102,7 @@ void my_canvas_draw_erase(t_my_canvas* x, t_glist* glist)
sys_vgui(".x%lx.c delete %lxMYCNV\n", canvas, x);
sys_vgui(".x%lx.c dtag all %lxMYCNV\n", canvas, x);
if (x->x_gui.x_fsf.x_selected)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
scalehandle_draw_erase2(&x->x_gui,glist);
//sys_vgui(".x%lx.c delete %lxBASE\n", canvas, x);
//sys_vgui(".x%lx.c delete %lxRECT\n", canvas, x);
//sys_vgui(".x%lx.c delete %lxLABEL\n", canvas, x);
......@@ -165,63 +157,10 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
sys_vgui(".x%lx.c itemconfigure %lxBASE "
"-stroke $pd_colors(selection)\n", canvas, x);
if (x->x_gui.scale_vis)
{
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxMYCNV %s}\n",
canvas,
x->x_gui.x_obj.te_xpix + x->x_vis_w -
SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix + x->x_vis_h -
SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
x->x_gui.scale_vis = 1;
scalehandle_draw_select(sh,canvas,x->x_vis_w-1,x->x_vis_h-1,nlet_tag,"MYCNV");
if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
{
if (x->x_gui.label_vis)
{
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) "
"-bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxLABEL %lxLABELH %lxMYCNV %s}\n",
canvas,
x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx -
LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy -
LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
x->x_gui.label_vis = 1;
scalehandle_draw_select(lh,canvas,x->x_gui.x_ldx,x->x_gui.x_ldy,nlet_tag,"MYCNV");
}
}
......@@ -232,12 +171,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke #%6.6x\n",
canvas, x, x->x_gui.x_bcol);
sys_vgui(".x%lx.c dtag %lxMYCNV selected\n", canvas, x);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
x->x_gui.scale_vis = 0;
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
x->x_gui.label_vis = 0;
scalehandle_draw_erase2(&x->x_gui,glist);
}
//}
}
......
......@@ -324,15 +324,7 @@ static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist)
sys_vgui(".x%lx.c delete %lxNUM\n", canvas, x);
sys_vgui(".x%lx.c dtag all %lxNUM\n", canvas, x);
if (x->x_gui.x_fsf.x_selected)
{
t_scalehandle *sh = (t_scalehandle *)(x->x_gui.x_handle);
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
t_scalehandle *lh = (t_scalehandle *)(x->x_gui.x_lhandle);
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
scalehandle_draw_erase2(&x->x_gui,glist);
}
static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist)
......@@ -486,60 +478,10 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
"-fill $pd_colors(selection)\n",
canvas, x);
if (x->x_gui.scale_vis)
{
sys_vgui("destroy %s\n", sh->h_pathname);
sys_vgui(".x%lx.c delete %lxSCALE\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) -bd 0 "
"-cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxSCALE %lxNUM %s}\n",
canvas, x->x_gui.x_obj.te_xpix + x->x_numwidth -
SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix + x->x_gui.x_h -
SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <Motion> {pd [concat %s _motion %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
x->x_gui.scale_vis = 1;
scalehandle_draw_select(sh,canvas,x->x_numwidth-1,x->x_gui.x_h-1,nlet_tag,"NUM");
if (strcmp(x->x_gui.x_lab->s_name, "empty") != 0)
{
if (x->x_gui.label_vis)
{
sys_vgui("destroy %s\n", lh->h_pathname);
sys_vgui(".x%lx.c delete %lxLABELH\n", canvas, x);
}
sys_vgui("canvas %s -width %d -height %d "
"-bg $pd_colors(selection) "
"-bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw "
"-width %d -height %d -window %s "
"-tags {%lxLABEL %lxLABELH %lxNUM %s}\n",