Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20096
Modified Files: Tag: desiredata desire.tk builtins.c Log Message: added [clipboard] object
Index: desire.tk =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.tk,v retrieving revision 1.1.2.600.2.337 retrieving revision 1.1.2.600.2.338 diff -C2 -d -r1.1.2.600.2.337 -r1.1.2.600.2.338 *** desire.tk 9 Aug 2007 20:20:31 -0000 1.1.2.600.2.337 --- desire.tk 10 Aug 2007 03:32:13 -0000 1.1.2.600.2.338 *************** *** 5024,5027 **** --- 5024,5043 ---- }
+ def Canvas get_clipboard {obj} { + puts "get clipboard" + set content [clipboard get] + set l {}; set s ""; set space " "; + set last_newline [string last ";" $content] + #foreach char [split $content ""] {lappend l [scan $char %c]} + set i 0 + foreach char [split $content ""] { + if {$i == $last_newline} {break} + if {$char == ";"} {set s ${s}${space}list} {set s ${s}$char} + incr i + } + netsend [list .$obj clipboard_set $s] + } + + def Canvas macro_schedule {delay obj} { if {[llength $@macro_q]} {
Index: builtins.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/builtins.c,v retrieving revision 1.1.2.57 retrieving revision 1.1.2.58 diff -C2 -d -r1.1.2.57 -r1.1.2.58 *** builtins.c 9 Aug 2007 21:25:12 -0000 1.1.2.57 --- builtins.c 10 Aug 2007 03:32:15 -0000 1.1.2.58 *************** *** 1012,1016 **** }
! /*-----------------*/
/* MSW and OSX don't appear to have single-precision ANSI math */ --- 1012,1043 ---- }
! /*---- Clipboard ----*/ ! static t_class *clipboard_class; ! struct t_clipboard : t_object { ! t_binbuf *alist; ! t_symbol *sym; ! t_outlet *dump; ! }; ! ! static void *clipboard_new(t_symbol *s) { ! t_clipboard *x = (t_clipboard *)pd_new(clipboard_class); ! if (*s->name) x->sym = s; ! else x->sym = gensym("clipboard"); ! x->alist = binbuf_new(); ! x->dump = outlet_new(x,&s_list); ! return x; ! } ! ! static void clipboard_bang(t_clipboard *x) {sys_mgui(x->dix->canvas, "get_clipboard", "p", x);} ! ! static void clipboard_reply (t_clipboard *x, t_symbol *s, int argc, t_atom *argv) { ! outlet_list(x->dump, &s_list, argc, argv); ! } ! ! static void clipboard_setup() { ! t_class *c = clipboard_class = class_new2("clipboard",clipboard_new,0,sizeof(t_clipboard),0,"S"); ! class_addbang(c, clipboard_bang); ! class_addmethod2(c, clipboard_reply,"clipboard_set","*"); ! }
/* MSW and OSX don't appear to have single-precision ANSI math */ *************** *** 2898,2901 **** --- 2925,2929 ---- print_setup(); macro_setup(); + clipboard_setup(); delay_setup(); metro_setup();