[PD-cvs] externals/tkwidgets/shared tkwidgets.c, 1.6, 1.7 tkwidgets.h, 1.6, 1.7
Hans-Christoph Steiner
eighthave at users.sourceforge.net
Thu Nov 22 06:57:48 CET 2007
Update of /cvsroot/pure-data/externals/tkwidgets/shared
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29476/shared
Modified Files:
tkwidgets.c tkwidgets.h
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: tkwidgets.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** tkwidgets.c 22 Nov 2007 02:53:22 -0000 1.6
--- tkwidgets.c 22 Nov 2007 05:57:45 -0000 1.7
***************
*** 44,80 ****
}
! /* this function queries the widget and sends the data to the store_callback */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv)
{
- // build list then send the whole shebang to store_callback
int i;
- post("tkwidgets_store_options total options: %d", argc);
for(i = 0; i < argc; i++)
{
- // TODO: only send if there is a value, not when blank
sys_vgui("set ::%s::ret [%s cget -%s]\n",
tcl_namespace->s_name, widget_id->s_name, argv[i]);
sys_vgui("if {[string length $::%s::ret] > 0} {\n",
tcl_namespace->s_name);
! sys_vgui("lappend ::%s::store_list -%s ; lappend ::%s::store_list $::%s::ret}\n",
tcl_namespace->s_name, argv[i],
tcl_namespace->s_name, tcl_namespace->s_name);
}
! sys_vgui("pd [concat %s store_callback $::%s::store_list \\;]\n",
receive_name->s_name, tcl_namespace->s_name);
! sys_vgui("unset ::%s::store_list \n", tcl_namespace->s_name);
}
! void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *widget_id,
! int argc, char** argv)
{
! int i;
! for(i = 0; i < argc; i++)
! {
! // TODO parse out -flags and values, and set them here:
! sys_vgui("%s configure %s\n",
! widget_id->s_name, argv[i]);
! }
}
--- 44,76 ----
}
! /* this queries the widget for each option listed in the tk_options struct,
! * builts a list in Tcl-space, then send that list to the store_callback */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv)
{
int i;
for(i = 0; i < argc; i++)
{
sys_vgui("set ::%s::ret [%s cget -%s]\n",
tcl_namespace->s_name, widget_id->s_name, argv[i]);
sys_vgui("if {[string length $::%s::ret] > 0} {\n",
tcl_namespace->s_name);
! sys_vgui("lappend ::%s::list -%s; lappend ::%s::list $::%s::ret}\n",
tcl_namespace->s_name, argv[i],
tcl_namespace->s_name, tcl_namespace->s_name);
}
! sys_vgui("pd [concat %s store_callback $::%s::list \\;]\n",
receive_name->s_name, tcl_namespace->s_name);
! sys_vgui("unset ::%s::list \n", tcl_namespace->s_name);
}
! void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *tcl_namespace,
! t_symbol *widget_id, t_binbuf *options_binbuf)
{
! int length;
! char *options;
! binbuf_gettext(options_binbuf, &options, &length);
! options[length] = 0; //binbuf_gettext() doesn't put a null, so we do
! sys_vgui("%s configure %s\n", widget_id->s_name, options);
}
***************
*** 161,165 ****
}
! void tkwidgets_draw_inlets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
--- 157,161 ----
}
! void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
***************
*** 190,194 ****
}
! void tkwidgets_erase_inlets(t_symbol* canvas_id, t_symbol* iolets_tag)
{
sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag);
--- 186,190 ----
}
! void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag)
{
sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag);
Index: tkwidgets.h
===================================================================
RCS file: /cvsroot/pure-data/externals/tkwidgets/shared/tkwidgets.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** tkwidgets.h 22 Nov 2007 02:53:22 -0000 1.6
--- tkwidgets.h 22 Nov 2007 05:57:45 -0000 1.7
***************
*** 72,75 ****
--- 72,77 ----
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv);
+ void tkwidgets_restore_options(t_symbol *receive_name, t_symbol *tcl_namespace,
+ t_symbol *widget_id, t_binbuf *options_binbuf);
void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id,
int argc, char** argv);
***************
*** 90,98 ****
// TODO perhaps I should try to use glist_drawiofor() from g_text.c
! void tkwidgets_draw_inlets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
int total_inlets, int total_outlets);
! void tkwidgets_erase_inlets(t_symbol* canvas_id, t_symbol* iolets_tag);
void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode
--- 92,100 ----
// TODO perhaps I should try to use glist_drawiofor() from g_text.c
! void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height,
int total_inlets, int total_outlets);
! void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag);
void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode
More information about the Pd-cvs
mailing list