Changeset 1767 for branches/blt4/gui/scripts
- Timestamp:
- Jun 20, 2010 11:32:36 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/gui/scripts/xylegend.tcl
r1764 r1767 66 66 private variable _rename ""; # Node selected to be renamed. 67 67 private variable _diffelements 68 private variable _unmapHidden 0 68 69 69 70 constructor {args} { graph } … … 74 75 private method Add { elem label {flags ""}} 75 76 private method Average {} 76 private method Check {} 77 private method BuildPopup { popup } 78 private method Check { menu } 77 79 private method Delete { args } 78 80 private method Difference {} … … 82 84 private method Lower { args } 83 85 private method Raise { args } 86 private method PopupMenu { x y } 84 87 private method Recolor {} 85 88 private method Rename {} … … 87 90 private method Show { args } 88 91 private method Toggle { args } 92 private method UnmapHidden {} 89 93 } 90 94 … … 152 156 $m add -text "Show" -command [itcl::code $this Show] 153 157 $m add -text "Toggle" -command [itcl::code $this Toggle] 158 $m add -text "Unmap Hidden" -command [itcl::code $this UnmapHidden] \ 159 -variable [itcl::scope _unmapHidden] \ 160 -type checkbutton 154 161 $m add -type separator 155 162 $m add -text "Lower" -command [itcl::code $this Lower] … … 162 169 $m add -text "Rename" -command [itcl::code $this Rename] 163 170 $m add -text "Delete" -command [itcl::code $this Delete] 164 171 set _unmapHidden [$graph cget -unmaphiddenelements] 165 172 set _graph $graph 166 173 set cmd [itcl::code $this Toggle current] … … 181 188 "$itk_component(legend) selection clearall" 182 189 $itk_component(legend) configure -selectcommand \ 183 [itcl::code $this Check] 184 190 [itcl::code $this Check $itk_component(controls)] 191 bind $itk_component(legend) <ButtonRelease-3> \ 192 [itcl::code $this PopupMenu %X %Y] 185 193 itk_component add editor { 186 194 Rappture::Editor $itk_interior.editor \ … … 194 202 1,0 $itk_component(scrollbars) -fill both 195 203 blt::table configure $itk_interior r0 -resize none 196 Check 204 Check $itk_component(controls) 197 205 eval itk_initialize $args 198 206 } … … 241 249 } 242 250 $itk_component(legend) open -recurse root 243 Check 251 Check $itk_component(controls) 244 252 } 245 253 … … 376 384 } 377 385 378 itcl::body Rappture::XyLegend::Check { } {386 itcl::body Rappture::XyLegend::Check { menu } { 379 387 set nodes [$itk_component(legend) curselection] 380 foreach n { Hide Show Toggle Raise Lower Rename Average Difference 381 Delete Recolor } { 382 $itk_component(controls) item configure $n -state disabled 383 } 388 $menu item configure all -state disabled 389 $menu item configure "Unmap Hidden" -state normal 384 390 foreach node $nodes { 385 391 if { [$_tree get $node "delete" 0] } { 386 $ itk_component(controls)item configure Delete -state normal392 $menu item configure Delete -state normal 387 393 break 388 394 } … … 390 396 if { [$_tree degree 0] > 1 && [llength $nodes] > 0 } { 391 397 foreach n { Raise Lower } { 392 $ itk_component(controls)item configure $n -state normal398 $menu item configure $n -state normal 393 399 } 394 400 } … … 398 404 1 { 399 405 foreach n { Hide Show Toggle Rename Recolor } { 400 $ itk_component(controls)item configure $n -state normal406 $menu item configure $n -state normal 401 407 } 402 408 } 403 409 2 { 404 410 foreach n { Hide Show Toggle Difference Average Recolor } { 405 $ itk_component(controls)item configure $n -state normal411 $menu item configure $n -state normal 406 412 } 407 413 } 408 414 default { 409 415 foreach n { Hide Show Toggle Average Recolor } { 410 $ itk_component(controls)item configure $n -state normal416 $menu item configure $n -state normal 411 417 } 412 418 } … … 557 563 } 558 564 565 itcl::body Rappture::XyLegend::UnmapHidden {} { 566 $_graph configure -unmaphiddenelements $_unmapHidden 567 } 568 559 569 itcl::body Rappture::XyLegend::SelectAll { } { 560 570 foreach node [$_tree children 0] { … … 618 628 } 619 629 } 630 631 # 632 # BuildPopup -- 633 # 634 # 635 itcl::body Rappture::XyLegend::BuildPopup { popup } { 636 set m $popup 637 blt::combomenu $popup \ 638 -yscrollbar $m.ys \ 639 -xscrollbar $m.xs -height { 0 2.5i } 640 blt::tk::scrollbar $m.xs 641 blt::tk::scrollbar $m.ys 642 $m add -text "Hide" -command [itcl::code $this Hide] 643 $m add -text "Show" -command [itcl::code $this Show] 644 $m add -text "Toggle" -command [itcl::code $this Toggle] 645 $m add -text "Unmap Hidden" -command [itcl::code $this UnmapHidden] \ 646 -variable [itcl::scope _unmapHidden] \ 647 -type checkbutton 648 $m add -type separator 649 $m add -text "Lower" -command [itcl::code $this Lower] 650 $m add -text "Raise" -command [itcl::code $this Raise] 651 $m add -type separator 652 $m add -text "Average" -command [itcl::code $this Average] 653 $m add -text "Difference" -command [itcl::code $this Difference] 654 $m add -type separator 655 $m add -text "Recolor" -command [itcl::code $this Recolor] 656 $m add -text "Rename" -command [itcl::code $this Rename] 657 $m add -text "Delete" -command [itcl::code $this Delete] 658 set _unmapHidden [$_graph cget -unmaphiddenelements] 659 set cmd [itcl::code $this Toggle current] 660 Check $m 661 } 662 663 # 664 # PopupMenu -- 665 # 666 # Builds the popup associated with the sensor map. The menu 667 # is first destroyed if one exists. This is because the menu 668 # bindings callbacks are specific to the current map. Destroying 669 # the menu automatically removes the bindings and callbacks. 670 # 671 itcl::body Rappture::XyLegend::PopupMenu { x y } { 672 set m .xylegendpopup 673 if { [winfo exists $m] } { 674 destroy $m 675 } 676 BuildPopup $m 677 blt::ComboMenu::popup $m $x $y 678 }
Note: See TracChangeset
for help on using the changeset viewer.