Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29765
Modified Files: Tag: impd_0_37 g_mycanvas.c u_object.tk Log Message: [cnv] goes Tcl
Index: g_mycanvas.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_mycanvas.c,v retrieving revision 1.1.1.3.2.2.2.6 retrieving revision 1.1.1.3.2.2.2.7 diff -C2 -d -r1.1.1.3.2.2.2.6 -r1.1.1.3.2.2.2.7 *** g_mycanvas.c 27 Apr 2004 18:09:34 -0000 1.1.1.3.2.2.2.6 --- g_mycanvas.c 1 May 2004 15:24:01 -0000 1.1.1.3.2.2.2.7 *************** *** 22,114 **** #endif
- /* ---------- cnv my gui-canvas for a window ---------------- */ - static t_class *my_canvas_class;
- /* widget helper functions */ - - void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) - { - int xpos=text_xpix(&x->x_gui.x_obj, 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); - } - - void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) - { - int xpos=text_xpix(&x->x_gui.x_obj, 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); - } - - 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); - } - - 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_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:""); - } - - void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) - { - t_canvas *canvas=glist_getcanvas(glist); - - if(x->x_gui.x_selected) - { - sys_vgui(".x%x.c itemconfigure %xBASE -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); - } - } - void my_canvas_draw(t_bng *x, t_glist *glist, int mode) { ! /*if (!glist_isvisible(glist_getcanvas(glist))) return; <-- doesn't work */ ! if (mode==IEM_GUI_DRAW_MODE_ERASE) ! sys_mgui((t_iemgui *)x,"cnv","erase",""); ! else if (mode==IEM_GUI_DRAW_MODE_SELECT) ! sys_mgui((t_iemgui *)x,"cnv","select","i",x->x_gui.x_selected); ! else { ! pd_upload((t_gobj *)x,glist); ! sys_mgui((t_iemgui *)x,"cnv","draw","");} }
--- 22,29 ---- #endif
static t_class *my_canvas_class;
void my_canvas_draw(t_bng *x, t_glist *glist, int mode) { ! iemgui_draw((t_iemgui *)x,glist,mode,"cnv"); }
*************** *** 205,219 **** { t_my_canvas *x = (t_my_canvas *)iemgui_new(my_canvas_class); ! int bflcol[]={-233017, -1, -66577}; ! int a=IEM_GUI_DEFAULTSIZE, w=100, h=60; ! int ldx=20, ldy=12, i=0; ! int fs=14; ! iem_inttosymargs(&x->x_gui.x_isa, 0); x->x_gui.x_font_style = 0; - 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); --- 120,131 ---- { t_my_canvas *x = (t_my_canvas *)iemgui_new(my_canvas_class); ! int bflcol[]={~0707070, ~0000000, ~0202020}; ! int a=IEM_GUI_DEFAULTSIZE, w=100, h=60, ldx=20, ldy=12, i=0, fs=14; iem_inttosymargs(&x->x_gui.x_isa, 0); x->x_gui.x_font_style = 0; if(((argc >= 10)&&(argc <= 13)) &&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)) { + /*pd_scanargs(argc,argv,"iii;",&a,&w,&h);*/ a = (int)atom_getintarg(0, argc, argv); w = (int)atom_getintarg(1, argc, argv); *************** *** 221,235 **** } 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); ! } else if((argc == 11)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))) ! { ! i = 1; ! iemgui_new_getnames(&x->x_gui, 3, argv); ! } else iemgui_new_getnames(&x->x_gui, 3, 0); - if(((argc >= 10)&&(argc <= 13)) &&(IS_A_SYMBOL(argv,i+3)||IS_A_FLOAT(argv,i+3))&&IS_A_FLOAT(argv,i+4) --- 133,140 ---- } 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);} else if((argc == 11)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))) ! {i=1; iemgui_new_getnames(&x->x_gui, 3, argv);} else iemgui_new_getnames(&x->x_gui, 3, 0); if(((argc >= 10)&&(argc <= 13)) &&(IS_A_SYMBOL(argv,i+3)||IS_A_FLOAT(argv,i+3))&&IS_A_FLOAT(argv,i+4) *************** *** 238,244 **** &&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+3; --- 143,149 ---- &&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+3; *************** *** 251,257 **** } if((argc == 13)&&IS_A_FLOAT(argv,i+10)) - { 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_glist = (t_glist *)canvas_getcurrent(); --- 156,160 ----
Index: u_object.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/u_object.tk,v retrieving revision 1.1.2.29 retrieving revision 1.1.2.30 diff -C2 -d -r1.1.2.29 -r1.1.2.30 *** u_object.tk 1 May 2004 15:03:07 -0000 1.1.2.29 --- u_object.tk 1 May 2004 15:24:01 -0000 1.1.2.30 *************** *** 222,225 **** --- 222,226 ---- } io_draw $self $canvas $x1 $y1 $xs $ys $ins $outs + set _($self:clickeditevent) objectbox_clickedit set _($self:clickevent) objectbox_click } *************** *** 241,244 **** --- 242,249 ---- }
+ proc objectbox_clickedit {self canvas x y b f} { + puts "objectbox_clickedit $self $canvas $x $y $b $f" + } + proc brokenbox_draw {self canvas xs ys ins outs} { objectbox_draw $self $canvas $xs $ys $ins $outs *************** *** 866,869 **** --- 871,875 ---- $canvas coords ${self}BASE $x1 $y1 [expr $x1+$xs] [expr $y1+$ys] } + label_draw $self $canvas }
*************** *** 873,876 ****
proc cnv_erase {self canvas} { ! $canvas delete ${self}BASE } --- 879,883 ----
proc cnv_erase {self canvas} { ! $canvas delete ${self}BASE ${self}LABEL } +