diff options
author | dgp <dgp@users.sourceforge.net> | 2008-03-07 22:03:48 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-03-07 22:03:48 (GMT) |
commit | abeca9f86cbf45c1fcbd44bb4f5a067710067769 (patch) | |
tree | 5471231cdcce67f768a7048f92e5a2523c7bcf8e | |
parent | fb0ca837014f85eeb26877b0589a2d83b2ecf7a5 (diff) | |
download | tk-abeca9f86cbf45c1fcbd44bb4f5a067710067769.zip tk-abeca9f86cbf45c1fcbd44bb4f5a067710067769.tar.gz tk-abeca9f86cbf45c1fcbd44bb4f5a067710067769.tar.bz2 |
merge updates from HEAD
-rw-r--r-- | ChangeLog | 52 | ||||
-rw-r--r-- | changes | 6 | ||||
-rw-r--r-- | doc/ttk_combobox.n | 5 | ||||
-rw-r--r-- | doc/ttk_notebook.n | 44 | ||||
-rw-r--r-- | doc/ttk_scale.n | 102 | ||||
-rw-r--r-- | generic/ttk/ttkPanedwindow.c | 13 | ||||
-rw-r--r-- | library/demos/knightstour.tcl | 247 | ||||
-rw-r--r-- | library/demos/widget | 3 | ||||
-rw-r--r-- | library/ttk/combobox.tcl | 4 | ||||
-rw-r--r-- | macosx/tkAboutDlg.r | 8 | ||||
-rw-r--r-- | macosx/tkMacOSXDraw.c | 38 | ||||
-rw-r--r-- | tests/ttk/combobox.test | 24 | ||||
-rw-r--r-- | unix/README | 239 |
13 files changed, 608 insertions, 177 deletions
@@ -1,11 +1,57 @@ -2008-02-04 Donal K. Fellows <donal.k.fellows@man.ac.uk> +2008-03-06 Joe English <jenglish@users.sourceforge.net> + + * doc/ttk_notebook.n: Move "TAB IDENTIFIERS" section + above "WIDGET COMMAND" section [Bug 1882011]. + +2008-02-29 Pat Thoyts <patthoyts@users.sourceforge.net> + + * library/demos/widget: Added a Knight's tour canvas demo. + * library/demos/knightstour.tcl: + +2008-02-27 Daniel Steffen <das@users.sourceforge.net> + + * macosx/tkMacOSXDraw.c: workaround leak in Carbon SetPortPenPixPat() + API [Bug 1863346]; avoid repeated PixPat allocation/deallocation. + +2008-02-23 Joe English <jenglish@users.sourceforge.net> + + * library/ttk/combobox.tcl, doc/ttk_combobox.n, + tests/ttk/combobox.test: Arrange to deliver <<ComboboxSelected>> + event after listbox is unposted, as intended [Bug 1890211]. + Clarified documentation. + +2008-02-23 Joe English <jenglish@users.sourceforge.net> + + * generic/ttk/ttkPanedWindow.c: Don't enforce minimum sash + thickness of 5 pixels, just use 5 as a default [FR 1898288] + +2008-02-14 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * unix/README: Documented missing configure flags. + +2008-02-06 Donal K. Fellows <donal.k.fellows@man.ac.uk> + + * doc/ttk_scale.n (new file): Added basic documentation. [Bug 1881925] + +2008-02-04 Don Porter <dgp@users.sourceforge.net> *** 8.5.1 TAGGED FOR RELEASE *** + * generic/tk.h: Bump to 8.5.1 for release. + * library/tk.tcl: + * unix/configure.in: + * unix/tk.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + +2008-02-04 Donal K. Fellows <donal.k.fellows@man.ac.uk> + * doc/MeasureChar.3, doc/FontId.3: Minor improvements (formatting, keywords). -2007-02-02 Daniel Steffen <das@users.sourceforge.net> +2008-02-02 Daniel Steffen <das@users.sourceforge.net> * macosx/Wish-Info.plist.in: add CFBundleLocalizations key, listing * unix/configure.in (Darwin): all library/msgs locales. @@ -21,7 +67,7 @@ 2008-02-01 Reinhard Max <max@suse.de> - * generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2006-4484). + * generic/tkImgGIF.c: Fixed a buffer overflow (CVE-2008-0553). * tests/imgPhoto.test: Added a test for the above. 2008-01-31 Jeff Hobbs <jeffh@ActiveState.com> @@ -2,7 +2,7 @@ This file summarizes all changes made to Tk since version 1.0 was released on March 13, 1991. Changes that aren't backward compatible are marked specially. -RCS: @(#) $Id: changes,v 1.107.2.8 2008/02/01 22:14:18 dgp Exp $ +RCS: @(#) $Id: changes,v 1.107.2.9 2008/03/07 22:03:48 dgp Exp $ 3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from the interpreter when the main window is deleted (otherwise there will @@ -6480,6 +6480,6 @@ Several documentation and release notes improvements 2008-01-31 (bug fix)[1881892] messagebox default title (hobbs) -2008-02-01 (bug fix)[CVE-2006-4484] buffer overflow in GIF format (max) +2008-02-01 (bug fix)[CVE-2008-0553] buffer overflow in GIF format (max) ---- Released 8.5.1, February 1, 2008 --- See ChangeLog for details --- +--- Released 8.5.1, February 5, 2008 --- See ChangeLog for details --- diff --git a/doc/ttk_combobox.n b/doc/ttk_combobox.n index b1ccc60..28557c6 100644 --- a/doc/ttk_combobox.n +++ b/doc/ttk_combobox.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: ttk_combobox.n,v 1.4.2.7 2008/01/29 17:35:48 dgp Exp $ +'\" RCS: @(#) $Id: ttk_combobox.n,v 1.4.2.8 2008/03/07 22:03:48 dgp Exp $ '\" .so man.macros .TH ttk::combobox n 8.5 Tk "Tk Themed Widget" @@ -99,7 +99,8 @@ widget commands (see \fIttk::entry(n)\fR for details): .SH "VIRTUAL EVENTS" The combobox widget generates a \fB<<ComboboxSelected>>\fR virtual event when the user selects an element from the list of values. -This event is generated after the listbox is unposted. +If the selection action unposts the listbox, +this event is delivered after the listbox is unposted. .SH "SEE ALSO" ttk::widget(n), ttk::entry(n) .SH KEYWORDS diff --git a/doc/ttk_notebook.n b/doc/ttk_notebook.n index ba8e6db..d20c497 100644 --- a/doc/ttk_notebook.n +++ b/doc/ttk_notebook.n @@ -4,7 +4,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: ttk_notebook.n,v 1.3.2.5 2008/01/29 17:35:50 dgp Exp $ +'\" RCS: @(#) $Id: ttk_notebook.n,v 1.3.2.6 2008/03/07 22:03:49 dgp Exp $ '\" .so man.macros .TH ttk::notebook n 8.5 Tk "Tk Themed Widget" @@ -79,6 +79,27 @@ Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if \fBttk::notebook::enableTraversal\fR is called. +.SH "TAB IDENTIFIERS" +The \fItabid\fR argument to the following commands may take +any of the following forms: +.IP \(bu +An integer between zero and the number of tabs; +.IP \(bu +The name of a slave window; +.IP \(bu +A positional specification of the form +.QW @\fIx\fR,\fIy\fR , +which identifies the tab +.IP \(bu +The literal string +.QW \fBcurrent\fR , +which identifies the currently-selected tab; or: +.IP \(bu +The literal string +.QW \fBend\fR , +which returns the number of tabs +(only valid for +.QW "\fIpathname \fBindex\fR" ). .SH "WIDGET COMMAND" .TP \fIpathname \fBadd\fR \fIwindow\fR ?\fIoptions...\fR? @@ -161,27 +182,6 @@ Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook. -.SH "TAB IDENTIFIERS" -The \fItabid\fR argument to the above commands may take -any of the following forms: -.IP \(bu -An integer between zero and the number of tabs; -.IP \(bu -The name of a slave window; -.IP \(bu -A positional specification of the form -.QW @\fIx\fR,\fIy\fR , -which identifies the tab -.IP \(bu -The literal string -.QW \fBcurrent\fR , -which identifies the currently-selected tab; or: -.IP \(bu -The literal string -.QW \fBend\fR , -which returns the number of tabs -(only valid for -.QW "\fIpathname \fBindex\fR" ). .SH "VIRTUAL EVENTS" The notebook widget generates a \fB<<NotebookTabChanged>>\fR virtual event after a new tab is selected. diff --git a/doc/ttk_scale.n b/doc/ttk_scale.n new file mode 100644 index 0000000..e2667c7 --- /dev/null +++ b/doc/ttk_scale.n @@ -0,0 +1,102 @@ +.\" +.\" Copyright (c) 2008 Donal Fellows +.\" +.\" See the file "license.terms" for information on usage and redistribution +.\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +.\" +.\" CVS: @(#) $Id: ttk_scale.n,v 1.1.2.2 2008/03/07 22:03:49 dgp Exp $ +.\" +.so man.macros +.TH ttk::scale n 8.5 Tk "Tk Themed Widget" +.BS +.SH NAME +ttk::scale \- Create and manipulate a scale widget +.SH SYNOPSIS +\fBttk::scale \fIpathName \fR?\fIoptions...\fR? +.BE +.SH DESCRIPTION +A \fBttk::scale\fR widget is typically used to control the numeric value of a +linked variable that varies uniformly over some range. A scale displays a +\fIslider\fR that can be moved along over a \fItrough\fR, with the relative +position of the slider over the trough indicating the value of the variable. +.SO ttk_widget +\-class \-cursor \-style +\-takefocus +.SE +.SH "WIDGET-SPECIFIC OPTIONS" +.OP \-command command Command +Specifies the prefix of a Tcl command to invoke whenever the scale's value is +changed via a widget command. The actual command consists of this option +followed by a space and a real number indicating the new value of the scale. +.OP \-from from From +A real value corresponding to the left or top end of the scale. +.OP \-length length Length +Specifies the desired long dimension of the scale in screen units (i.e. any of +the forms acceptable to \fBTk_GetPixels\fR). For vertical scales this is the +scale's height; for horizontal scales it is the scale's width. +.OP \-orient orient Orient +Specifies which orientation whether the widget should be laid out horizontally +or vertically. Must be either \fBhorizontal\fR or \fBvertical\fR or an +abbreviation of one of these. +.OP \-to to To +Specifies a real value corresponding to the right or bottom end of the scale. +This value may be either less than or greater than the \fBfrom\fR option. +.OP \-value value Value +Specifies the current floating-point value of the variable. +.OP \-variable variable Variable +Specifies the name of a global variable to link to the scale. Whenever the +value of the variable changes, the scale will update to reflect this value. +Whenever the scale is manipulated interactively, the variable will be modified +to reflect the scale's new value. +.SH "WIDGET COMMAND" +.TP +\fIpathName \fBcget \fIoption\fR +. +Returns the current value of the specified \fIoption\fR; see +\fIttk::widget(n)\fR. +.TP +\fIpathName \fBconfigure \fR?\fIoption\fR? ?\fIvalue option value ...\fR? +. +Modify or query widget options; see \fIttk::widget(n)\fR. +.TP +\fIpathName \fBget \fR?\fIx y\fR? +. +Get the current value of the \fB\-value\fR option, or the value corresponding +to the coordinates \fIx,y\fR if they are specified. \fIX\fR and \fIy\fR are +pixel coordinates relative to the scale widget origin. +.TP +\fIpathName \fBinstate \fIstatespec\fR ?\fIscript\fR? +. +Test the widget state; see \fIttk::widget(n)\fR. +.TP +\fIpathName \fBset \fIvalue\fR +. +Set the value of the widget (i.e. the \fB\-value\fR option) to \fIvalue\fR. +The value will be clipped to the range given by the \fB\-from\fR and +\fB\-to\fR options. Note that setting the linked variable (i.e. the variable +named in the \fB\-variable\fR option) does not cause such clipping. +.TP +\fIpathName \fBstate\fR ?\fIstateSpec\fR? +. +Modify or query the widget state; see \fIttk::widget(n)\fR. +.SH "INTERNAL COMMANDS" +.TP +\fIpathName \fBcoords \fR?\fIvalue\fR? +. +Get the coordinates corresponding to \fIvalue\fR, or the coordinates +corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR +is omitted. +.TP +\fIpathName \fBidentify \fIx y\fR +. +Returns the name of the element under the point given by \fIx\fR and \fIy\fR, +or an empty string if the point does not lie in any element of the scale. +\fIX\fR and \fIy\fR are pixel coordinates relative to the scale widget origin. +.SH "SEE ALSO" +ttk::widget(n), scale(n) +.SH KEYWORDS +scale, slider, trough, widget +.\" Local Variables: +.\" mode: nroff +.\" fill-column: 78 +.\" End: diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 819b210..3a8ba8f 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,4 +1,4 @@ -/* $Id: ttkPanedwindow.c,v 1.9.2.2 2007/11/25 19:19:21 dgp Exp $ +/* $Id: ttkPanedwindow.c,v 1.9.2.3 2008/03/07 22:03:49 dgp Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * @@ -13,8 +13,6 @@ #include "ttkTheme.h" #include "ttkWidget.h" -#define MIN_SASH_THICKNESS 5 - /*------------------------------------------------------------------------ * +++ Layout algorithm. * @@ -570,11 +568,6 @@ static Ttk_Layout PanedGetLayout( } } - /* Sanity-check: - */ - if (pw->paned.sashThickness < MIN_SASH_THICKNESS) - pw->paned.sashThickness = MIN_SASH_THICKNESS; - return panedLayout; } @@ -899,6 +892,8 @@ static WidgetSpec PanedWidgetSpec = * +++ Elements and layouts. */ +static const int DEFAULT_SASH_THICKNESS = 5; + typedef struct { Tcl_Obj *thicknessObj; } SashElement; @@ -914,7 +909,7 @@ static void SashElementSize( int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SashElement *sash = elementRecord; - int thickness = MIN_SASH_THICKNESS; + int thickness = DEFAULT_SASH_THICKNESS; Tcl_GetIntFromObj(NULL, sash->thicknessObj, &thickness); *widthPtr = *heightPtr = thickness; } diff --git a/library/demos/knightstour.tcl b/library/demos/knightstour.tcl new file mode 100644 index 0000000..93f8b47 --- /dev/null +++ b/library/demos/knightstour.tcl @@ -0,0 +1,247 @@ +# Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net> +# +# Calculate a Knight's tour of a chessboard. +# +# This uses Warnsdorff's rule to calculate the next square each +# time. This specifies that the next square should be the one that +# has the least number of available moves. +# +# Using this rule it is possible to get to a position where +# there are no squares available to move into. In this implementation +# this occurs when the starting square is d6. +# +# To solve this fault an enhancement to the rule is that if we +# have a choice of squares with an equal score, we should choose +# the one nearest the edge of the board. +# +# If the call to the Edgemost function is commented out you can see +# this occur. +# +# You can drag the knight to a specific square to start if you wish. +# If you let it repeat then it will choose random start positions +# for each new tour. + +package require Tk 8.5 + +# Return a list of accessible squares from a given square +proc ValidMoves {square} { + set moves {} + foreach pair {{-1 -2} {-2 -1} {-2 1} {-1 2} {1 2} {2 1} {2 -1} {1 -2}} { + set col [expr {($square % 8) + [lindex $pair 0]}] + set row [expr {($square / 8) + [lindex $pair 1]}] + if {$row > -1 && $row < 8 && $col > -1 && $col < 8} { + lappend moves [expr {$row * 8 + $col}] + } + } + return $moves +} + +# Return the number of available moves for this square +proc CheckSquare {square} { + variable visited + set moves 0 + foreach test [ValidMoves $square] { + if {[lsearch -exact -integer $visited $test] == -1} { + incr moves + } + } + return $moves +} + +# Select the next square to move to. Returns -1 if there are no available +# squares remaining that we can move to. +proc Next {square} { + variable visited + set minimum 9 + set nextSquare -1 + foreach testSquare [ValidMoves $square] { + if {[lsearch -exact -integer $visited $testSquare] == -1} { + set count [CheckSquare $testSquare] + if {$count < $minimum} { + set minimum $count + set nextSquare $testSquare + } elseif {$count == $minimum} { + set nextSquare [Edgemost $nextSquare $testSquare] + } + } + } + return $nextSquare +} + +# Select the square nearest the edge of the board +proc Edgemost {a b} { + set colA [expr {3-int(abs(3.5-($a%8)))}] + set colB [expr {3-int(abs(3.5-($b%8)))}] + set rowA [expr {3-int(abs(3.5-($a/8)))}] + set rowB [expr {3-int(abs(3.5-($b/8)))}] + return [expr {($colA * $rowA) < ($colB * $rowB) ? $a : $b}] +} + +# Display a square number as a standard chess square notation. +proc N {square} { + return [format %c%d [expr {97 + $square % 8}] \ + [expr {$square / 8 + 1}]] +} + +# Perform a Knight's move and schedule the next move. +proc MovePiece {dlg last square} { + variable visited + variable delay + variable continuous + $dlg.f.txt insert end "[llength $visited]. [N $last] .. [N $square]\n" {} + $dlg.f.txt see end + $dlg.f.c itemconfigure [expr {1+$last}] -state normal -outline black + $dlg.f.c itemconfigure [expr {1+$square}] -state normal -outline red + $dlg.f.c coords knight [lrange [$dlg.f.c coords [expr {1+$square}]] 0 1] + lappend visited $square + set next [Next $square] + if {$next ne -1} { + variable aid [after $delay [list MovePiece $dlg $square $next]] + } else { + $dlg.b1 configure -state normal + if {[llength $visited] == 64} { + variable initial + if {$initial == $square} { + $dlg.f.txt insert end "Closed tour!" + } else { + $dlg.f.txt insert end "Success\n" {} + if {$continuous} { + after [expr {$delay * 2}] [namespace code \ + [list Tour $dlg [expr {int(rand() * 64)}]]] + } + } + } else { + $dlg.f.txt insert end "FAILED!\n" {} + } + } +} + +# Begin a new tour of the board given a random start position +proc Tour {dlg {square {}}} { + variable visited {} + $dlg.f.txt delete 1.0 end + $dlg.b1 configure -state disabled + for {set n 0} {$n < 64} {incr n} { + $dlg.f.c itemconfigure $n -state disabled -outline black + } + if {$square eq {}} { + set square [expr {[$dlg.f.c find closest \ + {*}[$dlg.f.c coords knight] 0 65]-1}] + } + variable initial $square + after idle [list MovePiece $dlg $initial $initial] +} + +proc Stop {} { + variable aid + catch {after cancel $aid} +} + +proc Exit {dlg} { + Stop + destroy $dlg +} + +proc SetDelay {new} { + variable delay [expr {int($new)}] +} + +proc DragStart {w x y} { + $w dtag selected + $w addtag selected withtag current + variable dragging [list $x $y] +} +proc DragMotion {w x y} { + variable dragging + if {[info exists dragging]} { + $w move selected [expr {$x - [lindex $dragging 0]}] \ + [expr {$y - [lindex $dragging 1]}] + variable dragging [list $x $y] + } +} +proc DragEnd {w x y} { + set square [$w find closest $x $y 0 65] + $w coords selected [lrange [$w coords $square] 0 1] + $w dtag selected + variable dragging ; unset dragging +} + +proc CreateGUI {} { + catch {destroy .knightstour} + set dlg [toplevel .knightstour] + wm title $dlg "Knights tour" + wm withdraw $dlg + set f [ttk::frame $dlg.f] + set c [canvas $f.c -width 240 -height 240] + text $f.txt -width 10 -height 1 -background white \ + -yscrollcommand [list $f.vs set] -font {Arial 8} + ttk::scrollbar $f.vs -command [list $f.txt yview] + + variable delay 600 + variable continuous 0 + ttk::label $dlg.ls -text Speed + ttk::scale $dlg.sc -from 8 -to 2000 -command [list SetDelay] \ + -variable [namespace which -variable delay] + ttk::checkbutton $dlg.cc -text Repeat \ + -variable [namespace which -variable continuous] + ttk::button $dlg.b1 -text Start -command [list Tour $dlg] + ttk::button $dlg.b2 -text Exit -command [list Exit $dlg] + set square 0 + for {set row 7} {$row != -1} {incr row -1} { + for {set col 0} {$col < 8} {incr col} { + if {(($col & 1) ^ ($row & 1))} { + set fill tan3 ; set dfill tan4 + } else { + set fill bisque ; set dfill bisque3 + } + set coords [list [expr {$col * 30 + 3}] [expr {$row * 30 + 3}] \ + [expr {$col * 30 + 29}] [expr {$row * 30 + 29}]] + $c create rectangle $coords -fill $fill -disabledfill $dfill \ + -width 2 -state disabled + } + } + catch {eval font create KnightFont -size -24} + $c create text 0 0 -font KnightFont -text "\u265e" \ + -anchor nw -tags knight -fill black -activefill "#600000" + $c coords knight [lrange [$c coords [expr {1 + int(rand() * 64)}]] 0 1] + $c bind knight <ButtonPress-1> [namespace code [list DragStart %W %x %y]] + $c bind knight <Motion> [namespace code [list DragMotion %W %x %y]] + $c bind knight <ButtonRelease-1> [namespace code [list DragEnd %W %x %y]] + + grid $c $f.txt $f.vs -sticky news + grid rowconfigure $f 0 -weight 1 + grid columnconfigure $f 1 -weight 1 + + grid $f - - - - - -sticky news + set things [list $dlg.ls $dlg.sc $dlg.cc $dlg.b1] + if {![info exists ::widgetDemo]} { + lappend things $dlg.b2 [ttk::sizegrip $dlg.sg] + } + grid {*}$things -sticky e + if {[info exists ::widgetDemo]} { + grid [addSeeDismiss $dlg.buttons $dlg] - - - - - -sticky ew + } + + grid rowconfigure $dlg 0 -weight 1 + grid columnconfigure $dlg 0 -weight 1 + + bind $dlg <Control-F2> {console show} + bind $dlg <Return> [list $dlg.b1 invoke] + bind $dlg <Escape> [list $dlg.b2 invoke] + bind $dlg <Destroy> [namespace code [list Stop]] + wm protocol $dlg WM_DELETE_WINDOW [namespace code [list Exit $dlg]] + + wm deiconify $dlg + tkwait window $dlg +} + +if {!$tcl_interactive} { + if {![winfo exists .knightstour]} { + if {![info exists widgetDemo]} { wm withdraw . } + set r [catch [linsert $argv 0 CreateGUI] err] + if {$r} { + tk_messageBox -icon error -title "Error" -message $err + } + if {![info exists widgetDemo]} { exit $r } + } +} diff --git a/library/demos/widget b/library/demos/widget index 268c56c..890b329 100644 --- a/library/demos/widget +++ b/library/demos/widget @@ -10,7 +10,7 @@ exec wish "$0" "$@" # separate ".tcl" files is this directory, which are sourced by this script as # needed. # -# RCS: @(#) $Id: widget,v 1.29.2.8 2007/12/06 07:00:05 dgp Exp $ +# RCS: @(#) $Id: widget,v 1.29.2.9 2008/03/07 22:03:49 dgp Exp $ package require Tcl 8.5 package require Tk 8.5 @@ -358,6 +358,7 @@ addFormattedText { @@demo ruler A ruler with adjustable tab stops @@demo floor A building floor plan @@demo cscroll A simple scrollable canvas + @@demo knightstour A Knight's tour of the chess board @@subtitle Scales and Progress Bars @@demo hscale Horizontal scale diff --git a/library/ttk/combobox.tcl b/library/ttk/combobox.tcl index 847d806..4f8d914 100644 --- a/library/ttk/combobox.tcl +++ b/library/ttk/combobox.tcl @@ -1,5 +1,5 @@ # -# $Id: combobox.tcl,v 1.3.2.4 2007/11/12 19:22:38 dgp Exp $ +# $Id: combobox.tcl,v 1.3.2.5 2008/03/07 22:03:49 dgp Exp $ # # Combobox bindings. # @@ -169,7 +169,7 @@ proc ttk::combobox::SelectEntry {cb index} { $cb current $index $cb selection range 0 end $cb icursor end - event generate $cb <<ComboboxSelected>> + event generate $cb <<ComboboxSelected>> -when mark } ## Scroll -- Mousewheel binding diff --git a/macosx/tkAboutDlg.r b/macosx/tkAboutDlg.r index 9f42997..1a56d48 100644 --- a/macosx/tkAboutDlg.r +++ b/macosx/tkAboutDlg.r @@ -4,12 +4,12 @@ * This file creates resources for the Tk "About Box" dialog. * * Copyright (c) 1996 Sun Microsystems, Inc. - * Copyright (c) 2006-2007 Daniel A. Steffen <das@users.sourceforge.net> + * Copyright (c) 2006-2008 Daniel A. Steffen <das@users.sourceforge.net> * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkAboutDlg.r,v 1.8 2007/04/23 21:24:32 das Exp $ + * RCS: @(#) $Id: tkAboutDlg.r,v 1.8.2.1 2008/03/07 22:03:49 dgp Exp $ */ /* @@ -47,8 +47,8 @@ resource 'DITL' (128, "About Box", purgeable) { {232, 147, 252, 217}, Button {enabled, "Ok"}, { 20, 108, 212, 344}, StaticText {disabled, "Tcl " TCL_PATCH_LEVEL " & Tk " TK_PATCH_LEVEL "\n\n" - "© 2002-2007 Tcl Core Team." "\n\n" - "© 2002-2007 Daniel A. Steffen." "\n\n" + "© 2002-2008 Tcl Core Team." "\n\n" + "© 2002-2008 Daniel A. Steffen." "\n\n" "Jim Ingham & Ian Reid" "\n" "© 2001-2002 Apple Computer, Inc." "\n\n" "Jim Ingham & Ray Johnson" "\n" diff --git a/macosx/tkMacOSXDraw.c b/macosx/tkMacOSXDraw.c index 0428c56..b6bed19 100644 --- a/macosx/tkMacOSXDraw.c +++ b/macosx/tkMacOSXDraw.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.21.2.9 2007/11/12 19:22:38 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXDraw.c,v 1.21.2.10 2008/03/07 22:03:49 dgp Exp $ */ #include "tkMacOSXPrivate.h" @@ -43,7 +43,7 @@ int tkMacOSXUseCGDrawing = 1; int tkPictureIsOpen; -static PixPatHandle penPat = NULL; +static PixPatHandle penPat = NULL, tmpPixPat = NULL; static int cgAntiAliasLimit = 0; #define notAA(w) ((w) < cgAntiAliasLimit) @@ -1502,20 +1502,27 @@ TkMacOSXSetUpGraphicsPort( GC gc, /* GC to apply to current port. */ GWorldPtr destPort) { + CGrafPtr savePort; + Boolean portChanged; + + portChanged = QDSwapPort(destPort, &savePort); PenNormal(); if (gc) { - if (penPat == NULL) { - penPat = NewPixPat(); + if (!penPat) { + if (!tmpPixPat) { + penPat = NewPixPat(); + } else { + penPat = tmpPixPat; + tmpPixPat = NULL; + } } TkMacOSXSetColorInPort(gc->foreground, 1, penPat, destPort); - SetPortPenPixPat(destPort, penPat); + PenPixPat(penPat); if(gc->function == GXxor) { - SetPortPenMode(destPort, patXor); + PenMode(patXor); } if (gc->line_width > 1) { - Point s = {gc->line_width, gc->line_width}; - - SetPortPenSize(destPort, s); + PenSize(gc->line_width, gc->line_width); } if (gc->line_style != LineSolid) { /* @@ -1524,6 +1531,9 @@ TkMacOSXSetUpGraphicsPort( */ } } + if (portChanged) { + QDSwapPort(savePort, NULL); + } } /* @@ -1576,7 +1586,7 @@ TkMacOSXSetupDrawingContext( goto end; } if (useCG) { - dc.context = macDraw->context;; + dc.context = macDraw->context; } if (!dc.context || !(macDraw->flags & TK_IS_PIXMAP)) { dc.port = TkMacOSXGetDrawablePort(d); @@ -1743,7 +1753,11 @@ TkMacOSXRestoreDrawingContext( DisposeRgn(dcPtr->saveClip); } if (dcPtr->penPat) { - DisposePixPat(dcPtr->penPat); + if (!tmpPixPat) { + tmpPixPat = dcPtr->penPat; + } else { + DisposePixPat(dcPtr->penPat); + } } if (dcPtr->saveState) { ChkErr(SetThemeDrawingState, dcPtr->saveState, true); @@ -1756,7 +1770,7 @@ TkMacOSXRestoreDrawingContext( QDSwapPort(dcPtr->savePort, NULL); } #ifdef TK_MAC_DEBUG - bzero(dcPtr, sizeof(dcPtr)); + bzero(dcPtr, sizeof(TkMacOSXDrawingContext)); #endif /* TK_MAC_DEBUG */ } diff --git a/tests/ttk/combobox.test b/tests/ttk/combobox.test index 3c20bd3..8f25a81 100644 --- a/tests/ttk/combobox.test +++ b/tests/ttk/combobox.test @@ -1,5 +1,5 @@ # -# Tile package: combobox widget tests +# ttk::combobox widget tests # package require Tk 8.5 @@ -43,6 +43,26 @@ test combobox-2.4 "current -- value not in list" -body { .cb current } -result -1 -test combobox-end "Cleanup" -body { destroy .cb } +test combobox-2.end "Cleanup" -body { destroy .cb } + + +test combobox-1890211 "ComboboxSelected event after listbox unposted" -body { + # whitebox test... + pack [ttk::combobox .cb -values [list a b c]] + set result [list] + bind .cb <<ComboboxSelected>> { + lappend result Event [winfo ismapped .cb.popdown] [.cb get] + } + lappend result Start 0 [.cb get] + ttk::combobox::Post .cb + lappend result Post [winfo ismapped .cb.popdown] [.cb get] + .cb.popdown.l selection clear 0 end; .cb.popdown.l selection set 1 + ttk::combobox::LBSelected .cb.popdown.l + lappend result Select [winfo ismapped .cb.popdown] [.cb get] + update + set result +} -result [list Start 0 {} Post 1 {} Select 0 b Event 0 b] -cleanup { + destroy .cb +} tcltest::cleanupTests diff --git a/unix/README b/unix/README index a299b56..dc5faf1 100644 --- a/unix/README +++ b/unix/README @@ -1,170 +1,175 @@ Tk UNIX README -------------- -This is the directory where you configure, compile, test, and install -UNIX versions of Tk. This directory also contains source files for Tk -that are specific to UNIX. +This is the directory where you configure, compile, test, and install UNIX +versions of Tk. This directory also contains source files for Tk that are +specific to UNIX. The information in this file is maintained at: http://www.tcl.tk/doc/howto/compile.html -For information on platforms where Tcl/Tk is known to compile, along -with any porting notes for getting it to work on those platforms, see: +For information on platforms where Tcl/Tk is known to compile, along with any +porting notes for getting it to work on those platforms, see: http://www.tcl.tk/software/tcltk/platforms.html -The rest of this file contains instructions on how to do this. The -release should compile and run either "out of the box" or with trivial -changes on any UNIX-like system that approximates POSIX, BSD, or System -V. We know that it runs on workstations from Sun, H-P, DEC, IBM, and -SGI, as well as PCs running Linux, BSDI, and SCO UNIX. To compile for -a PC running Windows, see the README file in the directory ../win. To -compile for MacOSX, see the README file in the directory ../macosx. +The rest of this file contains instructions on how to do this. The release +should compile and run either "out of the box" or with trivial changes on any +UNIX-like system that approximates POSIX, BSD, or System V. We know that it +runs on workstations from Sun, H-P, DEC, IBM, and SGI, as well as PCs running +Linux, BSDI, and SCO UNIX. To compile for a PC running Windows, see the README +file in the directory ../win. To compile for MacOSX, see the README file in +the directory ../macosx. -RCS: @(#) $Id: README,v 1.22.2.3 2007/12/10 18:39:31 dgp Exp $ +RCS: @(#) $Id: README,v 1.22.2.4 2008/03/07 22:03:50 dgp Exp $ How To Compile And Install Tk: ------------------------------ (a) Make sure that the Tcl release is present in the directory - ../../tcl<version> (or else use the "--with-tcl" switch described - below). This release of Tk will only work with the equivalently - versioned Tcl release. Also, be sure that you have configured Tcl before - you configure Tk. + ../../tcl<version> (or else use the "--with-tcl" switch described below). + This release of Tk will only work with the equivalently versioned Tcl + release. Also, be sure that you have configured Tcl before you configure + Tk. (b) Check for patches as described in ../README. (c) If you have already compiled Tk once in this directory and are now preparing to compile again in the same directory but for a different - platform, or if you have applied patches, type "make distclean" to - discard all the configuration information computed previously. - -(d) Type "./configure". This runs a configuration script created by GNU - autoconf, which configures Tk for your system and creates a Makefile. - The configure script allows you to customize the Tk configuration for - your site; for details on how you can do this, type "./configure - -help" or refer to the autoconf documentation (not included here). - Tk's "configure" script supports the following special switches in - addition to the standard ones: + platform, or if you have applied patches, type "make distclean" to discard + all the configuration information computed previously. + +(d) Type "./configure". This runs a configuration script created by GNU + autoconf, which configures Tk for your system and creates a Makefile. The + configure script allows you to customize the Tk configuration for your + site; for details on how you can do this, type "./configure -help" or + refer to the autoconf documentation (not included here). Tk's "configure" + script supports the following special switches in addition to the standard + ones: + --with-tcl=DIR Specifies the directory containing the Tcl binaries and Tcl's platform-dependent - configuration information. By default - the Tcl directory is assumed to be in the - location given by (a) above. - --enable-threads If this switch is set, Tk will compile - itself with multithreading support. + configuration information. By default the Tcl + directory is assumed to be in the location + given by (a) above. + --with-x=DIR Tells configure where to find an installation + of the X Window System. Not normally needed. + --enable-threads If this switch is set, Tk will compile itself + with multithreading support. --enable-shared If this switch is specified, Tk will compile itself as a shared library if it can figure - out how to do that on this platform. This - is the default on platforms where we know - how to build shared libraries. + out how to do that on this platform. This is + the default on platforms where we know how to + build shared libraries. --disable-shared If this switch is specified, Tk will compile itself as a static library. - --enable-symbols Build with debugging symbols By default - standard debugging symbols are used. You - can specify the value "mem" to include + --disable-rpath Turns off use of the rpath link option on + platforms that would otherwise use it. + --enable-symbols Build with debugging symbols. By default + standard debugging symbols are used. You can + specify the value "mem" to include TCL_MEM_DEBUG memory debugging. --disable-symbols Build without debugging symbols - --disable-xft Disable support for antialiased fonts via - the Freetype/xft library. By default, - this is switched on whenever the - configure script can detect the required - libraries. --enable-64bit Enable 64bit support (where applicable) --disable-64bit Disable 64bit support (where applicable) --enable-64bit-vis Enable 64bit Sparc VIS support --disable-64bit-vis Disable 64bit Sparc VIS support + --disable-xft Disable support for antialiased fonts via the + Freetype/xft library. By default, this is + switched on whenever the configure script can + detect the required libraries. --enable-man-symlinks Use symlinks for linking the manpages that should be reachable under several names. --enable-man-compression=PROG Compress the manpages using PROG. --enable-man-suffix=STRING - Add STRING to the name of each of the - manual pages. If specified without giving - STRING, the suffix will be "tk". + Add STRING to the name of each of the manual + pages. If specified without giving STRING, the + suffix will be "tk". + Mac OS X only: + --enable-framework Package Tk as a framework. --disable-corefoundation Disable use of CoreFoundation API. --enable-aqua Use Aqua windowingsystem rather than X11, - requires --enable-corefoundation with Tcl - and Tk. - - Note: by default gcc will be used if it can be located on the PATH. - if you want to use cc instead of gcc, set the CC environment variable - to "cc" before running configure. It is not safe to change the Makefile - to use gcc after configure is run. - - Note: be sure to use only absolute path names (those starting with "/") - in the --prefix and --exec-prefix options. - -(e) Type "make". This will create a library archive called - "libtk<version>.a" or "libtk<version>.so" and an interpreter - application called "wish" that allows you to type Tcl/Tk commands - interactively or execute script files. It will also create a - stub library archive "libtkstub<version>.a" that developers may - link against other C code to produce loadable extensions that call - into Tk's public interface routines. - -(f) If the make fails then you'll have to personalize the Makefile - for your site or possibly modify the distribution in other ways. - First check the porting Web page above to see if there are hints - for compiling on your system. If you need to modify Makefile, - there are comments at the beginning of it that describe the things - you might want to change and how to change them. - -(g) Type "make install" to install Tk's binaries and script files in - standard places. You'll need write permission on the installation - directories to do this. The installation directories are - determined by the "configure" script and may be specified with - the --prefix and --exec-prefix options to "configure". See the - Makefile for information on what directories were chosen. You - should not override these choices by modifying the Makefile, or by - copying files post-install. The installed binaries have embedded within - them path values relative to the install directory. If you change your - mind about where Tk should be installed, start this procedure over again from step (a) so that the path embedded in the binaries agrees with the - install location. + requires --enable-corefoundation with Tcl and + Tk. + + Note: by default gcc will be used if it can be located on the PATH. If you + want to use cc instead of gcc, set the CC environment variable to "cc" + before running configure. It is not safe to change the Makefile to use gcc + after configure is run. + + Note: be sure to use only absolute path names (those starting with "/") in + the --prefix and --exec-prefix options. + +(e) Type "make". This will create a library archive called "libtk<version>.a" + or "libtk<version>.so" and an interpreter application called "wish" that + allows you to type Tcl/Tk commands interactively or execute script files. + It will also create a stub library archive "libtkstub<version>.a" that + developers may link against other C code to produce loadable extensions + that call into Tk's public interface routines. + +(f) If the make fails then you'll have to personalize the Makefile for your + site or possibly modify the distribution in other ways. First check the + porting Web page above to see if there are hints for compiling on your + system. If you need to modify Makefile, there are comments at the + beginning of it that describe the things you might want to change and how + to change them. + +(g) Type "make install" to install Tk's binaries and script files in standard + places. You'll need write permission on the installation directories to do + this. The installation directories are determined by the "configure" + script and may be specified with the --prefix and --exec-prefix options to + "configure". See the Makefile for information on what directories were + chosen. You should not override these choices by modifying the Makefile, + or by copying files post-install. The installed binaries have embedded + within them path values relative to the install directory. If you change + your mind about where Tk should be installed, start this procedure over + again from step (a) so that the path embedded in the binaries agrees with + the install location. (h) At this point you can play with Tk by running the installed "wish" - executable, or via the "make shell" target, and typing Tcl/Tk commands - at the interactive prompt. + executable, or via the "make shell" target, and typing Tcl/Tk commands at + the interactive prompt. If you have trouble compiling Tk, see the URL noted above about working -platforms. It contains information that people have provided about changes -they had to make to compile Tk in various environments. We're also -interested in hearing how to change the configuration setup so that Tk -compiles on additional platforms "out of the box". +platforms. It contains information that people have provided about changes +they had to make to compile Tk in various environments. We're also interested +in hearing how to change the configuration setup so that Tk compiles on +additional platforms "out of the box". Note: Do not specify either of the TCL_LIBRARY and TK_LIBRARY environment -variables in a production installation, as this can cause conflicts -between different versions of the libraries. Instead, the libraries -should have the correct locations of their associated script directories -built into them. +variables in a production installation, as this can cause conflicts between +different versions of the libraries. Instead, the libraries should have the +correct locations of their associated script directories built into them. Test suite ---------- -Tk has a substantial self-test suite, consisting of a set of scripts in -the subdirectory "tests". To run the test suite just type "make test" -in this directory. You should then see a printout of the test files -processed. If any errors occur, you'll see a much more substantial -printout for each error. In order to avoid false error reports, be sure -to run the tests with an empty resource database (e.g., remove your -.Xdefaults file or delete any entries starting with *). Also, don't -try to do anything else with your display or keyboard while the tests -are running, or you may get false violations. See the README file in -the "tests" directory for more information on the test suite. - -If the test suite generates errors, most likely they are due to non- -portable tests that are interacting badly with your system configuration. -We are gradually eliminating the non-portable tests, but this release -includes many new tests so there will probably be some portability -problems. As long as the test suite doesn't core dump, it's probably -safe to conclude that any errors represent portability problems in the -test suite and not fundamental flaws with Tk. +Tk has a substantial self-test suite, consisting of a set of scripts in the +subdirectory "tests". To run the test suite just type "make test" in this +directory. You should then see a printout of the test files processed. If any +errors occur, you'll see a much more substantial printout for each error. In +order to avoid false error reports, be sure to run the tests with an empty +resource database (e.g., remove your .Xdefaults file or delete any entries +starting with *). Also, don't try to do anything else with your display or +keyboard while the tests are running, or you may get false violations. See the +README file in the "tests" directory for more information on the test suite. + +If the test suite generates errors, most likely they are due to non-portable +tests that are interacting badly with your system configuration. We are +gradually eliminating the non-portable tests, but this release includes many +new tests so there will probably be some portability problems. As long as the +test suite doesn't core dump, it's probably safe to conclude that any errors +represent portability problems in the test suite and not fundamental flaws +with Tk. There are also a number of visual tests for things such as screen layout, -Postscript generation, etc. These tests all have to be run by manually -enabling the "userInteraction" constraint when testing, and the results -have to be verified visually.. This can be done with - make test TESTFLAGS="-constraints userInteraction" -Some tests will present a main window with a bunch of menus, which you can -use to select various tests. +Postscript generation, etc. These tests all have to be run by manually +enabling the "userInteraction" constraint when testing, and the results have +to be verified visually. This can be done with: + + make test TESTFLAGS="-constraints userInteraction" + +Some tests will present a main window with a bunch of menus, which you can use +to select various tests. |