[PD-cvs] SF.net SVN: pure-data:[10629] trunk/externals/pdvjtools/pix_preview/ pix_preview.tk2c

lluisbigorda at users.sourceforge.net lluisbigorda at users.sourceforge.net
Sun Jan 25 02:30:08 CET 2009


Revision: 10629
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10629&view=rev
Author:   lluisbigorda
Date:     2009-01-25 01:30:08 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
new tcl-socket procedure to get frame-data and paint into canvas

Modified Paths:
--------------
    trunk/externals/pdvjtools/pix_preview/pix_preview.tk2c

Modified: trunk/externals/pdvjtools/pix_preview/pix_preview.tk2c
===================================================================
--- trunk/externals/pdvjtools/pix_preview/pix_preview.tk2c	2009-01-25 01:16:22 UTC (rev 10628)
+++ trunk/externals/pdvjtools/pix_preview/pix_preview.tk2c	2009-01-25 01:30:08 UTC (rev 10629)
@@ -1,66 +1,34 @@
-// ########### colorgrid procedures -- ydegoyon at free.fr #########
-sys_gui("package require Img\n");
-sys_gui("proc colorgrid_apply {id} {\n");
-// strip "." from the TK id to make a variable name suffix
-sys_gui("set vid [string trimleft $id .]\n");
-// for each variable, make a local variable to hold its name...
-sys_gui("set var_graph_colorgrid [concat graph_colorgrid_$vid]\n");
-sys_gui("global $var_graph_colorgrid\n");
-sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n");
-sys_gui("global $var_graph_xlines\n");
-sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n");
-sys_gui("global $var_graph_ylines\n");
-sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_xlines] [eval concat $$var_graph_ylines] [eval concat $$var_graph_colorgrid] \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc colorgrid_cancel {id} {\n");
-sys_gui("set cmd [concat $id cancel \\;]\n");
-// puts stderr $cmd
-sys_gui("pd $cmd\n");
-sys_gui("}\n");
-sys_gui("proc colorgrid_ok {id} {\n");
-sys_gui("colorgrid_apply $id\n");
-sys_gui("colorgrid_cancel $id\n");
-sys_gui("}\n");
-sys_gui("proc pdtk_colorgrid_dialog {id xlines ylines colorgrid} {\n");
-sys_gui("set vid [string trimleft $id .]\n");
-sys_gui("set var_graph_colorgrid [concat graph_colorgrid_$vid]\n");
-sys_gui("global $var_graph_colorgrid\n");
-sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n");
-sys_gui("global $var_graph_xlines\n");
-sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n");
-sys_gui("global $var_graph_ylines\n");
-sys_gui("set $var_graph_colorgrid $colorgrid\n");
-sys_gui("set $var_graph_xlines $xlines\n");
-sys_gui("set $var_graph_ylines $ylines\n");
-sys_gui("toplevel $id\n");
-sys_gui("wm title $id {colorgrid}\n");
-sys_gui("wm protocol $id WM_DELETE_WINDOW [concat colorgrid_cancel $id]\n");
-sys_gui("label $id.label -text {COLORGRID PROPERTIES}\n");
-sys_gui("pack $id.label -side top\n");
-sys_gui("frame $id.buttonframe\n");
-sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n");
-sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"colorgrid_cancel $id\"\n");
-sys_gui("button $id.buttonframe.apply -text {Apply} -command \"colorgrid_apply $id\"\n");
-sys_gui("button $id.buttonframe.ok -text {OK} -command \"colorgrid_ok $id\"\n");
-sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.apply -side left -expand 1\n");
-sys_gui("pack $id.buttonframe.ok -side left -expand 1\n");
-sys_gui("frame $id.42rangef\n");
-sys_gui("pack $id.42rangef -side top\n");
-sys_gui("label $id.42rangef.lxlines -text \"X sections :\"\n");
-sys_gui("entry $id.42rangef.xlines -textvariable $var_graph_xlines -width 7\n");
-sys_gui("pack $id.42rangef.lxlines $id.42rangef.xlines -side left\n");
-sys_gui("frame $id.72rangef\n");
-sys_gui("pack $id.72rangef -side top\n");
-sys_gui("label $id.72rangef.lylines -text \"Y sections :\"\n");
-sys_gui("entry $id.72rangef.ylines -textvariable $var_graph_ylines -width 7\n");
-sys_gui("pack $id.72rangef.lylines $id.72rangef.ylines -side left\n");
-sys_gui("checkbutton $id.showcolorgrid -text {Show Grid} -variable $var_graph_colorgrid -anchor w\n");
-sys_gui("pack $id.showcolorgrid -side top\n");
-sys_gui("bind $id.42rangef.xlines <KeyPress-Return> [concat colorgrid_ok $id]\n");
-sys_gui("bind $id.72rangef.ylines <KeyPress-Return> [concat colorgrid_ok $id]\n");
-sys_gui("focus $id.42rangef.xlines\n");
-sys_gui("}\n");
-// ########### colorgrid procedures END -- lluis at artefacte.org #########
+sys_vgui("package require Img\n");
+sys_vgui("proc Echo_Server%d {port} {\n", whoami);
+sys_vgui("    set s [socket -server EchoAccept%d $port]\n", whoami);
+sys_vgui("    puts \"server%d socket created on port $port\"\n", whoami);
+sys_vgui("}\n");
+sys_vgui("proc EchoAccept%d {sock addr port} {\n", whoami);
+sys_vgui("    global echo\n");
+sys_vgui("    # Record the client's information\n");
+sys_vgui("    puts \"Accept $sock from $addr port $port\"\n");
+sys_vgui("    set echo(addr,$sock) [list $addr $port]\n");
+sys_vgui("    # Ensure that each \"puts\" by the server\n");
+sys_vgui("    # results in a network transmission\n");
+sys_vgui("    fconfigure $sock -buffering line\n");
+sys_vgui("    # Set up a callback for when the client sends data\n");
+sys_vgui("    fileevent $sock readable [list Echo%d $sock]\n", whoami);
+sys_vgui("}\n");
+sys_vgui("# Echo --\n");
+sys_vgui("#	This procedure is called when the server\n");
+sys_vgui("#	can read data from the client\n");
+sys_vgui("# Arguments:\n");
+sys_vgui("#	sock	The socket connection to the client\n");
+sys_vgui("proc Echo%d {sock} {\n", whoami);
+sys_vgui("    global echo\n");
+sys_vgui("    # Check end of file or abnormal connection drop,\n");
+sys_vgui("    # then echo data back to the client.\n");
+sys_vgui("    if {[eof $sock] || [catch {gets $sock line}]} {\n");
+sys_vgui("	close $sock\n");
+sys_vgui("	puts \"Close $echo(addr,$sock)\"\n");
+sys_vgui("	unset echo(addr,$sock)\n");
+sys_vgui("    } else {\n");
+sys_vgui("	#puts $sock $line\n");
+sys_vgui("	imgPREVIEW%d put $line\n", whoami);
+sys_vgui("    }\n");
+sys_vgui("}\n");


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list