Changeset 91
- Timestamp:
- Dec 4, 2009 5:00:15 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsascmds.tcl
- Property rcs:date changed from 1999/04/08 20:44:22 to 1999/07/21 16:22:54
- Property rcs:lines changed from +5 -2 to +126 -130
- Property rcs:rev changed from 1.11 to 1.12
r83 r91 50 50 global env expgui 51 51 # Windows environment variables 52 # -95 does not seem to be able to use these53 52 set env(GSAS) [file nativename $expgui(gsasdir)] 54 53 # PGPLOT_FONT is needed by PGPLOT … … 57 56 set env(LENPAGE) 60 58 57 # all winexec commands are background commands -- ignore background arg 59 60 58 # can't get pause to work! -- ignore wait 61 59 … … 137 135 -command "set expgui(temp) {}; destroy $w"] -side left 138 136 } 137 bind $w <Return> "destroy $w" 138 139 139 # force the window to stay on top 140 wm transient $w [winfo toplevel [winfo parent $w]] 141 142 bind $w <Return> "destroy $w" 143 wm withdraw $w 144 update idletasks 145 # center the new window in the middle of the parent 146 set x [expr [winfo x [winfo parent $w]] + [winfo width .]/2 - \ 147 [winfo reqwidth $w]/2 - [winfo vrootx [winfo parent $w]]] 148 set y [expr [winfo y [winfo parent $w]] + [winfo height .]/2 - \ 149 [winfo reqheight $w]/2 - [winfo vrooty [winfo parent $w]]] 150 wm geom $w +$x+$y 151 wm deiconify $w 152 153 set oldFocus [focus] 154 set oldGrab [grab current $w] 155 if {$oldGrab != ""} { 156 set grabStatus [grab status $oldGrab] 157 } 158 grab $w 140 putontop $w 141 159 142 focus $w.b.2 160 143 tkwait window $w 161 catch {focus $oldFocus} 162 if {$oldGrab != ""} { 163 if {$grabStatus == "global"} { 164 grab -global $oldGrab 165 } else { 166 grab $oldGrab 167 } 168 } 144 afterputontop 145 169 146 return $expgui(temp) 170 147 } … … 190 167 # Save the current exp file 191 168 savearchiveexp 169 # load the changed .EXP file automatically? 170 if {$expgui(autoexpload)} { 171 # disable the file changed monitor 172 set expgui(expModifiedLast) 0 173 } 192 174 set cmd {} 193 175 set expnam [file root [file tail $expgui(expfile)]] … … 202 184 } 203 185 forknewterm "$prog -- $expnam" $cmd 0 1 1 204 wm deiconify . 186 # load the changed .EXP file automatically? 187 if {$expgui(autoexpload)} { 188 # load the revised exp file 189 loadexp $expgui(expfile) 190 } 191 # wm deiconify . 205 192 } 206 193 … … 513 500 unixcnvbox $frmB outfile 0 514 501 set infile(done) 0 502 bind $frm <Return> "valid_conv_unix" 515 503 # force the window to stay on top 516 wm transient $frm [winfo toplevel [winfo parent $frm]] 517 518 bind $frm <Return> "valid_conv_unix" 519 wm withdraw $frm 520 update idletasks 521 # center the new window in the middle of the parent 522 set x [expr [winfo x [winfo parent $frm]] + [winfo width .]/2 - \ 523 [winfo reqwidth $frm]/2 - [winfo vrootx [winfo parent $frm]]] 524 set y [expr [winfo y [winfo parent $frm]] + [winfo height .]/2 - \ 525 [winfo reqheight $frm]/2 - [winfo vrooty [winfo parent $frm]]] 526 wm geom $frm +$x+$y 527 wm deiconify $frm 528 529 set oldFocus [focus] 530 set oldGrab [grab current $frm] 531 if {$oldGrab != ""} { 532 set grabStatus [grab status $oldGrab] 533 } 534 grab $frm 504 putontop $frm 535 505 focus $frmC.q 536 506 update … … 545 515 } 546 516 destroy $frm 517 afterputontop 547 518 } 548 519 … … 702 673 pack [label $frmA.0 -text "Select a file to convert"] -side top -anchor center 703 674 winfilebox $frm 675 bind $frm <Return> "ValidWinCnv $frm" 676 704 677 # force the window to stay on top 705 wm transient $frm [winfo toplevel [winfo parent $frm]] 706 707 bind $frm <Return> "ValidWinCnv $frm" 708 wm withdraw $frm 709 update idletasks 710 # center the new window in the middle of the parent 711 set x [expr [winfo x [winfo parent $frm]] + [winfo width .]/2 - \ 712 [winfo reqwidth $frm]/2 - [winfo vrootx [winfo parent $frm]]] 713 set y [expr [winfo y [winfo parent $frm]] + [winfo height .]/2 - \ 714 [winfo reqheight $frm]/2 - [winfo vrooty [winfo parent $frm]]] 715 wm geom $frm +$x+$y 716 wm deiconify $frm 717 718 set oldFocus [focus] 719 set oldGrab [grab current $frm] 720 if {$oldGrab != ""} { 721 set grabStatus [grab status $oldGrab] 722 } 723 grab $frm 678 putontop $frm 724 679 focus $frmC.q 725 680 tkwait window $frm 726 catch {focus $oldFocus} 727 if {$oldGrab != ""} { 728 if {$grabStatus == "global"} { 729 grab -global $oldGrab 730 } else { 731 grab $oldGrab 732 } 733 } 681 afterputontop 734 682 } 735 683 … … 919 867 set filelist [glob -nocomplain \ 920 868 [file join [set expgui(FileMenuDir)] *] ] 921 foreach file [lsort $filelist] {869 foreach file [lsort -dictionary $filelist] { 922 870 if {[file isdirectory $file]} { 923 871 $files insert end [file tail $file] … … 925 873 } 926 874 } 927 foreach file [lsort $filelist] {875 foreach file [lsort -dictionary $filelist] { 928 876 if {![file isdirectory $file]} { 929 877 set modified [clock format [file mtime $file] -format "%T %D"] … … 965 913 ] -side top 966 914 bind $frm <Return> {if ![catch {expr $liveplot(hst)}] "destroy .file"} 915 967 916 # force the window to stay on top 968 wm transient $frm [winfo toplevel [winfo parent $frm]] 969 wm withdraw $frm 970 update idletasks 971 # center the new window in the middle of the parent 972 set x [expr [winfo x [winfo parent $frm]] + [winfo width .]/2 - \ 973 [winfo reqwidth $frm]/2 - [winfo vrootx [winfo parent $frm]]] 974 set y [expr [winfo y [winfo parent $frm]] + [winfo height .]/2 - \ 975 [winfo reqheight $frm]/2 - [winfo vrooty [winfo parent $frm]]] 976 wm geom $frm +$x+$y 977 wm deiconify $frm 978 979 set oldFocus [focus] 980 set oldGrab [grab current $frm] 981 if {$oldGrab != ""} { 982 set grabStatus [grab status $oldGrab] 983 } 984 grab $frm 917 putontop $frm 985 918 focus $frm.2 986 919 tkwait window $frm 987 catch {focus $oldFocus} 988 if {$oldGrab != ""} { 989 if {$grabStatus == "global"} { 990 grab -global $oldGrab 991 } else { 992 grab $oldGrab 993 } 994 } 920 afterputontop 995 921 } 996 922 … … 1029 955 expfilebox $frmA $mode 1030 956 # force the window to stay on top 1031 wm transient $frm [winfo toplevel [winfo parent $frm]] 1032 1033 wm withdraw $frm 1034 update idletasks 1035 # center the new window in the middle of the parent 1036 set x [expr [winfo x [winfo parent $frm]] + [winfo width .]/2 - \ 1037 [winfo reqwidth $frm]/2 - [winfo vrootx [winfo parent $frm]]] 1038 set y [expr [winfo y [winfo parent $frm]] + [winfo height .]/2 - \ 1039 [winfo reqheight $frm]/2 - [winfo vrooty [winfo parent $frm]]] 1040 wm geom $frm +$x+$y 1041 wm deiconify $frm 1042 1043 set oldFocus [focus] 1044 set oldGrab [grab current $frm] 1045 if {$oldGrab != ""} { 1046 set grabStatus [grab status $oldGrab] 1047 } 1048 grab $frm 957 putontop $frm 1049 958 focus $frmC.b 1050 959 tkwait window $frm 1051 catch {focus $oldFocus} 1052 if {$oldGrab != ""} { 1053 if {$grabStatus == "global"} { 1054 grab -global $oldGrab 1055 } else { 1056 grab $oldGrab 1057 } 1058 } 960 afterputontop 1059 961 if {$expgui(FileMenuEXPNAM) == ""} return 1060 962 return [file join $expgui(FileMenuDir) $expgui(FileMenuEXPNAM)] … … 1237 1139 set filelist [glob -nocomplain \ 1238 1140 [file join [set expgui(FileMenuDir)] *] ] 1239 foreach file [lsort $filelist] {1141 foreach file [lsort -dictionary $filelist] { 1240 1142 if {[file isdirectory $file]} { 1241 1143 $files insert end [file tail $file] … … 1244 1146 } 1245 1147 set pairlist {} 1246 foreach file [lsort $filelist] {1148 foreach file [lsort -dictionary $filelist] { 1247 1149 if {![file isdirectory $file] && \ 1248 1150 [string toupper [file extension $file]] == ".EXP"} { … … 1287 1189 return 1288 1190 } 1191 1192 proc putontop {w} { 1193 # center window $w above its parent and make it stay on top 1194 set wp [winfo parent $w] 1195 wm transient $w [winfo toplevel $wp] 1196 wm withdraw $w 1197 update idletasks 1198 # center the new window in the middle of the parent 1199 set x [expr [winfo x $wp] + [winfo width $wp]/2 - \ 1200 [winfo reqwidth $w]/2 - [winfo vrootx $wp]] 1201 if {$x < 0} {set x 0} 1202 set xborder 10 1203 if {$x+[winfo reqwidth $w] +$xborder > [winfo screenwidth $w]} { 1204 incr x [expr \ 1205 [winfo screenwidth $w] - ($x+[winfo reqwidth $w] + $xborder)] 1206 } 1207 set y [expr [winfo y $wp] + [winfo height $wp]/2 - \ 1208 [winfo reqheight $w]/2 - [winfo vrooty $wp]] 1209 if {$y < 0} {set y 0} 1210 set yborder 25 1211 if {$y+[winfo reqheight $w] +$yborder > [winfo screenheight $w]} { 1212 incr y [expr \ 1213 [winfo screenheight $w] - ($y+[winfo reqheight $w] + $yborder)] 1214 } 1215 wm geom $w +$x+$y 1216 wm deiconify $w 1217 1218 global makenew 1219 set makenew(OldFocus) [focus] 1220 set makenew(OldGrab) [grab current $w] 1221 if {$makenew(OldGrab) != ""} { 1222 set makenew(GrabStatus) [grab status $makenew(OldGrab)] 1223 } 1224 grab $w 1225 } 1226 1227 proc afterputontop {} { 1228 # restore focus 1229 global makenew 1230 catch {focus $makenew(OldFocus)} 1231 if {$makenew(OldGrab) != ""} { 1232 if {$makenew(GrabStatus) == "global"} { 1233 grab -global $makenew(OldGrab) 1234 } else { 1235 grab $makenew(OldGrab) 1236 } 1237 } 1238 } 1239 1240 proc ShowBigMessage {win labeltext msg "optionlist OK"} { 1241 catch {destroy $win} 1242 toplevel $win 1243 1244 # grab focus, etc. 1245 pack [label $win.l1 -text $labeltext] -side top 1246 pack [frame $win.f1] -side top 1247 grid [text $win.f1.t \ 1248 -height 20 -width 55 -wrap none -font Courier \ 1249 -xscrollcommand "$win.f1.bscr set" \ 1250 -yscrollcommand "$win.f1.rscr set" \ 1251 ] -row 1 -column 0 -sticky news 1252 grid [scrollbar $win.f1.bscr -orient horizontal \ 1253 -command "$win.f1.t xview" \ 1254 ] -row 2 -column 0 -sticky ew 1255 grid [scrollbar $win.f1.rscr -command "$win.f1.t yview" \ 1256 ] -row 1 -column 1 -sticky ns 1257 # give extra space to the text box 1258 grid columnconfigure $win.f1 0 -weight 1 1259 grid rowconfigure $win.f1 1 -weight 1 1260 $win.f1.t insert end $msg 1261 1262 global makenew 1263 set makenew(result) 0 1264 bind $win <Return> "destroy $win" 1265 bind $win <KeyPress-Prior> "$win.f1.t yview scroll -1 page" 1266 bind $win <KeyPress-Next> "$win.f1.t yview scroll 1 page" 1267 bind $win <KeyPress-Right> "$win.f1.t xview scroll 1 unit" 1268 bind $win <KeyPress-Left> "$win.f1.t xview scroll -1 unit" 1269 bind $win <KeyPress-Up> "$win.f1.t yview scroll -1 unit" 1270 bind $win <KeyPress-Down> "$win.f1.t yview scroll 1 unit" 1271 bind $win <KeyPress-Home> "$win.f1.t yview 0" 1272 bind $win <KeyPress-End> "$win.f1.t yview end" 1273 set i 0 1274 foreach item $optionlist { 1275 pack [button $win.q[incr i] \ 1276 -command "set makenew(result) $i; destroy $win" -text $item] -side left 1277 } 1278 putontop $win 1279 tkwait window $win 1280 1281 # fix focus... 1282 afterputontop 1283 return $makenew(result) 1284 }
Note: See TracChangeset
for help on using the changeset viewer.