Changeset 1373


Ignore:
Timestamp:
Apr 1, 2009, 4:55:25 PM (16 years ago)
Author:
gah
Message:

First pass at changes to visualization widgets.

nanovisview.tcl use png icons.
visviewer.tcl change to sidebar layout
molvisviewer.tcl use png icons, fixed for sidebar layout.
heightmapviewer.tcl use png icons, fixed for sidebar layout.
flowvisviewer.tcl use png icons, fixed for sidebar layout.

resultviewer.tcl recognize flow data
field.tcl recognize unirect3d mesh.
field3dresult.tcl load FlowvisViewer? component description.
panes.tcl added horizontal panes. Need cursor fix. Must specify

correct cursor from options.

unirect2d.tcl added "axisorder" tag to specify order of field data.

Changed name to Unirect2d from UniRect2d.

unirect3d.tcl added "axisorder" tag to specify order of field data.

Right now, this is a test platform for me for flow
visualizations.

Location:
trunk/gui/scripts
Files:
1 added
11 edited

Legend:

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

    r1342 r1373  
    2929    public method hints {{key ""}}
    3030    public method isunirect2d {}
     31    public method isunirect3d {}
     32    public method extents {{what -overall}}
    3133
    3234    protected method _build {}
     
    4749    private variable _comp2style ;# maps component name => style settings
    4850    private variable _comp2cntls ;# maps component name => x,y control points
    49 
     51    private variable _comp2extents
    5052    private common _counter 0    ;# counter for unique vector names
    5153}
     
    114116        itcl::delete object $_comp2unirect2d($name)
    115117    }
     118    foreach name [array names _comp2unirect3d] {
     119        itcl::delete object $_comp2unirect3d($name)
     120    }
    116121}
    117122
     
    178183    }
    179184    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]
    181189    }
    182190    error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]"
     
    204212    }
    205213    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]
    208218    }
    209219    error "bad option \"$what\": should be [join [lsort [array names _comp2dims]] {, }]"
     
    518528    catch {unset _comp2style}
    519529    array unset _comp2unirect2d
    520 
     530    array unset _comp2unirect3d
     531    array unset _comp2extents
    521532    #
    522533    # Scan through the components of the field and create
     
    540551        }
    541552        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
    542560
    543561        if {$type == "1D"} {
     
    602620                    set _comp2dims($cname) "2D"
    603621                    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]
    605629                    set _comp2style($cname) [$_field get $cname.style]
    606630                    incr _counter
     
    694718            set _comp2style($cname) [$_field get $cname.style]
    695719            incr _counter
    696 
    697720        } elseif {$type == "opendx"} {
    698721            #
     
    757780}
    758781
    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#
    766787itcl::body Rappture::Field::isunirect2d { } {
    767788    return [expr [array size _comp2unirect2d] > 0]
    768789}
     790
     791#
     792# isunirect3d  --
     793#
     794# Returns if the field is a unirect3d object. 
     795#
     796itcl::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#
     805itcl::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  
    5757    set servers [Rappture::VisViewer::GetServerList "nanovis"]
    5858    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        }               
    6271        pack $itk_component(renderer) -expand yes -fill both
    6372
  • trunk/gui/scripts/flowvisviewer.tcl

    r1357 r1373  
    7272    public method OverIsoMarker { m x }
    7373
    74     public method drawer {what who}
    7574    public method camera {option args}
     75    public method tab {what who}
    7676
    7777    protected method Connect {}
     
    110110    private method ParseMarkersOption { tf ivol markers }
    111111    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 {}
    115116    private method PanCamera {}
    116117    private method GetMovie { widget width height }
     
    143144    common downloadPopup_          ;# download options from popup
    144145
    145     private variable drawer_
    146146    private common hardcopy_
     147    private variable headings_
    147148}
    148149
     
    220221        rename -highlightbackground -controlbackground controlBackground Background
    221222    }
    222     pack $itk_component(reset) -side top -padx 2 -pady 1
     223    pack $itk_component(reset) -side top -padx 2 -pady 2
    223224    Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
    224225
     
    233234        rename -highlightbackground -controlbackground controlBackground Background
    234235    }
    235     pack $itk_component(zoomin) -side top -padx 1 -pady 1
     236    pack $itk_component(zoomin) -side top -padx 2 -pady 2
    236237    Rappture::Tooltip::for $itk_component(zoomin) "Zoom in"
    237238
     
    246247        rename -highlightbackground -controlbackground controlBackground Background
    247248    }
    248     pack $itk_component(zoomout) -side top -padx 2 -pady 1
     249    pack $itk_component(zoomout) -side top -padx 2 -pady 2
    249250    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    250251
    251     itk_component add settingsButton {
    252         label $itk_component(controls).settingsbutton \
     252    itk_component add configure_button {
     253        label $itk_component(controls).configbutton \
    253254            -borderwidth 1 -padx 1 -pady 1 \
    254255            -relief "raised" -image [Rappture::icon wrench]
     
    259260            Background
    260261    }
    261     pack $itk_component(settingsButton) -padx 2 -pady 1 \
    262         -ipadx 1 -ipady 1
    263     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 e
    269 
    270     BuildSettingsDrawer
    271 
    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         usual
    278         ignore -borderwidth
    279         rename -highlightbackground -controlbackground controlBackground \
    280             Background
    281     }
    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 1
    288 
    289     BuildCutplanesDrawer
    290 
    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         usual
    297         ignore -borderwidth
    298         rename -highlightbackground -controlbackground controlBackground \
    299             Background
    300     }
    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 1
    307 
    308     BuildCameraDrawer
    309262
    310263    #
     
    325278    Rappture::Tooltip::for $itk_component(volume) \
    326279        "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
    328286
    329287    # Legend
     
    331289    set _image(legend) [image create photo]
    332290    itk_component add legend {
    333         canvas $itk_component(area).legend -height 50 -highlightthickness 0
     291        canvas $itk_component(plotarea).legend -height 50 -highlightthickness 0
    334292    } {
    335293        usual
     
    337295        rename -background -plotbackground plotBackground Background
    338296    }
    339     pack $itk_component(legend) -side bottom -fill x
    340297    bind $itk_component(legend) <Configure> \
    341298        [list $_dispatcher event -idle !legend]
    342299
    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       
    344308    # Create flow controls...
    345309
     
    475439    set _image(download) [image create photo]
    476440
     441    $itk_component(scroller) contents $itk_component(view_canvas)
     442    $itk_component(title) configure -text "$headings_(view)"
     443
    477444    eval itk_initialize $args
    478445
     
    662629    switch $option {
    663630        coming {
    664             if {[catch {blt::winop snap $itk_component(area) $_image(download)}]} {
     631            if {[catch {blt::winop snap $itk_component(plotarea) \
     632                            $_image(download)}]} {
    665633                $_image(download) configure -width 1 -height 1
    666634                $_image(download) put #000000
     
    791759#       sent later.
    792760#
    793 itcl::body Rappture::FlowvisViewer::SendCmd {string} {
     761itcl::body Rappture::FlowvisViewer::SendCmd { string } {
    794762    if {[llength $sendobjs_] > 0} {
    795763        append outbuf_ $string "\n"
     
    816784            set data [$dataobj values $comp]
    817785            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            }
    821797            if { ![SendBytes $data] } {
    822798                return
     
    13701346            if {$op} {
    13711347                $itk_component(${axis}CutButton) configure \
    1372                     -image [Rappture::icon ${axis}-cutplane-on] \
    13731348                    -relief sunken
    13741349                SendCmd "cutplane state 1 $axis [CurrentVolumeIds -cutplanes]"
     
    13761351            } else {
    13771352                $itk_component(${axis}CutButton) configure \
    1378                     -image [Rappture::icon ${axis}-cutplane-off] \
    13791353                    -relief raised
    13801354                SendCmd "cutplane state 0 $axis [CurrentVolumeIds -cutplanes]"
     
    16261600        "legend" {
    16271601            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
    16291604            } else {
    1630                 pack forget $itk_component(legend)
     1605                blt::table forget $itk_component(legend)
    16311606            }
    16321607            FixLegend
     
    20592034}
    20602035
    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
     2037itcl::body Rappture::FlowvisViewer::BuildViewTab {} {
    21222038    foreach { key value } {
    21232039        grid            0
     
    21282044        particles       1
    21292045        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
     2135itcl::body Rappture::FlowvisViewer::BuildVolumeTab {} {
     2136    foreach { key value } {
    21302137        light           40
    21312138        transp          50
     
    21352142        set settings_($this-$key) $value
    21362143    }
    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
    21452146    } {
    21462147        ignore -highlightthickness
    21472148    }
    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 \
    21522156            -highlightthickness 0
    21532157    } {
    21542158        ignore -highlightthickness
    21552159    }
    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)
    21652166
    21662167    set fg [option get $itk_component(hull) font Font]
     
    21952196    label $inner.thick -text "Thick" -font $fg
    21962197
    2197     set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0
    2198     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 
    22462198    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
     2213itcl::body Rappture::FlowvisViewer::BuildCutplanesTab {} {
     2214
     2215    itk_component add cutplanes_canvas {
     2216        canvas $itk_component(scroller).cutplanescanvas -highlightthickness 0
    22842217    } {
    22852218        ignore -highlightthickness
    22862219    }
    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 \
    22912227            -highlightthickness 0
    22922228    }  {
    22932229        ignore -highlightthickness
    22942230    }
    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)
    23032237
    23042238    # X-value slicer...
    23052239    itk_component add xCutButton {
    2306         label $itk_component(cutplanes).xbutton \
     2240        label $itk_component(cutplanes_frame).xbutton \
    23072241            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2308             -image [Rappture::icon x-cutplane-off] \
     2242            -image [Rappture::icon x-cutplane] \
    23092243            -highlightthickness 0
    23102244    } {
     
    23202254
    23212255    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 \
    23232257            -width 10 -orient vertical -showvalue off \
    2324             -borderwidth 1 -highlightthickness 0 \
     2258            -borderwidth 1 -highlightthickness 0 -state disabled \
    23252259            -command [itcl::code $this Slice move x]
    23262260    } {
     
    23342268    }
    23352269    $itk_component(xCutScale) set 50
    2336     #$itk_component(xCutScale) configure -state disabled
    23372270    Rappture::Tooltip::for $itk_component(xCutScale) \
    23382271        "@[itcl::code $this SlicerTip x]"
     
    23402273    # Y-value slicer...
    23412274    itk_component add yCutButton {
    2342         label $itk_component(cutplanes).ybutton \
     2275        label $itk_component(cutplanes_frame).ybutton \
    23432276            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2344             -image [Rappture::icon y-cutplane-off] \
     2277            -image [Rappture::icon y-cutplane] \
    23452278            -highlightthickness 0
    23462279    } {
     
    23562289
    23572290    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 \
    23592292            -width 10 -orient vertical -showvalue off \
    2360             -borderwidth 1 -highlightthickness 0 \
     2293            -borderwidth 1 -highlightthickness 0 -state disabled \
    23612294            -command [itcl::code $this Slice move y]
    23622295    } {
     
    23672300        rename -troughcolor -controldarkbackground controlDarkBackground Background
    23682301    }
    2369     $itk_component(yCutScale) set 50
    2370     #$itk_component(yCutScale) configure -state disabled
    23712302    Rappture::Tooltip::for $itk_component(yCutScale) \
    23722303        "@[itcl::code $this SlicerTip y]"
     2304    $itk_component(yCutScale) set 50
    23732305
    23742306    # Z-value slicer...
    23752307    itk_component add zCutButton {
    2376         label $itk_component(cutplanes).zbutton \
     2308        label $itk_component(cutplanes_frame).zbutton \
    23772309            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    2378             -image [Rappture::icon z-cutplane-off] \
     2310            -image [Rappture::icon z-cutplane] \
    23792311            -highlightthickness 0
    23802312    } {
     
    23892321
    23902322    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 \
    23922324            -width 10 -orient vertical -showvalue off \
    2393             -borderwidth 1 -highlightthickness 0 \
     2325            -borderwidth 1 -highlightthickness 0 -state disabled \
    23942326            -command [itcl::code $this Slice move z]
    23952327    } {
     
    24062338
    24072339    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
     2348itcl::body Rappture::FlowvisViewer::BuildCameraTab {} {
     2349
     2350    itk_component add camera_canvas {
     2351        canvas $itk_component(scroller).cameracanvas -highlightthickness 0
    24292352    } {
    24302353        ignore -highlightthickness
    24312354    }
    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 \
    24362362            -highlightthickness 0
    24372363    }
    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)
    24462370
    24472371    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
    24512373    foreach tag $labels {
    24522374        label $inner.${tag}label -text $tag -font "Arial 9"
     
    24562378            [itcl::code $this camera set ${tag}]
    24572379        blt::table $inner \
    2458             $row,1 $inner.${tag}label -anchor e \
    2459             $row,2 $inner.${tag} -anchor w
     2380            $row,0 $inner.${tag}label -anchor e \
     2381            $row,1 $inner.${tag} -anchor w
    24602382        incr row
    24612383    }
    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
    24672386
    24682387}
     
    25762495    return ""
    25772496}
     2497
     2498itcl::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  
    6262        # do nothing
    6363    }
    64     public method drawer {what who}
     64    public method tab {what who}
    6565    public method camera {option args}
    6666    protected method Connect {}
     
    7171    protected method ReceiveImage { args }
    7272    private method _ReceiveLegend {tf vmin vmax size}
    73     private method _BuildSettingsDrawer {}
    74     private method _BuildCameraDrawer {}
     73    private method _BuildViewTab {}
     74    private method _BuildCameraTab {}
    7575    private method _PanCamera {}
    7676    protected method _receive_echo {channel {data ""}}
     
    9999    private variable view_         ;# view params for 3D view
    100100    private common settings_      ;# Array used for checkbuttons and radiobuttons
    101     private variable initialized_
    102101    private common hardcopy_
     102    private variable headings_
    103103}
    104104
     
    161161        rename -highlightbackground -controlbackground controlBackground Background
    162162    }
    163     pack $itk_component(reset) -side top -padx 2 -pady { 2 0 }
     163    pack $itk_component(reset) -side top -padx 1 -pady { 4 0 }
    164164    Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
    165165
     
    174174        rename -highlightbackground -controlbackground controlBackground Background
    175175    }
    176     pack $itk_component(zoomin) -side top -padx 2 -pady { 2 0 }
     176    pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 }
    177177    Rappture::Tooltip::for $itk_component(zoomin) "Zoom in"
    178178
     
    187187        rename -highlightbackground -controlbackground controlBackground Background
    188188    }
    189     pack $itk_component(zoomout) -side top -padx 2 -pady { 2 0 }
     189    pack $itk_component(zoomout) -side top -padx 1 -pady { 4 }
    190190    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    191191
    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
    230194
    231195    # Legend
    232196    set _image(legend) [image create photo]
    233197    itk_component add legend {
    234         canvas $itk_component(area).legend -width 30 -highlightthickness 0
     198        canvas $itk_component(plotarea).legend -width 30 -highlightthickness 0
    235199    } {
    236200        usual
     
    238202        rename -background -plotbackground plotBackground Background
    239203    }
    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
    242209    bind $itk_component(legend) <Configure> \
    243210        [list $_dispatcher event -idle !legend]
     
    293260    }
    294261
     262    $itk_component(scroller) contents $itk_component(view_canvas)
     263    $itk_component(title) configure -text "$headings_(view)"
    295264    set _image(download) [image create photo]
    296 
    297265    eval itk_initialize $args
    298 
    299266    Connect
    300267}
     
    483450        coming {
    484451            if {[catch {
    485                 blt::winop snap $itk_component(area) $_image(download)
     452                blt::winop snap $itk_component(plotarea) $_image(download)
    486453            }]} {
    487454                $_image(download) configure -width 1 -height 1
     
    985952        "legend" {
    986953            if { $settings_($this-legend) } {
    987                 pack $itk_component(legend) -side right -fill y
     954                pack $itk_component(legend) -side left -fill y
    988955            } else {
    989                 pack forget $itk_component(legend) 
     956                pack forget $itk_component(legend)
    990957            }
    991958            set lineht [expr [font metrics $itk_option(-font) -linespace] + 4]
     
    11611128}
    11621129
    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 \
     1130itcl::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 \
    11781146            -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]
    11841154
    11851155    set fg [option get $itk_component(hull) font Font]
    11861156
    1187     set inner $itk_component(settings_frame)
     1157    set inner $itk_component(view_frame)
    11881158
    11891159    foreach { key value } {
     
    11961166        set settings_($this-$key) $value
    11971167    }
    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)
    12001169    checkbutton $inner.grid \
    12011170        -text "grid" \
     
    12261195
    12271196    blt::table $inner \
    1228         0,0 $inner.title -anchor w -columnspan 2 \
    12291197        1,1 $inner.grid -anchor w  \
    12301198        2,1 $inner.axes -anchor w \
     
    12331201        5,1 $inner.legend -anchor w
    12341202
    1235     blt::table configure $inner c0 -resize expand -width 2
    12361203    blt::table configure $inner c2 -resize expand
    12371204    blt::table configure $inner c1 -resize none
     
    12391206}
    12401207
    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     }
     1208itcl::body Rappture::HeightmapViewer::_BuildCameraTab {} {
    12481209
    12491210    itk_component add camera_canvas {
    1250         canvas $itk_component(camera).canvas -highlightthickness 0
     1211        canvas $itk_component(scroller).cameracanvas -highlightthickness 0
    12511212    } {
    12521213        ignore -highlightthickness
    12531214    }
    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"
    12551220
    12561221    itk_component add camera_frame {
    12571222        frame $itk_component(camera_canvas).frame \
    1258             -highlightthickness 0
    1259     }
     1223            -highlightthickness 0
     1224    } {
     1225        usual
     1226        ignore -background
     1227    }
    12601228    $itk_component(camera_canvas) create window 0 0 \
    12611229        -anchor nw -window $itk_component(camera_frame)
    12621230    bind $itk_component(camera_frame) <Configure> \
    1263         [itcl::code $this drawer resize camera]
     1231        [itcl::code $this tab resize camera]
    12641232
    12651233    set inner $itk_component(camera_frame)
    12661234
    1267     label $inner.title -text "Camera Settings" -font "Arial 10 bold"
    1268 
    12691235    set labels { phi theta psi pan-x pan-y zoom }
    1270     blt::table $inner \
    1271         0,0 $inner.title -anchor w  -columnspan 4
    12721236    set row 1
    12731237    foreach tag $labels {
     
    12821246        incr row
    12831247    }
    1284     bind $inner.title <Shift-ButtonPress> \
    1285         [itcl::code $this camera show]
    1286     blt::table configure $inner c0 -resize expand -width 4
    12871248    blt::table configure $inner c1 c2 -resize none
    12881249    blt::table configure $inner c3 -resize expand
     
    12901251}
    12911252
    1292 itcl::body Rappture::HeightmapViewer::drawer { what who } {
     1253itcl::body Rappture::HeightmapViewer::tab { what who } {
    12931254    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
    13161263        }
    13171264        "resize" {
  • trunk/gui/scripts/molvisviewer.tcl

    r1349 r1373  
     1
    12# ----------------------------------------------------------------------
    23#  COMPONENT: molvisviewer - view a molecule in 3D
     
    7071    public method bondthickness {option {model "all"} }
    7172    public method ResetView {}
    72     public method settings {option args}
     73    public method tab {what who}
    7374
    7475    protected method _send {args}
     
    8485    protected method _vmouse  {option b m x y}
    8586    private method _ReceiveImage { size cacheid frame rock }
    86     private method _BuildSettingsDrawer {}
     87    private method _BuildViewTab {}
    8788    private method GetPngImage { widget width height }
    8889    private method WaitIcon { option widget }
     
    115116
    116117    private common _settings  ;# array of settings for all known widgets
    117     private variable initialized_ "no";
     118    private variable initialized_
    118119
    119120    common _downloadPopup           ;# download options from popup
     
    121122    private common hardcopy_
    122123    private variable nextToken_ 0
     124    private variable headings_
    123125}
    124126
     
    299301    $this projection perspective
    300302
    301     itk_component add settings_button {
    302         label $itk_component(controls).settingsbutton \
     303    itk_component add configure_button {
     304        label $itk_component(controls).configbutton \
    303305            -borderwidth 1 -padx 1 -pady 1 \
    304306            -relief "raised" -image [Rappture::icon wrench]
     
    309311            Background
    310312    }
    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
    320322
    321323    #
     
    399401        [itcl::code $this _map]
    400402
     403    $itk_component(scroller) contents $itk_component(view_canvas)
     404    $itk_component(title) configure -text "$headings_(view)"
     405
    401406    eval itk_initialize $args
    402407    Connect
    403408}
    404409
    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
     410itcl::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
    420424    }
    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]
    425429
    426430    set fg [option get $itk_component(hull) font Font]
    427431
    428     set inner $itk_component(settings_frame)
     432    set inner $itk_component(view_frame)
    429433    label $inner.drawinglabel -text "Drawing Method" -font "Arial 9 bold"
    430434
     
    15521556
    15531557
    1554 itcl::body Rappture::MolvisViewer::settings { what args } {
    1555     switch -- ${what} {
    1556         "activate" {
    1557             $itk_component(drawer) add $itk_component(settings) -sticky nsew
    1558             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 0
    1563                 set initialized_ 1
    1564             }
    1565             $itk_component(settings_button) configure -relief sunken
    1566         }
    1567         "deactivate" {
    1568             $itk_component(drawer) forget $itk_component(settings)
    1569             $itk_component(settings_button) configure -relief raised
    1570         }
    1571         "toggle" {
    1572             set slaves [$itk_component(drawer) panes]
    1573             if { [lsearch $slaves $itk_component(settings)] >= 0 } {
    1574                 settings deactivate
    1575             } else {
    1576                 settings activate
    1577             }
    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.1i
    1584         }
    1585     }
    1586 }
    15871558
    15881559itcl::body Rappture::MolvisViewer::WaitIcon  { option widget } {
     
    16611632    return ""
    16621633}
     1634
     1635itcl::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
    12# ----------------------------------------------------------------------
    23#  COMPONENT: nanovisviewer - 3D volume rendering
     
    239240        label $itk_component(slicers).xslice \
    240241            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    241             -image [Rappture::icon x-cutplane-off]
     242            -image [Rappture::icon x-cutplane]
    242243    } {
    243244        usual
     
    275276        label $itk_component(slicers).yslice \
    276277            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    277             -image [Rappture::icon y-cutplane-off]
     278            -image [Rappture::icon y-cutplane]
    278279    } {
    279280        usual
     
    311312        label $itk_component(slicers).zslice \
    312313            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    313             -image [Rappture::icon z-cutplane-off]
     314            -image [Rappture::icon z-cutplane]
    314315    } {
    315316        usual
     
    13201321            if {$op} {
    13211322                $itk_component(${axis}slice) configure \
    1322                     -image [Rappture::icon ${axis}-cutplane-on] \
    13231323                    -relief sunken
    13241324                $itk_component(${axis}slicer) configure -state normal
     
    13261326            } else {
    13271327                $itk_component(${axis}slice) configure \
    1328                     -image [Rappture::icon ${axis}-cutplane-off] \
    13291328                    -relief raised
    13301329                $itk_component(${axis}slicer) configure -state disabled
  • trunk/gui/scripts/page.tcl

    r1342 r1373  
    238238            } else {
    239239                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)"
    241242                }
    242243            }
  • trunk/gui/scripts/panes.tcl

    r1342 r1373  
    4949    private variable _counter 0      ;# counter for auto-generated names
    5050    private variable _frac 0.0       ;# list of fractions
     51    public variable orientation "vertical"
    5152}
    5253
     
    118119        ignore -borderwidth
    119120    }
    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    }
    122126    foreach comp [list $sash ${sash}ridge] {
    123127        bind $itk_component($comp) <ButtonPress-1> \
     
    265269# ----------------------------------------------------------------------
    266270itcl::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    }
    270280    if {$frac < 0.05} {
    271281        set frac 0.05
     
    303313# ----------------------------------------------------------------------
    304314itcl::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
    315351            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
    320399            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    }   
    352412}
    353413
     
    359419# ----------------------------------------------------------------------
    360420itcl::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            }
    374453        }
    375454    }
  • trunk/gui/scripts/resultviewer.tcl

    r1342 r1373  
    254254                        set mesh [$dataobj mesh]
    255255                        set fmt [expr {("" != $mesh) ? "vtk" : "nanovis"}]
     256                        set extents [$dataobj extents]
     257                        if { $extents == 3 } {
     258                            set fmt "flowvis"
     259                        }
    256260                        set w $itk_interior.field3D
    257261                        Rappture::Field3DResult $w -mode $fmt
  • trunk/gui/scripts/unirect2d.tcl

    r1342 r1373  
     1
    12# ----------------------------------------------------------------------
    23#  COMPONENT: unirect2d - represents a uniform rectangular 2-D mesh.
     
    1718namespace eval Rappture { # forward declaration }
    1819
    19 itcl::class Rappture::UniRect2d {
     20itcl::class Rappture::Unirect2d {
    2021    constructor {xmlobj field cname} { # defined below }
    2122    destructor { # defined below }
     
    3334    private variable _ymin 0
    3435    private variable _ynum 0
    35     private variable _zv "";            # BLT vector containing the z-values
     36    private variable _values "";        # BLT vector containing the z-values
    3637    private variable _hints
    3738}
     
    4041# Constructor
    4142# ----------------------------------------------------------------------
    42 itcl::body Rappture::UniRect2d::constructor {xmlobj field cname} {
     43itcl::body Rappture::Unirect2d::constructor {xmlobj field cname} {
    4344    if {![Rappture::library isvalid $xmlobj]} {
    4445        error "bad value \"$xmlobj\": should be Rappture::library"
     
    5354    set _ymax [$mobj get "yaxis.max"]
    5455    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    }
    5587    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
    5995}
    6096
     
    6298# Destructor
    6399# ----------------------------------------------------------------------
    64 itcl::body Rappture::UniRect2d::destructor {} {
    65     if { $_zv != "" } {
    66         blt::vector destroy $_zv
     100itcl::body Rappture::Unirect2d::destructor {} {
     101    if { $_values != "" } {
     102        blt::vector destroy $_values
    67103    }
    68104}
     
    74110#       on the nanovis server.
    75111# ----------------------------------------------------------------------
    76 itcl::body Rappture::UniRect2d::blob {} {
     112itcl::body Rappture::Unirect2d::blob {} {
    77113    set data "unirect2d"
    78114    lappend data "xmin" $_xmin "xmax" $_xmax "xnum" $_xnum
    79115    lappend data "ymin" $_ymin "ymax" $_ymax "ynum" $_ynum
    80116    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]
    83125    }
    84126    return [Rappture::encoding::encode -as zb64 $data]
     
    91133#       on the nanovis server.
    92134# ----------------------------------------------------------------------
    93 itcl::body Rappture::UniRect2d::mesh {} {
     135itcl::body Rappture::Unirect2d::mesh {} {
    94136    set dx [expr {($_xmax - $_xmin) / double($_xnum)}]
    95137    set dy [expr {($_ymax - $_ymin) / double($_ynum)}]
     
    110152#       on the nanovis server.
    111153# ----------------------------------------------------------------------
    112 itcl::body Rappture::UniRect2d::values {} {
    113     if { [$_zv length] > 0 } {
    114         return [$_zv range 0 end]
     154itcl::body Rappture::Unirect2d::values {} {
     155    if { [$_values length] > 0 } {
     156        return [$_values range 0 end]
    115157    }
    116158    return ""
     
    122164#       specified axis.
    123165# ----------------------------------------------------------------------
    124 itcl::body Rappture::UniRect2d::limits {which} {
     166itcl::body Rappture::Unirect2d::limits {which} {
    125167    set min ""
    126168    set max ""
     
    137179            set axis "yaxis"
    138180        }
    139         v - xlin - vlog - z - zlin - zlog {
    140             if { [$_zv length] > 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)]
    143185            } else {
    144186                set min 0.0
     
    177219# the hint for that <keyword>, if it exists.
    178220# ----------------------------------------------------------------------
    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 
     221itcl::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    }
    221235    if {$keyword != ""} {
    222236        if {[info exists _hints($keyword)]} {
  • trunk/gui/scripts/visviewer.tcl

    r1342 r1373  
    2121
    2222    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"
    2525
    2626    private variable sid_ ""        ;# socket connection to server
    2727    private common done_            ;# Used to indicate status of send.
    2828    private variable buffer_        ;# buffer for incoming/outgoing commands
    29 
     29    private variable initialized_
     30    private variable isOpen_ 0
    3031    # Number of milliseconds to wait before idle timeout.
    3132    # If greater than 0, automatically disconnect from the visualization
     
    6465    protected method Color2RGB { color }
    6566    protected method Euler2XYZ { theta phi psi }
     67    protected method drawer {what}
    6668
    6769    private proc _CheckNameList { namelist }  {
     
    8890itk::usual Panedwindow {
    8991    keep -background -cursor
     92}
     93itk::usual Tabset {
     94    keep -background
    9095}
    9196
     
    119124    pack propagate $itk_component(hull) no
    120125
    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
    123147    } {
    124148        usual
    125149        rename -background -controlbackground controlBackground Background
    126150    }
    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
    148199    } {
    149200        usual
    150201        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
    153222
    154223    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
    155231}
    156232
     
    193269#
    194270itcl::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}]
    198274    } else {
    199275        set x 0; set y 0
     
    319395    # rebuild.
    320396    $_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}]
    323399    Rappture::Tooltip::cue @$x,$y "Connecting..."
    324400    set code [catch { Connect } ok]
     
    547623}
    548624
     625itcl::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.