Ignore:
Timestamp:
Jun 2, 2016, 8:19:06 AM (8 years ago)
Author:
dkearney
Message:

merging changes from trunk into multichoice branch

Location:
branches/multichoice
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/multichoice

  • branches/multichoice/gui/scripts/vtkstreamlinesviewer.tcl

    r6236 r6371  
    7272    private method BuildSurfaceTab {}
    7373    private method DrawLegend {}
    74     private method Combo { option }
    7574    private method Connect {}
    7675    private method CurrentDatasets {args}
     
    9190    private method IsValidObject { dataobj }
    9291    private method LeaveLegend {}
     92    private method LegendTitleAction { option }
    9393    private method MotionLegend { x y }
    9494    private method Pan {option x y}
     
    101101    private method ReceiveDataset { args }
    102102    private method ReceiveImage { args }
    103     private method ReceiveLegend { colormap title vmin vmax size }
     103    private method ReceiveLegend { colormap title min max size }
    104104    private method RequestLegend {}
    105105    private method Rotate {option x y}
    106106    private method SetCurrentColormap { color }
     107    private method SetCurrentFieldName { dataobj }
    107108    private method SetLegendTip { x y }
    108109    private method SetObjectStyle { dataobj comp }
     
    145146    private variable _curFldName ""
    146147    private variable _curFldLabel ""
    147     private variable _field ""
     148    private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    148149    private variable _streamlinesLength 0
    149150    private variable _numSeeds 200
    150     private variable _colorMode "vmag"; # Mode of colormap (vmag or scalar)
    151151
    152152    private common _downloadPopup;      # download options from popup
     
    301301    }
    302302    pack $itk_component(reset) -side top -padx 2 -pady 2
    303     Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
     303    Rappture::Tooltip::for $itk_component(reset) \
     304        "Reset the view to the default zoom level"
    304305
    305306    itk_component add zoomin {
     
    552553    }
    553554    array set params $settings
    554     set params(-description) ""
    555     set params(-param) ""
    556     array set params $settings
    557555
    558556    if {$params(-color) == "auto" || $params(-color) == "autoreset"} {
     
    592590        set _dlist [lreplace $_dlist $pos $pos]
    593591        array unset _obj2ovride $dataobj-*
    594         array unset _settings $dataobj-*
    595592        set changed 1
    596593    }
     
    653650            return $dlist
    654651        }
    655         -image {
     652        "-image" {
    656653            if {[llength $args] != 2} {
    657654                error "wrong # args: should be \"get -image view\""
     
    667664        }
    668665        default {
    669             error "bad option \"$op\": should be -objects or -image"
     666            error "bad option \"$op\": should be -objects, -visible or -image"
    670667        }
    671668    }
     
    982979        if { [info exists _obj2ovride($dataobj-raise)] &&  $_first == "" } {
    983980            set _first $dataobj
     981            SetCurrentFieldName $dataobj
    984982        }
    985983        foreach comp [$dataobj components] {
     
    10271025            }
    10281026        }
    1029         $itk_component(field) choices delete 0 end
    1030         $itk_component(fieldmenu) delete 0 end
    1031         array unset _fields
    1032         set _curFldName ""
    1033         set _curFldLabel ""
    1034         foreach cname [$_first components] {
    1035             foreach fname [$_first fieldnames $cname] {
    1036                 if { [info exists _fields($fname)] } {
    1037                     continue
    1038                 }
    1039                 foreach { label units components } \
    1040                     [$_first fieldinfo $fname] break
    1041                 $itk_component(field) choices insert end "$fname" "$label"
    1042                 $itk_component(fieldmenu) add radiobutton -label "$label" \
    1043                     -value $label -variable [itcl::scope _curFldLabel] \
    1044                     -selectcolor red \
    1045                     -activebackground $itk_option(-plotbackground) \
    1046                     -activeforeground $itk_option(-plotforeground) \
    1047                     -font "Arial 8" \
    1048                     -command [itcl::code $this Combo invoke]
    1049                 set _fields($fname) [list $label $units $components]
    1050                 if { $_curFldName == "" && $components == 3 } {
    1051                     set _curFldName $fname
    1052                     set _curFldLabel $label
    1053                 }
    1054             }
    1055         }
    1056         $itk_component(field) value $_curFldLabel
    10571027    }
    10581028
     
    12991269itcl::body Rappture::VtkStreamlinesViewer::InitSettings { args } {
    13001270    foreach spec $args {
    1301         if { [info exists _settings($_first${spec})] } {
    1302             # Reset global setting with dataobj specific setting
    1303             set _settings($spec) $_settings($_first${spec})
    1304         }
    13051271        AdjustSetting $spec
    13061272    }
     
    20682034    radiobutton $inner.vtk_button -text "VTK data file" \
    20692035        -variable [itcl::scope _downloadPopup(format)] \
    2070         -font "Helvetica 9 " \
     2036        -font "Arial 9" \
    20712037        -value vtk
    20722038    Rappture::Tooltip::for $inner.vtk_button "Save as VTK data file."
     
    21852151
    21862152# ----------------------------------------------------------------------
    2187 # USAGE: ReceiveLegend <colormap> <title> <vmin> <vmax> <size>
     2153# USAGE: ReceiveLegend <colormap> <title> <min> <max> <size>
    21882154#
    21892155# Invoked automatically whenever the "legend" command comes in from
     
    21912157# specified <size> will follow.
    21922158# ----------------------------------------------------------------------
    2193 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } {
     2159itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title min max size } {
    21942160    set _legendPending 0
    21952161    set _title $title
     
    22552221            $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y]
    22562222        }
    2257         $c bind title <ButtonPress> [itcl::code $this Combo post]
    2258         $c bind title <Enter> [itcl::code $this Combo activate]
    2259         $c bind title <Leave> [itcl::code $this Combo deactivate]
     2223        $c bind title <ButtonPress> [itcl::code $this LegendTitleAction post]
     2224        $c bind title <Enter> [itcl::code $this LegendTitleAction enter]
     2225        $c bind title <Leave> [itcl::code $this LegendTitleAction leave]
    22602226        # Reset the item coordinates according the current size of the plot.
    22612227        $c itemconfigure title -text $title
     
    23802346
    23812347# ----------------------------------------------------------------------
    2382 # USAGE: _dropdown post
    2383 # USAGE: _dropdown unpost
    2384 # USAGE: _dropdown select
    2385 #
    2386 # Used internally to handle the dropdown list for this combobox.  The
    2387 # post/unpost options are invoked when the list is posted or unposted
    2388 # to manage the relief of the controlling button.  The select option
    2389 # is invoked whenever there is a selection from the list, to assign
    2390 # the value back to the gauge.
    2391 # ----------------------------------------------------------------------
    2392 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} {
     2348# USAGE: LegendTitleAction post
     2349# USAGE: LegendTitleAction enter
     2350# USAGE: LegendTitleAction leave
     2351# USAGE: LegendTitleAction save
     2352#
     2353# Used internally to handle the dropdown list for the fields menu combobox.
     2354# The post option is invoked when the field title is pressed to launch the
     2355# dropdown.  The enter option is invoked when the user mouses over the field
     2356# title. The leave option is invoked when the user moves the mouse away
     2357# from the field title.  The save option is invoked whenever there is a
     2358# selection from the list, to alert the visualization server.
     2359# ----------------------------------------------------------------------
     2360itcl::body Rappture::VtkStreamlinesViewer::LegendTitleAction {option} {
    23932361    set c $itk_component(view)
    23942362    switch -- $option {
     
    24002368            tk_popup $itk_component(fieldmenu) $x $y
    24012369        }
    2402         activate {
     2370        enter {
    24032371            $c itemconfigure title -fill red
    24042372        }
    2405         deactivate {
     2373        leave {
    24062374            $c itemconfigure title -fill white
    24072375        }
    2408         invoke {
     2376        save {
    24092377            $itk_component(field) value $_curFldLabel
    24102378            AdjustSetting -field
    24112379        }
    24122380        default {
    2413             error "bad option \"$option\": should be post, unpost, select"
     2381            error "bad option \"$option\": should be post, enter, leave or save"
    24142382        }
    24152383    }
     
    24362404    set _view(-zoom) 1.0
    24372405}
     2406
     2407itcl::body Rappture::VtkStreamlinesViewer::SetCurrentFieldName { dataobj } {
     2408    set _first $dataobj
     2409    $itk_component(field) choices delete 0 end
     2410    $itk_component(fieldmenu) delete 0 end
     2411    array unset _fields
     2412    set _curFldName ""
     2413    set _curFldLabel ""
     2414    foreach cname [$_first components] {
     2415        foreach fname [$_first fieldnames $cname] {
     2416            if { [info exists _fields($fname)] } {
     2417                continue
     2418            }
     2419            foreach { label units components } \
     2420                [$_first fieldinfo $fname] break
     2421            $itk_component(field) choices insert end "$fname" "$label"
     2422            $itk_component(fieldmenu) add radiobutton -label "$label" \
     2423                -value $label -variable [itcl::scope _curFldLabel] \
     2424                -selectcolor red \
     2425                -activebackground $itk_option(-plotbackground) \
     2426                -activeforeground $itk_option(-plotforeground) \
     2427                -font "Arial 8" \
     2428                -command [itcl::code $this LegendTitleAction save]
     2429            set _fields($fname) [list $label $units $components]
     2430            if { $_curFldName == "" && $components == 3 } {
     2431                set _curFldName $fname
     2432                set _curFldLabel $label
     2433            }
     2434        }
     2435    }
     2436    $itk_component(field) value $_curFldLabel
     2437}
Note: See TracChangeset for help on using the changeset viewer.