Tk Library Source Code

Artifact [3f368740fd]
Login

Artifact 3f368740fdaa9a2fc758121d7a940acfb9a2e738:

Attachment "bwdiffs" to ticket [483838ffff] added by decosterjos 2001-11-20 23:24:37.
Index: tree.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/tree.tcl,v
retrieving revision 1.33
diff -r1.33 tree.tcl
786c786,787
< proc Tree::opentree { path node } {
---
> # JDC: added option recursive
> proc Tree::opentree { path node {recursive 1} } {
794c795
<     _recexpand $path $node 1 [Widget::getoption $path -opencmd]
---
>     _recexpand $path $node 1 $recursive [Widget::getoption $path -opencmd]
802c803
< proc Tree::closetree { path node } {
---
> proc Tree::closetree { path node {recursive 1} } {
810c811
<     _recexpand $path $node 0 [Widget::getoption $path -closecmd]
---
>     _recexpand $path $node 0 $recursive [Widget::getoption $path -closecmd]
999c1000,1001
< proc Tree::_recexpand { path node expand cmd } {
---
> # JDC : added option recursive
> proc Tree::_recexpand { path node expand recursive cmd } {
1010,1011c1012,1015
<     foreach subnode [lrange $data($node) 1 end] {
<         _recexpand $path $subnode $expand $cmd
---
>     if { $recursive } {
> 	foreach subnode [lrange $data($node) 1 end] {
> 	    _recexpand $path $subnode $expand $recursive $cmd
> 	}
Index: dialog.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/dialog.tcl,v
retrieving revision 1.8
diff -r1.8 dialog.tcl
21a22,23
> # JDC: added -transient and -place flag
> 
40a43,44
>         {-transient   Boolean    1        1}
>         {-place       Enum       center   0 {none center left right above below}}
90c94,97
<     wm transient $path [winfo toplevel $parent]
---
>    # JDC: made transient optional
>     if { [Widget::getoption $path -transient] } {
> 	wm transient $path [winfo toplevel $parent]
>     }
253,257c260,267
<         if { [winfo exists $parent] } {
<             BWidget::place $path 0 0 center $parent
<         } else {
<             BWidget::place $path 0 0 center
<         }
---
> 	set place [Widget::getoption $path -place]
> 	if { ![string equal $place none] } {
> 	    if { [winfo exists $parent] } {
> 		BWidget::place $path 0 0 $place $parent
> 	    } else {
> 		BWidget::place $path 0 0 $place
> 	    }
> 	}
Index: listbox.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/listbox.tcl,v
retrieving revision 1.4
diff -r1.4 listbox.tcl
43a44
> # JDC: added -selectmode
86c87
< 
---
> 	{-selectmode       Enum none 1 {none single multiple}}
149a151,165
>     switch -exact -- [Widget::getoption $path -selectmode] {
> 	single {
> 	    $path bindText <Button-1> [list $path selection set]
> 	    $path bindImage <Button-1> [list $path selection set]
> 	}
> 	multiple {
> 	    $path bindText <Button-1>         [list ListBox::_multiple_select $path n]
> 	    $path bindText <Control-Button-1> [list ListBox::_multiple_select $path c]
> 	    $path bindText <Shift-Button-1>   [list ListBox::_multiple_select $path s]
> 	    $path bindImage <Button-1>         [list ListBox::_multiple_select $path n]
> 	    $path bindImage <Control-Button-1> [list ListBox::_multiple_select $path c]
> 	    $path bindImage <Shift-Button-1>   [list ListBox::_multiple_select $path s]
> 	}
>     }
> 
1282a1299,1352
> }
> 
> # ------------------------------------------------------------------------------
> #  Command ListBox::_multiple_select
> # ------------------------------------------------------------------------------
> proc ListBox::_multiple_select { path mode idx } {
> 
>     variable $path
>     upvar 0  $path data
> 
> 
>     if { ![info exists data(anchor)] || ![info exists data(sel_anchor)] } {
> 	set data(anchor) $idx
> 	set data(sel_anchor) {}
>     }
> 
>     switch -exact -- $mode {
> 	n {
> 	    $path selection set $idx
> 	    set data(anchor) $idx
> 	    set data(sel_anchor) {}
> 	}
> 	c {
> 	    set l [$path selection get]
> 	    if { [lsearch -exact $l $idx] >= 0 } {
> 		$path selection remove $idx
> 	    } else {
> 		$path selection add $idx
> 	    }
> 	    set data(anchor) $idx
> 	    set data(sel_anchor) {}
> 	}
> 	s {
> 	    eval $path selection remove $data(sel_anchor)
> 
>   	    if { $idx > $data(anchor) } {
>   		set istart $data(anchor)
>   		set iend $idx
>   	    } else {
>   		set istart $idx
>   		set iend $data(anchor)
>   	    }
> 
>   	    for { set i $istart } { $i <= $iend } { incr i } {
>   		set l [$path selection get]
>   		set li [lsearch -exact $l $i]
> 		if { $li < 0 } {
> 		    $path selection add $i
> 		    lappend data(sel_anchor) $i
>  		}
>   	    }
>         }
>     }
> 
Index: widget.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/widget.tcl,v
retrieving revision 1.17
diff -r1.17 widget.tcl
982c982,983
<                 set def [lindex [lindex $config $idx] 3]
---
> 		# JDC: used 4 (was 3) to get def from optiondb
>                 set def [lindex [lindex $config $idx] 4]
985c986,987
<                 set def [lindex $optlist 3]
---
> 		# JDC: used 4 (was 3) to get def from optiondb
>                 set def [lindex $optlist 4]
Index: progressbar.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/progressbar.tcl,v
retrieving revision 1.5
diff -r1.5 progressbar.tcl
15c15
<         {-type        Enum       normal     0 {normal incremental infinite}}
---
>         {-type        Enum       normal     0 {normal incremental infinite nonincremental_infinite}}
151,193c151,183
<         place $path.bar -relx 0 -rely 0 -relwidth 1 -relheight 1
<         set type [Widget::getoption $path -type]
<         if { $val != 0 && [string compare $type "normal"] } {
<             set val [expr {$val+$_widget($path,val)}]
<         }
<         set _widget($path,val) $val
<         set max [Widget::getoption $path -maximum]
<         set bd  [expr {2*[$path.bar cget -bd]}]
<         set w   [winfo width  $path.bar]
<         set h   [winfo height $path.bar]
<         if { ![string compare $type "infinite"] } {
<             if { $val > $max } {
<                 set _widget($path,dir) [expr {-$_widget($path,dir)}]
<                 set val 0
<                 set _widget($path,val) 0
<             }
<             if { $val <= $max/2.0 } {
<                 set dx0 0.0
<                 set dx1 [expr {double($val)/$max}]
<             } else {
<                 set dx1 [expr {double($val)/$max}]
<                 set dx0 [expr {$dx1-0.5}]
<             }
<             if { $_widget($path,dir) == 1 } {
<                 set x0 $dx0
<                 set x1 $dx1
<             } else {
<                 set x0 [expr {1-$dx1}]
<                 set x1 [expr {1-$dx0}]
<             }
<             if { ![string compare [Widget::getoption $path -orient] "horizontal"] } {
<                 $path.bar coords rect [expr {$x0*$w}] 0 [expr {$x1*$w}] $h
<             } else {
<                 $path.bar coords rect 0 [expr {$h-$x0*$h}] $w [expr {$x1*$h}]
<             }
<         } else {
<             if { $val > $max } {set val $max}
<             if { ![string compare [Widget::getoption $path -orient] "horizontal"] } {
<                 $path.bar coords rect -1 0 [expr {$val*$w/$max}] $h
<             } else {
<                 $path.bar coords rect 0 [expr {$h+1}] $w [expr {$h*($max-$val)}]
<             }
<         }
---
> 	    place $path.bar -relx 0 -rely 0 -relwidth 1 -relheight 1
> 	    set type [Widget::getoption $path -type]
> 	    if { $val != 0 && [string compare $type "normal"] && [string compare $type "nonincremental_infinite"]} {
> 		set val [expr {$val+$_widget($path,val)}]
> 	    }
> 	    set _widget($path,val) $val
> 	    set max [Widget::getoption $path -maximum]
> 	    set bd  [expr {2*[$path.bar cget -bd]}]
> 	    set w   [winfo width  $path.bar]
> 	    set h   [winfo height $path.bar]
> 	    if { ![string compare $type "infinite"] || ![string compare $type "nonincremental_infinite"]} {
> 		# JDC: New infinite behaviour
> 		set tval [expr {$val % $max}]
> 		if { $tval < ($max / 2.0) } {
> 		    set x0 [expr {double($tval) / double($max) * 1.5}]
> 		} else {
> 		    set x0 [expr {(1.0 - (double($tval) / double($max))) * 1.5}]
> 		}
> 		set x1 [expr {$x0 + 0.25}]
> 		if { ![string compare [Widget::getoption $path -orient] "horizontal"] } {
> 		    $path.bar coords rect [expr {$x0*$w}] 0 [expr {$x1*$w}] $h
> 		} else {
> 		    $path.bar coords rect 0 [expr {$h-$x0*$h}] $w [expr {$x1*$h}]
> 		}
> 		
> 	    } else {
> 		if { $val > $max } {set val $max}
> 		if { ![string compare [Widget::getoption $path -orient] "horizontal"] } {
> 		    $path.bar coords rect -1 0 [expr {$val*$w/$max}] $h
> 		} else {
> 		    $path.bar coords rect 0 [expr {$h+1}] $w [expr {$h*($max-$val)}]
> 		}
> 	    }
Index: panedw.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/panedw.tcl,v
retrieving revision 1.6
diff -r1.6 panedw.tcl
10a11
> #     - PanedWindow::_apply_weights
17a19,22
> # JDC: added option to choose behavior of weights
> #    -weights extra : only apply weights to extra space (as current (>= 1.3.1) with grid command)
> #    -weights available : apply weights to total available space (as before (<1.3.1) with place command)
> 
27,30c32,35
<         {-side       Enum       top 1 {top left bottom right}}
<         {-width      Int        10  1 "%d >=3"}
<         {-pad        Int        4   1 "%d >= 0"}
<         {-background TkResource ""  0 frame}
---
>         {-side       Enum       top   1 {top left bottom right}}
>         {-width      Int        10    1 "%d >=3"}
>         {-pad        Int        4     1 "%d >= 0"}
>         {-background TkResource ""    0 frame}
32c37,38
<         {-activator  Enum       ""  1 {line button}}
---
>         {-activator  Enum       ""    1 {line button}}
> 	{-weights    Enum       extra 1 {extra available}}
106,109c112,118
<     set wbut  [Widget::getoption $path -width]
<     set pad   [Widget::getoption $path -pad]
<     set width [expr {$wbut+2*$pad}]
<     set side  [Widget::getoption $path -side]
---
>     set wbut   [Widget::getoption $path -width]
>     set pad    [Widget::getoption $path -pad]
>     set width  [expr {$wbut+2*$pad}]
>     set side   [Widget::getoption $path -side]
>     set weight [Widget::getoption $path.f$num -weight]
>     lappend _panedw($path,weights) $weight
> 
181,182c190
<         grid columnconfigure $path [expr {2*$num}] \
<             -weight  [Widget::getoption $path.f$num -weight]
---
>         grid columnconfigure $path [expr {2*$num}] -weight $weight
185,186c193
<         grid rowconfigure $path [expr {2*$num}] \
<             -weight  [Widget::getoption $path.f$num -weight]
---
>         grid rowconfigure $path [expr {2*$num}] -weight $weight
334a342,376
> 
>     _apply_weights $path
> }
> 
> # ------------------------------------------------------------------------------
> #  Command PanedWindow::apply_weights
> # ------------------------------------------------------------------------------
> proc PanedWindow::_apply_weights { path } {
>     variable _panedw
> 
>     set weights [Widget::getoption $path -weights]
>     if { ![string compare $weights "extra"] } {
> 	return
>     }
> 
>     set side   [Widget::getoption $path -side]
>     if { ![string compare $side "top"] || ![string compare $side "bottom"] } {
> 	set size width
>     } else {
> 	set size height
>     }
>     set wsash [expr {[Widget::getoption $path -width] + 2*[Widget::getoption $path -pad]}]
>     set rs [winfo $size $path]
>     set s [expr {$rs - ($_panedw($path,nbpanes) - 1) * $wsash}]
>     
>     set tw 0.0
>     foreach w $_panedw($path,weights) { 
> 	set tw [expr {$tw + $w}]
>     }
> 
>     for {set i 0} {$i < $_panedw($path,nbpanes)} {incr i} {
> 	set rw [lindex $_panedw($path,weights) $i]
> 	set ps [expr {int($rw / $tw * $s)}]
> 	$path.f$i configure -$size $ps
>     }