]> git.entuzijast.net Git - imunes.git/commitdiff
Provide transparent conversion from old-style file format (no canvases)
authormarko <marko>
Wed, 2 Nov 2005 13:47:56 +0000 (13:47 +0000)
committermarko <marko>
Wed, 2 Nov 2005 13:47:56 +0000 (13:47 +0000)
to the new one when loading an existing file.

Bug found by: Gordan Gledec
Submitted by:
Requested by:
Reviewed by:
Approved by:
Obtained from:

canvas.tcl
cfgparse.tcl

index df12d5f2caf152502c2e9c9b213a6ff2a63e46c5..8cb2408cb1495f5f17ba0f7f709f446893431caa 100755 (executable)
@@ -52,7 +52,8 @@ proc newCanvas { name } {
     } else {
        set $canvas [list "name Canvas[string range $canvas 1 end]"]
     }
-    return
+
+    return $canvas
 }
 
 
index 4c0e61b4be15e85e344b859f1bfdea145ccf900e..e50e6fee4ba09b031e0490bd58c2f447c16cca3c 100755 (executable)
@@ -300,6 +300,27 @@ proc loadCfg { cfg } {
        set class ""
        set object ""
     }
+
+    #
+    # Hack for comaptibility with old format files (no canvases)
+    #
+    if { $canvas_list == "" } {
+       global curcanvas sizex sizey
+
+       set curcanvas [newCanvas ""]
+       foreach node $node_list {
+           setNodeCanvas $node $curcanvas
+           set x [lindex [getNodeCoords $node] 0]
+           set y [lindex [getNodeCoords $node] 1]
+           if { $x > $sizex } {
+               set sizex [expr $x + 32]
+           }
+           if { $y > $sizey } {
+               set sizey [expr $y + 32]
+           }
+       }
+    }
+
     return
 }