Ignore:
Timestamp:
Sep 29, 2008, 8:08:49 AM (16 years ago)
Author:
gah
Message:

add recolor option to legend

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/xylegend.tcl

    r1152 r1167  
    7272    public method reset {}
    7373    public method Average {}
     74    public method Recolor {}
    7475    public method Check {}
    7576    public method Delete { args }
     
    150151        delete ""
    151152        rename ""
     153        recolor ""
    152154    }
    153155    foreach { but icon} $commands {
     
    167169    grid $controls.rename     -column 1 -row 2 -sticky w
    168170    grid $controls.delete     -column 1 -row 3 -sticky w
     171    grid $controls.recolor    -column 1 -row 4 -sticky w
    169172
    170173    grid columnconfigure $controls 0  -weight 1
     
    385388    set nodes [$itk_component(legend) curselection]
    386389    foreach n { hide show toggle raise lower
    387         rename average difference delete } {
     390        rename average difference delete recolor } {
    388391        $itk_component(controls).$n configure -state disabled
    389392    }
     
    403406        }
    404407        1 {
    405             foreach n { hide show toggle rename } {
     408            foreach n { hide show toggle rename recolor } {
    406409                $itk_component(controls).$n configure -state normal
    407410            }
    408411        }
    409412        2 {
    410             foreach n { hide show toggle difference average } {
     413            foreach n { hide show toggle difference average recolor } {
    411414                $itk_component(controls).$n configure -state normal
    412415            }
    413416        }
    414417        default {
    415             foreach n { hide show toggle average } {
     418            foreach n { hide show toggle average recolor } {
    416419                $itk_component(controls).$n configure -state normal
    417420            }
     
    536539}
    537540
     541
     542itcl::body Rappture::XyLegend::Recolor {} {
     543    set nodes [$itk_component(legend) curselection]
     544    if { $nodes == "" } {
     545        return
     546    }
     547    foreach node $nodes {
     548        set elem [$tree_ label $node]
     549        if { $lastColorIndex_ == 0 } {
     550            set lastColorIndex_ [llength $autocolors_]
     551        }
     552        incr lastColorIndex_ -1
     553        set color [lindex $autocolors_ $lastColorIndex_]
     554        $graph_ element configure $elem -color $color
     555        set im [$itk_component(legend) entry cget $node -icon]
     556        $graph_ legend icon $elem $im
     557    }
     558}
    538559
    539560itcl::body Rappture::XyLegend::SelectAll { } {
Note: See TracChangeset for help on using the changeset viewer.