Ignore:
Timestamp:
Oct 22, 2010, 4:06:10 PM (14 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r1422 r1929  
    6262    public method current {args}
    6363    public method color {value}
    64                                                                                
     64                                                                               
    6565    protected method _setCurrent {val}
    6666    protected method _redraw {}
     
    8282    private variable _vwidth 0        ;# width allocated for values
    8383}
    84                                                                                
     84                                                                               
    8585itk::usual Radiodial {
    8686    keep -background -foreground -cursor -font
     
    9292itcl::body Rappture::Radiodial::constructor {args} {
    9393    itk_component add dial {
    94         canvas $itk_interior.dial
     94        canvas $itk_interior.dial
    9595    }
    9696    pack $itk_component(dial) -expand yes -fill both
     
    127127itcl::body Rappture::Radiodial::add {label {value ""}} {
    128128    if {"" == $value} {
    129         set value [llength $_values]
     129        set value [llength $_values]
    130130    }
    131131
     
    141141
    142142    if {"" == $_current} {
    143         _setCurrent $value
     143        _setCurrent $value
    144144    }
    145145
     
    177177itcl::body Rappture::Radiodial::get {args} {
    178178    Rappture::getopts args params {
    179         value -format "label"
     179        value -format "label"
    180180    }
    181181    if {[llength $args] > 1} {
    182         error "wrong # args: should be \"get ?-format f? ?current|@index\""
     182        error "wrong # args: should be \"get ?-format f? ?current|@index\""
    183183    }
    184184    set index [lindex $args 0]
    185185    if {"" == $index} {
    186         set ilist ""
    187         for {set i 0} {$i < [llength $_values]} {incr i} {
    188             lappend ilist $i
    189         }
     186        set ilist ""
     187        for {set i 0} {$i < [llength $_values]} {incr i} {
     188            lappend ilist $i
     189        }
    190190    } elseif {"current" == $index} {
    191         set ilist [lsearch -exact $_values $_current]
    192         if {$ilist < 0} {
    193             set ilist ""
    194         }
     191        set ilist [lsearch -exact $_values $_current]
     192        if {$ilist < 0} {
     193            set ilist ""
     194        }
    195195    } elseif {[regexp {^@([0-9]+|end)$} $index match i]} {
    196         set ilist $i
     196        set ilist $i
    197197    }
    198198    if {[llength $ilist] == 1} {
    199         set op set
     199        set op set
    200200    } else {
    201         set op lappend
     201        set op lappend
    202202    }
    203203
    204204    set rlist ""
    205205    foreach i $ilist {
    206         switch -- $params(-format) {
    207             label {
    208                 set v [lindex $_values $i]
    209                 $op rlist [lindex $_val2label($v) 0]
    210             }
    211             value {
    212                 $op rlist [lindex $_values $i]
    213             }
    214             position {
    215                 foreach {min max} [_limits] break
    216                 set v [lindex $_values $i]
    217                 set frac [expr {double($v-$min)/($max-$min)}]
    218                 $op rlist $frac
    219             }
    220             all {
    221                 set v [lindex $_values $i]
    222                 foreach {min max} [_limits] break
    223                 set frac [expr {double($v-$min)/($max-$min)}]
     206        switch -- $params(-format) {
     207            label {
     208                set v [lindex $_values $i]
     209                $op rlist [lindex $_val2label($v) 0]
     210            }
     211            value {
     212                $op rlist [lindex $_values $i]
     213            }
     214            position {
     215                foreach {min max} [_limits] break
     216                set v [lindex $_values $i]
     217                set frac [expr {double($v-$min)/($max-$min)}]
     218                $op rlist $frac
     219            }
     220            all {
     221                set v [lindex $_values $i]
     222                foreach {min max} [_limits] break
     223                set frac [expr {double($v-$min)/($max-$min)}]
    224224                set l [lindex $_val2label($v) 0]
    225                 $op rlist [list $l $v $frac]
    226             }
    227             default {
    228                 error "bad value \"$v\": should be label, value, position, all"
    229             }
    230         }
     225                $op rlist [list $l $v $frac]
     226            }
     227            default {
     228                error "bad value \"$v\": should be label, value, position, all"
     229            }
     230        }
    231231    }
    232232    return $rlist
     
    240240itcl::body Rappture::Radiodial::current {args} {
    241241    if {[llength $args] == 0} {
    242         return $_current
     242        return $_current
    243243    } elseif {[llength $args] == 1} {
    244         set newval [lindex $args 0]
     244        set newval [lindex $args 0]
    245245        set n [_findLabel $newval]
    246246
    247         # Don't use expr (?:) because it evaluates the resulting string.
    248         # For example, it changes -0.020 to -0.02.
    249         if { $n >= 0 } {
    250             set rawval [lindex $_values $n]
    251         } else {
    252             set rawval ""
    253         }
    254         _setCurrent $rawval
    255 
    256         after cancel [itcl::code $this _redraw]
    257         after idle [itcl::code $this _redraw]
    258         event generate $itk_component(hull) <<Value>>
    259 
    260         return $_current
     247        # Don't use expr (?:) because it evaluates the resulting string.
     248        # For example, it changes -0.020 to -0.02.
     249        if { $n >= 0 } {
     250            set rawval [lindex $_values $n]
     251        } else {
     252            set rawval ""
     253        }
     254        _setCurrent $rawval
     255
     256        after cancel [itcl::code $this _redraw]
     257        after idle [itcl::code $this _redraw]
     258        event generate $itk_component(hull) <<Value>>
     259
     260        return $_current
    261261    }
    262262    error "wrong # args: should be \"current ?newval?\""
     
    273273
    274274    if {"" != $_spectrum} {
    275         foreach {min max} [_limits] break
    276         set frac [expr {double($value-$min)/($max-$min)}]
    277         set color [$_spectrum get $frac]
     275        foreach {min max} [_limits] break
     276        set frac [expr {double($value-$min)/($max-$min)}]
     277        set color [$_spectrum get $frac]
    278278    } else {
    279         if {$value == $_current} {
    280             set color $_activecolor
    281         } else {
    282             set color $itk_option(-linecolor)
    283         }
     279        if {$value == $_current} {
     280            set color $_activecolor
     281        } else {
     282            set color $itk_option(-linecolor)
     283        }
    284284    }
    285285    return $color
     
    295295    set _current $value
    296296    if {"" != $_variable} {
    297         upvar #0 $_variable var
    298         if {[info exists _val2label($value)]} {
    299             set var [lindex $_val2label($value) 0]
    300         } else {
    301             set var $value
    302         }
     297        upvar #0 $_variable var
     298        if {[info exists _val2label($value)]} {
     299            set var [lindex $_val2label($value) 0]
     300        } else {
     301            set var $value
     302        }
    303303    }
    304304}
     
    323323
    324324    if {"" != $_knob} {
    325         set kw [image width $_knob]
    326         set kh [image height $_knob]
    327 
    328         switch -- $itk_option(-knobposition) {
    329             n@top - nw@top - ne@top {
    330                 set extra [expr {$t-$kh}]
    331                 if {$extra < 0} {set extra 0}
    332                 set y1 [expr {$h-$extra-1}]
    333             }
    334             n@middle - nw@middle - ne@middle {
    335                 set extra [expr {int(ceil($kh-0.5*$t))}]
    336                 if {$extra < 0} {set extra 0}
    337                 set y1 [expr {$h-$extra-1}]
    338             }
    339             n@bottom - nw@bottom - ne@bottom {
    340                 set y1 [expr {$h-$kh-1}]
    341             }
    342 
    343             e@top - w@top - center@top -
    344             e@bottom - w@bottom - center@bottom {
    345                 set extra [expr {int(ceil(0.5*$kh))}]
    346                 set y1 [expr {$h-$extra-1}]
    347             }
    348             e@middle - w@middle - center@middle {
    349                 set extra [expr {int(ceil(0.5*($kh-$t)))}]
    350                 if {$extra < 0} {set extra 0}
    351                 set y1 [expr {$h-$extra-1}]
    352             }
    353 
    354             s@top - sw@top - se@top -
    355             s@middle - sw@middle - se@middle -
    356             s@bottom - sw@bottom - se@bottom {
    357                 set y1 [expr {$h-2}]
    358             }
    359         }
     325        set kw [image width $_knob]
     326        set kh [image height $_knob]
     327
     328        switch -- $itk_option(-knobposition) {
     329            n@top - nw@top - ne@top {
     330                set extra [expr {$t-$kh}]
     331                if {$extra < 0} {set extra 0}
     332                set y1 [expr {$h-$extra-1}]
     333            }
     334            n@middle - nw@middle - ne@middle {
     335                set extra [expr {int(ceil($kh-0.5*$t))}]
     336                if {$extra < 0} {set extra 0}
     337                set y1 [expr {$h-$extra-1}]
     338            }
     339            n@bottom - nw@bottom - ne@bottom {
     340                set y1 [expr {$h-$kh-1}]
     341            }
     342
     343            e@top - w@top - center@top -
     344            e@bottom - w@bottom - center@bottom {
     345                set extra [expr {int(ceil(0.5*$kh))}]
     346                set y1 [expr {$h-$extra-1}]
     347            }
     348            e@middle - w@middle - center@middle {
     349                set extra [expr {int(ceil(0.5*($kh-$t)))}]
     350                if {$extra < 0} {set extra 0}
     351                set y1 [expr {$h-$extra-1}]
     352            }
     353
     354            s@top - sw@top - se@top -
     355            s@middle - sw@middle - se@middle -
     356            s@bottom - sw@bottom - se@bottom {
     357                set y1 [expr {$h-2}]
     358            }
     359        }
    360360    }
    361361    set y0 [expr {$y1-$t}]
     
    366366    # draw the background rectangle
    367367    $c create rectangle $x0 $y0 $x1 $y1 \
    368         -outline $itk_option(-dialoutlinecolor) \
    369         -fill $itk_option(-dialfillcolor)
     368        -outline $itk_option(-dialoutlinecolor) \
     369        -fill $itk_option(-dialfillcolor)
    370370
    371371    # draw the optional progress bar, from start to current
    372372    if {"" != $itk_option(-dialprogresscolor)
    373           && [llength $_values] > 0 && "" != $_current} {
    374         if {$max != $min} {
    375             set frac [expr {double($_current-$min)/($max-$min)}]
    376         } else {
    377             set frac 0.
    378         }
    379         set xx1 [expr {$frac*($x1-$x0) + $x0}]
    380         $c create rectangle [expr {$x0+1}] [expr {$y0+3}] $xx1 [expr {$y1-2}] \
    381             -outline "" -fill $itk_option(-dialprogresscolor)
     373          && [llength $_values] > 0 && "" != $_current} {
     374        if {$max != $min} {
     375            set frac [expr {double($_current-$min)/($max-$min)}]
     376        } else {
     377            set frac 0.
     378        }
     379        set xx1 [expr {$frac*($x1-$x0) + $x0}]
     380        $c create rectangle [expr {$x0+1}] [expr {$y0+3}] $xx1 [expr {$y1-2}] \
     381            -outline "" -fill $itk_option(-dialprogresscolor)
    382382    }
    383383
    384384    # draw lines for all values
    385385    if {$max > $min} {
    386         foreach v $_values {
    387             set frac [expr {double($v-$min)/($max-$min)}]
    388             if {"" != $_spectrum} {
    389                 set color [$_spectrum get $frac]
    390             } else {
    391                 if {$v == $_current} {
    392                     set color $_activecolor
    393                 } else {
    394                     set color $itk_option(-linecolor)
    395                 }
    396             }
    397             set thick [expr {($v == $_current) ? 3 : 1}]
    398 
    399             if {"" != $color} {
    400                 set x [expr {$frac*($x1-$x0) + $x0}]
    401                 $c create line $x [expr {$y0+1}] $x $y1 \
    402                     -fill $color -width $thick
    403             }
    404         }
    405 
    406         if {"" != $_current} {
    407             set x [expr {double($_current-$min)/($max-$min)*($x1-$x0) + $x0}]
    408             regexp {([nsew]+|center)@} $itk_option(-knobposition) match anchor
    409             switch -glob -- $itk_option(-knobposition) {
    410                 *@top    { set kpos $y0 }
    411                 *@middle { set kpos [expr {int(ceil(0.5*($y1+$y0)))}] }
    412                 *@bottom { set kpos $y1 }
    413             }
    414             $c create image $x $kpos -anchor $anchor -image $_knob
    415         }
     386        foreach v $_values {
     387            set frac [expr {double($v-$min)/($max-$min)}]
     388            if {"" != $_spectrum} {
     389                set color [$_spectrum get $frac]
     390            } else {
     391                if {$v == $_current} {
     392                    set color $_activecolor
     393                } else {
     394                    set color $itk_option(-linecolor)
     395                }
     396            }
     397            set thick [expr {($v == $_current) ? 3 : 1}]
     398
     399            if {"" != $color} {
     400                set x [expr {$frac*($x1-$x0) + $x0}]
     401                $c create line $x [expr {$y0+1}] $x $y1 \
     402                    -fill $color -width $thick
     403            }
     404        }
     405
     406        if {"" != $_current} {
     407            set x [expr {double($_current-$min)/($max-$min)*($x1-$x0) + $x0}]
     408            regexp {([nsew]+|center)@} $itk_option(-knobposition) match anchor
     409            switch -glob -- $itk_option(-knobposition) {
     410                *@top    { set kpos $y0 }
     411                *@middle { set kpos [expr {int(ceil(0.5*($y1+$y0)))}] }
     412                *@bottom { set kpos $y1 }
     413            }
     414            $c create image $x $kpos -anchor $anchor -image $_knob
     415        }
    416416    }
    417417
     
    419419    set vw $itk_option(-valuewidth)
    420420    if {$vw > 0 && "" != $_current} {
    421         set str [lindex $_val2label($_current) 0]
    422         if {[string length $str] >= $vw} {
    423             set str "[string range $str 0 [expr {$vw-3}]]..."
    424         }
    425 
    426         set dy [expr {([font metrics $itk_option(-font) -linespace]
    427                         - [font metrics $itk_option(-font) -ascent])/2}]
    428 
    429         set id [$c create text [expr {$x1+4}] [expr {($y1+$y0)/2+$dy}] \
    430             -anchor w -text $str -font $itk_option(-font) -foreground $fg]
    431         foreach {x0 y0 x1 y1} [$c bbox $id] break
    432         set x0 [expr {$x0 + 10}]
    433 
    434         # set up a tooltip so you can mouse over truncated values
    435         Rappture::Tooltip::text $c [lindex $_val2label($_current) 0]
    436         $c bind $id <Enter> \
    437             [list ::Rappture::Tooltip::tooltip pending %W +$x0,$y1]
    438         $c bind $id <Leave> \
    439             [list ::Rappture::Tooltip::tooltip cancel]
    440         $c bind $id <ButtonPress> \
    441             [list ::Rappture::Tooltip::tooltip cancel]
    442         $c bind $id <KeyPress> \
    443             [list ::Rappture::Tooltip::tooltip cancel]
     421        set str [lindex $_val2label($_current) 0]
     422        if {[string length $str] >= $vw} {
     423            set str "[string range $str 0 [expr {$vw-3}]]..."
     424        }
     425
     426        set dy [expr {([font metrics $itk_option(-font) -linespace]
     427                        - [font metrics $itk_option(-font) -ascent])/2}]
     428
     429        set id [$c create text [expr {$x1+4}] [expr {($y1+$y0)/2+$dy}] \
     430            -anchor w -text $str -font $itk_option(-font) -foreground $fg]
     431        foreach {x0 y0 x1 y1} [$c bbox $id] break
     432        set x0 [expr {$x0 + 10}]
     433
     434        # set up a tooltip so you can mouse over truncated values
     435        Rappture::Tooltip::text $c [lindex $_val2label($_current) 0]
     436        $c bind $id <Enter> \
     437            [list ::Rappture::Tooltip::tooltip pending %W +$x0,$y1]
     438        $c bind $id <Leave> \
     439            [list ::Rappture::Tooltip::tooltip cancel]
     440        $c bind $id <ButtonPress> \
     441            [list ::Rappture::Tooltip::tooltip cancel]
     442        $c bind $id <KeyPress> \
     443            [list ::Rappture::Tooltip::tooltip cancel]
    444444    }
    445445}
     
    465465    foreach {min max} [_limits] break
    466466    if {$max > $min && $x >= $x0 && $x <= $x1} {
    467         set dmin $w
    468         set xnearest 0
    469         set vnearest ""
    470         foreach v $_values {
    471             set xv [expr {double($v-$min)/($max-$min)*($x1-$x0) + $x0}]
    472             if {abs($xv-$x) < $dmin} {
    473                 set dmin [expr {abs($xv-$x)}]
    474                 set xnearest $xv
    475                 set vnearest $v
    476             }
    477         }
    478 
    479         if {$vnearest != $_current} {
    480             _setCurrent $vnearest
    481             _redraw
    482 
    483             event generate $itk_component(hull) <<Value>>
    484         }
     467        set dmin $w
     468        set xnearest 0
     469        set vnearest ""
     470        foreach v $_values {
     471            set xv [expr {double($v-$min)/($max-$min)*($x1-$x0) + $x0}]
     472            if {abs($xv-$x) < $dmin} {
     473                set dmin [expr {abs($xv-$x)}]
     474                set xnearest $xv
     475                set vnearest $v
     476            }
     477        }
     478
     479        if {$vnearest != $_current} {
     480            _setCurrent $vnearest
     481            _redraw
     482
     483            event generate $itk_component(hull) <<Value>>
     484        }
    485485    }
    486486}
     
    497497    set index [lsearch -exact $_values $_current]
    498498    if {$index >= 0} {
    499         incr index $offset
    500         if {$index >= [llength $_values]} {
    501             set index [expr {[llength $_values]-1}]
    502         } elseif {$index < 0} {
    503             set index 0
    504         }
    505 
    506         set newval [lindex $_values $index]
    507         if {$newval != $_current} {
    508             _setCurrent $newval
    509             _redraw
    510 
    511             event generate $itk_component(hull) <<Value>>
    512         }
     499        incr index $offset
     500        if {$index >= [llength $_values]} {
     501            set index [expr {[llength $_values]-1}]
     502        } elseif {$index < 0} {
     503            set index 0
     504        }
     505
     506        set newval [lindex $_values $index]
     507        if {$newval != $_current} {
     508            _setCurrent $newval
     509            _redraw
     510
     511            event generate $itk_component(hull) <<Value>>
     512        }
    513513    }
    514514}
     
    523523itcl::body Rappture::Radiodial::_limits {} {
    524524    if {[llength $_values] == 0} {
    525         set min 0
    526         set max 0
     525        set min 0
     526        set max 0
    527527    } else {
    528         set min [lindex $_values 0]
    529         set max $min
    530         foreach v [lrange $_values 1 end] {
    531             if {$v < $min} { set min $v }
    532             if {$v > $max} { set max $v }
    533         }
    534         set del [expr {$max-$min}]
    535         set min [expr {$min-$itk_option(-valuepadding)*$del}]
    536         set max [expr {$max+$itk_option(-valuepadding)*$del}]
     528        set min [lindex $_values 0]
     529        set max $min
     530        foreach v [lrange $_values 1 end] {
     531            if {$v < $min} { set min $v }
     532            if {$v > $max} { set max $v }
     533        }
     534        set del [expr {$max-$min}]
     535        set min [expr {$min-$itk_option(-valuepadding)*$del}]
     536        set max [expr {$max+$itk_option(-valuepadding)*$del}]
    537537    }
    538538
    539539    if {"" != $itk_option(-min)} {
    540         set min $itk_option(-min)
     540        set min $itk_option(-min)
    541541    }
    542542    if {"" != $itk_option(-max)} {
    543         set max $itk_option(-max)
     543        set max $itk_option(-max)
    544544    }
    545545    return [list $min $max]
     
    578578
    579579    if {"" != $_knob} {
    580         set kh [image height $_knob]
    581 
    582         switch -- $itk_option(-knobposition) {
    583             n@top - nw@top - ne@top -
    584             s@bottom - sw@bottom - se@bottom {
    585                 if {$kh > $h} { set h $kh }
    586             }
    587             n@middle - nw@middle - ne@middle -
    588             s@middle - sw@middle - se@middle {
    589                 set h [expr {int(ceil(0.5*$h + $kh))}]
    590             }
    591             n@bottom - nw@bottom - ne@bottom -
    592             s@top - sw@top - se@top {
    593                 set h [expr {$h + $kh}]
    594             }
    595             e@middle - w@middle - center@middle {
    596                 set h [expr {(($h > $kh) ? $h : $kh) + 1}]
    597             }
    598             n@middle - ne@middle - nw@middle -
    599             s@middle - se@middle - sw@middle {
    600                 set extra [expr {int(ceil($kh-0.5*$h))}]
    601                 if {$extra < 0} { set extra 0 }
    602                 set h [expr {$h+$extra}]
    603             }
    604         }
     580        set kh [image height $_knob]
     581
     582        switch -- $itk_option(-knobposition) {
     583            n@top - nw@top - ne@top -
     584            s@bottom - sw@bottom - se@bottom {
     585                if {$kh > $h} { set h $kh }
     586            }
     587            n@middle - nw@middle - ne@middle -
     588            s@middle - sw@middle - se@middle {
     589                set h [expr {int(ceil(0.5*$h + $kh))}]
     590            }
     591            n@bottom - nw@bottom - ne@bottom -
     592            s@top - sw@top - se@top {
     593                set h [expr {$h + $kh}]
     594            }
     595            e@middle - w@middle - center@middle {
     596                set h [expr {(($h > $kh) ? $h : $kh) + 1}]
     597            }
     598            n@middle - ne@middle - nw@middle -
     599            s@middle - se@middle - sw@middle {
     600                set extra [expr {int(ceil($kh-0.5*$h))}]
     601                if {$extra < 0} { set extra 0 }
     602                set h [expr {$h+$extra}]
     603            }
     604        }
    605605    }
    606606    incr h 1
     
    610610    # if the -valuewidth is > 0, then make room for the value
    611611    if {$itk_option(-valuewidth) > 0} {
    612         set charw [font measure $itk_option(-font) "n"]
    613         set _vwidth [expr {$itk_option(-valuewidth)*$charw}]
    614         set w [expr {$w+$_vwidth+4}]
     612        set charw [font measure $itk_option(-font) "n"]
     613        set _vwidth [expr {$itk_option(-valuewidth)*$charw}]
     614        set w [expr {$w+$_vwidth+4}]
    615615    } else {
    616         set _vwidth 0
     616        set _vwidth 0
    617617    }
    618618
     
    629629itcl::body Rappture::Radiodial::_fixValue {args} {
    630630    if {"" == $itk_option(-variable)} {
    631         return
     631        return
    632632    }
    633633    upvar #0 $itk_option(-variable) var
     
    669669itcl::configbody Rappture::Radiodial::valuewidth {
    670670    if {![string is integer $itk_option(-valuewidth)]} {
    671         error "bad value \"$itk_option(-valuewidth)\": should be integer"
     671        error "bad value \"$itk_option(-valuewidth)\": should be integer"
    672672    }
    673673    _fixSize
     
    722722    set val $itk_option(-activelinecolor)
    723723    if {[catch {$val isa ::Rappture::Spectrum} valid] == 0 && $valid} {
    724         set _spectrum $val
    725         set _activecolor ""
     724        set _spectrum $val
     725        set _activecolor ""
    726726    } elseif {[catch {winfo rgb $itk_component(hull) $val}] == 0} {
    727         set _spectrum ""
    728         set _activecolor $val
     727        set _spectrum ""
     728        set _activecolor $val
    729729    } elseif {"" != $val} {
    730         error "bad value \"$val\": should be Spectrum object or color"
     730        error "bad value \"$val\": should be Spectrum object or color"
    731731    }
    732732    after cancel [itcl::code $this _redraw]
     
    739739itcl::configbody Rappture::Radiodial::knobimage {
    740740    if {[regexp {^image[0-9]+$} $itk_option(-knobimage)]} {
    741         set _knob $itk_option(-knobimage)
     741        set _knob $itk_option(-knobimage)
    742742    } elseif {"" != $itk_option(-knobimage)} {
    743         set _knob [Rappture::icon $itk_option(-knobimage)]
     743        set _knob [Rappture::icon $itk_option(-knobimage)]
    744744    } else {
    745         set _knob ""
     745        set _knob ""
    746746    }
    747747    _fixSize
     
    756756itcl::configbody Rappture::Radiodial::knobposition {
    757757    if {![regexp {^([nsew]+|center)@(top|middle|bottom)$} $itk_option(-knobposition)]} {
    758         error "bad value \"$itk_option(-knobposition)\": should be anchor@top|middle|bottom"
     758        error "bad value \"$itk_option(-knobposition)\": should be anchor@top|middle|bottom"
    759759    }
    760760    _fixSize
     
    770770itcl::configbody Rappture::Radiodial::padding {
    771771    if {[catch {winfo pixels $itk_component(hull) $itk_option(-padding)}]} {
    772         error "bad value \"$itk_option(-padding)\": should be size in pixels"
     772        error "bad value \"$itk_option(-padding)\": should be size in pixels"
    773773    }
    774774}
     
    780780itcl::configbody Rappture::Radiodial::valuepadding {
    781781    if {![string is double $itk_option(-valuepadding)]
    782           || $itk_option(-valuepadding) < 0} {
    783         error "bad value \"$itk_option(-valuepadding)\": should be >= 0.0"
     782          || $itk_option(-valuepadding) < 0} {
     783        error "bad value \"$itk_option(-valuepadding)\": should be >= 0.0"
    784784    }
    785785}
     
    790790itcl::configbody Rappture::Radiodial::variable {
    791791    if {"" != $_variable} {
    792         upvar #0 $_variable var
    793         trace remove variable var write [itcl::code $this _fixValue]
     792        upvar #0 $_variable var
     793        trace remove variable var write [itcl::code $this _fixValue]
    794794    }
    795795
     
    797797
    798798    if {"" != $_variable} {
    799         upvar #0 $_variable var
    800         trace add variable var write [itcl::code $this _fixValue]
    801 
    802         # sync to the current value of this variable
    803         if {[info exists var]} {
    804             _fixValue
    805         }
    806     }
    807 }
     799        upvar #0 $_variable var
     800        trace add variable var write [itcl::code $this _fixValue]
     801
     802        # sync to the current value of this variable
     803        if {[info exists var]} {
     804            _fixValue
     805        }
     806    }
     807}
Note: See TracChangeset for help on using the changeset viewer.