Bwidget Source Code
Check-in [4f04c7bef8]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:* 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 ...]).
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4f04c7bef84a1996eda81ab18f532e95a67ed283
User & Date: ericm 2000-02-17 18:37:19
Context
2000-02-19
02:07
Additional fixes from Eric Boudaillier. check-in: ac17439246 user: ericm tags: trunk
2000-02-17
18:37
* 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 ...]). check-in: 4f04c7bef8 user: ericm tags: trunk
03:06
* notebook.tcl: Changed appearance of tabs; leftmost tab is now flush with the left of the notebook, and the tabs look more Windows-like. check-in: affe6554cd user: ericm tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ChangeLog.

            1  +2000-02-17  Eric Melski  <[email protected]>
            2  +
            3  +	* notebook.tcl: Added an extra check to move the leftmost tab a
            4  +	touch to the right when it is not selected (again, to make the
            5  +	tabs more Windows-like).  Also replaced redundant [string equal]
            6  +	checks with a stored pre-check (ie, set foo [string equal ...]).
            7  +
            8  +2000-02-16  Eric Melski  <[email protected]>
            9  +
           10  +	* notebook.tcl: Changed appearance of tabs; leftmost tab is now 
           11  +	flush with the left of the notebook, and the tabs look more
           12  +	Windows-like.
           13  +
     1     14   2000-02-16  Sven Delmas  <[email protected]>
     2     15   
     3     16   	* dialog.tcl: Added a new parameter to the draw procedure that
     4     17   	allows me to pass in the desired geometry for the window. This was
     5     18   	needed to support tracking of dialog window geometries.
     6     19   
     7     20   	* tree.tcl: Changed the <KeyPress-space> binding to use "+", so it

Changes to notebook.tcl.

     1      1   # ------------------------------------------------------------------------------
     2      2   #  notebook.tcl
     3      3   #  This file is part of Unifix BWidget Toolkit
     4         -#  $Id: notebook.tcl,v 1.5 2000/02/17 03:06:01 ericm Exp $
            4  +#  $Id: notebook.tcl,v 1.6 2000/02/17 18:37:19 ericm Exp $
     5      5   # ------------------------------------------------------------------------------
     6      6   #  Index of commands:
     7      7   #     - NoteBook::create
     8      8   #     - NoteBook::configure
     9      9   #     - NoteBook::cget
    10     10   #     - NoteBook::compute_size
    11     11   #     - NoteBook::insert
................................................................................
   689    689       # lookup the tab colors
   690    690       set fgt   $data(lbg)
   691    691       set fgb   $data(dbg)
   692    692   
   693    693       set h   $data(hpage)
   694    694       set xd  [_get_x_page $path $pos]
   695    695       set xf  [expr {$xd + $data($page,width)}]
          696  +
          697  +    # Set the initial text offsets -- a few pixels down, centered left-to-right
          698  +    set textOffsetY 3
          699  +    set textOffsetX 9
   696    700   
   697    701       # Coordinates of the tab corners are:
   698    702       #     c3        c4
   699    703       #
   700    704       # c2                c5
   701    705       #
   702    706       # c1                c6
................................................................................
   711    715   
   712    716       set top		2
   713    717       set arcRadius	2
   714    718   
   715    719       if { $data(select) != $page } {
   716    720   	# Non-selected pages have tabs 2 pixels lower than the selected one
   717    721   	incr top 2
          722  +	if { $pos == 0 } {
          723  +	    # The leftmost page is a special case -- it is drawn with its
          724  +	    # tab a little indented.  To achieve this, we incr xd.  We also
          725  +	    # decr textOffsetX, so that the text doesn't move left/right.
          726  +	    incr xd 2
          727  +	    incr textOffsetX -2
          728  +	}
   718    729       }
   719    730   
   720    731       # Precompute some coord values that we use a lot
   721    732       set topPlusRadius	[expr {$top + $arcRadius}]
   722    733       set rightPlusRadius	[expr {$xf + $arcRadius}]
   723    734       set leftPlusRadius	[expr {$xd + $arcRadius}]
   724    735   
   725    736       # Sven
   726    737       set side [Widget::getoption $path -side]
          738  +    set tabsOnBottom [string equal $side "bottom"]
          739  +
   727    740       set h1 [expr {[winfo height $path]}]
   728    741       set bd [Widget::getoption $path -borderwidth]
   729         -    if { [string equal $side "bottom"] } {
          742  +
          743  +    if { $tabsOnBottom } {
   730    744   	set top [expr {$top * -1}]
   731    745   	set topPlusRadius [expr {$topPlusRadius * -1}]
   732    746   	# Hrm... the canvas has an issue with drawing diagonal segments
   733    747   	# of lines from the bottom to the top, so we have to draw this line
   734    748   	# backwards (ie, lt is actually the bottom, drawn from right to left)
   735    749           set lt  [list 					\
   736    750   		$rightPlusRadius	[expr {$h1-$h-1}]		\
................................................................................
   760    774   		$rightPlusRadius	$topPlusRadius		\
   761    775   		$rightPlusRadius	$h			\
   762    776   		]
   763    777       }
   764    778   
   765    779       set img [Widget::getoption $path.f$page -image]
   766    780   
   767         -    # Text on the tab is down a few pixels from the top of the tab, and
   768         -    # centered left-to-right.
   769         -    set textOffsetY 3
   770         -    set textOffsetX 9
   771         -
   772    781       set ytext $top
   773         -    if { [string equal $side "bottom"] } {
          782  +    if { $tabsOnBottom } {
   774    783   	# The "+ 2" below moves the text closer to the bottom of the tab,
   775    784   	# so it doesn't look so cramped.  I should be able to achieve the
   776    785   	# same goal by changing the anchor of the text and using this formula:
   777    786   	# ytext = $top + $h1 - $textOffsetY
   778    787   	# but that doesn't quite work (I think the linespace from the text
   779    788   	# gets in the way)
   780    789   	incr ytext [expr {$h1 - $h + 2}]