-# $Id: editor.tcl,v 1.72 2007/07/20 22:52:32 marko Exp $
+# $Id: editor.tcl,v 1.73 2007/08/10 18:31:52 ana Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
button $wi.custom.cfg.edit -text "Edit" \
-command "editStartupCfg $target 0"
button $wi.custom.cfg.clear -text "Clear" \
- -command "setCustomConfig $target {} {} {} 0"
+ -command "setCustomConfig $target {} {} {} 0 0"
pack $wi.custom.cfg.generate $wi.custom.cfg.edit \
$wi.custom.cfg.clear -side left
set id "generic"
set cmd [[typemodel $node].bootcmd $node]
set cfg [[typemodel $node].cfggen $node]
- setCustomConfig $node $id $cmd $cfg 0
+ setCustomConfig $node $id $cmd $cfg 0 0
}
frame $w.buttons
pack $w.buttons -side bottom
+ button $w.buttons.addccfg -text "Add new" \
+ -command "customConfigApply $w $node 1"
button $w.buttons.apply -text "Apply" \
- -command "customConfigApply $w $node"
- button $w.buttons.close -text Close -command "destroy $w"
+ -command "customConfigApply $w $node 0"
button $w.buttons.delete -text Delete -command \
"deleteCustomConfig $w $node $viewcustomid {} {} 1"
- pack $w.buttons.apply $w.buttons.close $w.buttons.delete -side left
+ button $w.buttons.close -text Close -command "destroy $w"
+ pack $w.buttons.addccfg $w.buttons.apply $w.buttons.delete \
+ $w.buttons.close -side left
pack $w.scroll -side right -fill y
pack $w.text -expand yes -fill both
# * w -- widget
# * node_id -- node id
#****
-proc customConfigApply { w node } {
+proc customConfigApply { w node addccfg } {
global changed
set newcmd [$w.ftop.cmd get]
[getCustomConfig $node] != $newconf } {
set changed 1
}
- setCustomConfig $node $newid $newcmd $newconf 0
+ setCustomConfig $node $newid $newcmd $newconf 0 $addccfg
destroy $w
- editStartupCfg $node 0
}
#****f* editor.tcl/popupConfigApply
canvas.tcl editor.tcl filemgmt.tcl help.tcl initgui.tcl \
quagga.tcl xorp.tcl static.tcl pc.tcl host.tcl \
lanswitch.tcl rj45.tcl hub.tcl ns2imunes.tcl ipsec.tcl \
- topogen.tcl annotations.tcl"
+ topogen.tcl annotations.tcl gpgui.tcl graph_partitioning.tcl"
tiny_icons="oval.gif delete.gif frswitch.gif host.gif hub.gif \
lanswitch.gif link.gif pc.gif rectangle.gif rj45.gif \
-# $Id: nodecfg.tcl,v 1.19 2007/07/19 03:14:13 marko Exp $
+# $Id: nodecfg.tcl,v 1.20 2007/08/10 18:31:52 ana Exp $
#
# Copyright 2004, 2005 University of Zagreb, Croatia. All rights reserved.
#
# *
#****
-proc setCustomConfig { node id cmd cfg delete } {
+proc setCustomConfig { node id cmd cfg delete addccfg } {
global viewcustomid
global $node
set $node [lreplace [set $node] $j $j]
}
+ set cnt 0
set indices [lsearch -all [set $node] "custom-config *"]
foreach i $indices {
+ set i [expr $i-$cnt]
+ set cnt [expr $cnt+1]
set tmp [lindex [set $node] $i]
set customCfg [lindex $tmp 1]
set cid [lindex [lsearch -inline $customCfg "custom-config-id *"] 1]
- if { $cid == $id } {
+
+ if { $addccfg == 0 && $delete == 0 } {
set $node [lreplace [set $node] $i $i]
- }
+ } elseif { $addccfg == 0 && $delete == 1 } {
+ if { $cid == $id } {
+ set $node [lreplace [set $node] $i $i]
+ }
+ } else {
+ if { $cid == $id } {
+ set warning "Choose another custom config id!"
+ tk_messageBox -message $warning -type ok -icon warning \
+ -title "Custom configuration id warning"
+ set $node [lreplace [set $node] $i $i]
+ }
+ }
+
}
if { $delete == 0 } {
proc deleteCustomConfig { w node id cmd cfg delete } {
global viewcustomid
- setCustomConfig $node $viewcustomid {} {} 1
+ setCustomConfig $node $viewcustomid {} {} 1 0
destroy $w
editStartupCfg $node 1
}