From d9c1d7d4841c8f1f69ca42467665192a23914bd1 Mon Sep 17 00:00:00 2001 From: marko Date: Wed, 2 Nov 2005 13:47:56 +0000 Subject: [PATCH] Provide transparent conversion from old-style file format (no canvases) 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 | 3 ++- cfgparse.tcl | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/canvas.tcl b/canvas.tcl index df12d5f..8cb2408 100755 --- a/canvas.tcl +++ b/canvas.tcl @@ -52,7 +52,8 @@ proc newCanvas { name } { } else { set $canvas [list "name Canvas[string range $canvas 1 end]"] } - return + + return $canvas } diff --git a/cfgparse.tcl b/cfgparse.tcl index 4c0e61b..e50e6fe 100755 --- a/cfgparse.tcl +++ b/cfgparse.tcl @@ -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 } -- 2.39.5