Ignore:
Timestamp:
Apr 2, 2009 6:05:34 PM (15 years ago)
Author:
mmc
Message:

Created the SidebarFrame? widget to manage all sidebar options, and plugged
it into the various vis viewers and the xyresult.

File:
1 edited

Legend:

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

    r1373 r1375  
    2424option add *FlowvisViewer.height 4i widgetDefault
    2525option add *FlowvisViewer.foreground black widgetDefault
    26 option add *FlowvisViewer.controlBackground gray widgetDefault
    27 option add *FlowvisViewer.controlDarkBackground #999999 widgetDefault
    2826option add *FlowvisViewer.plotBackground black widgetDefault
    2927option add *FlowvisViewer.plotForeground white widgetDefault
     
    7371
    7472    public method camera {option args}
    75     public method tab {what who}
    7673
    7774    protected method Connect {}
     
    145142
    146143    private common hardcopy_
    147     private variable headings_
    148144}
    149145
     
    211207    set settings_($this-speed) 10
    212208
     209    set f [$itk_component(main) component controls]
    213210    itk_component add reset {
    214         button $itk_component(controls).reset \
    215             -borderwidth 1 -padx 1 -pady 1 \
     211        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
    216212            -image [Rappture::icon reset-view] \
    217213            -command [itcl::code $this Zoom reset]
    218     } {
    219         usual
    220         ignore -borderwidth
    221         rename -highlightbackground -controlbackground controlBackground Background
    222214    }
    223215    pack $itk_component(reset) -side top -padx 2 -pady 2
     
    225217
    226218    itk_component add zoomin {
    227         button $itk_component(controls).zin \
    228             -borderwidth 1 -padx 1 -pady 1 \
     219        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
    229220            -image [Rappture::icon zoom-in] \
    230221            -command [itcl::code $this Zoom in]
    231     } {
    232         usual
    233         ignore -borderwidth
    234         rename -highlightbackground -controlbackground controlBackground Background
    235222    }
    236223    pack $itk_component(zoomin) -side top -padx 2 -pady 2
     
    238225
    239226    itk_component add zoomout {
    240         button $itk_component(controls).zout \
    241             -borderwidth 1 -padx 1 -pady 1 \
     227        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
    242228            -image [Rappture::icon zoom-out] \
    243229            -command [itcl::code $this Zoom out]
    244     } {
    245         usual
    246         ignore -borderwidth
    247         rename -highlightbackground -controlbackground controlBackground Background
    248230    }
    249231    pack $itk_component(zoomout) -side top -padx 2 -pady 2
    250232    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    251 
    252     itk_component add configure_button {
    253         label $itk_component(controls).configbutton \
    254             -borderwidth 1 -padx 1 -pady 1 \
    255             -relief "raised" -image [Rappture::icon wrench]
    256     } {
    257         usual
    258         ignore -borderwidth
    259         rename -highlightbackground -controlbackground controlBackground \
    260             Background
    261     }
    262233
    263234    #
     
    265236    #
    266237    itk_component add volume {
    267         label $itk_component(controls).volume \
    268             -borderwidth 1 -relief sunken -padx 1 -pady 1 \
     238        label $f.volume -borderwidth 1 -relief sunken -padx 1 -pady 1 \
    269239            -text "Volume" \
    270240            -image [Rappture::icon playback-record]
    271     } {
    272         usual
    273         ignore -borderwidth
    274         rename -highlightbackground -controlbackground controlBackground Background
    275241    }
    276242    bind $itk_component(volume) <ButtonPress> \
     
    438404
    439405    set _image(download) [image create photo]
    440 
    441     $itk_component(scroller) contents $itk_component(view_canvas)
    442     $itk_component(title) configure -text "$headings_(view)"
    443406
    444407    eval itk_initialize $args
     
    20472010        set settings_($this-$key) $value
    20482011    }
    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)
    20712012
    20722013    set fg [option get $itk_component(hull) font Font]
    20732014    #set bfg [option get $itk_component(hull) boldFont Font]
     2015
     2016    set inner [$itk_component(main) insert end \
     2017        -title "View Settings" \
     2018        -icon [Rappture::icon wrench]]
     2019    $inner configure -borderwidth 4
    20742020
    20752021    set ::Rappture::FlowvisViewer::settings_($this-isosurface) 0
     
    21312077        6,0 $inner.lic  -columnspan 1 -anchor w \
    21322078
     2079    for {set n 0} {$n <= 6} {incr n} {
     2080        blt::table configure $inner r$n -resize none
     2081    }
     2082    blt::table configure $inner r$n -resize expand
    21332083}
    21342084
     
    21422092        set settings_($this-$key) $value
    21432093    }
    2144     itk_component add volume_canvas {
    2145         canvas $itk_component(scroller).volumecanvas -highlightthickness 0
    2146     } {
    2147         ignore -highlightthickness
    2148     }
    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 \
    2156             -highlightthickness 0
    2157     } {
    2158         ignore -highlightthickness
    2159     }
    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)
     2094
     2095    set inner [$itk_component(main) insert end \
     2096        -title "Volume Settings" \
     2097        -icon [Rappture::icon playback-record]]
     2098    $inner configure -borderwidth 4
    21662099
    21672100    set fg [option get $itk_component(hull) font Font]
     
    21972130
    21982131    blt::table $inner \
    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 \
     2132        0,0 $inner.dim  -anchor e -pady 2 \
     2133        0,1 $inner.light -columnspan 2 -pady 2 \
     2134        0,3 $inner.bright -anchor w -pady 2 \
     2135        1,0 $inner.fog -anchor e -pady 2 \
     2136        1,1 $inner.transp -columnspan 2 -pady 2 \
     2137        1,3 $inner.plastic -anchor w -pady 2 \
     2138        2,0 $inner.clear -anchor e -pady 2 \
     2139        2,1 $inner.opacity -columnspan 2 -pady 2 \
     2140        2,3 $inner.opaque -anchor w -pady 2 \
     2141        3,0 $inner.thin -anchor e -pady 2 \
     2142        3,1 $inner.thickness -columnspan 2 -pady 2 \
     2143        3,3 $inner.thick -anchor w -pady 2
     2144
     2145    for {set n 0} {$n <= 3} {incr n} {
     2146        blt::table configure $inner r$n -resize none
     2147    }
     2148    blt::table configure $inner r$n -resize expand
    22112149}
    22122150
    22132151itcl::body Rappture::FlowvisViewer::BuildCutplanesTab {} {
    2214 
    2215     itk_component add cutplanes_canvas {
    2216         canvas $itk_component(scroller).cutplanescanvas -highlightthickness 0
    2217     } {
    2218         ignore -highlightthickness
    2219     }
    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 \
    2227             -highlightthickness 0
    2228     }  {
    2229         ignore -highlightthickness
    2230     }
    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)
     2152    set inner [$itk_component(main) insert end \
     2153        -title "Cutplane Settings" \
     2154        -icon [Rappture::icon cutbutton]]
     2155    $inner configure -borderwidth 4
    22372156
    22382157    # X-value slicer...
    22392158    itk_component add xCutButton {
    2240         label $itk_component(cutplanes_frame).xbutton \
     2159        label $inner.xbutton \
    22412160            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    22422161            -image [Rappture::icon x-cutplane] \
     
    22452164        usual
    22462165        ignore -borderwidth -highlightthickness
    2247         rename -highlightbackground -controlbackground \
    2248             controlBackground Background
    22492166    }
    22502167    bind $itk_component(xCutButton) <ButtonPress> \
     
    22542171
    22552172    itk_component add xCutScale {
    2256         ::scale $itk_component(cutplanes_frame).xval -from 100 -to 0 \
     2173        ::scale $inner.xval -from 100 -to 0 \
    22572174            -width 10 -orient vertical -showvalue off \
    22582175            -borderwidth 1 -highlightthickness 0 -state disabled \
     
    22602177    } {
    22612178        usual
    2262         ignore -borderwidth
    2263         ignore -highlightthickness
    2264         rename -highlightbackground -controlbackground \
    2265             controlBackground Background
    2266         rename -troughcolor -controldarkbackground \
    2267             controlDarkBackground Background
     2179        ignore -borderwidth -highlightthickness
    22682180    }
    22692181    $itk_component(xCutScale) set 50
     
    22732185    # Y-value slicer...
    22742186    itk_component add yCutButton {
    2275         label $itk_component(cutplanes_frame).ybutton \
     2187        label $inner.ybutton \
    22762188            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    22772189            -image [Rappture::icon y-cutplane] \
     
    22802192        usual
    22812193        ignore -borderwidth -highlightthickness       
    2282         rename -highlightbackground -controlbackground \
    2283             controlBackground Background
    22842194    }
    22852195    bind $itk_component(yCutButton) <ButtonPress> \
     
    22892199
    22902200    itk_component add yCutScale {
    2291         ::scale $itk_component(cutplanes_frame).yval -from 100 -to 0 \
     2201        ::scale $inner.yval -from 100 -to 0 \
    22922202            -width 10 -orient vertical -showvalue off \
    22932203            -borderwidth 1 -highlightthickness 0 -state disabled \
     
    22952205    } {
    22962206        usual
    2297         ignore -borderwidth
    2298         ignore -highlightthickness
    2299         rename -highlightbackground -controlbackground controlBackground Background
    2300         rename -troughcolor -controldarkbackground controlDarkBackground Background
     2207        ignore -borderwidth -highlightthickness
    23012208    }
    23022209    Rappture::Tooltip::for $itk_component(yCutScale) \
     
    23062213    # Z-value slicer...
    23072214    itk_component add zCutButton {
    2308         label $itk_component(cutplanes_frame).zbutton \
     2215        label $inner.zbutton \
    23092216            -borderwidth 1 -relief raised -padx 1 -pady 1 \
    23102217            -image [Rappture::icon z-cutplane] \
     
    23132220        usual
    23142221        ignore -borderwidth -highlightthickness       
    2315         rename -highlightbackground -controlbackground controlBackground Background
    23162222    }
    23172223    bind $itk_component(zCutButton) <ButtonPress> \
     
    23212227
    23222228    itk_component add zCutScale {
    2323         ::scale $itk_component(cutplanes_frame).zval -from 100 -to 0 \
     2229        ::scale $inner.zval -from 100 -to 0 \
    23242230            -width 10 -orient vertical -showvalue off \
    23252231            -borderwidth 1 -highlightthickness 0 -state disabled \
     
    23272233    } {
    23282234        usual
    2329         ignore -borderwidth
    2330         ignore -highlightthickness
    2331         rename -highlightbackground -controlbackground controlBackground Background
    2332         rename -troughcolor -controldarkbackground controlDarkBackground Background
     2235        ignore -borderwidth -highlightthickness
    23332236    }
    23342237    $itk_component(zCutScale) set 50
     
    23442247        0,1 $itk_component(yCutScale) \
    23452248        0,2 $itk_component(zCutScale) \
     2249
     2250    for {set n 0} {$n <= 1} {incr n} {
     2251        blt::table configure $inner r$n -resize none
     2252    }
     2253    blt::table configure $inner r$n -resize expand
    23462254}
    23472255
    23482256itcl::body Rappture::FlowvisViewer::BuildCameraTab {} {
    2349 
    2350     itk_component add camera_canvas {
    2351         canvas $itk_component(scroller).cameracanvas -highlightthickness 0
    2352     } {
    2353         ignore -highlightthickness
    2354     }
    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 \
    2362             -highlightthickness 0
    2363     }
    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)
     2257    set inner [$itk_component(main) insert end \
     2258        -title "Camera Settings" \
     2259        -icon [Rappture::icon camera]]
     2260    $inner configure -borderwidth 4
    23702261
    23712262    set labels { phi theta psi pan-x pan-y zoom }
     
    23782269            [itcl::code $this camera set ${tag}]
    23792270        blt::table $inner \
    2380             $row,0 $inner.${tag}label -anchor e \
    2381             $row,1 $inner.${tag} -anchor w
     2271            $row,0 $inner.${tag}label -anchor e -pady 2 \
     2272            $row,1 $inner.${tag} -anchor w -pady 2
     2273        blt::table configure $inner r$row -resize none
    23822274        incr row
    23832275    }
    23842276    blt::table configure $inner c0 c1 -resize none
    23852277    blt::table configure $inner c2 -resize expand
    2386 
     2278    blt::table configure $inner r$row -resize expand
    23872279}
    23882280
     
    24952387    return ""
    24962388}
    2497 
    2498 itcl::body Rappture::FlowvisViewer::tab { what who } {
    2499     switch -- ${what} {
    2500         "select" {
    2501             $itk_component(scroller) contents $itk_component(${who}_canvas)
    2502             after idle [list focus $itk_component(${who}_canvas)]
    2503             $itk_component(title) configure -text "$headings_($who)"
    2504             drawer open
    2505         }
    2506         "deselect" {
    2507             drawer close
    2508         }
    2509         "resize" {
    2510             set bbox [$itk_component(${who}_canvas) bbox all]
    2511             set wid [winfo width $itk_component(${who}_frame)]
    2512             $itk_component(${who}_canvas) configure -width $wid \
    2513                 -scrollregion $bbox -yscrollincrement 0.1i
    2514         }
    2515     }
    2516 }
    2517 
Note: See TracChangeset for help on using the changeset viewer.