More work on output queue. Memory related routines moved
[ir-tcl-moved-to-github.git] / client.tcl
index a99e741..5f05d6a 100644 (file)
@@ -4,7 +4,22 @@
 # Sebastian Hammer, Adam Dickmeiss
 #
 # $Log: client.tcl,v $
-# Revision 1.58  1995-06-29 12:34:06  adam
+# Revision 1.62  1995-08-04 11:32:37  adam
+# More work on output queue. Memory related routines moved
+# to mem.c
+#
+# Revision 1.61  1995/07/20  08:09:39  adam
+# client.tcl: Targets removed from hotTargets list when targets
+#  are removed/modified.
+# ir-tcl.c: More work on triggerResourceControl.
+#
+# Revision 1.60  1995/06/30  16:30:19  adam
+# Minor changes.
+#
+# Revision 1.59  1995/06/29  14:06:25  adam
+# Another bug in install fixed. Configure searches for more versions of yaz.
+#
+# Revision 1.58  1995/06/29  12:34:06  adam
 # IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
 #
 # Revision 1.57  1995/06/29  09:20:30  adam
 #
 #
 
-set tk4 0
+if {$tk_version == "3.6"} {
+    set tk4 0
+} else {
+    set tk4 1
+}
+
 if {$tk4} {
     proc configure-enable-e {w n} {
         incr n
@@ -239,7 +259,7 @@ if {! $tk4} {
 
 set libdir LIBDIR
 if {[file readable bitmaps/book2]} {
-       set libdir .
+    set libdir .
 }
 if {! [file readable ${libdir}/bitmaps/book2]} {
     puts "Cannot locate system files in ${libdir}. You must either run this"
@@ -275,7 +295,6 @@ wm minsize . 0 0
 set setOffset 0
 set setMax 0
 
-if {0} {
 proc tkerror err {
     set w .tkerrorw
 
@@ -290,12 +309,11 @@ proc tkerror err {
 
     label $w.top.b -bitmap error
     message $w.top.t -aspect 300 -text "Error: $err" \
-            -font -Adobe-Helvetica-Bold-R-Normal-*-240-*
+            -font -Adobe-Helvetica-Bold-R-Normal-*-180-*
     pack $w.top.b $w.top.t -side left -padx 10 -pady 10
 
     bottom-buttons $w [list {Close} [list destroy $w]] 1
 }
-}
 
 proc read-formats {} {
     global displayFormats
@@ -320,7 +338,7 @@ proc set-wrap {m} {
 }
 
 proc dputs {m} {
-#   puts $m
+   puts $m
 }
 
 proc set-display-format {f} {
@@ -771,16 +789,8 @@ proc popup-marc {sno no b df} {
 
 proc update-target-hotlist {target base} {
     global hotTargets
-    global tk4
 
-    set len [llength $hotTargets]
-    if {$len > 0} {
-        if {$tk4} {
-            .top.target.m delete 7 [expr 7+[llength $hotTargets]]
-        } else {
-            .top.target.m delete 6 [expr 6+[llength $hotTargets]]
-        }
-    }
+    set olen [llength $hotTargets]
     set i 0
     foreach e $hotTargets {
         if {$target == [lindex $e 0] && $base == [lindex $e 1]} {
@@ -790,12 +800,34 @@ proc update-target-hotlist {target base} {
         incr i    
     }
     set hotTargets [linsert $hotTargets 0 [list $target $base]]
-    set-target-hotlist    
+    set-target-hotlist $olen
 } 
 
-proc set-target-hotlist {} {
+proc delete-target-hotlist {target} {
     global hotTargets
-    
+
+    set olen [llength $hotTargets]
+    set i 0
+    foreach e $hotTargets {
+        if {$target == [lindex $e 0]} {
+           set hotTargets [lreplace $hotTargets $i $i]
+        }
+        incr i
+    }
+    set-target-hotlist $olen
+}
+
+proc set-target-hotlist {olen} {
+    global hotTargets
+    global tk4
+   
+    if {$olen > 0} {
+        if {$tk4} {
+            .top.target.m delete 7 [expr 7+$olen]
+        } else {
+            .top.target.m delete 6 [expr 6+$olen]
+        }
+    }
     set i 1
     foreach e $hotTargets {
         set target [lindex $e 0]
@@ -944,10 +976,8 @@ proc load-set-action {} {
 
 proc load-set {} {
     set w .load-set
-
-    set oldFocus [focus]
     toplevel $w
-
+    set oldFocus [focus]
     place-force $w .
     top-down-window $w
 
@@ -1551,7 +1581,7 @@ proc bind-fields {list returnAction escapeAction} {
     bind [lindex $list $i] <Return> $returnAction
     bind [lindex $list $i] <Escape> $escapeAction
     if {!$tk4} {
-        bind [lindex $list $i] <Tab>    [list focus [lindex $list 0]]
+        bind [lindex $list $i] <Tab>  [list focus [lindex $list 0]]
         bind [lindex $list $i] <Left> [list left-cursor [lindex $list $i]]
         bind [lindex $list $i] <Right> [list right-cursor [lindex $list $i]]
     }
@@ -1602,6 +1632,7 @@ definition $target ?"]
         unset profile($target)
         set settingsChanged 1
         cascade-target-list
+        delete-target-hotlist $target
     }
 }
 
@@ -1638,6 +1669,7 @@ proc protocol-setup-action {target} {
             $wno]
 
     cascade-target-list
+    delete-target-hotlist $target
     dputs $profile($target)
     destroy $w
 }
@@ -1668,9 +1700,8 @@ proc add-database {target} {
     global profile
 
     set w .database-select
-
-    set oldFocus [focus]
     toplevel $w
+    set oldFocus [focus]
  
     set wno [lindex $profile($target) 12]
     place-force $w .setup-${wno}
@@ -1865,7 +1896,7 @@ proc database-select {} {
     global hostid
 
     toplevel $w
-
+    set oldFocus [focus]
     place-force $w .
 
     top-down-window $w
@@ -1890,6 +1921,7 @@ proc database-select {} {
         $w.top.databases.list insert end $b
     }
     top-down-ok-cancel $w {database-select-action} 1
+    focus $oldFocus
 }
 
 proc cascade-target-list {} {
@@ -1956,6 +1988,7 @@ proc query-new {} {
     set w .query-new
 
     toplevel $w
+    set oldFocus [focus]
     place-force $w .
     top-down-window $w
     frame $w.top.index
@@ -1965,6 +1998,7 @@ proc query-new {} {
             {{Query Name:}} \
             query-new-action {destroy .query-new}
     top-down-ok-cancel $w query-new-action 1
+    focus $oldFocus
 }
 
 proc query-delete-action {queryNo} {
@@ -2096,6 +2130,7 @@ proc alert {ask} {
     global alertAnswer
 
     toplevel $w
+    set oldFocus [focus]
     place-force $w .
     top-down-window $w
 
@@ -2107,6 +2142,7 @@ proc alert {ask} {
   
     set alertAnswer 0
     top-down-ok-cancel $w {alert-action} 1
+    focus $oldFocus
     return $alertAnswer
 }
 
@@ -2244,6 +2280,7 @@ proc query-add-index {queryNo} {
     set w .query-add-index
 
     toplevel $w
+    set oldFocus [focus]
     place-force $w .query-setup
     top-down-window $w
     frame $w.top.index
@@ -2253,6 +2290,7 @@ proc query-add-index {queryNo} {
             {{Index Name:}} \
             [list query-add-index-action $queryNo] [list destroy $w]
     top-down-ok-cancel $w [list query-add-index-action $queryNo] 1
+    focus $oldFocus
 }
 
 proc query-setup-action {queryNo} {
@@ -2907,7 +2945,7 @@ menu .top.target.m
 .top.target.m add cascade -label "Setup" -menu .top.target.m.slist
 .top.target.m add command -label "Setup new" -command {define-target-dialog}
 .top.target.m add separator
-set-target-hotlist
+set-target-hotlist 0
 
 configure-disable-e .top.target.m 1
 configure-disable-e .top.target.m 2
@@ -3060,6 +3098,6 @@ pack .bot.a.status .bot.a.set .bot.a.message \
         -side left -padx 2 -pady 2
 
 ir z39
-
+z39 logLevel all
 show-logo 1