[PD-cvs] externals/tkwidgets text.c,1.8,1.9

Hans-Christoph Steiner eighthave at users.sourceforge.net
Thu Nov 22 06:57:48 CET 2007


Update of /cvsroot/pure-data/externals/tkwidgets
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29476

Modified Files:
	text.c 
Log Message:

- removed xscrollcommand and yscrollcommand from supported options since
  currently they use generated names, i.e. canvas_id, etc.  Perhaps it's
  possible to support user override of these, but it probably would not be
  simple

- renamed "inlets" functions to "iolets" since they handle outlets too

- fixed bug in save logic that made the options get appended everytime it was
  saved: I needed to binbuf_clear() first.

- created tkwidgets_restore_options() and implemented it in [text].  It turned
  out to be quite easy since Tk's "canvas configure" can take the whole slew
  of options all at once.




Index: text.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/text.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** text.c	22 Nov 2007 02:53:22 -0000	1.8
--- text.c	22 Nov 2007 05:57:45 -0000	1.9
***************
*** 31,35 ****
  /* TODO: window name "handle1376fc00" already exists in parent */
  /* TODO: figure out window vs. text width/height */
! 
  
  #define DEFAULT_COLOR           "grey70"
--- 31,36 ----
  /* TODO: window name "handle1376fc00" already exists in parent */
  /* TODO: figure out window vs. text width/height */
! /* TODO: move bind_* to tkwidgets.c */
! /* TODO: erase iolets on resize, they are leaving old ones behind */
  
  #define DEFAULT_COLOR           "grey70"
***************
*** 112,117 ****
      "width",
      "wrap",
-     "xscrollcommand",
-     "yscrollcommand"
  };
  
--- 113,116 ----
***************
*** 238,242 ****
      set_tkwidgets_ids(x,glist_getcanvas(glist));	
      create_widget(x);	
!     tkwidgets_draw_inlets((t_object*)x, glist, 
                            x->canvas_id, x->iolets_tag, x->all_tag,
                            x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
--- 237,241 ----
      set_tkwidgets_ids(x,glist_getcanvas(glist));	
      create_widget(x);	
!     tkwidgets_draw_iolets((t_object*)x, glist, 
                            x->canvas_id, x->iolets_tag, x->all_tag,
                            x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
***************
*** 247,250 ****
--- 246,251 ----
               x->frame_id->s_name, x->window_tag->s_name, x->all_tag->s_name, 
               x->width, x->height);
+     tkwidgets_restore_options(x->receive_name, x->tcl_namespace,
+                               x->widget_id, x->options_binbuf);
  }     
  
***************
*** 254,258 ****
  
      set_tkwidgets_ids(x,glist_getcanvas(glist));
!     tkwidgets_erase_inlets(x->canvas_id, x->iolets_tag);
      sys_vgui("destroy %s\n", x->frame_id->s_name);
      sys_vgui("%s delete %s\n", x->canvas_id->s_name, x->all_tag->s_name);
--- 255,259 ----
  
      set_tkwidgets_ids(x,glist_getcanvas(glist));
!     tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
      sys_vgui("destroy %s\n", x->frame_id->s_name);
      sys_vgui("%s delete %s\n", x->canvas_id->s_name, x->all_tag->s_name);
***************
*** 541,545 ****
          tkwidgets_store_options(x->receive_name, x->tcl_namespace, x->widget_id, 
                                  sizeof(textwidget_tk_options)/sizeof(char *), 
!                                 &textwidget_tk_options);
      }
  }
--- 542,546 ----
          tkwidgets_store_options(x->receive_name, x->tcl_namespace, x->widget_id, 
                                  sizeof(textwidget_tk_options)/sizeof(char *), 
!                                 (char **)&textwidget_tk_options);
      }
  }
***************
*** 599,604 ****
          sys_vgui("%s itemconfigure %s -width %d -height %d\n",
                   x->canvas_id->s_name, x->window_tag->s_name, x->width, x->height);
!         tkwidgets_erase_inlets(x->canvas_id, x->iolets_tag);
!         tkwidgets_draw_inlets((t_object*)x, x->x_glist, 
                                x->canvas_id, x->iolets_tag, x->all_tag,
                                x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
--- 600,605 ----
          sys_vgui("%s itemconfigure %s -width %d -height %d\n",
                   x->canvas_id->s_name, x->window_tag->s_name, x->width, x->height);
!         tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
!         tkwidgets_draw_iolets((t_object*)x, x->x_glist, 
                                x->canvas_id, x->iolets_tag, x->all_tag,
                                x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
***************
*** 612,616 ****
--- 613,622 ----
  {
      if(s != &s_)
+     {
+         binbuf_clear(x->options_binbuf);
          binbuf_restore(x->options_binbuf, argc, argv);
+     }
+     else
+         post("ERROR: does this ever happen?");
  }
  
***************
*** 641,657 ****
      t_canvas *canvas = (glist_isvisible(x->x_glist) ? x->x_canvas : 0);
      int newstate = (int)f;
!     if (x->x_resizing && newstate == 0)
      {
!         if (canvas)
!         {
!             tkwidgets_draw_inlets((t_object*)x, canvas,
!                                   x->canvas_id, x->iolets_tag, x->all_tag,
!                                   x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
!             canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
!         }
      }
!     else if (!x->x_resizing && newstate)
      {
!         tkwidgets_erase_inlets(x->canvas_id, x->iolets_tag);
      }
      x->x_resizing = newstate;
--- 647,660 ----
      t_canvas *canvas = (glist_isvisible(x->x_glist) ? x->x_canvas : 0);
      int newstate = (int)f;
!     if (x->x_resizing && !newstate && canvas)
      {
!         tkwidgets_draw_iolets((t_object*)x, canvas,
!                               x->canvas_id, x->iolets_tag, x->all_tag,
!                               x->width, x->height, TOTAL_INLETS, TOTAL_OUTLETS);
!         canvas_fixlinesfor(x->x_glist, (t_text *)x);  // 2nd inlet
      }
!     if (!x->x_resizing && newstate)
      {
!         tkwidgets_erase_iolets(x->canvas_id, x->iolets_tag);
      }
      x->x_resizing = newstate;
***************
*** 708,715 ****
          x->have_scrollbars = atom_getint(argv + 2);
          if(argc > 3) 
-         {
              binbuf_add(x->options_binbuf, argc - 3, argv + 3);
- //TODO            tkwidgets_restore_options(x->receive_name, x->widget_id);
-         }
  	}	
  
--- 711,715 ----





More information about the Pd-cvs mailing list