- Timestamp:
- Oct 26, 2011, 8:44:43 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/vtkstreamlinesviewer.tcl
r2632 r2649 93 93 private method ConvertToVtkData { dataobj comp } 94 94 private method DrawLegend { title } 95 private method Combo { option } 95 96 private method EnterLegend { x y } 96 97 private method EventuallyResize { w h } … … 152 153 private variable _fields 153 154 private variable _currentField "" 155 private variable _field "" 154 156 private variable _numSeeds 200 155 157 private variable _colorMode "vmag";# Mode of colormap (vmag or scalar) … … 273 275 } 274 276 277 itk_component add fieldmenu { 278 menu $itk_component(plotarea).menu -bg black -fg white -relief flat \ 279 -tearoff no 280 } { 281 usual 282 ignore -background -foreground -relief -tearoff 283 } 275 284 set c $itk_component(view) 276 285 bind $c <Configure> [itcl::code $this EventuallyResize %w %h] … … 1037 1046 set _currentField [$_first hints default] 1038 1047 $itk_component(field) choices delete 0 end 1048 $itk_component(fieldmenu) delete 0 end 1039 1049 array unset _fields 1040 1050 foreach { name title units } [$_first hints vectors] { 1041 1051 set _vectorFields($title) $name 1042 1052 $itk_component(field) choices insert end "$name" "$title" 1053 $itk_component(fieldmenu) add radiobutton -label "$title" \ 1054 -value $title -variable [itcl::scope _currentField] \ 1055 -selectcolor red \ 1056 -activebackground black \ 1057 -activeforeground white \ 1058 -font "Arial 8" \ 1059 -command [itcl::code $this Combo invoke] 1043 1060 set _fields($name) [list $title $units] 1044 1061 } … … 1046 1063 set _scalarFields($title) $name 1047 1064 $itk_component(field) choices insert end "$name" "$title" 1065 $itk_component(fieldmenu) add radiobutton -label "$title" \ 1066 -value $title -variable [itcl::scope _currentField] \ 1067 -selectcolor red \ 1068 -activebackground black \ 1069 -activeforeground white \ 1070 -font "Arial 8" \ 1071 -command [itcl::code $this Combo invoke] 1048 1072 set _fields($name) [list $title $units] 1049 1073 } … … 1497 1521 } 1498 1522 foreach dataset [CurrentDatasets -visible] { 1523 puts stderr "streamlines colormode $_colorMode ${name} $dataset" 1524 puts stderr "cutplane colormode $_colorMode ${name} $dataset" 1499 1525 SendCmd "streamlines colormode $_colorMode ${name} $dataset" 1500 1526 SendCmd "cutplane colormode $_colorMode ${name} $dataset" … … 2513 2539 # ---------------------------------------------------------------------- 2514 2540 itcl::body Rappture::VtkStreamlinesViewer::ReceiveLegend { colormap title vmin vmax size } { 2515 #puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size"2541 puts stderr "ReceiveLegend colormap=$colormap title=$title range=$vmin,$vmax size=$size" 2516 2542 set _limits(vmin) $vmin 2517 2543 set _limits(vmax) $vmax … … 2525 2551 $_image(legend) configure -data $bytes 2526 2552 #puts stderr "read $size bytes for [image width $_image(legend)]x[image height $_image(legend)] legend>" 2527 DrawLegend $_title 2553 if { [catch {DrawLegend $_title} errs] != 0 } { 2554 puts stderr errs=$errs 2555 } 2528 2556 } 2529 2557 } … … 2575 2603 $c bind colormap <Motion> [itcl::code $this MotionLegend %x %y] 2576 2604 } 2605 $c bind title <ButtonPress> [itcl::code $this Combo post] 2606 $c bind title <Enter> [itcl::code $this Combo activate] 2607 $c bind title <Leave> [itcl::code $this Combo deactivate] 2577 2608 # Reset the item coordinates according the current size of the plot. 2578 2609 $c itemconfigure title -text $title … … 2697 2728 } 2698 2729 } 2730 2731 2732 # ---------------------------------------------------------------------- 2733 # USAGE: _dropdown post 2734 # USAGE: _dropdown unpost 2735 # USAGE: _dropdown select 2736 # 2737 # Used internally to handle the dropdown list for this combobox. The 2738 # post/unpost options are invoked when the list is posted or unposted 2739 # to manage the relief of the controlling button. The select option 2740 # is invoked whenever there is a selection from the list, to assign 2741 # the value back to the gauge. 2742 # ---------------------------------------------------------------------- 2743 itcl::body Rappture::VtkStreamlinesViewer::Combo {option} { 2744 set c $itk_component(view) 2745 switch -- $option { 2746 post { 2747 foreach { x1 y1 x2 y2 } [$c bbox title] break 2748 set x1 [expr [winfo width $itk_component(view)] - [winfo reqwidth $itk_component(fieldmenu)]] 2749 set x [expr $x1 + [winfo rootx $itk_component(view)]] 2750 set y [expr $y2 + [winfo rooty $itk_component(view)]] 2751 puts stderr "combo x=$x y=$y" 2752 $itk_component(fieldmenu) post $x $y 2753 } 2754 activate { 2755 $c itemconfigure title -fill red 2756 } 2757 deactivate { 2758 $c itemconfigure title -fill white 2759 } 2760 invoke { 2761 $itk_component(field) value $_currentField 2762 AdjustSetting streamlines-field 2763 } 2764 default { 2765 error "bad option \"$option\": should be post, unpost, select" 2766 } 2767 } 2768 } 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782
Note: See TracChangeset
for help on using the changeset viewer.