grid columnconfigure . 0 -weight 1
bind .out <Control-l> clearOutput
- bind all <Alt-c> {console show}
- bind all <Control-F2> {console show}
+ if {[tk windowingsystem] eq "win32"} {
+ bind all <Alt-c> {console show}
+ bind all <Control-F2> {console show}
+ }
focus .out
wm geometry . +10+10
wm deiconify .
proc stateRestore {} {
global env state SP extract
+ if {[useRegistry]} {
+ if {[stateRestoreRegistry]} { return }
+ }
+
switch $::tcl_platform(platform) "macintosh" {
set stateFile [file join $env(PREF_FOLDER) "SockSpy Preferences"]
} "windows" {
trace variable $v w stateSave
}
}
+
+set regkey {HKEY_CURRENT_USER\SOFTWARE\sockspy.sourceforge.net}
+proc stateRestoreRegistry {} {
+ global env state SP extract regkey
+ set r 0
+ foreach name $::saveList {
+ catch {
+ uplevel #0 [list set $name [registry get $regkey $name]]
+ trace variable $name w stateSave
+ set r 1
+ }
+ }
+ return $r
+}
+
##+#########################################################################
#
# stateSave and stateSaveReal - Save program state.
proc stateSaveReal {} {
global state SP extract
+ if {[useRegistry]} {
+ return [stateSaveRegistry]
+ }
+
# silently ignore open failure
if {[catch {open $state(stateFile) w} sf]} return
close $sf
}
+proc stateSaveRegistry {} {
+ global state SP extract regkey
+ foreach name $::saveList {
+ registry set $regkey $name [set $name] sz
+ }
+}
+
+proc useRegistry {} {
+ global tcl_platform
+ set r 0
+ if {$tcl_platform(platform) eq "windows"} {
+ if {![catch {package require registry}]} {
+ set r 1
+ }
+ }
+ return $r
+}
+
################################################################
################################################################
################################################################