Example A.1. editTools
# Function : editTools # ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # Returns : # Parameters : tools - # # Description : Open Jeszra as a project inside itself. # This enables it to edit and customize every # aspect of Jeszra itself. # Written : 1998, Roger # Revision : 06/15/2009, Roger # Revision : 09/03/2009, Roger # Revision : 11/06/2009, Roger # ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― proc editTools {{tools .}} { set ip hidden; variable env; interp create $ip; $ip alias $tools $tools; # Pubchildren is the place where all children # get known to the slave interpreter... pubchildren $ip $tools; $ip alias menu add-menu; $ip alias master-opget opget; $ip alias pubwinfo pubwinfo; $ip alias pubchildren pubchidldren $ip; $ip alias getCurrentWidget vgmenu::currentWidget; $ip alias getSettings getSettings; $ip alias getManager vgmenu::getManager; $ip alias gprogress::progress gprogress; $ip alias importSettings exportSettings; $ip alias status status; $ip alias mkFirstLow mkFirstLow; $ip alias mkFirstUp mkFirstUp; $ip alias setInvoke setInvoke; $ip alias getContext getContext; $ip alias bindtags bindtags; # Required for the context menu ... $ip alias otherInspector otherInspector; $ip alias hideTop hideTop $ip; #$ip alias setInvoke setInvoke; # Tk 8.2 patch if {[info tclversion] < 8.1 || [info tclversion] >= 8.3} { $ip alias destroy destroy; } $ip alias master-inspect vgmenu::inspect; $ip alias setInterp vgmenu::selectInterp; # do more sophisticated stuff. ::goreedit::init $ip . # Avoid error messages when editing Jeszra. $ip eval { namespace eval vgfile { proc isSimpleCode { } { return 0 } } } $ip eval [subst { proc inspect {window {q 0}} { variable ::w set ::w \$window setInterp $ip; status "Call master for \$window"; master-inspect \$window \$q; } # proc winfo {type w} { # pubwinfo \$type \$w $tools; # } proc vgbind args {} proc event args {} proc exit args {} proc wech args {} proc grip args {} namespace eval vgfile {} proc vgfile::getName args {return {Jeszra@Jeszra}} proc vgfile::modified args {return 0} }] foreach file [list vgcode vgdo vginteract vgm] { $ip eval [list source \ [file join $env(VGHOME) library ${file}.tcl]]; } set wlist $tools; set pa $tools; while {[set pa [winfo parent $pa]] != {}} { $ip eval "proc $pa {args} {return {}}\n"; set wlist [linsert $wlist 0 $pa]; } $ip eval {proc editWidgets {args} {}}; $ip eval [::exportSettings]; $ip eval [list inspect $tools]; set top [vgtop $tools]; set tree $top.space.document.hierarchy: if {[winfo exists $tree]} { debug stdout "WLIST: $wlist" ::eval "$tree replace $wlist"; } }