Update of /cvsroot/pure-data/externals/tkwidgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26617
Modified Files: text-test.pd text.c Log Message: got bulk and individual querying working
Index: text-test.pd =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/text-test.pd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** text-test.pd 14 Nov 2007 02:53:03 -0000 1.1 --- text-test.pd 14 Nov 2007 06:16:12 -0000 1.2 *************** *** 2,6 **** #X obj 130 117 text 130 60; #X msg 47 29 size 100 100; ! #X obj 73 543 text 200 50; #X msg 130 30 size 400 200; #X obj 310 11 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 --- 2,6 ---- #X obj 130 117 text 130 60; #X msg 47 29 size 100 100; ! #X obj 48 540 text 130 60; #X msg 130 30 size 400 200; #X obj 310 11 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 *************** *** 20,25 **** --- 20,35 ---- #X msg 272 425 size 200 50; #X msg 89 490 font Arial 16; + #X obj 200 612 print QUERY; + #X floatatom 309 620 5 0 0 0 - - -; + #X obj 309 596 route highlightthickness font; + #X obj 396 624 pddp/print; + #X msg 421 372 width 8; + #X obj 309 642 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 + -1 -1; + #X msg 114 435 query highlightthickness; + #X msg 143 458 query; #X connect 0 1 6 0; #X connect 1 0 0 0; + #X connect 2 1 18 0; #X connect 3 0 0 0; #X connect 4 0 5 0; *************** *** 33,34 **** --- 43,50 ---- #X connect 14 0 2 0; #X connect 15 0 2 0; + #X connect 17 0 21 0; + #X connect 18 0 17 0; + #X connect 18 1 19 0; + #X connect 20 0 2 0; + #X connect 22 0 2 0; + #X connect 23 0 2 0;
Index: text.c =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/text.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** text.c 14 Nov 2007 03:51:35 -0000 1.2 --- text.c 14 Nov 2007 06:16:12 -0000 1.3 *************** *** 48,51 **** --- 48,54 ---- t_symbol* receive_name;
+ int optionc; + t_atom* optionv; + int x_height; int x_width; *************** *** 150,153 **** --- 153,186 ----
/* widget helper functions */ + + static void save_options(t_textwidget *x, int argc, char** argv) + { + int i; + post("total options: %d", argc); + for(i = 0; i < argc; i++) + { + // sys_vgui("lappend ::%s::optionsList %s \n", x->tcl_namespace, argv[i]); + sys_vgui("pd [concat %s query_callback %s [%s cget -%s] \;]\n", + x->receive_name->s_name, argv[i], x->text_id, argv[i]); + post("option %d: %s", i, argv[i]); + } + /* sys_vgui("foreach ::%s::option $::%s::optionsList {\n",x->tcl_namespace,x->tcl_namespace); */ + /* sys_vgui("pd [concat %s query_callback $::%s::option [%s cget [format "-%%s" $::%s::option]] \;]\n", */ + /* x->receive_name->s_name, x->tcl_namespace, x->text_id, x->tcl_namespace); */ + // sys_vgui("puts stderr [concat %s query_callback $::%s::option [%s cget [format "-%%s" $::%s::option]] \;] \n", + // x->receive_name->s_name, x->tcl_namespace, x->text_id, x->tcl_namespace); + /* sys_gui("}\n"); */ + /* sys_vgui("unset ::%s::optionsList \n", x->tcl_namespace); */ + } + + static void query_options(t_textwidget *x, int argc, char** argv) + { + int i; + post("total options: %d", argc); + for(i = 0; i < argc; i++) + sys_vgui("pd [concat %s query_callback %s [%s cget -%s] \;]\n", + x->receive_name->s_name, argv[i], x->text_id, argv[i]); + } + static void set_tk_widget_ids(t_textwidget *x, t_canvas *canvas) { *************** *** 632,635 **** --- 665,677 ---- }
+ static void textwidget_query(t_textwidget *x, t_symbol *s) + { + post("textwidget_query %s", s->s_name); + if(s == &s_) + query_options(x, sizeof(textwidget_tk_options)/sizeof(char *), textwidget_tk_options); + else + query_options(x, 1, &(s->s_name)); + } + static void textwidget_scrollbar(t_textwidget *x, t_float f) { *************** *** 671,674 **** --- 713,731 ----
/* callback functions */ + + static void textwidget_query_callback(t_textwidget *x, t_symbol *s, int argc, t_atom *argv) + { + t_symbol *tmp_symbol = atom_getsymbolarg(0, argc, argv); + if(tmp_symbol != &s_) + { + post("tmp_symbol %s argc %d", tmp_symbol->s_name, argc); + outlet_anything(x->x_status_outlet, tmp_symbol, argc - 1, argv + 1); + } + else + { + post("textwidget_query_callback %s %d", s->s_name, argc); + } + } + static void textwidget_click_callback(t_textwidget *x, t_floatarg f) { *************** *** 760,771 **** x->x_glist = canvas_getcurrent(); set_tk_widget_ids(x, x->x_glist); - - int i; - int option_argc = sizeof(textwidget_tk_options)/sizeof(char *); - post("total options: %d", option_argc); - for(i = 0; i < option_argc; i++) - { - post("option %d: %s", i, textwidget_tk_options[i]); - }
return (x); --- 817,820 ---- *************** *** 781,784 **** --- 830,835 ----
+ class_addmethod(textwidget_class, (t_method)textwidget_query, + gensym("query"), A_DEFSYMBOL, 0); class_addmethod(textwidget_class, (t_method)textwidget_scrollbar, gensym("scrollbar"), A_DEFFLOAT, 0); *************** *** 798,801 **** --- 849,854 ---- gensym("clear"), 0); /* callbacks */ + class_addmethod(textwidget_class, (t_method)textwidget_query_callback, + gensym("query_callback"), A_GIMME, 0); class_addmethod(textwidget_class, (t_method)textwidget_keyup_callback, gensym("keyup"), A_DEFFLOAT, 0);