Ignore:
Timestamp:
Jul 17, 2005 11:14:06 PM (19 years ago)
Author:
mmc
Message:

Fixed the device viewer to resize itself properly based on its
contents. The device layout takes into account the size of any
icon for a material layer, so a picture of a device can be embedded
by creating a single layer with an icon.

Fixed the Gauge to resize its icon area properly when the -spectrum
is configured later on.

File:
1 edited

Legend:

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

    r23 r24  
    1616package require BLT
    1717
    18 option add *DeviceViewer1D.width 4i widgetDefault
    19 option add *DeviceViewer1D.height 4i widgetDefault
    2018option add *DeviceViewer1D.padding 4 widgetDefault
    2119option add *DeviceViewer1D.deviceSize 0.25i widgetDefault
     
    3432    protected method _loadDevice {}
    3533    protected method _changeTabs {}
     34    protected method _fixSize {}
    3635    protected method _fixAxes {}
    3736    protected method _align {}
     
    6059    set _owner $owner
    6160
    62     itk_option add hull.width hull.height
    6361    pack propagate $itk_component(hull) no
    6462
     
    9593        blt::graph $itk_component(inner).graph \
    9694            -highlightthickness 0 -plotpadx 0 -plotpady 0 \
    97             -width 3i -height 3i
     95            -width 4i -height 2i
    9896    } {
    9997        keep -background -foreground -cursor -font
     
    120118
    121119    eval itk_initialize $args
     120
     121    _fixSize
    122122}
    123123
     
    294294    $itk_component(graph) configure \
    295295        -rightmargin [$itk_component(layout) extents bar3D]
     296
     297    _fixSize
    296298}
    297299
     
    408410    after cancel [itcl::code $this _fixAxes]
    409411    after 100 [itcl::code $this _fixAxes]
     412}
     413
     414# ----------------------------------------------------------------------
     415# USAGE: _fixSize
     416#
     417# Used internally to fix the overall size of this widget based on
     418# the various parts inside.  Sets the requested width/height of the
     419# widget so that it is big enough to display the device and its
     420# fields.
     421# ----------------------------------------------------------------------
     422itcl::body Rappture::DeviceViewer1D::_fixSize {} {
     423    update idletasks
     424    set w [winfo reqwidth $itk_component(tabs)]
     425    set h [winfo reqheight $itk_component(tabs)]
     426    component hull configure -width $w -height $h
    410427}
    411428
Note: See TracChangeset for help on using the changeset viewer.