1 # utilities for UIM tcl functions
2 # $Log: uimProcs.tcl,v $
3 # Revision 1.11 1995/12/21 22:17:48 naim
4 # Changing "Paradyn Error #" by "Paradyn Message #", since not every message
5 # is an error message - naim
7 # Revision 1.10 1995/11/29 00:23:12 tamches
8 # removed mkLogo; removed references to PdBitmapDir; added call
11 # Revision 1.9 1994/11/05 01:52:00 karavan
12 # small improvements to min window sizes, resizing effects, button names,
13 # and change pack command in mkLogo to new version.
15 # Revision 1.8 1994/11/03 20:48:11 karavan
16 # removed error message
18 # Revision 1.7 1994/09/13 05:05:47 karavan
19 # improved error handling
21 # Revision 1.6 1994/08/01 20:26:34 karavan
22 # changes to accommodate new dag design.
24 # Revision 1.5 1994/07/07 05:57:04 karavan
25 # UIM error service implementation
27 # Revision 1.4 1994/06/29 21:47:39 hollings
28 # killed old background colors and switched to motif like greys.
29 # cleaned up option specification to use options data base.
31 # Revision 1.3 1994/06/13 16:53:06 karavan
32 # added mkLogo procedure
34 # Revision 1.2 1994/05/23 01:55:46 karavan
35 # its a whole new look for paradyn!
37 # Revision 1.1 1994/05/03 06:36:03 karavan
41 proc mkEntry {w {pack {top expand fillx}} args} {
43 pack append [winfo parent $w] $w $pack
47 proc mkFrame {w {pack {top expand fill}} args} {
49 pack append [winfo parent $w] $w $pack
53 proc mkMessage {w {text ""} {pack {top fillx}} args} {
54 eval message $w -text \"$text\" $args
55 pack append [winfo parent $w] $w $pack
59 #----------------------------------------------------------------------------
60 # Make a bar of buttons and pack into parent. Embed the left button in an
61 # additional sunken frame to indicaute that it is the default button, and
62 # arrange for that button to be invoked as the default action for clicks
63 # and returns inthe dialog.
64 # **Changed order of every and other command klk**
65 #----------------------------------------------------------------------------
66 proc mkButtonBar {w every retval blist} {
68 set arg [lindex $blist 0]
72 foreach arg [lrange $blist 0 end] {
73 button $w.$i -text [lindex $arg 0] -width 10 -height 1\
74 -command "$every; [lindex $arg 1]"
75 pack append $w $w.$i {left expand padx 20 pady 4}
82 # Make a new dialog toplevel window
84 proc mkDialogWindow {w} {
86 toplevel $w -class Dialog -bd 0
87 wm title $w "Dialog box"
88 wm iconname $w "Dialog"
89 wm geometry $w +425+300
95 proc explError {errorCode oldwin} {
98 set w .error2$errorCode
100 #lookup errorCode, get explanation
101 set etext [lindex $pdError($errorCode) 3]
106 pack $w.out -padx 5 -pady 5
109 ## **** don't forget to use class for this font!!!!
110 label $w.out.top -text "Paradyn Message \#\ $errorCode Explanation" -fg red \
111 -font "-Adobe-times-bold-r-normal--*-120*"
112 pack $w.out.top -pady 5 -padx 5
115 message $w.out.explain -width 300 -text $etext -relief groove
116 pack $w.out.explain -pady 5 -padx 5
118 # single button option
119 button $w.out.b0 -text "OK" -command "destroy $w" \
121 pack $w.out.b0 -pady 5
124 proc showErrorHistory {} {
125 global pdErrorHistory
128 label $w.title -text "Paradyn Error History"
130 listbox $w.list.hlist -relief groove
131 scrollbar $w.list.s -orient vert -command "$w.hlist yview"
132 $w.hlist configure -yscrollcommand "$w.list.s set"
133 pack $w.title -side top
134 pack $w.list.hlist $w.list.s -side left
135 pack $w.list -side top
136 button $w.butt -text "OKAY" -command "destroy $w"
137 pack $w.butt -side top
141 # a simple help error screen for paradyn
142 # errorStr: text for custom error message
143 # errorCode: error ID from paradyn error database
145 proc showError {errorCode errorStr} {
146 global pdError pdErrorHistory
150 set retval [catch {set errRec $pdError($errorCode)}]
151 # puts "showError $retval"
153 set errorStr "No entry in error database for this error code."
156 set etype [lindex $errRec 2]
157 if {$errorStr == ""} {
158 set errorStr [lindex $errRec 0]
162 # the main error window
163 set w .error$errorCode
166 frame $w.out -class "Paradyn.Error"
167 pack $w.out -padx 5 -pady 5
169 # Error screen header: bitmap, title and Error Number
171 pack $w.out.top -padx 5 -pady 5
173 makeLogo $w.out.top.exclaim dont flat 0 red
175 # label $w.out.top.exclaim -bitmap @$PdBitmapDir/dont.xbm \
176 # -fg red -height 40 -width 40
178 ## **** don't forget to use class for this font!!!!
179 label $w.out.top.title -text "Paradyn Message \#\ $errorCode" \
181 -fg red -font "-Adobe-times-bold-r-normal--*-120*"
182 pack $w.out.top.exclaim $w.out.top.title -side left -pady 5 -padx 10
184 pack $w.out.top -expand yes -fill both
186 # specific error message text
188 message $w.out.mid.msg -width 300 -text $errorStr -relief groove \
190 pack $w.out.mid.msg -expand yes -fill both -padx 5 -pady 5
191 pack $w.out.mid -expand yes -fill both -padx 5
192 label $w.out.eclass -text "Message Category: $etype" -anchor center
193 pack $w.out.eclass -side top -pady 5
197 mkButtonBar $w.out.buttons {} retval {{CONTINUE ""} \
199 {EXIT PARADYN "destroy ."} }
201 $w.out.buttons.3 configure -command "errorExit $w"
202 $w.out.buttons.2 configure -command "explError $errorCode $w"
203 $w.out.buttons.1 configure -command "destroy $w"
204 pack $w.out.buttons -expand yes -fill both -padx 5
206 # add this error to error history list
207 lappend pdErrorHistory [list $errorCode $errorStr]
210 # Exit Paradyn, with or without core file per the user selection
211 # This is only called from an error condition.
213 proc errorExit {oldwin} {
218 label $w.l -text "Generate Core File (Y/N)?"
220 mkButtonBar $w.buttons {} retval {{YES ""} {NO ""}}
221 $w.buttons.1 configure -command "paradyn core -1; destroy ."
222 $w.buttons.2 configure -command "destroy ."
224 pack $w.l $w.buttons -side top