Changes in trunk/gui/scripts/deviceLayout1D.tcl [11:24]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/deviceLayout1D.tcl
r11 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 … … 203 231 # get the default system of units 204 232 set units [set defunits [$_device get units]] 205 if {$units == "arbitrary" } {233 if {$units == "arbitrary" || $units == ""} { 206 234 set defunits "m" 207 235 set units "um" … … 212 240 box* { 213 241 # get x-coord for each corner 214 set c0 [lindex [$_device get components.$nn.corner0] 0] 242 set c0 [$_device get components.$nn.corner0] 243 regsub -all , $c0 { } c0 244 set c0 [lindex $c0 0] 215 245 set c0 [Rappture::Units::convert $c0 \ 216 246 -context $defunits -to $units -units off] 217 247 218 set c1 [lindex [$_device get components.$nn.corner1] 0] 248 set c1 [$_device get components.$nn.corner1] 249 regsub -all , $c1 { } c1 250 set c1 [lindex $c1 0] 219 251 set c1 [Rappture::Units::convert $c1 \ 220 252 -context $defunits -to $units -units off] … … 310 342 itcl::body Rappture::DeviceLayout1D::_drawLayer {index x0 x1} { 311 343 set c $itk_component(area) 312 set h [expr {[winfo height $c]-1}] 313 314 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}] 315 348 set y0p [expr {$y0-$_sizes(bar45)}] 316 349 set y1p [expr {$y0-$_sizes(bar)}] … … 357 390 itcl::body Rappture::DeviceLayout1D::_drawIcon {index x0 x1 imh} { 358 391 set c $itk_component(area) 359 set h [expr {[winfo height $c]-1}] 360 361 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}] 362 396 set y0p [expr {$y0-$_sizes(bar45)}] 363 397 set y1p [expr {$y0-$_sizes(bar)}] … … 370 404 set y [expr {0.5*($y0+$y0p) + 0.5*($y1-$y0p)}] 371 405 372 ##set lcolor $itk_option(-deviceoutline)373 ##$c create line $xx0 $y $xx1 $y -width 3374 375 406 $c create image [expr {0.5*($xx0+$xx1)}] $y -anchor c -image $imh 376 407 } … … 385 416 itcl::body Rappture::DeviceLayout1D::_drawAnnotation {index x0 x1} { 386 417 set c $itk_component(area) 387 set h [expr {[winfo height $c]-1}] 388 389 set y0 $h 390 set y1 [expr {$y0-$_sizes(bar)-$_sizes(bar45)}] 391 418 419 set ytop [expr {$_sizes(header)+1}] 392 420 set x0p [expr {$x0+$_sizes(bar45)}] 393 421 set x1p [expr {$x1+$_sizes(bar45)}] … … 396 424 set fnt $itk_option(-font) 397 425 set lh [font metrics $fnt -linespace] 398 set ymid [expr {$y 1-2-0.5*$lh}]399 set y [expr {$y 1-4}]426 set ymid [expr {$ytop-2-0.5*$lh}] 427 set y [expr {$ytop-4}] 400 428 401 429 #
Note: See TracChangeset
for help on using the changeset viewer.