Changeset 72
- Timestamp:
- Dec 4, 2009 4:59:56 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsascmds.tcl
- Property rcs:date changed from 1999/02/19 18:18:23 to 1999/03/19 17:07:59
- Property rcs:lines changed from +3 -4 to +53 -35
- Property rcs:rev changed from 1.9 to 1.10
r62 r72 696 696 pack [frame [set frmA $frm.1] -bd 2 -relief groove] -padx 3 -pady 3 -side left 697 697 pack [frame [set frmC $frm.3] ] -padx 3 -pady 3 -side left 698 pack [button $frmC.b -text Convert -command " valid_conv_win$frm"] \698 pack [button $frmC.b -text Convert -command "ValidWinCnv $frm"] \ 699 699 -side top 700 700 pack [button $frmC.q -text Quit -command "destroy $frm"] -side top 701 701 pack [label $frmA.0 -text "Select a file to convert"] -side top -anchor center 702 winfilebox $frm A702 winfilebox $frm 703 703 # force the window to stay on top 704 704 wm transient $frm [winfo toplevel [winfo parent $frm]] 705 705 706 bind $frm <Return> " valid_conv_win$frm"706 bind $frm <Return> "ValidWinCnv $frm" 707 707 wm withdraw $frm 708 708 update idletasks … … 734 734 735 735 # validate the files and make the conversion 736 proc valid_conv_win{frm} {736 proc ValidWinCnv {frm} { 737 737 global expgui 738 # change backslashes to something sensible 739 regsub -all {\\} $expgui(FileMenuCnvName) / expgui(FileMenuCnvName) 740 # allow entry of D: for D:/ and D:TEST for d:/TEST 741 if {[string first : $expgui(FileMenuCnvName)] != -1 && \ 742 [string first :/ $expgui(FileMenuCnvName)] == -1} { 743 regsub : $expgui(FileMenuCnvName) :/ expgui(FileMenuCnvName) 744 } 738 745 if {$expgui(FileMenuCnvName) == "<Parent>"} { 739 746 set expgui(FileMenuDir) [file dirname [set expgui(FileMenuDir)] ] 740 Choose CnvFil$frm747 ChooseWinCnv $frm 741 748 return 742 749 } elseif [file isdirectory \ … … 746 753 [file join $expgui(FileMenuDir) $expgui(FileMenuCnvName)] 747 754 } 748 Choose CnvFil$frm755 ChooseWinCnv $frm 749 756 return 750 757 } … … 803 810 804 811 # create a file box 805 proc winfilebox { bx} {812 proc winfilebox {frm} { 806 813 global expgui 814 set bx $frm.1 807 815 pack [frame $bx.top] -side top 808 816 pack [label $bx.top.a -text "Directory" ] -side left … … 823 831 824 832 pack [button $bx.top.b -image $upfolder \ 825 -command "updir; Choose CnvFil $bx" ]833 -command "updir; ChooseWinCnv $frm" ] 826 834 pack [frame $bx.a -width 200 -height 75] -side top -expand yes -fill both 827 835 listbox $bx.a.files -relief raised -bd 2 \ … … 832 840 -height 15 -width 0 -takefocus 0 833 841 scrollbar $bx.a.scroll -command "move2boxesY \" $bx.a.files $bx.a.dates \" " 834 Choose CnvFil $bx835 bind $bx.a.files <ButtonRelease-1> "Release CnvFil $bx"836 bind $bx.a.dates <ButtonRelease-1> "Release CnvFil $bx"837 bind $bx.a.files <Double-1> "Select CnvFil $bx"838 bind $bx.a.dates <Double-1> "Select CnvFil $bx"842 ChooseWinCnv $frm 843 bind $bx.a.files <ButtonRelease-1> "ReleaseWinCnv $frm" 844 bind $bx.a.dates <ButtonRelease-1> "ReleaseWinCnv $frm" 845 bind $bx.a.files <Double-1> "SelectWinCnv $frm" 846 bind $bx.a.dates <Double-1> "SelectWinCnv $frm" 839 847 pack $bx.a.scroll -side left -fill y 840 848 pack $bx.a.files $bx.a.dates -side left -fill both -expand yes … … 843 851 844 852 # set the box or file in the selection window 845 proc Release CnvFil{frm} {853 proc ReleaseWinCnv {frm} { 846 854 global expgui 847 set files $frm. a.files848 set dates $frm. a.dates855 set files $frm.1.a.files 856 set dates $frm.1.a.dates 849 857 set select [$files curselection] 850 858 if {$select == ""} { … … 858 866 if {$expgui(FileMenuCnvName) == "<Parent>"} { 859 867 set expgui(FileMenuDir) [file dirname $expgui(FileMenuDir)] 860 Choose CnvFil$frm868 ChooseWinCnv $frm 861 869 } elseif [file isdirectory \ 862 870 [file join [set expgui(FileMenuDir)] $expgui(FileMenuCnvName)]] { 863 871 if {$expgui(FileMenuCnvName) != "."} { 864 872 set expgui(FileMenuDir) [file join $expgui(FileMenuDir) $expgui(FileMenuCnvName)] 865 Choose CnvFil$frm873 ChooseWinCnv $frm 866 874 } 867 875 } … … 870 878 871 879 # select a file or directory -- called on double click 872 proc Select CnvFil{frm} {880 proc SelectWinCnv {frm} { 873 881 global expgui 874 set files $frm. a.files875 set dates $frm. a.dates882 set files $frm.1.a.files 883 set dates $frm.1.a.dates 876 884 set select [$files curselection] 877 885 if {$select == ""} { … … 885 893 if {$file == "<Parent>"} { 886 894 set expgui(FileMenuDir) [file dirname [set expgui(FileMenuDir)] ] 887 Choose CnvFil$frm895 ChooseWinCnv $frm 888 896 } elseif [file isdirectory [file join [set expgui(FileMenuDir)] $file]] { 889 897 if {$file != "."} { 890 898 set expgui(FileMenuDir) [file join [set expgui(FileMenuDir)] $file] 891 Choose CnvFil$frm899 ChooseWinCnv $frm 892 900 } 893 901 } else { 894 902 set expgui(FileMenuCnvName) [file tail $file] 895 valid_conv_win$frm903 ValidWinCnv $frm 896 904 } 897 905 } … … 899 907 # fill the files & dates & Directory selection box with current directory, 900 908 # also called when box is created to fill it 901 proc Choose CnvFil{frm} {909 proc ChooseWinCnv {frm} { 902 910 global expgui 903 set files $frm. a.files904 set dates $frm. a.dates911 set files $frm.1.a.files 912 set dates $frm.1.a.dates 905 913 set expgui(FileMenuCnvName) {} 906 914 $files delete 0 end … … 917 925 } 918 926 foreach file [lsort $filelist] { 919 set modified [file mtime $file] 920 set modified [clock format [file mtime $file] -format "%T %D"] 921 $files insert end [file tail $file] 922 $dates insert end $modified 927 if {![file isdirectory $file]} { 928 set modified [clock format [file mtime $file] -format "%T %D"] 929 $files insert end [file tail $file] 930 $dates insert end $modified 931 } 923 932 } 924 933 $expgui(FileDirButtonMenu) delete 0 end … … 932 941 $expgui(FileDirButtonMenu) add command -label $path \ 933 942 -command "[list set expgui(FileMenuDir) $path]; \ 934 Choose CnvFil$frm"943 ChooseWinCnv $frm" 935 944 } 936 945 return … … 1051 1060 # validation routine 1052 1061 proc valid_exp_file {frm mode} { 1053 global expgui 1062 global expgui tcl_platform 1063 # windows fixes 1064 if {$tcl_platform(platform) == "windows"} { 1065 # change backslashes to something sensible 1066 regsub -all {\\} $expgui(FileMenuEXPNAM) / expgui(FileMenuEXPNAM) 1067 # allow entry of D: for D:/ and D:TEST for d:/TEST 1068 if {[string first : $expgui(FileMenuEXPNAM)] != -1 && \ 1069 [string first :/ $expgui(FileMenuEXPNAM)] == -1} { 1070 regsub : $expgui(FileMenuEXPNAM) :/ expgui(FileMenuEXPNAM) 1071 } 1072 } 1054 1073 if {$expgui(FileMenuEXPNAM) == "<Parent>"} { 1055 1074 set expgui(FileMenuDir) [file dirname [set expgui(FileMenuDir)] ] … … 1226 1245 [string toupper [file extension $file]] == ".EXP"} { 1227 1246 set modified [file mtime $file] 1228 lappend pairlist "$file $modified"1247 lappend pairlist [list $file $modified] 1229 1248 } 1230 1249 } … … 1265 1284 return 1266 1285 } 1267
Note: See TracChangeset
for help on using the changeset viewer.