Changeset 1375 for trunk


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.

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

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/Makefile.in

    r1295 r1375  
    8787                $(srcdir)/sequenceresult.tcl \
    8888                $(srcdir)/service.tcl \
     89                $(srcdir)/sidebarframe.tcl \
    8990                $(srcdir)/spectrum.tcl \
    9091                $(srcdir)/spinint.tcl \
  • 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 
  • trunk/gui/scripts/heightmapviewer.tcl

    r1373 r1375  
    2121option add *HeightmapViewer.height 4i widgetDefault
    2222option add *HeightmapViewer.foreground black widgetDefault
    23 option add *HeightmapViewer.controlBackground gray widgetDefault
    24 option add *HeightmapViewer.controlDarkBackground #999999 widgetDefault
    2523option add *HeightmapViewer.plotBackground black widgetDefault
    2624option add *HeightmapViewer.plotForeground white widgetDefault
     
    6260        # do nothing
    6361    }
    64     public method tab {what who}
    6562    public method camera {option args}
    6663    protected method Connect {}
     
    10097    private common settings_      ;# Array used for checkbuttons and radiobuttons
    10198    private common hardcopy_
    102     private variable headings_
    10399}
    104100
     
    143139    set obj2id_(count) 0
    144140
     141    set f [$itk_component(main) component controls]
    145142    itk_component add zoom {
    146         frame $itk_component(controls).zoom
    147     } {
    148         usual
    149         rename -background -controlbackground controlBackground Background
     143        frame $f.zoom
    150144    }
    151145    pack $itk_component(zoom) -side top
    152146
    153147    itk_component add reset {
    154         button $itk_component(zoom).reset \
    155             -borderwidth 1 -padx 1 -pady 1 \
     148        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
    156149            -image [Rappture::icon reset-view] \
    157150            -command [itcl::code $this _zoom reset]
    158     } {
    159         usual
    160         ignore -borderwidth
    161         rename -highlightbackground -controlbackground controlBackground Background
    162151    }
    163152    pack $itk_component(reset) -side top -padx 1 -pady { 4 0 }
     
    165154
    166155    itk_component add zoomin {
    167         button $itk_component(zoom).zin \
    168             -borderwidth 1 -padx 1 -pady 1 \
     156        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
    169157            -image [Rappture::icon zoom-in] \
    170158            -command [itcl::code $this _zoom in]
    171     } {
    172         usual
    173         ignore -borderwidth
    174         rename -highlightbackground -controlbackground controlBackground Background
    175159    }
    176160    pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 }
     
    178162
    179163    itk_component add zoomout {
    180         button $itk_component(zoom).zout \
    181             -borderwidth 1 -padx 1 -pady 1 \
     164        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
    182165            -image [Rappture::icon zoom-out] \
    183166            -command [itcl::code $this _zoom out]
    184     } {
    185         usual
    186         ignore -borderwidth
    187         rename -highlightbackground -controlbackground controlBackground Background
    188167    }
    189168    pack $itk_component(zoomout) -side top -padx 1 -pady { 4 }
     
    260239    }
    261240
    262     $itk_component(scroller) contents $itk_component(view_canvas)
    263     $itk_component(title) configure -text "$headings_(view)"
    264241    set _image(download) [image create photo]
    265242    eval itk_initialize $args
     
    11291106
    11301107itcl::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 \
    1146             -highlightthickness 0
    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]
    1154 
    11551108    set fg [option get $itk_component(hull) font Font]
    11561109
    1157     set inner $itk_component(view_frame)
     1110    set inner [$itk_component(main) insert end \
     1111        -title "View Settings" \
     1112        -icon [Rappture::icon wrench]]
     1113    $inner configure -borderwidth 4
    11581114
    11591115    foreach { key value } {
     
    11661122        set settings_($this-$key) $value
    11671123    }
    1168     set inner $itk_component(view_frame)
     1124
    11691125    checkbutton $inner.grid \
    11701126        -text "grid" \
     
    12031159    blt::table configure $inner c2 -resize expand
    12041160    blt::table configure $inner c1 -resize none
    1205 
     1161    for {set n 0} {$n <= 5} {incr n} {
     1162        blt::table configure $inner r$n -resize none
     1163    }
     1164    blt::table configure $inner r$n -resize expand
    12061165}
    12071166
    12081167itcl::body Rappture::HeightmapViewer::_BuildCameraTab {} {
    1209 
    1210     itk_component add camera_canvas {
    1211         canvas $itk_component(scroller).cameracanvas -highlightthickness 0
    1212     } {
    1213         ignore -highlightthickness
    1214     }
    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"
    1220 
    1221     itk_component add camera_frame {
    1222         frame $itk_component(camera_canvas).frame \
    1223             -highlightthickness 0
    1224     } {
    1225         usual
    1226         ignore -background
    1227     }
    1228     $itk_component(camera_canvas) create window 0 0 \
    1229         -anchor nw -window $itk_component(camera_frame)
    1230     bind $itk_component(camera_frame) <Configure> \
    1231         [itcl::code $this tab resize camera]
    1232 
    1233     set inner $itk_component(camera_frame)
     1168    set fg [option get $itk_component(hull) font Font]
     1169
     1170    set inner [$itk_component(main) insert end \
     1171        -title "Camera Settings" \
     1172        -icon [Rappture::icon camera]]
     1173    $inner configure -borderwidth 4
    12341174
    12351175    set labels { phi theta psi pan-x pan-y zoom }
     
    12371177    foreach tag $labels {
    12381178        label $inner.${tag}label -text $tag -font "Arial 9"
    1239         entry $inner.${tag} -font "Arial 9"  -bg white \
     1179        entry $inner.${tag} -font "Arial 9" -bg white -width 10 \
    12401180            -textvariable [itcl::scope settings_($this-$tag)]
    12411181        bind $inner.${tag} <KeyPress-Return> \
     
    12441184            $row,1 $inner.${tag}label -anchor e \
    12451185            $row,2 $inner.${tag} -anchor w
     1186        blt::table configure $inner r$row -resize none
    12461187        incr row
    12471188    }
    12481189    blt::table configure $inner c1 c2 -resize none
    12491190    blt::table configure $inner c3 -resize expand
    1250 
    1251 }
    1252 
    1253 itcl::body Rappture::HeightmapViewer::tab { what who } {
    1254     switch -- ${what} {
    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
    1263         }
    1264         "resize" {
    1265             set bbox [$itk_component(${who}_canvas) bbox all]
    1266             set wid [winfo width $itk_component(${who}_frame)]
    1267             $itk_component(${who}_canvas) configure -width $wid \
    1268                 -scrollregion $bbox -yscrollincrement 0.1i
    1269         }
    1270     }
    1271 }
    1272 
     1191    blt::table configure $inner r$row -resize expand
     1192}
  • trunk/gui/scripts/molvisviewer.tcl

    r1373 r1375  
    2020option add *MolvisViewer.height 4i widgetDefault
    2121option add *MolvisViewer.foreground black widgetDefault
    22 option add *MolvisViewer.controlBackground gray widgetDefault
    23 option add *MolvisViewer.controlDarkBackground #999999 widgetDefault
    2422option add *MolvisViewer.font -*-helvetica-medium-r-normal-*-12-* widgetDefault
    2523
     
    7169    public method bondthickness {option {model "all"} }
    7270    public method ResetView {}
    73     public method tab {what who}
    7471
    7572    protected method _send {args}
     
    122119    private common hardcopy_
    123120    private variable nextToken_ 0
    124     private variable headings_
    125121}
    126122
     
    196192    # Set up the widgets in the main body
    197193    #
     194    set f [$itk_component(main) component controls]
    198195    itk_component add reset {
    199         button $itk_component(controls).reset \
    200             -borderwidth 1 -padx 1 -pady 1 \
     196        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
    201197            -image [Rappture::icon reset-view] \
    202198            -command [itcl::code $this ResetView]
    203     } {
    204         usual
    205         ignore -borderwidth
    206         rename -highlightbackground -controlbackground controlBackground \
    207             Background
    208199    }
    209200    pack $itk_component(reset) -padx 1 -pady 2
     
    212203
    213204    itk_component add zoomin {
    214         button $itk_component(controls).zin \
    215             -borderwidth 1 -padx 1 -pady 1 \
     205        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
    216206            -image [Rappture::icon zoom-in] \
    217207            -command [itcl::code $this _zoom in]
    218     } {
    219         usual
    220         ignore -borderwidth
    221         rename -highlightbackground -controlbackground \
    222             controlBackground Background
    223208    }
    224209    pack $itk_component(zoomin) -padx 2 -pady { 0 2 }
     
    226211
    227212    itk_component add zoomout {
    228         button $itk_component(controls).zout \
    229             -borderwidth 1 -padx 1 -pady 1 \
     213        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
    230214            -image [Rappture::icon zoom-out] \
    231215            -command [itcl::code $this _zoom out]
    232     } {
    233         usual
    234         ignore -borderwidth
    235         rename -highlightbackground -controlbackground controlBackground \
    236             Background
    237216    }
    238217    pack $itk_component(zoomout) -padx 2 -pady { 0 2 }
    239218    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    240219
    241     #
    242     # Shortcuts
    243     #
    244     itk_component add shortcuts {
    245         frame $itk_component(controls).shortcuts
    246     } {
    247         usual
    248         rename -background -controlbackground controlBackground Background
    249     }
    250     pack $itk_component(shortcuts) -side top
    251 
    252220    itk_component add labels {
    253         label $itk_component(shortcuts).labels \
    254             -borderwidth 1 -padx 1 -pady 1 \
     221        label $f.labels -borderwidth 1 -padx 1 -pady 1 \
    255222            -relief "raised" -image [Rappture::icon atom-label]
    256     } {
    257         usual
    258         ignore -borderwidth
    259         rename -highlightbackground -controlbackground controlBackground \
    260             Background
    261223    }
    262224    pack $itk_component(labels) -padx 2 -pady { 0 2} -ipadx 1 -ipady 1
     
    267229
    268230    itk_component add rock {
    269         label $itk_component(shortcuts).rock \
    270             -borderwidth 1 -padx 1 -pady 1 \
     231        label $f.rock -borderwidth 1 -padx 1 -pady 1 \
    271232            -relief "raised" -image [Rappture::icon rock-view]
    272     } {
    273         usual
    274         ignore -borderwidth
    275         rename -highlightbackground -controlbackground controlBackground \
    276             Background
    277233    }
    278234    pack $itk_component(rock) -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
     
    284240
    285241    itk_component add ortho {
    286         label $itk_component(shortcuts).ortho \
    287             -borderwidth 1 -padx 1 -pady 1 \
     242        label $f.ortho -borderwidth 1 -padx 1 -pady 1 \
    288243            -relief "raised" -image [Rappture::icon 3dpers]
    289     } {
    290         usual
    291         ignore -borderwidth
    292         rename -highlightbackground -controlbackground controlBackground \
    293             Background
    294244    }
    295245    pack $itk_component(ortho) -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
     
    300250        [itcl::code $this projection toggle]
    301251    $this projection perspective
    302 
    303     itk_component add configure_button {
    304         label $itk_component(controls).configbutton \
    305             -borderwidth 1 -padx 1 -pady 1 \
    306             -relief "raised" -image [Rappture::icon wrench]
    307     } {
    308         usual
    309         ignore -borderwidth
    310         rename -highlightbackground -controlbackground controlBackground \
    311             Background
    312     }
    313252
    314253    _BuildViewTab
     
    401340        [itcl::code $this _map]
    402341
    403     $itk_component(scroller) contents $itk_component(view_canvas)
    404     $itk_component(title) configure -text "$headings_(view)"
    405 
    406342    eval itk_initialize $args
    407343    Connect
     
    409345
    410346itcl::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
    424     }
    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]
    429 
    430347    set fg [option get $itk_component(hull) font Font]
    431348
    432     set inner $itk_component(view_frame)
     349    set inner [$itk_component(main) insert end \
     350        -title "View Settings" \
     351        -icon [Rappture::icon wrench]]
     352    $inner configure -borderwidth 4
     353
    433354    label $inner.drawinglabel -text "Drawing Method" -font "Arial 9 bold"
    434355
     
    473394        -variable Rappture::MolvisViewer::_settings($this-ortho) \
    474395         -font "Arial 9 bold"
     396
     397    label $inner.spacer
    475398    blt::table $inner \
    476399        0,0 $inner.drawinglabel -anchor w -columnspan 4 \
     
    479402        2,2 $inner.lines -anchor w -columnspan 2 \
    480403        3,2 $inner.bstick -anchor w -columnspan 2 \
    481         4,0 $inner.labels -anchor w -columnspan 4 \
    482         5,0 $inner.rock -anchor w -columnspan 4 \
    483         6,0 $inner.ortho -anchor w -columnspan 4 \
    484         8,1 $inner.atomscale -anchor w -columnspan 2 \
    485         10,1 $inner.bondthickness -anchor w -columnspan 2
     404        4,0 $inner.labels -anchor w -columnspan 4 -pady {6 0} \
     405        5,0 $inner.rock -anchor w -columnspan 4 -pady {6 0} \
     406        6,0 $inner.ortho -anchor w -columnspan 4 -pady {6 0} \
     407        8,1 $inner.atomscale -fill x -columnspan 4 -pady {6 0} \
     408        10,1 $inner.bondthickness -fill x -columnspan 4 -pady {6 0}
    486409
    487410    blt::table configure $inner c0 -resize expand -width 2
    488411    blt::table configure $inner c1 c2 -resize none
    489412    blt::table configure $inner c3 -resize expand
     413    for {set n 0} {$n <= 10} {incr n} {
     414        blt::table configure $inner r$n -resize none
     415    }
     416    blt::table configure $inner r$n -resize expand
    490417}
    491418
     
    12281155    }
    12291156    set _settings($this-modelimg) [Rappture::icon $option]
    1230     #@set inner [$itk_component(controls).panel component inner]
    1231     set inner $itk_component(settings_frame)
     1157    set inner [$itk_component(main) panel "View Settings"]
    12321158    $inner.pict configure -image $_settings($this-modelimg)
    12331159
     
    16321558    return ""
    16331559}
    1634 
    1635 itcl::body Rappture::MolvisViewer::tab { what who } {
    1636     switch -- ${what} {
    1637         "select" {
    1638             $itk_component(scroller) contents $itk_component(${who}_canvas)
    1639             after idle [list focus $itk_component(${who}_canvas)]
    1640             $itk_component(title) configure -text "$headings_($who)"
    1641             drawer open
    1642         }
    1643         "deselect" {
    1644             drawer close
    1645         }
    1646         "resize" {
    1647             set bbox [$itk_component(${who}_canvas) bbox all]
    1648             set wid [winfo width $itk_component(${who}_frame)]
    1649             $itk_component(${who}_canvas) configure -width $wid \
    1650                 -scrollregion $bbox -yscrollincrement 0.1i
    1651         }
    1652     }
    1653 }
  • trunk/gui/scripts/scroller.tcl

    r1342 r1375  
    113113itcl::body Rappture::Scroller::contents {{widget "!@#query"}} {
    114114    if {$widget == "!@#query"} {
     115        if {$_contents == $_frame} {
     116            return $_frame.f
     117        }
    115118        return $_contents
    116119    }
     
    268271        }
    269272        outer {
    270             $_frame itemconfigure frame -width [winfo width $_frame]
     273            if {[winfo width $_frame] > [winfo reqwidth $_frame.f]} {
     274                $_frame itemconfigure frame -width [winfo width $_frame]
     275            } else {
     276                $_frame itemconfigure frame -width 0
     277            }
    271278            if {[winfo height $_frame] > [winfo reqheight $_frame.f]} {
    272279                $_frame itemconfigure frame -height [winfo height $_frame]
  • trunk/gui/scripts/visviewer.tcl

    r1373 r1375  
    6565    protected method Color2RGB { color }
    6666    protected method Euler2XYZ { theta phi psi }
    67     protected method drawer {what}
    6867
    6968    private proc _CheckNameList { namelist }  {
     
    9089itk::usual Panedwindow {
    9190    keep -background -cursor
    92 }
    93 itk::usual Tabset {
    94     keep -background
    9591}
    9692
     
    124120    pack propagate $itk_component(hull) no
    125121
    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
     122    itk_component add main {
     123        Rappture::SidebarFrame $itk_interior.main
     124    }
     125    pack $itk_component(main) -expand yes -fill both
     126    set f [$itk_component(main) component frame]
    132127
    133128    itk_component add plotarea {
    134         frame $itk_component(panes).plotarea -highlightthickness 0
    135     }
    136     $itk_component(panes) add $itk_component(plotarea) -sticky nsew
     129        frame $f.plotarea -highlightthickness 0
     130    }
    137131    set _image(plot) [image create photo]
    138132    itk_component add 3dview {
     
    143137        ignore -highlightthickness -borderwidth
    144138    }
    145     itk_component add drawer {
    146         frame $itk_component(panes).cntls
    147     } {
    148         usual
    149         rename -background -controlbackground controlBackground Background
    150     }
    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
    199     } {
    200         usual
    201         ignore -highlightthickness -borderwidth
    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
    222139
    223140    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
    231141}
    232142
     
    622532    }
    623533}
    624 
    625 itcl::body Rappture::VisViewer::drawer { what } {
    626     switch -- ${what} {
    627         "open" {
    628             after idle [list focus $itk_component(drawer)]
    629             set win [$itk_component(scroller) contents]
    630             set w1 [winfo reqwidth $win]
    631             set w2 [winfo reqwidth $itk_component(title)]
    632             set w [expr max($w1,$w2) + 30]
    633             set x [expr [winfo width $itk_component(panes)] - $w]
    634             $itk_component(panes) sash place 0 $x 0
    635             $itk_component(panes) paneconfigure $itk_component(drawer) \
    636                 -width $w
    637             #sash place 0 $x 0
    638             $itk_component(flipswitch) configure \
    639                 -image [Rappture::icon sbar-closed]
    640             set isOpen_ 1
    641         }
    642         "close" {
    643             $itk_component(flipswitch) configure \
    644                 -image [Rappture::icon sbar-open]
    645             set w [winfo width $itk_component(panes)]
    646             if { $w <= 1 } {
    647                 set w [winfo reqwidth $itk_component(panes)]
    648             }
    649             set x [lindex [$itk_component(panes) sash coord 0] 0]
    650             set initialized_(drawer) $x
    651             $itk_component(panes) paneconfigure $itk_component(drawer) \
    652                 -minsize 30
    653             set x [expr $w - 30]
    654             $itk_component(panes) sash place 0 $x 0
    655             set isOpen_ 0
    656         }
    657         "toggle" {
    658             if { $isOpen_ } {
    659                 drawer close
    660             } else {
    661                 drawer open
    662             }
    663         }
    664     }
    665 }
  • trunk/gui/scripts/xyresult.tcl

    r1342 r1375  
    8585    public method parameters {title args} { # do nothing }
    8686    public method download {option args}
    87     public method legend {option args}
    8887
    8988    protected method _rebuild {}
     
    142141    pack propagate $itk_component(hull) no
    143142
    144     itk_component add controls {
    145         frame $itk_interior.cntls
    146     } {
    147         usual
    148         rename -background -controlbackground controlBackground Background
    149     }
    150     pack $itk_component(controls) -side right -fill y
     143    itk_component add main {
     144        Rappture::SidebarFrame $itk_interior.main
     145    }
     146    pack $itk_component(main) -expand yes -fill both
     147    set f [$itk_component(main) component controls]
    151148
    152149    itk_component add reset {
    153         button $itk_component(controls).reset \
    154             -borderwidth 1 -padx 1 -pady 1 \
     150        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
    155151            -image [Rappture::icon reset-view] \
    156152            -command [itcl::code $this _zoom reset]
     
    158154        usual
    159155        ignore -borderwidth
    160         rename -highlightbackground -controlbackground controlBackground Background
    161156    }
    162157    pack $itk_component(reset) -padx 4 -pady 2 -anchor e
    163158    Rappture::Tooltip::for $itk_component(reset) "Reset the view to the default zoom level"
    164     itk_component add drawer {
    165         panedwindow $itk_interior.drawer \
    166             -orient horizontal -opaqueresize 1 -handlepad 0 \
    167             -handlesize 1 -sashwidth 2
    168     }
    169     pack $itk_component(drawer) -expand yes -fill both
     159
     160    set f [$itk_component(main) component frame]
    170161    itk_component add plot {
    171         blt::graph $itk_component(drawer).plot \
     162        blt::graph $f.plot \
    172163            -highlightthickness 0 -plotpadx 0 -plotpady 0 \
    173164            -rightmargin 10
     
    175166        keep -background -foreground -cursor -font
    176167    }
    177     $itk_component(drawer) add $itk_component(plot) -sticky nsew
     168    pack $itk_component(plot) -expand yes -fill both
    178169
    179170    $itk_component(plot) pen configure activeLine \
     
    244235
    245236    $itk_component(plot) legend configure -hide yes
     237
    246238    #
    247239    # Add legend for editing hidden/elements:
    248240    #
    249     itk_component add legendbutton {
    250         button $itk_component(controls).legendbutton \
    251             -borderwidth 1 -padx 2 -pady 0 -highlightthickness 0 \
    252             -image [Rappture::icon wrench] \
    253             -command [itcl::code $this legend toggle]
    254     } {
    255         usual
    256         ignore -borderwidth -font
    257         rename -highlightbackground -controlbackground controlBackground Background
    258     }
    259     pack $itk_component(legendbutton) \
    260         -side bottom -padx 4 -pady { 0 2 } -anchor e
    261    
     241    set inner [$itk_component(main) insert end \
     242        -title "Legend" \
     243        -icon [Rappture::icon wrench]]
     244    $inner configure -borderwidth 4
     245
    262246    itk_component add legend {
    263         Rappture::XyLegend $itk_component(drawer).legend $itk_component(plot)
    264     }
     247        Rappture::XyLegend $inner.legend $itk_component(plot)
     248    }
     249    pack $itk_component(legend) -expand yes -fill both
     250
    265251    after idle [subst {
    266252        update idletasks
    267253        $itk_component(legend) reset
    268254    }]
    269     Rappture::Tooltip::for $itk_component(legendbutton) \
    270         "Display legend"
    271255
    272256    # quick-and-dirty zoom functionality, for now...
     
    15831567    }
    15841568}
    1585 
    1586 itcl::body Rappture::XyResult::legend { what args } {
    1587     switch -- ${what} {
    1588         "activate" {
    1589             $itk_component(drawer) add $itk_component(legend) -sticky nsew
    1590             after idle [list focus $itk_component(legend)]
    1591             if { !$initialized_ } {
    1592                 set w [winfo width $itk_component(drawer)]
    1593                 set x [expr $w - 100]
    1594                 $itk_component(drawer) sash place 0 $x 0
    1595                 set initialized_ 1
    1596             }
    1597         }
    1598         "deactivate" {
    1599             $itk_component(drawer) forget $itk_component(legend)
    1600         }
    1601         "toggle" {
    1602             set slaves [$itk_component(drawer) panes]
    1603             if { [lsearch $slaves $itk_component(legend)] >= 0 } {
    1604                 legend deactivate
    1605             } else {
    1606                 legend activate
    1607             }
    1608         }
    1609     }
    1610 }
    1611 
Note: See TracChangeset for help on using the changeset viewer.