* tkcon.tcl (InitMenus): add ActiveTcl Help menu item, if AT Help
authorJeff Hobbs <hobbs@users.sourceforge.net>
Wed, 25 May 2005 20:23:53 +0000 (20:23 +0000)
committerJeff Hobbs <hobbs@users.sourceforge.net>
Wed, 25 May 2005 20:23:53 +0000 (20:23 +0000)
is found.

ChangeLog
tkcon.tcl

index b4728fcd968718fffed59666632cbc85099e4880..a6f9da96d40b3adc5df6a2261e3c5707ee9e2ec5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-25  Jeff Hobbs  <jeffh@ActiveState.com>
+
+       * tkcon.tcl (InitMenus): add ActiveTcl Help menu item, if AT Help
+       is found.
+
 2005-04-06  Jeff Hobbs  <jeffh@ActiveState.com>
 
        * tkcon.tcl (ExpandXotcl): allow for xotcl method name expansion,
index 2508d3583058684807565b125ec70fb3851610e8..7a30f8fcf6a1f20da96572274ef33540666f2e22 100755 (executable)
--- a/tkcon.tcl
+++ b/tkcon.tcl
@@ -1537,6 +1537,36 @@ proc ::tkcon::InitMenus {w title} {
                -command ::tkcon::About
        $m add command -label "Retrieve Latest Version" -underline 0 \
                -command ::tkcon::Retrieve
+       if {![catch {package require ActiveTcl} ver]} {
+           set cmd ""
+           if {$tcl_platform(platform) == "windows"} {
+               package require registry
+               set ver [join [lrange [split $ver .] 0 3] .]
+               set key {HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\ActiveTcl}
+               if {![catch {registry get "$key\\$ver\\Help" ""} help]
+                   && [file exists $help]} {
+                   set cmd [list exec $::env(COMSPEC) /c start $help]
+               }
+           } elseif {$tcl_platform(os) == "Darwin"} {
+               set ver ActiveTcl-[join [lrange [split $ver .] 0 1] .]
+               set rsc "/Library/Frameworks/Tcl.framework/Resources"
+               set help "$rsc/English.lproj/$ver/index.html"
+               if {[file exists $help]} {
+                   set cmd [list exec open $help]
+               }
+           } elseif {$tcl_platform(platform) == "unix"} {
+               set help [file dirname [info nameofexe]]
+               append help /../html/index.html
+               if {[file exists $help]} {
+                   set cmd [list puts "Start $help"]
+               }
+           }
+           if {$cmd != ""} {
+               $m add separator
+               $m add command -label "ActiveTcl Help" -underline 10 \
+                   -command $cmd
+           }
+       }
     }
 }