Ignore:
Timestamp:
Apr 24, 2008 11:30:56 AM (16 years ago)
Author:
dkearney
Message:

added ability for sequence.elemtents to contain a free text label. users can write their own label to sequence.element.about.label and it will show up next to the "Frame = 1" text just above the play button. Also made the "Frame = 1" text optional. if the user leaves out sequence.index.label, the "Frame = 1" will not show up.

File:
1 edited

Legend:

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

    r894 r997  
    2323
    2424    public method value {pos}
     25    public method label {pos}
    2526    public method index {pos}
    2627    public method size {}
     
    2930    private variable _xmlobj ""  ;# ref to lib obj with sequence data
    3031    private variable _dataobjs   ;# maps index => data object
     32    private variable _labels     ;# maps index => labels
    3133    private variable _indices    ;# list of sorted index values
    3234    private variable _hints      ;# cache of hints stored in XML
     
    5153        }
    5254
     55        # check for an element about.label stanza
     56        set elelabel [$xmlobj get $path.$name.about.label]
     57
    5358        set ctype ""
    5459        set _dataobjs($index) ""
     60        set _labels($index) ""
    5561        foreach cname [$_xmlobj children $name] {
    5662            set type [$xmlobj element -as type $path.$name.$cname]
     
    6066                    continue
    6167                }
     68                about {
     69                    # ignore this
     70                    continue
     71                }
    6272                curve {
    6373                    set obj [Rappture::Curve ::#auto $xmlobj $path.$name.$cname]
     
    100110            if {$type == $ctype} {
    101111                lappend _dataobjs($index) $obj
     112                set _labels($index) $elelabel
    102113            } else {
    103114                itcl::delete object $obj
     
    172183
    173184# ----------------------------------------------------------------------
     185# USAGE: label <pos>
     186#
     187# Returns the label for the element as position <pos> in the
     188# list of all elements.  Here, <pos> runs from 0 to size-1.
     189# ----------------------------------------------------------------------
     190itcl::body Rappture::Sequence::label {pos} {
     191    set i [lindex [lindex $_indices $pos] 0]
     192    return $_labels($i)
     193}
     194
     195# ----------------------------------------------------------------------
    174196# USAGE: index <pos>
    175197#
Note: See TracChangeset for help on using the changeset viewer.