Ignore:
Timestamp:
Apr 2, 2009, 6:05:34 PM (16 years ago)
Author:
mmc
Message:

Created the SidebarFrame? widget to manage all sidebar options, and plugged
it into the various vis viewers and the xyresult.

File:
1 edited

Legend:

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

    r1373 r1375  
    6565    protected method Color2RGB { color }
    6666    protected method Euler2XYZ { theta phi psi }
    67     protected method drawer {what}
    6867
    6968    private proc _CheckNameList { namelist }  {
     
    9089itk::usual Panedwindow {
    9190    keep -background -cursor
    92 }
    93 itk::usual Tabset {
    94     keep -background
    9591}
    9692
     
    124120    pack propagate $itk_component(hull) no
    125121
    126     itk_component add panes {
    127         panedwindow $itk_interior.panes \
    128             -orient horizontal -opaqueresize 1 -handlepad 0 \
    129             -handlesize 1 -sashwidth 2
    130     }
    131     pack $itk_component(panes) -expand yes -fill both
     122    itk_component add main {
     123        Rappture::SidebarFrame $itk_interior.main
     124    }
     125    pack $itk_component(main) -expand yes -fill both
     126    set f [$itk_component(main) component frame]
    132127
    133128    itk_component add plotarea {
    134         frame $itk_component(panes).plotarea -highlightthickness 0
    135     }
    136     $itk_component(panes) add $itk_component(plotarea) -sticky nsew
     129        frame $f.plotarea -highlightthickness 0
     130    }
    137131    set _image(plot) [image create photo]
    138132    itk_component add 3dview {
     
    143137        ignore -highlightthickness -borderwidth
    144138    }
    145     itk_component add drawer {
    146         frame $itk_component(panes).cntls
    147     } {
    148         usual
    149         rename -background -controlbackground controlBackground Background
    150     }
    151     itk_component add controls {
    152         frame $itk_component(drawer).cntls 
    153     } {
    154         usual
    155         rename -background -controlbackground controlBackground Background
    156         ignore -highlightthickness -borderwidth 
    157     }
    158 
    159     itk_component add titlebar {
    160         frame $itk_component(drawer).titlebar -background \#6666cc
    161     } {
    162         usual
    163         ignore -highlightthickness -borderwidth  -background
    164     }
    165 
    166     itk_component add title {
    167         label $itk_component(titlebar).title -text "This is the title bar" \
    168             -background \#6666cc -font "Arial 8" -foreground white 
    169     } {
    170         usual
    171         ignore -background -font -foreground
    172     }
    173     itk_component add flipswitch {
    174         button $itk_component(titlebar).flip \
    175             -borderwidth 1 -highlightthickness 0 \
    176             -relief "flat" -image [Rappture::icon sbar-open] \
    177             -command [itcl::code $this drawer toggle] \
    178             -background \#6666cc -foreground white -overrelief raised \
    179             -activebackground \#6666cc -activeforeground white
    180        
    181     } {
    182         ignore -borderwidth
    183         rename -highlightbackground -controlbackground controlBackground \
    184             Background
    185     }
    186     Rappture::Tooltip::for $itk_component(flipswitch) \
    187         "Configure settings"
    188 
    189     blt::table $itk_component(titlebar) \
    190         0,0 $itk_component(flipswitch) -ipady 2 -ipadx 5 -anchor w \
    191         0,1 $itk_component(title) -anchor w
    192     blt::table configure $itk_component(titlebar) c0 -width 30
    193 
    194     itk_component add sidebar {
    195         blt::tabset $itk_component(drawer).sidebar \
    196             -highlightthickness 0 -tearoff 0 -side left \
    197             -bd 0 -gap 0 -tabborderwidth 1 \
    198             -outerpad 0
    199     } {
    200         usual
    201         ignore -highlightthickness -borderwidth
    202         rename -highlightbackground -controlbackground controlBackground \
    203             Background
    204         rename -background -controlbackground controlBackground \
    205             Background
    206     }
    207     itk_component add scroller {
    208         Rappture::Scroller $itk_component(drawer).scroller \
    209             -xscrollmode auto -yscrollmode auto \
    210             -highlightthickness 0
    211     }
    212     blt::table $itk_component(drawer) \
    213         0,0 $itk_component(titlebar) -fill x -anchor w -columnspan 2 \
    214         1,0 $itk_component(controls) -fill y -anchor n -pady 3 \
    215         1,1 $itk_component(scroller) -rowspan 2 -fill both \
    216         2,0 $itk_component(sidebar)  -fill y -anchor s
    217 
    218     $itk_component(panes) add $itk_component(drawer) -sticky nsew
    219     blt::table configure $itk_component(drawer) r0 c1 r1 c0 -resize none
    220     blt::table configure $itk_component(drawer) c2 -resize expand
    221     blt::table configure $itk_component(drawer) r2 -resize expand
    222139
    223140    eval itk_initialize $args
    224 
    225     # Two things wrong with the tk:panedwindow. 
    226     # 1. can't disable the sash.  Maybe I can hide it.
    227     # 2. can't set/force the width of a pane.
    228 
    229     $itk_component(panes) paneconfigure $itk_component(drawer) \
    230         -minsize 30
    231141}
    232142
     
    622532    }
    623533}
    624 
    625 itcl::body Rappture::VisViewer::drawer { what } {
    626     switch -- ${what} {
    627         "open" {
    628             after idle [list focus $itk_component(drawer)]
    629             set win [$itk_component(scroller) contents]
    630             set w1 [winfo reqwidth $win]
    631             set w2 [winfo reqwidth $itk_component(title)]
    632             set w [expr max($w1,$w2) + 30]
    633             set x [expr [winfo width $itk_component(panes)] - $w]
    634             $itk_component(panes) sash place 0 $x 0
    635             $itk_component(panes) paneconfigure $itk_component(drawer) \
    636                 -width $w
    637             #sash place 0 $x 0
    638             $itk_component(flipswitch) configure \
    639                 -image [Rappture::icon sbar-closed]
    640             set isOpen_ 1
    641         }
    642         "close" {
    643             $itk_component(flipswitch) configure \
    644                 -image [Rappture::icon sbar-open]
    645             set w [winfo width $itk_component(panes)]
    646             if { $w <= 1 } {
    647                 set w [winfo reqwidth $itk_component(panes)]
    648             }
    649             set x [lindex [$itk_component(panes) sash coord 0] 0]
    650             set initialized_(drawer) $x
    651             $itk_component(panes) paneconfigure $itk_component(drawer) \
    652                 -minsize 30
    653             set x [expr $w - 30]
    654             $itk_component(panes) sash place 0 $x 0
    655             set isOpen_ 0
    656         }
    657         "toggle" {
    658             if { $isOpen_ } {
    659                 drawer close
    660             } else {
    661                 drawer open
    662             }
    663         }
    664     }
    665 }
Note: See TracChangeset for help on using the changeset viewer.