OSDN Git Service

* sid-visual-sched.tk patch from the following changeset.
authorbje <bje>
Wed, 8 Jan 2003 03:49:50 +0000 (03:49 +0000)
committerbje <bje>
Wed, 8 Jan 2003 03:49:50 +0000 (03:49 +0000)
* missed by merge?

2002-01-09  Graydon Hoare  <graydon@redhat.com>

* compSched.cxx (scheduler_client): New member "name".
(client_num_update): Hook up "N-name" attribute to client->name.
* sid-visual-sched.tk (relate): Load subscription names into GUI,
ghost subscriptions which have no output pins connected.
* sid-sched.xml: Document new N-name attributes.
* sid-sched.txt: Regenerate.

sid/component/sched/sid-visual-sched.tk

index c238fdc..65e12f2 100644 (file)
@@ -42,29 +42,47 @@ proc toggle_subscription {sched n} {
 
 proc make_toggle {sched n caption} {
     global saved_subs
+    global labels
+    set labels($n) $caption
     set saved_subs($sched,$n) {0 no}
-    checkbutton .rc.toggle-$n -text $caption -command [list toggle_subscription $sched $n]
-    grid .rc.toggle-$n -sticky w
+    checkbutton .rc.toggle-$n -textvariable labels($n) -command [list toggle_subscription $sched $n]
+    grid .rc.toggle-$n -column 0 -row $n -sticky w
 }
 
+proc refresh {sched} {
+    global labels
+    set n [sid::component::attribute_value $sched num-clients]
+    for {set i 0} {$i < $n} {incr i} { 
+       set name [sid::component::attribute_value $sched "$i-name"]
+       if { $name != [array get labels $i] } {
+           if { $name != {} } {
+               set labels($i) "pause $name"
+           }
+       }
+       
+       if { [sid::component::connected_pins $sched "$i-event"] == {} } {
+           .rc.toggle-$i configure -state "disabled"
+       } else {
+           .rc.toggle-$i configure -state "normal"
+       }
+    }
+    after 500 [list refresh $sched]
+}
 
 proc relate {rel comp} {
-    global names
+    global labels
     set n [sid::component::attribute_value $comp num-clients]
     for {set i 0} {$i < $n} {incr i} {
-       if {[array get names $i] == {}} {
-           make_toggle $comp $i "pause subscription $i"
-       } else {
-           make_toggle $comp $i "pause $names($i)"
-       }
+       make_toggle $comp $i "pause subscription $i"
     }
+    refresh $comp
     return ok
 }
 
 proc set_attribute_value {name value} {
-    global names
+    global labels
     if {[regexp {^([0-9]+)-name$} $name zz num] != 0} {
-       set names($num) $value
+       set labels($num) $value
        return ok
     } else {
        return bad_value 
@@ -89,4 +107,5 @@ proc relationship_names {} { return "" }
 frame .rc
 pack .rc
 wm title . "scheduler controls"
+wm positionfrom . user
 update