Changeset 1123


Ignore:
Timestamp:
Aug 19, 2008, 4:52:25 PM (16 years ago)
Author:
gah
Message:

add raise/lower of xy-graph elements

File:
1 edited

Legend:

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

    r1112 r1123  
    151151    common _downloadPopup          ;# download options from popup
    152152    private variable _markers
     153    private variable cur_ ""
    153154}
    154155                                                                               
     
    275276            -borderwidth 1 -padx 3 -pady 0 \
    276277            -text "L" -font "-*-times new roman-bold-i-*-*-11-*-*-*-*-*-*-*" \
    277             -command [list $itk_component(hull).legend activate \
    278                           $itk_component(controls).legend left]
     278            -command [subst {
     279                $itk_component(hull).legend activate \
     280                    $itk_component(controls).legend left
     281                focus $itk_component(hull).legend
     282            }]
    279283    } {
    280284        usual
     
    708712            [list ::Rappture::Tooltip::tooltip cancel]
    709713    }
    710     $g legend bind all <ButtonRelease> [itcl::code $this _legend toggle]
     714    $g legend bind all <ButtonRelease-1> [itcl::code $this _legend toggle]
    711715    $g legend bind all <ButtonRelease-3> [itcl::code $this _legend showall]
    712716    $g legend bind all <ButtonRelease-2> [itcl::code $this _legend showone]
     717    bind $itk_component(hull).legend <KeyPress-Down> \
     718        [itcl::code $this _legend raise]
     719    bind $itk_component(hull).legend <KeyPress-Up> \
     720        [itcl::code $this _legend lower]
     721    bind $itk_component(hull).legend <Shift-ButtonRelease-1> \
     722        [itcl::code $this _legend select]
    713723
    714724    #
     
    16391649            $g legend deactivate $cur
    16401650        }
    1641     }
    1642 }
     1651        "raise" {
     1652            if { $cur_ != "" } {
     1653                set g $itk_component(plot)
     1654                set display_list [$g element show]
     1655                set j [lsearch $display_list $cur_]
     1656                if { $j >= 1 } {
     1657                    set i [expr $j-1]
     1658                    set last [lindex $display_list $i]
     1659                    set display_list [lreplace $display_list $i $j]
     1660                    set display_list [linsert $display_list $i $cur_ $last]
     1661                    $g element show $display_list
     1662                    update
     1663                }
     1664            }
     1665        }
     1666        "lower" {
     1667            if { $cur_ != "" } {
     1668                set g $itk_component(plot)
     1669                set display_list [$g element show]
     1670                set i [lsearch $display_list $cur_]
     1671                if { $i >= 0 && $i < ([llength $display_list] - 1) } {
     1672                    set j [expr $i+1]
     1673                    set next [lindex $display_list $j]
     1674                    set display_list [lreplace $display_list $i $j]
     1675                    set display_list [linsert $display_list $i $next $cur_]
     1676                    $g element show $display_list
     1677                    update
     1678                }
     1679            }
     1680        }
     1681        "select" {
     1682            set g $itk_component(plot)
     1683            if { $cur_ != "" } {
     1684                $g element configure $cur_ -labelrelief flat
     1685            }
     1686            set cur_ [$g legend get current]
     1687            $g element configure $cur_ -hide no
     1688            $g legend deactivate $cur_
     1689            set relief [$g element cget $cur_ -labelrelief]
     1690            set relief [expr {($relief == "raised") ? "flat" : "raised"}]
     1691            $g element configure $cur_ -labelrelief $relief
     1692            if { $relief == "flat" } {
     1693                set cur_ ""
     1694            }
     1695            $g legend configure -relief flat
     1696        }
     1697    }
     1698}
Note: See TracChangeset for help on using the changeset viewer.