Bwidget Source Code
Check-in [4f04c7bef8]
Not logged in

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 ...]).
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4f04c7bef84a1996eda81ab18f532e95a67ed283
User & Date: ericm 2000-02-17 18:37:19.000
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
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.













1
2
3
4
5
6
7













2000-02-16  Sven Delmas  <[email protected]>

	* 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.

	* tree.tcl: Changed the <KeyPress-space> binding to use "+", so it
>
>
>
>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2000-02-17  Eric Melski  <[email protected]>

	* 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  <[email protected]>

	* 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  <[email protected]>

	* 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.

	* tree.tcl: Changed the <KeyPress-space> binding to use "+", so it
Changes to notebook.tcl.
1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.5 2000/02/17 03:06:01 ericm Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert



|







1
2
3
4
5
6
7
8
9
10
11
# ------------------------------------------------------------------------------
#  notebook.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: notebook.tcl,v 1.6 2000/02/17 18:37:19 ericm Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - NoteBook::create
#     - NoteBook::configure
#     - NoteBook::cget
#     - NoteBook::compute_size
#     - NoteBook::insert
689
690
691
692
693
694
695




696
697
698
699
700
701
702
    # lookup the tab colors
    set fgt   $data(lbg)
    set fgb   $data(dbg)

    set h   $data(hpage)
    set xd  [_get_x_page $path $pos]
    set xf  [expr {$xd + $data($page,width)}]





    # Coordinates of the tab corners are:
    #     c3        c4
    #
    # c2                c5
    #
    # c1                c6







>
>
>
>







689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
    # lookup the tab colors
    set fgt   $data(lbg)
    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
    #
    # c1                c6
711
712
713
714
715
716
717







718
719
720
721
722
723
724
725
726


727
728
729

730
731
732
733
734
735
736

    set top		2
    set arcRadius	2

    if { $data(select) != $page } {
	# Non-selected pages have tabs 2 pixels lower than the selected one
	incr top 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 h1 [expr {[winfo height $path]}]
    set bd [Widget::getoption $path -borderwidth]
    if { [string equal $side "bottom"] } {

	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)
        set lt  [list 					\
		$rightPlusRadius	[expr {$h1-$h-1}]		\







>
>
>
>
>
>
>









>
>


|
>







715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750

    set top		2
    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 { $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)
        set lt  [list 					\
		$rightPlusRadius	[expr {$h1-$h-1}]		\
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
		$rightPlusRadius	$topPlusRadius		\
		$rightPlusRadius	$h			\
		]
    }

    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"] } {
	# 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
	# gets in the way)
	incr ytext [expr {$h1 - $h + 2}]







<
<
<
<
<

|







774
775
776
777
778
779
780





781
782
783
784
785
786
787
788
789
		$rightPlusRadius	$topPlusRadius		\
		$rightPlusRadius	$h			\
		]
    }

    set img [Widget::getoption $path.f$page -image]






    set ytext $top
    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
	# gets in the way)
	incr ytext [expr {$h1 - $h + 2}]