[PD-cvs] externals/bbogart/entry entry.c,1.23,1.24

Hans-Christoph Steiner eighthave at users.sourceforge.net
Tue Nov 6 17:13:56 CET 2007


Update of /cvsroot/pure-data/externals/bbogart/entry
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19158

Modified Files:
	entry.c 
Log Message:

- switched to using x->canvas everywhere to make sure that [entry]'s widgets
  use the actual Pd canvas name as their root.  x->canvas is set in
  entry_new() by doing x->canvas = canvas_getcurrent();

- added mouse button bindings to make the Help/Properties popup menu work
  inside of the text box.


Index: entry.c
===================================================================
RCS file: /cvsroot/pure-data/externals/bbogart/entry/entry.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** entry.c	6 Nov 2007 06:13:16 -0000	1.23
--- entry.c	6 Nov 2007 16:13:54 -0000	1.24
***************
*** 39,43 ****
  #define BACKGROUNDCOLOR "grey70"
  
! #define DEBUG(x)
  
  typedef struct _entry
--- 39,43 ----
  #define BACKGROUNDCOLOR "grey70"
  
! #define DEBUG(x) x
  
  typedef struct _entry
***************
*** 45,49 ****
      t_object x_obj;
      
-     t_glist * x_glist;
      int x_rect_width;
      int x_rect_height;
--- 45,48 ----
***************
*** 66,69 ****
--- 65,70 ----
      t_int x_have_scrollbar;
      
+     t_canvas *canvas;
+     
      t_outlet* x_data_outlet;
      t_outlet* x_status_outlet;
***************
*** 117,121 ****
  
      int nplus, i, onset;
-     t_canvas *canvas = glist_getcanvas(glist);
      
      nplus = (nin == 1 ? 1 : nin-1);
--- 118,121 ----
***************
*** 126,135 ****
          if (firsttime)
          {
!             DEBUG(post(".x%x.c create rectangle %d %d %d %d -tags {%xi%d %xi}\n",
!                        canvas, onset, text_ypix(&x->x_obj, glist) - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1,
                         x, i, x););
!             sys_vgui(".x%x.c create rectangle %d %d %d %d -tags {%xi%d %xi}\n",
!                      canvas, onset, text_ypix(&x->x_obj, glist) - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1,
                       x, i, x);
--- 126,135 ----
          if (firsttime)
          {
!             DEBUG(post(".x%lx.c create rectangle %d %d %d %d -tags {%xi%d %xi}\n",
!                        x->canvas, onset, text_ypix(&x->x_obj, glist) - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1,
                         x, i, x););
!             sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%xi%d %xi}\n",
!                      x->canvas, onset, text_ypix(&x->x_obj, glist) - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1,
                       x, i, x);
***************
*** 137,145 ****
          else
          {
!             DEBUG(post(".x%x.c coords %xi%d %d %d %d %d\n",
!                        canvas, x, i, onset, text_ypix(&x->x_obj, glist) - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1););
!             sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n",
!                      canvas, x, i, onset, text_ypix(&x->x_obj, glist) - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist)- 1);
          }
--- 137,145 ----
          else
          {
!             DEBUG(post(".x%lx.c coords %xi%d %d %d %d %d\n",
!                        x->canvas, x, i, onset, text_ypix(&x->x_obj, glist) - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) - 1););
!             sys_vgui(".x%lx.c coords %xi%d %d %d %d %d\n",
!                      x->canvas, x, i, onset, text_ypix(&x->x_obj, glist) - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist)- 1);
          }
***************
*** 151,160 ****
          if (firsttime)
          {
!             DEBUG(post(".x%x.c create rectangle %d %d %d %d -tags {%xo%d %xo}\n",
!                        canvas, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1,
                         x, i, x););
!             sys_vgui(".x%x.c create rectangle %d %d %d %d -tags {%xo%d %xo}\n",
!                      canvas, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1,
                       x, i, x);
--- 151,160 ----
          if (firsttime)
          {
!             DEBUG(post(".x%lx.c create rectangle %d %d %d %d -tags {%xo%d %xo}\n",
!                        x->canvas, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1,
                         x, i, x););
!             sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%xo%d %xo}\n",
!                      x->canvas, onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1,
                       x, i, x);
***************
*** 162,171 ****
          else
          {
!             DEBUG(post(".x%x.c coords %xo%d %d %d %d %d\n",
!                        canvas, x, i, 
                         onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1););
!             sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n",
!                      canvas, x, i,
                       onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1);
--- 162,171 ----
          else
          {
!             DEBUG(post(".x%lx.c coords %xo%d %d %d %d %d\n",
!                        x->canvas, x, i, 
                         onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                         onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1););
!             sys_vgui(".x%lx.c coords %xo%d %d %d %d %d\n",
!                      x->canvas, x, i,
                       onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 2,
                       onset + IOWIDTH, text_ypix(&x->x_obj, glist) + x->x_rect_height-1);
***************
*** 175,189 ****
  }
  
! static void erase_inlets(t_entry *x, t_canvas *canvas)
  {
      DEBUG(post("erase_inlets"););
  /* Added tag for all inlets of one instance */
!     DEBUG(post(".x%x.c delete %xi\n", canvas,x););
!     sys_vgui(".x%x.c delete %xi\n", canvas,x); 
!     DEBUG(post(".x%x.c delete %xo\n", canvas,x););
!     sys_vgui(".x%x.c delete %xo\n", canvas,x); 
  /* Added tag for all outlets of one instance */
!     DEBUG(post(".x%x.c delete  %xhandle\n", canvas,x,0););
!     sys_vgui(".x%x.c delete  %xhandle\n", canvas,x,0);
  }
  
--- 175,189 ----
  }
  
! static void erase_inlets(t_entry *x)
  {
      DEBUG(post("erase_inlets"););
  /* Added tag for all inlets of one instance */
!     DEBUG(post(".x%lx.c delete %xi\n", x->canvas,x););
!     sys_vgui(".x%lx.c delete %xi\n", x->canvas,x); 
!     DEBUG(post(".x%lx.c delete %xo\n", x->canvas,x););
!     sys_vgui(".x%lx.c delete %xo\n", x->canvas,x); 
  /* Added tag for all outlets of one instance */
!     DEBUG(post(".x%lx.c delete  %xhandle\n", x->canvas,x,0););
!     sys_vgui(".x%lx.c delete  %xhandle\n", x->canvas,x,0);
  }
  
***************
*** 193,204 ****
  
     if (firsttime)
!    sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xhandle\n",
!    glist_getcanvas(glist),
     onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
     onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4,
     x);
     else
!    sys_vgui(".x%x.c coords %xhandle %d %d %d %d\n",
!    glist_getcanvas(glist), x, 
     onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
     onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4);
--- 193,204 ----
  
     if (firsttime)
!    sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %xhandle\n",
!    x->canvas,
     onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
     onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4,
     x);
     else
!    sys_vgui(".x%lx.c coords %xhandle %d %d %d %d\n",
!    x->canvas, x, 
     onset, text_ypix(&x->x_obj, glist) + x->x_rect_height - 12,
     onset + IOWIDTH-2, text_ypix(&x->x_obj, glist) + x->x_rect_height-4);
***************
*** 207,214 ****
  static void draw_scrollbar(t_entry *x)
  {
!     DEBUG(post("pack .x%x.c.s%x.scrollbar -side right -fill y -before .x%x.c.s%x.text \n",
!                x->x_glist, x, x->x_glist, x););
!     sys_vgui("pack .x%x.c.s%x.scrollbar -side right -fill y -before .x%x.c.s%x.text \n",
!              x->x_glist, x, x->x_glist, x);
      x->x_have_scrollbar = 1;
  }
--- 207,214 ----
  static void draw_scrollbar(t_entry *x)
  {
!     DEBUG(post("pack .x%lx.c.s%x.scrollbar -side right -fill y -before .x%lx.c.s%x.text \n",
!                x->canvas, x, x->canvas, x););
!     sys_vgui("pack .x%lx.c.s%x.scrollbar -side right -fill y -before .x%lx.c.s%x.text \n",
!              x->canvas, x, x->canvas, x);
      x->x_have_scrollbar = 1;
  }
***************
*** 216,228 ****
  static void erase_scrollbar(t_entry *x)
  {
!     DEBUG(post("pack forget .x%x.c.s%x.scrollbar \n", x->x_glist, x););
!     sys_vgui("pack forget .x%x.c.s%x.scrollbar \n", x->x_glist, x);
      x->x_have_scrollbar = 0;
  }
  
! static void create_widget(t_entry *x, t_glist *glist)
  {
      DEBUG(post("create_widget"););
-     t_canvas *canvas=glist_getcanvas(glist);
      /* I guess this is for fine-tuning of the rect size based on width and height? */
      x->x_rect_width = x->x_width;
--- 216,246 ----
  static void erase_scrollbar(t_entry *x)
  {
!     DEBUG(post("pack forget .x%lx.c.s%x.scrollbar \n", x->canvas, x););
!     sys_vgui("pack forget .x%lx.c.s%x.scrollbar \n", x->canvas, x);
      x->x_have_scrollbar = 0;
  }
  
! static void bind_button_events(t_entry *x)
! {
!     DEBUG(post("bind .x%lx.c.s%x.text <Button-2> \
! {pdtk_canvas_popup .x%lx [expr %%x + %d] [expr %%y + %d] 0 0} \n",
!                x->canvas, x, x->canvas, x->x_obj.te_xpix, x->x_obj.te_ypix););
!     sys_vgui("bind .x%lx.c.s%x.text <Button-2> \
! {pdtk_canvas_popup .x%lx [expr %%x + %d] [expr %%y + %d] 0 0} \n",
!              x->canvas, x, x->canvas, x->x_obj.te_xpix, x->x_obj.te_ypix);
!     sys_vgui("bind .x%lx.c.s%x.text <Control-Button> \
! {pdtk_canvas_popup .x%lx [expr %%x + %d] [expr %%y + %d] 0 0} \n",
!              x->canvas, x, x->canvas, x->x_obj.te_xpix, x->x_obj.te_ypix);
!     sys_vgui("bind .x%lx.c.s%x.text <Button-3> \
! {pdtk_canvas_popup .x%lx [expr %%x + %d] [expr %%y + %d] 0 0} \n",
!              x->canvas, x, x->canvas, x->x_obj.te_xpix, x->x_obj.te_ypix);
!     sys_vgui("bind .x%lx.c.s%x.text <Control-Button> \
! {pdtk_canvas_popup .x%lx [expr %%x + %d] [expr %%y + %d] 0 0} \n",
!              x->canvas, x, x->canvas, x->x_obj.te_xpix, x->x_obj.te_ypix);
! }
! 
! static void create_widget(t_entry *x)
  {
      DEBUG(post("create_widget"););
      /* I guess this is for fine-tuning of the rect size based on width and height? */
      x->x_rect_width = x->x_width;
***************
*** 233,269 ****
  
      /* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
!     DEBUG(post("destroy .x%x.c.s%x\n", canvas, x););
!     sys_vgui("destroy .x%x.c.s%x\n", canvas, x);
  
  
!     DEBUG(post("frame .x%x.c.s%x \n",canvas, x););
!     sys_vgui("frame .x%x.c.s%x \n",canvas, x);
!     DEBUG(post("text .x%x.c.s%x.text -font {%s %d %s} -border 1 \
                -highlightthickness 1 -relief sunken -bg \"%s\" -fg \"%s\" \
!               -yscrollcommand {.x%x.c.s%x.scrollbar set} \n",
!                canvas, x, x->x_font_face->s_name, x->x_font_size, 
                 x->x_font_weight->s_name,
                 x->x_bgcolour->s_name,x->x_fgcolour->s_name,
!                canvas, x););
!     sys_vgui("text .x%x.c.s%x.text -font {%s %d %s} -border 1 \
                -highlightthickness 1 -relief sunken -bg \"%s\" -fg \"%s\" \
!               -yscrollcommand {.x%x.c.s%x.scrollbar set} \n",
!              canvas, x, x->x_font_face->s_name, x->x_font_size, 
               x->x_font_weight->s_name,
               x->x_bgcolour->s_name, x->x_fgcolour->s_name,
!              canvas, x);
!     DEBUG(post("scrollbar .x%x.c.s%x.scrollbar -command {.x%x.c.s%x.text yview} \n",canvas, x, canvas, x););
!     sys_vgui("scrollbar .x%x.c.s%x.scrollbar -command {.x%x.c.s%x.text yview} \n",canvas, x ,canvas, x);
!     DEBUG(post("pack .x%x.c.s%x.text -side left -fill both -expand 1 \n",canvas, x););
!     sys_vgui("pack .x%x.c.s%x.text -side left -fill both -expand 1 \n",canvas, x);
!     DEBUG(post("pack .x%x.c.s%x -side bottom -fill both -expand 1 \n",canvas, x););
!     sys_vgui("pack .x%x.c.s%x -side bottom -fill both -expand 1 \n",canvas, x);
  
!     DEBUG(post("bind .x%x.c.s%x.text <KeyRelease> {+pd %s keyup %%N \\;} \n", 
!                canvas, x, x->x_receive_name->s_name););
!     sys_vgui("bind .x%x.c.s%x.text <KeyRelease> {+pd %s keyup %%N \\;} \n", 
!              canvas, x, x->x_receive_name->s_name);
!     DEBUG(post("pdtk_standardkeybindings .x%x.c.s%x.text \n", canvas, x););
!     sys_vgui("pdtk_standardkeybindings .x%x.c.s%x.text \n", canvas, x);
  }
  
--- 251,291 ----
  
      /* Seems we have to delete the widget in case it already exists (Provided by Guenter)*/
!     DEBUG(post("destroy .x%lx.c.s%x\n", x->canvas, x););
!     sys_vgui("destroy .x%lx.c.s%x\n", x->canvas, x);
  
  
!     DEBUG(post("frame .x%lx.c.s%x \n", x->canvas, x););
!     sys_vgui("frame .x%lx.c.s%x \n", x->canvas, x);
!     DEBUG(post("text .x%lx.c.s%x.text -font {%s %d %s} -border 1 \
                -highlightthickness 1 -relief sunken -bg \"%s\" -fg \"%s\" \
!               -yscrollcommand {.x%lx.c.s%x.scrollbar set} \n",
!                x->canvas, x, x->x_font_face->s_name, x->x_font_size, 
                 x->x_font_weight->s_name,
                 x->x_bgcolour->s_name,x->x_fgcolour->s_name,
!                x->canvas, x););
!     sys_vgui("text .x%lx.c.s%x.text -font {%s %d %s} -border 1 \
                -highlightthickness 1 -relief sunken -bg \"%s\" -fg \"%s\" \
!               -yscrollcommand {.x%lx.c.s%x.scrollbar set} \n",
!              x->canvas, x, x->x_font_face->s_name, x->x_font_size, 
               x->x_font_weight->s_name,
               x->x_bgcolour->s_name, x->x_fgcolour->s_name,
!              x->canvas, x);
!     DEBUG(post("scrollbar .x%lx.c.s%x.scrollbar -command {.x%lx.c.s%x.text yview} \n",
!                x->canvas, x, x->canvas, x););
!     sys_vgui("scrollbar .x%lx.c.s%x.scrollbar -command {.x%lx.c.s%x.text yview} \n",
!              x->canvas, x ,x->canvas, x);
!     DEBUG(post("pack .x%lx.c.s%x.text -side left -fill both -expand 1 \n",x->canvas, x););
!     sys_vgui("pack .x%lx.c.s%x.text -side left -fill both -expand 1 \n", x->canvas, x);
!     DEBUG(post("pack .x%lx.c.s%x -side bottom -fill both -expand 1 \n", x->canvas, x););
!     sys_vgui("pack .x%lx.c.s%x -side bottom -fill both -expand 1 \n", x->canvas, x);
  
!     DEBUG(post("bind .x%lx.c.s%x.text <KeyRelease> {+pd %s keyup %%N \\;} \n", 
!                x->canvas, x, x->x_receive_name->s_name););
!     sys_vgui("bind .x%lx.c.s%x.text <KeyRelease> {+pd %s keyup %%N \\;} \n", 
!              x->canvas, x, x->x_receive_name->s_name);
!     DEBUG(post("pdtk_standardkeybindings .x%lx.c.s%x.text \n", x->canvas, x););
!     sys_vgui("pdtk_standardkeybindings .x%lx.c.s%x.text \n", x->canvas, x);
! 
!     bind_button_events(x);
  }
  
***************
*** 271,300 ****
  {
      DEBUG(post("entry_drawme"););
-     t_canvas *canvas=glist_getcanvas(glist);
      DEBUG(post("drawme %d",firsttime););
      if (firsttime) 
      {
!         x->x_glist = canvas;
!         create_widget(x,glist);	       
!         DEBUG(post(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x \
!                     -tags %xS -width %d -height %d \n", canvas,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
!                    canvas, x, x, x->x_width, x->x_height););
!         sys_vgui(".x%x.c create window %d %d -anchor nw -window .x%x.c.s%x \
!                   -tags %xS -width %d -height %d \n", canvas, 
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
!                  canvas, x,x, x->x_width, x->x_height);
      }     
      else 
      {
!         DEBUG(post(".x%x.c coords %xS %d %d\n", canvas, x,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)););
!         sys_vgui(".x%x.c coords %xS %d %d\n", canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
      }
!     if( (x->x_glist->gl_edit) && (canvas == x->x_glist) )
          draw_inlets(x, glist, firsttime, 1,2);
      else
!         erase_inlets(x, canvas);
      //     draw_handle(x, glist, firsttime);
  }
--- 293,320 ----
  {
      DEBUG(post("entry_drawme"););
      DEBUG(post("drawme %d",firsttime););
      if (firsttime) 
      {
!         create_widget(x);	       
!         DEBUG(post(".x%lx.c create window %d %d -anchor nw -window .x%lx.c.s%x \
!                     -tags %xS -width %d -height %d \n", x->canvas,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
!                    x->canvas, x, x, x->x_width, x->x_height););
!         sys_vgui(".x%lx.c create window %d %d -anchor nw -window .x%lx.c.s%x \
!                   -tags %xS -width %d -height %d \n", x->canvas, 
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist),
!                  x->canvas, x,x, x->x_width, x->x_height);
      }     
      else 
      {
!         DEBUG(post(".x%lx.c coords %xS %d %d\n", x->canvas, x,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)););
!         sys_vgui(".x%lx.c coords %xS %d %d\n", x->canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist));
      }
!     if( (glist->gl_edit) && (x->canvas == glist) ) /* this is buggy logic */
          draw_inlets(x, glist, firsttime, 1,2);
      else
!         erase_inlets(x);
      //     draw_handle(x, glist, firsttime);
  }
***************
*** 304,315 ****
  {
      DEBUG(post("entry_erase"););
!     t_canvas *canvas = glist_getcanvas(glist);
!     DEBUG(post("destroy .x%x.c.s%x\n", canvas, x););
!     sys_vgui("destroy .x%x.c.s%x\n", canvas, x);
  
!     DEBUG(post(".x%x.c delete %xS\n", canvas, x););
!     sys_vgui(".x%x.c delete %xS\n", canvas, x);
  
!     erase_inlets(x, canvas);
  }
  	
--- 324,334 ----
  {
      DEBUG(post("entry_erase"););
!     DEBUG(post("destroy .x%lx.c.s%x\n", x->canvas, x););
!     sys_vgui("destroy .x%lx.c.s%x\n", x->canvas, x);
  
!     DEBUG(post(".x%lx.c delete %xS\n", x->canvas, x););
!     sys_vgui(".x%lx.c delete %xS\n", x->canvas, x);
  
!     erase_inlets(x);
  }
  	
***************
*** 342,351 ****
      if (glist_isvisible(glist))
      {
!         t_canvas *canvas = glist_getcanvas(glist);
!         DEBUG(post(".x%x.c coords %xSEL %d %d %d %d\n", canvas, x,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                     text_xpix(&x->x_obj, glist) + x->x_rect_width, 
                     text_ypix(&x->x_obj, glist) + x->x_rect_height-2););
!         sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                   text_xpix(&x->x_obj, glist) + x->x_rect_width, 
--- 361,369 ----
      if (glist_isvisible(glist))
      {
!         DEBUG(post(".x%lx.c coords %xSEL %d %d %d %d\n", x->canvas, x,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                     text_xpix(&x->x_obj, glist) + x->x_rect_width, 
                     text_ypix(&x->x_obj, glist) + x->x_rect_height-2););
!         sys_vgui(".x%lx.c coords %xSEL %d %d %d %d\n", x->canvas, x,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                   text_xpix(&x->x_obj, glist) + x->x_rect_width, 
***************
*** 353,357 ****
        
          entry_drawme(x, glist, 0);
!         canvas_fixlinesfor(canvas, (t_text*) x);
      }
      DEBUG(post("displace end"););
--- 371,375 ----
        
          entry_drawme(x, glist, 0);
!         canvas_fixlinesfor(x->canvas, (t_text*) x);
      }
      DEBUG(post("displace end"););
***************
*** 362,374 ****
      DEBUG(post("entry_select"););
      t_entry *x = (t_entry *)z;
!     t_canvas *canvas = glist_getcanvas(glist);
      if (state) {
!         DEBUG(post(".x%x.c create rectangle %d %d %d %d -tags %xSEL -outline blue\n",
!                    canvas,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                     text_xpix(&x->x_obj, glist) + x->x_rect_width, 
                     text_ypix(&x->x_obj, glist) + x->x_rect_height-2, x););
!         sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xSEL -outline blue\n",
!                  canvas,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                   text_xpix(&x->x_obj, glist) + x->x_rect_width, 
--- 380,392 ----
      DEBUG(post("entry_select"););
      t_entry *x = (t_entry *)z;
! 
      if (state) {
!         DEBUG(post(".x%lx.c create rectangle %d %d %d %d -tags %xSEL -outline blue\n",
!                    x->canvas,
                     text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                     text_xpix(&x->x_obj, glist) + x->x_rect_width, 
                     text_ypix(&x->x_obj, glist) + x->x_rect_height-2, x););
!         sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %xSEL -outline blue\n",
!                  x->canvas,
                   text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)-1,
                   text_xpix(&x->x_obj, glist) + x->x_rect_width, 
***************
*** 376,381 ****
      }
      else {
!         DEBUG(post(".x%x.c delete %xSEL\n", canvas, x););
!         sys_vgui(".x%x.c delete %xSEL\n", canvas, x);
      }
  }
--- 394,399 ----
      }
      else {
!         DEBUG(post(".x%lx.c delete %xSEL\n", x->canvas, x););
!         sys_vgui(".x%lx.c delete %xSEL\n", x->canvas, x);
      }
  }
***************
*** 402,406 ****
  {
      DEBUG(post("entry_vis"););
!     t_entry* s = (t_entry*)z;
      t_rtext *y;
      DEBUG(post("vis: %d",vis););
--- 420,424 ----
  {
      DEBUG(post("entry_vis"););
!     t_entry *s = (t_entry*)z;
      t_rtext *y;
      DEBUG(post("vis: %d",vis););
***************
*** 440,449 ****
      DEBUG(post("append ::entry%lx::list \" \"\n", x););
      sys_vgui("append ::entry%lx::list \" \"\n", x);
!     DEBUG(post(".x%x.c.s%x.text insert end $::entry%lx::list ; unset ::entry%lx::list \n", 
!                x->x_glist, x, x, x ););
!     sys_vgui(".x%x.c.s%x.text insert end $::entry%lx::list ; unset ::entry%lx::list \n", 
!              x->x_glist, x, x, x );
!     DEBUG(post(".x%x.c.s%x.text yview end-2char \n", x->x_glist, x ););
!     sys_vgui(".x%x.c.s%x.text yview end-2char \n", x->x_glist, x );
  }
  
--- 458,467 ----
      DEBUG(post("append ::entry%lx::list \" \"\n", x););
      sys_vgui("append ::entry%lx::list \" \"\n", x);
!     DEBUG(post(".x%lx.c.s%x.text insert end $::entry%lx::list ; unset ::entry%lx::list \n", 
!                x->canvas, x, x, x ););
!     sys_vgui(".x%lx.c.s%x.text insert end $::entry%lx::list ; unset ::entry%lx::list \n", 
!              x->canvas, x, x, x );
!     DEBUG(post(".x%lx.c.s%x.text yview end-2char \n", x->canvas, x ););
!     sys_vgui(".x%lx.c.s%x.text yview end-2char \n", x->canvas, x );
  }
  
***************
*** 460,484 ****
          if(tmp_int < 10)
          {
!             DEBUG(post(".x%x.c.s%x.text insert end %d\n", x->x_glist, x, tmp_int););
!             sys_vgui(".x%x.c.s%x.text insert end %d\n", x->x_glist, x, tmp_int);
          }
          else if(tmp_int == 10)
          {
!             DEBUG(post(".x%x.c.s%x.text insert end {\n}\n", x->x_glist, x););
!             sys_vgui(".x%x.c.s%x.text insert end {\n}\n", x->x_glist, x);
          }
          else
          {
!             DEBUG(post(".x%x.c.s%x.text insert end [format \"%c\" %d]\n", x->x_glist, x, tmp_int););
!             sys_vgui(".x%x.c.s%x.text insert end [format \"%c\" %d]\n", x->x_glist, x, tmp_int);
          }
      }
      else 
      {
!         DEBUG(post(".x%x.c.s%x.text insert end %s\n", x->x_glist, x, tmp_symbol->s_name ););
!         sys_vgui(".x%x.c.s%x.text insert end %s\n", x->x_glist, x, tmp_symbol->s_name );
      }
!     DEBUG(post(".x%x.c.s%x.text yview end-2char \n", x->x_glist, x ););
!     sys_vgui(".x%x.c.s%x.text yview end-2char \n", x->x_glist, x );
  }
  
--- 478,502 ----
          if(tmp_int < 10)
          {
!             DEBUG(post(".x%lx.c.s%x.text insert end %d\n", x->canvas, x, tmp_int););
!             sys_vgui(".x%lx.c.s%x.text insert end %d\n", x->canvas, x, tmp_int);
          }
          else if(tmp_int == 10)
          {
!             DEBUG(post(".x%lx.c.s%x.text insert end {\n}\n", x->canvas, x););
!             sys_vgui(".x%lx.c.s%x.text insert end {\n}\n", x->canvas, x);
          }
          else
          {
!             DEBUG(post(".x%lx.c.s%x.text insert end [format \"%c\" %d]\n", x->canvas, x, tmp_int););
!             sys_vgui(".x%lx.c.s%x.text insert end [format \"%c\" %d]\n", x->canvas, x, tmp_int);
          }
      }
      else 
      {
!         DEBUG(post(".x%lx.c.s%x.text insert end %s\n", x->canvas, x, tmp_symbol->s_name ););
!         sys_vgui(".x%lx.c.s%x.text insert end %s\n", x->canvas, x, tmp_symbol->s_name );
      }
!     DEBUG(post(".x%lx.c.s%x.text yview end-2char \n", x->canvas, x ););
!     sys_vgui(".x%lx.c.s%x.text yview end-2char \n", x->canvas, x );
  }
  
***************
*** 486,491 ****
  static void entry_clear(t_entry* x)
  {
!     DEBUG(post(".x%x.c.s%x.text delete 0.0 end \n", x->x_glist, x););
!     sys_vgui(".x%x.c.s%x.text delete 0.0 end \n", x->x_glist, x);
  }
  
--- 504,509 ----
  static void entry_clear(t_entry* x)
  {
!     DEBUG(post(".x%lx.c.s%x.text delete 0.0 end \n", x->canvas, x););
!     sys_vgui(".x%lx.c.s%x.text delete 0.0 end \n", x->canvas, x);
  }
  
***************
*** 512,520 ****
      /* With "," and ";" escaping thanks to JMZ */
      DEBUG(post("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
!                 [.x%x.c.s%x.text get 0.0 end]] \\;]\n", 
!                x->x_receive_name->s_name, x->x_glist, x););
      sys_vgui("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
!               [.x%x.c.s%x.text get 0.0 end]] \\;]\n", 
!              x->x_receive_name->s_name, x->x_glist, x);
  }
  
--- 530,538 ----
      /* With "," and ";" escaping thanks to JMZ */
      DEBUG(post("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
!                 [.x%lx.c.s%x.text get 0.0 end]] \\;]\n", 
!                x->x_receive_name->s_name, x->canvas, x););
      sys_vgui("pd [concat %s output [string map {\",\" \"\\\\,\" \";\" \"\\\\;\"} \
!               [.x%lx.c.s%x.text get 0.0 end]] \\;]\n", 
!              x->x_receive_name->s_name, x->canvas, x);
  }
  
***************
*** 582,597 ****
  static void entry_option_float(t_entry* x, t_symbol *option, t_float value)
  {
! 	DEBUG(post(".x%x.c.s%x.text configure -%s %f \n", 
!                x->x_glist, x, option->s_name, value););
! 	sys_vgui(".x%x.c.s%x.text configure -%s %f \n", 
!                x->x_glist, x, option->s_name, value);
  }
  
  static void entry_option_symbol(t_entry* x, t_symbol *option, t_symbol *value)
  {
! 	DEBUG(post(".x%x.c.s%x.text configure -%s {%s} \n", 
!                x->x_glist, x, option->s_name, value->s_name););
! 	sys_vgui(".x%x.c.s%x.text configure -%s {%s} \n", 
!                x->x_glist, x, option->s_name, value->s_name);
  }
  
--- 600,615 ----
  static void entry_option_float(t_entry* x, t_symbol *option, t_float value)
  {
! 	DEBUG(post(".x%lx.c.s%x.text configure -%s %f \n", 
!                x->canvas, x, option->s_name, value););
! 	sys_vgui(".x%lx.c.s%x.text configure -%s %f \n", 
!                x->canvas, x, option->s_name, value);
  }
  
  static void entry_option_symbol(t_entry* x, t_symbol *option, t_symbol *value)
  {
! 	DEBUG(post(".x%lx.c.s%x.text configure -%s {%s} \n", 
!                x->canvas, x, option->s_name, value->s_name););
! 	sys_vgui(".x%lx.c.s%x.text configure -%s {%s} \n", 
!                x->canvas, x, option->s_name, value->s_name);
  }
  
***************
*** 625,632 ****
  {
  	x->x_bgcolour = bgcol;
! 	DEBUG(post(".x%x.c.s%x.text configure -background \"%s\" \n", 
!                x->x_glist, x, x->x_bgcolour->s_name););
! 	sys_vgui(".x%x.c.s%x.text configure -background \"%s\" \n", 
!              x->x_glist, x, x->x_bgcolour->s_name);
  }
  
--- 643,650 ----
  {
  	x->x_bgcolour = bgcol;
! 	DEBUG(post(".x%lx.c.s%x.text configure -background \"%s\" \n", 
!                x->canvas, x, x->x_bgcolour->s_name););
! 	sys_vgui(".x%lx.c.s%x.text configure -background \"%s\" \n", 
!              x->canvas, x, x->x_bgcolour->s_name);
  }
  
***************
*** 635,642 ****
  {
  	x->x_fgcolour = fgcol;
! 	DEBUG(post(".x%x.c.s%x.text configure -foreground \"%s\" \n", 
!                x->x_glist, x, x->x_fgcolour->s_name););
! 	sys_vgui(".x%x.c.s%x.text configure -foreground \"%s\" \n", 
!              x->x_glist, x, x->x_fgcolour->s_name);
  }
  
--- 653,660 ----
  {
  	x->x_fgcolour = fgcol;
! 	DEBUG(post(".x%lx.c.s%x.text configure -foreground \"%s\" \n", 
!                x->canvas, x, x->x_fgcolour->s_name););
! 	sys_vgui(".x%lx.c.s%x.text configure -foreground \"%s\" \n", 
!              x->canvas, x, x->x_fgcolour->s_name);
  }
  
***************
*** 648,656 ****
      {
          x->x_font_size = (t_int)font_size;
!         DEBUG(post(".x%x.c.s%x.text configure -font {%s %d %s} \n", 
!                    x->x_glist, x,
                     x->x_font_face->s_name, x->x_font_size, x->x_font_weight->s_name););
!         sys_vgui(".x%x.c.s%x.text configure -font {%s %d %s} \n", 
!                  x->x_glist, x,
                   x->x_font_face->s_name, x->x_font_size, 
                   x->x_font_weight->s_name);
--- 666,674 ----
      {
          x->x_font_size = (t_int)font_size;
!         DEBUG(post(".x%lx.c.s%x.text configure -font {%s %d %s} \n", 
!                    x->canvas, x,
                     x->x_font_face->s_name, x->x_font_size, x->x_font_weight->s_name););
!         sys_vgui(".x%lx.c.s%x.text configure -font {%s %d %s} \n", 
!                  x->canvas, x,
                   x->x_font_face->s_name, x->x_font_size, 
                   x->x_font_weight->s_name);
***************
*** 707,710 ****
--- 725,730 ----
      pd_bind(&x->x_obj.ob_pd, x->x_receive_name);
  
+     x->canvas = canvas_getcurrent();
+ 
      return (x);
  }





More information about the Pd-cvs mailing list