Update of /cvsroot/pure-data/externals/tkwidgets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32405
Modified Files: text-help.pd text-test.pd text.c Log Message:
- created text_binbuf to store the text when the text widget doesn't exist so that loadbanging [set( messages can work. The same logic needs to be applied to the options messages too...
Index: text-test.pd =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/text-test.pd,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** text-test.pd 22 Nov 2007 02:53:22 -0000 1.5 --- text-test.pd 27 Nov 2007 06:05:48 -0000 1.6 *************** *** 1,51 **** ! #N canvas 137 196 721 672 10; ! #X obj 256 77 text 400 200 1; ! #X msg 47 29 size 100 100; ! #X obj 48 470 text 130 60 0; ! #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 ! 1; ! #X msg 655 333; ! #X msg 23 245 highlightthickness $1; ! #X obj 26 219 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 ! -1 -1 0 1; ! #X msg 49 290 padx $1; ! #X obj 52 269 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144 ! -1 -1 0 1; ! #X msg 110 405 font "Lucida Sans" 18 bold; ! #X msg 124 429 font Arial 16; ! #X obj 200 542 print QUERY; ! #X floatatom 309 550 5 0 0 0 - - -; ! #X obj 309 526 route highlightthickness font; ! #X obj 396 554 pddp/print; ! #X obj 309 572 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 ! -1 -1; ! #X msg 68 321 query highlightthickness; ! #X msg 78 345 query; ! #X msg 309 31 scrollbars $1; ! #X msg 85 367 query size; ! #X msg 342 369; ! #X obj 310 335 prepend set; ! #X msg 250 41 bang; ! #X connect 0 0 22 0; ! #X connect 0 1 5 0; #X connect 1 0 0 0; ! #X connect 2 1 14 0; ! #X connect 2 1 12 0; ! #X connect 3 0 0 0; ! #X connect 4 0 19 0; #X connect 6 0 2 0; ! #X connect 7 0 6 0; ! #X connect 8 0 2 0; ! #X connect 9 0 8 0; ! #X connect 10 0 2 0; ! #X connect 11 0 2 0; ! #X connect 13 0 16 0; ! #X connect 14 0 13 0; ! #X connect 14 1 15 0; ! #X connect 17 0 2 0; ! #X connect 18 0 2 0; ! #X connect 19 0 0 0; ! #X connect 20 0 2 0; ! #X connect 22 0 21 0; ! #X connect 23 0 0 0; --- 1,21 ---- ! #N canvas 88 197 538 519 10; ! #X obj 165 127 text 227 97 1; ! #X msg 174 40 bang; ! #X msg 289 83 key $1; ! #X msg 273 48 123; ! #X msg 305 48 124; ! #X msg 335 48 125; ! #X msg 242 49 10; ! #X msg 368 47 92; ! #X obj 177 367 text 200 60 0; ! #X obj 190 283 loadbang; ! #X msg 182 319 set blah blah blah; #X connect 1 0 0 0; ! #X connect 2 0 0 0; ! #X connect 3 0 2 0; ! #X connect 4 0 2 0; ! #X connect 5 0 2 0; #X connect 6 0 2 0; ! #X connect 7 0 2 0; ! #X connect 9 0 10 0; ! #X connect 10 0 8 0;
Index: text.c =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/text.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** text.c 27 Nov 2007 05:22:32 -0000 1.19 --- text.c 27 Nov 2007 06:05:48 -0000 1.20 *************** *** 24,28 **** #include "shared/tkwidgets.h"
! /* TODO: set message doesnt work with a loadbang */ /* TODO: window name "handle1376fc00" already exists in parent */ /* TODO: figure out window vs. text width/height */ --- 24,28 ---- #include "shared/tkwidgets.h"
! /* TODO: append options messages to options_binbuf if not visible */ /* TODO: window name "handle1376fc00" already exists in parent */ /* TODO: figure out window vs. text width/height */ *************** *** 49,52 **** --- 49,53 ---- t_glist* x_glist; /* glist that owns this widget */ t_binbuf* options_binbuf;/* binbuf to save options state in */ + t_binbuf* text_binbuf; /* store text on copy/paste and [loadbang] set*/
int width; *************** *** 207,210 **** --- 208,213 ---- static void drawme(t_textwidget *x, t_glist *glist) { + char *buf; + int bufsize; DEBUG(post("drawme: firsttime %d canvas %lx glist %lx", x->x_canvas, glist);); set_tkwidgets_ids(x,glist_getcanvas(glist)); *************** *** 222,225 **** --- 225,232 ---- x->width, x->height); tkwidgets_restore_options(x->widget_id, x->options_binbuf); + binbuf_gettext(x->text_binbuf, &buf, &bufsize); + buf[bufsize] = 0; // binbuf_gettext() doesn't terminate the string + post("%s insert end {%s}\n", x->widget_id->s_name, buf); + sys_vgui("%s insert end {%s}\n", x->widget_id->s_name, buf); }
*************** *** 469,474 **** DEBUG(post("textwidget_set"););
! textwidget_clear(x); ! textwidget_append(x, s, argc, argv); }
--- 476,489 ---- DEBUG(post("textwidget_set"););
! if(glist_isvisible(x->x_glist)) ! { ! textwidget_clear(x); ! textwidget_append(x, s, argc, argv); ! } ! else ! { ! binbuf_clear(x->text_binbuf); ! binbuf_add(x->text_binbuf, argc, argv); ! } }
*************** *** 669,672 **** --- 684,688 ----
x->options_binbuf = binbuf_new(); + x->text_binbuf = binbuf_new();
x->x_selected = 0;
Index: text-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/tkwidgets/text-help.pd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** text-help.pd 27 Nov 2007 05:22:31 -0000 1.4 --- text-help.pd 27 Nov 2007 06:05:48 -0000 1.5 *************** *** 1,8 **** ! #N canvas 343 45 785 704 10; #X obj 52 -43 text 130 60 0; #X obj 53 -193 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 12 65 print; ! #X msg 89 -178 clear; #X msg 107 -157 set one two three four five six; #X obj 36 142 text 130 60 0; --- 1,8 ---- ! #N canvas 245 42 785 704 10; #X obj 52 -43 text 130 60 0; #X obj 53 -193 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 12 65 print; ! #X msg 78 -197 clear; #X msg 107 -157 set one two three four five six; #X obj 36 142 text 130 60 0; *************** *** 173,176 **** --- 173,177 ---- #X connect 14 0 0 0; #X restore 199 -200 pd adding with the key message; + #X obj 107 -177 loadbang; #X connect 0 0 2 0; #X connect 0 0 7 0; *************** *** 245,246 **** --- 246,248 ---- #X connect 92 0 88 0; #X connect 93 0 88 0; + #X connect 95 0 4 0;