2 # Copyright (c) 1993, 1994 Barton P. Miller, Jeff Hollingsworth,
3 # Bruce Irvin, Jon Cargille, Krishna Kunchithapadam, Karen
4 # Karavanic, Tia Newhall, Mark Callaghan. All rights reserved.
6 # This software is furnished under the condition that it may not be
7 # provided or otherwise made available to, or used by, any other
8 # person, except as provided for by the terms of applicable license
9 # agreements. No title to or ownership of the software is hereby
10 # transferred. The name of the principals may not be used in any
11 # advertising or publicity related to this software without specific,
12 # written prior authorization. Any use of this software must include
13 # the above copyright notice.
16 # this file contains the routines for the "SAVE" button
19 global saveGlobalData savePhaseData saveResources saveDirectory \
20 saveMessage saveWindow
22 # clear previous invalid entry message, if any
23 set saveMessage "Enter name of Directory for Data/Resource Files"
25 # make sure directory entry is valid
26 if { ! [file exists $saveDirectory]} {
27 #try to create the directory
28 catch {exec mkdir $saveDirectory}
30 if { (! [file isdirectory $saveDirectory]) || \
31 (![file writable $saveDirectory]) } {
32 set saveMessage "Error: invalid directory name"
36 if {$saveGlobalData == 1} {
37 if {$savePhaseData == 0} {
38 paradyn save data global $saveDirectory
40 paradyn save data all $saveDirectory
43 if {$savePhaseData == 1} {
44 paradyn save data phase $saveDirectory
47 if {$saveResources == 1} {
48 paradyn save resources all $saveDirectory
53 proc drawSaveMenu {} {
54 global saveGlobalData savePhaseData saveResources saveDirectory \
55 saveMessage saveWindow
58 wm title $saveWindow "Paradyn Save"
59 wm iconname $saveWindow "Paradyn Save"
61 set di $saveWindow.directory
62 set wh $saveWindow.what
63 set ex $saveWindow.exit
65 frame $wh -relief raised -borderwidth 2
66 frame $ex -relief raised -borderwidth 2
67 pack $wh $di $ex -side top -fill both -padx 2 -pady 5
70 label $wh.la -text "Save Paradyn Data" \
71 -foreground white -anchor c \
72 -font *-New*Century*Schoolbook-Bold-R-*-14-* \
75 pack $wh.la -side top -fill both -expand true
78 checkbutton $wh.gd -text "Global Data" -variable saveGlobalData
80 checkbutton $wh.pd -text "Phase Data" -variable savePhaseData
82 checkbutton $wh.re -text "Where Axes" -variable saveResources
84 pack $wh.gd $wh.pd $wh.re -side left -padx 25 -pady 5 -anchor w
88 # make the list frame and set up resizing
91 entry $di.top.ent -width 50 -textvariable saveDirectory -relief sunken
92 bind $di.top.ent <Return> "pdSave"
93 label $di.top.la -text "Directory:"
94 pack $di.top.la $di.top.ent -side left -padx 5
95 set saveMessage "Enter name of Directory for Data/Resource Files"
96 label $di.bot.ms -textvariable saveMessage
97 pack $di.bot.ms -side top
98 pack $di.top $di.bot -side top -fill both
101 mkButtonBar $ex {} retval {{SAVE "pdSave"} \
102 {CLEAR "set saveDirectory \"\""} {CANCEL "destroy .pdsw"} }