- Timestamp:
- Jul 17, 2005, 11:14:06 PM (19 years ago)
- Location:
- trunk/gui/scripts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/deviceEditor.tcl
r22 r24 13 13 package require Itk 14 14 15 option add *DeviceEditor.width 5i widgetDefault16 option add *DeviceEditor.height 5i widgetDefault17 15 option add *DeviceEditor.autoCleanUp yes widgetDefault 18 16 … … 41 39 # ---------------------------------------------------------------------- 42 40 itcl::body Rappture::DeviceEditor::constructor {owner args} { 43 itk_option add hull.width hull.height44 pack propagate $itk_component(hull) no45 46 41 itk_component add top { 47 42 frame $itk_interior.top -
trunk/gui/scripts/deviceLayout1D.tcl
r23 r24 90 90 ignore -highlightthickness -highlightbackground -highlightcolor 91 91 } 92 pack $itk_component(area) - fill both92 pack $itk_component(area) -expand yes -fill both 93 93 bind $itk_component(area) <Configure> \ 94 94 [list $_dispatcher event -idle !redraw] 95 95 96 96 eval itk_initialize $args 97 98 set _sizes(header) 1 99 set _sizes(bararea) 1 97 100 } 98 101 … … 163 166 # ---------------------------------------------------------------------- 164 167 itcl::body Rappture::DeviceLayout1D::_layout {} { 165 # first, recompute the overall height of this widget 166 set h [expr {$_sizes(bar)+$_sizes(bar45)+2}] 168 # 169 # First, recompute the overall height of this widget... 170 # 171 # size of an ordinary material bar: 172 set hmax [expr {$_sizes(bar)+$_sizes(bar45)+2}] 173 174 # add the maximum size of any embedded icons: 175 if {$_device != ""} { 176 foreach nn [$_device children components] { 177 set icon [$_device get components.$nn.about.icon] 178 if {"" != $icon} { 179 if {[info exists _icons($icon)]} { 180 set imh $_icons($icon) 181 } else { 182 set imh [image create photo -data $icon] 183 set _icons($icon) $imh 184 } 185 186 set h [image height $_icons($icon)] 187 if {$h > $hmax} { 188 set hmax $h 189 } 190 } 191 } 192 } 193 set _sizes(bararea) $hmax 167 194 168 195 set fnt $itk_option(-font) … … 171 198 if {"" != $m} { 172 199 set extra [expr {1.5*[font metrics $fnt -linespace]}] 173 set h [expr {$h+$extra}]200 set hmax [expr {$hmax+$extra}] 174 201 break 175 202 } … … 181 208 if {"" != [$_device get components.$nn.about.label]} { 182 209 set extra [expr {1.2*[font metrics $fnt -linespace]}] 183 set h [expr {$h+$extra}]210 set hmax [expr {$hmax+$extra}] 184 211 break 185 212 } … … 188 215 189 216 set oldh [component hull cget -height] 190 if {$h != $oldh} {191 component hull configure -height $h 217 if {$hmax != $oldh} { 218 component hull configure -height $hmax 192 219 $_dispatcher event -idle !redraw 193 220 } 221 set _sizes(header) [expr {$hmax - $_sizes(bararea)}] 194 222 195 223 # next, scan through the device and compute layer positions … … 314 342 itcl::body Rappture::DeviceLayout1D::_drawLayer {index x0 x1} { 315 343 set c $itk_component(area) 316 set h [expr {[winfo height $c]-1}] 317 318 set y0 $h 344 set h [expr {$_sizes(header) + $_sizes(bararea) - 1}] 345 346 set bsize [expr {$_sizes(bar)+$_sizes(bar45)+2}] 347 set y0 [expr {$h - 0.5*$_sizes(bararea) + 0.5*$bsize}] 319 348 set y0p [expr {$y0-$_sizes(bar45)}] 320 349 set y1p [expr {$y0-$_sizes(bar)}] … … 361 390 itcl::body Rappture::DeviceLayout1D::_drawIcon {index x0 x1 imh} { 362 391 set c $itk_component(area) 363 set h [expr {[winfo height $c]-1}] 364 365 set y0 $h 392 set h [expr {$_sizes(header) + $_sizes(bararea) - 1}] 393 394 set bsize [expr {$_sizes(bar)+$_sizes(bar45)+2}] 395 set y0 [expr {$h - 0.5*$_sizes(bararea) + 0.5*$bsize}] 366 396 set y0p [expr {$y0-$_sizes(bar45)}] 367 397 set y1p [expr {$y0-$_sizes(bar)}] … … 374 404 set y [expr {0.5*($y0+$y0p) + 0.5*($y1-$y0p)}] 375 405 376 ##set lcolor $itk_option(-deviceoutline)377 ##$c create line $xx0 $y $xx1 $y -width 3378 379 406 $c create image [expr {0.5*($xx0+$xx1)}] $y -anchor c -image $imh 380 407 } … … 389 416 itcl::body Rappture::DeviceLayout1D::_drawAnnotation {index x0 x1} { 390 417 set c $itk_component(area) 391 set h [expr {[winfo height $c]-1}] 392 393 set y0 $h 394 set y1 [expr {$y0-$_sizes(bar)-$_sizes(bar45)}] 395 418 419 set ytop [expr {$_sizes(header)+1}] 396 420 set x0p [expr {$x0+$_sizes(bar45)}] 397 421 set x1p [expr {$x1+$_sizes(bar45)}] … … 400 424 set fnt $itk_option(-font) 401 425 set lh [font metrics $fnt -linespace] 402 set ymid [expr {$y 1-2-0.5*$lh}]403 set y [expr {$y 1-4}]426 set ymid [expr {$ytop-2-0.5*$lh}] 427 set y [expr {$ytop-4}] 404 428 405 429 # -
trunk/gui/scripts/deviceViewer1D.tcl
r23 r24 16 16 package require BLT 17 17 18 option add *DeviceViewer1D.width 4i widgetDefault19 option add *DeviceViewer1D.height 4i widgetDefault20 18 option add *DeviceViewer1D.padding 4 widgetDefault 21 19 option add *DeviceViewer1D.deviceSize 0.25i widgetDefault … … 34 32 protected method _loadDevice {} 35 33 protected method _changeTabs {} 34 protected method _fixSize {} 36 35 protected method _fixAxes {} 37 36 protected method _align {} … … 60 59 set _owner $owner 61 60 62 itk_option add hull.width hull.height63 61 pack propagate $itk_component(hull) no 64 62 … … 95 93 blt::graph $itk_component(inner).graph \ 96 94 -highlightthickness 0 -plotpadx 0 -plotpady 0 \ 97 -width 3i -height 3i95 -width 4i -height 2i 98 96 } { 99 97 keep -background -foreground -cursor -font … … 120 118 121 119 eval itk_initialize $args 120 121 _fixSize 122 122 } 123 123 … … 294 294 $itk_component(graph) configure \ 295 295 -rightmargin [$itk_component(layout) extents bar3D] 296 297 _fixSize 296 298 } 297 299 … … 408 410 after cancel [itcl::code $this _fixAxes] 409 411 after 100 [itcl::code $this _fixAxes] 412 } 413 414 # ---------------------------------------------------------------------- 415 # USAGE: _fixSize 416 # 417 # Used internally to fix the overall size of this widget based on 418 # the various parts inside. Sets the requested width/height of the 419 # widget so that it is big enough to display the device and its 420 # fields. 421 # ---------------------------------------------------------------------- 422 itcl::body Rappture::DeviceViewer1D::_fixSize {} { 423 update idletasks 424 set w [winfo reqwidth $itk_component(tabs)] 425 set h [winfo reqheight $itk_component(tabs)] 426 component hull configure -width $w -height $h 410 427 } 411 428 -
trunk/gui/scripts/gauge.tcl
r22 r24 82 82 itcl::body Rappture::Gauge::constructor {args} { 83 83 itk_component add icon { 84 canvas $itk_interior.icon -borderwidth 0 -highlightthickness 0 84 canvas $itk_interior.icon -width 1 -height 1 \ 85 -borderwidth 0 -highlightthickness 0 85 86 } { 86 87 usual … … 542 543 error "bad option \"$itk_option(-spectrum)\": should be Rappture::Spectrum object" 543 544 } 545 _resize 544 546 _layout 545 547 _redraw -
trunk/gui/scripts/moleculeViewer.tcl
r22 r24 15 15 package require BLT 16 16 17 option add *MoleculeViewer.width 4i widgetDefault18 option add *MoleculeViewer.height 4i widgetDefault17 option add *MoleculeViewer.width 5i widgetDefault 18 option add *MoleculeViewer.height 5i widgetDefault 19 19 option add *MoleculeViewer.backdrop black widgetDefault 20 20 -
trunk/gui/scripts/pager.tcl
r22 r24 166 166 set _pages [linsert $_pages $pos $params(-name)] 167 167 168 #bind $win <Configure> \169 #[itcl::code $_dispatcher event -idle !fixsize]168 bind $win <Configure> \ 169 [itcl::code $_dispatcher event -idle !fixsize] 170 170 171 171 # the number of pages affects the arrangment -- force an update
Note: See TracChangeset
for help on using the changeset viewer.