Changeset 1391


Ignore:
Timestamp:
Apr 12, 2009 11:35:49 AM (15 years ago)
Author:
mmc
Message:

Final touches on the sidebar:

  • click tabs to open/close
  • added tooltips to tabs
  • fixed highlight thickness for buttons in control area
  • added padding above first control button
  • snap to close when sidebar is too small
  • sidebar never resize sash never gets lost when window is sized smaller
  • new icons for volume & cutplane in nanovis sidebar
  • added "show volume" control to volume options in nanovis sidebar
Location:
trunk/gui/scripts
Files:
2 added
7 edited

Legend:

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

    r1377 r1391  
    217217    itk_component add reset {
    218218        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
     219            -highlightthickness 0 \
    219220            -image [Rappture::icon reset-view] \
    220221            -command [itcl::code $this Zoom reset]
     222    } {
     223        usual
     224        ignore -highlightthickness
    221225    }
    222226    pack $itk_component(reset) -side top -padx 2 -pady 2
     
    225229    itk_component add zoomin {
    226230        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
     231            -highlightthickness 0 \
    227232            -image [Rappture::icon zoom-in] \
    228233            -command [itcl::code $this Zoom in]
     234    } {
     235        usual
     236        ignore -highlightthickness
    229237    }
    230238    pack $itk_component(zoomin) -side top -padx 2 -pady 2
     
    233241    itk_component add zoomout {
    234242        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
     243            -highlightthickness 0 \
    235244            -image [Rappture::icon zoom-out] \
    236245            -command [itcl::code $this Zoom out]
     246    } {
     247        usual
     248        ignore -highlightthickness
    237249    }
    238250    pack $itk_component(zoomout) -side top -padx 2 -pady 2
  • trunk/gui/scripts/heightmapviewer.tcl

    r1376 r1391  
    147147    itk_component add reset {
    148148        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
     149            -highlightthickness 0 \
    149150            -image [Rappture::icon reset-view] \
    150151            -command [itcl::code $this _zoom reset]
     152    } {
     153        usual
     154        ignore -highlightthickness
    151155    }
    152156    pack $itk_component(reset) -side top -padx 1 -pady { 4 0 }
     
    155159    itk_component add zoomin {
    156160        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
     161            -highlightthickness 0 \
    157162            -image [Rappture::icon zoom-in] \
    158163            -command [itcl::code $this _zoom in]
     164    } {
     165        usual
     166        ignore -highlightthickness
    159167    }
    160168    pack $itk_component(zoomin) -side top -padx 1 -pady { 4 0 }
     
    163171    itk_component add zoomout {
    164172        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
     173            -highlightthickness 0 \
    165174            -image [Rappture::icon zoom-out] \
    166175            -command [itcl::code $this _zoom out]
     176    } {
     177        usual
     178        ignore -highlightthickness
    167179    }
    168180    pack $itk_component(zoomout) -side top -padx 1 -pady { 4 }
  • trunk/gui/scripts/molvisviewer.tcl

    r1388 r1391  
    195195    itk_component add reset {
    196196        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
     197            -highlightthickness 0 \
    197198            -image [Rappture::icon reset-view] \
    198199            -command [itcl::code $this ResetView]
     200    } {
     201        usual
     202        ignore -highlightthickness
    199203    }
    200204    pack $itk_component(reset) -padx 1 -pady 2
     
    204208    itk_component add zoomin {
    205209        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
     210            -highlightthickness 0 \
    206211            -image [Rappture::icon zoom-in] \
    207212            -command [itcl::code $this _zoom in]
    208     }
    209     pack $itk_component(zoomin) -padx 2 -pady { 0 2 }
     213    } {
     214        usual
     215        ignore -highlightthickness
     216    }
     217    pack $itk_component(zoomin) -padx 2 -pady 2
    210218    Rappture::Tooltip::for $itk_component(zoomin) "Zoom in"
    211219
    212220    itk_component add zoomout {
    213221        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
     222            -highlightthickness 0 \
    214223            -image [Rappture::icon zoom-out] \
    215224            -command [itcl::code $this _zoom out]
    216     }
    217     pack $itk_component(zoomout) -padx 2 -pady { 0 2 }
     225    } {
     226        usual
     227        ignore -highlightthickness
     228    }
     229    pack $itk_component(zoomout) -padx 2 -pady 2
    218230    Rappture::Tooltip::for $itk_component(zoomout) "Zoom out"
    219231
     
    222234            -relief "raised" -image [Rappture::icon atom-label]
    223235    }
    224     pack $itk_component(labels) -padx 2 -pady { 0 2} -ipadx 1 -ipady 1
     236    pack $itk_component(labels) -padx 2 -pady {6 2} -ipadx 1 -ipady 1
    225237    Rappture::Tooltip::for $itk_component(labels) \
    226238        "Show/hide the labels on atoms"
     
    232244            -relief "raised" -image [Rappture::icon rock-view]
    233245    }
    234     pack $itk_component(rock) -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
     246    pack $itk_component(rock) -padx 2 -pady 2 -ipadx 1 -ipady 1
    235247    Rappture::Tooltip::for $itk_component(rock) "Rock model back and forth"
    236248
     
    243255            -relief "raised" -image [Rappture::icon 3dpers]
    244256    }
    245     pack $itk_component(ortho) -padx 2 -pady { 0 2 } -ipadx 1 -ipady 1
     257    pack $itk_component(ortho) -padx 2 -pady 2 -ipadx 1 -ipady 1
    246258    Rappture::Tooltip::for $itk_component(ortho) \
    247259        "Change to orthoscopic projection"
  • trunk/gui/scripts/nanovisviewer.tcl

    r1390 r1391  
    201201    itk_component add reset {
    202202        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
     203            -highlightthickness 0 \
    203204            -image [Rappture::icon reset-view] \
    204205            -command [itcl::code $this Zoom reset]
     206    } {
     207        usual
     208        ignore -highlightthickness
    205209    }
    206210    pack $itk_component(reset) -side top -padx 2 -pady 2
     
    209213    itk_component add zoomin {
    210214        button $f.zin -borderwidth 1 -padx 1 -pady 1 \
     215            -highlightthickness 0 \
    211216            -image [Rappture::icon zoom-in] \
    212217            -command [itcl::code $this Zoom in]
     218    } {
     219        usual
     220        ignore -highlightthickness
    213221    }
    214222    pack $itk_component(zoomin) -side top -padx 2 -pady 2
     
    217225    itk_component add zoomout {
    218226        button $f.zout -borderwidth 1 -padx 1 -pady 1 \
     227            -highlightthickness 0 \
    219228            -image [Rappture::icon zoom-out] \
    220229            -command [itcl::code $this Zoom out]
     230    } {
     231        usual
     232        ignore -highlightthickness
    221233    }
    222234    pack $itk_component(zoomout) -side top -padx 2 -pady 2
     
    227239    #
    228240    itk_component add volume {
    229         label $f.volume -borderwidth 1 -relief sunken -padx 1 -pady 1 \
    230             -text "Volume" \
    231             -image [Rappture::icon playback-record]
     241        label $f.volume -borderwidth 1 -relief sunken \
     242            -image [Rappture::icon volume-on]
    232243    }
    233244    bind $itk_component(volume) <ButtonPress> \
     
    235246    Rappture::Tooltip::for $itk_component(volume) \
    236247        "Toggle the volume cloud on/off"
    237     pack $itk_component(volume) -padx 2 -pady 2
     248    pack $itk_component(volume) -ipadx 1 -ipady 1 -padx 2 -pady 2
    238249
    239250    BuildViewTab
     
    16681679    set inner [$itk_component(main) insert end \
    16691680        -title "Volume Settings" \
    1670         -icon [Rappture::icon playback-record]]
     1681        -icon [Rappture::icon volume-on]]
    16711682    $inner configure -borderwidth 4
    16721683
    16731684    set fg [option get $itk_component(hull) font Font]
    16741685    #set bfg [option get $itk_component(hull) boldFont Font]
     1686
     1687    checkbutton $inner.vol -text "Show volume" -font $fg \
     1688        -variable [itcl::scope settings_($this-volume)] \
     1689        -command [itcl::code $this FixSettings volume]
     1690    label $inner.shading -text "Shading:" -font $fg
    16751691
    16761692    label $inner.dim -text "Dim" -font $fg
     
    17031719
    17041720    blt::table $inner \
    1705         0,0 $inner.dim  -anchor e -pady 2 \
    1706         0,1 $inner.light -columnspan 2 -pady 2 -fill x \
    1707         0,3 $inner.bright -anchor w -pady 2 \
    1708         1,0 $inner.fog -anchor e -pady 2 \
    1709         1,1 $inner.transp -columnspan 2 -pady 2 -fill x \
    1710         1,3 $inner.plastic -anchor w -pady 2 \
    1711         2,0 $inner.clear -anchor e -pady 2 \
    1712         2,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
    1713         2,3 $inner.opaque -anchor w -pady 2 \
    1714         3,0 $inner.thin -anchor e -pady 2 \
    1715         3,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
    1716         3,3 $inner.thick -anchor w -pady 2
     1721        0,0 $inner.vol -columnspan 4 -anchor w -pady 2 \
     1722        1,0 $inner.shading -columnspan 4 -anchor w -pady {10 2} \
     1723        2,0 $inner.dim -anchor e -pady 2 \
     1724        2,1 $inner.light -columnspan 2 -pady 2 -fill x \
     1725        2,3 $inner.bright -anchor w -pady 2 \
     1726        3,0 $inner.fog -anchor e -pady 2 \
     1727        3,1 $inner.transp -columnspan 2 -pady 2 -fill x \
     1728        3,3 $inner.plastic -anchor w -pady 2 \
     1729        4,0 $inner.clear -anchor e -pady 2 \
     1730        4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
     1731        4,3 $inner.opaque -anchor w -pady 2 \
     1732        5,0 $inner.thin -anchor e -pady 2 \
     1733        5,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
     1734        5,3 $inner.thick -anchor w -pady 2
    17171735
    17181736    blt::table configure $inner c0 c1 c3 r* -resize none
    1719     blt::table configure $inner r4 -resize expand
     1737    blt::table configure $inner r6 -resize expand
    17201738}
    17211739
     
    19351953            if {$op} {
    19361954                SendCmd "volume data state on [CurrentVolumeIds]"
    1937                 $itk_component(volume) configure -relief sunken
     1955                $itk_component(volume) configure -relief sunken \
     1956                    -image [Rappture::icon volume-on]
    19381957                set settings_($this-volume) 1
    19391958            } else {
    19401959                SendCmd "volume data state off [CurrentVolumeIds]"
    1941                 $itk_component(volume) configure -relief raised
     1960                $itk_component(volume) configure -relief raised \
     1961                    -image [Rappture::icon volume-off]
    19421962                set settings_($this-volume) 0
    19431963            }
  • trunk/gui/scripts/sidebarframe.tcl

    r1376 r1391  
    4545    public method pop {what}
    4646
     47    protected method _toggleTab {which}
    4748    protected method _sash {op x}
    4849    protected method _fixLayout {args}
     
    185186        rename -background -controlbackground controlBackground Background
    186187    }
    187     pack $itk_component(controls) -side top -pady {0 20}
     188    pack $itk_component(controls) -side top -pady {8 20}
    188189
    189190    #
     
    235236    $itk_component(tabs) insert end $pname \
    236237        -image $panel(-icon) -text "" -padx 0 -pady 0 \
    237         -command [itcl::code $this select $pname]
     238        -command [itcl::code $this _toggleTab $pname]
     239
     240    Rappture::Tooltip::text $itk_component(tabs)-$pname \
     241        "Open/close sidebar for $panel(-title)"
     242    $itk_component(tabs) bind $pname <Enter> \
     243        [list ::Rappture::Tooltip::tooltip pending %W-$pname @%X,%Y]
     244    $itk_component(tabs) bind $pname <Leave> \
     245        [list ::Rappture::Tooltip::tooltip cancel]
     246    $itk_component(tabs) bind $pname <ButtonPress> \
     247        [list ::Rappture::Tooltip::tooltip cancel]
     248    $itk_component(tabs) bind $pname <KeyPress> \
     249        [list ::Rappture::Tooltip::tooltip cancel]
    238250
    239251    set _panels($pname-title) $panel(-title)
     
    314326    if {$_state == "closed"} {
    315327        pop open
    316     } else {
    317         set minw [winfo reqwidth $itk_component(controlbar)]
    318         if {$_width < $minw+50} {
    319             set _width [expr {$minw+50}]
    320             $_dispatcher event -idle !layout
    321         }
     328    }
     329
     330    set minw [winfo reqwidth $itk_component(controlbar)]
     331    if {$_width != "auto" && $_width < $minw+50} {
     332        set _width [expr {$minw+50}]
     333        $_dispatcher event -idle !layout
    322334    }
    323335    set n [$itk_component(tabs) index -name $pname]
     
    385397
    386398# ----------------------------------------------------------------------
     399# USAGE: _toggleTab <which>
     400#
     401# Invoked automatically when the user clicks on a tab for the sidebar.
     402# If the sidebar is closed, it is automatically opened and the tab is
     403# selected.  If the sidebar is opened, then it's closed.
     404# ----------------------------------------------------------------------
     405itcl::body Rappture::SidebarFrame::_toggleTab {which} {
     406    if {$_state == "closed"} {
     407        pop open
     408        select $which
     409    } elseif {[$itk_component(tabs) index -name $_selected]
     410          == [$itk_component(tabs) index -name $which]} {
     411        pop close
     412    } else {
     413        select $which
     414    }
     415}
     416
     417# ----------------------------------------------------------------------
    387418# USAGE: _sash <op> <X>
    388419#
     
    418449        }
    419450        release {
     451            set minw [winfo reqwidth $itk_component(controlbar)]
     452            if {$_width-$minw < 40} {
     453                set _width "auto"
     454                pop close
     455            }
    420456        }
    421457        default {
     
    454490            }
    455491            set sbarw [expr {$sbarw + $ctrlw + $sashw}]
    456 
    457             # don't let the sidebar take up too much of the window area
    458             if {$sbarw > 0.75*$w} {
    459                 set sbarw [expr {int(0.75*$w)}]
    460             }
    461492        } else {
    462493            set sbarw $_width
    463494        }
     495    }
     496
     497    # don't let the sidebar take up too much of the window area
     498    if {$sbarw > 0.75*$w} {
     499        set sbarw [expr {int(0.75*$w)}]
    464500    }
    465501
  • trunk/gui/scripts/xyresult.tcl

    r1375 r1391  
    149149    itk_component add reset {
    150150        button $f.reset -borderwidth 1 -padx 1 -pady 1 \
     151            -highlightthickness 0 \
    151152            -image [Rappture::icon reset-view] \
    152153            -command [itcl::code $this _zoom reset]
    153154    } {
    154155        usual
    155         ignore -borderwidth
     156        ignore -borderwidth -highlightthickness
    156157    }
    157158    pack $itk_component(reset) -padx 4 -pady 2 -anchor e
Note: See TracChangeset for help on using the changeset viewer.