Update of /cvsroot/pure-data/externals/bbogart/entry In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13010
Modified Files: entry-help.pd entry.c Log Message: changed [add( to [append( and added [key( method for inputting individual keys; removed mousefocus since I found a fix inside u_main.tk -> pdtk_canvas_click
Index: entry.c =================================================================== RCS file: /cvsroot/pure-data/externals/bbogart/entry/entry.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** entry.c 29 Oct 2007 17:44:23 -0000 1.21 --- entry.c 30 Oct 2007 03:59:52 -0000 1.22 *************** *** 22,31 **** #include <string.h>
! /* TODO: make "display only" option, to force box to never accept focus */ ! /* TODO: make focus option only accept regular and shifted chars, not Cmd, Alt, Ctrl */ ! /* TODO: make entry_save include whole classname, including namespace prefix */ /* TODO: make [size( message redraw object */ /* TODO: set message doesnt work with a loadbang */ - /* TODO: make message to add a single character to the existing text */ /* TODO: complete inlet draw/erase logic */
--- 22,28 ---- #include <string.h>
! /* TODO: get Ctrl-A working to select all */ /* TODO: make [size( message redraw object */ /* TODO: set message doesnt work with a loadbang */ /* TODO: complete inlet draw/erase logic */
*************** *** 41,45 **** #define BACKGROUNDCOLOR "grey70"
! #define DEBUG(x) x
typedef struct _entry --- 38,42 ---- #define BACKGROUNDCOLOR "grey70"
! #define DEBUG(x)
typedef struct _entry *************** *** 266,273 **** 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("bind .x%x.c.s%x.text <Leave> {focus [winfo parent .x%x.c.s%x]} \n", - canvas, x, canvas, x);); - sys_vgui("bind .x%x.c.s%x.text <Leave> {focus [winfo parent .x%x.c.s%x]} \n", - canvas, x, canvas, x); 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); --- 263,266 ---- *************** *** 423,429 **** }
! static void entry_add(t_entry* x, t_symbol *s, int argc, t_atom *argv) { ! DEBUG(post("entry_add");); int i; t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */ --- 416,422 ---- }
! static void entry_append(t_entry* x, t_symbol *s, int argc, t_atom *argv) { ! DEBUG(post("entry_append");); int i; t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */ *************** *** 455,458 **** --- 448,486 ---- }
+ static void entry_key(t_entry* x, t_symbol *s, int argc, t_atom *argv) + { + DEBUG(post("entry_key");); + t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */ + t_int tmp_int; + + tmp_symbol = atom_getsymbolarg(0, argc, argv); + if(tmp_symbol == &s_) + { + tmp_int = (t_int) atom_getfloatarg(0, argc , argv); + 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 ); + } + /* Clear the contents of the text widget */ static void entry_clear(t_entry* x) *************** *** 469,473 ****
entry_clear(x); ! entry_add(x, s, argc, argv); }
--- 497,501 ----
entry_clear(x); ! entry_append(x, s, argc, argv); }
*************** *** 724,729 **** 0); ! class_addmethod(entry_class, (t_method)entry_add, ! gensym("add"), A_GIMME, 0); --- 752,762 ---- 0); ! class_addmethod(entry_class, (t_method)entry_append, ! gensym("append"), ! A_GIMME, ! 0); ! ! class_addmethod(entry_class, (t_method)entry_key, ! gensym("key"), A_GIMME, 0);
Index: entry-help.pd =================================================================== RCS file: /cvsroot/pure-data/externals/bbogart/entry/entry-help.pd,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** entry-help.pd 28 Oct 2007 05:53:08 -0000 1.8 --- entry-help.pd 30 Oct 2007 03:59:52 -0000 1.9 *************** *** 1,27 **** ! #N canvas 172 88 748 676 10; ! #X obj 73 212 entry 150 100 grey black; #X obj 11 84 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; ! #X obj 32 346 print; ! #X msg 100 95 clear; ! #X msg 157 99 set one two three four five six; ! #X msg 72 50 fgcolour yellow; ! #X msg 50 23 bgcolour purple; #X obj 142 462 entry 100 50 grey70 purple; ! #X text 8 365 Creation arguments are: width height bgcolor fgcolor. The width and height are in pixels.; #X obj 251 254 select return; ! #X obj 79 347 pddp/print; ! #X obj 176 173 trigger bang bang; ! #X msg 176 194 clear; #X symbolatom 216 319 10 0 0 1 last_key_typed - -; #X text 255 275 ^-- hit return to output; #X msg 219 430 size 400 200; ! #X msg 29 4 bgcolour grey; ! #X msg 84 71 fgcolour black; #X text 12 394 The size message currently only takes affect after a save and reopen.; ! #X msg 169 127 add seven eight nine; ! #X msg 196 149 add ten eleven.; #X msg 30 459 fontsize $1; #X msg 52 432 12; --- 1,27 ---- ! #N canvas 172 88 781 680 10; ! #X obj 72 208 entry 150 100 grey black; #X obj 11 84 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; ! #X obj 32 316 print; ! #X msg 109 73 clear; ! #X msg 127 94 set one two three four five six; ! #X msg 31 29 fgcolour yellow; ! #X msg 94 4 bgcolour purple; #X obj 142 462 entry 100 50 grey70 purple; ! #X text 9 355 Creation arguments are: width height bgcolor fgcolor. The width and height are in pixels.; #X obj 251 254 select return; ! #X obj 79 317 pddp/print; ! #X obj 218 165 trigger bang bang; ! #X msg 218 186 clear; #X symbolatom 216 319 10 0 0 1 last_key_typed - -; #X text 255 275 ^-- hit return to output; #X msg 219 430 size 400 200; ! #X msg 6 4 bgcolour grey; ! #X msg 52 52 fgcolour black; #X text 12 394 The size message currently only takes affect after a save and reopen.; ! #X msg 138 117 append seven eight nine; ! #X msg 142 137 append ten eleven.; #X msg 30 459 fontsize $1; #X msg 52 432 12; *************** *** 30,34 **** #X obj 166 18 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/text.htm ; ! #X obj 572 91 entry 300 50 grey70 black; #X msg 572 67 option relief $1; #X obj 571 46 symbol; --- 30,34 ---- #X obj 166 18 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/text.htm ; ! #X obj 442 91 entry 300 50 grey70 black; #X msg 572 67 option relief $1; #X obj 571 46 symbol; *************** *** 39,58 **** #X msg 640 10 solid; #X msg 681 10 sunken; ! #X obj 366 524 entry 124 100 grey70 black; ! #X obj 368 468 symbol; ! #X obj 558 526 entry 124 100 grey70 black; ! #X obj 558 478 symbol; ! #X msg 541 454 on; ! #X msg 575 453 off; ! #X msg 349 443 normal; ! #X msg 395 443 disabled; ! #X msg 367 491 option state $1; ! #X msg 558 500 option undo $1; #X msg 132 430 size 100 50; ! #X text 421 470 disable editing; ! #X text 608 469 turn on undo; #X obj 572 217 entry 100 50 grey70 black; #X obj 571 172 symbol; ! #X obj 502 394 entry 100 50 grey70 black; #X obj 501 349 symbol; #X msg 572 193 option wrap $1; --- 39,56 ---- #X msg 640 10 solid; #X msg 681 10 sunken; ! #X obj 611 524 symbol; ! #X obj 482 525 symbol; ! #X msg 465 501 on; ! #X msg 499 500 off; ! #X msg 592 499 normal; ! #X msg 638 499 disabled; ! #X msg 610 547 option state $1; ! #X msg 482 547 option undo $1; #X msg 132 430 size 100 50; ! #X text 664 526 disable editing; ! #X text 525 526 turn on undo; #X obj 572 217 entry 100 50 grey70 black; #X obj 571 172 symbol; ! #X obj 447 394 entry 250 80 grey70 black; #X obj 501 349 symbol; #X msg 572 193 option wrap $1; *************** *** 76,80 **** #X obj 52 601 entry 100 50 grey70 black; #X obj 51 556 symbol; ! #X obj 161 636 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm ; #X msg 49 521 boat; --- 74,78 ---- #X obj 52 601 entry 100 50 grey70 black; #X obj 51 556 symbol; ! #X obj 39 650 pddp/pddplink http://tcl.tk/man/tcl8.4/TkCmd/cursors.htm ; #X msg 49 521 boat; *************** *** 98,101 **** --- 96,110 ---- #X obj 395 346 tgl 15 0 empty empty empty 0 -6 0 10 -262144 -1 -1 0 1; + #X msg 129 171 key a; + #X msg 170 171 key 32; + #X obj 342 510 keyup; + #X msg 342 549 key $1; + #X floatatom 359 531 5 0 0 0 - - -; + #X msg 269 210 key 3322; + #X obj 550 586 entry 100 50 grey70 purple; + #X obj 342 584 entry 100 50 grey70 black; + #X text 337 488 type single chars:; + #X msg 411 535 key a; + #X msg 412 557 key 9; #X connect 0 0 2 0; #X connect 0 0 10 0; *************** *** 128,170 **** #X connect 33 0 28 0; #X connect 34 0 28 0; ! #X connect 36 0 43 0; ! #X connect 38 0 44 0; ! #X connect 39 0 38 0; ! #X connect 40 0 38 0; ! #X connect 41 0 36 0; ! #X connect 42 0 36 0; ! #X connect 43 0 35 0; ! #X connect 44 0 37 0; ! #X connect 45 0 7 0; ! #X connect 49 0 52 0; ! #X connect 51 0 57 0; ! #X connect 52 0 48 0; ! #X connect 53 0 49 0; ! #X connect 54 0 49 0; ! #X connect 55 0 49 0; ! #X connect 57 0 50 0; ! #X connect 58 0 51 0; ! #X connect 59 0 51 0; ! #X connect 60 0 51 0; ! #X connect 61 0 51 0; ! #X connect 63 0 51 0; ! #X connect 64 0 51 0; ! #X connect 65 0 51 0; ! #X connect 67 0 84 0; ! #X connect 69 0 73 0; ! #X connect 71 0 69 0; ! #X connect 72 0 69 0; ! #X connect 73 0 68 0; ! #X connect 75 0 69 0; ! #X connect 76 0 69 0; ! #X connect 77 0 69 0; ! #X connect 78 0 69 0; ! #X connect 79 0 69 0; ! #X connect 80 0 69 0; ! #X connect 81 0 69 0; ! #X connect 83 0 69 0; ! #X connect 84 0 66 0; ! #X connect 85 0 86 0; ! #X connect 86 0 26 0; ! #X connect 87 0 50 0; ! #X connect 88 0 87 0; --- 137,187 ---- #X connect 33 0 28 0; #X connect 34 0 28 0; ! #X connect 35 0 41 0; ! #X connect 36 0 42 0; ! #X connect 37 0 36 0; ! #X connect 38 0 36 0; ! #X connect 39 0 35 0; ! #X connect 40 0 35 0; ! #X connect 41 0 93 0; ! #X connect 42 0 93 0; ! #X connect 43 0 7 0; ! #X connect 47 0 50 0; ! #X connect 49 0 55 0; ! #X connect 50 0 46 0; ! #X connect 51 0 47 0; ! #X connect 52 0 47 0; ! #X connect 53 0 47 0; ! #X connect 55 0 48 0; ! #X connect 56 0 49 0; ! #X connect 57 0 49 0; ! #X connect 58 0 49 0; ! #X connect 59 0 49 0; ! #X connect 61 0 49 0; ! #X connect 62 0 49 0; ! #X connect 63 0 49 0; ! #X connect 65 0 82 0; ! #X connect 67 0 71 0; ! #X connect 69 0 67 0; ! #X connect 70 0 67 0; ! #X connect 71 0 66 0; ! #X connect 73 0 67 0; ! #X connect 74 0 67 0; ! #X connect 75 0 67 0; ! #X connect 76 0 67 0; ! #X connect 77 0 67 0; ! #X connect 78 0 67 0; ! #X connect 79 0 67 0; ! #X connect 81 0 67 0; ! #X connect 82 0 64 0; ! #X connect 83 0 84 0; ! #X connect 84 0 26 0; ! #X connect 85 0 48 0; ! #X connect 86 0 85 0; ! #X connect 87 0 0 0; ! #X connect 88 0 0 0; ! #X connect 89 0 90 0; ! #X connect 89 0 91 0; ! #X connect 90 0 94 0; ! #X connect 92 0 0 0; ! #X connect 96 0 94 0; ! #X connect 97 0 94 0;