Index: ChangeLog ================================================================== --- ChangeLog +++ ChangeLog @@ -1,5 +1,18 @@ +2000-02-17 Eric Melski + + * notebook.tcl: Added an extra check to move the leftmost tab a + touch to the right when it is not selected (again, to make the + tabs more Windows-like). Also replaced redundant [string equal] + checks with a stored pre-check (ie, set foo [string equal ...]). + +2000-02-16 Eric Melski + + * notebook.tcl: Changed appearance of tabs; leftmost tab is now + flush with the left of the notebook, and the tabs look more + Windows-like. + 2000-02-16 Sven Delmas * dialog.tcl: Added a new parameter to the draw procedure that allows me to pass in the desired geometry for the window. This was needed to support tracking of dialog window geometries. Index: notebook.tcl ================================================================== --- notebook.tcl +++ notebook.tcl @@ -1,9 +1,9 @@ # ------------------------------------------------------------------------------ # notebook.tcl # This file is part of Unifix BWidget Toolkit -# $Id: notebook.tcl,v 1.5 2000/02/17 03:06:01 ericm Exp $ +# $Id: notebook.tcl,v 1.6 2000/02/17 18:37:19 ericm Exp $ # ------------------------------------------------------------------------------ # Index of commands: # - NoteBook::create # - NoteBook::configure # - NoteBook::cget @@ -691,10 +691,14 @@ set fgb $data(dbg) set h $data(hpage) set xd [_get_x_page $path $pos] set xf [expr {$xd + $data($page,width)}] + + # Set the initial text offsets -- a few pixels down, centered left-to-right + set textOffsetY 3 + set textOffsetX 9 # Coordinates of the tab corners are: # c3 c4 # # c2 c5 @@ -713,22 +717,32 @@ set arcRadius 2 if { $data(select) != $page } { # Non-selected pages have tabs 2 pixels lower than the selected one incr top 2 + if { $pos == 0 } { + # The leftmost page is a special case -- it is drawn with its + # tab a little indented. To achieve this, we incr xd. We also + # decr textOffsetX, so that the text doesn't move left/right. + incr xd 2 + incr textOffsetX -2 + } } # Precompute some coord values that we use a lot set topPlusRadius [expr {$top + $arcRadius}] set rightPlusRadius [expr {$xf + $arcRadius}] set leftPlusRadius [expr {$xd + $arcRadius}] # Sven set side [Widget::getoption $path -side] + set tabsOnBottom [string equal $side "bottom"] + set h1 [expr {[winfo height $path]}] set bd [Widget::getoption $path -borderwidth] - if { [string equal $side "bottom"] } { + + if { $tabsOnBottom } { set top [expr {$top * -1}] set topPlusRadius [expr {$topPlusRadius * -1}] # Hrm... the canvas has an issue with drawing diagonal segments # of lines from the bottom to the top, so we have to draw this line # backwards (ie, lt is actually the bottom, drawn from right to left) @@ -762,17 +776,12 @@ ] } set img [Widget::getoption $path.f$page -image] - # Text on the tab is down a few pixels from the top of the tab, and - # centered left-to-right. - set textOffsetY 3 - set textOffsetX 9 - set ytext $top - if { [string equal $side "bottom"] } { + if { $tabsOnBottom } { # The "+ 2" below moves the text closer to the bottom of the tab, # so it doesn't look so cramped. I should be able to achieve the # same goal by changing the anchor of the text and using this formula: # ytext = $top + $h1 - $textOffsetY # but that doesn't quite work (I think the linespace from the text