# and Technology through the research contract #IP-2003-143.
#
-# $Id: filemgmt.tcl,v 1.17 2008/01/08 12:35:30 marko Exp $
+# $Id: filemgmt.tcl,v 1.18 2008/01/08 14:21:00 marko Exp $
##****h* imunes/filemgmt.tcl
proc newProject {} {
- global curcfg cfg_list sizex sizey
+ global curcfg cfg_list
set curcfg [newObjectId cfg]
lappend cfg_list $curcfg
set canvas_list {}
newCanvas ""
set curcanvas [lindex $canvas_list 0]
- set sizex [lindex [getCanvasSize $curcanvas] 0]
- set sizey [lindex [getCanvasSize $curcanvas] 1]
+ set currentFile ""
+ updateProjectMenu
+ switchProject
+}
+
+
+proc updateProjectMenu {} {
+ global curcfg cfg_list
+
+ .menubar.file delete 8 end
+ .menubar.file add separator
+
+ foreach cfg $cfg_list {
+ set fname [set ::cf::[set cfg]::currentFile]
+ if { $fname == "" } {
+ set fname "untitled[string range $cfg 1 end]"
+ }
+ .menubar.file add checkbutton -label $fname -variable curcfg \
+ -onvalue $cfg -command switchProject
+ }
+}
+
+
+proc switchProject {} {
+ upvar 0 ::cf::[set ::curcfg]::currentFile currentFile
+
switchCanvas none
redrawAll
- set currentFile ""
setWmTitle $currentFile
}
global curcfg
if { $fname == "" } {
- wm title . "IMUNES - untitled[string range $curcfg 1 end]"
- } else {
- wm title . "IMUNES - $fname"
+ set fname "untitled[string range $curcfg 1 end]"
}
+ wm title . "IMUNES - $fname"
}
set redolevel 0
set undolog(0) $cfg
set activetool select
- setWmTitle $fileName
+ updateProjectMenu
}
dumpCfg file $fileId
close $fileId
.bottom.textbox config -text "Saved $fileName"
- setWmTitle $fileName
+ updateProjectMenu
}
}
# Opens a open file dialog box.
#****
proc fileOpenDialogBox {} {
- upvar 0 ::cf::[set ::curcfg]::currentFile currentFile
global fileTypes
set selectedFile [tk_getOpenFile -filetypes $fileTypes]
if { $selectedFile != ""} {
+ newProject
+ upvar 0 ::cf::[set ::curcfg]::currentFile currentFile
set currentFile $selectedFile
openFile
}
# and Technology through the research contract #IP-2003-143.
#
-# $Id: imunes.tcl,v 1.35 2008/01/08 12:35:30 marko Exp $
+# $Id: imunes.tcl,v 1.36 2008/01/08 14:21:00 marko Exp $
#****h* imunes/imunes.tcl
set ::cf::[set curcfg]::currentFile $argv
openFile
}
+ updateProjectMenu
# Fire up the animation loop
animate
} else {
# and Technology through the research contract #IP-2003-143.
#
-# $Id: initgui.tcl,v 1.46 2008/01/08 12:35:30 marko Exp $
+# $Id: initgui.tcl,v 1.47 2008/01/08 14:21:00 marko Exp $
#****h* imunes/initgui.tcl
.menubar.file add separator
.menubar.file add command -label Quit -underline 0 -command { exit }
+.menubar.file add separator
#