Annotation of capa/capa51/GUITools/ideas/of5tool/export.tcl, revision 1.2
1.2 ! albertel 1: # creates a .qz file frm a 1 of N spec
! 2: # Copyright (C) 1992-2000 Michigan State University
! 3: #
! 4: # The CAPA system is free software; you can redistribute it and/or
! 5: # modify it under the terms of the GNU Library General Public License as
! 6: # published by the Free Software Foundation; either version 2 of the
! 7: # License, or (at your option) any later version.
! 8: #
! 9: # The CAPA system is distributed in the hope that it will be useful,
! 10: # but WITHOUT ANY WARRANTY; without even the implied warranty of
! 11: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
! 12: # Library General Public License for more details.
! 13: #
! 14: # You should have received a copy of the GNU Library General Public
! 15: # License along with the CAPA system; see the file COPYING. If not,
! 16: # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
! 17: # Boston, MA 02111-1307, USA.
! 18: #
! 19: # As a special exception, you have permission to link this program
! 20: # with the TtH/TtM library and distribute executables, as long as you
! 21: # follow the requirements of the GNU GPL in regard to all of the
! 22: # software in the executable aside from TtH/TtM.
! 23:
1.1 albertel 24: proc export {} {
25: global problem
26:
27: set file [ tk_getSaveFile -defaultextension .qz \
28: -filetypes {{{Quizzer file} {.qz}}} ]
29: if { $file == "" } {
30: tk_messageBox -icon info -type ok -message "Information not saved"
31: return
32: }
33:
34: set fileid [open $file "w"]
35:
36: exportQZHeader $fileid
37:
38: for { set i 1 } { $i <= $problem(num) } { incr i } {
39: switch $problem(prob.$i.type) {
40: "Multiple Choice"
41: {
42: MCexportHeader $fileid $i
43: MCexportLeafs $fileid $i
44: MCexportAns $fileid $i
45: }
46: -
47: {
48: tk_messageBox -icon error \
49: -message "Problem type $problem(prob.$i.type) not supported" \
50: -type ok
51: }
52: }
53: }
54:
55: exportQZFooter $fileid
56:
57: close $fileid
58:
59: tk_messageBox -icon info -message "Exported to $file" -type ok
60: }
61:
62: proc exportQZHeader { fileid } {
63: global problem
64:
65: puts $fileid "//Created by HACK GUI to qz files"
66: puts $fileid "//CAPA system software is copyrighted by Michigan State University."
67: puts $fileid "//"
68: puts $fileid "/IMP \"../Tools/StdMacros\""
69: puts $fileid "/IMP \"../Tools/StdUnits\""
70: if { $problem(includes) != "" } {
71: }
72: puts $fileid "/IMP \"HWTop\""
73: }
74:
75: proc exportQZFooter { fileid } {
76: global problem
77:
78: puts $fileid "//*********************"
79: puts $fileid "/END($problem(endline))"
80: }
81:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>