@@ -23,11 +23,13 @@ typedef struct _image
2323 int x_img_height ;
2424 int x_gop_spill ;
2525 int x_click ;
26- //t_float x_clicked;
2726 t_symbol * x_fname ;
2827 t_symbol * x_receive ;
29- //int x_selected;
30- //t_symbol* send;
28+ #if 0 // TODO?
29+ t_float x_clicked ;
30+ int x_selected ;
31+ t_symbol * send ;
32+ #endif
3133} t_image ;
3234
3335/* widget helper functions */
@@ -97,19 +99,12 @@ static void image_drawme(t_image *x, t_glist *glist, int firstime)
9799 x ,
98100 x ,
99101 "center" );
100- //sys_vgui("catch {.x%zx.c delete %xS}\n", glist_getcanvas(glist), x);
101- //sys_vgui(".x%x.c create image %d %d -tags %xS\n",
102- // glist_getcanvas(glist),text_xpix(&x->x_obj, glist),
103- // text_ypix(&x->x_obj, glist), x);
104102 gui_vmess ("gui_image_size_callback" , "xxs" ,
105103 glist_getcanvas (glist ), x , x -> x_receive -> s_name );
106104 }
107105 else
108106 {
109107 // move the gobj
110- //sys_vgui(".x%x.c coords %xS %d %d\n",
111- // glist_getcanvas(glist), x,
112- // text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
113108 gui_vmess ("gui_image_coords" , "xxii" ,
114109 glist_getcanvas (glist ),
115110 x ,
@@ -127,9 +122,6 @@ static void image_drawme(t_image *x, t_glist *glist, int firstime)
127122static void image_erase (t_image * x ,t_glist * glist )
128123{
129124 gui_vmess ("gui_gobj_erase" , "xx" , glist_getcanvas (glist ), x );
130- //sys_vgui("catch {.x%x.c delete %xS}\n",glist_getcanvas(glist), x);
131- //sys_vgui("catch {image delete $img%x}\n", x);
132- //sys_vgui("catch {.x%x.c delete %xSEL}\n",glist_getcanvas(glist), x);
133125}
134126
135127static t_symbol * get_filename (t_int argc , t_atom * argv )
@@ -188,14 +180,15 @@ static void image_getrect(t_gobj *z, t_glist *glist,
188180 if ((glist_getcanvas (glist ) != glist && !x -> x_click ) || (!glist -> gl_edit && !x -> x_click ))
189181 {
190182 * xp2 = * xp1 ;
191- // only if we have an image loaded and we are placed within a GOP obliterate the height
192- //if (glist_getcanvas(glist) != glist && (x->x_img_width + x->x_img_height) >= 2)
193- //{
194- //printf("blah\n");
195- //*yp2 = *yp1;
196- //}
183+ // only if we have an image loaded and we are placed within a GOP
184+ // obliterate the height
185+ #if 0
186+ if (glist_getcanvas (glist ) != glist && (x -> x_img_width + x -> x_img_height ) >= 2 )
187+ {
188+ * yp2 = * yp1 ;
189+ }
190+ #endif
197191 }
198- //fprintf(stderr,"image_getrect %d %d %d %d\n", *xp1, *yp1, *xp2, *yp2);
199192}
200193
201194static void image_displace (t_gobj * z , t_glist * glist ,
@@ -216,12 +209,6 @@ static void image_displace_wtag(t_gobj *z, t_glist *glist,
216209 t_image * x = (t_image * )z ;
217210 x -> x_obj .te_xpix += dx ;
218211 x -> x_obj .te_ypix += dy ;
219- /*sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n",
220- glist_getcanvas(glist), x,
221- text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
222- text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height);
223-
224- image_drawme(x, glist, 0);*/
225212 canvas_fixlinesfor (glist ,(t_text * ) x );
226213}
227214
@@ -234,42 +221,13 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
234221 if (x -> x_glist == glist_getcanvas (glist ))
235222 {
236223 //x->x_selected = state;
237- if (!x -> x_gop_spill && (x -> x_img_width + x -> x_img_height ) >= 2 )
238- {
239- sys_vgui (".x%x.c create prect %d %d %d %d \
240- -tags %xSEL -strokewidth 1 -stroke $pd_colors(selection)\n" ,
241- glist_getcanvas (glist ),
242- text_xpix (& x -> x_obj , glist ) - x -> x_img_width /2 ,
243- text_ypix (& x -> x_obj , glist ) - x -> x_img_height /2 ,
244- text_xpix (& x -> x_obj , glist ) + x -> x_img_width /2 ,
245- text_ypix (& x -> x_obj , glist ) + x -> x_img_height /2 , x );
246- }
247- else
248- {
249- sys_vgui (".x%x.c create prect %d %d %d %d \
250- -tags %xSEL -strokewidth 1 -stroke $pd_colors(selection)\n" ,
251- glist_getcanvas (glist ),
252- text_xpix (& x -> x_obj , glist ) - x -> x_width /2 ,
253- text_ypix (& x -> x_obj , glist ) - x -> x_height /2 ,
254- text_xpix (& x -> x_obj , glist ) + x -> x_width /2 ,
255- text_ypix (& x -> x_obj , glist ) + x -> x_height /2 , x );
256- }
257224 gui_vmess ("gui_image_toggle_border" , "xxi" , glist_getcanvas (glist ),
258225 x , 1 );
259226 }
260227 gui_vmess ("gui_gobj_select" , "xx" , glist_getcanvas (glist ), x );
261- //if (glist->gl_owner && !glist_istoplevel(glist))
262- //sys_vgui(".x%x.c addtag selected withtag %xS\n", glist_getcanvas(glist), x);
263- //sys_vgui(".x%x.c addtag selected withtag %xMT\n", glist_getcanvas(glist), x);
264- //sys_vgui(".x%x.c addtag selected withtag %xSEL\n", glist_getcanvas(glist), x);
265228 }
266229 else
267230 {
268- //sys_vgui("catch {.x%x.c delete %xSEL}\n",
269- //glist_getcanvas(glist), x);
270- //if (glist->gl_owner && !glist_istoplevel(glist))
271- //sys_vgui(".x%zx.c dtag %xS selected\n", glist_getcanvas(glist), x);
272- //sys_vgui(".x%zx.c dtag %xMT selected\n", glist_getcanvas(glist), x);
273231 gui_vmess ("gui_image_toggle_border" , "xxi" , glist_getcanvas (glist ),
274232 x , 0 );
275233 gui_vmess ("gui_gobj_deselect" , "xx" , glist_getcanvas (glist ), x );
@@ -278,12 +236,14 @@ static void image_select(t_gobj *z, t_glist *glist, int state)
278236
279237static void image_activate (t_gobj * z , t_glist * glist , int state )
280238{
281- /*fprintf(stderr,"activate...\n");
239+ #if 0 // TODO?
240+ fprintf (stderr ,"activate...\n" );
282241 t_text * x = (t_text * )z ;
283242 t_rtext * y = glist_findrtext (glist , x );
284243 rtext_activate (y , state );
285244 t_image * i = (t_image * )z ;
286- canvas_redraw(i->x_glist);*/
245+ canvas_redraw (i -> x_glist );
246+ #endif
287247}
288248
289249static void image_delete (t_gobj * z , t_glist * glist )
@@ -307,27 +267,37 @@ static void image_vis(t_gobj *z, t_glist *glist, int vis)
307267static void image_save (t_gobj * z , t_binbuf * b )
308268{
309269 t_image * x = (t_image * )z ;
310- binbuf_addv (b , "ssiissi" , gensym ("#X" ), gensym ("obj" ),
311- x -> x_obj .te_xpix , x -> x_obj .te_ypix ,
312- atom_getsymbol (binbuf_getvec (x -> x_obj .te_binbuf )),
313- x -> x_fname , x -> x_gop_spill );
270+ // ag: unless we need it, avoid adding the gop-spill argument which isn't
271+ // compatible with vanilla ggee
272+ if (x -> x_gop_spill )
273+ binbuf_addv (b , "ssiissi" , gensym ("#X" ), gensym ("obj" ),
274+ x -> x_obj .te_xpix , x -> x_obj .te_ypix ,
275+ atom_getsymbol (binbuf_getvec (x -> x_obj .te_binbuf )),
276+ x -> x_fname , x -> x_gop_spill );
277+ else
278+ binbuf_addv (b , "ssiiss" , gensym ("#X" ), gensym ("obj" ),
279+ x -> x_obj .te_xpix , x -> x_obj .te_ypix ,
280+ atom_getsymbol (binbuf_getvec (x -> x_obj .te_binbuf )),
281+ x -> x_fname );
314282 binbuf_addv (b , ";" );
315283}
316284
317285static t_widgetbehavior image_widgetbehavior ;
318286
319- /*void image_size(t_image* x,t_floatarg w,t_floatarg h) {
287+ #if 0 // TODO?
288+ static void image_size (t_image * x ,t_floatarg w ,t_floatarg h ) {
320289 x -> x_width = w ;
321290 x -> x_height = h ;
322291 image_displace ((t_gobj * )x , x -> x_glist , 0.0 , 0.0 );
323- }*/
292+ }
324293
325- /* void image_color(t_image* x,t_symbol* col)
294+ static void image_color (t_image * x ,t_symbol * col )
326295{
327296 //outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang ..
328297 //so color black does the same as bang, but doesn't forward the bang
329298
330- }*/
299+ }
300+ #endif
331301
332302static int image_newclick (t_gobj * z , struct _glist * glist , int xpix , int ypix , int shift , int alt , int dbl , int doit )
333303{
@@ -337,15 +307,6 @@ static int image_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, i
337307 outlet_bang (x -> x_obj .ob_outlet );
338308 // LATER: figure out how to do click on and click off
339309 // and provide a toggle button behavior instead
340- /*{
341- x->x_clicked = 1;
342- outlet_float(x->x_obj.ob_outlet, x->x_clicked);
343- }
344- else if (x->x_clicked)
345- {
346- x->x_clicked = 0;
347- outlet_float(x->x_obj.ob_outlet, x->x_clicked);
348- }*/
349310 return (1 );
350311}
351312
@@ -426,19 +387,19 @@ static void image_imagesize_callback(t_image *x, t_float w, t_float h) {
426387 }
427388 else
428389 {
429- //sys_vgui("catch {.x%x.c delete %xMT}\n", glist_getcanvas(x->x_glist), x);
430390 // reselect if we are on a toplevel canvas to adjust the selection rectangle, if necessary
431391
392+ #if 0
432393 /* ico@vt.edu: this does not work for the spill mode, so we will have to
433- draw the select box on demand
394+ draw the select box on demand */
434395 gui_vmess ("gui_image_draw_border" , "xxiiii" ,
435396 glist_getcanvas (x -> x_glist ),
436397 x ,
437398 0 - x -> x_img_width /2 ,
438399 0 - x -> x_img_height /2 ,
439400 x -> x_img_width ,
440401 x -> x_img_height );
441- */
402+ #endif
442403
443404 if (glist_isselected (x -> x_glist , (t_gobj * )x ) && glist_getcanvas (x -> x_glist ) == x -> x_glist )
444405 {
@@ -463,14 +424,11 @@ static void image_setwidget(void)
463424
464425static void image_free (t_image * x )
465426{
466- //sys_vgui("image delete img%x\n", x);
467427 gui_vmess ("gui_image_free" , "x" , x );
468428 if (x -> x_receive )
469429 {
470430 pd_unbind (& x -> x_obj .ob_pd ,x -> x_receive );
471431 }
472- //sys_vgui(".x%x.c delete %xSEL\n", x);
473- //sys_vgui(".x%x.c delete %xS\n", x);
474432}
475433
476434static void * image_new (t_symbol * s , t_int argc , t_atom * argv )
@@ -515,12 +473,12 @@ void image_setup(void)
515473 image_class = class_new (gensym ("image" ),
516474 (t_newmethod )image_new , (t_method )image_free ,
517475 sizeof (t_image ),0 , A_GIMME ,0 );
518- /*
476+ #if 0 // TODO?
519477 class_addmethod (image_class , (t_method )image_size , gensym ("size" ),
520478 A_FLOAT , A_FLOAT , 0 );
521479 class_addmethod (image_class , (t_method )image_color , gensym ("color" ),
522480 A_SYMBOL , 0 );
523- */
481+ #endif
524482 class_addmethod (image_class , (t_method )image_click , gensym ("click" ),
525483 A_DEFFLOAT , 0 );
526484 class_addmethod (image_class , (t_method )image_open , gensym ("open" ),
0 commit comments