[PD-cvs] pd/src desire.c,1.1.2.18,1.1.2.19

Mathieu Bouchard matju at users.sourceforge.net
Sun Sep 18 11:22:20 CEST 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26178

Modified Files:
      Tag: devel_0_39
	desire.c 
Log Message:
added canvas_text_setto (method text_setto)


Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -C2 -d -r1.1.2.18 -r1.1.2.19
*** desire.c	17 Sep 2005 21:12:47 -0000	1.1.2.18
--- desire.c	18 Sep 2005 09:22:18 -0000	1.1.2.19
***************
*** 633,637 ****
      }
      else namebuf[0] = 0;
!     sys_vgui("wm title .x%lx {%s%c%s - %s}\n", 
          x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
              canvas_getdir(x)->s_name);
--- 633,637 ----
      }
      else namebuf[0] = 0;
!     sys_vgui("%lx window_title {%s%c%s - %s}\n", 
          x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf,
              canvas_getdir(x)->s_name);
***************
*** 651,668 ****
  {
      if (doit)
!         sys_vgui(".x%lx.c create line\
!             %d %d %d %d %d %d %d %d %d %d -fill #ff8080 -tags GOP\n",
!             glist_getcanvas(x),
!             x->gl_xmargin, x->gl_ymargin,
!             x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin,
!             x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin + x->gl_pixheight,
!             x->gl_xmargin, x->gl_ymargin + x->gl_pixheight,
!             x->gl_xmargin, x->gl_ymargin);
!     else sys_vgui(".x%lx.c delete GOP\n",  glist_getcanvas(x));
  }
  
!     /* the window becomes "mapped" (visible and not miniaturized) or
!     "unmapped" (either miniaturized or just plain gone.)  This should be
!     called from the GUI after the fact to "notify" us that we're mapped. */
  void canvas_map(t_canvas *x, t_floatarg f)
  {
--- 651,662 ----
  {
      if (doit)
!         sys_mgui(glist_getcanvas(x),"gop_rectangle","iiii",
!             x->gl_xmargin, x->gl_ymargin, x->gl_pixwidth, x->gl_pixheight);
!     else sys_mgui(glist_getcanvas(x),"gop_rectangle_delete","");
  }
  
! /* the window becomes "mapped" (visible and not miniaturized) or
! "unmapped" (either miniaturized or just plain gone.)  This should be
! called from the GUI after the fact to "notify" us that we're mapped. */
  void canvas_map(t_canvas *x, t_floatarg f)
  {
***************
*** 687,691 ****
              if (x->gl_isgraph && x->gl_goprect)
                  canvas_drawredrect(x, 1);
!             sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
          }
      }
--- 681,685 ----
              if (x->gl_isgraph && x->gl_goprect)
                  canvas_drawredrect(x, 1);
!             sys_mgui(x,"canvas_getscroll","");
          }
      }
***************
*** 695,699 ****
          {
                  /* just clear out the whole canvas... */
!             sys_vgui(".x%lx.c delete all\n", x);
  #if 0
                  /* alternatively, we could have erased them one by one...
--- 689,693 ----
          {
                  /* just clear out the whole canvas... */
!             sys_mgui(x,"erase","");
  #if 0
                  /* alternatively, we could have erased them one by one...
***************
*** 796,802 ****
              canvas_vis(x, 1);
  #else
!             sys_vgui("raise .x%lx\n", x);
!             sys_vgui("focus .x%lx.c\n", x);
!             sys_vgui("wm deiconify .x%lx\n", x);  
  #endif
          }
--- 790,796 ----
              canvas_vis(x, 1);
  #else
!             sys_vgui(x,"window_raise","");
!             sys_vgui(x,"window_focus","");
!             sys_vgui(x,"window_deiconify","");  
  #endif
          }
***************
*** 829,838 ****
              return;
          }
!         sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
          glist_noselect(x);
          if (glist_isvisible(x))
              canvas_map(x, 0);
          canvas_create_editor(x, 0);
!         sys_vgui("destroy .x%lx\n", x);
          for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++)
              ;
--- 823,832 ----
              return;
          }
!         sys_mgui(x,"getscroll","");
          glist_noselect(x);
          if (glist_isvisible(x))
              canvas_map(x, 0);
          canvas_create_editor(x, 0);
!         sys_vgui("destroy .x%lx\n", x); // huh?
          for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++)
              ;
***************
*** 933,987 ****
      t_linetraverser t;
      t_outconnect *oc;
-     {
-         linetraverser_start(&t, x);
-         while (oc = linetraverser_next(&t))
-             sys_vgui(".x%lx.c create line %d %d %d %d -width %d -tags l%lx\n",
-                     glist_getcanvas(x),
-                         t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, 
-                             (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1),
-                                 oc);
-     }
- }
- 
- void canvas_fixlinesfor(t_canvas *x, t_text *text)
- {
-     t_linetraverser t;
-     t_outconnect *oc;
- 
      linetraverser_start(&t, x);
!     while (oc = linetraverser_next(&t))
!     {
!         if (t.tr_ob == text || t.tr_ob2 == text)
!         {
!             sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n",
!                 glist_getcanvas(x), oc,
!                     t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
!         }
!     }
  }
  
!     /* kill all lines for the object */
  void canvas_deletelinesfor(t_canvas *x, t_text *text)
! {
!     t_linetraverser t;
!     t_outconnect *oc;
!     linetraverser_start(&t, x);
!     while (oc = linetraverser_next(&t))
!     {
!         if (t.tr_ob == text || t.tr_ob2 == text)
!         {
!             if (x->gl_editor)
!             {
!                 sys_vgui(".x%lx.c delete l%lx\n",
!                     glist_getcanvas(x), oc);
!             }
!             obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
!         }
!     }
! }
  
!     /* kill all lines for one inlet or outlet */
! void canvas_deletelinesforio(t_canvas *x, t_text *text,
!     t_inlet *inp, t_outlet *outp)
  {
      t_linetraverser t;
--- 927,944 ----
      t_linetraverser t;
      t_outconnect *oc;
      linetraverser_start(&t, x);
!     while ((oc = linetraverser_next(&t)))
! 	sys_vgui("wire_update %lx %lx %d %d %d %d %d", oc,
!                     glist_getcanvas(x), t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno, 
!                             (outlet_getsymbol(t.tr_outlet) == &s_signal));
  }
  
! void canvas_fixlinesfor(t_canvas *x, t_text *text)
! {sys_mgui(text,"draw_wires","");}
  void canvas_deletelinesfor(t_canvas *x, t_text *text)
! {sys_mgui(text,"delete_wires","");}
  
! /* kill all lines for one inlet or outlet */
! void canvas_deletelinesforio(t_canvas *x, t_text *text, t_inlet *inp, t_outlet *outp)
  {
      t_linetraverser t;
***************
*** 1163,1177 ****
  }
  
! static void canvas_click(t_canvas *x,
!     t_floatarg xpos, t_floatarg ypos,
!         t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
! {
!     canvas_vis(x, 1);
! }
! 
  
!     /* find out from subcanvas contents how much to fatten the box */
! void canvas_fattensub(t_canvas *x,
!     int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_gobj *y;
--- 1120,1128 ----
  }
  
! //static void canvas_click(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
! //{canvas_vis(x, 1);}
  
! /* find out from subcanvas contents how much to fatten the box */
! void canvas_fattensub(t_canvas *x, int *xp1, int *yp1, int *xp2, int *yp2)
  {
      t_gobj *y;
***************
*** 1843,1847 ****
              sinkno == index2 && t.tr_inno == inno)
          {
!             sys_vgui(".x%lx.c delete l%lx\n", x, oc);
              obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
              break;
--- 1794,1798 ----
              sinkno == index2 && t.tr_inno == inno)
          {
!             sys_mgui(oc,"delete","");
              obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno);
              break;
***************
*** 2211,2215 ****
      if (xwas != x || cursorwas != cursornum)
      {
!         sys_vgui(".x%lx configure -cursor %s\n", x, cursorlist[cursornum]);
          xwas = x;
          cursorwas = cursornum;
--- 2162,2166 ----
      if (xwas != x || cursorwas != cursornum)
      {
!         //sys_vgui(".x%lx configure -cursor %s\n", x, cursorlist[cursornum]);
          xwas = x;
          cursorwas = cursornum;
***************
*** 2219,2234 ****
  void canvas_inlettip(t_canvas* x,t_object* ob,int closest,int xpos,int ypos)
  {
  	if (!sys_tooltips) return;
  	if (ob->ob_pd->c_firstin) closest--;
  	if (closest < 0)
! 		sys_vgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
  				 (t_int)x, xpos, ypos,ob->ob_pd->c_firsttip->s_name);
  	else
  		sys_vgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
  				 (t_int)x, xpos, ypos-4,inlet_tip(ob->te_inlet,closest));
  }
  
  
!     /* check if a point lies in a gobj.  */
  int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos,
      int *x1p, int *y1p, int *x2p, int *y2p)
--- 2170,2187 ----
  void canvas_inlettip(t_canvas* x,t_object* ob,int closest,int xpos,int ypos)
  {
+ /*
  	if (!sys_tooltips) return;
  	if (ob->ob_pd->c_firstin) closest--;
  	if (closest < 0)
! 		sys_mgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
  				 (t_int)x, xpos, ypos,ob->ob_pd->c_firsttip->s_name);
  	else
  		sys_vgui(".x%lx.c create text %d %d -anchor sw -text \"%s\" -tags y\n",
  				 (t_int)x, xpos, ypos-4,inlet_tip(ob->te_inlet,closest));
+ */
  }
  
  
! /* check if a point lies in a gobj.  */
  int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos,
      int *x1p, int *y1p, int *x2p, int *y2p)
***************
*** 2270,2275 ****
      canprop = (!y || (y && class_getpropertiesfn(pd_class(&y->g_pd))));
      canopen = (y && zgetfn(&y->g_pd, gensym("menu-open")));
!     sys_vgui("pdtk_canvas_popup .x%lx %d %d %d %d\n",
!         x, xpos, ypos, canprop, canopen);
  }
  
--- 2223,2228 ----
      canprop = (!y || (y && class_getpropertiesfn(pd_class(&y->g_pd))));
      canopen = (y && zgetfn(&y->g_pd, gensym("menu-open")));
! //    sys_vgui("pdtk_canvas_popup .x%lx %d %d %d %d\n",
! //        x, xpos, ypos, canprop, canopen);
  }
  
***************
*** 12387,12391 ****
  void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
  
! void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) {
      if (x->te_type == T_OBJECT) {
      	t_binbuf *b = binbuf_new();
--- 12340,12344 ----
  void text_eraseborder(t_text *x, t_glist *glist, char *tag) {}
  
! static void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize) {
      if (x->te_type == T_OBJECT) {
      	t_binbuf *b = binbuf_new();
***************
*** 12422,12425 ****
--- 12375,12388 ----
  }
  
+ static void canvas_text_setto(t_canvas *x, t_symbol *s, int argc, t_atom *argv) {
+ 	char str[666];
+ 	t_text *o;
+ 	int i;
+ 	if (sscanf(atom_getsymbol(argv)->s_name,"!%lx",(long*)&o)<1) {error("gargamel was here"); return;}
+ 	for (i=0; i<argc-1; i++) str[i] = atom_getfloat(argv+i+1);
+ 	str[argc-1]=0;
+ 	text_setto(o,x,str,argc-1);
+ }
+ 
  void g_text_setup(void) {
      text_class = class_new(gensym("text"), 0, 0, sizeof(t_text),
***************
*** 13782,13784 ****
--- 13745,13750 ----
      class_addmethod(c, (t_method)glist_arraydialog, gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
      class_addmethod(c, (t_method)glist_sort, gensym("sort"), A_NULL);
+ 
+     class_addmethod(c, (t_method)canvas_text_setto, gensym("text_setto"), A_GIMME, 0);
  }
+ 





More information about the Pd-cvs mailing list