aboutsummaryrefslogtreecommitdiff
path: root/pd/src/g_mycanvas.c
diff options
context:
space:
mode:
Diffstat (limited to 'pd/src/g_mycanvas.c')
-rw-r--r--pd/src/g_mycanvas.c194
1 files changed, 97 insertions, 97 deletions
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index ff55e86b..93f96ff5 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -35,19 +35,19 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist)
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
- sys_vgui(".x%x.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %xRECT\n",
- canvas, xpos, ypos,
- xpos + x->x_vis_w, ypos + x->x_vis_h,
- x->x_gui.x_bcol, x->x_gui.x_bcol, x);
- sys_vgui(".x%x.c create rectangle %d %d %d %d -outline #%6.6x -tags %xBASE\n",
- canvas, xpos, ypos,
- xpos + x->x_gui.x_w, ypos + x->x_gui.x_h,
- x->x_gui.x_bcol, x);
- 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);
+ sys_vgui(".x%lx.c create rectangle %d %d %d %d -fill #%6.6x -outline #%6.6x -tags %lxRECT\n",
+ canvas, xpos, ypos,
+ xpos + x->x_vis_w, ypos + x->x_vis_h,
+ x->x_gui.x_bcol, x->x_gui.x_bcol, x);
+ sys_vgui(".x%lx.c create rectangle %d %d %d %d -outline #%6.6x -tags %lxBASE\n",
+ canvas, xpos, ypos,
+ xpos + x->x_gui.x_w, ypos + x->x_gui.x_h,
+ x->x_gui.x_bcol, x);
+ sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
+ -font {%s %d bold} -fill #%6.6x -tags %lxLABEL\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);
}
void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
@@ -56,37 +56,37 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist)
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
- sys_vgui(".x%x.c coords %xRECT %d %d %d %d\n",
- canvas, x, xpos, ypos, xpos + x->x_vis_w,
- ypos + x->x_vis_h);
- sys_vgui(".x%x.c coords %xBASE %d %d %d %d\n",
- canvas, x, xpos, ypos,
- xpos + x->x_gui.x_w, ypos + x->x_gui.x_h);
- sys_vgui(".x%x.c coords %xLABEL %d %d\n",
- canvas, x, xpos+x->x_gui.x_ldx,
- ypos+x->x_gui.x_ldy);
+ sys_vgui(".x%lx.c coords %lxRECT %d %d %d %d\n",
+ canvas, x, xpos, ypos, xpos + x->x_vis_w,
+ ypos + x->x_vis_h);
+ sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
+ canvas, x, xpos, ypos,
+ xpos + x->x_gui.x_w, ypos + x->x_gui.x_h);
+ sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
+ canvas, x, xpos+x->x_gui.x_ldx,
+ ypos+x->x_gui.x_ldy);
}
void my_canvas_draw_erase(t_my_canvas* x, t_glist* glist)
{
t_canvas *canvas=glist_getcanvas(glist);
- sys_vgui(".x%x.c delete %xBASE\n", canvas, x);
- sys_vgui(".x%x.c delete %xRECT\n", canvas, x);
- sys_vgui(".x%x.c delete %xLABEL\n", canvas, x);
+ 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);
}
void my_canvas_draw_config(t_my_canvas* x, t_glist* glist)
{
t_canvas *canvas=glist_getcanvas(glist);
- sys_vgui(".x%x.c itemconfigure %xRECT -fill #%6.6x -outline #%6.6x\n", canvas, x,
- x->x_gui.x_bcol, x->x_gui.x_bcol);
- sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x,
- x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol);
- 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, x->x_gui.x_lcol,
- strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
+ sys_vgui(".x%lx.c itemconfigure %lxRECT -fill #%6.6x -outline #%6.6x\n", canvas, x,
+ x->x_gui.x_bcol, x->x_gui.x_bcol);
+ sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x,
+ x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_bcol);
+ sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n",
+ canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol,
+ strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"");
}
void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
@@ -95,26 +95,26 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist)
if(x->x_gui.x_fsf.x_selected)
{
- sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
+ sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_SELECTED);
}
else
{
- sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol);
+ sys_vgui(".x%lx.c itemconfigure %lxBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol);
}
}
void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode)
{
if(mode == IEM_GUI_DRAW_MODE_MOVE)
- my_canvas_draw_move(x, glist);
+ my_canvas_draw_move(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_NEW)
- my_canvas_draw_new(x, glist);
+ my_canvas_draw_new(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_SELECT)
- my_canvas_draw_select(x, glist);
+ my_canvas_draw_select(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_ERASE)
- my_canvas_draw_erase(x, glist);
+ my_canvas_draw_erase(x, glist);
else if(mode == IEM_GUI_DRAW_MODE_CONFIG)
- my_canvas_draw_config(x, glist);
+ my_canvas_draw_config(x, glist);
}
/* ------------------------ cnv widgetbehaviour----------------------------- */
@@ -137,11 +137,11 @@ static void my_canvas_save(t_gobj *z, t_binbuf *b)
iemgui_save(&x->x_gui, srl, bflcol);
binbuf_addv(b, "ssiisiiisssiiiiiii", gensym("#X"),gensym("obj"),
- (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
- gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h,
- srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
- iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
- bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa));
+ (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
+ gensym("cnv"), x->x_gui.x_w, x->x_vis_w, x->x_vis_h,
+ srl[0], srl[1], srl[2], x->x_gui.x_ldx, x->x_gui.x_ldy,
+ iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
+ bflcol[0], bflcol[2], iem_symargstoint(&x->x_gui.x_isa));
binbuf_addv(b, ";");
}
@@ -153,20 +153,20 @@ static void my_canvas_properties(t_gobj *z, t_glist *owner)
iemgui_properties(&x->x_gui, srl);
sprintf(buf, "pdtk_iemgui_dialog %%s MY_CANVAS \
- ------selectable_dimensions(pix):------ %d %d size: 0.0 0.0 empty \
- ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \
- %d empty empty %d %d empty %d \
- %s %s \
- %s %d %d \
- %d %d \
- %d %d %d\n",
- x->x_gui.x_w, 1,
- x->x_vis_w, x->x_vis_h, 0,/*no_schedule*/
- -1, -1, -1, -1,/*no linlog, no init, no multi*/
- srl[0]->s_name, srl[1]->s_name,
- srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
- x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
- 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol);
+ ------selectable_dimensions(pix):------ %d %d size: 0.0 0.0 empty \
+ ------visible_rectangle(pix)(pix):------ %d width: %d height: %d \
+ %d empty empty %d %d empty %d \
+ %s %s \
+ %s %d %d \
+ %d %d \
+ %d %d %d\n",
+ x->x_gui.x_w, 1,
+ x->x_vis_w, x->x_vis_h, 0,/*no_schedule*/
+ -1, -1, -1, -1,/*no linlog, no init, no multi*/
+ srl[0]->s_name, srl[1]->s_name,
+ srl[2]->s_name, x->x_gui.x_ldx, x->x_gui.x_ldy,
+ x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize,
+ 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol);
gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf);
}
@@ -174,9 +174,9 @@ static void my_canvas_get_pos(t_my_canvas *x)
{
if(x->x_gui.x_fsf.x_snd_able && x->x_gui.x_snd->s_thing)
{
- x->x_at[0].a_w.w_float = text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
- x->x_at[1].a_w.w_float = text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
- pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
+ x->x_at[0].a_w.w_float = text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist);
+ x->x_at[1].a_w.w_float = text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist);
+ pd_list(x->x_gui.x_snd->s_thing, &s_list, 2, x->x_at);
}
}
@@ -190,14 +190,14 @@ static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv
x->x_gui.x_isa.x_loadinit = 0;
if(a < 1)
- a = 1;
+ a = 1;
x->x_gui.x_w = a;
x->x_gui.x_h = x->x_gui.x_w;
if(w < 1)
- w = 1;
+ w = 1;
x->x_vis_w = w;
if(h < 1)
- h = 1;
+ h = 1;
x->x_vis_h = h;
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
@@ -208,7 +208,7 @@ static void my_canvas_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
int i = (int)atom_getintarg(0, ac, av);
if(i < 1)
- i = 1;
+ i = 1;
x->x_gui.x_w = i;
x->x_gui.x_h = i;
iemgui_size((void *)x, &x->x_gui);
@@ -226,17 +226,17 @@ static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
i = (int)atom_getintarg(0, ac, av);
if(i < 1)
- i = 1;
+ i = 1;
x->x_vis_w = i;
if(ac > 1)
{
i = (int)atom_getintarg(1, ac, av);
if(i < 1)
- i = 1;
+ i = 1;
}
x->x_vis_h = i;
if(glist_isvisible(x->x_gui.x_glist))
- (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
+ (*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
}
static void my_canvas_color(t_my_canvas *x, t_symbol *s, int ac, t_atom *av)
@@ -272,19 +272,19 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
if(((argc >= 10)&&(argc <= 13))
&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2))
{
- a = (int)atom_getintarg(0, argc, argv);
- w = (int)atom_getintarg(1, argc, argv);
- h = (int)atom_getintarg(2, argc, argv);
+ a = (int)atom_getintarg(0, argc, argv);
+ w = (int)atom_getintarg(1, argc, argv);
+ h = (int)atom_getintarg(2, argc, argv);
}
if((argc >= 12)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))&&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)))
{
- i = 2;
- iemgui_new_getnames(&x->x_gui, 3, argv);
+ i = 2;
+ iemgui_new_getnames(&x->x_gui, 3, argv);
}
else if((argc == 11)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3)))
{
- i = 1;
- iemgui_new_getnames(&x->x_gui, 3, argv);
+ i = 1;
+ iemgui_new_getnames(&x->x_gui, 3, argv);
}
else iemgui_new_getnames(&x->x_gui, 3, 0);
@@ -294,50 +294,50 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
&&IS_A_FLOAT(argv,i+7)&&IS_A_FLOAT(argv,i+8)
&&IS_A_FLOAT(argv,i+9))
{
- /* disastrously, the "label" sits in a different part of the
- message. So we have to track its location separately (in
- the slot x_labelbindex) and initialize it specially here. */
- iemgui_new_dogetname(&x->x_gui, i+3, argv);
- x->x_gui.x_labelbindex = i+4;
- ldx = (int)atom_getintarg(i+4, argc, argv);
- ldy = (int)atom_getintarg(i+5, argc, argv);
- iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(i+6, argc, argv));
- fs = (int)atom_getintarg(i+7, argc, argv);
- bflcol[0] = (int)atom_getintarg(i+8, argc, argv);
- bflcol[2] = (int)atom_getintarg(i+9, argc, argv);
+ /* disastrously, the "label" sits in a different part of the
+ message. So we have to track its location separately (in
+ the slot x_labelbindex) and initialize it specially here. */
+ iemgui_new_dogetname(&x->x_gui, i+3, argv);
+ x->x_gui.x_labelbindex = i+4;
+ ldx = (int)atom_getintarg(i+4, argc, argv);
+ ldy = (int)atom_getintarg(i+5, argc, argv);
+ iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(i+6, argc, argv));
+ fs = (int)atom_getintarg(i+7, argc, argv);
+ bflcol[0] = (int)atom_getintarg(i+8, argc, argv);
+ bflcol[2] = (int)atom_getintarg(i+9, argc, argv);
}
if((argc == 13)&&IS_A_FLOAT(argv,i+10))
{
- iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(i+10, argc, argv));
+ iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(i+10, argc, argv));
}
x->x_gui.x_draw = (t_iemfunptr)my_canvas_draw;
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
- x->x_gui.x_fsf.x_snd_able = 0;
+ x->x_gui.x_fsf.x_snd_able = 0;
if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
- x->x_gui.x_fsf.x_rcv_able = 0;
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(a < 1)
- a = 1;
+ a = 1;
x->x_gui.x_w = a;
x->x_gui.x_h = x->x_gui.x_w;
if(w < 1)
- w = 1;
+ w = 1;
x->x_vis_w = w;
if(h < 1)
- h = 1;
+ h = 1;
x->x_vis_h = h;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
- strcpy(x->x_gui.x_font, "courier"); }
+ 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);
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
- fs = 4;
+ fs = 4;
x->x_gui.x_fontsize = fs;
iemgui_all_colfromload(&x->x_gui, bflcol);
x->x_at[0].a_type = A_FLOAT;
@@ -349,14 +349,14 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
static void my_canvas_ff(t_my_canvas *x)
{
if(x->x_gui.x_fsf.x_rcv_able)
- pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
+ pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
gfxstub_deleteforkey(x);
}
void g_mycanvas_setup(void)
{
my_canvas_class = class_new(gensym("cnv"), (t_newmethod)my_canvas_new,
- (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0);
+ (t_method)my_canvas_ff, sizeof(t_my_canvas), CLASS_NOINLET, A_GIMME, 0);
class_addcreator((t_newmethod)my_canvas_new, gensym("my_canvas"), A_GIMME, 0);
class_addmethod(my_canvas_class, (t_method)my_canvas_dialog, gensym("dialog"), A_GIMME, 0);
class_addmethod(my_canvas_class, (t_method)my_canvas_size, gensym("size"), A_GIMME, 0);