Ignore:
Timestamp:
Apr 1, 2009, 4:55:25 PM (15 years ago)
Author:
gah
Message:

First pass at changes to visualization widgets.

nanovisview.tcl use png icons.
visviewer.tcl change to sidebar layout
molvisviewer.tcl use png icons, fixed for sidebar layout.
heightmapviewer.tcl use png icons, fixed for sidebar layout.
flowvisviewer.tcl use png icons, fixed for sidebar layout.

resultviewer.tcl recognize flow data
field.tcl recognize unirect3d mesh.
field3dresult.tcl load FlowvisViewer? component description.
panes.tcl added horizontal panes. Need cursor fix. Must specify

correct cursor from options.

unirect2d.tcl added "axisorder" tag to specify order of field data.

Changed name to Unirect2d from UniRect2d.

unirect3d.tcl added "axisorder" tag to specify order of field data.

Right now, this is a test platform for me for flow
visualizations.

File:
1 edited

Legend:

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

    r1342 r1373  
    4949    private variable _counter 0      ;# counter for auto-generated names
    5050    private variable _frac 0.0       ;# list of fractions
     51    public variable orientation "vertical"
    5152}
    5253
     
    118119        ignore -borderwidth
    119120    }
    120     pack $itk_component(${sash}ridge) -fill x
    121 
     121    if { $orientation == "vertical" } {
     122        pack $itk_component(${sash}ridge) -fill x
     123    } else {
     124        pack $itk_component(${sash}ridge) -fill y -side left
     125    }
    122126    foreach comp [list $sash ${sash}ridge] {
    123127        bind $itk_component($comp) <ButtonPress-1> \
     
    265269# ----------------------------------------------------------------------
    266270itcl::body Rappture::Panes::_drag {pname X Y} {
    267     set realY [expr {$Y-[winfo rooty $itk_component(hull)]}]
    268     set Ymax  [winfo height $itk_component(hull)]
    269     set frac [expr double($realY)/$Ymax]
     271    if { $orientation == "vertical" } {
     272        set realY [expr {$Y-[winfo rooty $itk_component(hull)]}]
     273        set Ymax  [winfo height $itk_component(hull)]
     274        set frac [expr double($realY)/$Ymax]
     275    } else {
     276        set realX [expr {$X-[winfo rootx $itk_component(hull)]}]
     277        set Xmax  [winfo width $itk_component(hull)]
     278        set frac [expr double($realX)/$Xmax]
     279    }
    270280    if {$frac < 0.05} {
    271281        set frac 0.05
     
    303313# ----------------------------------------------------------------------
    304314itcl::body Rappture::Panes::_fixLayout {args} {
    305     set h [winfo height $itk_component(hull)]
    306 
    307     set plist ""
    308     set flist ""
    309     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 { $orientation == "vertical" } {
     316        set h [winfo height $itk_component(hull)]
     317
     318        set plist ""
     319        set flist ""
     320        foreach p $_panes f $_frac v $_visibility {
     321            set sash ${p}sash
     322            if {$v} {
     323                # this pane is visible -- make room for it
     324                lappend plist $p
     325                lappend flist $f
     326                if {[info exists itk_component($sash)]} {
     327                    set h [expr {$h - [winfo height $itk_component($sash)]}]
     328                }
     329            } else {
     330                # this pane is not visible -- remove sash
     331                if {[info exists itk_component($sash)]} {
     332                    place forget $itk_component($sash)
     333                }
     334                place forget $itk_component($p)
     335            }
     336        }
     337       
     338        # normalize the fractions so they add up to 1
     339        set total 0
     340        foreach f $flist { set total [expr {$total+$f}] }
     341        set newflist ""
     342        foreach f $flist {
     343            lappend newflist [expr {double($f)/$total}]
     344        }
     345        set flist $newflist
     346       
     347        # lay out the various panes
     348        set y 0
     349        foreach p $plist f $flist {
     350            set sash ${p}sash
    315351            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
     352                set sh [winfo reqheight $itk_component($sash)]
     353                place $itk_component($sash) -y $y -relx 0.5 -anchor n \
     354                    -relwidth 1.0 -height $sh
     355                set y [expr {$y + $sh}]
     356            }
     357           
     358            set ph [expr {$h*$f}]
     359            place $itk_component($p) -y $y -relx 0.5 -anchor n \
     360                -relwidth 1.0 -height $ph
     361            set y [expr {$y + $ph}]
     362        }
     363    } else {
     364        set w [winfo width $itk_component(hull)]
     365
     366        set plist ""
     367        set flist ""
     368        foreach p $_panes f $_frac v $_visibility {
     369            set sash ${p}sash
     370            if {$v} {
     371                # this pane is visible -- make room for it
     372                lappend plist $p
     373                lappend flist $f
     374                if {[info exists itk_component($sash)]} {
     375                    set w [expr {$w - [winfo width $itk_component($sash)]}]
     376                }
     377            } else {
     378                # this pane is not visible -- remove sash
     379                if {[info exists itk_component($sash)]} {
     380                    place forget $itk_component($sash)
     381                }
     382                place forget $itk_component($p)
     383            }
     384        }
     385       
     386        # normalize the fractions so they add up to 1
     387        set total 0
     388        foreach f $flist { set total [expr {$total+$f}] }
     389        set newflist ""
     390        foreach f $flist {
     391            lappend newflist [expr {double($f)/$total}]
     392        }
     393        set flist $newflist
     394       
     395        # lay out the various panes
     396        set x 0
     397        foreach p $plist f $flist {
     398            set sash ${p}sash
    320399            if {[info exists itk_component($sash)]} {
    321                 place forget $itk_component($sash)
    322             }
    323             place forget $itk_component($p)
    324         }
    325     }
    326 
    327     # normalize the fractions so they add up to 1
    328     set total 0
    329     foreach f $flist { set total [expr {$total+$f}] }
    330     set newflist ""
    331     foreach f $flist {
    332         lappend newflist [expr {double($f)/$total}]
    333     }
    334     set flist $newflist
    335 
    336     # lay out the various panes
    337     set y 0
    338     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}]
    351     }
     400                set sw [winfo reqwidth $itk_component($sash)]
     401                place $itk_component($sash) -x $x -rely 0.5 -anchor w \
     402                    -relheight 1.0 -width $sw
     403                set x [expr {$x + $sw}]
     404            }
     405           
     406            set pw [expr {$w*$f}]
     407            place $itk_component($p) -x $x -rely 0.5 -anchor w \
     408                -relheight 1.0 -width $pw
     409            set x [expr {$x + $pw}]
     410        }
     411    }   
    352412}
    353413
     
    359419# ----------------------------------------------------------------------
    360420itcl::body Rappture::Panes::_fixSashes {args} {
    361     set ht [winfo pixels $itk_component(hull) $itk_option(-sashwidth)]
    362     set bd [expr {$ht/2}]
    363     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)
     421    if { $orientation == "vertical" } {
     422        set ht [winfo pixels $itk_component(hull) $itk_option(-sashwidth)]
     423        set bd [expr {$ht/2}]
     424        foreach pane $_panes {
     425            set sash "${pane}sashridge"
     426            if {[info exists itk_component($sash)]} {
     427                $itk_component($sash) configure -height $ht -borderwidth $bd
     428                if {$itk_option(-sashrelief) == "solid"} {
     429                    $itk_component($sash) configure -background black
     430                } else {
     431                    $itk_component($sash) configure \
     432                        -background $itk_option(-background)
     433                }
     434                pack $itk_component($sash) -pady $itk_option(-sashpadding)
     435            }
     436        }
     437    } else {
     438        set w [winfo pixels $itk_component(hull) $itk_option(-sashwidth)]
     439        set bd [expr {$w/2}]
     440        foreach pane $_panes {
     441            set sash "${pane}sashridge"
     442            if {[info exists itk_component($sash)]} {
     443                $itk_component($sash) configure -width $w -borderwidth $bd
     444                if {$itk_option(-sashrelief) == "solid"} {
     445                    $itk_component($sash) configure -background black
     446                } else {
     447                    $itk_component($sash) configure \
     448                        -background $itk_option(-background)
     449                }
     450                pack $itk_component($sash) -padx $itk_option(-sashpadding) \
     451                    -side left
     452            }
    374453        }
    375454    }
Note: See TracChangeset for help on using the changeset viewer.