1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
#
# save.tk
#
proc save(build) name {
global Load
build_Title $name "Save"
build_DismissButtonbar $name dbbar "window(dismiss) save" \
{"Save..." {save(presave) .save} }
set cmd [build_CmdFrame $name cmd]
build_Filename $cmd f Save(Filename) Save(Directory)
bind_LabelEntryColumns $cmd.f 1 <Return> save(update)
build_Choicefield $cmd ch0 "Data style:" Load(Format_Flag) \
{"Unformatted" "DsTool 1.x" "DsTool 2.0" "DsTool Tk"}
$cmd.ch0.c1 configure -state disabled
$cmd.ch0.c0 configure -state disabled
for {set i 0} {$i<4} {incr i} {
bind $cmd.ch0.c$i <Button-1> [list save(options_$i) $name]
bindtags $cmd.ch0.c$i [list Radiobutton $name all $cmd.ch0.c$i]
}
build_Label $cmd label "Save options:"
set $cmd.olist1 [build_StdFrame $cmd olist1]
set $cmd.olist2 [build_StdFrame $cmd olist2]
pack $cmd.olist1 $cmd.olist2 -side left
build_Optionslist $cmd.olist1 lists \
{ "Current settings" Save(Settings) } \
{ "Window configuration" Save(Config) } \
{ "Trajectories" Save(Traj) } \
{ "Fixed points" Save(Fixpt) }
build_Optionslist $cmd.olist2 lists \
{ "Continuation data" Save(Cont) } \
{ "Selected points" Save(Select) } \
{ "Parameter data" Save(Param) } \
{ "Function values" Save(Funct) }
# { "Stored points" Save(Memory) }
# build_Optionslist $cmd olist \
# { "Current settings" Save(Settings) } \
# { "Window configuration" Save(Config) }
# { "Stored points" Save(Memory) }
pack $cmd -fill both -expand 1
save(options_$Load(Format_Flag)) $name
}
proc save(enter) {} {
pm_to_tcl Save
}
proc save(leave) {} {
tcl_to_pm Save
tcl_to_pm Load
pm_to_tcl Save
}
proc save(update) {} {
tcl_to_pm Save
pm_to_tcl Save
}
proc save(upfile) {} {
global Save
global File
set Save(Filename) $File(Filename)
set Save(Directory) $File(Directory)
}
proc save(presave) name {
global Save Load
window(open) filesl
if {($Load(Format_Flag) == 0)||($Load(Format_Flag) == 1)} {
set Load(Format_Flag) 2
tcl_to_pm Load
save(options_[set Load(Format_Flag)]) $name
}
filesl(init) "Save" \
"*.config" \
$Save(Directory) \
$Save(Filename) \
"save(upfile)" \
"save(go_win)"
}
proc save(go_win) {} {
global Save
if { ![save(go)] } {
# cannot write to file
set filename $Save(Directory)/$Save(Filename)
build_Dialog dialog "DsTool: Save" "Cannot write to: \n$filename" 0 OK
}
}
proc save(options_0) name {
}
proc save(options_1) name {
}
proc save(options_2) name {
global Save
if {[winfo exists $name]} {
foreach i {1 2} {
for {set j 0} {$j<7} {incr j} {
# only four will exist, but they might have numbers 0,1,2,3 or
# 0,4,5,6 due to the way the optionslist is built.
if {[winfo exists $name.cmd.olist$i.lists.b$j] == 1} {
$name.cmd.olist$i.lists.b$j configure -state normal
}
}
}
}
}
proc save(options_3) name {
global Save
if {[winfo exists $name]} {
foreach item {Traj Fixpt Cont Param Select Funct} {
set Save($item) 0
}
foreach i {1 2} {
for {set j 0} {$j<7} {incr j} {
# see above comment
if {[winfo exists $name.cmd.olist$i.lists.b$j] == 1} {
$name.cmd.olist$i.lists.b$j configure -state disabled
}
}
}
$name.cmd.olist1.lists.b0 configure -state normal
if {[winfo exists $name.cmd.olist1.lists.b1] == 1} {
$name.cmd.olist1.lists.b1 configure -state normal
} else {
$name.cmd.olist1.lists.b4 configure -state normal
}
}
}
|