From 643b19451d3b2bd1e080733c4c93c5a9daaad63a Mon Sep 17 00:00:00 2001 From: jenglish Date: Tue, 7 Nov 2006 03:45:27 +0000 Subject: Miscellaneous minor changes to re-sync Ttk codebase with Tile CVS: fix comments damaged by overzealous search-and-destroy; removed obsolete [style default] synonym for [ttk::style configure]; removed other dead code. --- ChangeLog | 11 +++++ generic/ttk/ttkClassicTheme.c | 7 ++- generic/ttk/ttkPanedwindow.c | 9 ++-- generic/ttk/ttkTheme.c | 9 ++-- generic/ttk/ttkTreeview.c | 4 +- library/ttk/entry.tcl | 4 +- library/ttk/notebook.tcl | 20 +-------- library/ttk/panedwindow.tcl | 6 +-- library/ttk/utils.tcl | 38 ++++++++-------- tests/ttk/bwidget.test | 101 ------------------------------------------ tests/ttk/panedwindow.test | 6 +-- win/ttkWinXPTheme.c | 4 +- 12 files changed, 53 insertions(+), 166 deletions(-) delete mode 100644 tests/ttk/bwidget.test diff --git a/ChangeLog b/ChangeLog index 2280ab7..50aa570 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-11-06 Joe English + * generic/ttk/ttkClassicTheme.c, generic/ttk/ttkPanedwindow.c, + generic/ttk/ttkTheme.c, generic/ttk/ttkTreeview.c, + win/ttkWinXPTheme.c, library/ttk/entry.tcl, + library/ttk/notebook.tcl, library/ttk/panedwindow.tcl, + library/ttk/utils.tcl, tests/ttk/entry.test, tests/ttk/bwidget.test: + Miscellaneous minor changes to re-sync Ttk codebase with Tile CVS: + fix comments damaged by overzealous search-and-destroy; + removed obsolete [style default] synonym for [ttk::style configure]; + removed other dead code. + 2006-11-03 Pat Thoyts * library/safetk.tcl (::safe::tkTopLevel): Theme it. diff --git a/generic/ttk/ttkClassicTheme.c b/generic/ttk/ttkClassicTheme.c index f62c6f2..19164aa 100644 --- a/generic/ttk/ttkClassicTheme.c +++ b/generic/ttk/ttkClassicTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkClassicTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ + * $Id: ttkClassicTheme.c,v 1.3 2006/11/07 03:45:27 jenglish Exp $ * * Copyright (c) 2004, Joe English * @@ -288,12 +288,11 @@ static Ttk_ElementSpec ArrowElementSpec = /*------------------------------------------------------------------------ - * +++ Sash element (for ttk::paned window) + * +++ Sash element (for ttk::panedwindow) * * NOTES: * - * Paned windows with -orient horizontal use vertical sashes, - * and vice versa. + * panedwindows with -orient horizontal use vertical sashes, and vice versa. * * Interpretation of -sashrelief 'groove' and 'ridge' are * swapped wrt. the core panedwindow, which (I think) has them backwards. diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c index 7fe1cc8..ac8d9cc 100644 --- a/generic/ttk/ttkPanedwindow.c +++ b/generic/ttk/ttkPanedwindow.c @@ -1,8 +1,8 @@ -/* $Id: ttkPanedwindow.c,v 1.2 2006/11/03 03:06:22 das Exp $ +/* $Id: ttkPanedwindow.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $ * * Copyright (c) 2005, Joe English. Freely redistributable. * - * Ttk widget set: ttk::panedwindow widget. + * ttk::panedwindow widget implementation. * * TODO: track active/pressed sash. */ @@ -378,7 +378,7 @@ static void PanedGeometryRequestProc( } static Ttk_ManagerSpec PanedManagerSpec = { - { "paned", PanedGeometryRequestProc, Ttk_LostSlaveProc }, + { "panedwindow", PanedGeometryRequestProc, Ttk_LostSlaveProc }, PaneOptionSpecs, sizeof(Pane), PanedSize, PanedPlaceSlaves, @@ -390,6 +390,7 @@ static Ttk_ManagerSpec PanedManagerSpec = { /*------------------------------------------------------------------------ * +++ Event handler. * + * <> * Tk does not execute binding scripts for events when * the pointer crosses from a parent to a child. This widget * needs to know when that happens, though, so it can reset @@ -780,7 +781,7 @@ static Ttk_ElementSpec SashElementSpec = { }; TTK_BEGIN_LAYOUT(PanedLayout) - TTK_NODE("Paned.background", 0) /* @@@ BUG: empty layouts don't work */ + TTK_NODE("Panedwindow.background", 0)/* @@@ BUG: empty layouts don't work */ TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalSashLayout) diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index af33606..cca5d3a 100644 --- a/generic/ttk/ttkTheme.c +++ b/generic/ttk/ttkTheme.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * $Id: ttkTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ + * $Id: ttkTheme.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $ */ #include @@ -504,7 +504,7 @@ void Ttk_RegisterCleanup( * Scheduled as an idle callback; clientData is a StylePackageData *. * * Sends a <> event to every widget in the hierarchy. - * Ttk widgets respond to this by calling the WorldChanged class proc, + * Widgets respond to this by calling the WorldChanged class proc, * which in turn recreates the layout. * * The Tk C API doesn't doesn't provide an easy way to traverse @@ -516,8 +516,7 @@ static void ThemeChangedProc(ClientData clientData) static char ThemeChangedScript[] = "ttk::ThemeChanged"; StylePackageData *pkgPtr = (StylePackageData *)clientData; - if (Tcl_EvalEx(pkgPtr->interp, ThemeChangedScript, -1, TCL_EVAL_GLOBAL) - != TCL_OK) { + if (Tcl_GlobalEval(pkgPtr->interp, ThemeChangedScript) != TCL_OK) { Tcl_BackgroundError(pkgPtr->interp); } pkgPtr->themeChangePending = 0; @@ -1629,8 +1628,6 @@ static struct Ensemble StyleEnsemble[] = { { "layout", StyleLayoutCmd, 0 }, { "theme", 0, StyleThemeEnsemble }, { "element", 0, StyleElementEnsemble }, - - { "default", StyleConfigureCmd, 0 }, /* TEMP: for pre-0.7 compatibility */ { NULL, 0, 0 } }; diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c index ec61201..f34d452 100644 --- a/generic/ttk/ttkTreeview.c +++ b/generic/ttk/ttkTreeview.c @@ -1,5 +1,5 @@ /* - * $Id: ttkTreeview.c,v 1.2 2006/11/03 03:06:22 das Exp $ + * $Id: ttkTreeview.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $ * Copyright (c) 2004, Joe English * * Ttk widget set: treeview widget. @@ -2967,8 +2967,6 @@ MODULE_SCOPE int TtkTreeview_Init(Tcl_Interp *interp) Ttk_RegisterLayout(theme, "Heading", HeadingLayout); Ttk_RegisterLayout(theme, "Row", RowLayout); - Tcl_PkgProvide(interp, "ttk::treeview", TTK_VERSION); - return TCL_OK; } diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl index 65fdf90..7d84be7 100644 --- a/library/ttk/entry.tcl +++ b/library/ttk/entry.tcl @@ -1,5 +1,5 @@ # -# $Id: entry.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: entry.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $ # # DERIVED FROM: tk/library/entry.tcl r1.22 # @@ -409,7 +409,7 @@ proc ttk::entry::DragTo {w x} { # according to the current selection mode. # # TODO: AutoScroll should repeat faster (50ms) than normal autorepeat. -# TODO: Need a way for ttk::Repeat scripts to cancel themselves. +# TODO: Need a way for Repeat scripts to cancel themselves. # proc ttk::entry::AutoScroll {w} { variable State diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl index d2edddc..9ad6d01 100644 --- a/library/ttk/notebook.tcl +++ b/library/ttk/notebook.tcl @@ -1,5 +1,5 @@ # -# $Id: notebook.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: notebook.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $ # # Bindings for TNotebook widget # @@ -39,24 +39,6 @@ proc ttk::notebook::ActivateTab {w tab} { } } -# ttk::focusFirst $w -- -# Return the first descendant of $w, in preorder traversal order, -# that can take keyboard focus, "" if none do. -# -# See also: tk_focusNext -# -proc ttk::focusFirst {w} { - if {[ttk::takesFocus $w]} { - return $w - } - foreach child [winfo children $w] { - if {[set c [ttk::focusFirst $child]] ne ""} { - return $c - } - } - return "" -} - # Press $nb $x $y -- # ButtonPress-1 binding for notebook widgets. # Activate the tab under the mouse cursor, if any. diff --git a/library/ttk/panedwindow.tcl b/library/ttk/panedwindow.tcl index 451e5c4..e575e8a 100644 --- a/library/ttk/panedwindow.tcl +++ b/library/ttk/panedwindow.tcl @@ -1,7 +1,7 @@ # -# $Id: panedwindow.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: panedwindow.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $ # -# Ttk widget set: bindings for TPanedwindow widget. +# Bindings for ttk::panedwindow widget. # namespace eval ttk::panedwindow { @@ -24,7 +24,7 @@ bind TPanedwindow { ttk::panedwindow::Release %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::SetCursor %W %x %y } bind TPanedwindow { ttk::panedwindow::ResetCursor %W } -# See PanedEventProc in ttkPanedwindow.c: +# See <> bind TPanedwindow <> { ttk::panedwindow::ResetCursor %W } diff --git a/library/ttk/utils.tcl b/library/ttk/utils.tcl index b8059ae..11f85b9 100644 --- a/library/ttk/utils.tcl +++ b/library/ttk/utils.tcl @@ -1,5 +1,5 @@ # -# $Id: utils.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: utils.tcl,v 1.2 2006/11/07 03:45:28 jenglish Exp $ # # Ttk widget set: utilities for widget implementations. # @@ -58,6 +58,24 @@ proc ttk::takesFocus {w} { return 0 } +# ttk::focusFirst $w -- +# Return the first descendant of $w, in preorder traversal order, +# that can take keyboard focus, "" if none do. +# +# See also: tk_focusNext +# +proc ttk::focusFirst {w} { + if {[ttk::takesFocus $w]} { + return $w + } + foreach child [winfo children $w] { + if {[set c [ttk::focusFirst $child]] ne ""} { + return $c + } + } + return "" +} + ### Grabs. # # Rules: @@ -213,22 +231,4 @@ proc ttk::CopyBindings {from to} { } } -## ttk::LoadImages $imgdir ?$patternList? -- -# Utility routine for pixmap themes -# -# Loads all image files in $imgdir matching $patternList. -# Returns: a paired list of filename/imagename pairs. -# -proc ttk::LoadImages {imgdir {patterns {*.gif}}} { - foreach pattern $patterns { - foreach file [glob -directory $imgdir $pattern] { - set img [file tail [file rootname $file]] - if {![info exists images($img)]} { - set images($img) [image create photo -file $file] - } - } - } - return [array get images] -} - #*EOF* diff --git a/tests/ttk/bwidget.test b/tests/ttk/bwidget.test deleted file mode 100644 index f371daf..0000000 --- a/tests/ttk/bwidget.test +++ /dev/null @@ -1,101 +0,0 @@ -# -# Test BWidget / Ttk compatibility. -# -# NOTE: This part of the test suite is no longer operative: -# [namespace import -force ttk::*] is not expected or intended to work. -# -# Keeping the file around for now since it contains some historical -# information about how ttk *tried* to make it work, and what -# sort of things went wrong. -# - -package require Tk 8.5 -package require tcltest -tcltest::cleanupTests ; return - -loadTestedCommands - -set have_compat 0 -if {![catch {ttk::pkgconfig get compat} compat]} {set have_compat $compat} -testConstraint bwidget [expr {$have_compat && ![catch {package require BWidget}]}] - -test bwidget-1.0 "Setup for BWidget test" -constraints bwidget -body { - namespace import -force ttk::* - puts "Loaded BWidget version [package provide BWidget]" -} - -test bwidget-1.1 "Make Label widget" -constraints bwidget -body { - pack [Label .w] -} -cleanup {destroy .w} - -test bwidget-1.2 "Make ScrolledWindow widget" -constraints bwidget -body { - pack [ScrolledWindow .w -auto both -scrollbar vertical] -} -cleanup {destroy .w} - -test bwidget-1.3 "Make PagesManager widget" -constraints bwidget -body { - pack [PagesManager .w] -} -cleanup {destroy .w} - -# -# ProgressBar: this one fails with 'unknown color name "xxx"', -# where "xxx" is the default value of some other option -# (variously, "4m", "100", something else). -# -# Update: fixed now. Source of problem: widgets were using "unused" -# as the resource database name for compatibility options; -# BWidgets keys off the db name instead of the option name. -# -test bwidget-1.4 "Make ProgressBar widget" -constraints bwidget -body { - pack [ProgressBar .w] -} -cleanup {destroy .w} - -# @@@ TODO: full BWidget coverage, -# @@@ not just the ones people have reported problems with. - - -# -# <>: -# -# TK_OPTION_NULL_OK doesn't work for TK_OPTION_INT (among others); -# see Bug #967209. -# -# This means that [.l configure -width [.l cget -width]] -- which is -# essentially what BWidgets does -- will raise an error if -width has -# a NULL default. -# -# Temporary workaround: declare -width, etc. as TK_OPTION_STRING instead. -# This disables typechecking in the 'configure' method, but it seems -# to be the best way to avoid the BWidget incompatibility for now. -# -test nulloptions-1.1 "Test null options" -body { - ttk::label .tl - .tl configure -width [.tl cget -width] -} -cleanup { destroy .tl } - -# -# <> This also means we have to (partially) disable -# the widget option / element option consistency checks. -# -test nulloptions-1.2 "Ensure workaround doesn't break -width" -body { - ttk::label .tl -text "x" -width 0 - set w1 [winfo reqwidth .tl] - .tl configure -width 10 - set w2 [winfo reqwidth .tl] - expr {$w2 > $w1} -} -result 1 -cleanup { destroy .tl } - -test nulloptions-1.3 "Exhaustive test" -body { - set readonlyOpts [list -class] - foreach widget $::ttk::widgets { - #puts "$widget" - ttk::$widget .w - foreach configspec [.w configure] { - set option [lindex $configspec 0] - if {[lsearch -exact $readonlyOpts $option] >= 0} { continue } - .w configure $option [.w cget $option] - } - destroy .w - } -} - -tcltest::cleanupTests diff --git a/tests/ttk/panedwindow.test b/tests/ttk/panedwindow.test index 13a7e85..190e6b5 100644 --- a/tests/ttk/panedwindow.test +++ b/tests/ttk/panedwindow.test @@ -1,5 +1,5 @@ # -# $Id: panedwindow.test,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: panedwindow.test,v 1.2 2006/11/07 03:45:28 jenglish Exp $ # package require Tk 8.5 @@ -21,7 +21,7 @@ test panedwindow-1.1 "Make sure empty panedwindow doesn't crash" -body { test panedwindow-1.2 "Add a pane" -body { .pw add [ttk::frame .pw.f1] winfo manager .pw.f1 -} -result "paned" +} -result "panedwindow" test panedwindow-1.3 "Steal pane" -body { pack .pw.f1 -side bottom @@ -36,7 +36,7 @@ test panedwindow-1.5 "Remanage pane" -body { #XXX .pw insert 0 .pw.f1 .pw add .pw.f1 winfo manager .pw.f1 -} -result "paned" +} -result "panedwindow" test panedwindow-1.6 "Forget pane" -body { .pw forget .pw.f1 diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index d8748c0..0960d5e 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.2 2006/11/03 03:06:22 das Exp $ + * $Id: ttkWinXPTheme.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -622,7 +622,7 @@ static Ttk_ElementSpec PbarElementSpec = * not if it's simply the rightmost tab. This information * is not available. * - * The TIS_* and TTKS_* definitions are identical, so + * The TIS_* and TILES_* definitions are identical, so * we can use the same statemap no matter what the partId. */ static void TabElementDraw( -- cgit v0.12