Ignore:
Timestamp:
Apr 26, 2006 6:42:46 PM (18 years ago)
Author:
mmc
Message:
  • Added <description> capability to output objects, including axes.
  • Fixed the ResultSet? so that it is more compact and supports the simulation number as a parameter. This is useful when there are datasets with wildly varying parameters.
File:
1 edited

Legend:

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

    r411 r413  
    3232
    3333option add *XyResult*Balloon*Entry.background white widgetDefault
    34 
    35 blt::bitmap define XyResult-reset {
    36 #define reset_width 12
    37 #define reset_height 12
    38 static unsigned char reset_bits[] = {
    39    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    40    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    41 }
    42 
    43 blt::bitmap define XyResult-dismiss {
    44 #define dismiss_width 10
    45 #define dismiss_height 8
    46 static unsigned char dismiss_bits[] = {
    47    0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00, 0x78, 0x00, 0xfc, 0x00,
    48    0xce, 0x01, 0x87, 0x03};
    49 }
    50 
    5134
    5235itcl::class Rappture::XyResult {
     
    117100        button $itk_component(controls).reset \
    118101            -borderwidth 1 -padx 1 -pady 1 \
    119             -bitmap XyResult-reset \
     102            -bitmap [Rappture::icon reset] \
    120103            -command [itcl::code $this _zoom reset]
    121104    } {
     
    150133    # Add support for editing axes:
    151134    #
    152     Rappture::Balloon $itk_component(hull).axes
     135    Rappture::Balloon $itk_component(hull).axes -title "Axis Options"
    153136    set inner [$itk_component(hull).axes component inner]
    154     set inner [frame $inner.bd -borderwidth 4 -relief flat]
    155     pack $inner -expand yes -fill both
    156 
    157     button $inner.dismiss -bitmap XyResult-dismiss \
    158         -relief flat -overrelief raised -command "
    159           Rappture::Tooltip::cue hide
    160           [list $itk_component(hull).axes deactivate]
    161         "
    162     grid $inner.dismiss -row 0 -column 1 -sticky e
    163137
    164138    label $inner.labell -text "Label:"
     
    494468                    $g axis configure $axis -title $label -hide no
    495469                    set _label2axis($ax-$label) $axis
     470
     471                    # if this axis has a description, add it as a tooltip
     472                    set desc [string trim [$xydata hints ${ax}desc]]
     473                    Rappture::Tooltip::text $g-$axis $desc
    496474                }
    497475            }
     
    531509        $g axis bind $axis <ButtonRelease> \
    532510            [itcl::code $this _axis release $axis %x %y]
     511        $g axis bind $axis <KeyPress> \
     512            [list ::Rappture::Tooltip::tooltip cancel]
    533513    }
    534514
     
    775755            if {$x > 0.5*[winfo width $g]} {
    776756                if {$x < 4} {
    777                     set x "-0"
     757                    set tipx "-0"
    778758                } else {
    779                     set x "-[expr {$x-4}]"  ;# move tooltip to the left
     759                    set tipx "-[expr {$x-4}]"  ;# move tooltip to the left
    780760                }
    781761            } else {
    782762                if {$x < -4} {
    783                     set x "+0"
     763                    set tipx "+0"
    784764                } else {
    785                     set x "+[expr {$x+4}]"  ;# move tooltip to the right
     765                    set tipx "+[expr {$x+4}]"  ;# move tooltip to the right
    786766                }
    787767            }
    788768            if {$y > 0.5*[winfo height $g]} {
    789769                if {$y < 4} {
    790                     set y "-0"
     770                    set tipy "-0"
    791771                } else {
    792                     set y "-[expr {$y-4}]"  ;# move tooltip to the top
     772                    set tipy "-[expr {$y-4}]"  ;# move tooltip to the top
    793773                }
    794774            } else {
    795775                if {$y < -4} {
    796                     set y "+0"
     776                    set tipy "+0"
    797777                } else {
    798                     set y "+[expr {$y+4}]"  ;# move tooltip to the bottom
     778                    set tipy "+[expr {$y+4}]"  ;# move tooltip to the bottom
    799779                }
    800780            }
    801781            Rappture::Tooltip::text $g $tip
    802             Rappture::Tooltip::tooltip show $g $x,$y
     782            Rappture::Tooltip::tooltip show $g $tipx,$tipy
    803783        }
    804784    } else {
     
    832812
    833813        $g crosshairs configure -hide yes
    834         Rappture::Tooltip::tooltip cancel
     814
     815        # only cancel in plotting area or we'll mess up axes
     816        if {[$g inside $x $y]} {
     817            Rappture::Tooltip::tooltip cancel
     818        }
    835819
    836820        # there is no currently highlighted element
     
    857841# ----------------------------------------------------------------------
    858842itcl::body Rappture::XyResult::_axis {option args} {
    859     set inner [$itk_component(hull).axes component inner].bd
     843    set inner [$itk_component(hull).axes component inner]
    860844
    861845    switch -- $option {
     
    864848                error "wrong # args: should be \"_axis hilite axis state\""
    865849            }
     850            set g $itk_component(plot)
    866851            set axis [lindex $args 0]
    867852            set state [lindex $args 1]
    868853
    869854            if {$state} {
    870                 $itk_component(plot) axis configure $axis \
     855                $g axis configure $axis \
    871856                    -color $itk_option(-activecolor) \
    872857                    -titlecolor $itk_option(-activecolor)
     858
     859                set x [expr {[winfo pointerx $g]+4}]
     860                set y [expr {[winfo pointery $g]+4}]
     861                Rappture::Tooltip::tooltip pending $g-$axis @$x,$y
    873862            } else {
    874                 $itk_component(plot) axis configure $axis \
     863                $g axis configure $axis \
    875864                    -color $itk_option(-foreground) \
    876865                    -titlecolor $itk_option(-foreground)
     866                Rappture::Tooltip::tooltip cancel
    877867            }
    878868        }
     
    892882            set _axis(min0) $min
    893883            set _axis(max0) $max
     884            Rappture::Tooltip::tooltip cancel
    894885        }
    895886        drag {
Note: See TracChangeset for help on using the changeset viewer.