]> git.entuzijast.net Git - imunes.git/commitdiff
Improvement of the custom configuration window (branch RELENG_4_11).
authorana <ana>
Sat, 11 Aug 2007 08:57:29 +0000 (08:57 +0000)
committerana <ana>
Sat, 11 Aug 2007 08:57:29 +0000 (08:57 +0000)
Bug found by:
Submitted by:
Reviewed by:
Approved by:
Obtained from:

editor.tcl
nodecfg.tcl

index 61341d84527bfe9bc9a69a2722184120a81c3100..5534fddd8f8b71bbfc1a14198e89533d3b55e732 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: editor.tcl,v 1.62.2.10 2007/07/20 17:08:39 miljenko Exp $ 
+# $Id: editor.tcl,v 1.62.2.11 2007/08/11 08:57:29 ana Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -338,8 +338,11 @@ proc drawNode { node } {
     set x [expr {[lindex $coords 0] * $zoom}]
     set y [expr {[lindex $coords 1] * $zoom}]
     if { [nodeType $node] != "pseudo" } {
+       set labelstr1 [getNodeName $node];
+       set labelstr2 [getNodePartition $node];
+       set l [format "%s\n%s" $labelstr1 $labelstr2];
        set label [.c create text $x $y -fill blue \
-           -text "[getNodeName $node]" \
+           -text "$l" \
            -tags "nodelabel $node"]
     } else {
        set pnode [getNodeName $node]
@@ -1487,7 +1490,7 @@ proc button1-motion { c x y } {
                        # actually we should check if curobj==bkgImage
     } elseif { $activetool == "oval" && \
       ( $curobj == $newoval || $curobj == $background || $curtype == "background" || $curtype == "grid")} {
-      # Draw a new oval
+       # Draw a new oval
        if {$newoval == ""} {
            set newoval [$c create oval $lastX $lastY $x $y \
                        -dash {10 4} -width 1 -tags "newoval"]
@@ -2220,7 +2223,7 @@ proc popupConfigDialog { c } {
            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
 
@@ -2423,7 +2426,7 @@ proc cfgGenerate { node } {
     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 
 }
 
 
@@ -2523,12 +2526,15 @@ proc editStartupCfg { node deleted } {
 
        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
@@ -2559,7 +2565,7 @@ proc editStartupCfg { node deleted } {
 #   * w -- widget
 #   * node_id -- node id
 #****
-proc customConfigApply { w node } {
+proc customConfigApply { w node addccfg } {
     global changed
 
     set newcmd [$w.ftop.cmd get]
@@ -2572,9 +2578,8 @@ proc customConfigApply { w node } {
        [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
index 2289cc5ac70e3c0c10a666da5a86260247b4e49a..74c0166647757533a73f915d284aef8f11613937 100755 (executable)
@@ -1,4 +1,4 @@
-# $Id: nodecfg.tcl,v 1.16.2.3 2007/07/19 03:31:22 marko Exp $ 
+# $Id: nodecfg.tcl,v 1.16.2.4 2007/08/11 08:57:29 ana Exp $ 
 #
 # Copyright 2004, 2005 University of Zagreb, Croatia.  All rights reserved.
 #
@@ -406,7 +406,7 @@ proc getCustomConfig { node } {
 #   * 
 #****
 
-proc setCustomConfig { node id cmd cfg delete } {
+proc setCustomConfig { node id cmd cfg delete addccfg } {
     global viewcustomid
     global $node
 
@@ -417,14 +417,30 @@ proc setCustomConfig { node id cmd cfg delete } {
        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 } {
@@ -454,7 +470,7 @@ proc setCustomConfig { node id cmd cfg delete } {
 proc deleteCustomConfig { w node id cmd cfg delete } {
     global viewcustomid
        
-    setCustomConfig $node $viewcustomid {} {} 1
+    setCustomConfig $node $viewcustomid {} {} 1 0
     destroy $w
     editStartupCfg $node 1
 }