From: <ai...@us...> - 2013-11-12 03:22:21
|
Revision: 12678 http://sourceforge.net/p/plplot/code/12678 Author: airwin Date: 2013-11-12 03:22:18 +0000 (Tue, 12 Nov 2013) Log Message: ----------- Use PLPLOT_ITCL_VERSION, PLPLOT_ITK_VERSION, and PLPLOT_IWIDGETS_VERSION (now #defined in C environment) to create Tcl global variables pl_itcl_package_name, pl_itk_package_name, and pl_iwidgets_package_name. Use those global variables containing the package name and version for Itcl, Itk, and Iwidgets wherever the "package require Itcl", "package require Itk", and "package require Iwidgets" were used previously in tcl scripts. Tested by: Alan W. Irwin <ai...@us...> on Linux using the test_interactive target in the build tree. There were no run-time errors, and the "itcl" examples (targets test_tk_02 and test_tk_04) worked without issues, but the "itcl" menu items for colour palette manipulation were missing. Thus, these changes introduce a colour palette regression that needs to be fixed. Modified Paths: -------------- trunk/bindings/tcl/tclAPI.c trunk/bindings/tk/PLWin.itk trunk/bindings/tk/Pltkwin.tcl trunk/bindings/tk/plcolor.tcl trunk/bindings/tk/pltools.tcl trunk/bindings/tk/plwidget.tcl trunk/bindings/tk-x-plat/Memberscope.tcl trunk/bindings/tk-x-plat/Plplotwin.tcl trunk/bindings/tk-x-plat/Plwindow.tcl trunk/bindings/tk-x-plat/plbarchart.tcl trunk/bindings/tk-x-plat/pltimeseries.tcl trunk/bindings/tk-x-plat/plwidget2.tcl trunk/cmake/modules/tcl-related.cmake trunk/examples/tk/tk02.in trunk/examples/tk/tk04.in Modified: trunk/bindings/tcl/tclAPI.c =================================================================== --- trunk/bindings/tcl/tclAPI.c 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tcl/tclAPI.c 2013-11-12 03:22:18 UTC (rev 12678) @@ -443,6 +443,37 @@ Tcl_SetVar( interp, "plversion", PLPLOT_VERSION, TCL_GLOBAL_ONLY ); + if ( strcmp( PLPLOT_ITCL_VERSION, "4.0.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 4", TCL_GLOBAL_ONLY ); + else if ( strcmp( PLPLOT_ITCL_VERSION, "3.0.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl 3", TCL_GLOBAL_ONLY ); + else + // Mark invalid package name in such a way as to cause an error + // when, for example, itcl has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Itcl. + Tcl_SetVar( interp, "pl_itcl_package_name", "Itcl(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + + if ( strcmp( PLPLOT_ITK_VERSION, "4.0.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_itk_package_name", "Itk 4", TCL_GLOBAL_ONLY ); + else if ( strcmp( PLPLOT_ITK_VERSION, "3.0.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_itk_package_name", "Itk 3", TCL_GLOBAL_ONLY ); + else + // Mark invalid package name in such a way as to cause an error + // when, for example, itk has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Itk. + Tcl_SetVar( interp, "pl_itk_package_name", "Itk(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + + if ( strcmp( PLPLOT_IWIDGETS_VERSION, "4.1.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets 4", TCL_GLOBAL_ONLY ); + else if ( strcmp( PLPLOT_IWIDGETS_VERSION, "4.0.0" ) >= 0 ) + Tcl_SetVar( interp, "pl_iwidgets_package_name", "-exact Iwidgets " PLPLOT_IWIDGETS_VERSION, TCL_GLOBAL_ONLY ); + else + // Mark invalid package name in such a way as to cause an error + // when, for example, itk has been disabled by PLplot, yet one + // of the PLplot Tcl scripts attempts to load Iwidgets. + Tcl_SetVar( interp, "pl_iwidgets_package_name", "Iwidgets(because_not_found_by_PLplot)", TCL_GLOBAL_ONLY ); + + // Begin search for init script // Each search begins with a test of libDir, so rearrangement is easy. // If search is successful, both libDir (C) and pllibrary (tcl) are set Modified: trunk/bindings/tk/PLWin.itk =================================================================== --- trunk/bindings/tk/PLWin.itk 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk/PLWin.itk 2013-11-12 03:22:18 UTC (rev 12678) @@ -7,7 +7,7 @@ # $Id$ ############################################################################### -package require Itk +eval package require $pl_itk_package_name itcl::class PLWin { inherit itk::Widget Modified: trunk/bindings/tk/Pltkwin.tcl =================================================================== --- trunk/bindings/tk/Pltkwin.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk/Pltkwin.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -36,9 +36,7 @@ # We don't need version numbers because we use the first versions # which actually use the 'package' mechanism. package require Pltk -package require Itcl -package require Itk -package require Iwidgets +eval package require $pl_iwidgets_package_name itcl::class Pltkwin { inherit PLWin Modified: trunk/bindings/tk/plcolor.tcl =================================================================== --- trunk/bindings/tk/plcolor.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk/plcolor.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -69,7 +69,7 @@ set colorSpace hsl -package require Itcl +eval package require $pl_itcl_package_name itcl::class ColorEditor { private variable r 255 Modified: trunk/bindings/tk/pltools.tcl =================================================================== --- trunk/bindings/tk/pltools.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk/pltools.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -258,7 +258,7 @@ proc fileSelect {{filter {}}} { # Use the Iwidgets file selector if available - if ![catch {package require Iwidgets}] { + if ![catch {eval package require $pl_iwidgets_package_name}] { if {![winfo exist .fs]} { iwidgets::fileselectiondialog .fs -modality application } Modified: trunk/bindings/tk/plwidget.tcl =================================================================== --- trunk/bindings/tk/plwidget.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk/plwidget.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -560,7 +560,7 @@ # The palette tools require Itcl 3.0 or later. - if [catch {package require Itcl 3.0}] { return } + if [catch {eval package require $pl_itcl_package_name}] { return } $pmenu($w) add cascade -label "Palettes" -menu $m menu $m Modified: trunk/bindings/tk-x-plat/Memberscope.tcl =================================================================== --- trunk/bindings/tk-x-plat/Memberscope.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/Memberscope.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -2,7 +2,7 @@ # Use, copy, sell, rewrite, improve however you like. # Vince Darley. -package require Itcl +eval package require $pl_itcl_package_name itcl::class Memberscope { protected method memberscope {var} Modified: trunk/bindings/tk-x-plat/Plplotwin.tcl =================================================================== --- trunk/bindings/tk-x-plat/Plplotwin.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/Plplotwin.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -51,7 +51,7 @@ package require Tk 8.0 package require Plplotter -package require Itk 3.0 +eval package require $pl_itk_package_name # # Usual options. Modified: trunk/bindings/tk-x-plat/Plwindow.tcl =================================================================== --- trunk/bindings/tk-x-plat/Plwindow.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/Plwindow.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -13,9 +13,8 @@ option add *Plwindow.width 250 widgetDefault option add *Plwindow.height 250 widgetDefault -package require Itk 3.0 package require Plplotter - +eval package require $pl_itk_package_name # # Usual options. # Modified: trunk/bindings/tk-x-plat/plbarchart.tcl =================================================================== --- trunk/bindings/tk-x-plat/plbarchart.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/plbarchart.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -17,8 +17,7 @@ ## package require Plplotter -package require Itk - +eval package require $pl_itk_package_name proc plbarchart {args} {uplevel Plbarchart $args} itcl::class Plbarchart { Modified: trunk/bindings/tk-x-plat/pltimeseries.tcl =================================================================== --- trunk/bindings/tk-x-plat/pltimeseries.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/pltimeseries.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -17,8 +17,7 @@ ## package require Plplotter -package require Itk - +eval package require $pl_itk_package_name proc pltimeseries {args} {uplevel Pltimeseries $args} itcl::class Pltimeseries { Modified: trunk/bindings/tk-x-plat/plwidget2.tcl =================================================================== --- trunk/bindings/tk-x-plat/plwidget2.tcl 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/bindings/tk-x-plat/plwidget2.tcl 2013-11-12 03:22:18 UTC (rev 12678) @@ -533,11 +533,11 @@ $m add checkbutton -label "Doublebuffer" -variable \ plotopts($w,dbl) -command "$w.plwin configure -doublebuffer \$plotopts($w,dbl)" - global plopt_static_redraw plopt_dynamic_redraw + global plopt_static_redraw plopt_dynamic_redraw pl_itcl_package_name # The palette tools require Itcl 3.0 or later. - if [catch {package require Itcl 3.0}] { return } + if [catch {eval package require $pl_itcl_package_name}] { return } # Set up redraw variables. Basically if you have r/w colorcells (e.g. # PseudoColor visual, not sure if any others), you don't need either of Modified: trunk/cmake/modules/tcl-related.cmake =================================================================== --- trunk/cmake/modules/tcl-related.cmake 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/cmake/modules/tcl-related.cmake 2013-11-12 03:22:18 UTC (rev 12678) @@ -296,14 +296,14 @@ endforeach(SUGGESTED_IWIDGETS_VERSION 4.0.2 4.0.1 4.0.0) endif(USE_INCRTCL_VERSION_4) if(NOT IWIDGETS_RC) - list(GET IWIDGETS_VERSIONS_LIST 0 IWIDGETS_VERSION) + list(GET IWIDGETS_VERSIONS_LIST 0 PLPLOT_IWIDGETS_VERSION) list(GET IWIDGETS_VERSIONS_LIST 1 CONSISTENT_ITK_VERSION) list(GET IWIDGETS_VERSIONS_LIST 2 CONSISTENT_ITCL_VERSION) message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent") if(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION) message(STATUS "Checking that the Iwidgets, Itk, and Itcl packages are consistent - true") else(CONSISTENT_ITCL_VERSION STREQUAL PLPLOT_ITCL_VERSION AND CONSISTENT_ITK_VERSION STREQUAL PLPLOT_ITK_VERSION) - message(STATUS "IWIDGETS_VERSION = ${IWIDGETS_VERSION}") + message(STATUS "PLPLOT_IWIDGETS_VERSION = ${PLPLOT_IWIDGETS_VERSION}") message(STATUS "PLPLOT_ITK_VERSION = ${PLPLOT_ITK_VERSION}") message(STATUS "CONSISTENT_ITK_VERSION = ${CONSISTENT_ITK_VERSION}") message(STATUS "PLPLOT_ITCL_VERSION = ${PLPLOT_ITCL_VERSION}") Modified: trunk/examples/tk/tk02.in =================================================================== --- trunk/examples/tk/tk02.in 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/examples/tk/tk02.in 2013-11-12 03:22:18 UTC (rev 12678) @@ -8,7 +8,8 @@ # @> A script for using Tk to control xtk01, using the PLplot itcl interface. ############################################################################### -package require Itk +package require Pltk +eval package require $pl_itk_package_name wm title . "x01c -- TK version" plstdwin . Modified: trunk/examples/tk/tk04.in =================================================================== --- trunk/examples/tk/tk04.in 2013-11-12 00:54:54 UTC (rev 12677) +++ trunk/examples/tk/tk04.in 2013-11-12 03:22:18 UTC (rev 12678) @@ -7,8 +7,8 @@ # @> A script illustrating use of 2-d tcl api (plframe). ############################################################################### -package require Itk - +package require Pltk +eval package require $pl_itk_package_name wm title . "tk04" plstdwin . This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |