Updated configuration system.
[ir-tcl-moved-to-github.git] / client.tcl
index 6473a39..9d8ff83 100644 (file)
@@ -1,10 +1,19 @@
 # IR toolkit for tcl/tk
-# (c) Index Data 1995-1997
+# (c) Index Data 1995-1998
 # See the file LICENSE for details.
 # Sebastian Hammer, Adam Dickmeiss
 #
 # $Log: client.tcl,v $
-# Revision 1.101  1997-11-19 11:20:56  adam
+# Revision 1.104  1998-02-12 13:32:41  adam
+# Updated configuration system.
+#
+# Revision 1.103  1998/01/30 13:30:50  adam
+# Name of target database is irtdb.tcl instead of clientrc.tcl.
+#
+# Revision 1.102  1997/11/19 13:19:54  adam
+# Font fix.
+#
+# Revision 1.101  1997/11/19 11:20:56  adam
 # New target profile format - associative arrrays instead of LONG lists.
 #
 # Revision 1.100  1997/09/09 10:19:50  adam
@@ -494,7 +503,7 @@ wm minsize . 0 0
 set setOffset 0
 set setMax 0
 
-if {[lindex [split $tk_version .] 0] > 4} {
+if {[lindex [split $tk_version .] 0] < 5} {
     set font(bb,normal) -Adobe-Helvetica-Medium-R-Normal-*-240-*
     set font(bb,bold) -Adobe-Helvetica-Bold-R-Normal-*-240-*
     set font(b,normal) -Adobe-Helvetica-Medium-R-Normal-*-180-*
@@ -544,11 +553,13 @@ if {[file readable "${libdir}/tagsets.tcl"]} {
     source "${libdir}/tagsets.tcl"
 }
 
-# Read the global configuration file.
-if {[file readable "clientrc.tcl"]} {
-    source "clientrc.tcl"
-} elseif {[file readable "${libdir}/clientrc.tcl"]} {
-    source "${libdir}/clientrc.tcl"
+# Read the global target configuration file.
+if {[file readable "${libdir}/irtdb.tcl"]} {
+    source "${libdir}/irtdb.tcl"
+}
+# Read the local target configuration file.
+if {[file readable "irtdb.tcl"]} {
+    source "irtdb.tcl"
 }
 
 # Read the user configuration file.
@@ -575,13 +586,20 @@ foreach target [array names profile] {
            set profile($target,comstack) [lindex $profile($target) 6]
            set profile($target,databases) [lindex $profile($target) 7]
            set profile($target,timeDefine) $timedef
-
-           incr profile(Default,windowNumber)
+           set profile($target,windowNumber) 1
        }
        unset profile($target)
     }
 }
 
+# Assign unique ID's to each target's window number
+set wno 1
+foreach n [array names profile *,windowNumber] {
+    set profile($n) $wno
+    incr wno
+}
+set profile(Default,windowNumber) $wno
+
 # These globals describe the current query type. They are set to the
 # first query type.
 set queryButtonsFind [lindex $queryButtons 0]
@@ -1410,7 +1428,7 @@ proc close-target {} {
     configure-disable-e .top.target.m 1
     configure-disable-e .top.target.m 2
     if {[tk4]} {
-        .top.rset.m delete 2 last
+        .top.rset.m delete 1 last
     } else {
         .top.rset.m delete 1 last
     }
@@ -2898,7 +2916,7 @@ proc save-geometry {} {
 }
 
 # Procedure save-settings
-# This procedure saves the per-host related settings clientrc.tcl which
+# This procedure saves the per-host related settings irtdb.tcl which
 # is normally kept in the directory /usr/local/lib/irtcl.
 # All query types and target defintion profiles are saved.
 proc save-settings {} {
@@ -2909,17 +2927,10 @@ proc save-settings {} {
     global queryButtons
     global queryInfo
 
-    if {[file exists clientrc.tcl]} {
-        set f [open "clientrc.tcl" w]
-    } elseif {![file writable "${libdir}/clientrc.tcl"]} {
-        set a [alert "Cannot open ${libdir}/clientrc.tcl for writing. Do you \
-                wish to save clientrc.tcl in the current directory instead?"]
-        if {! $a} {
-            return
-        }
-        set f [open "clientrc.tcl" w]
+    if {[file writable "${libdir}/irtdb.tcl"]} {
+        set f [open "${libdir}/irtdb.tcl" w]
     } else {
-        set f [open "${libdir}/clientrc.tcl" w]
+        set f [open "irtdb.tcl" w]
     }
     puts $f "# Setup file"
 
@@ -3962,6 +3973,7 @@ irmenu .top.service.m.present
 
 irmenu .top.service.m.dblist
 
+# Init: Definition of Set menu.
 menubutton .top.rset -text Set -menu .top.rset.m
 irmenu .top.rset.m
 .top.rset.m add command -label Load -command {load-set}
@@ -4148,7 +4160,7 @@ if {[file exists ${libdir}/setup.tcl]} {
 }
 
 # Init: Uncomment this line if you wan't to enable logging.
-ir-log-init all
+ir-log-init all irtcl irtcl.log
 
 # Init: If hostid is a valid target, a new connection will be established
 # immediately.