Annotation of capa/capa51/GUITools/ideas/of5tool/export.tcl, revision 1.1.1.1

1.1       albertel    1: proc export {} {
                      2:     global problem
                      3: 
                      4:     set file [ tk_getSaveFile -defaultextension .qz \
                      5: 		  -filetypes {{{Quizzer file} {.qz}}}  ]
                      6:     if { $file == "" } {
                      7: 	tk_messageBox -icon info -type ok -message "Information not saved"
                      8: 	return
                      9:     }
                     10:     
                     11:     set fileid [open $file "w"]
                     12:     
                     13:     exportQZHeader $fileid
                     14: 
                     15:     for { set i 1 } { $i <= $problem(num) } { incr i } {
                     16: 	switch $problem(prob.$i.type) {
                     17: 	    "Multiple Choice" 
                     18: 	    {
                     19: 		MCexportHeader $fileid $i
                     20: 		MCexportLeafs $fileid $i
                     21: 		MCexportAns $fileid $i 
                     22: 	    }
                     23: 	    -
                     24: 	    {
                     25: 		tk_messageBox -icon error \
                     26: 	         -message "Problem type $problem(prob.$i.type) not supported" \
                     27: 		    -type ok
                     28: 	    }
                     29: 	}
                     30:     }
                     31: 
                     32:     exportQZFooter $fileid 
                     33: 
                     34:     close $fileid
                     35:     
                     36:     tk_messageBox -icon info -message "Exported to $file" -type ok
                     37: }
                     38: 
                     39: proc exportQZHeader { fileid } {
                     40:     global problem
                     41: 
                     42:     puts $fileid "//Created by HACK GUI to qz files"
                     43:     puts $fileid "//CAPA system software is copyrighted by Michigan State University."
                     44:     puts $fileid "//"
                     45:     puts $fileid "/IMP \"../Tools/StdMacros\""
                     46:     puts $fileid "/IMP \"../Tools/StdUnits\""
                     47:     if { $problem(includes) != "" } {
                     48:     }
                     49:     puts $fileid "/IMP \"HWTop\""
                     50: }
                     51: 
                     52: proc exportQZFooter { fileid } {
                     53:     global problem
                     54: 
                     55:     puts $fileid "//*********************"
                     56:     puts $fileid "/END($problem(endline))"
                     57: }
                     58: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>