From: <arj...@us...> - 2013-11-21 11:06:14
|
Revision: 12731 http://sourceforge.net/p/plplot/code/12731 Author: arjenmarkus Date: 2013-11-21 11:06:09 +0000 (Thu, 21 Nov 2013) Log Message: ----------- Make the pausing in running the Tk examples optional. The pausing may occur both in the examples themselves via the plspause command and by the plxframe widget. It is made optional via the auxiliary command ::plw::set_pause. Also make sure that the standard wish examples are drawn in a window of suitable size (the plstdwin command is responsible for this) Modified Paths: -------------- trunk/bindings/tk/plwidget.tcl trunk/examples/tk/standard_examples.in trunk/examples/tk/tkdemos.tcl Modified: trunk/bindings/tk/plwidget.tcl =================================================================== --- trunk/bindings/tk/plwidget.tcl 2013-11-21 02:52:05 UTC (rev 12730) +++ trunk/bindings/tk/plwidget.tcl 2013-11-21 11:06:09 UTC (rev 12731) @@ -2,7 +2,7 @@ #---------------------------------------------------------------------------- # PLPLOT TK/TCL graphics renderer # plplot window initialization procs -# +# # Maurice LeBrun # IFS, University of Texas at Austin # 29-May-1993 @@ -10,7 +10,7 @@ # Note: to keep namespace problems to a minimum, all procs defined here begin # with "pl". These are further subdivided into "plw::" for button- or # menu-accessible commands, or "pl_" for utility commands. -# +# # anything in 'plw::' should really be considered private. If they are # needed externally (i.e. in user code) then we should rename them or expose # them. @@ -131,6 +131,7 @@ # Set up bop/eop handling when running tcl scripts from a plserver global plstate_bopseen; set plstate_bopseen($w) 0 + global plstate_pause; set plstate_pause($w) 1 $w.plwin configure -bopcmd "plw::bop $w" $w.plwin configure -eopcmd "plw::eop $w" } @@ -141,6 +142,7 @@ #---------------------------------------------------------------------------- # plw::setup_defaults # plw::set_zoom_handler +# plw::set_pause # # Set up default settings. #---------------------------------------------------------------------------- @@ -221,6 +223,12 @@ set user_zoom_handler($w) $zoom_handler } +proc plw::set_pause {w pause} { + global plstate_pause + + set plstate_pause($w) $pause +} + #---------------------------------------------------------------------------- # plw::create_TopRow # @@ -276,7 +284,7 @@ label $w.ftop.lstat -anchor w -relief raised plw::label_push $w "[string range $w 1 end]" pack append $w.ftop $w.ftop.lstat \ - {right expand fill} + {right expand fill} } #---------------------------------------------------------------------------- @@ -423,7 +431,7 @@ proc plw::create_pmenu_orient {w} { global pmenu; set m $pmenu($w).orient - $pmenu($w) add cascade -label "Orient" -menu $m + $pmenu($w) add cascade -label "Orient" -menu $m menu $m $m configure -postcommand "plw::update_orient $w" @@ -595,10 +603,10 @@ # Set up palette tools $m add command -label "Palette 0" \ - -command "plcmap0_edit $w.plwin $w" + -command "plcmap0_edit $w.plwin $w" $m add command -label "Palette 1" \ - -command "plcmap1_edit $w.plwin $w" + -command "plcmap1_edit $w.plwin $w" # Palettes - options (another cascade) @@ -696,7 +704,7 @@ global key_resume global key_zoom_select global key_zoom_back - global key_zoom_forward + global key_zoom_forward global key_zoom_reset global key_print global key_save_again @@ -734,7 +742,7 @@ $key_scroll_right "plw::view_scroll $w 1 0 $state" \ $key_scroll_left "plw::view_scroll $w -1 0 $state" \ $key_scroll_up "plw::view_scroll $w 0 -1 $state" \ - $key_scroll_down "plw::view_scroll $w 0 1 $state" + $key_scroll_down "plw::view_scroll $w 0 1 $state" # Pass keypress event info back to client. @@ -823,11 +831,11 @@ proc plw::bop {w} { global plot_menu_on; if !$plot_menu_on return - global plstate_resume plstate_bopseen + global plstate_resume plstate_bopseen plstate_pause # There was a previous bop, deal with it. - if $plstate_bopseen($w) { + if {$plstate_bopseen($w)} { update idletasks plw::label_push $w "press <Enter> to continue." tkwait variable plstate_resume($w) @@ -847,7 +855,7 @@ # i.e. control is returned to the interpreter before the next time this proc # is called, there will be no pause. - set plstate_bopseen($w) 1 + set plstate_bopseen($w) $plstate_pause($w) set id2 [after idle "global plstate_bopseen; set plstate_bopseen($w) 0"] } @@ -882,7 +890,7 @@ # # The closelink command was added in the hopes of making the dp driver # cleanup a bit more robust, but doesn't seem to have any effect except -# to slow things down quite a bit. +# to slow things down quite a bit. #---------------------------------------------------------------------------- proc plw::end {w} { @@ -1195,7 +1203,7 @@ # zoomopts($w,1): # 0 first and last points specified determine opposite corners # of zoom box. -# 1 box is centered about the first point clicked on, +# 1 box is centered about the first point clicked on, # perimeter follows mouse (default) # #---------------------------------------------------------------------------- @@ -1438,7 +1446,7 @@ #---------------------------------------------------------------------------- proc plw::view_select {w x0 y0 x1 y1} { - + # Adjust arguments to be in bounds and properly ordered (xl < xr, etc) set xl [min $x0 $x1] @@ -1504,7 +1512,7 @@ if { $nxl < 0.0 } then { set nxl 0.0 set nxr [expr 2.0 * $xl] - } + } if { $nxr > 1.0 } then { set nxr 1.0 set nxl [expr 2.0 * $xl - 1.0] @@ -1700,7 +1708,7 @@ #---------------------------------------------------------------------------- proc plw::fixview {w hscroll vscroll} { - + # Create scrollbars if they don't already exist. set created_sb 0 @@ -1825,11 +1833,11 @@ global plot_menu_on; if !$plot_menu_on return global plmenu_lstat plmenu_lstat_depth - if { ![info exists plmenu_lstat_depth] || ![info exists plmenu_lstat_depth($w)] } { + if { ![info exists plmenu_lstat_depth] || ![info exists plmenu_lstat_depth($w)] } { set plmenu_lstat_depth($w) -1 } if {$plmenu_lstat_depth($w) < 9} { - incr plmenu_lstat_depth($w) + incr plmenu_lstat_depth($w) } { puts stderr "plw::label_push: you just hit the max stack depth" } @@ -1848,7 +1856,7 @@ global plot_menu_on; if !$plot_menu_on return global plmenu_lstat plmenu_lstat_depth - if ![info exists plmenu_lstat_depth] { + if ![info exists plmenu_lstat_depth] { puts stderr "plw::label_pop: no stack defined yet, strange.." return } Modified: trunk/examples/tk/standard_examples.in =================================================================== --- trunk/examples/tk/standard_examples.in 2013-11-21 02:52:05 UTC (rev 12730) +++ trunk/examples/tk/standard_examples.in 2013-11-21 11:06:09 UTC (rev 12731) @@ -7,6 +7,16 @@ # continued ones with a trailing backslash like this one \ exec @plserver_LOCATION@ -f "$0" "$@" source tkdemos.tcl +# +# Turn off pausing - it has to be done in two ways, as the plxframe uses a visual +# clue and bindings to key press events. +# Note that the widget in question is .plw, not $plwin +# +$plwin cmd plspause 0 +plw::set_pause .plw 0 +# +# Now run the examples one by one +# 0 1 2 Modified: trunk/examples/tk/tkdemos.tcl =================================================================== --- trunk/examples/tk/tkdemos.tcl 2013-11-21 02:52:05 UTC (rev 12730) +++ trunk/examples/tk/tkdemos.tcl 2013-11-21 11:06:09 UTC (rev 12731) @@ -57,7 +57,8 @@ } "*wish*" - "*tclsh*" { - # use 'wish" method + # use 'wish" method (size of the window is determined by plstdwin) + plstdwin . plframe .plw set plwin .plw } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |