2006-09-05 Jeff Hobbs <jeffh@ActiveState.com>
+ * tkcon.tcl (::tkcon::NewTab, ::tkcon::GetSlave): ensure that new
+ tabs in other toplevel tkcon windows are built in the correct
+ slave hierarchy.
+
* pkgIndex.tcl: sample pkgIndex.tcl that allows using tkcon as a
package.
variable ATTACH
set con [InitTab $PRIV(base)]
- set slave [interp create Slave[GetSlaveNum]]
+ set slave [GetSlave]
InitSlave $slave
$slave alias exit ::tkcon::DeleteTab $con $slave
- set ATTACH($con) [list $slave slave]
+ if {$PRIV(name) != ""} {
+ set ATTACH($con) [list [list $PRIV(name) $slave] slave]
+ } else {
+ set ATTACH($con) [list $slave slave]
+ }
$PRIV(X) configure -state normal
MenuConfigure Console "Delete Tab" -state normal
GotoTab $con
interp alias {} ::tkcon::Main {} ::tkcon::InterpEval Main
interp alias {} ::tkcon::Slave {} ::tkcon::InterpEval
- proc ::tkcon::GetSlaveNum {} {
- set i -1
- while {[interp exists Slave[incr i]]} {
+ proc ::tkcon::GetSlave {{slave {}}} {
+ set i 0
+ puts [info level 0]
+ while {[Slave $slave [list interp exists Slave[incr i]]]} {
# oh my god, an empty loop!
}
- return $i
+ set interp [Slave $slave [list interp create Slave$i]]
+ return $interp
}
## ::tkcon::New - create new console window
variable PRIV
global argv0 argc argv
- set tmp [interp create Slave[GetSlaveNum]]
+ set tmp [GetSlave]
lappend PRIV(slaves) $tmp
load {} Tk $tmp
# If we have tbcload, then that should be autoloaded into slaves.
$tmp alias exit ::tkcon::Exit $tmp
$tmp alias ::tkcon::Destroy ::tkcon::Destroy $tmp
$tmp alias ::tkcon::New ::tkcon::New
- $tmp alias ::tkcon::GetSlaveNum ::tkcon::GetSlaveNum
+ $tmp alias ::tkcon::GetSlave ::tkcon::GetSlave $tmp
$tmp alias ::tkcon::Main ::tkcon::InterpEval Main
$tmp alias ::tkcon::Slave ::tkcon::InterpEval
$tmp alias ::tkcon::Interps ::tkcon::Interps