Changeset 1373
- Timestamp:
- Apr 1, 2009, 4:55:25 PM (16 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/field.tcl
r1342 r1373 29 29 public method hints {{key ""}} 30 30 public method isunirect2d {} 31 public method isunirect3d {} 32 public method extents {{what -overall}} 31 33 32 34 protected method _build {} … … 47 49 private variable _comp2style ;# maps component name => style settings 48 50 private variable _comp2cntls ;# maps component name => x,y control points 49 51 private variable _comp2extents 50 52 private common _counter 0 ;# counter for unique vector names 51 53 } … … 114 116 itcl::delete object $_comp2unirect2d($name) 115 117 } 118 foreach name [array names _comp2unirect3d] { 119 itcl::delete object $_comp2unirect3d($name) 120 } 116 121 } 117 122 … … 178 183 } 179 184 if {[info exists _comp2unirect2d($what)]} { 180 return "" ;# no mesh -- it's embedded in the value data 185 return [$mobj mesh] 186 } 187 if {[info exists _comp2unirect3d($what)]} { 188 return [$mobj mesh] 181 189 } 182 190 error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]" … … 204 212 } 205 213 if {[info exists _comp2unirect2d($what)]} { 206 set mobj $_comp2unirect2d($what) 207 return [$mobj values] 214 return [$_comp2unirect2d($what) values] 215 } 216 if {[info exists _comp2unirect3d($what)]} { 217 return [$_comp2unirect3d($what) values] 208 218 } 209 219 error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]" … … 518 528 catch {unset _comp2style} 519 529 array unset _comp2unirect2d 520 530 array unset _comp2unirect3d 531 array unset _comp2extents 521 532 # 522 533 # Scan through the components of the field and create … … 540 551 } 541 552 set _comp2style($cname) "" 553 554 # Save the extents of the component 555 set extents [$_field element $cname.extents] 556 if { $extents == "" } { 557 set extents 1 558 } 559 set _comp2extents($cname) $extents 542 560 543 561 if {$type == "1D"} { … … 602 620 set _comp2dims($cname) "2D" 603 621 set _comp2unirect2d($cname) \ 604 [Rappture::UniRect2d \#auto $_xmlobj $_field $cname] 622 [Rappture::Unirect2d \#auto $_xmlobj $_field $cname] 623 set _comp2style($cname) [$_field get $cname.style] 624 incr _counter 625 } elseif { $element == "unirect3d" } { 626 set _comp2dims($cname) "3D" 627 set _comp2unirect3d($cname) \ 628 [Rappture::Unirect3d \#auto $_xmlobj $_field $cname] 605 629 set _comp2style($cname) [$_field get $cname.style] 606 630 incr _counter … … 694 718 set _comp2style($cname) [$_field get $cname.style] 695 719 incr _counter 696 697 720 } elseif {$type == "opendx"} { 698 721 # … … 757 780 } 758 781 759 # ---------------------------------------------------------------------- 760 # USAGE: mesh ?<name>? 761 # 762 # Returns a list {xvec yvec} for the specified field component <name>. 763 # If the name is not specified, then it returns the vectors for the 764 # overall field (sum of all components). 765 # ---------------------------------------------------------------------- 782 # 783 # isunirect2d -- 784 # 785 # Returns if the field is a unirect2d object. 786 # 766 787 itcl::body Rappture::Field::isunirect2d { } { 767 788 return [expr [array size _comp2unirect2d] > 0] 768 789 } 790 791 # 792 # isunirect3d -- 793 # 794 # Returns if the field is a unirect3d object. 795 # 796 itcl::body Rappture::Field::isunirect3d { } { 797 return [expr [array size _comp2unirect3d] > 0] 798 } 799 800 # 801 # extents -- 802 # 803 # Returns if the field is a unirect2d object. 804 # 805 itcl::body Rappture::Field::extents {{what -overall}} { 806 if {$what == "-overall" } { 807 set max 0 808 foreach cname [$_field children -type component] { 809 set extents [info exists _comp2extents($cname)] 810 if { $max < $extents } { 811 set max $extents 812 } 813 } 814 return $max 815 } 816 if { $what == "component0"} { 817 set what [lindex [components -name] 0] 818 return $_comp2extents($what) 819 } 820 return $_comp2extents($what) 821 } -
trunk/gui/scripts/field3dresult.tcl
r1342 r1373 57 57 set servers [Rappture::VisViewer::GetServerList "nanovis"] 58 58 if {"" != $servers && $flags(-mode) != "vtk"} { 59 itk_component add renderer { 60 Rappture::NanovisViewer $itk_interior.ren $servers 61 } 59 switch -- $flags(-mode) { 60 "nanovis" { 61 itk_component add renderer { 62 Rappture::NanovisViewer $itk_interior.ren $servers 63 } 64 } 65 "flowvis" { 66 itk_component add renderer { 67 Rappture::FlowvisViewer $itk_interior.ren $servers 68 } 69 } 70 } 62 71 pack $itk_component(renderer) -expand yes -fill both 63 72 -
trunk/gui/scripts/flowvisviewer.tcl
r1357 r1373 72 72 public method OverIsoMarker { m x } 73 73 74 public method drawer {what who}75 74 public method camera {option args} 75 public method tab {what who} 76 76 77 77 protected method Connect {} … … 110 110 private method ParseMarkersOption { tf ivol markers } 111 111 private method ParseLevelsOption { tf ivol levels } 112 private method BuildCutplanesDrawer {} 113 private method BuildSettingsDrawer {} 114 private method BuildCameraDrawer {} 112 private method BuildCutplanesTab {} 113 private method BuildViewTab {} 114 private method BuildVolumeTab {} 115 private method BuildCameraTab {} 115 116 private method PanCamera {} 116 117 private method GetMovie { widget width height } … … 143 144 common downloadPopup_ ;# download options from popup 144 145 145 private variable drawer_146 146 private common hardcopy_ 147 private variable headings_ 147 148 } 148 149 … … 220 221 rename -highlightbackground -controlbackground controlBackground Background 221 222 } 222 pack $itk_component(reset) -side top -padx 2 -pady 1223 pack $itk_component(reset) -side top -padx 2 -pady 2 223 224 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 224 225 … … 233 234 rename -highlightbackground -controlbackground controlBackground Background 234 235 } 235 pack $itk_component(zoomin) -side top -padx 1 -pady 1236 pack $itk_component(zoomin) -side top -padx 2 -pady 2 236 237 Rappture::Tooltip::for $itk_component(zoomin) "Zoom in" 237 238 … … 246 247 rename -highlightbackground -controlbackground controlBackground Background 247 248 } 248 pack $itk_component(zoomout) -side top -padx 2 -pady 1249 pack $itk_component(zoomout) -side top -padx 2 -pady 2 249 250 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 250 251 251 itk_component add settingsButton {252 label $itk_component(controls). settingsbutton \252 itk_component add configure_button { 253 label $itk_component(controls).configbutton \ 253 254 -borderwidth 1 -padx 1 -pady 1 \ 254 255 -relief "raised" -image [Rappture::icon wrench] … … 259 260 Background 260 261 } 261 pack $itk_component(settingsButton) -padx 2 -pady 1 \262 -ipadx 1 -ipady 1263 Rappture::Tooltip::for $itk_component(settingsButton) \264 "Configure settings"265 bind $itk_component(settingsButton) <ButtonPress> \266 [itcl::code $this drawer toggle settings]267 pack $itk_component(settingsButton) -side bottom \268 -padx 2 -pady 2 -anchor e269 270 BuildSettingsDrawer271 272 itk_component add cutplanesButton {273 label $itk_component(controls).cutplanesbutton \274 -borderwidth 1 -padx 1 -pady 1 \275 -relief "raised" -image [Rappture::icon cutbutton]276 } {277 usual278 ignore -borderwidth279 rename -highlightbackground -controlbackground controlBackground \280 Background281 }282 Rappture::Tooltip::for $itk_component(cutplanesButton) \283 "Set cutplanes"284 bind $itk_component(cutplanesButton) <ButtonPress> \285 [itcl::code $this drawer toggle cutplanes]286 pack $itk_component(cutplanesButton) -side bottom \287 -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1288 289 BuildCutplanesDrawer290 291 itk_component add cameraButton {292 label $itk_component(controls).camerabutton \293 -borderwidth 1 -padx 1 -pady 1 \294 -relief "raised" -image [Rappture::icon camera]295 } {296 usual297 ignore -borderwidth298 rename -highlightbackground -controlbackground controlBackground \299 Background300 }301 Rappture::Tooltip::for $itk_component(cameraButton) \302 "Camera settings"303 bind $itk_component(cameraButton) <ButtonPress> \304 [itcl::code $this drawer toggle camera]305 pack $itk_component(cameraButton) -side bottom \306 -padx 2 -pady 1 -ipadx 1 -ipady 1307 308 BuildCameraDrawer309 262 310 263 # … … 325 278 Rappture::Tooltip::for $itk_component(volume) \ 326 279 "Toggle the volume cloud on/off" 327 pack $itk_component(volume) -padx 1 -pady 1 280 pack $itk_component(volume) -padx 2 -pady 2 281 282 BuildViewTab 283 BuildVolumeTab 284 BuildCutplanesTab 285 BuildCameraTab 328 286 329 287 # Legend … … 331 289 set _image(legend) [image create photo] 332 290 itk_component add legend { 333 canvas $itk_component( area).legend -height 50 -highlightthickness 0291 canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0 334 292 } { 335 293 usual … … 337 295 rename -background -plotbackground plotBackground Background 338 296 } 339 pack $itk_component(legend) -side bottom -fill x340 297 bind $itk_component(legend) <Configure> \ 341 298 [list $_dispatcher event -idle !legend] 342 299 343 300 # Hack around the Tk panewindow. The problem is that the requested 301 # size of the 3d view isn't set until an image is retrieved from 302 # the server. So the panewindow uses the tiny size. 303 set w [expr [winfo reqwidth $itk_component(hull)] - 80] 304 blt::table $itk_component(plotarea) \ 305 0,0 $itk_component(3dview) -fill both -reqwidth $w \ 306 1,0 $itk_component(legend) -fill both 307 344 308 # Create flow controls... 345 309 … … 475 439 set _image(download) [image create photo] 476 440 441 $itk_component(scroller) contents $itk_component(view_canvas) 442 $itk_component(title) configure -text "$headings_(view)" 443 477 444 eval itk_initialize $args 478 445 … … 662 629 switch $option { 663 630 coming { 664 if {[catch {blt::winop snap $itk_component(area) $_image(download)}]} { 631 if {[catch {blt::winop snap $itk_component(plotarea) \ 632 $_image(download)}]} { 665 633 $_image(download) configure -width 1 -height 1 666 634 $_image(download) put #000000 … … 791 759 # sent later. 792 760 # 793 itcl::body Rappture::FlowvisViewer::SendCmd { string} {761 itcl::body Rappture::FlowvisViewer::SendCmd { string } { 794 762 if {[llength $sendobjs_] > 0} { 795 763 append outbuf_ $string "\n" … … 816 784 set data [$dataobj values $comp] 817 785 set nbytes [string length $data] 818 if { ![SendBytes "flow data follows $nbytes"] } { 819 return 820 } 786 set extents [$dataobj extents $comp] 787 788 # I have a field. Is a vector field or a volume field? 789 if { $extents == 1 } { 790 set cmd "volume data follows $nbytes" 791 } else { 792 set cmd "flow data follows $nbytes $extents" 793 } 794 if { ![SendBytes $cmd] } { 795 return 796 } 821 797 if { ![SendBytes $data] } { 822 798 return … … 1370 1346 if {$op} { 1371 1347 $itk_component(${axis}CutButton) configure \ 1372 -image [Rappture::icon ${axis}-cutplane-on] \1373 1348 -relief sunken 1374 1349 SendCmd "cutplane state 1 $axis [CurrentVolumeIds -cutplanes]" … … 1376 1351 } else { 1377 1352 $itk_component(${axis}CutButton) configure \ 1378 -image [Rappture::icon ${axis}-cutplane-off] \1379 1353 -relief raised 1380 1354 SendCmd "cutplane state 0 $axis [CurrentVolumeIds -cutplanes]" … … 1626 1600 "legend" { 1627 1601 if { $settings_($this-legend) } { 1628 pack $itk_component(legend) -side bottom -fill x 1602 blt::table $itk_component(plotarea) \ 1603 1,0 $itk_component(legend) -fill x 1629 1604 } else { 1630 pack forget $itk_component(legend)1605 blt::table forget $itk_component(legend) 1631 1606 } 1632 1607 FixLegend … … 2059 2034 } 2060 2035 2061 itcl::body Rappture::FlowvisViewer::drawer { what who } { 2062 if { [info exists drawer_(current)] && $who != $drawer_(current) } { 2063 drawer deactivate $drawer_(current) 2064 } 2065 switch -- ${what} { 2066 "activate" { 2067 $itk_component(drawer) add $itk_component($who) -sticky nsew 2068 after idle [list focus $itk_component($who)] 2069 if { ![info exists drawer_($who)] } { 2070 set rw [winfo reqwidth $itk_component($who)] 2071 set w [winfo width $itk_component(drawer)] 2072 set x [expr $w - $rw] 2073 $itk_component(drawer) sash place 0 $x 0 2074 set drawer_($who) 1 2075 } else { 2076 set w [winfo width $itk_component(drawer)] 2077 puts stderr "w of drawer is $w" 2078 puts stderr "w of last($who) is $drawer_($who-lastx)" 2079 set x [expr $w - $drawer_($who-lastx) - 10] 2080 puts stderr "setting sash to $x for $who" 2081 $itk_component(drawer) sash place 0 $x 0 2082 $itk_component(drawer) paneconfigure $itk_component($who) \ 2083 -width $drawer_($who-lastx) 2084 $itk_component(3dview) configure -width $x 2085 } 2086 set drawer_(current) $who 2087 $itk_component(${who}Button) configure -relief sunken -bd 1 2088 } 2089 "deactivate" { 2090 # Save the current width of the drawer. 2091 puts stderr "component=$who" 2092 set width [winfo width $itk_component($who)] 2093 set reqwidth [winfo reqwidth $itk_component($who)] 2094 if { $reqwidth < $width } { 2095 set width $reqwidth 2096 } 2097 set x [lindex [$itk_component(drawer) sash coord 0] 0] 2098 puts stderr "sashx=$x" 2099 set drawer_($who-lastx) $width 2100 $itk_component(drawer) forget $itk_component($who) 2101 $itk_component(${who}Button) configure -relief raised -bd 1 2102 unset drawer_(current) 2103 } 2104 "toggle" { 2105 set slaves [$itk_component(drawer) panes] 2106 if { [lsearch $slaves $itk_component($who)] >= 0 } { 2107 drawer deactivate $who 2108 } else { 2109 drawer activate $who 2110 } 2111 } 2112 "resize" { 2113 set bbox [$itk_component(${who}Canvas) bbox all] 2114 set wid [winfo width $itk_component(${who}Frame)] 2115 $itk_component(${who}Canvas) configure -width $wid \ 2116 -scrollregion $bbox -yscrollincrement 0.1i 2117 } 2118 } 2119 } 2120 2121 itcl::body Rappture::FlowvisViewer::BuildSettingsDrawer {} { 2036 2037 itcl::body Rappture::FlowvisViewer::BuildViewTab {} { 2122 2038 foreach { key value } { 2123 2039 grid 0 … … 2128 2044 particles 1 2129 2045 lic 1 2046 } { 2047 set settings_($this-$key) $value 2048 } 2049 itk_component add view_canvas { 2050 canvas $itk_component(scroller).viewcanvas -highlightthickness 0 2051 } { 2052 ignore -highlightthickness 2053 } 2054 $itk_component(sidebar) insert end "view" \ 2055 -image [Rappture::icon wrench] -text "" -padx 0 -pady 0 \ 2056 -command [itcl::code $this tab select "view"] 2057 set headings_(view) "View Settings" 2058 2059 itk_component add view_frame { 2060 frame $itk_component(view_canvas).frame \ 2061 -highlightthickness 0 2062 } { 2063 ignore -highlightthickness 2064 } 2065 $itk_component(view_canvas) create window 0 0 \ 2066 -anchor nw -window $itk_component(view_frame) 2067 bind $itk_component(view_frame) <Configure> \ 2068 [itcl::code $this tab resize "view"] 2069 2070 set inner $itk_component(view_frame) 2071 2072 set fg [option get $itk_component(hull) font Font] 2073 #set bfg [option get $itk_component(hull) boldFont Font] 2074 2075 set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0 2076 checkbutton $inner.isosurface \ 2077 -text "Isosurface shading" \ 2078 -variable [itcl::scope settings_($this-isosurface)] \ 2079 -command [itcl::code $this FixSettings isosurface] \ 2080 -font "Arial 9" 2081 2082 checkbutton $inner.axes \ 2083 -text "Axes" \ 2084 -variable [itcl::scope settings_($this-axes)] \ 2085 -command [itcl::code $this FixSettings axes] \ 2086 -font "Arial 9" 2087 2088 checkbutton $inner.grid \ 2089 -text "Grid" \ 2090 -variable [itcl::scope settings_($this-grid)] \ 2091 -command [itcl::code $this FixSettings grid] \ 2092 -font "Arial 9" 2093 2094 checkbutton $inner.outline \ 2095 -text "Outline" \ 2096 -variable [itcl::scope settings_($this-outline)] \ 2097 -command [itcl::code $this FixSettings outline] \ 2098 -font "Arial 9" 2099 2100 checkbutton $inner.legend \ 2101 -text "Legend" \ 2102 -variable [itcl::scope settings_($this-legend)] \ 2103 -command [itcl::code $this FixSettings legend] \ 2104 -font "Arial 9" 2105 2106 checkbutton $inner.volume \ 2107 -text "Volume" \ 2108 -variable [itcl::scope settings_($this-volume)] \ 2109 -command [itcl::code $this FixSettings volume] \ 2110 -font "Arial 9" 2111 2112 checkbutton $inner.particles \ 2113 -text "Particles" \ 2114 -variable [itcl::scope settings_($this-particles)] \ 2115 -command [itcl::code $this FixSettings particles] \ 2116 -font "Arial 9" 2117 2118 checkbutton $inner.lic \ 2119 -text "Lic" \ 2120 -variable [itcl::scope settings_($this-lic)] \ 2121 -command [itcl::code $this FixSettings lic] \ 2122 -font "Arial 9" 2123 2124 blt::table $inner \ 2125 0,0 $inner.axes -columnspan 2 -anchor w \ 2126 1,0 $inner.grid -columnspan 2 -anchor w \ 2127 2,0 $inner.outline -columnspan 2 -anchor w \ 2128 3,0 $inner.volume -columnspan 2 -anchor w \ 2129 4,0 $inner.legend -columnspan 2 -anchor w \ 2130 5,0 $inner.particles -columnspan 2 -anchor w \ 2131 6,0 $inner.lic -columnspan 1 -anchor w \ 2132 2133 } 2134 2135 itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} { 2136 foreach { key value } { 2130 2137 light 40 2131 2138 transp 50 … … 2135 2142 set settings_($this-$key) $value 2136 2143 } 2137 itk_component add settings { 2138 Rappture::Scroller $itk_component(drawer).settings \ 2139 -xscrollmode auto -yscrollmode auto \ 2140 -highlightthickness 0 2141 } 2142 2143 itk_component add settingsCanvas { 2144 canvas $itk_component(settings).canvas -highlightthickness 0 2144 itk_component add volume_canvas { 2145 canvas $itk_component(scroller).volumecanvas -highlightthickness 0 2145 2146 } { 2146 2147 ignore -highlightthickness 2147 2148 } 2148 $itk_component(settings) contents $itk_component(settingsCanvas) 2149 2150 itk_component add settingsFrame { 2151 frame $itk_component(settingsCanvas).frame \ 2149 $itk_component(sidebar) insert end "volume" \ 2150 -image [Rappture::icon playback-record] -text "" -padx 0 -pady 0 \ 2151 -command [itcl::code $this tab select "volume"] 2152 set headings_(volume) "Volume Settings" 2153 2154 itk_component add volume_frame { 2155 frame $itk_component(volume_canvas).frame \ 2152 2156 -highlightthickness 0 2153 2157 } { 2154 2158 ignore -highlightthickness 2155 2159 } 2156 $itk_component(settingsCanvas) create window 0 0 \ 2157 -anchor nw -window $itk_component(settingsFrame) 2158 bind $itk_component(settingsFrame) <Configure> \ 2159 [itcl::code $this drawer resize settings] 2160 2161 set inner $itk_component(settingsFrame) 2162 2163 label $inner.title -text "View Settings" -font "Arial 10 bold" 2164 label $inner.volset -text "Volume Settings" -font "Arial 10 bold" 2160 $itk_component(volume_canvas) create window 0 0 \ 2161 -anchor nw -window $itk_component(volume_frame) 2162 bind $itk_component(volume_frame) <Configure> \ 2163 [itcl::code $this tab resize "volume"] 2164 2165 set inner $itk_component(volume_frame) 2165 2166 2166 2167 set fg [option get $itk_component(hull) font Font] … … 2195 2196 label $inner.thick -text "Thick" -font $fg 2196 2197 2197 set ::Rappture::FlowvisViewer::settings_($this-isosurface) 02198 checkbutton $inner.isosurface \2199 -text "Isosurface shading" \2200 -variable [itcl::scope settings_($this-isosurface)] \2201 -command [itcl::code $this FixSettings isosurface] \2202 -font "Arial 9"2203 2204 checkbutton $inner.axes \2205 -text "Axes" \2206 -variable [itcl::scope settings_($this-axes)] \2207 -command [itcl::code $this FixSettings axes] \2208 -font "Arial 9"2209 2210 checkbutton $inner.grid \2211 -text "Grid" \2212 -variable [itcl::scope settings_($this-grid)] \2213 -command [itcl::code $this FixSettings grid] \2214 -font "Arial 9"2215 2216 checkbutton $inner.outline \2217 -text "Outline" \2218 -variable [itcl::scope settings_($this-outline)] \2219 -command [itcl::code $this FixSettings outline] \2220 -font "Arial 9"2221 2222 checkbutton $inner.legend \2223 -text "Legend" \2224 -variable [itcl::scope settings_($this-legend)] \2225 -command [itcl::code $this FixSettings legend] \2226 -font "Arial 9"2227 2228 checkbutton $inner.volume \2229 -text "Volume" \2230 -variable [itcl::scope settings_($this-volume)] \2231 -command [itcl::code $this FixSettings volume] \2232 -font "Arial 9"2233 2234 checkbutton $inner.particles \2235 -text "Particles" \2236 -variable [itcl::scope settings_($this-particles)] \2237 -command [itcl::code $this FixSettings particles] \2238 -font "Arial 9"2239 2240 checkbutton $inner.lic \2241 -text "Lic" \2242 -variable [itcl::scope settings_($this-lic)] \2243 -command [itcl::code $this FixSettings lic] \2244 -font "Arial 9"2245 2246 2198 blt::table $inner \ 2247 0,0 $inner.title -anchor w -columnspan 4 \ 2248 1,1 $inner.axes -columnspan 2 -anchor w \ 2249 2,1 $inner.grid -columnspan 2 -anchor w \ 2250 3,1 $inner.outline -columnspan 2 -anchor w \ 2251 4,1 $inner.volume -columnspan 2 -anchor w \ 2252 1,3 $inner.legend -columnspan 2 -anchor w \ 2253 2,3 $inner.particles -columnspan 2 -anchor w \ 2254 3,3 $inner.lic -columnspan 1 -anchor w \ 2255 9,0 $inner.volset -anchor w -columnspan 4 \ 2256 11,1 $inner.dim -anchor e \ 2257 11,2 $inner.light -columnspan 2 \ 2258 11,4 $inner.bright -anchor w \ 2259 12,1 $inner.fog -anchor e \ 2260 12,2 $inner.transp -columnspan 2 \ 2261 12,4 $inner.plastic -anchor w \ 2262 13,1 $inner.clear -anchor e \ 2263 13,2 $inner.opacity -columnspan 2 \ 2264 13,4 $inner.opaque -anchor w \ 2265 14,1 $inner.thin -anchor e \ 2266 14,2 $inner.thickness -columnspan 2 \ 2267 14,4 $inner.thick -anchor w \ 2268 2269 blt::table configure $inner c0 -resize expand -width 4 2270 } 2271 2272 itcl::body Rappture::FlowvisViewer::BuildCutplanesDrawer {} { 2273 itk_component add cutplanes { 2274 Rappture::Scroller $itk_component(drawer).cutplanes \ 2275 -xscrollmode auto -yscrollmode auto \ 2276 -highlightthickness 0 2277 } 2278 2279 # 2280 # Create slicer controls... 2281 # 2282 itk_component add cutplanesCanvas { 2283 canvas $itk_component(cutplanes).canvas -highlightthickness 0 2199 0,0 $inner.dim -anchor e \ 2200 0,1 $inner.light -columnspan 2 \ 2201 0,3 $inner.bright -anchor w \ 2202 1,0 $inner.fog -anchor e \ 2203 1,1 $inner.transp -columnspan 2 \ 2204 1,3 $inner.plastic -anchor w \ 2205 2,0 $inner.clear -anchor e \ 2206 2,1 $inner.opacity -columnspan 2 \ 2207 2,3 $inner.opaque -anchor w \ 2208 3,0 $inner.thin -anchor e \ 2209 3,1 $inner.thickness -columnspan 2 \ 2210 3,3 $inner.thick -anchor w \ 2211 } 2212 2213 itcl::body Rappture::FlowvisViewer::BuildCutplanesTab {} { 2214 2215 itk_component add cutplanes_canvas { 2216 canvas $itk_component(scroller).cutplanescanvas -highlightthickness 0 2284 2217 } { 2285 2218 ignore -highlightthickness 2286 2219 } 2287 $itk_component(cutplanes) contents $itk_component(cutplanesCanvas) 2288 2289 itk_component add cutplanesFrame { 2290 frame $itk_component(cutplanesCanvas).frame \ 2220 $itk_component(sidebar) insert end "cutplanes" \ 2221 -image [Rappture::icon cutbutton] -text "" -padx 0 -pady 0 \ 2222 -command [itcl::code $this tab select "cutplanes"] 2223 set headings_(cutplanes) "Cutplane Settings" 2224 2225 itk_component add cutplanes_frame { 2226 frame $itk_component(cutplanes_canvas).frame \ 2291 2227 -highlightthickness 0 2292 2228 } { 2293 2229 ignore -highlightthickness 2294 2230 } 2295 $itk_component(cutplanesCanvas) create window 0 0 \ 2296 -anchor nw -window $itk_component(cutplanesFrame) 2297 bind $itk_component(cutplanesFrame) <Configure> \ 2298 [itcl::code $this drawer resize cutplanes] 2299 2300 set inner $itk_component(cutplanesFrame) 2301 2302 label $inner.title -text "Cutplanes" -font "Arial 10 bold" 2231 $itk_component(cutplanes_canvas) create window 0 0 \ 2232 -anchor nw -window $itk_component(cutplanes_frame) 2233 bind $itk_component(cutplanes_frame) <Configure> \ 2234 [itcl::code $this tab resize cutplanes] 2235 2236 set inner $itk_component(cutplanes_frame) 2303 2237 2304 2238 # X-value slicer... 2305 2239 itk_component add xCutButton { 2306 label $itk_component(cutplanes ).xbutton \2240 label $itk_component(cutplanes_frame).xbutton \ 2307 2241 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 2308 -image [Rappture::icon x-cutplane -off] \2242 -image [Rappture::icon x-cutplane] \ 2309 2243 -highlightthickness 0 2310 2244 } { … … 2320 2254 2321 2255 itk_component add xCutScale { 2322 ::scale $itk_component(cutplanes ).xval -from 100 -to 0 \2256 ::scale $itk_component(cutplanes_frame).xval -from 100 -to 0 \ 2323 2257 -width 10 -orient vertical -showvalue off \ 2324 -borderwidth 1 -highlightthickness 0 \2258 -borderwidth 1 -highlightthickness 0 -state disabled \ 2325 2259 -command [itcl::code $this Slice move x] 2326 2260 } { … … 2334 2268 } 2335 2269 $itk_component(xCutScale) set 50 2336 #$itk_component(xCutScale) configure -state disabled2337 2270 Rappture::Tooltip::for $itk_component(xCutScale) \ 2338 2271 "@[itcl::code $this SlicerTip x]" … … 2340 2273 # Y-value slicer... 2341 2274 itk_component add yCutButton { 2342 label $itk_component(cutplanes ).ybutton \2275 label $itk_component(cutplanes_frame).ybutton \ 2343 2276 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 2344 -image [Rappture::icon y-cutplane -off] \2277 -image [Rappture::icon y-cutplane] \ 2345 2278 -highlightthickness 0 2346 2279 } { … … 2356 2289 2357 2290 itk_component add yCutScale { 2358 ::scale $itk_component(cutplanes ).yval -from 100 -to 0 \2291 ::scale $itk_component(cutplanes_frame).yval -from 100 -to 0 \ 2359 2292 -width 10 -orient vertical -showvalue off \ 2360 -borderwidth 1 -highlightthickness 0 \2293 -borderwidth 1 -highlightthickness 0 -state disabled \ 2361 2294 -command [itcl::code $this Slice move y] 2362 2295 } { … … 2367 2300 rename -troughcolor -controldarkbackground controlDarkBackground Background 2368 2301 } 2369 $itk_component(yCutScale) set 502370 #$itk_component(yCutScale) configure -state disabled2371 2302 Rappture::Tooltip::for $itk_component(yCutScale) \ 2372 2303 "@[itcl::code $this SlicerTip y]" 2304 $itk_component(yCutScale) set 50 2373 2305 2374 2306 # Z-value slicer... 2375 2307 itk_component add zCutButton { 2376 label $itk_component(cutplanes ).zbutton \2308 label $itk_component(cutplanes_frame).zbutton \ 2377 2309 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 2378 -image [Rappture::icon z-cutplane -off] \2310 -image [Rappture::icon z-cutplane] \ 2379 2311 -highlightthickness 0 2380 2312 } { … … 2389 2321 2390 2322 itk_component add zCutScale { 2391 ::scale $itk_component(cutplanes ).zval -from 100 -to 0 \2323 ::scale $itk_component(cutplanes_frame).zval -from 100 -to 0 \ 2392 2324 -width 10 -orient vertical -showvalue off \ 2393 -borderwidth 1 -highlightthickness 0 \2325 -borderwidth 1 -highlightthickness 0 -state disabled \ 2394 2326 -command [itcl::code $this Slice move z] 2395 2327 } { … … 2406 2338 2407 2339 blt::table $inner \ 2408 0,0 $inner.title -anchor w -columnspan 4 \ 2409 3,1 $itk_component(xCutButton) \ 2410 3,2 $itk_component(yCutButton) \ 2411 3,3 $itk_component(zCutButton) \ 2412 2,1 $itk_component(xCutScale) \ 2413 2,2 $itk_component(yCutScale) \ 2414 2,3 $itk_component(zCutScale) \ 2415 2416 blt::table configure $inner c0 -resize expand -width 4 2417 } 2418 2419 itcl::body Rappture::FlowvisViewer::BuildCameraDrawer {} { 2420 2421 itk_component add camera { 2422 Rappture::Scroller $itk_component(drawer).camerascrl \ 2423 -xscrollmode auto -yscrollmode auto \ 2424 -highlightthickness 0 2425 } 2426 2427 itk_component add cameraCanvas { 2428 canvas $itk_component(camera).canvas -highlightthickness 0 2340 1,0 $itk_component(xCutButton) \ 2341 1,1 $itk_component(yCutButton) \ 2342 1,2 $itk_component(zCutButton) \ 2343 0,0 $itk_component(xCutScale) \ 2344 0,1 $itk_component(yCutScale) \ 2345 0,2 $itk_component(zCutScale) \ 2346 } 2347 2348 itcl::body Rappture::FlowvisViewer::BuildCameraTab {} { 2349 2350 itk_component add camera_canvas { 2351 canvas $itk_component(scroller).cameracanvas -highlightthickness 0 2429 2352 } { 2430 2353 ignore -highlightthickness 2431 2354 } 2432 $itk_component(camera) contents $itk_component(cameraCanvas) 2433 2434 itk_component add cameraFrame { 2435 frame $itk_component(cameraCanvas).frame \ 2355 $itk_component(sidebar) insert end "camera" \ 2356 -image [Rappture::icon camera] -text "" -padx 0 -pady 0 \ 2357 -command [itcl::code $this tab select "camera"] 2358 set headings_(camera) "Camera Settings" 2359 2360 itk_component add camera_frame { 2361 frame $itk_component(camera_canvas).frame \ 2436 2362 -highlightthickness 0 2437 2363 } 2438 $itk_component(cameraCanvas) create window 0 0 \ 2439 -anchor nw -window $itk_component(cameraFrame) 2440 bind $itk_component(cameraFrame) <Configure> \ 2441 [itcl::code $this drawer resize camera] 2442 2443 set inner $itk_component(cameraFrame) 2444 2445 label $inner.title -text "Camera Settings" -font "Arial 10 bold" 2364 $itk_component(camera_canvas) create window 0 0 \ 2365 -anchor nw -window $itk_component(camera_frame) 2366 bind $itk_component(camera_frame) <Configure> \ 2367 [itcl::code $this tab resize "camera"] 2368 2369 set inner $itk_component(camera_frame) 2446 2370 2447 2371 set labels { phi theta psi pan-x pan-y zoom } 2448 blt::table $inner \ 2449 0,0 $inner.title -anchor w -columnspan 4 2450 set row 1 2372 set row 0 2451 2373 foreach tag $labels { 2452 2374 label $inner.${tag}label -text $tag -font "Arial 9" … … 2456 2378 [itcl::code $this camera set ${tag}] 2457 2379 blt::table $inner \ 2458 $row, 1$inner.${tag}label -anchor e \2459 $row, 2$inner.${tag} -anchor w2380 $row,0 $inner.${tag}label -anchor e \ 2381 $row,1 $inner.${tag} -anchor w 2460 2382 incr row 2461 2383 } 2462 bind $inner.title <Shift-ButtonPress> \ 2463 [itcl::code $this camera show] 2464 blt::table configure $inner c0 -resize expand -width 4 2465 blt::table configure $inner c1 c2 -resize none 2466 blt::table configure $inner c3 -resize expand 2384 blt::table configure $inner c0 c1 -resize none 2385 blt::table configure $inner c2 -resize expand 2467 2386 2468 2387 } … … 2576 2495 return "" 2577 2496 } 2497 2498 itcl::body Rappture::FlowvisViewer::tab { what who } { 2499 switch -- ${what} { 2500 "select" { 2501 $itk_component(scroller) contents $itk_component(${who}_canvas) 2502 after idle [list focus $itk_component(${who}_canvas)] 2503 $itk_component(title) configure -text "$headings_($who)" 2504 drawer open 2505 } 2506 "deselect" { 2507 drawer close 2508 } 2509 "resize" { 2510 set bbox [$itk_component(${who}_canvas) bbox all] 2511 set wid [winfo width $itk_component(${who}_frame)] 2512 $itk_component(${who}_canvas) configure -width $wid \ 2513 -scrollregion $bbox -yscrollincrement 0.1i 2514 } 2515 } 2516 } 2517 -
trunk/gui/scripts/heightmapviewer.tcl
r1349 r1373 62 62 # do nothing 63 63 } 64 public method drawer{what who}64 public method tab {what who} 65 65 public method camera {option args} 66 66 protected method Connect {} … … 71 71 protected method ReceiveImage { args } 72 72 private method _ReceiveLegend {tf vmin vmax size} 73 private method _Build SettingsDrawer{}74 private method _BuildCamera Drawer{}73 private method _BuildViewTab {} 74 private method _BuildCameraTab {} 75 75 private method _PanCamera {} 76 76 protected method _receive_echo {channel {data ""}} … … 99 99 private variable view_ ;# view params for 3D view 100 100 private common settings_ ;# Array used for checkbuttons and radiobuttons 101 private variable initialized_102 101 private common hardcopy_ 102 private variable headings_ 103 103 } 104 104 … … 161 161 rename -highlightbackground -controlbackground controlBackground Background 162 162 } 163 pack $itk_component(reset) -side top -padx 2 -pady { 20 }163 pack $itk_component(reset) -side top -padx 1 -pady { 4 0 } 164 164 Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level" 165 165 … … 174 174 rename -highlightbackground -controlbackground controlBackground Background 175 175 } 176 pack $itk_component(zoomin) -side top -padx 2 -pady { 20 }176 pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 } 177 177 Rappture::Tooltip::for $itk_component(zoomin) "Zoom in" 178 178 … … 187 187 rename -highlightbackground -controlbackground controlBackground Background 188 188 } 189 pack $itk_component(zoomout) -side top -padx 2 -pady { 2 0}189 pack $itk_component(zoomout) -side top -padx 1 -pady { 4 } 190 190 Rappture::Tooltip::for $itk_component(zoomout) "Zoom out" 191 191 192 itk_component add settings_button { 193 label $itk_component(controls).settingsbutton \ 194 -borderwidth 1 -padx 1 -pady 1 \ 195 -relief "raised" -image [Rappture::icon wrench] 196 } { 197 usual 198 ignore -borderwidth 199 rename -highlightbackground -controlbackground controlBackground \ 200 Background 201 } 202 pack $itk_component(settings_button) -padx 2 -pady { 0 2 } \ 203 -ipadx 1 -ipady 1 204 Rappture::Tooltip::for $itk_component(settings_button) \ 205 "Configure settings" 206 bind $itk_component(settings_button) <ButtonPress> \ 207 [itcl::code $this drawer toggle settings] 208 pack $itk_component(settings_button) -side bottom \ 209 -padx 2 -pady 2 -anchor e 210 211 itk_component add camera_button { 212 label $itk_component(controls).camerabutton \ 213 -borderwidth 1 -padx 1 -pady 1 \ 214 -relief "raised" -image [Rappture::icon camera] 215 } { 216 usual 217 ignore -borderwidth 218 rename -highlightbackground -controlbackground controlBackground \ 219 Background 220 } 221 Rappture::Tooltip::for $itk_component(camera_button) \ 222 "Camera settings" 223 bind $itk_component(camera_button) <ButtonPress> \ 224 [itcl::code $this drawer toggle camera] 225 pack $itk_component(camera_button) -side bottom \ 226 -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1 227 228 _BuildSettingsDrawer 229 _BuildCameraDrawer 192 _BuildViewTab 193 _BuildCameraTab 230 194 231 195 # Legend 232 196 set _image(legend) [image create photo] 233 197 itk_component add legend { 234 canvas $itk_component( area).legend -width 30 -highlightthickness 0198 canvas $itk_component(plotarea).legend -width 30 -highlightthickness 0 235 199 } { 236 200 usual … … 238 202 rename -background -plotbackground plotBackground Background 239 203 } 240 pack $itk_component(legend) -side right -fill y 241 pack $itk_component(3dview) -side left -expand yes -fill both 204 set w [expr [winfo reqwidth $itk_component(hull)] - 80] 205 pack forget $itk_component(3dview) 206 pack $itk_component(3dview) -side left -fill both -expand yes 207 pack $itk_component(legend) -side left -fill y 208 242 209 bind $itk_component(legend) <Configure> \ 243 210 [list $_dispatcher event -idle !legend] … … 293 260 } 294 261 262 $itk_component(scroller) contents $itk_component(view_canvas) 263 $itk_component(title) configure -text "$headings_(view)" 295 264 set _image(download) [image create photo] 296 297 265 eval itk_initialize $args 298 299 266 Connect 300 267 } … … 483 450 coming { 484 451 if {[catch { 485 blt::winop snap $itk_component( area) $_image(download)452 blt::winop snap $itk_component(plotarea) $_image(download) 486 453 }]} { 487 454 $_image(download) configure -width 1 -height 1 … … 985 952 "legend" { 986 953 if { $settings_($this-legend) } { 987 pack $itk_component(legend) -side right -fill y954 pack $itk_component(legend) -side left -fill y 988 955 } else { 989 pack forget $itk_component(legend) 956 pack forget $itk_component(legend) 990 957 } 991 958 set lineht [expr [font metrics $itk_option(-font) -linespace] + 4] … … 1161 1128 } 1162 1129 1163 itcl::body Rappture::HeightmapViewer::_BuildSettingsDrawer {} { 1164 1165 itk_component add settings { 1166 Rappture::Scroller $itk_component(drawer).scrl \ 1167 -xscrollmode auto -yscrollmode auto \ 1168 -width 200 -height 100 1169 } 1170 1171 itk_component add settings_canvas { 1172 canvas $itk_component(settings).canvas -highlightthickness 0 1173 } 1174 $itk_component(settings) contents $itk_component(settings_canvas) 1175 1176 itk_component add settings_frame { 1177 frame $itk_component(settings_canvas).frame -bg white \ 1130 itcl::body Rappture::HeightmapViewer::_BuildViewTab {} { 1131 1132 itk_component add view_canvas { 1133 canvas $itk_component(scroller).viewcanvas -highlightthickness 0 1134 } { 1135 ignore -highlightthickness 1136 } 1137 $itk_component(sidebar) insert end "view" \ 1138 -image [Rappture::icon wrench] -text "" -padx 0 -pady 0 \ 1139 -ipadx 0 -ipady 0 \ 1140 -command [itcl::code $this tab select "view"] 1141 1142 set headings_(view) "View Settings" 1143 1144 itk_component add view_frame { 1145 frame $itk_component(view_canvas).frame \ 1178 1146 -highlightthickness 0 1179 } 1180 $itk_component(settings_canvas) create window 0 0 \ 1181 -anchor nw -window $itk_component(settings_frame) 1182 bind $itk_component(settings_frame) <Configure> \ 1183 [itcl::code $this drawer resize settings] 1147 } { 1148 ignore -background 1149 } 1150 $itk_component(view_canvas) create window 0 0 \ 1151 -anchor nw -window $itk_component(view_frame) 1152 bind $itk_component(view_frame) <Configure> \ 1153 [itcl::code $this tab resize view] 1184 1154 1185 1155 set fg [option get $itk_component(hull) font Font] 1186 1156 1187 set inner $itk_component( settings_frame)1157 set inner $itk_component(view_frame) 1188 1158 1189 1159 foreach { key value } { … … 1196 1166 set settings_($this-$key) $value 1197 1167 } 1198 set inner $itk_component(settings_frame) 1199 label $inner.title -text "View Settings" -font "Arial 10 bold" 1168 set inner $itk_component(view_frame) 1200 1169 checkbutton $inner.grid \ 1201 1170 -text "grid" \ … … 1226 1195 1227 1196 blt::table $inner \ 1228 0,0 $inner.title -anchor w -columnspan 2 \1229 1197 1,1 $inner.grid -anchor w \ 1230 1198 2,1 $inner.axes -anchor w \ … … 1233 1201 5,1 $inner.legend -anchor w 1234 1202 1235 blt::table configure $inner c0 -resize expand -width 21236 1203 blt::table configure $inner c2 -resize expand 1237 1204 blt::table configure $inner c1 -resize none … … 1239 1206 } 1240 1207 1241 itcl::body Rappture::HeightmapViewer::_BuildCameraDrawer {} { 1242 1243 itk_component add camera { 1244 Rappture::Scroller $itk_component(drawer).camerascrl \ 1245 -xscrollmode auto -yscrollmode auto \ 1246 -highlightthickness 0 1247 } 1208 itcl::body Rappture::HeightmapViewer::_BuildCameraTab {} { 1248 1209 1249 1210 itk_component add camera_canvas { 1250 canvas $itk_component( camera).canvas -highlightthickness 01211 canvas $itk_component(scroller).cameracanvas -highlightthickness 0 1251 1212 } { 1252 1213 ignore -highlightthickness 1253 1214 } 1254 $itk_component(camera) contents $itk_component(camera_canvas) 1215 $itk_component(sidebar) insert end "camera" \ 1216 -image [Rappture::icon camera] -text "" -padx 0 -pady 0 \ 1217 -ipadx 0 -ipady 0 \ 1218 -command [itcl::code $this tab select "camera"] 1219 set headings_(camera) "Camera Settings" 1255 1220 1256 1221 itk_component add camera_frame { 1257 1222 frame $itk_component(camera_canvas).frame \ 1258 -highlightthickness 0 1259 } 1223 -highlightthickness 0 1224 } { 1225 usual 1226 ignore -background 1227 } 1260 1228 $itk_component(camera_canvas) create window 0 0 \ 1261 1229 -anchor nw -window $itk_component(camera_frame) 1262 1230 bind $itk_component(camera_frame) <Configure> \ 1263 [itcl::code $this drawerresize camera]1231 [itcl::code $this tab resize camera] 1264 1232 1265 1233 set inner $itk_component(camera_frame) 1266 1234 1267 label $inner.title -text "Camera Settings" -font "Arial 10 bold"1268 1269 1235 set labels { phi theta psi pan-x pan-y zoom } 1270 blt::table $inner \1271 0,0 $inner.title -anchor w -columnspan 41272 1236 set row 1 1273 1237 foreach tag $labels { … … 1282 1246 incr row 1283 1247 } 1284 bind $inner.title <Shift-ButtonPress> \1285 [itcl::code $this camera show]1286 blt::table configure $inner c0 -resize expand -width 41287 1248 blt::table configure $inner c1 c2 -resize none 1288 1249 blt::table configure $inner c3 -resize expand … … 1290 1251 } 1291 1252 1292 itcl::body Rappture::HeightmapViewer:: drawer{ what who } {1253 itcl::body Rappture::HeightmapViewer::tab { what who } { 1293 1254 switch -- ${what} { 1294 "activate" { 1295 $itk_component(drawer) add $itk_component($who) -sticky nsew 1296 after idle [list focus $itk_component($who)] 1297 if { ![info exists initialized_($who)] } { 1298 set w [winfo width $itk_component(drawer)] 1299 set x [expr $w - 120] 1300 $itk_component(drawer) sash place 0 $x 0 1301 set initialized_($who) 1 1302 } 1303 $itk_component(${who}_button) configure -relief sunken 1304 } 1305 "deactivate" { 1306 $itk_component(drawer) forget $itk_component($who) 1307 $itk_component(${who}_button) configure -relief raised 1308 } 1309 "toggle" { 1310 set slaves [$itk_component(drawer) panes] 1311 if { [lsearch $slaves $itk_component($who)] >= 0 } { 1312 drawer deactivate $who 1313 } else { 1314 drawer activate $who 1315 } 1255 "select" { 1256 $itk_component(scroller) contents $itk_component(${who}_canvas) 1257 after idle [list focus $itk_component(${who}_canvas)] 1258 $itk_component(title) configure -text "$headings_($who)" 1259 drawer open 1260 } 1261 "deselect" { 1262 drawer close 1316 1263 } 1317 1264 "resize" { -
trunk/gui/scripts/molvisviewer.tcl
r1349 r1373 1 1 2 # ---------------------------------------------------------------------- 2 3 # COMPONENT: molvisviewer - view a molecule in 3D … … 70 71 public method bondthickness {option {model "all"} } 71 72 public method ResetView {} 72 public method settings {option args}73 public method tab {what who} 73 74 74 75 protected method _send {args} … … 84 85 protected method _vmouse {option b m x y} 85 86 private method _ReceiveImage { size cacheid frame rock } 86 private method _Build SettingsDrawer{}87 private method _BuildViewTab {} 87 88 private method GetPngImage { widget width height } 88 89 private method WaitIcon { option widget } … … 115 116 116 117 private common _settings ;# array of settings for all known widgets 117 private variable initialized_ "no";118 private variable initialized_ 118 119 119 120 common _downloadPopup ;# download options from popup … … 121 122 private common hardcopy_ 122 123 private variable nextToken_ 0 124 private variable headings_ 123 125 } 124 126 … … 299 301 $this projection perspective 300 302 301 itk_component add settings_button {302 label $itk_component(controls). settingsbutton \303 itk_component add configure_button { 304 label $itk_component(controls).configbutton \ 303 305 -borderwidth 1 -padx 1 -pady 1 \ 304 306 -relief "raised" -image [Rappture::icon wrench] … … 309 311 Background 310 312 } 311 pack $itk_component(settings_button) -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1 312 Rappture::Tooltip::for $itk_component(settings_button) \313 "Configure settings" 314 bind $itk_component(settings_button) <ButtonPress> \315 [itcl::code $this settings toggle] 316 pack $itk_component(settings_button) -side bottom \317 -padx 2 -pady 2 -anchor e 318 319 _BuildSettingsDrawer 313 314 _BuildViewTab 315 316 # Hack around the Tk panewindow. The problem is that the requested 317 # size of the 3d view isn't set until an image is retrieved from 318 # the server. So the panewindow uses the tiny size. 319 set w [expr [winfo reqwidth $itk_component(hull)] - 80] 320 blt::table $itk_component(plotarea) \ 321 0,0 $itk_component(3dview) -fill both -reqwidth $w 320 322 321 323 # … … 399 401 [itcl::code $this _map] 400 402 403 $itk_component(scroller) contents $itk_component(view_canvas) 404 $itk_component(title) configure -text "$headings_(view)" 405 401 406 eval itk_initialize $args 402 407 Connect 403 408 } 404 409 405 itcl::body Rappture::MolvisViewer::_BuildSettingsDrawer {} { 406 407 itk_component add settings { 408 Rappture::Scroller $itk_component(drawer).scrl \ 409 -xscrollmode auto -yscrollmode auto \ 410 -width 200 -height 100 411 } 412 413 itk_component add settings_canvas { 414 canvas $itk_component(settings).canvas 415 } 416 $itk_component(settings) contents $itk_component(settings_canvas) 417 418 itk_component add settings_frame { 419 frame $itk_component(settings_canvas).frame -bg white 410 itcl::body Rappture::MolvisViewer::_BuildViewTab {} { 411 412 itk_component add view_canvas { 413 canvas $itk_component(scroller).viewcanvas -highlightthickness 0 414 } { 415 ignore -highlightthickness 416 } 417 $itk_component(sidebar) insert end "view" \ 418 -image [Rappture::icon wrench] -text "" -padx 0 -pady 0 \ 419 -command [itcl::code $this tab select "view"] 420 set headings_(view) "View Settings" 421 422 itk_component add view_frame { 423 frame $itk_component(view_canvas).frame -bg white 420 424 } 421 $itk_component( settings_canvas) create window 0 0 \422 -anchor nw -window $itk_component( settings_frame)423 bind $itk_component( settings_frame) <Configure> \424 [itcl::code $this settings resize]425 $itk_component(view_canvas) create window 0 0 \ 426 -anchor nw -window $itk_component(view_frame) 427 bind $itk_component(view_frame) <Configure> \ 428 [itcl::code $this tab resize view] 425 429 426 430 set fg [option get $itk_component(hull) font Font] 427 431 428 set inner $itk_component( settings_frame)432 set inner $itk_component(view_frame) 429 433 label $inner.drawinglabel -text "Drawing Method" -font "Arial 9 bold" 430 434 … … 1552 1556 1553 1557 1554 itcl::body Rappture::MolvisViewer::settings { what args } {1555 switch -- ${what} {1556 "activate" {1557 $itk_component(drawer) add $itk_component(settings) -sticky nsew1558 after idle [list focus $itk_component(settings)]1559 if { !$initialized_ } {1560 set w [winfo width $itk_component(drawer)]1561 set x [expr $w - 100]1562 $itk_component(drawer) sash place 0 $x 01563 set initialized_ 11564 }1565 $itk_component(settings_button) configure -relief sunken1566 }1567 "deactivate" {1568 $itk_component(drawer) forget $itk_component(settings)1569 $itk_component(settings_button) configure -relief raised1570 }1571 "toggle" {1572 set slaves [$itk_component(drawer) panes]1573 if { [lsearch $slaves $itk_component(settings)] >= 0 } {1574 settings deactivate1575 } else {1576 settings activate1577 }1578 }1579 "resize" {1580 set bbox [$itk_component(settings_canvas) bbox all]1581 set wid [winfo width $itk_component(settings_frame)]1582 $itk_component(settings_canvas) configure -width $wid \1583 -scrollregion $bbox -yscrollincrement 0.1i1584 }1585 }1586 }1587 1558 1588 1559 itcl::body Rappture::MolvisViewer::WaitIcon { option widget } { … … 1661 1632 return "" 1662 1633 } 1634 1635 itcl::body Rappture::MolvisViewer::tab { what who } { 1636 switch -- ${what} { 1637 "select" { 1638 $itk_component(scroller) contents $itk_component(${who}_canvas) 1639 after idle [list focus $itk_component(${who}_canvas)] 1640 $itk_component(title) configure -text "$headings_($who)" 1641 drawer open 1642 } 1643 "deselect" { 1644 drawer close 1645 } 1646 "resize" { 1647 set bbox [$itk_component(${who}_canvas) bbox all] 1648 set wid [winfo width $itk_component(${who}_frame)] 1649 $itk_component(${who}_canvas) configure -width $wid \ 1650 -scrollregion $bbox -yscrollincrement 0.1i 1651 } 1652 } 1653 } -
trunk/gui/scripts/nanovisviewer.tcl
r1349 r1373 1 1 2 # ---------------------------------------------------------------------- 2 3 # COMPONENT: nanovisviewer - 3D volume rendering … … 239 240 label $itk_component(slicers).xslice \ 240 241 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 241 -image [Rappture::icon x-cutplane -off]242 -image [Rappture::icon x-cutplane] 242 243 } { 243 244 usual … … 275 276 label $itk_component(slicers).yslice \ 276 277 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 277 -image [Rappture::icon y-cutplane -off]278 -image [Rappture::icon y-cutplane] 278 279 } { 279 280 usual … … 311 312 label $itk_component(slicers).zslice \ 312 313 -borderwidth 1 -relief raised -padx 1 -pady 1 \ 313 -image [Rappture::icon z-cutplane -off]314 -image [Rappture::icon z-cutplane] 314 315 } { 315 316 usual … … 1320 1321 if {$op} { 1321 1322 $itk_component(${axis}slice) configure \ 1322 -image [Rappture::icon ${axis}-cutplane-on] \1323 1323 -relief sunken 1324 1324 $itk_component(${axis}slicer) configure -state normal … … 1326 1326 } else { 1327 1327 $itk_component(${axis}slice) configure \ 1328 -image [Rappture::icon ${axis}-cutplane-off] \1329 1328 -relief raised 1330 1329 $itk_component(${axis}slicer) configure -state disabled -
trunk/gui/scripts/page.tcl
r1342 r1373 238 238 } else { 239 239 if {[catch {$frame.cntls insert end $path.$cname} c]} { 240 error $c "$c\n (while building control for $path.$cname)" 240 global errorInfo 241 error $c "$c\n$errorInfo\n (while building control for $path.$cname)" 241 242 } 242 243 } -
trunk/gui/scripts/panes.tcl
r1342 r1373 49 49 private variable _counter 0 ;# counter for auto-generated names 50 50 private variable _frac 0.0 ;# list of fractions 51 public variable orientation "vertical" 51 52 } 52 53 … … 118 119 ignore -borderwidth 119 120 } 120 pack $itk_component(${sash}ridge) -fill x 121 121 if { $orientation == "vertical" } { 122 pack $itk_component(${sash}ridge) -fill x 123 } else { 124 pack $itk_component(${sash}ridge) -fill y -side left 125 } 122 126 foreach comp [list $sash ${sash}ridge] { 123 127 bind $itk_component($comp) <ButtonPress-1> \ … … 265 269 # ---------------------------------------------------------------------- 266 270 itcl::body Rappture::Panes::_drag {pname X Y} { 267 set realY [expr {$Y-[winfo rooty $itk_component(hull)]}] 268 set Ymax [winfo height $itk_component(hull)] 269 set frac [expr double($realY)/$Ymax] 271 if { $orientation == "vertical" } { 272 set realY [expr {$Y-[winfo rooty $itk_component(hull)]}] 273 set Ymax [winfo height $itk_component(hull)] 274 set frac [expr double($realY)/$Ymax] 275 } else { 276 set realX [expr {$X-[winfo rootx $itk_component(hull)]}] 277 set Xmax [winfo width $itk_component(hull)] 278 set frac [expr double($realX)/$Xmax] 279 } 270 280 if {$frac < 0.05} { 271 281 set frac 0.05 … … 303 313 # ---------------------------------------------------------------------- 304 314 itcl::body Rappture::Panes::_fixLayout {args} { 305 set h [winfo height $itk_component(hull)] 306 307 set plist "" 308 set flist "" 309 foreach p $_panes f $_frac v $_visibility { 310 set sash ${p}sash 311 if {$v} { 312 # this pane is visible -- make room for it 313 lappend plist $p 314 lappend flist $f 315 if { $orientation == "vertical" } { 316 set h [winfo height $itk_component(hull)] 317 318 set plist "" 319 set flist "" 320 foreach p $_panes f $_frac v $_visibility { 321 set sash ${p}sash 322 if {$v} { 323 # this pane is visible -- make room for it 324 lappend plist $p 325 lappend flist $f 326 if {[info exists itk_component($sash)]} { 327 set h [expr {$h - [winfo height $itk_component($sash)]}] 328 } 329 } else { 330 # this pane is not visible -- remove sash 331 if {[info exists itk_component($sash)]} { 332 place forget $itk_component($sash) 333 } 334 place forget $itk_component($p) 335 } 336 } 337 338 # normalize the fractions so they add up to 1 339 set total 0 340 foreach f $flist { set total [expr {$total+$f}] } 341 set newflist "" 342 foreach f $flist { 343 lappend newflist [expr {double($f)/$total}] 344 } 345 set flist $newflist 346 347 # lay out the various panes 348 set y 0 349 foreach p $plist f $flist { 350 set sash ${p}sash 315 351 if {[info exists itk_component($sash)]} { 316 set h [expr {$h - [winfo height $itk_component($sash)]}] 317 } 318 } else { 319 # this pane is not visible -- remove sash 352 set sh [winfo reqheight $itk_component($sash)] 353 place $itk_component($sash) -y $y -relx 0.5 -anchor n \ 354 -relwidth 1.0 -height $sh 355 set y [expr {$y + $sh}] 356 } 357 358 set ph [expr {$h*$f}] 359 place $itk_component($p) -y $y -relx 0.5 -anchor n \ 360 -relwidth 1.0 -height $ph 361 set y [expr {$y + $ph}] 362 } 363 } else { 364 set w [winfo width $itk_component(hull)] 365 366 set plist "" 367 set flist "" 368 foreach p $_panes f $_frac v $_visibility { 369 set sash ${p}sash 370 if {$v} { 371 # this pane is visible -- make room for it 372 lappend plist $p 373 lappend flist $f 374 if {[info exists itk_component($sash)]} { 375 set w [expr {$w - [winfo width $itk_component($sash)]}] 376 } 377 } else { 378 # this pane is not visible -- remove sash 379 if {[info exists itk_component($sash)]} { 380 place forget $itk_component($sash) 381 } 382 place forget $itk_component($p) 383 } 384 } 385 386 # normalize the fractions so they add up to 1 387 set total 0 388 foreach f $flist { set total [expr {$total+$f}] } 389 set newflist "" 390 foreach f $flist { 391 lappend newflist [expr {double($f)/$total}] 392 } 393 set flist $newflist 394 395 # lay out the various panes 396 set x 0 397 foreach p $plist f $flist { 398 set sash ${p}sash 320 399 if {[info exists itk_component($sash)]} { 321 place forget $itk_component($sash) 322 } 323 place forget $itk_component($p) 324 } 325 } 326 327 # normalize the fractions so they add up to 1 328 set total 0 329 foreach f $flist { set total [expr {$total+$f}] } 330 set newflist "" 331 foreach f $flist { 332 lappend newflist [expr {double($f)/$total}] 333 } 334 set flist $newflist 335 336 # lay out the various panes 337 set y 0 338 foreach p $plist f $flist { 339 set sash ${p}sash 340 if {[info exists itk_component($sash)]} { 341 set sh [winfo reqheight $itk_component($sash)] 342 place $itk_component($sash) -y $y -relx 0.5 -anchor n \ 343 -relwidth 1.0 -height $sh 344 set y [expr {$y + $sh}] 345 } 346 347 set ph [expr {$h*$f}] 348 place $itk_component($p) -y $y -relx 0.5 -anchor n \ 349 -relwidth 1.0 -height $ph 350 set y [expr {$y + $ph}] 351 } 400 set sw [winfo reqwidth $itk_component($sash)] 401 place $itk_component($sash) -x $x -rely 0.5 -anchor w \ 402 -relheight 1.0 -width $sw 403 set x [expr {$x + $sw}] 404 } 405 406 set pw [expr {$w*$f}] 407 place $itk_component($p) -x $x -rely 0.5 -anchor w \ 408 -relheight 1.0 -width $pw 409 set x [expr {$x + $pw}] 410 } 411 } 352 412 } 353 413 … … 359 419 # ---------------------------------------------------------------------- 360 420 itcl::body Rappture::Panes::_fixSashes {args} { 361 set ht [winfo pixels $itk_component(hull) $itk_option(-sashwidth)] 362 set bd [expr {$ht/2}] 363 foreach pane $_panes { 364 set sash "${pane}sashridge" 365 if {[info exists itk_component($sash)]} { 366 $itk_component($sash) configure -height $ht -borderwidth $bd 367 if {$itk_option(-sashrelief) == "solid"} { 368 $itk_component($sash) configure -background black 369 } else { 370 $itk_component($sash) configure \ 371 -background $itk_option(-background) 372 } 373 pack $itk_component($sash) -pady $itk_option(-sashpadding) 421 if { $orientation == "vertical" } { 422 set ht [winfo pixels $itk_component(hull) $itk_option(-sashwidth)] 423 set bd [expr {$ht/2}] 424 foreach pane $_panes { 425 set sash "${pane}sashridge" 426 if {[info exists itk_component($sash)]} { 427 $itk_component($sash) configure -height $ht -borderwidth $bd 428 if {$itk_option(-sashrelief) == "solid"} { 429 $itk_component($sash) configure -background black 430 } else { 431 $itk_component($sash) configure \ 432 -background $itk_option(-background) 433 } 434 pack $itk_component($sash) -pady $itk_option(-sashpadding) 435 } 436 } 437 } else { 438 set w [winfo pixels $itk_component(hull) $itk_option(-sashwidth)] 439 set bd [expr {$w/2}] 440 foreach pane $_panes { 441 set sash "${pane}sashridge" 442 if {[info exists itk_component($sash)]} { 443 $itk_component($sash) configure -width $w -borderwidth $bd 444 if {$itk_option(-sashrelief) == "solid"} { 445 $itk_component($sash) configure -background black 446 } else { 447 $itk_component($sash) configure \ 448 -background $itk_option(-background) 449 } 450 pack $itk_component($sash) -padx $itk_option(-sashpadding) \ 451 -side left 452 } 374 453 } 375 454 } -
trunk/gui/scripts/resultviewer.tcl
r1342 r1373 254 254 set mesh [$dataobj mesh] 255 255 set fmt [expr {("" != $mesh) ? "vtk" : "nanovis"}] 256 set extents [$dataobj extents] 257 if { $extents == 3 } { 258 set fmt "flowvis" 259 } 256 260 set w $itk_interior.field3D 257 261 Rappture::Field3DResult $w -mode $fmt -
trunk/gui/scripts/unirect2d.tcl
r1342 r1373 1 1 2 # ---------------------------------------------------------------------- 2 3 # COMPONENT: unirect2d - represents a uniform rectangular 2-D mesh. … … 17 18 namespace eval Rappture { # forward declaration } 18 19 19 itcl::class Rappture::Uni Rect2d {20 itcl::class Rappture::Unirect2d { 20 21 constructor {xmlobj field cname} { # defined below } 21 22 destructor { # defined below } … … 33 34 private variable _ymin 0 34 35 private variable _ynum 0 35 private variable _ zv "";# BLT vector containing the z-values36 private variable _values ""; # BLT vector containing the z-values 36 37 private variable _hints 37 38 } … … 40 41 # Constructor 41 42 # ---------------------------------------------------------------------- 42 itcl::body Rappture::Uni Rect2d::constructor {xmlobj field cname} {43 itcl::body Rappture::Unirect2d::constructor {xmlobj field cname} { 43 44 if {![Rappture::library isvalid $xmlobj]} { 44 45 error "bad value \"$xmlobj\": should be Rappture::library" … … 53 54 set _ymax [$mobj get "yaxis.max"] 54 55 set _ynum [$mobj get "yaxis.numpoints"] 56 57 foreach {key path} { 58 group about.group 59 label about.label 60 color about.color 61 style about.style 62 type about.type 63 xlabel xaxis.label 64 xdesc xaxis.description 65 xunits xaxis.units 66 xscale xaxis.scale 67 xmin xaxis.min 68 xmax xaxis.max 69 ylabel yaxis.label 70 ydesc yaxis.description 71 yunits yaxis.units 72 yscale yaxis.scale 73 ymin yaxis.min 74 ymax yaxis.max 75 } { 76 set str [$mobj get $path] 77 if {"" != $str} { 78 set _hints($key) $str 79 } 80 } 81 foreach {key} { extents axisorder } { 82 set str [$field get $cname.$key] 83 if {"" != $str} { 84 set _hints($key) $str 85 } 86 } 55 87 itcl::delete object $mobj 56 57 set _zv [blt::vector create #auto] 58 $_zv set [$field get "$cname.values"] 88 89 set _values [blt::vector create \#auto] 90 set values [$field get "$cname.values"] 91 if { $values == "" } { 92 set values [$field get "$cname.zvalues"] 93 } 94 $_values set $values 59 95 } 60 96 … … 62 98 # Destructor 63 99 # ---------------------------------------------------------------------- 64 itcl::body Rappture::Uni Rect2d::destructor {} {65 if { $_ zv!= "" } {66 blt::vector destroy $_ zv100 itcl::body Rappture::Unirect2d::destructor {} { 101 if { $_values != "" } { 102 blt::vector destroy $_values 67 103 } 68 104 } … … 74 110 # on the nanovis server. 75 111 # ---------------------------------------------------------------------- 76 itcl::body Rappture::Uni Rect2d::blob {} {112 itcl::body Rappture::Unirect2d::blob {} { 77 113 set data "unirect2d" 78 114 lappend data "xmin" $_xmin "xmax" $_xmax "xnum" $_xnum 79 115 lappend data "ymin" $_ymin "ymax" $_ymax "ynum" $_ynum 80 116 lappend data "xmin" $_xmin "ymin" $_ymin "xmax" $_xmax "ymax" $_ymax 81 if { [$_zv length] > 0 } { 82 lappend data "zvalues" [$_zv range 0 end] 117 foreach key { axisorder extents xunits yunits units } { 118 set hint [hints $key] 119 if { $hint != "" } { 120 lappend data $key $hint 121 } 122 } 123 if { [$_values length] > 0 } { 124 lappend data "values" [$_values range 0 end] 83 125 } 84 126 return [Rappture::encoding::encode -as zb64 $data] … … 91 133 # on the nanovis server. 92 134 # ---------------------------------------------------------------------- 93 itcl::body Rappture::Uni Rect2d::mesh {} {135 itcl::body Rappture::Unirect2d::mesh {} { 94 136 set dx [expr {($_xmax - $_xmin) / double($_xnum)}] 95 137 set dy [expr {($_ymax - $_ymin) / double($_ynum)}] … … 110 152 # on the nanovis server. 111 153 # ---------------------------------------------------------------------- 112 itcl::body Rappture::Uni Rect2d::values {} {113 if { [$_ zvlength] > 0 } {114 return [$_ zvrange 0 end]154 itcl::body Rappture::Unirect2d::values {} { 155 if { [$_values length] > 0 } { 156 return [$_values range 0 end] 115 157 } 116 158 return "" … … 122 164 # specified axis. 123 165 # ---------------------------------------------------------------------- 124 itcl::body Rappture::Uni Rect2d::limits {which} {166 itcl::body Rappture::Unirect2d::limits {which} { 125 167 set min "" 126 168 set max "" … … 137 179 set axis "yaxis" 138 180 } 139 v - xlin - vlog - z - zlin - zlog {140 if { [$_ zvlength] > 0 } {141 set min [blt::vector expr min($_ zv)]142 set max [blt::vector expr max($_ zv)]181 v - vlin - vlog - z - zlin - zlog { 182 if { [$_values length] > 0 } { 183 set min [blt::vector expr min($_values)] 184 set max [blt::vector expr max($_values)] 143 185 } else { 144 186 set min 0.0 … … 177 219 # the hint for that <keyword>, if it exists. 178 220 # ---------------------------------------------------------------------- 179 itcl::body Rappture::UniRect2d::hints {{keyword ""}} { 180 if {![info exists _hints]} { 181 foreach {key path} { 182 group about.group 183 label about.label 184 color about.color 185 style about.style 186 type about.type 187 xlabel xaxis.label 188 xdesc xaxis.description 189 xunits xaxis.units 190 xscale xaxis.scale 191 xmin xaxis.min 192 xmax xaxis.max 193 ylabel yaxis.label 194 ydesc yaxis.description 195 yunits yaxis.units 196 yscale yaxis.scale 197 ymin yaxis.min 198 ymax yaxis.max 199 } { 200 set str [$_curve get $path] 201 if {"" != $str} { 202 set _hints($key) $str 203 } 204 } 205 206 if {[info exists _hints(xlabel)] && "" != $_hints(xlabel) 207 && [info exists _hints(xunits)] && "" != $_hints(xunits)} { 208 set _hints(xlabel) "$_hints(xlabel) ($_hints(xunits))" 209 } 210 if {[info exists _hints(ylabel)] && "" != $_hints(ylabel) 211 && [info exists _hints(yunits)] && "" != $_hints(yunits)} { 212 set _hints(ylabel) "$_hints(ylabel) ($_hints(yunits))" 213 } 214 215 if {[info exists _hints(group)] && [info exists _hints(label)]} { 216 # pop-up help for each curve 217 set _hints(tooltip) $_hints(label) 218 } 219 } 220 221 itcl::body Rappture::Unirect2d::hints { {keyword ""} } { 222 if {[info exists _hints(xlabel)] && "" != $_hints(xlabel) 223 && [info exists _hints(xunits)] && "" != $_hints(xunits)} { 224 set _hints(xlabel) "$_hints(xlabel) ($_hints(xunits))" 225 } 226 if {[info exists _hints(ylabel)] && "" != $_hints(ylabel) 227 && [info exists _hints(yunits)] && "" != $_hints(yunits)} { 228 set _hints(ylabel) "$_hints(ylabel) ($_hints(yunits))" 229 } 230 231 if {[info exists _hints(group)] && [info exists _hints(label)]} { 232 # pop-up help for each curve 233 set _hints(tooltip) $_hints(label) 234 } 221 235 if {$keyword != ""} { 222 236 if {[info exists _hints($keyword)]} { -
trunk/gui/scripts/visviewer.tcl
r1342 r1373 21 21 22 22 private common servers_ ;# array of visualization server lists 23 set servers_(nanovis) " "24 set servers_(pymol) " "23 set servers_(nanovis) "localhost:2000" 24 set servers_(pymol) "localhost:2020" 25 25 26 26 private variable sid_ "" ;# socket connection to server 27 27 private common done_ ;# Used to indicate status of send. 28 28 private variable buffer_ ;# buffer for incoming/outgoing commands 29 29 private variable initialized_ 30 private variable isOpen_ 0 30 31 # Number of milliseconds to wait before idle timeout. 31 32 # If greater than 0, automatically disconnect from the visualization … … 64 65 protected method Color2RGB { color } 65 66 protected method Euler2XYZ { theta phi psi } 67 protected method drawer {what} 66 68 67 69 private proc _CheckNameList { namelist } { … … 88 90 itk::usual Panedwindow { 89 91 keep -background -cursor 92 } 93 itk::usual Tabset { 94 keep -background 90 95 } 91 96 … … 119 124 pack propagate $itk_component(hull) no 120 125 121 itk_component add controls { 122 frame $itk_interior.cntls 126 itk_component add panes { 127 panedwindow $itk_interior.panes \ 128 -orient horizontal -opaqueresize 1 -handlepad 0 \ 129 -handlesize 1 -sashwidth 2 130 } 131 pack $itk_component(panes) -expand yes -fill both 132 133 itk_component add plotarea { 134 frame $itk_component(panes).plotarea -highlightthickness 0 135 } 136 $itk_component(panes) add $itk_component(plotarea) -sticky nsew 137 set _image(plot) [image create photo] 138 itk_component add 3dview { 139 label $itk_component(plotarea).vol -image $_image(plot) \ 140 -highlightthickness 0 -borderwidth 0 141 } { 142 usual 143 ignore -highlightthickness -borderwidth 144 } 145 itk_component add drawer { 146 frame $itk_component(panes).cntls 123 147 } { 124 148 usual 125 149 rename -background -controlbackground controlBackground Background 126 150 } 127 pack $itk_component(controls) -side right -fill y 128 129 # 130 # RENDERING AREA 131 # 132 itk_component add drawer { 133 panedwindow $itk_interior.drawer \ 134 -orient horizontal -opaqueresize 1 -handlepad 0 \ 135 -handlesize 1 -sashwidth 2 136 } 137 pack $itk_component(drawer) -expand yes -fill both 138 139 itk_component add area { 140 frame $itk_interior.area -highlightthickness 0 141 } 142 $itk_component(drawer) add $itk_component(area) -sticky nsew 143 144 set _image(plot) [image create photo] 145 itk_component add 3dview { 146 label $itk_component(area).vol -image $_image(plot) \ 147 -highlightthickness 0 -width 1 -height 1 -borderwidth 0 151 itk_component add controls { 152 frame $itk_component(drawer).cntls 153 } { 154 usual 155 rename -background -controlbackground controlBackground Background 156 ignore -highlightthickness -borderwidth 157 } 158 159 itk_component add titlebar { 160 frame $itk_component(drawer).titlebar -background \#6666cc 161 } { 162 usual 163 ignore -highlightthickness -borderwidth -background 164 } 165 166 itk_component add title { 167 label $itk_component(titlebar).title -text "This is the title bar" \ 168 -background \#6666cc -font "Arial 8" -foreground white 169 } { 170 usual 171 ignore -background -font -foreground 172 } 173 itk_component add flipswitch { 174 button $itk_component(titlebar).flip \ 175 -borderwidth 1 -highlightthickness 0 \ 176 -relief "flat" -image [Rappture::icon sbar-open] \ 177 -command [itcl::code $this drawer toggle] \ 178 -background \#6666cc -foreground white -overrelief raised \ 179 -activebackground \#6666cc -activeforeground white 180 181 } { 182 ignore -borderwidth 183 rename -highlightbackground -controlbackground controlBackground \ 184 Background 185 } 186 Rappture::Tooltip::for $itk_component(flipswitch) \ 187 "Configure settings" 188 189 blt::table $itk_component(titlebar) \ 190 0,0 $itk_component(flipswitch) -ipady 2 -ipadx 5 -anchor w \ 191 0,1 $itk_component(title) -anchor w 192 blt::table configure $itk_component(titlebar) c0 -width 30 193 194 itk_component add sidebar { 195 blt::tabset $itk_component(drawer).sidebar \ 196 -highlightthickness 0 -tearoff 0 -side left \ 197 -bd 0 -gap 0 -tabborderwidth 1 \ 198 -outerpad 0 148 199 } { 149 200 usual 150 201 ignore -highlightthickness -borderwidth 151 } 152 pack $itk_component(3dview) -expand yes -fill both 202 rename -highlightbackground -controlbackground controlBackground \ 203 Background 204 rename -background -controlbackground controlBackground \ 205 Background 206 } 207 itk_component add scroller { 208 Rappture::Scroller $itk_component(drawer).scroller \ 209 -xscrollmode auto -yscrollmode auto \ 210 -highlightthickness 0 211 } 212 blt::table $itk_component(drawer) \ 213 0,0 $itk_component(titlebar) -fill x -anchor w -columnspan 2 \ 214 1,0 $itk_component(controls) -fill y -anchor n -pady 3 \ 215 1,1 $itk_component(scroller) -rowspan 2 -fill both \ 216 2,0 $itk_component(sidebar) -fill y -anchor s 217 218 $itk_component(panes) add $itk_component(drawer) -sticky nsew 219 blt::table configure $itk_component(drawer) r0 c1 r1 c0 -resize none 220 blt::table configure $itk_component(drawer) c2 -resize expand 221 blt::table configure $itk_component(drawer) r2 -resize expand 153 222 154 223 eval itk_initialize $args 224 225 # Two things wrong with the tk:panedwindow. 226 # 1. can't disable the sash. Maybe I can hide it. 227 # 2. can't set/force the width of a pane. 228 229 $itk_component(panes) paneconfigure $itk_component(drawer) \ 230 -minsize 30 155 231 } 156 232 … … 193 269 # 194 270 itcl::body Rappture::VisViewer::_ServerDown {} { 195 if { [info exists itk_component( area)] } {196 set x [expr {[winfo rootx $itk_component( area)]+10}]197 set y [expr {[winfo rooty $itk_component( area)]+10}]271 if { [info exists itk_component(plotarea)] } { 272 set x [expr {[winfo rootx $itk_component(plotarea)]+10}] 273 set y [expr {[winfo rooty $itk_component(plotarea)]+10}] 198 274 } else { 199 275 set x 0; set y 0 … … 319 395 # rebuild. 320 396 $_dispatcher cancel !serverDown 321 set x [expr {[winfo rootx $itk_component( area)]+10}]322 set y [expr {[winfo rooty $itk_component( area)]+10}]397 set x [expr {[winfo rootx $itk_component(plotarea)]+10}] 398 set y [expr {[winfo rooty $itk_component(plotarea)]+10}] 323 399 Rappture::Tooltip::cue @$x,$y "Connecting..." 324 400 set code [catch { Connect } ok] … … 547 623 } 548 624 625 itcl::body Rappture::VisViewer::drawer { what } { 626 switch -- ${what} { 627 "open" { 628 after idle [list focus $itk_component(drawer)] 629 set win [$itk_component(scroller) contents] 630 set w1 [winfo reqwidth $win] 631 set w2 [winfo reqwidth $itk_component(title)] 632 set w [expr max($w1,$w2) + 30] 633 set x [expr [winfo width $itk_component(panes)] - $w] 634 $itk_component(panes) sash place 0 $x 0 635 $itk_component(panes) paneconfigure $itk_component(drawer) \ 636 -width $w 637 #sash place 0 $x 0 638 $itk_component(flipswitch) configure \ 639 -image [Rappture::icon sbar-closed] 640 set isOpen_ 1 641 } 642 "close" { 643 $itk_component(flipswitch) configure \ 644 -image [Rappture::icon sbar-open] 645 set w [winfo width $itk_component(panes)] 646 if { $w <= 1 } { 647 set w [winfo reqwidth $itk_component(panes)] 648 } 649 set x [lindex [$itk_component(panes) sash coord 0] 0] 650 set initialized_(drawer) $x 651 $itk_component(panes) paneconfigure $itk_component(drawer) \ 652 -minsize 30 653 set x [expr $w - 30] 654 $itk_component(panes) sash place 0 $x 0 655 set isOpen_ 0 656 } 657 "toggle" { 658 if { $isOpen_ } { 659 drawer close 660 } else { 661 drawer open 662 } 663 } 664 } 665 }
Note: See TracChangeset
for help on using the changeset viewer.