From: Jeff Hobbs Date: Tue, 5 Sep 2006 23:08:31 +0000 (+0000) Subject: * tkcon.tcl (::tkcon::NewTab, ::tkcon::GetSlave): ensure that new X-Git-Tag: tkcon-2-5~13 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=e9c2646f845dd29af217b0e10ff0ab472a8e38c2;p=tkcon * tkcon.tcl (::tkcon::NewTab, ::tkcon::GetSlave): ensure that new tabs in other toplevel tkcon windows are built in the correct slave hierarchy. --- diff --git a/ChangeLog b/ChangeLog index 441f4c9..66866b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-09-05 Jeff Hobbs + * 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. diff --git a/tkcon.tcl b/tkcon.tcl index 753fb27..98ce376 100755 --- a/tkcon.tcl +++ b/tkcon.tcl @@ -817,10 +817,14 @@ proc ::tkcon::NewTab {{con {}}} { 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 @@ -2401,12 +2405,14 @@ proc ::tkcon::MainInit {} { 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 @@ -2418,7 +2424,7 @@ proc ::tkcon::MainInit {} { 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. @@ -2435,7 +2441,7 @@ proc ::tkcon::MainInit {} { $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