# create a oval
proc popupOvalApply { c wi target} {
- global newoval oval_list
+ global newoval annotation_list
global $target
global changed
# build the oval object
if {$target == 0} {
- set object [newObjectId "oval"]
- lappend oval_list $object
+ set object [newObjectId annotation]
+ lappend annotation_list $object
set coords [$c coords "$newoval"]
} else {
set object $target
proc deleteAnnotation { c type target } {
- upvar ${type}_list type_list
- global changed
+ global changed annotation_list
$c delete -withtags "$type && $target"
$c delete -withtags "new$type"
- set i [lsearch -exact $type_list $target]
- set type_list [lreplace $type_list $i $i]
+ set i [lsearch -exact annotation_list $target]
+ set annotation_list [lreplace annotation_list $i $i]
set changed 1
updateUndoLog
}
# create a rectangle
proc popupRectApply { c wi target } {
- global newrect rectangle_list
+ global newrect annotation_list
global $target
global changed
set iconcoords "iconcoords"
# build the oval object
- # Prije: set object [newObjectId "rectangle"]
set object $target
if { $target == 0 } {
# Create a new rectangle object
- set target [newObjectId "rectangle"]
+ set target [newObjectId annotation]
global $target
- lappend rectangle_list $target
+ lappend annotation_list $target
set coords [$c coords $newrect]
} else {
set coords [getNodeCoords $target]
proc textEnter { c x y } {
- global text_list
+ global annotation_list
global curcanvas
- set object [newObjectId "text"]
+ set object [newObjectId annotation]
set newtext [$c create text $x $y -text "" \
-anchor w -justify left -tags "text $object"]
lappend $object "label {}"
setNodeCanvas $object $curcanvas
- lappend text_list $object
+ lappend annotation_list $object
textConfig $c $object
}
proc textConfigApply { c wi target } {
- global text_list
+ global annotation_list
global $target
global fontfamily fontsize textBold textItalic textUnderline
global changed
# build the oval object
if { $target == 0 } {
+ # XXX what is the purpose of this? --> leftover from copy/paste
+ xxx xxx xxx
set target [newObjectId "target"]
global $target
- lappend text_list $target
+ lappend annotation_list $target
set coords [$c coords $newtext]
} else {
set coords [getNodeCoords $target]
}
}
+proc drawAnnotation { obj } {
+ switch -exact -- [nodeType $obj] {
+ oval {
+ drawOval $obj
+ }
+ rectangle {
+ drawRect $obj
+ }
+ text {
+ drawText $obj
+ }
+ }
+}
-# $Id: cfgparse.tcl,v 1.15.2.4 2007/07/19 03:31:21 marko Exp $
+# $Id: cfgparse.tcl,v 1.15.2.5 2007/07/20 12:57:15 miljenko Exp $
#
# Copyright 2005 University of Zagreb, Croatia. All rights reserved.
#
#****
proc dumpCfg {method dest} {
- global node_list link_list canvas_list
+ global node_list link_list canvas_list annotation_list
global showIfNames showNodeLabels showLinkLabels
global showIfIPaddrs showIfIPv6addrs
global showIPsecConfig
global showBkgImage showGrid showAnnotations
- global oval_list rectangle_list text_list
foreach node $node_list {
global $node
dumpputs $method $dest ""
}
- foreach obj "rectangle oval text link canvas" {
+ foreach obj "link annotation canvas" {
upvar 0 ${obj}_list obj_list
foreach elem $obj_list {
global $elem
#****
proc loadCfg { cfg } {
- global node_list link_list canvas_list
+ global node_list link_list canvas_list annotation_list
global showIfNames showNodeLabels showLinkLabels
global showIfIPaddrs showIfIPv6addrs
global showIPsecConfig
global showBkgImage showGrid showAnnotations
- global oval_list rectangle_list text_list
# Cleanup first
set node_list {}
set link_list {}
+ set annotation_list {}
set canvas_list {}
- set oval_list {}
- set rectangle_list {}
- set text_list {}
set class ""
set object ""
foreach entry $cfg {
set $object {}
if {"$class" == "node"} {
lappend node_list $object
- }
- if {"$class" == "link"} {
+ } elseif {"$class" == "link"} {
lappend link_list $object
- }
- if {"$class" == "canvas"} {
+ } elseif {"$class" == "canvas"} {
lappend canvas_list $object
- }
- if {"$class" == "option"} {
- # for future use
- lappend prefs $object
- }
- if {"$class" == "rectangle"} {
- lappend rectangle_list $object
- }
- if {"$class" == "oval"} {
- lappend oval_list $object
- }
- if {"$class" == "text"} {
- lappend text_list $object
+ } elseif {"$class" == "option"} {
+ # do nothing
+ } elseif {"$class" == "annotation"} {
+ lappend annotation_list $object
+ } else {
+ puts "configuration parsing error: unknown object class $class"
+ exit 1
}
continue
} else {
}
}
}
- } elseif {"$class" == "oval" \
- || "$class" == "rectangle" \
- || "$class" == "text"} {
+ } elseif {"$class" == "annotation"} {
switch -exact -- $field {
+ type {
+ lappend $object "type $value"
+ }
iconcoords {
lappend $object "iconcoords {$value}"
}
#****
proc newObjectId { type } {
- global node_list link_list canvas_list
- global oval_list rectangle_list text_list
+ global node_list link_list annotation_list canvas_list
set mark [string range [set type] 0 0]
set id 0
-# $Id: editor.tcl,v 1.62.2.7 2007/07/19 08:00:47 marko Exp $
+# $Id: editor.tcl,v 1.62.2.8 2007/07/20 12:57:15 miljenko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
#****
proc redrawAll {} {
- global node_list link_list background sizex sizey grid
+ global node_list link_list annotation_list background sizex sizey grid
global curcanvas zoom
global showBkgImage showAnnotations showGrid bkgImage
- global oval_list label_list rectangle_list text_list
.bottom.zoom config -text "zoom [expr {int($zoom * 100)}]%"
set e_sizex [expr {int($sizex * $zoom)}]
set e_sizey [expr {int($sizey * $zoom)}]
}
if { $showAnnotations == 1 } {
- foreach rect $rectangle_list {
- if { [getNodeCanvas $rect] == $curcanvas } {
- drawRect $rect
- }
- }
- foreach oval $oval_list {
- if { [getNodeCanvas $oval] == $curcanvas } {
- drawOval $oval
- }
- }
- foreach text $text_list {
- if { [getNodeCanvas $text] == $curcanvas } {
- drawText $text
+ foreach obj $annotation_list {
+ if { [getNodeCanvas $obj] == $curcanvas } {
+ drawAnnotation $obj
}
}
}
$c raise interface "linklabel || link || grid || oval || rectangle || background"
$c raise node "interface || linklabel || link || grid || oval || rectangle || background"
$c raise nodelabel "node || interface || linklabel || link || grid || oval || rectangle || background"
- $c raise menuBubble "nodelabel || node || interface || linklabel || link || grid || oval || rectangle || background"
- $c raise text "menuBubble || nodelabel || node || interface || linklabel || link || grid || oval || rectangle || background"
+ $c raise text "nodelabel || node || interface || linklabel || link || grid || oval || rectangle || background"
}
#****f* editor.tcl/nodeEnter
-# $Id: imunes.tcl,v 1.19.2.4 2007/07/19 03:31:22 marko Exp $
+# $Id: imunes.tcl,v 1.19.2.5 2007/07/20 12:57:15 miljenko Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
set node_list {}
set link_list {}
+set annotation_list {}
set canvas_list {}
-set oval_list {}
-set rectangle_list {}
-set text_list {}
-set prefs {}
set eid e0
#****v* imunes.tcl/exec_hosts