Ignore:
Timestamp:
Mar 18, 2009, 2:59:21 PM (16 years ago)
Author:
gah
Message:

preliminary HQ output from molvisviewer; unexpand tabs; all jpeg generation at 100%

File:
1 edited

Legend:

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

    r1140 r1342  
    7373    set pname "pane[incr _counter]"
    7474    itk_component add $pname {
    75         frame $itk_interior.$pname
     75        frame $itk_interior.$pname
    7676    }
    7777
     
    9393itcl::body Rappture::Panes::insert {pos args} {
    9494    Rappture::getopts args params {
    95         value -fraction 0.5
     95        value -fraction 0.5
    9696    }
    9797    if {[llength $args] > 0} {
    98         error "wrong # args: should be \"insert pos ?-fraction f?\""
     98        error "wrong # args: should be \"insert pos ?-fraction f?\""
    9999    }
    100100
     
    102102    set sash "${pname}sash"
    103103    itk_component add $sash {
    104         frame $itk_interior.$sash
     104        frame $itk_interior.$sash
    105105    } {
    106         usual
    107         rename -cursor -sashcursor sashCursor SashCursor
     106        usual
     107        rename -cursor -sashcursor sashCursor SashCursor
    108108    }
    109109    bind $itk_component($sash) <Enter> [itcl::code $this hilite on $sash]
     
    111111
    112112    itk_component add ${sash}ridge {
    113         frame $itk_component($sash).ridge
     113        frame $itk_component($sash).ridge
    114114    } {
    115         usual
    116         rename -cursor -sashcursor sashCursor SashCursor
    117         rename -relief -sashrelief sashRelief SashRelief
    118         ignore -borderwidth
     115        usual
     116        rename -cursor -sashcursor sashCursor SashCursor
     117        rename -relief -sashrelief sashRelief SashRelief
     118        ignore -borderwidth
    119119    }
    120120    pack $itk_component(${sash}ridge) -fill x
    121121
    122122    foreach comp [list $sash ${sash}ridge] {
    123         bind $itk_component($comp) <ButtonPress-1> \
    124             [itcl::code $this _grab $pname %X %Y]
    125         bind $itk_component($comp) <B1-Motion> \
    126             [itcl::code $this _drag $pname %X %Y]
    127         bind $itk_component($comp) <ButtonRelease-1> \
    128             [itcl::code $this _drop $pname %X %Y]
     123        bind $itk_component($comp) <ButtonPress-1> \
     124            [itcl::code $this _grab $pname %X %Y]
     125        bind $itk_component($comp) <B1-Motion> \
     126            [itcl::code $this _drag $pname %X %Y]
     127        bind $itk_component($comp) <ButtonRelease-1> \
     128            [itcl::code $this _drop $pname %X %Y]
    129129    }
    130130
    131131
    132132    itk_component add $pname {
    133         frame $itk_interior.$pname
     133        frame $itk_interior.$pname
    134134    }
    135135    set _panes [linsert $_panes $pos $pname]
     
    154154    set pname [lindex $_panes $pos]
    155155    if {[info exists itk_component($pname)]} {
    156         return $itk_component($pname)
     156        return $itk_component($pname)
    157157    }
    158158    return ""
     
    167167itcl::body Rappture::Panes::visibility {pos {newval ""}} {
    168168    if {"" == $newval} {
    169         return [lindex $_visibility $pos]
     169        return [lindex $_visibility $pos]
    170170    }
    171171    if {![string is boolean $newval]} {
    172         error "bad value \"$newval\": should be boolean"
     172        error "bad value \"$newval\": should be boolean"
    173173    }
    174174    if {$pos == "end" || ($pos >= 0 && $pos < [llength $_visibility])} {
    175         set _visibility [lreplace $_visibility $pos $pos [expr {$newval}]]
    176         $_dispatcher event -idle !layout
     175        set _visibility [lreplace $_visibility $pos $pos [expr {$newval}]]
     176        $_dispatcher event -idle !layout
    177177    } else {
    178         error "bad index \"$pos\": out of range"
     178        error "bad index \"$pos\": out of range"
    179179    }
    180180}
     
    188188itcl::body Rappture::Panes::fraction {pos {newval ""}} {
    189189    if {"" == $newval} {
    190         return [lindex $_frac $pos]
     190        return [lindex $_frac $pos]
    191191    }
    192192    if {![string is double $newval]} {
    193         error "bad value \"$newval\": should be fraction 0-1"
     193        error "bad value \"$newval\": should be fraction 0-1"
    194194    }
    195195    if {$pos == "end" || ($pos >= 0 && $pos < [llength $_frac])} {
    196         set len [llength $_frac]
    197         set _frac [lreplace $_frac $pos $pos xxx]
    198         set total 0
    199         foreach f $_frac {
    200             if {"xxx" != $f} {
    201                 set total [expr {$total+$f}]
    202             }
    203         }
    204         for {set i 0} {$i < $len} {incr i} {
    205             set f [lindex $_frac $i]
    206             if {"xxx" == $f} {
    207                 set f $newval
    208             } else {
    209                 set f [expr {$f/$total - $newval/double($len-1)}]
    210             }
    211             set _frac [lreplace $_frac $i $i $f]
    212         }
    213         $_dispatcher event -idle !layout
     196        set len [llength $_frac]
     197        set _frac [lreplace $_frac $pos $pos xxx]
     198        set total 0
     199        foreach f $_frac {
     200            if {"xxx" != $f} {
     201                set total [expr {$total+$f}]
     202            }
     203        }
     204        for {set i 0} {$i < $len} {incr i} {
     205            set f [lindex $_frac $i]
     206            if {"xxx" == $f} {
     207                set f $newval
     208            } else {
     209                set f [expr {$f/$total - $newval/double($len-1)}]
     210            }
     211            set _frac [lreplace $_frac $i $i $f]
     212        }
     213        $_dispatcher event -idle !layout
    214214    } else {
    215         error "bad index \"$pos\": out of range"
     215        error "bad index \"$pos\": out of range"
    216216    }
    217217}
     
    226226    switch -- $itk_option(-sashrelief) {
    227227      sunken {
    228         if {$state} {
    229             $itk_component(${sash}ridge) configure -relief raised
    230         } else {
    231             $itk_component(${sash}ridge) configure -relief sunken
    232         }
     228        if {$state} {
     229            $itk_component(${sash}ridge) configure -relief raised
     230        } else {
     231            $itk_component(${sash}ridge) configure -relief sunken
     232        }
    233233      }
    234234      raised {
    235         if {$state} {
    236             $itk_component(${sash}ridge) configure -relief sunken
    237         } else {
    238             $itk_component(${sash}ridge) configure -relief raised
    239         }
     235        if {$state} {
     236            $itk_component(${sash}ridge) configure -relief sunken
     237        } else {
     238            $itk_component(${sash}ridge) configure -relief raised
     239        }
    240240      }
    241241      solid {
    242         if {$state} {
    243             $itk_component($sash) configure -background black
    244         } else {
    245             $itk_component($sash) configure \
    246                 -background $itk_option(-background)
    247         }
     242        if {$state} {
     243            $itk_component($sash) configure -background black
     244        } else {
     245            $itk_component($sash) configure \
     246                -background $itk_option(-background)
     247        }
    248248      }
    249249    }
     
    269269    set frac [expr double($realY)/$Ymax]
    270270    if {$frac < 0.05} {
    271         set frac 0.05
     271        set frac 0.05
    272272    }
    273273    if {$frac > 0.95} {
    274         set frac 0.95
     274        set frac 0.95
    275275    }
    276276    if {[llength $_frac] == 2} {
    277         set _frac [list $frac [expr {1-$frac}]]
     277        set _frac [list $frac [expr {1-$frac}]]
    278278    } else {
    279         set i [expr {[lsearch $_panes $pname]-1}]
    280         if {$i >= 0} {
    281             set _frac [lreplace $_frac $i $i $frac]
    282         }
     279        set i [expr {[lsearch $_panes $pname]-1}]
     280        if {$i >= 0} {
     281            set _frac [lreplace $_frac $i $i $frac]
     282        }
    283283    }
    284284    _fixLayout
     
    308308    set flist ""
    309309    foreach p $_panes f $_frac v $_visibility {
    310         set sash ${p}sash
    311         if {$v} {
    312             # this pane is visible -- make room for it
    313             lappend plist $p
    314             lappend flist $f
    315             if {[info exists itk_component($sash)]} {
    316                 set h [expr {$h - [winfo height $itk_component($sash)]}]
    317             }
    318         } else {
    319             # this pane is not visible -- remove sash
    320             if {[info exists itk_component($sash)]} {
    321                 place forget $itk_component($sash)
    322             }
    323             place forget $itk_component($p)
    324         }
     310        set sash ${p}sash
     311        if {$v} {
     312            # this pane is visible -- make room for it
     313            lappend plist $p
     314            lappend flist $f
     315            if {[info exists itk_component($sash)]} {
     316                set h [expr {$h - [winfo height $itk_component($sash)]}]
     317            }
     318        } else {
     319            # this pane is not visible -- remove sash
     320            if {[info exists itk_component($sash)]} {
     321                place forget $itk_component($sash)
     322            }
     323            place forget $itk_component($p)
     324        }
    325325    }
    326326
     
    330330    set newflist ""
    331331    foreach f $flist {
    332         lappend newflist [expr {double($f)/$total}]
     332        lappend newflist [expr {double($f)/$total}]
    333333    }
    334334    set flist $newflist
     
    337337    set y 0
    338338    foreach p $plist f $flist {
    339         set sash ${p}sash
    340         if {[info exists itk_component($sash)]} {
    341             set sh [winfo reqheight $itk_component($sash)]
    342             place $itk_component($sash) -y $y -relx 0.5 -anchor n \
    343                 -relwidth 1.0 -height $sh
    344             set y [expr {$y + $sh}]
    345         }
    346 
    347         set ph [expr {$h*$f}]
    348         place $itk_component($p) -y $y -relx 0.5 -anchor n \
    349             -relwidth 1.0 -height $ph
    350         set y [expr {$y + $ph}]
     339        set sash ${p}sash
     340        if {[info exists itk_component($sash)]} {
     341            set sh [winfo reqheight $itk_component($sash)]
     342            place $itk_component($sash) -y $y -relx 0.5 -anchor n \
     343                -relwidth 1.0 -height $sh
     344            set y [expr {$y + $sh}]
     345        }
     346
     347        set ph [expr {$h*$f}]
     348        place $itk_component($p) -y $y -relx 0.5 -anchor n \
     349            -relwidth 1.0 -height $ph
     350        set y [expr {$y + $ph}]
    351351    }
    352352}
     
    362362    set bd [expr {$ht/2}]
    363363    foreach pane $_panes {
    364         set sash "${pane}sashridge"
    365         if {[info exists itk_component($sash)]} {
    366             $itk_component($sash) configure -height $ht -borderwidth $bd
    367             if {$itk_option(-sashrelief) == "solid"} {
    368                 $itk_component($sash) configure -background black
    369             } else {
    370                 $itk_component($sash) configure \
    371                     -background $itk_option(-background)
    372             }
    373             pack $itk_component($sash) -pady $itk_option(-sashpadding)
    374         }
     364        set sash "${pane}sashridge"
     365        if {[info exists itk_component($sash)]} {
     366            $itk_component($sash) configure -height $ht -borderwidth $bd
     367            if {$itk_option(-sashrelief) == "solid"} {
     368                $itk_component($sash) configure -background black
     369            } else {
     370                $itk_component($sash) configure \
     371                    -background $itk_option(-background)
     372            }
     373            pack $itk_component($sash) -pady $itk_option(-sashpadding)
     374        }
    375375    }
    376376}
Note: See TracChangeset for help on using the changeset viewer.