Changeset 5469 for branches/1.4


Ignore:
Timestamp:
May 7, 2015 2:17:47 PM (9 years ago)
Author:
ldelgass
Message:

fix legend toggle in vtkvolume

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.4/gui/scripts/vtkvolumeviewer.tcl

    r5465 r5469  
    13491349        }
    13501350        "-legendvisible" {
    1351             set bool $_settings($what)
     1351            DrawLegend
    13521352        }
    13531353        "-volumevisible" {
     
    21922192    set lineht [font metrics $font -linespace]
    21932193
     2194    if { !$_settings(-legendvisible) } {
     2195        $c delete legend
     2196        return
     2197    }
     2198
    21942199    if { [info exists _fields($fname)] } {
    21952200        foreach { title units } $_fields($fname) break
     
    22002205        set title $fname
    22012206    }
    2202     if { $_settings(-legendvisible) } {
    2203         set x [expr $w - 2]
    2204         if { [$c find withtag "legend"] == "" } {
    2205             set y 2
    2206             $c create text $x $y \
    2207                 -anchor ne \
    2208                 -fill $itk_option(-plotforeground) -tags "title legend" \
    2209                 -font $font
    2210             incr y $lineht
    2211             $c create text $x $y \
    2212                 -anchor ne \
    2213                 -fill $itk_option(-plotforeground) -tags "vmax legend" \
    2214                 -font $font
    2215             incr y $lineht
    2216             $c create image $x $y \
    2217                 -anchor ne \
    2218                 -image $_image(legend) -tags "colormap legend"
    2219             $c create text $x [expr {$h-2}] \
    2220                 -anchor se \
    2221                 -fill $itk_option(-plotforeground) -tags "vmin legend" \
    2222                 -font $font
    2223             #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
    2224             $c bind colormap <Leave> [itcl::code $this LeaveLegend]
    2225             $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    2226         }
    2227         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2228         $c bind title <Enter> [itcl::code $this Combo activate]
    2229         $c bind title <Leave> [itcl::code $this Combo deactivate]
    2230         # Reset the item coordinates according the current size of the plot.
    2231         $c itemconfigure title -text $title
    2232         if { [info exists _limits($_curFldName)] } {
    2233             foreach { vmin vmax } $_limits($_curFldName) break
    2234             $c itemconfigure vmin -text [format %g $vmin]
    2235             $c itemconfigure vmax -text [format %g $vmax]
    2236         }
     2207
     2208    set x [expr $w - 2]
     2209    if { [$c find withtag "legend"] == "" } {
    22372210        set y 2
    2238         $c coords title $x $y
     2211        $c create text $x $y \
     2212            -anchor ne \
     2213            -fill $itk_option(-plotforeground) -tags "title legend" \
     2214            -font $font
    22392215        incr y $lineht
    2240         $c coords vmax $x $y
     2216        $c create text $x $y \
     2217            -anchor ne \
     2218            -fill $itk_option(-plotforeground) -tags "vmax legend" \
     2219            -font $font
    22412220        incr y $lineht
    2242         $c coords colormap $x $y
    2243         $c coords vmin $x [expr {$h - 2}]
    2244     }
     2221        $c create image $x $y \
     2222            -anchor ne \
     2223            -image $_image(legend) -tags "colormap legend"
     2224        $c create text $x [expr {$h-2}] \
     2225            -anchor se \
     2226            -fill $itk_option(-plotforeground) -tags "vmin legend" \
     2227            -font $font
     2228        #$c bind colormap <Enter> [itcl::code $this EnterLegend %x %y]
     2229        $c bind colormap <Leave> [itcl::code $this LeaveLegend]
     2230        $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
     2231    }
     2232    $c bind title <ButtonPress> [itcl::code $this Combo post]
     2233    $c bind title <Enter> [itcl::code $this Combo activate]
     2234    $c bind title <Leave> [itcl::code $this Combo deactivate]
     2235    # Reset the item coordinates according the current size of the plot.
     2236    $c itemconfigure title -text $title
     2237    if { [info exists _limits($_curFldName)] } {
     2238        foreach { vmin vmax } $_limits($_curFldName) break
     2239        $c itemconfigure vmin -text [format %g $vmin]
     2240        $c itemconfigure vmax -text [format %g $vmax]
     2241    }
     2242    set y 2
     2243    $c coords title $x $y
     2244    incr y $lineht
     2245    $c coords vmax $x $y
     2246    incr y $lineht
     2247    $c coords colormap $x $y
     2248    $c coords vmin $x [expr {$h - 2}]
    22452249}
    22462250
Note: See TracChangeset for help on using the changeset viewer.