From a3220fdf64e35fe118d44af78a8d9582b416fbd7 Mon Sep 17 00:00:00 2001
From: jenglish <jenglish@flightlab.com>
Date: Fri, 24 Nov 2006 18:04:14 +0000
Subject: * library/ttk/altTheme.tcl, library/ttk/clamTheme.tcl,
 library/ttk/defaults.tcl, library/ttk/winTheme.tcl, library/ttk/xpTheme.tcl:
 explicitly specify -anchor w on TMenubutton * tests/ttk/entry.test: Fixed
 font dependency; test entry-3.2 should work on all platforms now. *
 library/classicTheme.tcl: Don't define or use TkClassicDefaultFont. *
 generic/ttk/ttkTreeview.c, generic/ttk/ttkPanedwindow.c: Handle missing
 layouts.

---
 ChangeLog                    | 11 +++++++++++
 generic/tkEvent.c            |  4 +---
 generic/ttk/ttkPanedwindow.c | 42 ++++++++++++++++++++++++------------------
 generic/ttk/ttkTreeview.c    |  7 ++++---
 library/ttk/altTheme.tcl     |  5 +++--
 library/ttk/clamTheme.tcl    |  5 +++--
 library/ttk/classicTheme.tcl | 14 ++++++++------
 library/ttk/defaults.tcl     |  5 +++--
 library/ttk/ttk.tcl          | 17 ++++++-----------
 library/ttk/winTheme.tcl     |  5 +++--
 library/ttk/xpTheme.tcl      |  4 ++--
 tests/ttk/entry.test         |  4 ++--
 12 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 95164a3..1e2ea02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-11-24  Joe English  <jenglish@users.sourceforge.net>
+
+	* library/ttk/altTheme.tcl, library/ttk/clamTheme.tcl, 
+	library/ttk/defaults.tcl, library/ttk/winTheme.tcl, 
+	library/ttk/xpTheme.tcl: explicitly specify -anchor w on TMenubutton
+	* tests/ttk/entry.test: Fixed font dependency; test entry-3.2 
+	should work on all platforms now.
+	* library/classicTheme.tcl: Don't define or use TkClassicDefaultFont.
+	* generic/ttk/ttkTreeview.c, generic/ttk/ttkPanedwindow.c:
+	Handle missing layouts.
+
 2006-11-23  Jeff Hobbs  <jeffh@ActiveState.com>
 
 	* win/tkWinMenu.c (TkWinHandleMenuEvent, DrawMenuUnderline):
diff --git a/generic/tkEvent.c b/generic/tkEvent.c
index 91a286e..fda8ac9 100644
--- a/generic/tkEvent.c
+++ b/generic/tkEvent.c
@@ -12,12 +12,10 @@
  * See the file "license.terms" for information on usage and redistribution of
  * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  *
- * RCS: @(#) $Id: tkEvent.c,v 1.33 2006/02/03 22:40:34 dkf Exp $
+ * RCS: @(#) $Id: tkEvent.c,v 1.34 2006/11/24 18:04:14 jenglish Exp $
  */
 
-#include "tkPort.h"
 #include "tkInt.h"
-#include <signal.h>
 
 /*
  * There's a potential problem if a handler is deleted while it's current
diff --git a/generic/ttk/ttkPanedwindow.c b/generic/ttk/ttkPanedwindow.c
index ac8d9cc..e207a58 100644
--- a/generic/ttk/ttkPanedwindow.c
+++ b/generic/ttk/ttkPanedwindow.c
@@ -1,4 +1,4 @@
-/* $Id: ttkPanedwindow.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $
+/* $Id: ttkPanedwindow.c,v 1.4 2006/11/24 18:04:14 jenglish Exp $
  *
  * Copyright (c) 2005, Joe English.  Freely redistributable.
  *
@@ -447,29 +447,35 @@ static Ttk_Layout PanedGetLayout(
 {
     Paned *pw = recordPtr;
     Ttk_Layout panedLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
-    int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
-    const char *layoutName = horizontal ? ".Vertical.Sash" : ".Horizontal.Sash";
-    Ttk_Layout sashLayout = Ttk_CreateSublayout(interp, themePtr, panedLayout,
-	    layoutName, pw->core.optionTable);
 
-    if (sashLayout) {
-	int sashWidth, sashHeight;
+    if (panedLayout) {
+	int horizontal = pw->paned.orient == TTK_ORIENT_HORIZONTAL;
+	const char *layoutName = 
+	    horizontal ? ".Vertical.Sash" : ".Horizontal.Sash";
+	Ttk_Layout sashLayout = Ttk_CreateSublayout(
+	    interp, themePtr, panedLayout, layoutName, pw->core.optionTable);
 
-	if (pw->paned.sashLayout)
-	    Ttk_FreeLayout(pw->paned.sashLayout);
-	pw->paned.sashLayout = sashLayout;
+	if (sashLayout) {
+	    int sashWidth, sashHeight;
 
-	Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight);
+	    Ttk_LayoutSize(sashLayout, 0, &sashWidth, &sashHeight);
+	    pw->paned.sashThickness = horizontal ? sashWidth : sashHeight;
 
-	pw->paned.sashThickness = horizontal ? sashWidth : sashHeight;
+	    if (pw->paned.sashLayout)
+		Ttk_FreeLayout(pw->paned.sashLayout);
+	    pw->paned.sashLayout = sashLayout;
+	} else {
+	    Ttk_FreeLayout(panedLayout);
+	    return 0;
+	}
+    }
 
-	/* Sanity-check:
-	 */
-	if (pw->paned.sashThickness < MIN_SASH_THICKNESS)
-	    pw->paned.sashThickness = MIN_SASH_THICKNESS;
+    /* Sanity-check:
+     */
+    if (pw->paned.sashThickness < MIN_SASH_THICKNESS)
+	pw->paned.sashThickness = MIN_SASH_THICKNESS;
 
-	Ttk_ManagerSizeChanged(pw->paned.mgr);
-    }
+    Ttk_ManagerSizeChanged(pw->paned.mgr);
 
     return panedLayout;
 }
diff --git a/generic/ttk/ttkTreeview.c b/generic/ttk/ttkTreeview.c
index f34d452..6d8a4eb 100644
--- a/generic/ttk/ttkTreeview.c
+++ b/generic/ttk/ttkTreeview.c
@@ -1,8 +1,8 @@
 /*
- * $Id: ttkTreeview.c,v 1.3 2006/11/07 03:45:28 jenglish Exp $
+ * $Id: ttkTreeview.c,v 1.4 2006/11/24 18:04:14 jenglish Exp $
  * Copyright (c) 2004, Joe English
  *
- * Ttk widget set: treeview widget.
+ * ttk::treeview widget implementation.
  */
 
 #include <string.h>
@@ -1279,7 +1279,8 @@ static Ttk_Layout TreeviewGetLayout(
     Ttk_Layout treeLayout = TtkWidgetGetLayout(interp, themePtr, recordPtr);
 
     if (!(
-	GetSublayout(interp, themePtr, treeLayout, ".Item",
+	treeLayout 
+     && GetSublayout(interp, themePtr, treeLayout, ".Item",
 	    tv->tree.itemOptionTable, &tv->tree.itemLayout)
      && GetSublayout(interp, themePtr, treeLayout, ".Cell",
 	    tv->tree.tagOptionTable, &tv->tree.cellLayout)	/*@@@HERE*/
diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl
index 71fe23b..b1bbc65 100644
--- a/library/ttk/altTheme.tcl
+++ b/library/ttk/altTheme.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: altTheme.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+# $Id: altTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set: Alternate theme
 #
@@ -49,7 +49,8 @@ namespace eval ttk::theme::alt {
 	style map TRadiobutton -indicatorcolor \
 	    [list  disabled $colors(-frame)  pressed $colors(-frame)]
 
-	style configure TMenubutton -width -11 -padding "3 3" -relief raised
+	style configure TMenubutton \
+	    -width -11 -padding "3 3" -relief raised -anchor w
 
 	style configure TEntry -padding 1
 	style map TEntry -fieldbackground \
diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl
index 76e24fe..abf979f 100644
--- a/library/ttk/clamTheme.tcl
+++ b/library/ttk/clamTheme.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: clamTheme.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+# $Id: clamTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set: "Clam" theme
 #
@@ -82,7 +82,8 @@ namespace eval ttk::theme::clam {
 	style map TRadiobutton -indicatorbackground \
 	    [list  disabled $colors(-frame)  pressed $colors(-frame)]
 
-	style configure TMenubutton -width -11 -padding 5 -relief raised
+	style configure TMenubutton \
+	    -width -11 -padding 5 -relief raised -anchor w
 
 	style configure TEntry -padding 1 -insertwidth 1
 	style map TEntry \
diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl
index 6376268..5e29787 100644
--- a/library/ttk/classicTheme.tcl
+++ b/library/ttk/classicTheme.tcl
@@ -1,14 +1,13 @@
 #
-# $Id: classicTheme.tcl,v 1.1 2006/10/31 01:42:26 hobbs Exp $
+# $Id: classicTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
-# Ttk widget set: Classic theme.
-# Implements the classic Tk Motif-like look and feel.
+# "classic" Tk theme.
+#
+# Implements Tk's traditional Motif-like look and feel.
 #
 
 namespace eval ttk::theme::classic {
 
-    font create TkClassicDefaultFont -family Helvetica -weight bold -size -12
-
     variable colors; array set colors {
 	-frame		"#d9d9d9"
 	-activebg	"#ececec"
@@ -22,7 +21,7 @@ namespace eval ttk::theme::classic {
     namespace import -force ::ttk::style
     style theme settings classic {
 	style configure "." \
-	    -font		TkClassicDefaultFont \
+	    -font		TkDefaultFont \
 	    -background		$colors(-frame) \
 	    -foreground		black \
 	    -selectbackground	$colors(-selectbg) \
@@ -35,6 +34,9 @@ namespace eval ttk::theme::classic {
 	    -insertwidth	2 \
 	    ;
 
+	# To match pre-Xft X11 appearance, use:
+	#	ttk::style configure . -font {Helvetica 12 bold}
+
 	style map "." -background \
 	    [list disabled $colors(-frame) active $colors(-activebg)]
 	style map "." -foreground \
diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl
index a370e65..be7d7f3 100644
--- a/library/ttk/defaults.tcl
+++ b/library/ttk/defaults.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: defaults.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: defaults.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set: Default theme
 #
@@ -53,7 +53,8 @@ namespace eval ttk {
 	style map TRadiobutton -indicatorcolor \
 	    [list pressed $colors(-activebg)  selected $colors(-indicator)]
 
-	style configure TMenubutton -relief raised -padding "10 3"
+	style configure TMenubutton \
+	    -relief raised -padding "10 3" -anchor w
 
 	style configure TEntry -relief sunken -fieldbackground white -padding 1
 	style map TEntry -fieldbackground \
diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl
index f573bfc..ed3c92d 100644
--- a/library/ttk/ttk.tcl
+++ b/library/ttk/ttk.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: ttk.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: ttk.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set initialization script.
 #
@@ -24,27 +24,27 @@ source [file join $::ttk::library utils.tcl]
 #	Define $old command as a deprecated alias for $new command
 #	$old and $new must be fully namespace-qualified.
 #
-proc ::ttk::deprecated {old new} {
+proc ttk::deprecated {old new} {
     interp alias {} $old {} ttk::do'deprecate $old $new
 }
 ## do'deprecate --
 #	Implementation procedure for deprecated commands --
 #	issue a warning (once), then re-alias old to new.
 #
-proc ::ttk::do'deprecate {old new args} {
+proc ttk::do'deprecate {old new args} {
     deprecated'warning $old $new
     interp alias {} $old {} $new
-    eval [linsert $args 0 $new]
+    uplevel 1 [linsert $args 0 $new]
 }
 
 ## deprecated'warning --
 #	Gripe about use of deprecated commands.
 #
-proc ::ttk::deprecated'warning {old new} {
+proc ttk::deprecated'warning {old new} {
     puts stderr "$old deprecated -- use $new instead"
 }
 
-### Forward-compatibility.
+### Backward-compatibility.
 #
 # ttk::panedwindow used to be named ttk::paned.  Keep the alias for now.
 #
@@ -62,7 +62,6 @@ if {[info exists ::ttk::deprecrated] && $::ttk::deprecated} {
 	}
 
 	variable version 0.7.8
-	variable patchlevel 0.7.8
     }
     package provide tile $::tile::version
 
@@ -85,10 +84,6 @@ if {[info exists ::ttk::deprecrated] && $::ttk::deprecated} {
 	variable wc
 	foreach wc $widgets {
 	    namespace export $wc
-
-	    deprecated ::t$wc ::ttk::$wc
-	    deprecated ::tile::$wc ::ttk::$wc
-	    namespace eval ::tile [list namespace export $wc]
 	}
     }
 }
diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl
index ac4cba9..9678b10 100644
--- a/library/ttk/winTheme.tcl
+++ b/library/ttk/winTheme.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: winTheme.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: winTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set: Windows Native theme
 #
@@ -23,7 +23,8 @@ namespace eval ttk {
 	style configure TButton -width -11 -relief raised -shiftrelief 1
 	style configure TCheckbutton -padding "2 4"
 	style configure TRadiobutton -padding "2 4"
-	style configure TMenubutton -padding "8 4" -arrowsize 3 -relief raised
+	style configure TMenubutton \
+	    -padding "8 4" -arrowsize 3 -relief raised -anchor w
 
 	style map TButton -relief {{!disabled pressed} sunken}
 
diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl
index 7749e56..9bb8b8b 100644
--- a/library/ttk/xpTheme.tcl
+++ b/library/ttk/xpTheme.tcl
@@ -1,5 +1,5 @@
 #
-# $Id: xpTheme.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $
+# $Id: xpTheme.tcl,v 1.2 2006/11/24 18:04:14 jenglish Exp $
 #
 # Ttk widget set: XP Native theme
 #
@@ -24,7 +24,7 @@ namespace eval ttk {
 	style configure TButton -padding {1 1} -width -11
 	style configure TRadiobutton -padding 2
 	style configure TCheckbutton -padding 2
-	style configure TMenubutton -padding {8 4}
+	style configure TMenubutton -padding {8 4} -anchor w
 
 	style configure TNotebook -tabmargins {2 2 2 0}
 	style map TNotebook.Tab \
diff --git a/tests/ttk/entry.test b/tests/ttk/entry.test
index 0e7acd2..3ac9182 100644
--- a/tests/ttk/entry.test
+++ b/tests/ttk/entry.test
@@ -77,7 +77,7 @@ test entry-2.1 "Create entry before scrollbar" -body {
 test entry-2.2 "Initial scroll position" -body {
     ttk::entry .e -font fixed -width 5 -xscrollcommand scroll
     .e insert end "0123456789"
-    pack .e; update idletasks
+    pack .e; update
     set scrollInfo
 } -result {0 0.5} -cleanup { destroy .e }
 # NOTE: result can vary depending on font.
@@ -102,7 +102,7 @@ test entry-3.1 "bbox widget command" -body {
 
 test entry-3.2 "xview" -body {
     .e delete 0 end;
-    .e insert end [string repeat "M" 40]
+    .e insert end [string repeat "0" 40]
     update idletasks
     set result [.e xview]
 } -result {0 0.5}
-- 
cgit v0.12