Changeset 413


Ignore:
Timestamp:
Apr 26, 2006 6:42:46 PM (15 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.
Location:
trunk
Files:
5 added
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/examples/zoo/curve/tool.xml

    r72 r413  
    2626<output>
    2727  <curve id="single">
    28     <about><label>Single curve</label></about>
     28    <about>
     29      <label>Single curve</label>
     30      <description>This is an example of a single curve.</description>
     31    </about>
    2932    <xaxis>
    3033      <label>Time</label>
     34      <description>Time during the experiment.</description>
    3135      <units>s</units>
    3236    </xaxis>
    3337    <yaxis>
    3438      <label>Voltage v(11)</label>
     39      <description>Output from the amplifier.</description>
    3540      <units>V</units>
    3641    </yaxis>
     
    4146      <group>Multiple curves</group>
    4247      <label>Factor a=1</label>
     48      <description>This is an example of multiple curves on the same plot.</description>
    4349    </about>
    4450    <xaxis>
    4551      <label>Frequency</label>
     52      <description>Frequency of the input source.</description>
    4653      <units>Hz</units>
    4754      <scale>log</scale>
     
    4956    <yaxis>
    5057      <label>Current</label>
     58      <description>Current through the pull-down resistor.</description>
    5159      <units>uA</units>
    5260      <scale>log</scale>
     
    5866      <group>Multiple curves</group>
    5967      <label>Factor a=2</label>
     68      <description>This is an example of multiple curves on the same plot.</description>
    6069    </about>
    6170    <xaxis>
    6271      <label>Frequency</label>
     72      <description>Frequency of the input source.</description>
    6373      <units>Hz</units>
    6474      <scale>log</scale>
     
    6676    <yaxis>
    6777      <label>Current</label>
     78      <description>Current through the pull-down resistor.</description>
    6879      <units>uA</units>
    6980      <scale>log</scale>
  • trunk/gui/Makefile.in

    r193 r413  
    339339        $(TCLSH_PROG) $(srcdir)/cf/mkindex.tcl $(DESTDIR)$(pkglibdir)/scripts
    340340        $(mkinstalldirs) $(pkglibdir)/scripts/images
    341         @for i in $(srcdir)/scripts/images/*.gif; do \
     341        @for i in $(srcdir)/scripts/images/*.gif \
     342                $(srcdir)/scripts/images/*.xbm; do \
    342343            echo "Installing $$i" ; \
    343344            $(INSTALL_DATA) $$i $(DESTDIR)$(pkglibdir)/scripts/images ; \
  • trunk/gui/apps/driver

    r365 r413  
    5050option add *Switch.textBackground white
    5151option add *Progress.barColor #ffffcc
     52option add *Balloon.titleBackground #6666cc
     53option add *Balloon.titleForeground white
     54option add *ResultSet.controlbarBackground #6666cc
     55option add *ResultSet.controlbarForeground white
     56option add *ResultSet.activeControlBackground #ccccff
     57option add *ResultSet.activeControlForeground black
     58option add *Radiodial.length 3i
    5259
    5360switch $tcl_platform(platform) {
     
    8390
    8491set tool [Rappture::Tool ::#auto $xmlobj $installdir]
     92
     93# ----------------------------------------------------------------------
     94# LOAD RESOURCE SETTINGS
     95#
     96# Try to load the $SESSIONDIR/resources file, which contains
     97# middleware settings, such as the application name and the
     98# filexfer settings.
     99# ----------------------------------------------------------------------
     100Rappture::resources::load
    85101
    86102# ----------------------------------------------------------------------
  • trunk/gui/scripts/analyzer.tcl

    r216 r413  
    6464    protected method _simState {state args}
    6565    protected method _simOutput {message}
     66    protected method _resultTooltip {}
    6667
    6768    private variable _tool ""          ;# belongs to this tool
     
    7071    private variable _pages 0          ;# number of pages for result sets
    7172    private variable _label2page       ;# maps output label => result set
     73    private variable _label2desc       ;# maps output label => description
    7274    private variable _lastlabel ""     ;# label of last example loaded
    7375    private variable _plotlist ""      ;# items currently being plotted
     
    7577    private common job                 ;# array var used for blt::bgexec jobs
    7678
    77     private common icons
    78     set icons(download) [image create photo -data {
    79 R0lGODlhFAAUAMYBAAAAAP///+js9vL1+4yhxrbD21h6sFp8slx+tV6Bt2CFumSIvmOHvWaLwGyS
    80 yG6UynCRwWiOw2yUyXCZzm+XzG+Wy3Oc0XKaz3We1Hqk23mj2Xqk2nmi2ICex/T3+3Od0nqm3Hag
    81 1Xun3Iat3ZK56JK03t7n8uzy+PX4+/f5+/T4+/L3+vn7/Pj7/Pf7/Pb6+/n9/fz///r9/fn8/Pz+
    82 /vv9/fr8/Pz9/UGMfluegZzRp6XYqwWXC67frwCZAAKaAgOaAgOaAwWbBQabBQicCA6fDg6eDw+f
    83 Dw+fEA+eDxCfEF6/Xl+/X6TbpKbbpqzerK7frq3era/fr/z+/P3+/bXjsXjSbKrjotbw02bSVKvj
    84 olnSQYPfcJbjh5/jk1TSOV7XQm3bVIvidprmiKjqmXTgV4DjZrPuo7TupNb1zo/qc5nsf8L0s8Hz
    85 sar0j7L1mdD5wdH5wur+4eL91f///////////////////////////////////////////////yH5
    86 BAEAAH8ALAIAAgAQABAAAAfYgAUlIiAbHCEYHxcTFRIdBX8jJJOUlZQQfyKam5ycDX8ZAaKjpKMM
    87 fxoBLC0pHis7Rz5GOiYBCn8cATI2LC8oSFhVWEkCAQl/IQE3NTIzLj5aVlc+JwEIfxgBNDXLMD5e
    88 WV4+AwEHfxbaNNs1Pl1bXT4qAQZ/FAExPUo++1xfXPs+eEh5IIpJGjJjxIQBE0bMGDJpljgQFQUI
    89 GjNlMmY0c0bIEwIRGizAEYTNGjUo17QhkoPKn5cvnwSJ88bNGzhEmkyByfPJDzlz5AxxspMnTyix
    90 ijxx+TIQADs=
    91 }]
     79    # resources file tells us the results directory
     80    public common _resultdir ""
     81    public proc setResultDir {path} { set _resultdir $path }
     82}
     83
     84# must use this name -- plugs into Rappture::resources::load
     85proc analyzer_init_resources {} {
     86    Rappture::resources::register \
     87        results_directory Rappture::Analyzer::setResultDir
    9288}
    9389                                                                               
     
    214210        [itcl::code $this download coming]
    215211
     212    Rappture::Tooltip::for $itk_component(resultselector) \
     213        "@[itcl::code $this _resultTooltip]"
     214
    216215    if {[Rappture::filexfer::enabled]} {
    217216        $itk_component(resultselector) choices insert end \
     
    221220
    222221        itk_component add download {
    223             button $w.top.dl -image $icons(download) -anchor e \
     222            button $w.top.dl -image [Rappture::icon download] -anchor e \
    224223                -borderwidth 1 -relief flat -overrelief raised \
    225224                -command [itcl::code $this download now $w.top.dl]
     
    235234
    236235    itk_component add results {
    237         Rappture::Panes $w.pane
     236        Rappture::Panes $w.pane -sashwidth 1 -sashrelief solid -sashpadding {4 0}
    238237    }
    239238    pack $itk_component(results) -expand yes -fill both
     
    254253    pack $itk_component(resultset) -expand yes -fill both
    255254    bind $itk_component(resultset) <<Control>> [itcl::code $this _fixSize]
     255    bind $itk_component(results) <Configure> [itcl::code $this _fixSize]
    256256
    257257    eval itk_initialize $args
     
    360360                set result "$msg\n$errorInfo"
    361361            }
     362
     363            # if there's a results_directory defined in the resources
     364            # file, then move the run.xml file there for storage
     365            if {"" != $_resultdir} {
     366                file rename -force -- $file $_resultdir
     367            }
    362368        } else {
    363369            set status 1
    364             set result "Can't find result file in output:\n\n$result"
     370            set result "Can't find result file in output.\nDid you call Rappture::result in your simulator?"
    365371        }
    366372    }
     
    465471    # if there are any valid results, add them to the resultset
    466472    if {$haveresults} {
    467         set size [$itk_component(resultset) size]
    468473        set index [$itk_component(resultset) add $xmlobj]
    469474
     
    483488                    set page [$itk_component(resultpages) insert end $name]
    484489                    set _label2page($label) $page
     490                    set _label2desc($label) \
     491                        [$xmlobj get output.$item.about.description]
    485492                    Rappture::ResultViewer $page.rviewer
    486493                    pack $page.rviewer -expand yes -fill both -pady 4
     
    535542
    536543    $itk_component(resultset) clear
    537     $itk_component(results) fraction end 0.1
     544
     545    # reset the size of the controls area
     546    set ht [winfo height $itk_component(results)]
     547    set cntlht [$itk_component(resultset) size -controlarea]
     548    set frac [expr {double($cntlht)/$ht}]
     549    $itk_component(results) fraction end $frac
    538550
    539551    foreach label [array names _label2page] {
     
    544556    $itk_component(resultselector) choices delete 0 end
    545557    catch {unset _label2page}
     558    catch {unset _label2desc}
    546559    set _plotlist ""
    547560
     
    775788# ----------------------------------------------------------------------
    776789itcl::body Rappture::Analyzer::_fixSize {} {
    777     set f [$itk_component(results) fraction end]
    778     if {$f < 0.4} {
    779         $itk_component(results) fraction end [expr {$f+0.15}]
     790    set ht [winfo height $itk_component(results)]
     791    if {$ht <= 1} { set ht [winfo reqheight $itk_component(results)] }
     792    set cntlht [$itk_component(resultset) size -controlarea]
     793    set frac [expr {double($cntlht)/$ht}]
     794
     795    if {$frac < 0.4} {
     796        $itk_component(results) fraction end $frac
    780797    }
    781798    _fixSimControl
     
    937954
    938955# ----------------------------------------------------------------------
     956# USAGE: _resultTooltip
     957#
     958# Used internally to build the tooltip string displayed for the
     959# result selector.  If the current page has an associated description,
     960# then it is displayed beneath the result.
     961#
     962# Returns the string for the tooltip.
     963# ----------------------------------------------------------------------
     964itcl::body Rappture::Analyzer::_resultTooltip {} {
     965    set tip ""
     966    set name [$itk_component(resultselector) value]
     967    if {[info exists _label2desc($name)] &&
     968         [string length $_label2desc($name)] > 0} {
     969        append tip "$_label2desc($name)\n\n"
     970    }
     971    if {[array size _label2page] > 1} {
     972        append tip "Use this control to display other output results."
     973    }
     974    return $tip
     975}
     976
     977# ----------------------------------------------------------------------
    939978# USAGE: _fixSimControl
    940979#
  • trunk/gui/scripts/balloon.tcl

    r115 r413  
    1919namespace eval Rappture { # forward declaration }
    2020
     21option add *Balloon.dismissButton on widgetDefault
     22option add *Balloon.padX 4 widgetDefault
     23option add *Balloon.padY 4 widgetDefault
     24option add *Balloon.titleBackground #999999 widgetDefault
     25option add *Balloon.titleForeground white widgetDefault
     26option add *Balloon.relief raised widgetDefault
    2127option add *Balloon.stemLength 16 widgetDefault
    2228
     
    2430    inherit itk::Toplevel
    2531
     32    itk_option define -deactivatecommand deactivateCommand DeactivateCommand ""
     33    itk_option define -dismissbutton dismissButton DismissButton "on"
     34    itk_option define -padx padX Pad 0
     35    itk_option define -pady padY Pad 0
     36    itk_option define -title title Title ""
     37    itk_option define -titlebackground titleBackground Background ""
     38    itk_option define -titleforeground titleForeground Foreground ""
    2639    itk_option define -stemlength stemLength StemLength 20
    27     itk_option define -deactivatecommand deactivateCommand DeactivateCommand ""
    2840
    2941    constructor {args} { # defined below }
     
    5365    wm overrideredirect $itk_component(hull) yes
    5466    wm withdraw $itk_component(hull)
    55     component hull configure -borderwidth 1 -relief solid
     67    component hull configure -borderwidth 1 -relief solid -padx 0 -pady 0
     68
     69    itk_component add border {
     70        frame $itk_interior.border -borderwidth 2
     71    } {
     72        usual
     73        keep -relief
     74    }
     75    pack $itk_component(border) -expand yes -fill both
     76
     77    itk_component add titlebar {
     78        frame $itk_component(border).tbar
     79    } {
     80        usual
     81        rename -background -titlebackground titleBackground Background
     82    }
     83
     84    itk_component add title {
     85        label $itk_component(titlebar).title -width 1 -anchor w
     86    } {
     87        usual
     88        rename -background -titlebackground titleBackground Background
     89        rename -foreground -titleforeground titleForeground Foreground
     90        rename -highlightbackground -titlebackground titleBackground Background
     91        rename -text -title title Title
     92    }
     93    pack $itk_component(title) -side left -expand yes -fill both -padx 2
     94
     95    itk_component add dismiss {
     96        button $itk_component(titlebar).dismiss \
     97            -bitmap [Rappture::icon dismiss] \
     98            -relief flat -overrelief raised -command "
     99              Rappture::Tooltip::cue hide
     100              [list $itk_component(hull) deactivate]
     101            "
     102    } {
     103        usual
     104        rename -background -titlebackground titleBackground Background
     105        rename -foreground -titleforeground titleForeground Foreground
     106        rename -highlightbackground -titlebackground titleBackground Background
     107    }
    56108
    57109    itk_component add inner {
    58         frame $itk_interior.inner -borderwidth 2 -relief raised
     110        frame $itk_component(border).inner
    59111    }
    60112    pack $itk_component(inner) -expand yes -fill both
     
    85137    set sh [image height $_fills($placement)]
    86138    set p $itk_component(hull)
     139    set screenw [winfo screenwidth $p]
     140    set screenh [winfo screenheight $p]
    87141
    88142    if {[winfo exists $where]} {
     
    104158    deactivate
    105159
     160    set pw [winfo reqwidth $p]
     161    if {$pw > $screenw} { set pw [expr {$screenw-10}] }
     162    set ph [winfo reqheight $p]
     163    if {$ph > $screenh} { set ph [expr {$screenh-10}] }
     164
    106165    switch -- $placement {
    107166        left {
    108167            set sx [expr {$x-$sw+3}]
    109168            set sy [expr {$y-$sh/2}]
    110             set px [expr {$sx-[winfo reqwidth $p]+3}]
    111             set py [expr {$y-[winfo reqheight $p]/2}]
     169            set px [expr {$sx-$pw+3}]
     170            set py [expr {$y-$ph/2}]
     171
     172            # make sure that the panel doesn't go off-screen
     173            if {$py < 0} { set py 0 }
     174            if {$py+$ph > $screenh} { set py [expr {$screenh-$ph}] }
     175            if {$px < 0} { set pw [expr {$pw+$px}]; set px 0 }
    112176        }
    113177        right {
     
    115179            set sy [expr {$y-$sh/2}]
    116180            set px [expr {$x+$sw-3}]
    117             set py [expr {$y-[winfo reqheight $p]/2}]
     181            set py [expr {$y-$ph/2}]
     182
     183            # make sure that the panel doesn't go off-screen
     184            if {$py < 0} { set py 0 }
     185            if {$py+$ph > $screenh} { set py [expr {$screenh-$ph}] }
     186            if {$px+$pw > $screenw} { set pw [expr {$screenw-$px)}] }
    118187        }
    119188        above {
    120189            set sx [expr {$x-$sw/2}]
    121190            set sy [expr {$y-$sh+3}]
    122             set px [expr {$x-[winfo reqwidth $p]/2}]
    123             set py [expr {$sy-[winfo reqheight $p]+3}]
     191            set px [expr {$x-$pw/2}]
     192            set py [expr {$sy-$ph+3}]
     193
     194            # make sure that the panel doesn't go off-screen
     195            if {$px < 0} { set px 0 }
     196            if {$px+$pw > $screenw} { set px [expr {$screenw-$pw}] }
     197            if {$py < 0} { set ph [expr {$ph+$py}]; set py 0 }
    124198        }
    125199        below {
    126200            set sx [expr {$x-$sw/2}]
    127201            set sy $y
    128             set px [expr {$x-[winfo reqwidth $p]/2}]
     202            set px [expr {$x-$pw/2}]
    129203            set py [expr {$y+$sh-3}]
     204
     205            # make sure that the panel doesn't go off-screen
     206            if {$px < 0} { set px 0 }
     207            if {$px+$pw > $screenw} { set px [expr {$screenw-$pw}] }
     208            if {$py+$ph > $screenh} { set ph [expr {$screenh-$py)}] }
    130209        }
    131210    }
     
    134213    }
    135214
    136     wm geometry $p +$px+$py
     215    wm geometry $p ${pw}x${ph}+$px+$py
    137216    wm deiconify $p
    138217    raise $p
     
    408487    }
    409488}
     489
     490# ----------------------------------------------------------------------
     491# CONFIGURATION OPTION: -dismissbutton
     492# ----------------------------------------------------------------------
     493itcl::configbody Rappture::Balloon::dismissbutton {
     494    if {![string is boolean $itk_option(-dismissbutton)]} {
     495        error "bad value \"$itk_option(-dismissbutton)\": should be on/off, 1/0, true/false, yes/no"
     496    }
     497    if {$itk_option(-dismissbutton)} {
     498        pack $itk_component(titlebar) -before $itk_component(inner) \
     499            -side top -fill x
     500        pack $itk_component(dismiss) -side right -padx 4
     501    } elseif {"" != $itk_option(-title)} {
     502        pack $itk_component(titlebar) -before $itk_component(inner) \
     503            -side top -fill x
     504        pack forget $itk_component(dismiss)
     505    } else {
     506        pack forget $itk_component(titlebar)
     507    }
     508}
     509
     510# ----------------------------------------------------------------------
     511# CONFIGURATION OPTION: -padx
     512# ----------------------------------------------------------------------
     513itcl::configbody Rappture::Balloon::padx {
     514    pack $itk_component(inner) -padx $itk_option(-padx)
     515}
     516
     517# ----------------------------------------------------------------------
     518# CONFIGURATION OPTION: -pady
     519# ----------------------------------------------------------------------
     520itcl::configbody Rappture::Balloon::pady {
     521    pack $itk_component(inner) -pady $itk_option(-pady)
     522}
     523
     524# ----------------------------------------------------------------------
     525# CONFIGURATION OPTION: -title
     526# ----------------------------------------------------------------------
     527itcl::configbody Rappture::Balloon::title {
     528    if {"" != $itk_option(-title) || $itk_option(-dismissbutton)} {
     529        pack $itk_component(titlebar) -before $itk_component(inner) \
     530            -side top -fill x
     531        if {$itk_option(-dismissbutton)} {
     532            pack $itk_component(dismiss) -side right -padx 4
     533        } else {
     534            pack forget $itk_component(dismiss)
     535        }
     536    } else {
     537        pack forget $itk_component(titlebar)
     538    }
     539}
  • trunk/gui/scripts/contourresult.tcl

    r220 r413  
    1818package require BLT
    1919package require Img
    20 
    21 blt::bitmap define ContourResult-reset {
    22 #define reset_width 12
    23 #define reset_height 12
    24 static unsigned char reset_bits[] = {
    25    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    26    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    27 }
    28 
    29 blt::bitmap define ContourResult-zoomin {
    30 #define zoomin_width 12
    31 #define zoomin_height 12
    32 static unsigned char zoomin_bits[] = {
    33    0x7c, 0x00, 0x82, 0x00, 0x11, 0x01, 0x11, 0x01, 0x7d, 0x01, 0x11, 0x01,
    34    0x11, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    35 }
    36 
    37 blt::bitmap define ContourResult-zoomout {
    38 #define zoomout_width 12
    39 #define zoomout_height 12
    40 static unsigned char zoomout_bits[] = {
    41    0x7c, 0x00, 0x82, 0x00, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
    42    0x01, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    43 }
    44 
    45 blt::bitmap define ContourResult-xslice {
    46 #define x_width 12
    47 #define x_height 12
    48 static unsigned char x_bits[] = {
    49    0x00, 0x00, 0x00, 0x00, 0x9c, 0x03, 0x98, 0x01, 0xf0, 0x00, 0x60, 0x00,
    50    0x60, 0x00, 0xf0, 0x00, 0x98, 0x01, 0x9c, 0x03, 0x00, 0x00, 0x00, 0x00};
    51 }
    52 
    53 blt::bitmap define ContourResult-yslice {
    54 #define y_width 12
    55 #define y_height 12
    56 static unsigned char y_bits[] = {
    57    0x00, 0x00, 0x00, 0x00, 0x0e, 0x07, 0x0c, 0x03, 0x98, 0x01, 0xf0, 0x00,
    58    0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00};
    59 }
    60 blt::bitmap define ContourResult-zslice {
    61 #define z_width 12
    62 #define z_height 12
    63 static unsigned char z_bits[] = {
    64    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x84, 0x03, 0xc0, 0x01, 0xe0, 0x00,
    65    0x70, 0x00, 0x38, 0x00, 0x1c, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    66 }
    6720
    6821option add *ContourResult.width 4i widgetDefault
     
    157110        button $itk_component(zoom).reset \
    158111            -borderwidth 1 -padx 1 -pady 1 \
    159             -bitmap ContourResult-reset \
     112            -bitmap [Rappture::icon reset] \
    160113            -command [itcl::code $this _zoom reset]
    161114    } {
     
    170123        button $itk_component(zoom).zin \
    171124            -borderwidth 1 -padx 1 -pady 1 \
    172             -bitmap ContourResult-zoomin \
     125            -bitmap [Rappture::icon zoomin] \
    173126            -command [itcl::code $this _zoom in]
    174127    } {
     
    183136        button $itk_component(zoom).zout \
    184137            -borderwidth 1 -padx 1 -pady 1 \
    185             -bitmap ContourResult-zoomout \
     138            -bitmap [Rappture::icon zoomout] \
    186139            -command [itcl::code $this _zoom out]
    187140    } {
     
    211164        label $itk_component(slicers).xslice \
    212165            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    213             -bitmap ContourResult-xslice
     166            -bitmap [Rappture::icon x]
    214167    } {
    215168        usual
     
    245198        label $itk_component(slicers).yslice \
    246199            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    247             -bitmap ContourResult-yslice
     200            -bitmap [Rappture::icon y]
    248201    } {
    249202        usual
     
    279232        label $itk_component(slicers).zslice \
    280233            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    281             -bitmap ContourResult-zslice
     234            -bitmap [Rappture::icon z]
    282235    } {
    283236        usual
  • trunk/gui/scripts/curve.tcl

    r115 r413  
    194194            style   about.style
    195195            xlabel  xaxis.label
     196            xdesc   xaxis.description
    196197            xunits  xaxis.units
    197198            xscale  xaxis.scale
     
    199200            xmax    xaxis.max
    200201            ylabel  yaxis.label
     202            ydesc   yaxis.description
    201203            yunits  yaxis.units
    202204            yscale  yaxis.scale
  • trunk/gui/scripts/energyLevels.tcl

    r226 r413  
    2828option add *EnergyLevels.font \
    2929    -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
    30 
    31 blt::bitmap define EnergyLevels-reset {
    32 #define reset_width 12
    33 #define reset_height 12
    34 static unsigned char reset_bits[] = {
    35    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    36    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    37 }
    38 
    39 blt::bitmap define EnergyLevels-zoomin {
    40 #define zoomin_width 12
    41 #define zoomin_height 12
    42 static unsigned char zoomin_bits[] = {
    43    0x7c, 0x00, 0x82, 0x00, 0x11, 0x01, 0x11, 0x01, 0x7d, 0x01, 0x11, 0x01,
    44    0x11, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    45 }
    46 
    47 blt::bitmap define EnergyLevels-zoomout {
    48 #define zoomout_width 12
    49 #define zoomout_height 12
    50 static unsigned char zoomout_bits[] = {
    51    0x7c, 0x00, 0x82, 0x00, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
    52    0x01, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    53 }
    54 
    55 blt::bitmap define EnergyLevels-rdiag {
    56 #define rdiag_width 8
    57 #define rdiag_height 8
    58 static unsigned char rdiag_bits[] = {
    59    0x66, 0x33, 0x99, 0xcc, 0x66, 0x33, 0x99, 0xcc};
    60 }
    61 
    6230
    6331itcl::class Rappture::EnergyLevels {
     
    132100        button $itk_component(controls).reset \
    133101            -borderwidth 1 -padx 1 -pady 1 \
    134             -bitmap EnergyLevels-reset \
     102            -bitmap [Rappture::icon reset] \
    135103            -command [itcl::code $this _zoom reset]
    136104    } {
     
    144112        button $itk_component(controls).zin \
    145113            -borderwidth 1 -padx 1 -pady 1 \
    146             -bitmap EnergyLevels-zoomin \
     114            -bitmap [Rappture::icon zoomin] \
    147115            -command [itcl::code $this _zoom in]
    148116    } {
     
    157125        button $itk_component(controls).zout \
    158126            -borderwidth 1 -padx 1 -pady 1 \
    159             -bitmap EnergyLevels-zoomout \
     127            -bitmap [Rappture::icon zoomout] \
    160128            -command [itcl::code $this _zoom out]
    161129    } {
     
    508476                set y [expr {($_ehomo-$_emin)*$e2y + $yzoom0}]
    509477                set id [$c create rectangle $xx0 $y $xx1 $y0 \
    510                     -stipple EnergyLevels-rdiag \
     478                    -stipple [Rappture::icon rdiag] \
    511479                    -outline "" -fill $itk_option(-shadecolor)]
    512480                $c lower $id
     
    623591            if {$yy0 < $y0} {
    624592                set id [$c create rectangle $xx2 $yy0 $xx3 $y0 \
    625                     -stipple EnergyLevels-rdiag \
     593                    -stipple [Rappture::icon rdiag] \
    626594                    -outline "" -fill $itk_option(-shadecolor) \
    627595                    -tags zlabels]
  • trunk/gui/scripts/filexfer.tcl

    r213 r413  
    2727namespace eval Rappture::filexfer {
    2828    variable enabled 0                 ;# set to 1 when this is running
    29     variable port 9001                 ;# start server on this port
     29    variable port 0                    ;# start server on this port
    3030    variable cookie ""                 ;# magic cookie for applet auth
    3131    variable restrictClientAddress ""  ;# allow clients only from this addr
     
    7575    }
    7676
    77     #
    78     # Set up a safe interpreter for loading filexfer options...
    79     #
    80     variable optionParser [interp create -safe]
    81     foreach cmd [$optionParser eval {info commands}] {
    82         $optionParser hide $cmd
    83     }
    84     # this lets us ignore unrecognized commands in the file:
    85     $optionParser invokehidden proc unknown {args} {}
    86 
    87     $optionParser alias filexfer_port Rappture::filexfer::option_port
    88     $optionParser alias filexfer_cookie Rappture::filexfer::option_cookie
    89     $optionParser alias filexfer_sitelogo Rappture::filexfer::option_sitelogo
    90     $optionParser alias filexfer_stylesheet Rappture::filexfer::option_stylesheet
     77}
     78
     79# must use this name -- plugs into Rappture::resources::load
     80proc filexfer_init_resources {} {
     81    Rappture::resources::register \
     82        filexfer_port Rappture::filexfer::option_port \
     83        filexfer_cookie Rappture::filexfer::option_cookie \
     84        filexfer_sitelogo Rappture::filexfer::option_sitelogo \
     85        filexfer_stylesheet Rappture::filexfer::option_stylesheet
    9186}
    9287
     
    9994# ----------------------------------------------------------------------
    10095proc Rappture::filexfer::init {} {
    101     global env
    102     variable optionParser
    10396    variable enabled
    10497    variable port
     
    109102
    110103    #
    111     # Look for a $SESSION variable and a file called
    112     # ~/data/sessions/$SESSION/resources.  If found, then
    113     # load the settings from that file and start a server
    114     # for filexfer.
    115     #
    116     if {[info exists env(SESSION)]} {
    117         set file ~/data/sessions/$env(SESSION)/resources
    118         if {![file exists $file]} {
    119             return 0
    120         }
    121         if {[catch {
    122             set fid [open $file r]
    123             set info [read $fid]
    124             close $fid
    125             $optionParser eval $info
    126         } result]} {
    127             after 1 [list tk_messageBox -title Error -icon error -message "Error in resources file:\n$reslt"]
    128             return 0
    129         }
    130 
     104    # The port setting should have been set properly in the
     105    # "resources" file loaded at the beginning of the app.
     106    # If it wasn't, then don't do any filexfer.
     107    #
     108    if {$port > 0} {
    131109        #
    132110        # If the prescribed port is busy, then exit with a special
  • trunk/gui/scripts/imageresult.tcl

    r193 r413  
    2222    -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
    2323
    24 blt::bitmap define ImageResult-reset {
    25 #define reset_width 12
    26 #define reset_height 12
    27 static unsigned char reset_bits[] = {
    28    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    29    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    30 }
    31 
    32 blt::bitmap define ImageResult-zoomin {
    33 #define zoomin_width 12
    34 #define zoomin_height 12
    35 static unsigned char zoomin_bits[] = {
    36    0x7c, 0x00, 0x82, 0x00, 0x11, 0x01, 0x11, 0x01, 0x7d, 0x01, 0x11, 0x01,
    37    0x11, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    38 }
    39 
    40 blt::bitmap define ImageResult-zoomout {
    41 #define zoomout_width 12
    42 #define zoomout_height 12
    43 static unsigned char zoomout_bits[] = {
    44    0x7c, 0x00, 0x82, 0x00, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
    45    0x01, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    46 }
    47 
    48 
    4924itcl::class Rappture::ImageResult {
    5025    inherit itk::Widget
     
    10580        button $itk_component(controls).reset \
    10681            -borderwidth 1 -padx 1 -pady 1 \
    107             -bitmap ImageResult-reset \
     82            -bitmap [Rappture::icon reset] \
    10883            -command [itcl::code $this _zoom reset]
    10984    } {
     
    11893        button $itk_component(controls).zin \
    11994            -borderwidth 1 -padx 1 -pady 1 \
    120             -bitmap ImageResult-zoomin \
     95            -bitmap [Rappture::icon zoomin] \
    12196            -command [itcl::code $this _zoom in]
    12297    } {
     
    131106        button $itk_component(controls).zout \
    132107            -borderwidth 1 -padx 1 -pady 1 \
    133             -bitmap ImageResult-zoomout \
     108            -bitmap [Rappture::icon zoomout] \
    134109            -command [itcl::code $this _zoom out]
    135110    } {
  • trunk/gui/scripts/meshresult.tcl

    r193 r413  
    2222option add *MeshResult.font \
    2323    -*-helvetica-medium-r-normal-*-*-120-* widgetDefault
    24 
    25 blt::bitmap define MeshResult-reset {
    26 #define reset_width 12
    27 #define reset_height 12
    28 static unsigned char reset_bits[] = {
    29    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    30    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    31 }
    3224
    3325itcl::class Rappture::MeshResult {
     
    8577        button $itk_component(controls).reset \
    8678            -borderwidth 1 -padx 1 -pady 1 \
    87             -bitmap MeshResult-reset \
     79            -bitmap [Rappture::icon reset] \
    8880            -command [itcl::code $this _zoom reset]
    8981    } {
  • trunk/gui/scripts/moleculeViewer.tcl

    r220 r413  
    2222option add *MoleculeViewer.backdrop black widgetDefault
    2323
    24 blt::bitmap define MoleculeViewer-reset {
    25 #define reset_width 12
    26 #define reset_height 12
    27 static unsigned char reset_bits[] = {
    28    0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0x04, 0x02, 0x04, 0x02, 0x04, 0x02,
    29    0x04, 0x02, 0x04, 0x02, 0x04, 0x02, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00};
    30 }
    31 
    32 blt::bitmap define MoleculeViewer-zoomin {
    33 #define zoomin_width 12
    34 #define zoomin_height 12
    35 static unsigned char zoomin_bits[] = {
    36    0x7c, 0x00, 0x82, 0x00, 0x11, 0x01, 0x11, 0x01, 0x7d, 0x01, 0x11, 0x01,
    37    0x11, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    38 }
    39 
    40 blt::bitmap define MoleculeViewer-zoomout {
    41 #define zoomout_width 12
    42 #define zoomout_height 12
    43 static unsigned char zoomout_bits[] = {
    44    0x7c, 0x00, 0x82, 0x00, 0x01, 0x01, 0x01, 0x01, 0x7d, 0x01, 0x01, 0x01,
    45    0x01, 0x01, 0x82, 0x03, 0xfc, 0x07, 0x80, 0x0f, 0x00, 0x0f, 0x00, 0x06};
    46 }
    47 
    48 blt::bitmap define MoleculeViewer-atoms {
    49 #define atoms_width 12
    50 #define atoms_height 12
    51 static unsigned char atoms_bits[] = {
    52    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x02, 0x4c, 0x02, 0xc8, 0x03,
    53    0x48, 0x02, 0x48, 0x02, 0x5c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    54 }
    55 
    5624itcl::class Rappture::MoleculeViewer {
    5725    inherit itk::Widget
     
    138106        button $itk_component(controls).reset \
    139107            -borderwidth 1 -padx 1 -pady 1 \
    140             -bitmap MoleculeViewer-reset \
     108            -bitmap [Rappture::icon reset] \
    141109            -command [itcl::code $this _zoom reset]
    142110    } {
     
    151119        button $itk_component(controls).zin \
    152120            -borderwidth 1 -padx 1 -pady 1 \
    153             -bitmap MoleculeViewer-zoomin \
     121            -bitmap [Rappture::icon zoomin] \
    154122            -command [itcl::code $this _zoom in]
    155123    } {
     
    164132        button $itk_component(controls).zout \
    165133            -borderwidth 1 -padx 1 -pady 1 \
    166             -bitmap MoleculeViewer-zoomout \
     134            -bitmap [Rappture::icon zoomout] \
    167135            -command [itcl::code $this _zoom out]
    168136    } {
     
    177145        label $itk_component(controls).labels \
    178146            -borderwidth 1 -padx 1 -pady 1 \
    179             -bitmap MoleculeViewer-atoms
     147            -bitmap [Rappture::icon atoms]
    180148    } {
    181149        usual
  • trunk/gui/scripts/panes.tcl

    r115 r413  
    1616option add *Panes.width 3i widgetDefault
    1717option add *Panes.height 3i widgetDefault
     18option add *Panes.sashRelief sunken widgetDefault
     19option add *Panes.sashWidth 2 widgetDefault
     20option add *Panes.sashPadding 4 widgetDefault
    1821option add *Panes.sashCursor sb_v_double_arrow
    1922
     
    2225
    2326    itk_option define -sashcursor sashCursor SashCursor ""
     27    itk_option define -sashrelief sashRelief SashRelief ""
     28    itk_option define -sashwidth sashWidth SashWidth 0
     29    itk_option define -sashpadding sashPadding SashPadding 0
    2430
    2531    constructor {args} { # defined below }
     
    3339    protected method _drop {pane X Y}
    3440    protected method _fixLayout {args}
     41    protected method _fixSashes {args}
    3542
    3643    private variable _dispatcher ""  ;# dispatcher for !events
     
    5461    $_dispatcher register !layout
    5562    $_dispatcher dispatch $this !layout [itcl::code $this _fixLayout]
     63    $_dispatcher register !sashes
     64    $_dispatcher dispatch $this !sashes [itcl::code $this _fixSashes]
    5665
    5766    # fix the layout whenever the window size changes
     
    94103
    95104    itk_component add ${sash}ridge {
    96         frame $itk_component($sash).ridge \
    97             -height 2 -borderwidth 1 -relief sunken
     105        frame $itk_component($sash).ridge
    98106    } {
    99107        usual
    100108        rename -cursor -sashcursor sashCursor SashCursor
    101     }
    102     pack $itk_component(${sash}ridge) -fill x -pady 4
     109        rename -relief -sashrelief sashRelief SashRelief
     110        ignore -borderwidth
     111    }
     112    pack $itk_component(${sash}ridge) -fill x
    103113
    104114    foreach comp [list $sash ${sash}ridge] {
     
    120130    set f $params(-fraction)
    121131    set _frac [list [expr {1-$f}] $f]
     132
     133    # fix sash characteristics
     134    $_dispatcher event -idle !sashes
    122135
    123136    # make sure we fix up the layout at some point
     
    238251    }
    239252}
     253
     254# ----------------------------------------------------------------------
     255# USAGE: _fixSashes
     256#
     257# Used internally to fix the appearance of sashes whenever a new
     258# sash appears or the controlling configuration options change.
     259# ----------------------------------------------------------------------
     260itcl::body Rappture::Panes::_fixSashes {args} {
     261    set ht [winfo pixels $itk_component(hull) $itk_option(-sashwidth)]
     262    set bd [expr {$ht/2}]
     263    foreach pane $_panes {
     264        set sash "${pane}sashridge"
     265        if {[info exists itk_component($sash)]} {
     266            $itk_component($sash) configure -height $ht -borderwidth $bd
     267            if {$itk_option(-sashrelief) == "solid"} {
     268                $itk_component($sash) configure -background black
     269            } else {
     270                $itk_component($sash) configure \
     271                    -background $itk_option(-background)
     272            }
     273            pack $itk_component($sash) -pady $itk_option(-sashpadding)
     274        }
     275    }
     276}
     277
     278# ----------------------------------------------------------------------
     279# CONFIGURATION OPTION: -sashrelief
     280# ----------------------------------------------------------------------
     281itcl::configbody Rappture::Panes::sashrelief {
     282    $_dispatcher event -idle !sashes
     283}
     284
     285# ----------------------------------------------------------------------
     286# CONFIGURATION OPTION: -sashwidth
     287# ----------------------------------------------------------------------
     288itcl::configbody Rappture::Panes::sashwidth {
     289    $_dispatcher event -idle !sashes
     290}
     291
     292# ----------------------------------------------------------------------
     293# CONFIGURATION OPTION: -sashpadding
     294# ----------------------------------------------------------------------
     295itcl::configbody Rappture::Panes::sashpadding {
     296    $_dispatcher event -idle !sashes
     297}
  • trunk/gui/scripts/postern.tcl

    r171 r413  
    1616package require Itk
    1717
    18 blt::bitmap define Postern-dismiss {
    19 #define dismiss_width 10
    20 #define dismiss_height 8
    21 static unsigned char dismiss_bits[] = {
    22    0x87, 0x03, 0xce, 0x01, 0xfc, 0x00, 0x78, 0x00, 0x78, 0x00, 0xfc, 0x00,
    23    0xce, 0x01, 0x87, 0x03};
    24 }
    25 
    2618option add *Postern.size 2 widgetDefault
    2719option add *Postern.activeColor gray widgetDefault
     
    8678    #
    8779    Rappture::Balloon $itk_component(hull).popup \
     80        -title "Secret Command Console" \
    8881        -deactivatecommand [itcl::code $this activate off]
    89 
    9082    set inner [$itk_component(hull).popup component inner]
    91     set inner [frame $inner.bd -borderwidth 4 -relief flat]
    92     pack $inner -expand yes -fill both
    93 
    94     button $inner.dismiss -bitmap Postern-dismiss \
    95         -relief flat -overrelief raised \
    96         -command [itcl::code $this close]
    97     pack $inner.dismiss -anchor e
    9883
    9984    Rappture::Scroller $inner.area
     
    203188            $itk_component(hull) $itk_option(-popup)
    204189
    205         set text [$itk_component(hull).popup component inner].bd.area.text
     190        set text [$itk_component(hull).popup component inner].area.text
    206191        focus $text
    207192
     
    226211# ----------------------------------------------------------------------
    227212itcl::body Rappture::Postern::command {option} {
    228     set text [$itk_component(hull).popup component inner].bd.area.text
     213    set text [$itk_component(hull).popup component inner].area.text
    229214
    230215    switch -- $option {
     
    331316    }
    332317
    333     set text [$itk_component(hull).popup component inner].bd.area.text
     318    set text [$itk_component(hull).popup component inner].area.text
    334319    if {$channel == "stdout" || $channel == "stderr"} {
    335320        $text insert end $string $channel
  • trunk/gui/scripts/radiodial.tcl

    r115 r413  
    2929    itk_option define -min min Min ""
    3030    itk_option define -max max Max ""
     31    itk_option define -variable variable Variable ""
     32
    3133    itk_option define -thickness thickness Thickness 0
    3234    itk_option define -length length Length 0
     
    5052    public method color {value}
    5153                                                                               
     54    protected method _setCurrent {val}
    5255    protected method _redraw {}
    5356    protected method _click {x y}
     
    5558    protected method _limits {}
    5659    protected method _fixSize {}
     60    protected method _fixValue {args}
    5761
    5862    private variable _values ""       ;# list of all values on the dial
    5963    private variable _val2label       ;# maps value => label
    6064    private variable _current ""      ;# current value (where pointer is)
     65    private variable _variable ""     ;# variable associated with -variable
    6166
    6267    private variable _spectrum ""     ;# width allocated for values
     
    103108# ----------------------------------------------------------------------
    104109itcl::body Rappture::Radiodial::destructor {} {
     110    configure -variable ""  ;# remove variable trace
    105111    after cancel [itcl::code $this _redraw]
    106112}
     
    123129
    124130    if {"" == $_current} {
    125         set _current $value
     131        _setCurrent $value
    126132    }
    127133
     
    137143itcl::body Rappture::Radiodial::clear {} {
    138144    set _values ""
    139     set _current ""
     145    _setCurrent ""
    140146    catch {unset _val2label}
    141147
     
    168174        set ilist ""
    169175        for {set i 0} {$i < [llength $_values]} {incr i} {
    170             append ilist $i
     176            lappend ilist $i
    171177        }
    172178    } elseif {"current" == $index} {
     
    235241            error "bad value \"$newval\""
    236242        }
    237         set _current $newval
     243        _setCurrent $newval
    238244
    239245        after cancel [itcl::code $this _redraw]
     
    277283    }
    278284    return $color
     285}
     286
     287# ----------------------------------------------------------------------
     288# USAGE: _setCurrent <value>
     289#
     290# Called automatically whenever the widget changes size to redraw
     291# all elements within it.
     292# ----------------------------------------------------------------------
     293itcl::body Rappture::Radiodial::_setCurrent {value} {
     294    set _current $value
     295    if {"" != $_variable} {
     296        upvar #0 $_variable var
     297        if {[info exists _val2label($value)]} {
     298            set var $_val2label($value)
     299        } else {
     300            set var $value
     301        }
     302    }
    279303}
    280304
     
    389413
    390414        if {$vnearest != $_current} {
    391             set _current $vnearest
     415            _setCurrent $vnearest
    392416            _redraw
    393417
     
    417441        set newval [lindex $_values $index]
    418442        if {$newval != $_current} {
    419             set _current $newval
     443            _setCurrent $newval
    420444            _redraw
    421445
     
    482506
    483507# ----------------------------------------------------------------------
     508# USAGE: _fixValue ?<name1> <name2> <op>?
     509#
     510# Invoked automatically whenever the -variable associated with this
     511# widget is modified.  Copies the value to the current settings for
     512# the widget.
     513# ----------------------------------------------------------------------
     514itcl::body Rappture::Radiodial::_fixValue {args} {
     515    if {"" == $itk_option(-variable)} {
     516        return
     517    }
     518    upvar #0 $itk_option(-variable) var
     519
     520    set newval $var
     521    set found 0
     522    foreach v $_values {
     523        if {[string equal $_val2label($v) $newval]} {
     524            set newval $v
     525            set found 1
     526            break
     527        }
     528    }
     529    if {!$found && "" != $newval} {
     530        error "bad value \"$newval\""
     531    }
     532    set _current $newval  ;# set current directly, so we don't trigger again
     533
     534    after cancel [itcl::code $this _redraw]
     535    after idle [itcl::code $this _redraw]
     536    event generate $itk_component(hull) <<Value>>
     537}
     538
     539# ----------------------------------------------------------------------
    484540# CONFIGURE: -thickness
    485541# ----------------------------------------------------------------------
     
    509565        error "bad value \"$itk_option(-valuewidth)\": should be integer"
    510566    }
     567    _fixSize
    511568    after cancel [itcl::code $this _redraw]
    512569    after idle [itcl::code $this _redraw]
     
    554611    after idle [itcl::code $this _redraw]
    555612}
     613
     614# ----------------------------------------------------------------------
     615# CONFIGURE: -variable
     616# ----------------------------------------------------------------------
     617itcl::configbody Rappture::Radiodial::variable {
     618    if {"" != $_variable} {
     619        upvar #0 $_variable var
     620        trace remove variable var write [itcl::code $this _fixValue]
     621    }
     622
     623    set _variable $itk_option(-variable)
     624
     625    if {"" != $_variable} {
     626        upvar #0 $_variable var
     627        trace add variable var write [itcl::code $this _fixValue]
     628
     629        # sync to the current value of this variable
     630        if {[info exists var]} {
     631            _fixValue
     632        }
     633    }
     634}
  • trunk/gui/scripts/resultset.tcl

    r170 r413  
    1717option add *ResultSet.height 4i widgetDefault
    1818option add *ResultSet.missingData skip widgetDefault
     19option add *ResultSet.controlbarBackground gray widgetDefault
     20option add *ResultSet.controlbarForeground white widgetDefault
     21option add *ResultSet.activeControlBackground #ffffcc widgetDefault
     22option add *ResultSet.activeControlForeground black widgetDefault
     23option add *ResultSet.controlActiveForeground blue widgetDefault
    1924option add *ResultSet.toggleBackground gray widgetDefault
    2025option add *ResultSet.toggleForeground white widgetDefault
     
    2732    inherit itk::Widget
    2833
     34    itk_option define -activecontrolbackground activeControlBackground Background ""
     35    itk_option define -activecontrolforeground activeControlForeground Foreground ""
     36    itk_option define -controlactiveforeground controlActiveForeground Foreground ""
    2937    itk_option define -togglebackground toggleBackground Background ""
    3038    itk_option define -toggleforeground toggleForeground Foreground ""
    3139    itk_option define -textfont textFont Font ""
    3240    itk_option define -boldfont boldFont Font ""
     41    itk_option define -foreground foreground Foreground ""
    3342    itk_option define -missingdata missingData MissingData ""
    3443    itk_option define -clearcommand clearCommand ClearCommand ""
     
    4150    public method add {xmlobj}
    4251    public method clear {}
     52    public method activate {column}
    4353    public method contains {xmlobj}
    4454    public method size {{what -results}}
     
    4656    protected method _doClear {}
    4757    protected method _doSettings {{cmd ""}}
     58    protected method _doPrompt {state}
     59    protected method _control {option args}
    4860    protected method _fixControls {args}
     61    protected method _fixLayout {args}
    4962    protected method _fixSettings {args}
    50     protected method _doPrompt {state}
    51     protected method _toggleAll {path widget}
     63    protected method _fixExplore {}
     64    protected method _fixValue {column why}
     65    protected method _drawValue {column widget wmax}
     66    protected method _toggleAll {{column "current"}}
     67    protected method _getTooltip {role column}
    5268
    5369    private variable _dispatcher ""  ;# dispatchers for !events
    5470    private variable _results ""     ;# tuple of known results
    5571    private variable _recent ""      ;# most recent result in _results
    56     private variable _plotall ""     ;# column with "All" active
    57     private variable _col2widget     ;# maps column name => control widget
     72    private variable _active ""      ;# column with active control
     73    private variable _plotall 0      ;# non-zero => plot all active results
     74    private variable _layout         ;# info used in _fixLayout
    5875    private variable _counter 0      ;# counter for unique control names
     76    private variable _settings 0     ;# non-zero => _fixSettings in progress
     77    private variable _explore 0      ;# non-zero => explore all parameters
     78
     79    private common _cntlInfo         ;# maps column name => control info
    5980}
    6081                                                                               
     
    7596    $_dispatcher dispatch $this !fixcntls \
    7697        [itcl::code $this _fixControls]
     98    $_dispatcher register !layout
     99    $_dispatcher dispatch $this !layout \
     100        [itcl::code $this _fixLayout]
    77101    $_dispatcher register !settings
    78102    $_dispatcher dispatch $this !settings \
    79103        [itcl::code $this _fixSettings]
    80104
     105    # initialize controls info
     106    set _cntlInfo($this-all) ""
     107
     108    # initialize layout info
     109    set _layout(mode) "usual"
     110    set _layout(active) ""
     111
    81112    # create a list of tuples for data
    82113    set _results [Rappture::Tuples ::#auto]
     
    86117    itk_component add cntls {
    87118        frame $itk_interior.cntls
    88     }
    89     pack $itk_component(cntls) -fill x
     119    } {
     120        usual
     121        rename -background -controlbarbackground controlbarBackground Background
     122        rename -highlightbackground -controlbarbackground controlbarBackground Background
     123    }
     124    pack $itk_component(cntls) -fill x -pady {0 2}
    90125
    91126    itk_component add clear {
    92127        button $itk_component(cntls).clear -text "Clear" -state disabled \
     128            -padx 1 -pady 1 \
    93129            -relief flat -overrelief raised \
    94130            -command [itcl::code $this _doClear]
    95     }
    96     pack $itk_component(clear) -side right
     131    } {
     132        usual
     133        rename -background -controlbarbackground controlbarBackground Background
     134        rename -foreground -controlbarforeground controlbarForeground Foreground
     135        rename -highlightbackground -controlbarbackground controlbarBackground Background
     136    }
     137    pack $itk_component(clear) -side right -padx 2 -pady 1
    97138    Rappture::Tooltip::for $itk_component(clear) \
    98139        "Clears all results collected so far."
    99140
    100141    itk_component add status {
    101         label $itk_component(cntls).status -anchor w -text "No results"
    102     }
    103     pack $itk_component(status) -side left -expand yes -fill x
    104 
    105     itk_component add scroller {
    106         Rappture::Scroller $itk_interior.scroller \
    107             -xscrollmode off -yscrollmode auto -height 1i
    108     }
    109     pack $itk_component(scroller) -expand yes -fill both
     142        label $itk_component(cntls).status -anchor w \
     143            -text "No results" -padx 0 -pady 0
     144    } {
     145        usual
     146        rename -background -controlbarbackground controlbarBackground Background
     147        rename -foreground -controlbarforeground controlbarForeground Foreground
     148        rename -highlightbackground -controlbarbackground controlbarBackground Background
     149    }
     150    pack $itk_component(status) -side left -padx 2 -pady {2 0}
     151
     152    itk_component add parameters {
     153        button $itk_component(cntls).params -text "Parameters..." \
     154            -state disabled -padx 1 -pady 1 \
     155            -relief flat -overrelief raised \
     156            -command [list $itk_component(hull).popup activate $itk_component(cntls).params above]
     157    } {
     158        usual
     159        rename -background -controlbarbackground controlbarBackground Background
     160        rename -foreground -controlbarforeground controlbarForeground Foreground
     161        rename -highlightbackground -controlbarbackground controlbarBackground Background
     162    }
     163    pack $itk_component(parameters) -side left -padx 8 -pady 1
     164    Rappture::Tooltip::for $itk_component(parameters) \
     165        "Click to access all parameters."
     166
     167    itk_component add dials {
     168        frame $itk_interior.dials
     169    }
     170    pack $itk_component(dials) -expand yes -fill both
     171    bind $itk_component(dials) <Configure> \
     172        [list $_dispatcher event -after 10 !layout why resize]
     173
     174    # create the permanent controls in the "short list" area
     175    set dials $itk_component(dials)
     176    frame $dials.bg
     177    Rappture::Radiodial $dials.dial -valuewidth 0
     178    Rappture::Tooltip::for $dials.dial \
     179        "@[itcl::code $this _getTooltip dial active]"
     180
     181    set fn [option get $itk_component(hull) textFont Font]
     182    label $dials.all -text "All" -padx 8 \
     183        -borderwidth 1 -relief raised -font $fn
     184    Rappture::Tooltip::for $dials.all \
     185        "@[itcl::code $this _getTooltip all active]"
     186    bind $dials.all <ButtonRelease> [itcl::code $this _toggleAll]
     187
     188    frame $dials.labelmore
     189    label $dials.labelmore.arrow -bitmap [Rappture::icon empty] -borderwidth 0
     190    pack $dials.labelmore.arrow -side left -fill y
     191    _control bind $dials.labelmore.arrow @more
     192    label $dials.labelmore.name -text "more parameters..." -font $fn \
     193        -borderwidth 0 -padx 0 -pady 1
     194    pack $dials.labelmore.name -side left
     195    label $dials.labelmore.value
     196    pack $dials.labelmore.value -side left
     197    _control bind $dials.labelmore.name @more
     198    Rappture::Tooltip::for $dials.labelmore \
     199        "@[itcl::code $this _getTooltip more more]"
     200
     201    # use this pop-up for access to all controls
     202    Rappture::Balloon $itk_component(hull).popup \
     203        -title "Change Parameters" -padx 0 -pady 0
     204    set inner [$itk_component(hull).popup component inner]
     205
     206    frame $inner.cntls
     207    pack $inner.cntls -side bottom -fill x
     208    frame $inner.cntls.sep -height 2 -borderwidth 1 -relief sunken
     209    pack $inner.cntls.sep -side top -fill x -padx 4 -pady 4
     210    checkbutton $inner.cntls.explore -font $fn \
     211        -text "Explore combinations with no results" \
     212        -variable [itcl::scope _explore] \
     213        -command [itcl::code $this _fixExplore]
     214    pack $inner.cntls.explore -side top -anchor w
     215    Rappture::Tooltip::for $inner.cntls.explore \
     216        "When this option is turned on, you can set parameters to various combinations that have not yet been simulated.  The Simulate button will light up, and you can simulate these missing combinations.\n\nWhen turned off, controls will avoid missing combinations, and automatically snap to the closest available dataset."
     217
     218    itk_component add options {
     219        Rappture::Scroller $inner.scrl -xscrollmode auto -yscrollmode auto
     220    }
     221    pack $itk_component(options) -expand yes -fill both
     222
     223    set popup [$itk_component(options) contents frame]
     224    frame $popup.bg
    110225
    111226    eval itk_initialize $args
     
    143258        $itk_component(status) configure -text "1 result"
    144259        $itk_component(clear) configure -state normal
     260        if {[$_results size] >= 2} {
     261            $itk_component(parameters) configure -state normal
     262        } else {
     263            $itk_component(parameters) configure -state disabled
     264        }
    145265        return 0
    146266    }
     
    204324    } else {
    205325        $itk_component(status) configure -text "[$_results size] results"
     326        $itk_component(parameters) configure -state normal
    206327    }
    207328    $itk_component(clear) configure -state normal
     
    219340
    220341    # delete all adjuster controls
    221     set f [$itk_component(scroller) contents frame]
    222     foreach w [winfo children $f] {
    223         destroy $w
    224     }
    225     catch {unset _col2widget}
    226     set _plotall ""
     342    set popup [$itk_component(options) contents frame]
     343    set shortlist $itk_component(dials)
     344    foreach col $_cntlInfo($this-all) {
     345        set id $_cntlInfo($this-$col-id)
     346        destroy $popup.label$id $popup.dial$id $popup.all$id
     347        destroy $shortlist.label$id
     348    }
     349
     350    # clean up control info
     351    foreach key [array names _cntlInfo $this-*] {
     352        catch {unset _cntlInfo($key)}
     353    }
     354    set _cntlInfo($this-all) ""
    227355    set _counter 0
    228 
    229     # don't need to scroll adjustor controls right now
    230     $itk_component(scroller) configure -yscrollmode off
    231356
    232357    # clear out all results
     
    234359    eval $_results column delete [lrange [$_results column names] 1 end]
    235360    set _recent ""
     361    set _active ""
     362
     363    set _plotall 0
     364    $itk_component(dials).all configure -relief raised \
     365        -background $itk_option(-background) \
     366        -foreground $itk_option(-foreground)
    236367
    237368    # update status and Clear button
    238369    $itk_component(status) configure -text "No results"
     370    $itk_component(parameters) configure -state disabled
    239371    $itk_component(clear) configure -state disabled
    240372    $_dispatcher event -idle !fixcntls
     373
     374    # let clients know that the number of controls has changed
     375    event generate $itk_component(hull) <<Control>>
     376}
     377
     378# ----------------------------------------------------------------------
     379# USAGE: activate <column>
     380#
     381# Clients use this to activate a particular column in the set of
     382# controls.  When a column is active, its label is bold and its
     383# value has a radiodial in the "short list" area.
     384# ----------------------------------------------------------------------
     385itcl::body Rappture::ResultSet::activate {column} {
     386    if {$column == "@more"} {
     387        $itk_component(hull).popup activate \
     388            $itk_component(dials).labelmore.name above
     389        return
     390    }
     391
     392    set allowed [$_results column names]
     393    if {[lsearch $allowed $column] < 0} {
     394        error "bad value \"$column\": should be one of [join $allowed {, }]"
     395    }
     396
     397    # column is now active
     398    set _active $column
     399
     400    # keep track of usage, so we know which controls are popular
     401    incr _cntlInfo($this-$column-usage)
     402
     403    # fix controls at next idle point
     404    $_dispatcher event -idle !layout why data
     405    $_dispatcher event -idle !settings column $_active
    241406}
    242407
     
    310475
    311476# ----------------------------------------------------------------------
    312 # USAGE: size ?-results|-controls?
    313 #
    314 # Returns the number of results or the number of controls in this
    315 # result set.
     477# USAGE: size ?-results|-controls|-controlarea?
     478#
     479# Returns various measures for the size of this area:
     480#   -results ....... number of results loaded
     481#   -controls ...... number of distinct control parameters
     482#   -controlarea ... minimum size of usable control area, in pixels
    316483# ----------------------------------------------------------------------
    317484itcl::body Rappture::ResultSet::size {{what -results}} {
     
    321488        }
    322489        -controls {
    323             return [array size _col2widget]
     490            return [llength $_cntlInfo($this-all)]
     491        }
     492        -controlarea {
     493            set ht [winfo reqheight $itk_component(cntls)]
     494            incr ht 2  ;# padding below controls
     495
     496            set normalLine [font metrics $itk_option(-textfont) -linespace]
     497            incr normalLine 2  ;# padding
     498            set boldLine [font metrics $itk_option(-boldfont) -linespace]
     499            incr boldLine 2  ;# padding
     500
     501            set numcntls [llength $_cntlInfo($this-all)]
     502            switch -- $numcntls {
     503                0 - 1 {
     504                    # 0 = no controls (no data at all)
     505                    # 1 = run control, but only 1 run so far
     506                    # add nothing
     507                }
     508                default {
     509                    # non-active controls
     510                    incr ht [expr {($numcntls-1)*$normalLine}]
     511                    # active control
     512                    incr ht $boldLine
     513                    # dial for active control
     514                    incr ht [winfo reqheight $itk_component(dials).dial]
     515                    # padding around active control
     516                    incr ht 4
     517                }
     518            }
     519            return $ht
    324520        }
    325521        default {
    326             error "bad option \"$what\": should be -results or -controls"
     522            error "bad option \"$what\": should be -results, -controls, or -controlarea"
    327523        }
    328524    }
     
    356552
    357553# ----------------------------------------------------------------------
     554# USAGE: _doPrompt <state>
     555#
     556# Used internally whenever the current settings represent a point
     557# with no data.  Invokes the -promptcommand with an explanation of
     558# the missing data, prompting the user to simulate it.
     559# ----------------------------------------------------------------------
     560itcl::body Rappture::ResultSet::_doPrompt {state} {
     561    if {[string length $itk_option(-promptcommand)] > 0} {
     562        if {$state} {
     563            set message "No data for these settings"
     564            set settings ""
     565            foreach col [lrange [$_results column names] 1 end] {
     566                set val $_cntlInfo($this-$col-value)
     567                lappend settings $col $val
     568            }
     569            uplevel #0 $itk_option(-promptcommand) [list on $message $settings]
     570        } else {
     571            uplevel #0 $itk_option(-promptcommand) off
     572        }
     573    }
     574}
     575
     576# ----------------------------------------------------------------------
     577# USAGE: _control bind <widget> <column>
     578# USAGE: _control hilite <state> <column> <panel>
     579# USAGE: _control load <widget> <column>
     580#
     581# Used internally to manage the interactivity of controls.  The "bind"
     582# operation sets up bindings on the label/value for each control, so
     583# you can mouse over and click on a control to activate it.  The
     584# "hilite" operation controls highlighting of the control.  The "load"
     585# operation loads data into the specified radiodial <widget>.
     586# ----------------------------------------------------------------------
     587itcl::body Rappture::ResultSet::_control {option args} {
     588    switch -- $option {
     589        bind {
     590            if {[llength $args] != 2} {
     591                error "wrong # args: should be _control bind widget column"
     592            }
     593            set widget [lindex $args 0]
     594            set col [lindex $args 1]
     595
     596            set panel [winfo parent $widget]
     597            if {[string match label* [winfo name $panel]]} {
     598                set panel [winfo parent $panel]
     599            }
     600
     601            bind $widget <Enter> \
     602                [itcl::code $this _control hilite on $col $panel]
     603            bind $widget <Leave> \
     604                [itcl::code $this _control hilite off $col $panel]
     605            bind $widget <ButtonRelease> [itcl::code $this activate $col]
     606        }
     607        hilite {
     608            if {[llength $args] != 3} {
     609                error "wrong # args: should be _control hilite state column panel"
     610            }
     611            if {$_layout(mode) != "usual"} {
     612                # abbreviated controls? then skip highlighting
     613                return
     614            }
     615            set state [lindex $args 0]
     616            set col [lindex $args 1]
     617            set panel [lindex $args 2]
     618
     619            if {[string index $col 0] == "@"} {
     620                # handle artificial names like "@more"
     621                set id [string range $col 1 end]
     622            } else {
     623                # get id for ordinary columns
     624                set id $_cntlInfo($this-$col-id)
     625            }
     626
     627            # highlight any non-active entries
     628            if {$col != $_active} {
     629                if {$state} {
     630                    set fg $itk_option(-controlactiveforeground)
     631                    $panel.label$id.name configure -fg $fg
     632                    $panel.label$id.value configure -fg $fg
     633                    $panel.label$id.arrow configure -fg $fg \
     634                        -bitmap [Rappture::icon rarrow2]
     635                } else {
     636                    set fg $itk_option(-foreground)
     637                    $panel.label$id.name configure -fg $fg
     638                    $panel.label$id.value configure -fg $fg
     639                    $panel.label$id.arrow configure -fg $fg \
     640                        -bitmap [Rappture::icon empty]
     641                }
     642            }
     643        }
     644        load {
     645            if {[llength $args] != 2} {
     646                error "wrong # args: should be _control load widget column"
     647            }
     648            set dial [lindex $args 0]
     649            set col [lindex $args 1]
     650
     651            if {$col == "xmlobj"} {
     652                 # load the Simulation # control
     653                 set nruns [$_results size]
     654
     655                 # load the results into the control
     656                 $dial clear
     657                 for {set n 0} {$n < $nruns} {incr n} {
     658                     $dial add "#[expr {$n+1}]" $n
     659                 }
     660                 return
     661            }
     662
     663            set havenums 1
     664            set vlist ""
     665            foreach rec [$_results get -format [list xmlobj $col]] {
     666                set xo [lindex $rec 0]
     667                set v [lindex $rec 1]
     668
     669                if {![info exists values($v)]} {
     670                    lappend vlist $v
     671                    foreach {raw norm} [Rappture::LibraryObj::value $xo $col] break
     672                    set values($v) $norm
     673
     674                    if {$havenums && ![string is double $norm]} {
     675                        set havenums 0
     676                    }
     677                }
     678            }
     679
     680            if {!$havenums} {
     681                # don't have normalized nums? then sort and create nums
     682                catch {unset values}
     683
     684                set n 0
     685                foreach v [lsort $vlist] {
     686                    set values($v) [incr n]
     687                }
     688            }
     689
     690            # load the results into the control
     691            $dial clear
     692            foreach v [array names values] {
     693                $dial add $v $values($v)
     694            }
     695        }
     696        default {
     697            error "bad option \"$option\": should be bind, hilite, or load"
     698        }
     699    }
     700}
     701
     702# ----------------------------------------------------------------------
    358703# USAGE: _fixControls ?<eventArgs...>?
    359704#
     
    363708# ----------------------------------------------------------------------
    364709itcl::body Rappture::ResultSet::_fixControls {args} {
    365     set f [$itk_component(scroller) contents frame]
    366     grid columnconfigure $f 1 -weight 1
    367 
    368710    if {[$_results size] == 0} {
    369711        return
    370712    }
    371713
     714    set popup [$itk_component(options) contents frame]
     715    grid columnconfigure $popup 0 -minsize 16
     716    grid columnconfigure $popup 1 -weight 1
     717
     718    set shortlist $itk_component(dials)
     719    grid columnconfigure $shortlist 1 -weight 1
     720
    372721    #
    373722    # Scan through all columns in the data and create any
    374723    # controls that just appeared.
    375724    #
    376     foreach col [lrange [$_results column names] 1 end] {
     725    set nadded 0
     726    foreach col [$_results column names] {
    377727        set xmlobj [$_results get -format xmlobj 0]
    378728
     
    381731        # create one.
    382732        #
    383         if {![info exists _col2widget($col)]} {
    384             # add an "All" button to plot all results
    385             label $f.all$_counter -text "All" -padx 8 \
    386                 -borderwidth 1 -relief raised -font $itk_option(-textfont)
    387             grid $f.all$_counter -row $_counter -column 0 \
    388                 -padx 8 -pady 2 -sticky nsew
    389             Rappture::Tooltip::for $f.all$_counter "Plot all values for this quantity"
    390 
    391             bind $f.all$_counter <ButtonPress> \
    392                 [itcl::code $this _toggleAll $col $f.all$_counter]
    393 
    394             # search for the first XML object with this element defined
    395             foreach xmlobj [$_results get -format xmlobj] {
    396                 set str [$xmlobj get $col.about.label]
    397                 if {"" == $str} {
    398                     set str [$xmlobj element -as id $col]
     733        if {![info exists _cntlInfo($this-$col-id)]} {
     734            set row [lindex [grid size $popup] 1]
     735            set row2 [expr {$row+1}]
     736
     737            set tip ""
     738            if {$col == "xmlobj"} {
     739                set quantity "Simulation"
     740                set tip "List of all simulations that you have performed so far."
     741            } else {
     742                # search for the first XML object with this element defined
     743                foreach xmlobj [$_results get -format xmlobj] {
     744                    set quantity [$xmlobj get $col.about.label]
     745                    set tip [$xmlobj get $col.about.description]
     746                    if {"" != $quantity} {
     747                        break
     748                    }
    399749                }
    400                 if {"" != $str} {
    401                     break
     750                if {"" == $quantity && "" != $xmlobj} {
     751                    set quantity [$xmlobj element -as id $col]
    402752                }
    403753            }
    404754
    405             if {"" != $str} {
    406                 set w $f.label$_counter
    407                 label $w -text $str -anchor w -font $itk_option(-boldfont)
    408                 grid $w -row $_counter -column 1 -sticky w
    409 
    410                 grid $f.all$_counter -rowspan 2
    411                 Rappture::Tooltip::for $f.all$_counter "Plot all values for $str"
    412                 incr _counter
    413             }
    414 
    415             set w $f.cntl$_counter
    416             Rappture::Radiodial $w
    417             grid $w -row $_counter -column 1 -sticky ew
    418             bind $w <<Value>> \
    419                 [itcl::code $_dispatcher event -after 100 !settings column $col widget $w]
    420             set _col2widget($col) $w
     755            #
     756            # Build the main control in the pop-up panel.
     757            #
     758            set fn $itk_option(-textfont)
     759            set w $popup.label$_counter
     760            frame $w
     761            grid $w -row $row -column 2 -sticky ew -padx 4 -pady {4 0}
     762            label $w.arrow -bitmap [Rappture::icon empty] -borderwidth 0
     763            pack $w.arrow -side left -fill y
     764            _control bind $w.arrow $col
     765
     766            label $w.name -text $quantity -anchor w \
     767                -borderwidth 0 -padx 0 -pady 1 -font $fn
     768            pack $w.name -side left
     769            bind $w.name <Configure> [itcl::code $this _fixValue $col resize]
     770            _control bind $w.name $col
     771
     772            label $w.value -anchor w \
     773                -borderwidth 0 -padx 0 -pady 1 -font $fn
     774            pack $w.value -side left
     775            bind $w.value <Configure> [itcl::code $this _fixValue $col resize]
     776            _control bind $w.value $col
     777
     778            Rappture::Tooltip::for $w \
     779                "@[itcl::code $this _getTooltip label $col]"
     780
     781            set w $popup.dial$_counter
     782            Rappture::Radiodial $w -valuewidth 0
     783            grid $w -row $row2 -column 2 -sticky ew -padx 4 -pady {0 4}
     784            $w configure -variable ::Rappture::ResultSet::_cntlInfo($this-$col-value)
     785            Rappture::Tooltip::for $w \
     786                "@[itcl::code $this _getTooltip dial $col]"
     787
     788            set w $popup.all$_counter
     789            label $w -text "All" -padx 8 \
     790                -borderwidth 1 -relief raised -font $fn
     791            grid $w -row $row -rowspan 2 -column 1 -sticky nsew -padx 2 -pady 4
     792            Rappture::Tooltip::for $w \
     793                "@[itcl::code $this _getTooltip all $col]"
     794            bind $w <ButtonRelease> [itcl::code $this _toggleAll $col]
     795
     796            # Create the controls for the "short list" area.
     797            set w $shortlist.label$_counter
     798            frame $w
     799            grid $w -row $row -column 1 -sticky ew
     800            label $w.arrow -bitmap [Rappture::icon empty] -borderwidth 0
     801            pack $w.arrow -side left -fill y
     802            _control bind $w.arrow $col
     803
     804            label $w.name -text $quantity -anchor w \
     805                -borderwidth 0 -padx 0 -pady 1 -font $fn
     806            pack $w.name -side left
     807            bind $w.name <Configure> [itcl::code $this _fixValue $col resize]
     808            _control bind $w.name $col
     809
     810            label $w.value -anchor w \
     811                -borderwidth 0 -padx 0 -pady 1 -font $fn
     812            pack $w.value -side left
     813            bind $w.value <Configure> [itcl::code $this _fixValue $col resize]
     814            _control bind $w.value $col
     815
     816            Rappture::Tooltip::for $w \
     817                "@[itcl::code $this _getTooltip label $col]"
     818
     819            # if this is the "Simulation #" control, add a separator
     820            if {$col == "xmlobj"} {
     821                grid $popup.all$_counter -column 0
     822                grid $popup.label$_counter -column 1 -columnspan 2
     823                grid $popup.dial$_counter -column 1 -columnspan 2
     824
     825                if {![winfo exists $popup.sep]} {
     826                    frame $popup.sep -height 1 -borderwidth 0 -background black
     827                }
     828                grid $popup.sep -row [expr {$row+2}] -column 0 \
     829                    -columnspan 3 -sticky ew -pady 4
     830
     831                if {![winfo exists $popup.paraml]} {
     832                    label $popup.paraml -text "Parameters:" -font $fn
     833                }
     834                grid $popup.paraml -row [expr {$row+3}] -column 0 \
     835                    -columnspan 3 -sticky w -padx 4 -pady {0 4}
     836            }
     837
     838            # create a record for this control
     839            lappend _cntlInfo($this-all) $col
     840            set _cntlInfo($this-$col-id) $_counter
     841            set _cntlInfo($this-$col-label) $quantity
     842            set _cntlInfo($this-$col-tip) $tip
     843            set _cntlInfo($this-$col-value) ""
     844            set _cntlInfo($this-$col-usage) 0
     845            set _cntlInfo($this-$col) ""
     846
     847            trace add variable _cntlInfo($this-$col-value) write \
     848                "[itcl::code $this _fixValue $col value]; list"
    421849
    422850            incr _counter
    423             grid rowconfigure $f $_counter -minsize 4
    424             incr _counter
    425 
    426             $itk_component(scroller) configure -yscrollmode auto
     851
     852            # fix the shortlist layout to show as many controls as we can
     853            $_dispatcher event -now !layout why data
    427854
    428855            # let clients know that a new control appeared
     
    435862        # them into the control.
    436863        #
    437         catch {unset values}
    438         set havenums 1
    439         set vlist ""
    440         foreach rec [$_results get -format [list xmlobj $col]] {
    441             set xo [lindex $rec 0]
    442             set v [lindex $rec 1]
    443 
    444             if {![info exists values($v)]} {
    445                 lappend vlist $v
    446                 foreach {raw norm} [Rappture::LibraryObj::value $xo $col] break
    447                 set values($v) $norm
    448 
    449                 if {$havenums && ![string is double $norm]} {
    450                     set havenums 0
     864        set id $_cntlInfo($this-$col-id)
     865        set popup [$itk_component(options) contents frame]
     866        set dial $popup.dial$id
     867
     868        _control load $popup.dial$id $col
     869
     870        if {$col == $_layout(active)} {
     871            $shortlist.dial configure -variable ""
     872            _control load $shortlist.dial $col
     873            $shortlist.dial configure -variable \
     874                "::Rappture::ResultSet::_cntlInfo($this-$col-value)"
     875        }
     876        incr nadded
     877    }
     878
     879    #
     880    # Activate the most recent control.  If a bunch of controls
     881    # were just added, then activate the "Simulation" control,
     882    # since that's the easiest way to page through results.
     883    #
     884    if {$nadded > 0} {
     885        if {[$_results column names] == 2 || $nadded == 1} {
     886            activate [lindex $_cntlInfo($this-all) end]
     887        } else {
     888            activate xmlobj
     889        }
     890    }
     891
     892    #
     893    # Set all controls to the settings of the most recent addition.
     894    # Setting the value slot will trigger the !settings event, which
     895    # will then fix all other controls to match the one that changed.
     896    #
     897    if {"" != $_recent} {
     898        set raw [lindex [$_results find -format xmlobj $_recent] 0]
     899        set raw "#[expr {$raw+1}]"
     900        set _cntlInfo($this-xmlobj-value) $raw
     901    }
     902}
     903
     904# ----------------------------------------------------------------------
     905# USAGE: _fixLayout ?<eventArgs...>?
     906#
     907# Called automatically at the idle point after the controls have
     908# changed, or the size of the window has changed.  Fixes the layout
     909# so that the active control is displayed, and other recent controls
     910# are shown above and/or below.  At the very least, we must show the
     911# "more options..." control, which pops up a panel of all controls.
     912# ----------------------------------------------------------------------
     913itcl::body Rappture::ResultSet::_fixLayout {args} {
     914    array set eventdata $args
     915
     916    set popup [$itk_component(options) contents frame]
     917    set shortlist $itk_component(dials)
     918
     919    # clear out the short list area
     920    foreach w [grid slaves $shortlist] {
     921        grid forget $w
     922    }
     923
     924    # reset all labels back to an ordinary font/background
     925    set fn $itk_option(-textfont)
     926    set bg $itk_option(-background)
     927    set fg $itk_option(-foreground)
     928    foreach col $_cntlInfo($this-all) {
     929        set id $_cntlInfo($this-$col-id)
     930        $popup.label$id configure -background $bg
     931        $popup.label$id.arrow configure -background $bg \
     932            -bitmap [Rappture::icon empty]
     933        $popup.label$id.name configure -font $fn -background $bg
     934        $popup.label$id.value configure -background $bg
     935        $popup.all$id configure -background $bg -foreground $fg \
     936            -relief raised
     937        $popup.dial$id configure -background $bg
     938        $shortlist.label$id configure -background $bg
     939        $shortlist.label$id.arrow configure -background $bg \
     940            -bitmap [Rappture::icon empty]
     941        $shortlist.label$id.name configure -font $fn -background $bg
     942        $shortlist.label$id.value configure -background $bg
     943    }
     944
     945    # only 1 result? then we don't need any controls
     946    if {[$_results size] < 2} {
     947        return
     948    }
     949
     950    # compute the number of controls that will fit in the shortlist area
     951    set dials $itk_component(dials)
     952    set h [winfo height $dials]
     953    set normalLine [font metrics $itk_option(-textfont) -linespace]
     954    set boldLine [font metrics $itk_option(-boldfont) -linespace]
     955    set active [expr {$boldLine+[winfo reqheight $dials.dial]+4}]
     956
     957    if {$h < $active+$normalLine} {
     958        # active control kinda big? then show parameter values only
     959        set _layout(mode) abbreviated
     960        set ncntls [expr {int(floor(double($h)/$normalLine))}]
     961    } else {
     962        set _layout(mode) usual
     963        set ncntls [expr {int(floor(double($h-$active)/$normalLine))+1}]
     964    }
     965
     966    # find the controls with the most usage
     967    set order ""
     968    foreach col $_cntlInfo($this-all) {
     969        lappend order [list $col $_cntlInfo($this-$col-usage)]
     970    }
     971    set order [lsort -integer -decreasing -index 1 $order]
     972
     973    set mostUsed ""
     974    if {[llength $order] <= $ncntls} {
     975        # plenty of space? then show all controls
     976        foreach item $order {
     977            lappend mostUsed [lindex $item 0]
     978        }
     979    } else {
     980        # otherwise, limit to the most-used controls
     981        foreach item [lrange $order 0 [expr {$ncntls-1}]] {
     982            lappend mostUsed [lindex $item 0]
     983        }
     984
     985        # make sure the active control is included
     986        if {"" != $_active && [lsearch -exact $mostUsed $_active] < 0} {
     987            set mostUsed [lreplace [linsert $mostUsed 0 $_active] end end]
     988        }
     989
     990        # if there are more controls, add the "more parameters..." entry
     991        if {$ncntls > 2} {
     992            set mostUsed [lreplace $mostUsed end end @more]
     993            set rest [expr {[llength $order]-($ncntls-1)}]
     994            if {$rest == 1} {
     995                $dials.labelmore.name configure -text "1 more parameter..."
     996            } else {
     997                $dials.labelmore.name configure -text "$rest more parameters..."
     998            }
     999        }
     1000    }
     1001
     1002    # draw the active control
     1003    set row 0
     1004    foreach col [concat $_cntlInfo($this-all) @more] {
     1005        # this control not on the short list? then ignore it
     1006        if {[lsearch $mostUsed $col] < 0} {
     1007            continue
     1008        }
     1009
     1010        if {[string index $col 0] == "@"} {
     1011            set id [string range $col 1 end]
     1012        } else {
     1013            set id $_cntlInfo($this-$col-id)
     1014        }
     1015        grid $shortlist.label$id -row $row -column 1 -sticky ew -padx 4
     1016
     1017        if {$col == $_active} {
     1018            # put the background behind the active control in the popup
     1019            set id $_cntlInfo($this-$_active-id)
     1020            array set ginfo [grid info $popup.label$id]
     1021            grid $popup.bg -row $ginfo(-row) -rowspan 2 \
     1022                -column 0 -columnspan 3 -sticky nsew
     1023            lower $popup.bg
     1024
     1025            if {$_layout(mode) == "usual"} {
     1026                # put the background behind the active control in the shortlist
     1027                grid $shortlist.bg -row $row -rowspan 2 \
     1028                    -column 0 -columnspan 2 -sticky nsew
     1029                lower $shortlist.bg
     1030
     1031                # place the All and dial in the shortlist area
     1032                grid $shortlist.all -row $row -rowspan 2 -column 0 \
     1033                    -sticky nsew -padx 2 -pady 2
     1034                grid $shortlist.dial -row [expr {$row+1}] -column 1 \
     1035                    -sticky ew -padx 4
     1036                incr row
     1037
     1038                if {$_layout(active) != $_active} {
     1039                    $shortlist.dial configure -variable ""
     1040                    _control load $shortlist.dial $col
     1041                    $shortlist.dial configure -variable \
     1042                        "::Rappture::ResultSet::_cntlInfo($this-$col-value)"
     1043                    set _layout(active) $_active
    4511044                }
    4521045            }
    4531046        }
    454 
    455         if {!$havenums} {
    456             # don't have normalized nums? then sort and create nums
    457             catch {unset values}
    458 
    459             set n 0
    460             foreach v [lsort $vlist] {
    461                 set values($v) [incr n]
    462             }
    463         }
    464 
    465         # load the results into the control
    466         set w $_col2widget($col)
    467         $w clear
    468         foreach v [array names values] {
    469             $w add $v $values($v)
    470         }
    471     }
    472 
    473     #
    474     # Set all controls to the settings of the most recent
    475     # addition.
    476     #
    477     if {"" != $_recent} {
    478         foreach col [array names _col2widget] {
    479             set raw [lindex [Rappture::LibraryObj::value $_recent $col] 0]
    480             $_col2widget($col) current $raw
    481         }
    482     }
    483 
    484     # fix the settings after everything settles
    485     $_dispatcher event -after 100 !settings
     1047        incr row
     1048    }
     1049
     1050    # highlight the active control
     1051    if {[info exists _cntlInfo($this-$_active-id)]} {
     1052        set id $_cntlInfo($this-$_active-id)
     1053        set bf $itk_option(-boldfont)
     1054        set fg $itk_option(-activecontrolforeground)
     1055        set bg $itk_option(-activecontrolbackground)
     1056
     1057        $popup.label$id configure -background $bg
     1058        $popup.label$id.arrow configure -foreground $fg -background $bg \
     1059            -bitmap [Rappture::icon rarrow]
     1060        $popup.label$id.name configure -foreground $fg -background $bg \
     1061            -font $bf
     1062        $popup.label$id.value configure -foreground $fg -background $bg
     1063        $popup.dial$id configure -background $bg
     1064        $popup.bg configure -background $bg
     1065
     1066        if {$_plotall} {
     1067            $popup.all$id configure -relief sunken \
     1068                -background $itk_option(-togglebackground) \
     1069                -foreground $itk_option(-toggleforeground)
     1070        } else {
     1071            $popup.all$id configure -relief raised \
     1072                -background $itk_option(-activecontrolbackground) \
     1073                -foreground $itk_option(-activecontrolforeground)
     1074        }
     1075
     1076        if {$_layout(mode) == "usual"} {
     1077            $shortlist.label$id configure -background $bg
     1078            $shortlist.label$id.arrow configure -foreground $fg \
     1079                -background $bg -bitmap [Rappture::icon rarrow]
     1080            $shortlist.label$id.name configure -foreground $fg \
     1081                -background $bg -font $bf
     1082            $shortlist.label$id.value configure -foreground $fg \
     1083                -background $bg
     1084            $shortlist.dial configure -background $bg
     1085            $shortlist.bg configure -background $bg
     1086
     1087            if {[$shortlist.all cget -relief] == "raised"} {
     1088                $shortlist.all configure -foreground $fg -background $bg
     1089            }
     1090        }
     1091    }
    4861092}
    4871093
     
    4971103# ----------------------------------------------------------------------
    4981104itcl::body Rappture::ResultSet::_fixSettings {args} {
     1105    array set eventdata $args
     1106    if {[info exists eventdata(column)]} {
     1107        set changed $eventdata(column)
     1108    } else {
     1109        set changed ""
     1110    }
    4991111    _doPrompt off
    5001112
     
    5121124
    5131125    #
     1126    # Find the selected run.  If the run setting changed, then
     1127    # look at its current value.  Otherwise, search the results
     1128    # for a tuple that matches the current settings.
     1129    #
     1130    if {$changed == "xmlobj"} {
     1131        # value is "#2" -- skip # and adjust range starting from 0
     1132        set irun [string range $_cntlInfo($this-xmlobj-value) 1 end]
     1133        if {"" != $irun} { set irun [expr {$irun-1}] }
     1134    } else {
     1135        set format ""
     1136        set tuple ""
     1137        foreach col [lrange [$_results column names] 1 end] {
     1138            lappend format $col
     1139            lappend tuple $_cntlInfo($this-$col-value)
     1140        }
     1141        set irun [lindex [$_results find -format $format -- $tuple] 0]
     1142
     1143        if {"" == $irun && "" != $changed
     1144             && $itk_option(-missingdata) == "skip"} {
     1145            #
     1146            # No data for these settings.  Try leaving the next
     1147            # column open, then the next, and so forth, until
     1148            # we find some data.
     1149            #
     1150            # allcols:  foo bar baz qux
     1151            #               ^^^changed
     1152            #
     1153            # search:   baz qux foo
     1154            #
     1155            set val $_cntlInfo($this-$changed-value)
     1156            set allcols [lrange [$_results column names] 1 end]
     1157            set i [lsearch -exact $allcols $changed]
     1158            set search [concat \
     1159                [lrange $allcols [expr {$i+1}] end] \
     1160                [lrange $allcols 0 [expr {$i-1}]] \
     1161            ]
     1162            set nsearch [llength $search]
     1163
     1164            for {set i 0} {$i < $nsearch} {incr i} {
     1165                set format $changed
     1166                set tuple [list $val]
     1167                for {set j [expr {$i+1}]} {$j < $nsearch} {incr j} {
     1168                    set col [lindex $search $j]
     1169                    lappend format $col
     1170                    lappend tuple $_cntlInfo($this-$col-value)
     1171                }
     1172                set irun [lindex [$_results find -format $format -- $tuple] 0]
     1173                if {"" != $irun} {
     1174                    break
     1175                }
     1176            }
     1177        }
     1178    }
     1179
     1180    #
     1181    # If we found a particular run, then load its values into all
     1182    # controls.
     1183    #
     1184    if {"" != $irun} {
     1185        # stop reacting to value changes
     1186        set _settings 1
     1187
     1188        set format [lrange [$_results column names] 1 end]
     1189        set data [lindex [$_results get -format $format $irun] 0]
     1190        foreach col $format val $data {
     1191            set _cntlInfo($this-$col-value) $val
     1192        }
     1193        set _cntlInfo($this-xmlobj-value) "#[expr {$irun+1}]"
     1194
     1195        # okay, react to value changes again
     1196        set _settings 0
     1197    }
     1198
     1199    #
    5141200    # Search for tuples matching the current setting and
    5151201    # plot them.
    5161202    #
    517     set format ""
    518     set tuple ""
    519     foreach col [lrange [$_results column names] 1 end] {
    520         if {$col != $_plotall} {
    521             lappend format $col
    522             set w $_col2widget($col)
    523             lappend tuple [$w get current]
     1203    if {$_plotall && $_active == "xmlobj"} {
     1204        set format ""
     1205    } else {
     1206        set format ""
     1207        set tuple ""
     1208        foreach col [lrange [$_results column names] 1 end] {
     1209            if {!$_plotall || $col != $_active} {
     1210                lappend format $col
     1211                lappend tuple $_cntlInfo($this-$col-value)
     1212            }
    5241213        }
    5251214    }
     
    5371226        foreach col [lrange [$_results column names] 1 end] {
    5381227            lappend format $col
    539             set w $_col2widget($col)
    540             lappend tuple [$w get current]
     1228            lappend tuple $_cntlInfo($this-$col-value)
    5411229        }
    5421230        set icurr [$_results find -format $format -- $tuple]
     
    5701258        #
    5711259        _doSettings $plist
    572     } elseif {$itk_option(-missingdata) == "skip"} {
    573         #
    574         # No data for these settings.  Try leaving the next
    575         # column open, then the next, and so forth, until
    576         # we find some data.
    577         #
    578         array set eventdata $args
    579         if {[info exists eventdata(column)]} {
    580             set changed $eventdata(column)
    581             set allcols [lrange [$_results column names] 1 end]
    582             set i [lsearch -exact $allcols $changed]
    583             set search [concat \
    584                 [lrange $allcols [expr {$i+1}] end] \
    585                 [lrange $allcols 0 [expr {$i-1}]] \
    586             ]
    587             set nsearch [llength $search]
    588 
    589             set tweak(widget) ""
    590             set tweak(value) ""
    591             for {set i 0} {$i < $nsearch} {incr i} {
    592                 set format $eventdata(column)
    593                 set tuple [list [$eventdata(widget) get current]]
    594                 for {set j [expr {$i+1}]} {$j < $nsearch} {incr j} {
    595                     set col [lindex $search $j]
    596                     set w $_col2widget($col)
    597                     lappend format $col
    598                     lappend tuple [$w get current]
    599                 }
    600                 set ilist [$_results find -format $format -- $tuple]
    601                 if {[llength $ilist] > 0} {
    602                     set col [lindex $search $i]
    603                     set tweak(widget) $_col2widget($col)
    604                     set first [lindex $ilist 0]
    605                     set tweak(value) [lindex [$_results get -format $col -- $first] 0]
    606                     break
    607                 }
    608             }
    609 
    610             # set the value to the next valid result
    611             if {$tweak(widget) != ""} {
    612                 $tweak(widget) current $tweak(value)
    613             }
    614         }
    6151260
    6161261    } elseif {$itk_option(-missingdata) == "prompt"} {
    6171262        # prompt the user to simulate these settings
    6181263        _doPrompt on
    619     }
    620 }
    621 
    622 # ----------------------------------------------------------------------
    623 # USAGE: _doPrompt <state>
    624 #
    625 # Used internally whenever the current settings represent a point
    626 # with no data.  Invokes the -promptcommand with an explanation of
    627 # the missing data, prompting the user to simulate it.
    628 # ----------------------------------------------------------------------
    629 itcl::body Rappture::ResultSet::_doPrompt {state} {
    630     if {[string length $itk_option(-promptcommand)] > 0} {
    631         if {$state} {
    632             set message "No data for these settings"
    633             set settings ""
    634             foreach col [lrange [$_results column names] 1 end] {
    635                 set w $_col2widget($col)
    636                 set val [$w get current]
    637                 lappend settings $col $val
    638             }
    639             uplevel #0 $itk_option(-promptcommand) [list on $message $settings]
     1264        _doSettings  ;# clear plotting area
     1265
     1266        # clear the current run selection -- there is no run for this
     1267        set _settings 1
     1268        set _cntlInfo($this-xmlobj-value) ""
     1269        set _settings 0
     1270    }
     1271}
     1272
     1273# ----------------------------------------------------------------------
     1274# USAGE: _fixExplore
     1275#
     1276# Called automatically whenever the user toggles the "Explore" button
     1277# on the parameter popup.  Changes the -missingdata option back and
     1278# forth, to allow for missing data or skip it.
     1279# ----------------------------------------------------------------------
     1280itcl::body Rappture::ResultSet::_fixExplore {} {
     1281    if {$_explore} {
     1282        configure -missingdata prompt
     1283    } else {
     1284        configure -missingdata skip
     1285    }
     1286}
     1287
     1288# ----------------------------------------------------------------------
     1289# USAGE: _fixValue <columnName> <why>
     1290#
     1291# Called automatically whenver a value for a parameter dial changes.
     1292# Updates the interface to display the new value.  The <why> is a
     1293# reason for the change, which may be "resize" (draw old value in
     1294# new size) or "value" (value changed).
     1295# ----------------------------------------------------------------------
     1296itcl::body Rappture::ResultSet::_fixValue {col why} {
     1297    if {[info exists _cntlInfo($this-$col-id)]} {
     1298        set id $_cntlInfo($this-$col-id)
     1299
     1300        set popup [$itk_component(options) contents frame]
     1301        set widget $popup.label$id
     1302        set wmax [winfo width $popup.dial$id]
     1303        _drawValue $col $widget $wmax
     1304
     1305        set widget $itk_component(dials).label$id
     1306        set wmax [winfo width $itk_component(dials).dial]
     1307        if {$wmax <= 1} {
     1308            set wmax [expr {round(0.9*[winfo width $itk_component(cntls)])}]
     1309        }
     1310        _drawValue $col $widget $wmax
     1311
     1312        if {$why == "value" && !$_settings} {
     1313            # keep track of usage, so we know which controls are popular
     1314            incr _cntlInfo($this-$col-usage)
     1315
     1316            # adjust the settings according to the value in the column
     1317            $_dispatcher event -idle !settings column $col
     1318        }
     1319    }
     1320}
     1321
     1322# ----------------------------------------------------------------------
     1323# USAGE: _drawValue <columnName> <widget> <widthMax>
     1324#
     1325# Used internally to fix the rendering of a "quantity = value" display.
     1326# If the name/value in <widget> are smaller than <widthMax>, then the
     1327# full "quantity = value" string is displayed.  Otherwise, an
     1328# abbreviated form is displayed.
     1329# ----------------------------------------------------------------------
     1330itcl::body Rappture::ResultSet::_drawValue {col widget wmax} {
     1331    set quantity $_cntlInfo($this-$col-label)
     1332    regsub -all {\n} $quantity " " quantity  ;# take out newlines
     1333
     1334    set newval $_cntlInfo($this-$col-value)
     1335    regsub -all {\n} $newval " " newval  ;# take out newlines
     1336
     1337    set lfont [$widget.name cget -font]
     1338    set vfont [$widget.value cget -font]
     1339
     1340    set wn [font measure $lfont $quantity]
     1341    set wv [font measure $lfont " = $newval"]
     1342    set w [expr {$wn + $wv}]
     1343
     1344    if {$w <= $wmax} {
     1345        # if the text fits, then shown "quantity = value"
     1346        $widget.name configure -text $quantity
     1347        $widget.value configure -text " = $newval"
     1348    } else {
     1349        # Otherwise, we'll have to appreviate.
     1350        # If the value is really long, then just show a little bit
     1351        # of it.  Otherwise, show as much of the value as we can.
     1352        if {[string length $newval] > 30} {
     1353            set frac 0.8
    6401354        } else {
    641             uplevel #0 $itk_option(-promptcommand) off
    642         }
    643     }
    644 }
    645 
    646 # ----------------------------------------------------------------------
    647 # USAGE: _toggleAll <path> <widget>
     1355            set frac 0.2
     1356        }
     1357        set wNameSpace [expr {round($frac*$wmax)}]
     1358        set wValueSpace [expr {$wmax-$wNameSpace}]
     1359
     1360        # fit as much of the "quantity" label in the space available
     1361        if {$wn < $wNameSpace} {
     1362            $widget.name configure -text $quantity
     1363            set wValueSpace [expr {$wmax-$wn}]
     1364        } else {
     1365            set wDots [font measure $lfont "..."]
     1366            set wchar [expr {double($wn)/[string length $quantity]}]
     1367            while {1} {
     1368                # figure out a good size for the abbreviated string
     1369                set cmax [expr {round(($wNameSpace-$wDots)/$wchar)}]
     1370                if {$cmax < 0} {set cmax 0}
     1371                set str "[string range $quantity 0 $cmax]..."
     1372                if {[font measure $lfont $str] <= $wNameSpace
     1373                      || $wDots >= $wNameSpace} {
     1374                    break
     1375                }
     1376                # we're measuring with average chars, so we may have
     1377                # to shave a little off and do this again
     1378                set wDots [expr {$wDots+2*$wchar}]
     1379            }
     1380            $widget.name configure -text $str
     1381            set wValueSpace [expr {$wmax-[font measure $lfont $str]}]
     1382        }
     1383
     1384        if {$wv < $wValueSpace} {
     1385            $widget.value configure -text " = $newval"
     1386        } else {
     1387            set wDots [font measure $vfont "..."]
     1388            set wEq [font measure $vfont " = "]
     1389            set wchar [expr {double($wv)/[string length " = $newval"]}]
     1390            while {1} {
     1391                # figure out a good size for the abbreviated string
     1392                set cmax [expr {round(($wValueSpace-$wDots-$wEq)/$wchar)}]
     1393                if {$cmax < 0} {set cmax 0}
     1394                set str " = [string range $newval 0 $cmax]..."
     1395                if {[font measure $vfont $str] <= $wValueSpace
     1396                      || $wDots >= $wValueSpace} {
     1397                    break
     1398                }
     1399                # we're measuring with average chars, so we may have
     1400                # to shave a little off and do this again
     1401                set wDots [expr {$wDots+2*$wchar}]
     1402            }
     1403            $widget.value configure -text $str
     1404        }
     1405    }
     1406}
     1407
     1408# ----------------------------------------------------------------------
     1409# USAGE: _toggleAll ?<columnName>?
    6481410#
    6491411# Called automatically whenever the user clicks on an "All" button.
    6501412# Toggles the button between its on/off states.  In the "on" state,
    651 # all results associated with the <path> are sent to the result viewer.
    652 # ----------------------------------------------------------------------
    653 itcl::body Rappture::ResultSet::_toggleAll {path widget} {
    654     if {[$widget cget -relief] == "sunken"} {
    655         $widget configure -relief raised \
     1413# all results associated with the current control are sent to the
     1414# result viewer.
     1415# ----------------------------------------------------------------------
     1416itcl::body Rappture::ResultSet::_toggleAll {{col "current"}} {
     1417    if {$col == "current"} {
     1418        set col $_active
     1419    }
     1420    if {![info exists _cntlInfo($this-$col-id)]} {
     1421        return
     1422    }
     1423    set id $_cntlInfo($this-$col-id)
     1424    set popup [$itk_component(options) contents frame]
     1425    set pbutton $popup.all$id
     1426    set current [$pbutton cget -relief]
     1427    set sbutton $itk_component(dials).all
     1428
     1429    foreach c $_cntlInfo($this-all) {
     1430        set id $_cntlInfo($this-$c-id)
     1431        $popup.all$id configure -relief raised \
    6561432            -background $itk_option(-background) \
    6571433            -foreground $itk_option(-foreground)
    658 
    659         set _plotall ""
     1434    }
     1435
     1436    if {$current == "sunken"} {
     1437        $pbutton configure -relief raised \
     1438            -background $itk_option(-activecontrolbackground) \
     1439            -foreground $itk_option(-activecontrolforeground)
     1440        $sbutton configure -relief raised \
     1441            -background $itk_option(-activecontrolbackground) \
     1442            -foreground $itk_option(-activecontrolforeground)
     1443        set _plotall 0
    6601444    } else {
    661         # pop out all other "All" buttons
    662         set f [$itk_component(scroller) contents frame]
    663         for {set i 0} {$i < $_counter} {incr i} {
    664             if {[winfo exists $f.all$i]} {
    665                 $f.all$i configure -relief raised \
    666                     -background $itk_option(-background) \
    667                     -foreground $itk_option(-foreground)
    668             }
    669         }
    670 
    671         # push this one in
    672         $widget configure -relief sunken \
     1445        $pbutton configure -relief sunken \
    6731446            -background $itk_option(-togglebackground) \
    6741447            -foreground $itk_option(-toggleforeground)
    675 
    676         # switch the "All" context to this path
    677         set _plotall $path
     1448        $sbutton configure -relief sunken \
     1449            -background $itk_option(-togglebackground) \
     1450            -foreground $itk_option(-toggleforeground)
     1451        set _plotall 1
     1452
     1453        if {$col != $_active} {
     1454            # clicked on an inactive "All" button? then activate that column
     1455            activate $col
     1456        }
    6781457    }
    6791458    $_dispatcher event -idle !settings
     1459}
     1460
     1461# ----------------------------------------------------------------------
     1462# USAGE: _getTooltip <role> <column>
     1463#
     1464# Called automatically whenever the user hovers a control within
     1465# this widget.  Returns the tooltip associated with the control.
     1466# ----------------------------------------------------------------------
     1467itcl::body Rappture::ResultSet::_getTooltip {role column} {
     1468    set label ""
     1469    set tip ""
     1470    if {$column == "active"} {
     1471        set column $_active
     1472    }
     1473    if {[info exists _cntlInfo($this-$column-label)]} {
     1474        set label $_cntlInfo($this-$column-label)
     1475    }
     1476    if {[info exists _cntlInfo($this-$column-tip)]} {
     1477        set tip $_cntlInfo($this-$column-tip)
     1478    }
     1479
     1480    switch -- $role {
     1481        label {
     1482            if {$column != $_active} {
     1483                append tip "\n\nClick to activate this control."
     1484            }
     1485        }
     1486        dial {
     1487            append tip "\n\nClick to change the value of this parameter."
     1488        }
     1489        all {
     1490            if {$label == ""} {
     1491                set tip "Plot all values for this quantity."
     1492            } else {
     1493                set tip "Plot all values for $label."
     1494            }
     1495            if {$_plotall} {
     1496                set what "all values"
     1497            } else {
     1498                set what "one value"
     1499            }
     1500            append tip "\n\nCurrently, plotting $what.  Click to toggle."
     1501        }
     1502        more {
     1503            set tip "Click to access all parameters."
     1504        }
     1505    }
     1506    return $tip
    6801507}
    6811508
     
    6881515        error "bad value \"$itk_option(-missingdata)\": should be [join $opts {, }]"
    6891516    }
    690 }
     1517    set _explore [expr {$itk_option(-missingdata) != "skip"}]
     1518}
     1519
     1520# ----------------------------------------------------------------------
     1521# OPTION: -activecontrolbackground
     1522# ----------------------------------------------------------------------
     1523itcl::configbody Rappture::ResultSet::activecontrolbackground {
     1524    $_dispatcher event -idle !layout
     1525}
     1526
     1527# ----------------------------------------------------------------------
     1528# OPTION: -activecontrolforeground
     1529# ----------------------------------------------------------------------
     1530itcl::configbody Rappture::ResultSet::activecontrolforeground {
     1531    $_dispatcher event -idle !layout
     1532}
  • trunk/gui/scripts/textresult.tcl

    r193 r413  
    3636    public method find {option}
    3737
    38     set _dataobj ""  ;# data object currently being displayed
    39 
    40     private common icons
    41     set dir [file dirname [info script]]
    42     set icons(up) [image create photo -file [file join $dir images findup.gif]]
    43     set icons(down) [image create photo -file [file join $dir images finddn.gif]]
     38    private variable _dataobj ""  ;# data object currently being displayed
     39    private variable _raised      ;# maps all data objects => -raise param
    4440}
    4541                                                                               
     
    8076
    8177    itk_component add finddown {
    82         button $itk_component(controls).finddown -image $icons(down) \
     78        button $itk_component(controls).finddown \
     79            -image [Rappture::icon finddn] \
    8380            -relief flat -overrelief raised \
    8481            -command [itcl::code $this find down]
     
    9087
    9188    itk_component add findup {
    92         button $itk_component(controls).findup -image $icons(up) \
     89        button $itk_component(controls).findup \
     90            -image [Rappture::icon findup] \
    9391            -relief flat -overrelief raised \
    9492            -command [itcl::code $this find up]
     
    153151        -width ""
    154152        -linestyle ""
    155         -raise ""
     153        -raise 0
    156154    }
    157155    foreach {opt val} $settings {
     
    162160    }
    163161
    164     $itk_component(text) configure -state normal
    165     $itk_component(text) delete 1.0 end
    166 
     162    set replace 0
    167163    if {"" != $dataobj} {
     164        set _raised($dataobj) $params(-raise)
     165        if {"" == $_dataobj} {
     166            set replace 1
     167        } elseif {$_raised($_dataobj) == 0 && $params(-raise)} {
     168            set replace 1
     169        }
     170    }
     171
     172    if {$replace} {
     173        $itk_component(text) configure -state normal
     174        $itk_component(text) delete 1.0 end
     175
    168176        if {[$dataobj element -as type] == "log"} {
    169177            # log output -- remove special =RAPPTURE-???=> messages
     
    204212            $itk_component(text) insert end [$dataobj get]
    205213        }
    206     }
    207 
    208     $itk_component(text) configure -state disabled
    209     set _dataobj $dataobj
     214        $itk_component(text) configure -state disabled
     215
     216        set _dataobj $dataobj
     217    }
    210218}
    211219
     
    227235# ----------------------------------------------------------------------
    228236itcl::body Rappture::TextResult::delete {args} {
    229     $itk_component(text) configure -state normal
    230     $itk_component(text) delete 1.0 end
    231     $itk_component(text) configure -state disabled
    232     set _dataobj ""
     237    if {[llength $args] == 0} {
     238        # delete everything
     239        catch {unset _raised}
     240        set _dataobj ""
     241        $itk_component(text) configure -state normal
     242        $itk_component(text) delete 1.0 end
     243        $itk_component(text) configure -state disabled
     244    } else {
     245        # delete these specific objects
     246        foreach obj $args {
     247            catch {unset _raised($obj)}
     248            if {$obj == $_dataobj} {
     249                set _dataobj ""
     250                $itk_component(text) configure -state normal
     251                $itk_component(text) delete 1.0 end
     252                $itk_component(text) configure -state disabled
     253            }
     254        }
     255    }
    233256}
    234257
  • trunk/gui/scripts/tool.tcl

    r405 r413  
    3535    private common job               ;# array var used for blt::bgexec jobs
    3636    private common jobnum 0          ;# counter for unique job number
     37
     38    # resources file tells us the application name
     39    public common _appname ""
     40    public proc setAppName {name} { set _appname $name }
     41}
     42
     43# must use this name -- plugs into Rappture::resources::load
     44proc tool_init_resources {} {
     45    Rappture::resources::register \
     46        application_name Rappture::Tool::setAppName
    3747}
    3848                                                                               
     
    7989itcl::body Rappture::Tool::run {args} {
    8090    global errorInfo
     91
     92    # make sure that we save the proper application name
     93    if {"" != $_appname} {
     94        $_xmlobj put tool.name $_appname
     95    }
    8196
    8297    # sync all widgets to the XML tree
  • trunk/gui/scripts/tooltip.tcl

    r213 r413  
    5959    bind RapptureTooltip <KeyPress> \
    6060        [list ::Rappture::Tooltip::tooltip cancel]
    61 
    62     private common icons
    63     set dir [file dirname [info script]]
    64     set icons(cue) [image create photo -file [file join $dir images cue24.gif]]
    6561}
    6662
     
    141137
    142138    # strings can't be too big, or they'll go off screen!
    143     if {[string length $mesg] > 1000} {
    144         set mesg "[string range $mesg 0 1000]..."
    145     }
    146139    set pos 0
    147140    ::for {set i 0} {$pos >= 0 && $i < 20} {incr i} {
     
    152145        set mesg "[string range $mesg 0 $pos]..."
    153146    }
     147    if {[string length $mesg] > 1000} {
     148        set mesg "[string range $mesg 0 1500]..."
     149    }
    154150    $itk_component(text) configure -text $mesg
    155151
    156152    #
    157     # Make sure the tooltip doesn't go off screen.  Then, put it up.
     153    # Make sure the tooltip doesn't go off screen.
    158154    #
    159155    update idletasks
     
    182178    }
    183179
     180    #
     181    # Will the tooltip pop up under the mouse pointer?  If so, then
     182    # it will just disappear.  Doh!  We should figure out a better
     183    # place to pop it up.
     184    #
     185    set px [winfo pointerx $hull]
     186    set py [winfo pointery $hull]
     187    if {$px >= $xpos && $px <= $xpos+[winfo reqwidth $hull]
     188          && $py >= $ypos && $py <= $ypos+[winfo reqheight $hull]} {
     189
     190        if {$px > [winfo screenwidth $hull]/2} {
     191            set signx "-"
     192            set xpos [expr {[winfo screenwidth $hull]-$px+4}]
     193        } else {
     194            set signx "+"
     195            set xpos [expr {$px+4}]
     196        }
     197        if {$py > [winfo screenheight $hull]/2} {
     198            set signy "-"
     199            set ypos [expr {[winfo screenheight $hull]-$py+4}]
     200        } else {
     201            set signy "+"
     202            set ypos [expr {$py+4}]
     203        }
     204    }
     205
     206    #
     207    # Finally, put it up.
     208    #
    184209    wm geometry $hull $signx$xpos$signy$ypos
    185210    update
     
    276301                error "wrong # args: should be \"tooltip pending widget ?@x,y?\""
    277302            }
    278             set widget [lindex $args 0]
     303            set tag [lindex $args 0]
    279304            set loc [lindex $args 1]
    280305
    281             if {[winfo exists $widget]} {
    282                 .rappturetooltip configure -message $catalog($widget)
     306            # tag name may be .g-axis -- get widget ".g" part
     307            set widget $tag
     308            if {[regexp {^(\.[^-]+)-[^\.]+$} $widget match wname]} {
     309                set widget $wname
     310            }
     311
     312            if {[winfo exists $widget] && [info exists catalog($tag)]} {
     313                .rappturetooltip configure -message $catalog($tag)
    283314                if {[string index $loc 0] == "@"} {
    284315                    .rappturetooltip show $loc
     
    381412# create a tooltip widget to show error cues
    382413Rappture::Tooltip .rappturetoolcue \
    383     -icon $Rappture::Tooltip::icons(cue) \
     414    -icon [Rappture::icon cue24] \
    384415    -background black -outline #333333 -foreground white
    385416
  • 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 {
  • trunk/src2/core/Makefile

    r370 r413  
    1010test: test.o RpOutcome.o RpMesh1D.o RpField1D.o RpMeshTri2D.o RpFieldTri2D.o RpMeshRect3D.o RpFieldRect3D.o RpMeshPrism3D.o RpFieldPrism3D.o RpSerialBuffer.o RpSerializer.o RpSerializable.o
    1111        g++ $(CFLAGS) -o test test.o RpOutcome.o RpMesh1D.o RpField1D.o RpMeshTri2D.o RpFieldTri2D.o RpMeshRect3D.o RpFieldRect3D.o RpMeshPrism3D.o RpFieldPrism3D.o RpSerialBuffer.o RpSerializer.o RpSerializable.o
     12
     13docs:
     14        if test ! -d ../../docs/rappture2; then \
     15          mkdir ../../docs; \
     16          mkdir ../../docs/rappture2; \
     17        fi
     18        doxygen
    1219
    1320test.o: test.cc RpPtr.h
  • trunk/src2/core/RpSerialBuffer.cc

    r364 r413  
    11/*
     2 * ======================================================================
     3 *  Rappture::SerialBuffer
     4 *
     5 *  AUTHOR:  Michael McLennan, Purdue University
     6 *           Carol X Song, Purdue University
     7 *
     8 *  Copyright (c) 2004-2006  Purdue Research Foundation
    29 * ----------------------------------------------------------------------
    3  *  Rappture::SerialBuffer
    4  *    Used by the Serializer to build up the buffer of serialized
    5  *    data.  Similar to a string, but it handles nulls and other
    6  *    control characters.  Also handles big/little endian order
    7  *    properly.
    8  *
    9  * ======================================================================
    10  *  AUTHOR:  Carol X Song, Purdue University
    11  *           Michael McLennan, Purdue University
    12  *  Copyright (c) 2004-2006  Purdue Research Foundation
    13  *
    1410 *  See the file "license.terms" for information on usage and
    1511 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     
    2824using namespace Rappture;
    2925
     26/**
     27 * Construct an empty SerialBuffer.
     28 */
    3029SerialBuffer::SerialBuffer()
    3130  : _buffer(),
     
    3433}
    3534
     35/**
     36 * Construct a SerialBuffer loaded with bytes produced by another
     37 * SerialBuffer.  This is used to decode information from the buffer.
     38 *
     39 * @param bytes pointer to bytes being decoded.
     40 * @param nbytes number of bytes being decoded.
     41 */
    3642SerialBuffer::SerialBuffer(const char* bytes, int nbytes)
    3743  : _buffer(),
     
    4450}
    4551
     52/**
     53 * Copy constructor
     54 */
    4655SerialBuffer::SerialBuffer(const SerialBuffer& sb)
    4756  : _buffer(sb._buffer),
     
    5059}
    5160
     61/**
     62 * Assignment operator
     63 */
    5264SerialBuffer&
    5365SerialBuffer::operator=(const SerialBuffer& sb)
     
    6173}
    6274
     75/**
     76 * Get the bytes currently stored in the buffer.  These bytes can
     77 * be stored, and used later to construct another SerialBuffer to
     78 * decode the information.
     79 *
     80 * @return Pointer to the bytes in the buffer.
     81 */
    6382const char*
    6483SerialBuffer::bytes() const
     
    6786}
    6887
     88/**
     89 * Get the number of bytes currently stored in the buffer.
     90 * @return Number of the bytes in the buffer.
     91 */
    6992int
    7093SerialBuffer::size() const
     
    7396}
    7497
     98/**
     99 * Clear the buffer, making it empty.
     100 */
    75101SerialBuffer&
    76102SerialBuffer::clear()
  • trunk/src2/core/RpSerialBuffer.h

    r364 r413  
    11/*
     2 * ======================================================================
     3 *  Rappture::SerialBuffer
     4 *
     5 *  AUTHOR:  Michael McLennan, Purdue University
     6 *           Carol X Song, Purdue University
     7 *
     8 *  Copyright (c) 2004-2006  Purdue Research Foundation
    29 * ----------------------------------------------------------------------
    3  *  Rappture::SerialBuffer
    4  *    Used by the Serializer to build up the buffer of serialized
    5  *    data.  Similar to a string, but it handles nulls and other
    6  *    control characters.  Also handles big/little endian order
    7  *    properly.
    8  *
    9  * ======================================================================
    10  *  AUTHOR:  Carol X Song, Purdue University
    11  *           Michael McLennan, Purdue University
    12  *  Copyright (c) 2004-2006  Purdue Research Foundation
    13  *
    1410 *  See the file "license.terms" for information on usage and
    1511 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     
    2420namespace Rappture {
    2521
     22/**
     23 * Used by the Serializer to build up the buffer of serialized
     24 * data.  Similar to a string, but it handles nulls and other
     25 * control characters.  Also handles big/little endian order
     26 * properly.
     27 */
    2628class SerialBuffer {
    2729public:
     
    5153
    5254private:
    53     std::vector<char> _buffer;  // data within this buffer
    54     int _pos;                   // position for read functions
     55    /// Contains the actual data within this buffer.
     56    std::vector<char> _buffer;
     57
     58    /// Position for the various readXyz() functions.
     59    int _pos;
    5560};
    5661
  • trunk/src2/core/RpSerializable.cc

    r370 r413  
    11/*
     2 * ======================================================================
     3 *  Rappture::Serializable
     4 *
     5 *  AUTHOR:  Michael McLennan, Purdue University
     6 *           Carol X Song, Purdue University
     7 *
     8 *  Copyright (c) 2004-2006  Purdue Research Foundation
    29 * ----------------------------------------------------------------------
    3  *  Rappture::Serializable
    4  *    Base class for any object that can be serialized into a stream,
    5  *    then saved to a file or written to a socket, and reconstituted
    6  *    into its original form.  Serializable objects can be added to
    7  *    a serializer, which handles the overall conversion.
    8  *
    9  * ======================================================================
    10  *  AUTHOR:  Carol X Song, Purdue University
    11  *           Michael McLennan, Purdue University
    12  *  Copyright (c) 2004-2006  Purdue Research Foundation
    13  *
    1410 *  See the file "license.terms" for information on usage and
    1511 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  • trunk/src2/core/RpSerializable.h

    r370 r413  
    11/*
     2 * ======================================================================
     3 *  Rappture::Serializable
     4 *
     5 *  AUTHOR:  Michael McLennan, Purdue University
     6 *           Carol X Song, Purdue University
     7 *
     8 *  Copyright (c) 2004-2006  Purdue Research Foundation
    29 * ----------------------------------------------------------------------
    3  *  Rappture::Serializable
    4  *    Base class for any object that can be serialized into a stream,
    5  *    then saved to a file or written to a socket, and reconstituted
    6  *    into its original form.  Serializable objects can be added to
    7  *    a serializer, which handles the overall conversion.
    8  *
    9  * ======================================================================
    10  *  AUTHOR:  Carol X Song, Purdue University
    11  *           Michael McLennan, Purdue University
    12  *  Copyright (c) 2004-2006  Purdue Research Foundation
    13  *
    1410 *  See the file "license.terms" for information on usage and
    1511 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     
    2925class SerialConversion;  // see below
    3026
     27/**
     28 * Base class for any object that can be serialized into a stream,
     29 * then saved to a file or written to a socket, and reconstituted
     30 * into its original form.  Serializable objects can be added to
     31 * a serializer, which handles the overall conversion.
     32 */
    3133class Serializable {
    3234public:
     
    5961};
    6062
     63/**
     64 * Each class derived from Serializable should have a SerialConversion
     65 * stored as a static data member.  This declares information needed
     66 * to serialize/deserialize the class, making objects in that class
     67 * serializable.
     68 */
    6169class SerialConversion {
    6270public:
Note: See TracChangeset for help on using the changeset viewer.