diff options
author | dgp <dgp@users.sourceforge.net> | 2007-11-21 16:46:25 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2007-11-21 16:46:25 (GMT) |
commit | 41749d2f0483a6d2f71f624be6b96faff276f491 (patch) | |
tree | 2d7b44a18db2c51b77444675eef3981a791da3c4 | |
parent | 2168c0147d8f33747f24da4a35a2b6e29ebdee55 (diff) | |
download | tk-41749d2f0483a6d2f71f624be6b96faff276f491.zip tk-41749d2f0483a6d2f71f624be6b96faff276f491.tar.gz tk-41749d2f0483a6d2f71f624be6b96faff276f491.tar.bz2 |
merge updates from 8.5b3
42 files changed, 643 insertions, 420 deletions
@@ -1,3 +1,81 @@ +2007-11-19 Don Porter <dgp@users.sourceforge.net> + + *** 8.5b3 TAGGED FOR RELEASE *** + + * README: Bump version number to 8.5b3. + * generic/tk.h: + * library/tk.tcl: + * unix/configure.in: + * unix/tk.spec: + * win/configure.in: + + * unix/configure: autoconf-2.59 + * win/configure: + + * changes: Update changes for 8.5b3 release. + +2007-11-19 Pat Thoyts <patthoyts@users.sourceforge.net> + + * generic/ttk/ttkTheme.c: Fix crash when 'style element create' + * tests/ttk/ttk.test: called w/ insufficient args; add tests. + +2007-11-18 Joe English <jenglish@users.sourceforge.net> + + * generic/ttk/ttkElements.c, macosx/ttkMacOSXTheme.c: Add "fill" + element: like "background" but only erases parcel. + + * generic/ttk/ttkFrame.c: Use fill element in Labelframe Label + sublayout. Also improved default labelmargins for -labelanchor w*, e*. + + * generic/ttk/ttkLabel.c: no longer need Labelframe hack. + + * library/ttk/aquaTheme.tcl: ImageTextElement no longer needed. + TextElement no longer needs '-background' option. + + * generic/ttk/ttkFrame.c: Use sublayout for ttk::labelframe labels + instead of single element. + + * generic/ttk/ttkLabel.c: Default -anchor for text and label elements + is now "w" instead of "center". [Bug 1614540] + + * library/ttk/defaults.tcl, library/ttk/*Theme.tcl: Button styles now + need explicit "-anchor center". + + * generic/ttk/ttkLayout.c (TTKInitPadding): BUGFIX: + Ttk_GetPaddingFromObj() and Ttk_GetBorderFromObj() returned garbage + when passed an empty list. + + * macosx/ttkMacOSXTheme.c: Resynchronize with Tile codebase so that + patches can flow back and forth. + + * library/ttk/aquaTheme.tcl: Extra TButton -padding no longer needed. + +2007-11-18 Pat Thoyts <patthoyts@users.sourceforge.net> + + * win/ttkWinXPTheme.c: Add support for size information flags for + scrollbar and combobox buttons. This handles Tile [Patches 1596647 and + 1596657] but a bit more generically. + +2007-11-17 Pat Thoyts <patthoyts@users.sourceforge.net> + + * generic/(tkArgv.c, tkBind.c, tkCipboard.c, tkEntry.c, tkOption.c, + tkScale.c, tkScrollbar.c, tkTextImage.c, tkVisual.c, tkWindow.c): Tidy + up some variable types. + + * generic/tkFont.c: Only check for -displayof if there are + * test/font.test: sufficient arguments. This permits checking + strings like -d. + +2007-11-17 Joe English <jenglish@users.sourceforge.net> + + * library/ttk/scrollbar.tcl: Swap in core scrollbars for + [ttk::scrollbar]s on OSX. + +2007-11-16 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net> + + * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Correct an + oversight in the bug fix from 2007-11-11. [Bug 1824638] + 2007-11-15 Daniel Steffen <das@users.sourceforge.net> * macosx/Wish.xcodeproj/project.pbxproj: add new chanio.test. @@ -11,8 +89,8 @@ 2007-11-11 Benjamin Riefenstahl <b.riefenstahl@turtle-trading.net> * macosx/tkMacOSXFont.c (TkpMeasureCharsInContext): Fix the case when - TK_WHOLE_WORDS and TK_AT_LEAST_ONE are both set and maxLength is - small. [Bug 1824638] + TK_WHOLE_WORDS and TK_AT_LEAST_ONE are both set and maxLength is small. + [Bug 1824638] 2007-11-09 Daniel Steffen <das@users.sourceforge.net> @@ -158,8 +236,6 @@ * library/demos/mclist.tcl: Added a demo of how to do a multi-column sortable listbox. -2007-11-02 Donal K. Fellows <donal.k.fellows@manchester.ac.uk> - * library/msgbox.tcl: Made message dialog use Ttk widgets for better L&F. @@ -173,8 +249,6 @@ * library/demos/textpeer.tcl: Better resizing. [Bug 1822601] -2007-11-01 Donal K. Fellows <donal.k.fellows@man.ac.uk> - * doc/colors.n: Added list of Windows system colors. [Bug 945409] 2007-11-01 Daniel Steffen <das@users.sourceforge.net> @@ -5,7 +5,7 @@ README: Tk You can get any source release of Tcl from the file distributions link at the above URL. -RCS: @(#) $Id: README,v 1.47.2.3 2007/10/27 04:23:13 dgp Exp $ +RCS: @(#) $Id: README,v 1.47.2.4 2007/11/21 16:46:25 dgp Exp $ 1. Introduction --------------- @@ -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.3 2007/10/27 04:23:13 dgp Exp $ +RCS: @(#) $Id: changes,v 1.107.2.4 2007/11/21 16:46:25 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 @@ -6251,11 +6251,11 @@ ttk::radiobutton, ttk::checkbutton, ttk::treeview, ttk::separator, ttk::scrollbar, ttk::entry, ttk::frame and ttk::labelframe widgets. Adds ttk::style command. -2006-11-02 (enhancement) Improve OS X Carbon Update event handling (steffen). +2006-11-02 (enhancement) Improve OS X Carbon Update event handling (steffen) -2006-11-07 (configure change) Unix --enable-xft is enabled by default now. +2006-11-07 (configure change) Unix --enable-xft is enabled by default (kenny) -2006-11-23 (bug fix)[1599877] Fix unicode character underline in menus. +2006-11-23 (bug fix)[1599877] Fix unicode character underline in menus (hobbs) 2006-11-24 (bug fix)[1487701] Better handling of tcl_interactive on OS X to control display of console (hobbs, steffen) @@ -6266,19 +6266,19 @@ control display of console (hobbs, steffen) 2006-12-01 (new feature) Add -transparentcolor wm attribute on Windows (hobbs) -2006-12-02 (new feature)[TIP 300] Added [font actual $font $char]. +2006-12-01 (new feature)[TIP 300] Added [font actual $font $char] (kenny) -2006-12-04 (new feature)[TIP 286] Added [$menu xposition] subcommand. +2006-12-04 (new feature)[TIP 286] Added [$menu xposition] subcommand (bron) 2006-12-11 (enhancement) Improved EWMH support for _NET_WM_PID and -_NET_WM_PING. +_NET_WM_PING (fellows) 2007-01-25 (configure change) ensure CPPFLAGS env var used when set (steffen) 2007-02-19 (configure change) Use SHLIB_SUFFIX=".so" on HP-UX IA64 (was -".sl"). +".sl") (hobbs) -2007-04-10 (platform support) Correctly handle theming on Vista/Aero. +2007-04-10 (platform support) Correctly handle theming on Vista/Aero (english) 2007-04-23 (enhancement) Allow empty value for -selectforeground opt (steffen) @@ -6361,7 +6361,7 @@ installed tkMacOSXInt.h header (steffen) 2007-07-09 (bug fix) Aqua: window click activation & titlebar click handling in presence of grabs or modal windows (steffen) -2007-07-25 (bug fix)[1743786] Aqua: tk_getOpenFile result (steffen) +2007-07-25 (bug fix)[1743786] Aqua: [tk_getOpenFile] result (steffen) 2007-08-01 (bug fix)[1692927] [tk_messageBox -detail] buffer (davies,thoyts) @@ -6412,3 +6412,34 @@ project for Xcode 3.0 (steffen) Improvements to demo suite to make more use of Tk 8.5 features (fellows,steffen) --- Released 8.5b2, October 26, 2007 --- See ChangeLog for details --- + +2007-10-29 (appearance change) Default look and fonts on X11 (hobbs) + *** POTENTIAL INCOMPATIBILITY; [::tk::classic::restore] to undo *** + +2007-10-30 (bug fix)[1803723] Win: Arabic and Hebrew rendering (fellows) + +2007-10-30 (bug fix)[1550528] [tk_chooseDirectory -mustexist true] disables +the "OK" until valid selection (hobbs) + +2007-11-03 (new feature) adjustable [console] fonts (thoyts) + +2007-11-04 (enhancement) Aqua: "Run Widget Demo" menu item (steffen) + +2007-11-09 (bug fix) Aqua: activate event after window expansion (steffen) + +2007-11-09 (bug fix)[1824521] Aqua: menubutton crash with -bitmap (steffen) + +2007-11-09 (platform support) Aqua: (menu)button pressed/inactive/disabled +look&feel; menubutton size with -image/-bitmap (steffen) + +2007-11-09 (bug fix) Aqua: [tk_getOpenFile] (et al.) and help menu crashes on +Mac OS X Leopard (steffen) + +2007-11-11 (bug fix)[1824638] Aqua: small max-width text measuring (riefenstahl) + +2007-11-14 (bug fix)[1831803] sv.msg catalog for "sv" locale (fellows) + +Many significant improvements to the documentation and demos (fellows, hobbs, +steffen, kupries) + +--- Released 8.5b3, Novemeber 19, 2007 --- See ChangeLog for details --- diff --git a/generic/tk.h b/generic/tk.h index 0d8e1aa..5b08cf1 100644 --- a/generic/tk.h +++ b/generic/tk.h @@ -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: tk.h,v 1.98.2.5 2007/10/27 04:23:15 dgp Exp $ + * RCS: @(#) $Id: tk.h,v 1.98.2.6 2007/11/21 16:46:25 dgp Exp $ */ #ifndef _TK diff --git a/generic/tkArgv.c b/generic/tkArgv.c index 9039c88..77d4dd4 100644 --- a/generic/tkArgv.c +++ b/generic/tkArgv.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkArgv.c,v 1.5.2.3 2007/10/15 18:38:32 dgp Exp $ + * RCS: @(#) $Id: tkArgv.c,v 1.5.2.4 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -337,7 +337,7 @@ PrintUsage( * for default options. */ { register Tk_ArgvInfo *infoPtr; - int width, i, numSpaces; + size_t width, i, numSpaces; #define NUM_SPACES 20 static char spaces[] = " "; char tmp[TCL_DOUBLE_SPACE]; @@ -351,7 +351,7 @@ PrintUsage( for (i = 0; i < 2; i++) { for (infoPtr = i ? defaultTable : argTable; infoPtr->type != TK_ARGV_END; infoPtr++) { - int length; + size_t length; if (infoPtr->key == NULL) { continue; } diff --git a/generic/tkBind.c b/generic/tkBind.c index 05853ea..3e02891 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkBind.c,v 1.42.2.1 2007/09/07 01:25:33 dgp Exp $ + * RCS: @(#) $Id: tkBind.c,v 1.42.2.2 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -1002,7 +1002,7 @@ Tk_CreateBinding( oldStr = (char *) psPtr->clientData; if ((append != 0) && (oldStr != NULL)) { - int length; + size_t length; length = strlen(oldStr) + strlen(command) + 2; newStr = (char *) ckalloc((unsigned) length); @@ -3935,7 +3935,7 @@ GetVirtualEventUid( char *virtString) { Tk_Uid uid; - int length; + size_t length; length = strlen(virtString); diff --git a/generic/tkClipboard.c b/generic/tkClipboard.c index faebe9f..94b061d 100644 --- a/generic/tkClipboard.c +++ b/generic/tkClipboard.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkClipboard.c,v 1.15.2.1 2007/09/07 01:25:34 dgp Exp $ + * RCS: @(#) $Id: tkClipboard.c,v 1.15.2.2 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -61,7 +61,7 @@ ClipboardHandler( TkClipboardTarget *targetPtr = (TkClipboardTarget*) clientData; TkClipboardBuffer *cbPtr; char *srcPtr, *destPtr; - int count = 0; + size_t count = 0; int scanned = 0; size_t length, freeCount; @@ -104,7 +104,7 @@ ClipboardHandler( srcPtr = cbPtr->buffer; length = cbPtr->length; } - return count; + return (int)count; } /* @@ -150,7 +150,7 @@ ClipboardAppHandler( length = maxBytes; } strncpy(buffer, p, length); - return length; + return (int)length; } /* diff --git a/generic/tkEntry.c b/generic/tkEntry.c index 1a94123..9e7ffce 100644 --- a/generic/tkEntry.c +++ b/generic/tkEntry.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkEntry.c,v 1.44.2.1 2007/05/26 04:06:07 dgp Exp $ + * RCS: @(#) $Id: tkEntry.c,v 1.44.2.2 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -2008,7 +2008,9 @@ InsertChars( char *value) /* New characters to add (NULL-terminated * string). */ { - int byteIndex, byteCount, oldChars, charsAdded, newByteCount; + ptrdiff_t byteIndex; + size_t byteCount, newByteCount; + int oldChars, charsAdded; CONST char *string; char *newStr; @@ -2021,7 +2023,7 @@ InsertChars( newByteCount = entryPtr->numBytes + byteCount + 1; newStr = (char *) ckalloc((unsigned) newByteCount); - memcpy(newStr, string, (size_t) byteIndex); + memcpy(newStr, string, byteIndex); strcpy(newStr + byteIndex, value); strcpy(newStr + byteIndex + byteCount, string + byteIndex); diff --git a/generic/tkFont.c b/generic/tkFont.c index 51a7bb7..6671fde 100644 --- a/generic/tkFont.c +++ b/generic/tkFont.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkFont.c,v 1.35.2.4 2007/10/24 12:59:32 dgp Exp $ + * RCS: @(#) $Id: tkFont.c,v 1.35.2.5 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -718,12 +718,14 @@ Tk_FontObjCmd( case FONT_MEASURE: { char *string; Tk_Font tkfont; - int length, skip; + int length = 0, skip = 0; Tcl_Obj *resultPtr; - skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); - if (skip < 0) { - return TCL_ERROR; + if (objc > 4) { + skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); + if (skip < 0) { + return TCL_ERROR; + } } if (objc - skip != 4) { Tcl_WrongNumArgs(interp, 2, objv, "font ?-displayof window? text"); diff --git a/generic/tkOption.c b/generic/tkOption.c index f482272..830af0c 100644 --- a/generic/tkOption.c +++ b/generic/tkOption.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkOption.c,v 1.20.2.2 2007/09/07 01:25:36 dgp Exp $ + * RCS: @(#) $Id: tkOption.c,v 1.20.2.3 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -261,7 +261,8 @@ Tk_AddOption( Element newEl; register CONST char *p; CONST char *field; - int count, firstField, length; + int count, firstField; + ptrdiff_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) diff --git a/generic/tkScale.c b/generic/tkScale.c index 904e12b..b1366d4 100644 --- a/generic/tkScale.c +++ b/generic/tkScale.c @@ -16,7 +16,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScale.c,v 1.24.2.2 2007/09/07 01:25:36 dgp Exp $ + * RCS: @(#) $Id: tkScale.c,v 1.24.2.3 2007/11/21 16:46:26 dgp Exp $ */ #include "default.h" @@ -636,7 +636,7 @@ ConfigureScale( ComputeFormat(scalePtr); - scalePtr->labelLength = scalePtr->label ? strlen(scalePtr->label) : 0; + scalePtr->labelLength = scalePtr->label ? (int)strlen(scalePtr->label) : 0; Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder); diff --git a/generic/tkScrollbar.c b/generic/tkScrollbar.c index 0b185c7..9f0d5d0 100644 --- a/generic/tkScrollbar.c +++ b/generic/tkScrollbar.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkScrollbar.c,v 1.8.2.2 2007/09/09 04:15:54 dgp Exp $ + * RCS: @(#) $Id: tkScrollbar.c,v 1.8.2.3 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -542,7 +542,7 @@ ConfigureScrollbar( */ if (scrollPtr->command != NULL) { - scrollPtr->commandSize = strlen(scrollPtr->command); + scrollPtr->commandSize = (int)strlen(scrollPtr->command); } else { scrollPtr->commandSize = 0; } diff --git a/generic/tkTextImage.c b/generic/tkTextImage.c index 09be68c..606fafb 100644 --- a/generic/tkTextImage.c +++ b/generic/tkTextImage.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. * - * RCS: @(#) $Id: tkTextImage.c,v 1.19.2.1 2007/09/07 01:25:36 dgp Exp $ + * RCS: @(#) $Id: tkTextImage.c,v 1.19.2.2 2007/11/21 16:46:26 dgp Exp $ */ #include "tkPort.h" @@ -328,7 +328,7 @@ EmbImageConfigure( char *name; int count = 0; /* The counter for picking a unique name */ int conflict = 0; /* True if we have a name conflict */ - unsigned int len; /* length of image name */ + size_t len; /* length of image name */ if (Tk_SetOptions(textPtr->interp, (char*)&eiPtr->body.ei, eiPtr->body.ei.optionTable, diff --git a/generic/tkVisual.c b/generic/tkVisual.c index ddbe53a..ad9f328 100644 --- a/generic/tkVisual.c +++ b/generic/tkVisual.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkVisual.c,v 1.7.2.1 2007/09/07 01:25:36 dgp Exp $ + * RCS: @(#) $Id: tkVisual.c,v 1.7.2.2 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -101,7 +101,8 @@ Tk_GetVisual( XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; - int length, c, numVisuals, prio, bestPrio, i; + ptrdiff_t length; + int c, numVisuals, prio, bestPrio, i; CONST char *p; VisualDictionary *dictPtr; TkColormap *cmapPtr; diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 182c96c..0ad9bbe 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWindow.c,v 1.80.2.4 2007/10/24 12:59:32 dgp Exp $ + * RCS: @(#) $Id: tkWindow.c,v 1.80.2.5 2007/11/21 16:46:26 dgp Exp $ */ #include "tkInt.h" @@ -744,7 +744,7 @@ NameWindow( char *pathName; int isNew; Tcl_HashEntry *hPtr; - int length1, length2; + size_t length1, length2; /* * Setup all the stuff except name right away, then do the name stuff diff --git a/generic/ttk/ttkElements.c b/generic/ttk/ttkElements.c index 94fadfb..831cde7 100644 --- a/generic/ttk/ttkElements.c +++ b/generic/ttk/ttkElements.c @@ -1,4 +1,4 @@ -/* $Id: ttkElements.c,v 1.6.2.2 2007/11/12 19:22:37 dgp Exp $ +/* $Id: ttkElements.c,v 1.6.2.3 2007/11/21 16:46:27 dgp Exp $ * * Copyright (c) 2003, Joe English * @@ -38,8 +38,7 @@ TtkNullElementDraw( { } -/* public */ Ttk_ElementSpec ttkNullElementSpec = -{ +/* public */ Ttk_ElementSpec ttkNullElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, @@ -48,10 +47,10 @@ TtkNullElementDraw( }; /*---------------------------------------------------------------------- - * +++ Background element. + * +++ Background and fill elements. * - * This element simply clears the entire widget area - * with the background color. (NB: ignores parcel). + * The fill element fills its parcel with the background color. + * The background element ignores the parcel, and fills the entire window. * * Ttk_GetLayout() automatically includes a background element. */ @@ -60,20 +59,13 @@ typedef struct { Tcl_Obj *backgroundObj; } BackgroundElement; -static Ttk_ElementOptionSpec BackgroundElementOptions[] = -{ +static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, {NULL} }; -static void BackgroundElementSize( - void *clientData, void *elementRecord, Tk_Window tkwin, - int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) -{ -} - -static void BackgroundElementDraw( +static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { @@ -82,15 +74,31 @@ static void BackgroundElementDraw( XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), - 0,0, Tk_Width(tkwin), Tk_Height(tkwin)); + b.x, b.y, b.width, b.height); } -static Ttk_ElementSpec BackgroundElementSpec = +static void BackgroundElementDraw( + void *clientData, void *elementRecord, Tk_Window tkwin, + Drawable d, Ttk_Box b, unsigned int state) { + FillElementDraw( + clientData, elementRecord, tkwin, + d, Ttk_WinBox(tkwin), state); +} + +static Ttk_ElementSpec FillElementSpec = { + TK_STYLE_VERSION_2, + sizeof(BackgroundElement), + BackgroundElementOptions, + TtkNullElementSize, + FillElementDraw +}; + +static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(BackgroundElement), BackgroundElementOptions, - BackgroundElementSize, + TtkNullElementSize, BackgroundElementDraw }; @@ -104,8 +112,7 @@ typedef struct { Tcl_Obj *reliefObj; } BorderElement; -static Ttk_ElementOptionSpec BorderElementOptions[] = -{ +static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, @@ -143,8 +150,7 @@ static void BorderElementDraw( } } -static Ttk_ElementSpec BorderElementSpec = -{ +static Ttk_ElementSpec BorderElementSpec = { TK_STYLE_VERSION_2, sizeof(BorderElement), BorderElementOptions, @@ -192,8 +198,7 @@ static void FieldElementDraw( b.x, b.y, b.width, b.height, borderWidth, TK_RELIEF_SUNKEN); } -static Ttk_ElementSpec FieldElementSpec = -{ +static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, @@ -218,8 +223,7 @@ typedef struct { Tcl_Obj *shiftreliefObj; } PaddingElement; -static Ttk_ElementOptionSpec PaddingElementOptions[] = -{ +static Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, Tk_Offset(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, @@ -244,20 +248,12 @@ static void PaddingElementSize( *paddingPtr = Ttk_RelievePadding(pad, relief, shiftRelief); } -static void PaddingElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, - Drawable d, Ttk_Box b, unsigned int state) -{ - /* No-op */ -} - -static Ttk_ElementSpec PaddingElementSpec = -{ +static Ttk_ElementSpec PaddingElementSpec = { TK_STYLE_VERSION_2, sizeof(PaddingElement), PaddingElementOptions, PaddingElementSize, - PaddingElementDraw + TtkNullElementDraw }; /*---------------------------------------------------------------------- @@ -325,8 +321,7 @@ static void FocusElementDraw( } } -static Ttk_ElementSpec FocusElementSpec = -{ +static Ttk_ElementSpec FocusElementSpec = { TK_STYLE_VERSION_2, sizeof(FocusElement), FocusElementOptions, @@ -341,14 +336,12 @@ static Ttk_ElementSpec FocusElementSpec = * the general separator checks the "-orient" option. */ -typedef struct -{ +typedef struct { Tcl_Obj *orientObj; Tcl_Obj *borderObj; } SeparatorElement; -static Ttk_ElementOptionSpec SeparatorElementOptions[] = -{ +static Ttk_ElementOptionSpec SeparatorElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, @@ -408,8 +401,7 @@ static void GeneralSeparatorElementDraw( } } -static Ttk_ElementSpec HorizontalSeparatorElementSpec = -{ +static Ttk_ElementSpec HorizontalSeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, @@ -417,8 +409,7 @@ static Ttk_ElementSpec HorizontalSeparatorElementSpec = HorizontalSeparatorElementDraw }; -static Ttk_ElementSpec VerticalSeparatorElementSpec = -{ +static Ttk_ElementSpec VerticalSeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, @@ -426,8 +417,7 @@ static Ttk_ElementSpec VerticalSeparatorElementSpec = HorizontalSeparatorElementDraw }; -static Ttk_ElementSpec SeparatorElementSpec = -{ +static Ttk_ElementSpec SeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(SeparatorElement), SeparatorElementOptions, @@ -439,8 +429,7 @@ static Ttk_ElementSpec SeparatorElementSpec = * +++ Sizegrip: lower-right corner grip handle for resizing window. */ -typedef struct -{ +typedef struct { Tcl_Obj *backgroundObj; } SizegripElement; @@ -496,8 +485,7 @@ static Ttk_ElementSpec SizegripElementSpec = { * style; use "altTheme" for the newer, nicer version. */ -typedef struct -{ +typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *reliefObj; Tcl_Obj *colorObj; @@ -506,8 +494,7 @@ typedef struct Tcl_Obj *borderWidthObj; } IndicatorElement; -static Ttk_ElementOptionSpec IndicatorElementOptions[] = -{ +static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, @@ -617,8 +604,7 @@ static void DiamondIndicatorElementDraw( Tk_Draw3DPolygon(tkwin,d,border,points,4,borderWidth,relief); } -static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = -{ +static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, @@ -626,8 +612,7 @@ static Ttk_ElementSpec CheckbuttonIndicatorElementSpec = SquareIndicatorElementDraw }; -static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = -{ +static Ttk_ElementSpec RadiobuttonIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(IndicatorElement), IndicatorElementOptions, @@ -655,8 +640,7 @@ typedef struct { Tcl_Obj *marginObj; } MenuIndicatorElement; -static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = -{ +static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorwidth", TK_OPTION_PIXELS, @@ -701,8 +685,7 @@ static void MenuIndicatorElementDraw( borderWidth, TK_RELIEF_RAISED); } -static Ttk_ElementSpec MenuIndicatorElementSpec = -{ +static Ttk_ElementSpec MenuIndicatorElementSpec = { TK_STYLE_VERSION_2, sizeof(MenuIndicatorElement), MenuIndicatorElementOptions, @@ -718,8 +701,7 @@ static Ttk_ElementSpec MenuIndicatorElementSpec = */ static int ArrowElements[] = { ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT }; -typedef struct -{ +typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; @@ -727,8 +709,7 @@ typedef struct Tcl_Obj *colorObj; } ArrowElement; -static Ttk_ElementOptionSpec ArrowElementOptions[] = -{ +static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-background", TK_OPTION_BORDER, Tk_Offset(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-relief",TK_OPTION_RELIEF, @@ -779,8 +760,7 @@ static void ArrowElementDraw( Ttk_PadBox(b, ArrowMargins), direction); } -static Ttk_ElementSpec ArrowElementSpec = -{ +static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ArrowElement), ArrowElementOptions, @@ -794,15 +774,13 @@ static Ttk_ElementSpec ArrowElementSpec = * Used in scrollbars and scales in place of "border". */ -typedef struct -{ +typedef struct { Tcl_Obj *colorObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } TroughElement; -static Ttk_ElementOptionSpec TroughElementOptions[] = -{ +static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, Tk_Offset(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-troughcolor", TK_OPTION_BORDER, @@ -839,8 +817,7 @@ static void TroughElementDraw( borderWidth, relief); } -static Ttk_ElementSpec TroughElementSpec = -{ +static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(TroughElement), TroughElementOptions, @@ -855,8 +832,7 @@ static Ttk_ElementSpec TroughElementSpec = * Used in scrollbars. */ -typedef struct -{ +typedef struct { Tcl_Obj *orientObj; Tcl_Obj *thicknessObj; Tcl_Obj *reliefObj; @@ -864,8 +840,7 @@ typedef struct Tcl_Obj *borderWidthObj; } ThumbElement; -static Ttk_ElementOptionSpec ThumbElementOptions[] = -{ +static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(ThumbElement, orientObj), "horizontal" }, { "-width", TK_OPTION_PIXELS, @@ -912,8 +887,7 @@ static void ThumbElementDraw( borderWidth, relief); } -static Ttk_ElementSpec ThumbElementSpec = -{ +static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ThumbElement), ThumbElementOptions, @@ -928,8 +902,7 @@ static Ttk_ElementSpec ThumbElementSpec = * This is the moving part of the scale widget. Drawn as a raised box. */ -typedef struct -{ +typedef struct { Tcl_Obj *orientObj; /* orientation of overall slider */ Tcl_Obj *lengthObj; /* slider length */ Tcl_Obj *thicknessObj; /* slider thickness */ @@ -938,8 +911,7 @@ typedef struct Tcl_Obj *borderWidthObj; /* the size of the border */ } SliderElement; -static Ttk_ElementOptionSpec SliderElementOptions[] = -{ +static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, Tk_Offset(SliderElement,lengthObj), "30" }, { "-sliderthickness",TK_OPTION_PIXELS,Tk_Offset(SliderElement,thicknessObj), @@ -1021,8 +993,7 @@ static void SliderElementDraw( } } -static Ttk_ElementSpec SliderElementSpec = -{ +static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(SliderElement), SliderElementOptions, @@ -1042,8 +1013,7 @@ static Ttk_ElementSpec SliderElementSpec = #define DEFAULT_PBAR_THICKNESS "15" #define DEFAULT_PBAR_LENGTH "30" -typedef struct -{ +typedef struct { Tcl_Obj *orientObj; /* widget orientation */ Tcl_Obj *thicknessObj; /* the height/width of the bar */ Tcl_Obj *lengthObj; /* default width/height of the bar */ @@ -1052,8 +1022,7 @@ typedef struct Tcl_Obj *borderWidthObj; /* thickness of the border */ } PbarElement; -static Ttk_ElementOptionSpec PbarElementOptions[] = -{ +static Ttk_ElementOptionSpec PbarElementOptions[] = { { "-orient", TK_OPTION_ANY, Tk_Offset(PbarElement,orientObj), "horizontal" }, { "-thickness", TK_OPTION_PIXELS, Tk_Offset(PbarElement,thicknessObj), @@ -1197,8 +1166,7 @@ static void TabElementDraw( } -static Ttk_ElementSpec TabElementSpec = -{ +static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(TabElement), TabElementOptions, @@ -1237,8 +1205,7 @@ static void ClientElementSize( *paddingPtr = Ttk_UniformPadding((short)borderWidth); } -static Ttk_ElementSpec ClientElementSpec = -{ +static Ttk_ElementSpec ClientElementSpec = { TK_STYLE_VERSION_2, sizeof(ClientElement), ClientElementOptions, @@ -1262,6 +1229,7 @@ void TtkElements_Init(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "background", &BackgroundElementSpec,NULL); + Ttk_RegisterElement(interp, theme, "fill", &FillElementSpec, NULL); Ttk_RegisterElement(interp, theme, "border", &BorderElementSpec, NULL); Ttk_RegisterElement(interp, theme, "field", &FieldElementSpec, NULL); Ttk_RegisterElement(interp, theme, "focus", &FocusElementSpec, NULL); diff --git a/generic/ttk/ttkFrame.c b/generic/ttk/ttkFrame.c index 0866116..1c37065 100644 --- a/generic/ttk/ttkFrame.c +++ b/generic/ttk/ttkFrame.c @@ -1,4 +1,4 @@ -/* $Id: ttkFrame.c,v 1.5.2.2 2007/10/27 04:23:15 dgp Exp $ +/* $Id: ttkFrame.c,v 1.5.2.3 2007/11/21 16:46:27 dgp Exp $ * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. @@ -14,8 +14,7 @@ * +++ Frame widget: */ -typedef struct -{ +typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *paddingObj; Tcl_Obj *reliefObj; @@ -23,8 +22,7 @@ typedef struct Tcl_Obj *heightObj; } FramePart; -typedef struct -{ +typedef struct { WidgetCore core; FramePart frame; } Frame; @@ -241,11 +239,11 @@ typedef struct { Tk_Window labelWidget; Ttk_Manager *mgr; + Ttk_Layout labelLayout; /* Sublayout for label */ Ttk_Box labelParcel; /* Set in layoutProc */ } LabelframePart; -typedef struct -{ +typedef struct { WidgetCore core; FramePart frame; LabelframePart label; @@ -274,8 +272,7 @@ static Tk_OptionSpec LabelframeOptionSpecs[] = /* * Labelframe style parameters: */ -typedef struct -{ +typedef struct { int borderWidth; /* border width */ Ttk_Padding padding; /* internal padding */ Ttk_PositionSpec labelAnchor; /* corner/side to place label */ @@ -291,8 +288,6 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style) style->borderWidth = DEFAULT_BORDERWIDTH; style->padding = Ttk_UniformPadding(0); style->labelAnchor = TTK_PACK_TOP | TTK_STICK_W; - style->labelMargins = - Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0); style->labelOutside = 0; if ((objPtr = Ttk_QueryOption(layout, "-borderwidth", 0)) != NULL) { @@ -306,6 +301,14 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style) } if ((objPtr = Ttk_QueryOption(layout,"-labelmargins", 0)) != NULL) { Ttk_GetBorderFromObj(NULL, objPtr, &style->labelMargins); + } else { + if (style->labelAnchor & (TTK_PACK_TOP|TTK_PACK_BOTTOM)) { + style->labelMargins = + Ttk_MakePadding(DEFAULT_LABELINSET,0,DEFAULT_LABELINSET,0); + } else { + style->labelMargins = + Ttk_MakePadding(0,DEFAULT_LABELINSET,0,DEFAULT_LABELINSET); + } } if ((objPtr = Ttk_QueryOption(layout,"-labeloutside", 0)) != NULL) { Tcl_GetBooleanFromObj(NULL, objPtr, &style->labelOutside); @@ -321,17 +324,13 @@ static void LabelframeStyleOptions(Labelframe *lf, LabelframeStyle *style) static void LabelframeLabelSize(Labelframe *lframePtr, int *widthPtr, int *heightPtr) { - WidgetCore *corePtr = &lframePtr->core; Tk_Window labelWidget = lframePtr->label.labelWidget; - Ttk_LayoutNode *textNode = Ttk_LayoutFindNode(corePtr->layout, "text"); if (labelWidget) { *widthPtr = Tk_ReqWidth(labelWidget); *heightPtr = Tk_ReqHeight(labelWidget); - } else if (textNode) { - Ttk_LayoutNodeReqSize(corePtr->layout, textNode, widthPtr, heightPtr); } else { - *widthPtr = *heightPtr = 0; + Ttk_LayoutSize(lframePtr->label.labelLayout, 0, widthPtr, heightPtr); } } @@ -379,6 +378,36 @@ static int LabelframeSize(void *recordPtr, int *widthPtr, int *heightPtr) return 0; } +/* + * LabelframeGetLayout -- + * Getlayout widget hook. + */ + +static Ttk_Layout LabelframeGetLayout( + Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) +{ + Labelframe *lf = recordPtr; + Ttk_Layout frameLayout = TtkWidgetGetLayout(interp, theme, recordPtr); + Ttk_Layout labelLayout; + + if (!frameLayout) { + return NULL; + } + + labelLayout = Ttk_CreateSublayout( + interp, theme, frameLayout, ".Label", lf->core.optionTable); + + if (labelLayout) { + if (lf->label.labelLayout) { + Ttk_FreeLayout(lf->label.labelLayout); + } + Ttk_RebindSublayout(labelLayout, recordPtr); + lf->label.labelLayout = labelLayout; + } + + return frameLayout; +} + /* * LabelframeDoLayout -- * Labelframe layout hook. @@ -390,20 +419,12 @@ static void LabelframeDoLayout(void *recordPtr) { Labelframe *lframePtr = recordPtr; WidgetCore *corePtr = &lframePtr->core; - Ttk_Box borderParcel = Ttk_WinBox(corePtr->tkwin); - Ttk_LayoutNode - *textNode = Ttk_LayoutFindNode(corePtr->layout, "text"), - *borderNode = Ttk_LayoutFindNode(corePtr->layout, "border"); int lw, lh; /* Label width and height */ LabelframeStyle style; + Ttk_Box borderParcel = Ttk_WinBox(lframePtr->core.tkwin); Ttk_Box labelParcel; /* - * Do base layout: - */ - Ttk_PlaceLayout(corePtr->layout,corePtr->state,borderParcel); - - /* * Compute label parcel: */ LabelframeStyleOptions(lframePtr, &style); @@ -429,16 +450,22 @@ static void LabelframeDoLayout(void *recordPtr) /* * Place border and label: */ - if (borderNode) { - Ttk_PlaceLayoutNode(corePtr->layout, borderNode, borderParcel); - } - if (textNode) { - Ttk_PlaceLayoutNode(corePtr->layout, textNode, labelParcel); - } + Ttk_PlaceLayout(corePtr->layout, corePtr->state, borderParcel); + Ttk_PlaceLayout(lframePtr->label.labelLayout, corePtr->state, labelParcel); /* labelWidget placed in LabelframePlaceSlaves GM hook */ lframePtr->label.labelParcel = labelParcel; } +static void LabelframeDisplay(void *recordPtr, Drawable d) +{ + Labelframe *lframePtr = recordPtr; + Ttk_DrawLayout(lframePtr->core.layout, lframePtr->core.state, d); + Ttk_DrawLayout(lframePtr->label.labelLayout, lframePtr->core.state, d); +} + +/* +++ Labelframe geometry manager hooks. + */ + /* LabelframePlaceSlaves -- * Sets the position and size of the labelwidget. */ @@ -455,9 +482,6 @@ static void LabelframePlaceSlaves(void *recordPtr) } } -/* Labelframe geometry manager: - */ - /* LabelRemoved -- * Unset the -labelwidget option. * @@ -489,6 +513,7 @@ static int LabelframeInitialize(Tcl_Interp *interp, void *recordPtr) lframe->label.mgr = Ttk_CreateManager( &LabelframeManagerSpec, lframe, lframe->core.tkwin); lframe->label.labelWidget = 0; + lframe->label.labelLayout = 0; lframe->label.labelParcel = Ttk_MakeBox(-1,-1,-1,-1); return TCL_OK; @@ -585,19 +610,23 @@ static WidgetSpec LabelframeWidgetSpec = LabelframeCleanup, /* cleanupProc */ LabelframeConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ - TtkWidgetGetLayout, /* getLayoutProc */ + LabelframeGetLayout, /* getLayoutProc */ LabelframeSize, /* sizeProc */ LabelframeDoLayout, /* layoutProc */ - TtkWidgetDisplay /* displayProc */ + LabelframeDisplay /* displayProc */ }; TTK_BEGIN_LAYOUT(LabelframeLayout) TTK_NODE("Labelframe.border", TTK_FILL_BOTH) - TTK_NODE("Labelframe.text", TTK_FILL_BOTH) +TTK_END_LAYOUT + +TTK_BEGIN_LAYOUT(LabelSublayout) + TTK_GROUP("Label.fill", TTK_FILL_BOTH, + TTK_NODE("Label.text", TTK_FILL_BOTH)) TTK_END_LAYOUT /* ====================================================================== - * +++ Initialization: + * +++ Initialization. */ MODULE_SCOPE @@ -607,6 +636,7 @@ void TtkFrame_Init(Tcl_Interp *interp) Ttk_RegisterLayout(theme, "TFrame", FrameLayout); Ttk_RegisterLayout(theme, "TLabelframe", LabelframeLayout); + Ttk_RegisterLayout(theme, "TLabelframe.Label", LabelSublayout); RegisterWidget(interp, "ttk::frame", &FrameWidgetSpec); RegisterWidget(interp, "ttk::labelframe", &LabelframeWidgetSpec); diff --git a/generic/ttk/ttkLabel.c b/generic/ttk/ttkLabel.c index 58bdceb..51bb36e 100644 --- a/generic/ttk/ttkLabel.c +++ b/generic/ttk/ttkLabel.c @@ -1,4 +1,4 @@ -/* $Id: ttkLabel.c,v 1.8 2007/05/03 22:15:59 dkf Exp $ +/* $Id: ttkLabel.c,v 1.8.2.1 2007/11/21 16:46:27 dgp Exp $ * * text, image, and label elements. * @@ -11,8 +11,7 @@ #include <tk.h> #include "ttkTheme.h" -/* - *---------------------------------------------------------------------- +/*---------------------------------------------------------------------- * +++ Text element. * * This element displays a textual label in the foreground color. @@ -21,15 +20,13 @@ * is present and >= 0. */ -typedef struct -{ +typedef struct { /* * Element options: */ Tcl_Obj *textObj; Tcl_Obj *fontObj; Tcl_Obj *foregroundObj; - Tcl_Obj *backgroundObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Tcl_Obj *anchorObj; @@ -51,22 +48,19 @@ typedef struct /* Text element options table. * NB: Keep in sync with label element option table. */ -static Ttk_ElementOptionSpec TextElementOptions[] = -{ +static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, Tk_Offset(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, Tk_Offset(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, Tk_Offset(TextElement,foregroundObj), "black" }, - { "-background", TK_OPTION_BORDER, - Tk_Offset(TextElement,backgroundObj), DEFAULT_BACKGROUND }, { "-underline", TK_OPTION_INT, Tk_Offset(TextElement,underlineObj), "-1"}, { "-width", TK_OPTION_INT, Tk_Offset(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, - Tk_Offset(TextElement,anchorObj), "center"}, + Tk_Offset(TextElement,anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, Tk_Offset(TextElement,justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, @@ -209,8 +203,7 @@ static void TextElementDraw( } } -static Ttk_ElementSpec TextElementSpec = -{ +static Ttk_ElementSpec TextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), TextElementOptions, @@ -218,44 +211,12 @@ static Ttk_ElementSpec TextElementSpec = TextElementDraw }; -/* - * ImageTextElement -- - * Same as TextElement, but erases the background area first. - */ -static void ImageTextElementDraw( - void *clientData, void *elementRecord, Tk_Window tkwin, - Drawable d, Ttk_Box b, Ttk_State state) -{ - TextElement *text = elementRecord; - Tk_3DBorder bd = Tk_Get3DBorderFromObj(tkwin,text->backgroundObj); - - if (!TextSetup(text, tkwin)) - return; - - XFillRectangle(Tk_Display(tkwin), d, - Tk_3DBorderGC(tkwin, bd, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); - - TextDraw(text, tkwin, d, b); - TextCleanup(text); -} - -static Ttk_ElementSpec ImageTextElementSpec = -{ - TK_STYLE_VERSION_2, - sizeof(TextElement), - TextElementOptions, - TextElementSize, - ImageTextElementDraw -}; - -/* - *---------------------------------------------------------------------- +/*---------------------------------------------------------------------- * +++ Image element. * Draws an image. */ -typedef struct -{ +typedef struct { Tcl_Obj *imageObj; Tcl_Obj *stippleObj; /* For TTK_STATE_DISABLED */ Tcl_Obj *backgroundObj; /* " " */ @@ -268,8 +229,7 @@ typedef struct /* ===> NB: Keep in sync with label element option table. <=== */ -static Ttk_ElementOptionSpec ImageElementOptions[] = -{ +static Ttk_ElementOptionSpec ImageElementOptions[] = { { "-image", TK_OPTION_STRING, Tk_Offset(ImageElement,imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ @@ -393,8 +353,7 @@ static void ImageElementDraw( } } -static Ttk_ElementSpec ImageElementSpec = -{ +static Ttk_ElementSpec ImageElementSpec = { TK_STYLE_VERSION_2, sizeof(ImageElement), ImageElementOptions, @@ -433,8 +392,7 @@ static Ttk_ElementSpec ImageElementSpec = * Here, padding is handled by a different element. */ -typedef struct -{ +typedef struct { /* * Element options: */ @@ -451,8 +409,7 @@ typedef struct int totalWidth, totalHeight; } LabelElement; -static Ttk_ElementOptionSpec LabelElementOptions[] = -{ +static Ttk_ElementOptionSpec LabelElementOptions[] = { { "-compound", TK_OPTION_ANY, Tk_Offset(LabelElement,compoundObj), "none" }, { "-space", TK_OPTION_PIXELS, @@ -467,14 +424,12 @@ static Ttk_ElementOptionSpec LabelElementOptions[] = Tk_Offset(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, Tk_Offset(LabelElement,text.foregroundObj), "black" }, - { "-background", TK_OPTION_BORDER, - Tk_Offset(LabelElement,text.backgroundObj), DEFAULT_BACKGROUND }, { "-underline", TK_OPTION_INT, Tk_Offset(LabelElement,text.underlineObj), "-1"}, { "-width", TK_OPTION_INT, Tk_Offset(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, - Tk_Offset(LabelElement,text.anchorObj), "center"}, + Tk_Offset(LabelElement,text.anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, Tk_Offset(LabelElement,text.justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, @@ -687,8 +642,7 @@ static void LabelElementDraw( LabelCleanup(l); } -static Ttk_ElementSpec LabelElementSpec = -{ +static Ttk_ElementSpec LabelElementSpec = { TK_STYLE_VERSION_2, sizeof(LabelElement), LabelElementOptions, @@ -708,7 +662,5 @@ void TtkLabel_Init(Tcl_Interp *interp) Ttk_RegisterElement(interp, theme, "text", &TextElementSpec, NULL); Ttk_RegisterElement(interp, theme, "image", &ImageElementSpec, NULL); Ttk_RegisterElement(interp, theme, "label", &LabelElementSpec, NULL); - Ttk_RegisterElement(interp, theme, "Labelframe.text", /* @@@ */ - &ImageTextElementSpec,NULL); } diff --git a/generic/ttk/ttkLayout.c b/generic/ttk/ttkLayout.c index ca1a6e9..d604cfe 100644 --- a/generic/ttk/ttkLayout.c +++ b/generic/ttk/ttkLayout.c @@ -5,7 +5,7 @@ * * Copyright (c) 2003 Joe English. Freely redistributable. * - * $Id: ttkLayout.c,v 1.8 2007/03/21 20:06:41 jenglish Exp $ + * $Id: ttkLayout.c,v 1.8.2.1 2007/11/21 16:46:27 dgp Exp $ */ #include <string.h> @@ -280,6 +280,7 @@ static void TTKInitPadding(int padc, int pixels[4], Ttk_Padding *pad) { switch (padc) { + case 0: pixels[0] = 0; /*FALLTHRU*/ case 1: pixels[1] = pixels[0]; /*FALLTHRU*/ case 2: pixels[2] = pixels[0]; /*FALLTHRU*/ case 3: pixels[3] = pixels[1]; /*FALLTHRU*/ diff --git a/generic/ttk/ttkTheme.c b/generic/ttk/ttkTheme.c index 3dc1178..813330f 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.6.2.1 2007/11/12 19:22:37 dgp Exp $ + * $Id: ttkTheme.c,v 1.6.2.2 2007/11/21 16:46:27 dgp Exp $ */ #include <stdlib.h> @@ -1460,7 +1460,7 @@ static int StyleElementCreateCmd( FactoryRec *recPtr; if (objc < 5) { - Tcl_WrongNumArgs(interp, 5, objv, "name type ?options...?"); + Tcl_WrongNumArgs(interp, 3, objv, "name type ?options...?"); return TCL_ERROR; } diff --git a/library/tk.tcl b/library/tk.tcl index 20ce436..9ee09fe 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -3,7 +3,7 @@ # Initialization script normally executed in the interpreter for each # Tk-based application. Arranges class bindings for widgets. # -# RCS: @(#) $Id: tk.tcl,v 1.63.2.4 2007/10/27 04:23:16 dgp Exp $ +# RCS: @(#) $Id: tk.tcl,v 1.63.2.5 2007/11/21 16:46:27 dgp Exp $ # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. @@ -15,7 +15,7 @@ package require Tcl 8.5 ;# Guard against [source] in an 8.4- interp ;# before using 8.5 [package] features. # Insist on running with compatible version of Tcl -package require Tcl 8.5b1-8.6 +package require Tcl 8.5.0-8.6 # Verify that we have Tk binary and script components from the same release package require -exact Tk 8.5.0 diff --git a/library/ttk/altTheme.tcl b/library/ttk/altTheme.tcl index 62a0607..d892175 100644 --- a/library/ttk/altTheme.tcl +++ b/library/ttk/altTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: altTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $ +# $Id: altTheme.tcl,v 1.3.2.1 2007/11/21 16:46:27 dgp Exp $ # # Ttk widget set: Alternate theme # @@ -35,7 +35,8 @@ namespace eval ttk::theme::alt { style map "." -embossed [list disabled 1] ; style configure TButton \ - -width -11 -padding "1 1" -relief raised -shiftrelief 1 \ + -anchor center -width -11 -padding "1 1" \ + -relief raised -shiftrelief 1 \ -highlightthickness 1 -highlightcolor $colors(-frame) style map TButton -relief { @@ -51,7 +52,7 @@ namespace eval ttk::theme::alt { [list disabled $colors(-frame) pressed $colors(-frame)] style configure TMenubutton \ - -width -11 -padding "3 3" -relief raised -anchor w + -width -11 -padding "3 3" -relief raised style configure TEntry -padding 1 style map TEntry -fieldbackground \ diff --git a/library/ttk/aquaTheme.tcl b/library/ttk/aquaTheme.tcl index 5800a14..b90e148 100644 --- a/library/ttk/aquaTheme.tcl +++ b/library/ttk/aquaTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: aquaTheme.tcl,v 1.2.2.4 2007/11/01 16:37:23 dgp Exp $ +# $Id: aquaTheme.tcl,v 1.2.2.5 2007/11/21 16:46:27 dgp Exp $ # # Aqua theme (OSX native look and feel) # @@ -28,8 +28,7 @@ namespace eval ttk::theme::aqua { # ttk::style configure . -stipple {} - ttk::style configure TButton -padding {0 2} -width -6 - ttk::style configure TMenubutton -anchor w + ttk::style configure TButton -anchor center -width -6 ttk::style configure Toolbutton -padding 4 # See Apple HIG figs 14-63, 14-65 ttk::style configure TNotebook -tabposition n -padding {20 12} @@ -51,21 +50,12 @@ namespace eval ttk::theme::aqua { # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 255 - # Modify the the default Labelframe layout to use generic text element - # instead of Labelframe.text; the latter erases the window background - # (@@@ this still isn't right... want to fill with background pattern) - - ttk::style layout TLabelframe { - Labelframe.border - text - } - # # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls) # ttk::style configure TLabelframe \ - -labeloutside true -labelmargins {14 0 14 4} + -labeloutside true -labelmargins {14 0 14 4} # TODO: panedwindow sashes should be 9 pixels (HIG:Controls:Split Views) } diff --git a/library/ttk/clamTheme.tcl b/library/ttk/clamTheme.tcl index 930ec97..4a2325e 100644 --- a/library/ttk/clamTheme.tcl +++ b/library/ttk/clamTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: clamTheme.tcl,v 1.4 2006/12/18 19:33:14 jenglish Exp $ +# $Id: clamTheme.tcl,v 1.4.2.1 2007/11/21 16:46:27 dgp Exp $ # # "Clam" theme. # @@ -45,7 +45,8 @@ namespace eval ttk::theme::clam { ; # -selectbackground [list !focus "#847d73"] - ttk::style configure TButton -width -11 -padding 5 -relief raised + ttk::style configure TButton \ + -anchor center -width -11 -padding 5 -relief raised ttk::style map TButton \ -background [list \ disabled $colors(-frame) \ @@ -56,7 +57,8 @@ namespace eval ttk::theme::clam { -bordercolor [list alternate "#000000"] \ ; - ttk::style configure Toolbutton -padding 2 -relief flat + ttk::style configure Toolbutton \ + -anchor center -padding 2 -relief flat ttk::style map Toolbutton \ -relief [list \ disabled flat \ @@ -85,7 +87,7 @@ namespace eval ttk::theme::clam { [list disabled $colors(-frame) pressed $colors(-frame)] ttk::style configure TMenubutton \ - -width -11 -padding 5 -relief raised -anchor w + -width -11 -padding 5 -relief raised ttk::style configure TEntry -padding 1 -insertwidth 1 ttk::style map TEntry \ diff --git a/library/ttk/classicTheme.tcl b/library/ttk/classicTheme.tcl index 2061b4e..658acf6 100644 --- a/library/ttk/classicTheme.tcl +++ b/library/ttk/classicTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: classicTheme.tcl,v 1.3 2006/12/18 19:33:14 jenglish Exp $ +# $Id: classicTheme.tcl,v 1.3.2.1 2007/11/21 16:46:27 dgp Exp $ # # "classic" Tk theme. # @@ -45,7 +45,8 @@ namespace eval ttk::theme::classic { style map "." -highlightcolor [list focus black] - style configure TButton -padding "3m 1m" -relief raised -shiftrelief 1 + style configure TButton \ + -anchor center -padding "3m 1m" -relief raised -shiftrelief 1 style map TButton -relief [list {!disabled pressed} sunken] style configure TCheckbutton -indicatorrelief raised diff --git a/library/ttk/defaults.tcl b/library/ttk/defaults.tcl index d076d8e..19e82a8 100644 --- a/library/ttk/defaults.tcl +++ b/library/ttk/defaults.tcl @@ -1,5 +1,5 @@ # -# $Id: defaults.tcl,v 1.4 2006/12/18 19:33:14 jenglish Exp $ +# $Id: defaults.tcl,v 1.4.2.1 2007/11/21 16:46:27 dgp Exp $ # # Settings for default theme. # @@ -38,7 +38,8 @@ namespace eval ttk::theme::default { [list disabled $colors(-disabledfg)] ttk::style configure TButton \ - -padding "3 3" -width -9 -relief raised -shiftrelief 1 + -anchor center -padding "3 3" -width -9 \ + -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] ttk::style configure TCheckbutton \ @@ -52,7 +53,7 @@ namespace eval ttk::theme::default { [list pressed $colors(-activebg) selected $colors(-indicator)] ttk::style configure TMenubutton \ - -relief raised -padding "10 3" -anchor w + -relief raised -padding "10 3" ttk::style configure TEntry \ -relief sunken -fieldbackground white -padding 1 diff --git a/library/ttk/scrollbar.tcl b/library/ttk/scrollbar.tcl index 6b37b24..0efe789 100644 --- a/library/ttk/scrollbar.tcl +++ b/library/ttk/scrollbar.tcl @@ -1,9 +1,27 @@ # -# $Id: scrollbar.tcl,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: scrollbar.tcl,v 1.1.2.1 2007/11/21 16:46:27 dgp Exp $ # # Bindings for TScrollbar widget # +# Still don't have a working ttk::scrollbar under OSX - +# Swap in a [tk::scrollbar] on that platform, +# unless user specifies -class or -style. +# +if {[tk windowingsystem] eq "aqua"} { + rename ::ttk::scrollbar ::ttk::_scrollbar + proc ttk::scrollbar {w args} { + set constructor ::tk::scrollbar + foreach {option _} $args { + if {$option eq "-class" || $option eq "-style"} { + set constructor ::ttk::_scrollbar + break + } + } + return [$constructor $w {*}$args] + } +} + namespace eval ttk::scrollbar { variable State # State(xPress) -- diff --git a/library/ttk/winTheme.tcl b/library/ttk/winTheme.tcl index 30736f8..0887e1f 100644 --- a/library/ttk/winTheme.tcl +++ b/library/ttk/winTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: winTheme.tcl,v 1.3.2.1 2007/10/17 14:37:05 dgp Exp $ +# $Id: winTheme.tcl,v 1.3.2.2 2007/11/21 16:46:27 dgp Exp $ # # Settings for 'winnative' theme. # @@ -19,11 +19,12 @@ namespace eval ttk::theme::winnative { ttk::style map "." -foreground [list disabled SystemGrayText] ; ttk::style map "." -embossed [list disabled 1] ; - ttk::style configure TButton -width -11 -relief raised -shiftrelief 1 + ttk::style configure TButton \ + -anchor center -width -11 -relief raised -shiftrelief 1 ttk::style configure TCheckbutton -padding "2 4" ttk::style configure TRadiobutton -padding "2 4" ttk::style configure TMenubutton \ - -padding "8 4" -arrowsize 3 -relief raised -anchor w + -padding "8 4" -arrowsize 3 -relief raised ttk::style map TButton -relief {{!disabled pressed} sunken} diff --git a/library/ttk/xpTheme.tcl b/library/ttk/xpTheme.tcl index 7420950..eba4676 100644 --- a/library/ttk/xpTheme.tcl +++ b/library/ttk/xpTheme.tcl @@ -1,5 +1,5 @@ # -# $Id: xpTheme.tcl,v 1.3.2.1 2007/10/17 14:37:05 dgp Exp $ +# $Id: xpTheme.tcl,v 1.3.2.2 2007/11/21 16:46:27 dgp Exp $ # # Settings for 'xpnative' theme # @@ -20,10 +20,10 @@ namespace eval ttk::theme::xpnative { -foreground [list disabled SystemGrayText] \ ; - ttk::style configure TButton -padding {1 1} -width -11 + ttk::style configure TButton -anchor center -padding {1 1} -width -11 ttk::style configure TRadiobutton -padding 2 ttk::style configure TCheckbutton -padding 2 - ttk::style configure TMenubutton -padding {8 4} -anchor w + ttk::style configure TMenubutton -padding {8 4} ttk::style configure TNotebook -tabmargins {2 2 2 0} ttk::style map TNotebook.Tab \ diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c index d78670e..34128e9 100644 --- a/macosx/tkMacOSXFont.c +++ b/macosx/tkMacOSXFont.c @@ -35,7 +35,7 @@ * that such fonts can not be used for controls, because controls * definitely require a family id (this assertion needs testing). * - * RCS: @(#) $Id: tkMacOSXFont.c,v 1.24.2.9 2007/11/13 13:08:44 dgp Exp $ + * RCS: @(#) $Id: tkMacOSXFont.c,v 1.24.2.10 2007/11/21 16:46:27 dgp Exp $ */ #include "tkMacOSXPrivate.h" @@ -938,13 +938,13 @@ TkpMeasureCharsInContext( */ if (flags & TK_WHOLE_WORDS) { - if ((flags & TK_AT_LEAST_ONE) - && ((offset == urstart) || (uchars[offset] != ' '))) { + if ((flags & TK_AT_LEAST_ONE) && ((offset == urstart) + || ((offset != urend) && (uchars[offset] != ' ')))) { /* * With TK_AT_LEAST_ONE, if we are the the start of the * range, we need to add at least one character. If we are * not at the end of a word, we must be in the middle of the - * first word still and we want to run with what we have so + * first word still and we want to just use what we have so * far. In both cases we still need to find the right * character boundary, so we set a flag that gets us into the * code for character mode below. @@ -971,13 +971,15 @@ TkpMeasureCharsInContext( /* * If "flags" says that we don't actually want a word break, we need - * to find the next character break ourself, as ATSUBreakLine() will - * only give us word breaks. Do a simple linear search. + * to find the next character break ourself, as ATSUBreakLine will + * only give us word breaks. Do a simple linear search. + * + * Even do this, if ATSUBreakLine returned kATSULineBreakInWord, + * because we have not accounted correctly for all of the flags yet, + * like TK_AT_LEAST_ONE. */ - if ((err != kATSULineBreakInWord) - && (!(flags & TK_WHOLE_WORDS) || forceCharacterMode) - && (offset <= urend)) { + if ((!(flags & TK_WHOLE_WORDS) || forceCharacterMode) && (offset <= urend)) { UniCharArrayOffset lastOffset = offset; UniCharArrayOffset nextoffset; int lastX = -1; diff --git a/macosx/ttkMacOSXTheme.c b/macosx/ttkMacOSXTheme.c index 0bf4041..95d8723 100644 --- a/macosx/ttkMacOSXTheme.c +++ b/macosx/ttkMacOSXTheme.c @@ -27,17 +27,34 @@ * top-level window, not to the Tk_Window. BoxToRect() * accounts for this. * - * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.7.2.6 2007/11/12 19:22:39 dgp Exp $ + * RCS: @(#) $Id: ttkMacOSXTheme.c,v 1.7.2.7 2007/11/21 16:46:28 dgp Exp $ */ #include "tkMacOSXPrivate.h" #include "ttk/ttkTheme.h" +#if !defined(BUILD_tile) +/* + * Use this version in the core: + */ #define BEGIN_DRAWING(d) { \ TkMacOSXDrawingContext dc; \ if (!TkMacOSXSetupDrawingContext((d), NULL, 0, &dc)) {return;} #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc); } +#else /* BUILD_tile */ +/* + * TkMacOSXSetupDrawingContext is not available to extensions, + * need to do this the hard way in Tile: + */ +#define BEGIN_DRAWING(d) { \ + CGrafPtr saveWorld; GDHandle saveDevice; \ + GetGWorld(&saveWorld, &saveDevice); \ + SetGWorld(TkMacOSXGetDrawablePort(d), 0); \ + TkMacOSXSetUpClippingRgn(d); +#define END_DRAWING \ + SetGWorld(saveWorld,saveDevice); } +#endif /* defined(BUILD_TILE) */ /*---------------------------------------------------------------------- * +++ Utilities. @@ -186,16 +203,17 @@ static void ButtonElementSize( static const Rect scratchBounds = {0, 0, 100, 100}; Rect contentBounds; - ButtonElementSizeNoPadding(clientData, elementRecord, tkwin, widthPtr, - heightPtr, paddingPtr); + ButtonElementSizeNoPadding( + clientData, elementRecord, tkwin, + widthPtr, heightPtr, paddingPtr); /* * To compute internal padding, query the appearance manager * for the content bounds of a dummy rectangle, then use * the difference as the padding. */ - ChkErr(GetThemeButtonContentBounds, &scratchBounds, parms->kind, &info, - &contentBounds); + ChkErr(GetThemeButtonContentBounds, + &scratchBounds, parms->kind, &info, &contentBounds); paddingPtr->left = contentBounds.left; paddingPtr->top = contentBounds.top; @@ -270,11 +288,11 @@ static void TabElementDraw( Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); + ThemeTabStyle tabStyle = Ttk_StateTableLookup(TabStyleTable, state); bounds.bottom += TAB_OVERLAP; BEGIN_DRAWING(d) - ChkErr(DrawThemeTab, &bounds, Ttk_StateTableLookup(TabStyleTable, state), - kThemeTabNorth, 0, 0); + ChkErr(DrawThemeTab, &bounds, tabStyle, kThemeTabNorth, 0, 0); END_DRAWING } @@ -302,10 +320,10 @@ static void PaneElementDraw( Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); + ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); BEGIN_DRAWING(d) - ChkErr(DrawThemeTabPane, &bounds, - Ttk_StateTableLookup(ThemeStateTable, state)); + ChkErr(DrawThemeTabPane, &bounds, drawState); END_DRAWING } @@ -339,10 +357,10 @@ static void GroupElementDraw( Drawable d, Ttk_Box b, Ttk_State state) { Rect bounds = BoxToRect(d, b); + ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); BEGIN_DRAWING(d) - ChkErr(DrawThemePrimaryGroup, &bounds, - Ttk_StateTableLookup(ThemeStateTable, state)); + ChkErr(DrawThemePrimaryGroup, &bounds, drawState); END_DRAWING } @@ -385,6 +403,7 @@ static void EntryElementDraw( Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin,e->backgroundObj); Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3)); Rect bounds = BoxToRect(d, inner); + ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); /* * Erase w/background color: @@ -394,15 +413,7 @@ static void EntryElementDraw( inner.x,inner.y, inner.width, inner.height); BEGIN_DRAWING(d) - /* - * Draw border: - */ - ChkErr(DrawThemeEditTextFrame, &bounds, - Ttk_StateTableLookup(ThemeStateTable, state)); - - /* - * Draw focus highlight: - */ + ChkErr(DrawThemeEditTextFrame, &bounds, drawState); if (state & TTK_STATE_FOCUS) { ChkErr(DrawThemeFocusRect, &bounds, 1); } @@ -446,8 +457,8 @@ static void ComboboxElementDraw( Rect bounds = BoxToRect(d, Ttk_PadBox(b, ComboboxMargins)); BEGIN_DRAWING(d) - ChkErr(DrawThemeButton, &bounds, kThemeComboBox, &info, NULL, NULL, NULL, - 0); + ChkErr(DrawThemeButton, + &bounds, kThemeComboBox, &info, NULL, NULL, NULL, 0); END_DRAWING } @@ -521,8 +532,7 @@ static void TrackElementDraw( Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); - /* - * @@@ BUG: min, max, and value should account for resolution: + /* @@@ BUG: min, max, and value should account for resolution: * @@@ if finer than 1.0, conversion to int breaks. */ info.kind = data->kind; @@ -688,14 +698,14 @@ static void SeparatorElementDraw( Drawable d, Ttk_Box b, unsigned int state) { Rect bounds = BoxToRect(d, b); + ThemeDrawState drawState = Ttk_StateTableLookup(ThemeStateTable, state); /* * DrawThemeSeparator only supports kThemeStateActive / kThemeStateInactive */ state &= TTK_STATE_BACKGROUND; BEGIN_DRAWING(d) - ChkErr(DrawThemeSeparator, &bounds, - Ttk_StateTableLookup(ThemeStateTable, state)); + ChkErr(DrawThemeSeparator, &bounds, drawState); END_DRAWING } @@ -717,11 +727,11 @@ static void SizegripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { - Rect bounds; Point origin = {0, 0}; + Rect bounds; - ChkErr(GetThemeStandaloneGrowBoxBounds, origin, sizegripGrowDirection, - false, &bounds); + ChkErr(GetThemeStandaloneGrowBoxBounds, + origin, sizegripGrowDirection, false, &bounds); *widthPtr = bounds.right - bounds.left; *heightPtr = bounds.bottom - bounds.top; } @@ -737,8 +747,9 @@ static void SizegripElementDraw( state &= TTK_STATE_BACKGROUND; BEGIN_DRAWING(d) - ChkErr(DrawThemeStandaloneGrowBox, origin, sizegripGrowDirection, false, - Ttk_StateTableLookup(ThemeStateTable, state)); + ChkErr(DrawThemeStandaloneGrowBox, + origin, sizegripGrowDirection, false, + Ttk_StateTableLookup(ThemeStateTable, state)); END_DRAWING } @@ -751,7 +762,7 @@ static Ttk_ElementSpec SizegripElementSpec = { }; /*---------------------------------------------------------------------- - * +++ Background element. + * +++ Background and fill elements. * * This isn't quite right: In Aqua, the correct background for * a control depends on what kind of container it belongs to, @@ -762,14 +773,14 @@ static Ttk_ElementSpec SizegripElementSpec = { * off-screen graphics port this leads to alignment glitches. */ -static void BackgroundElementDraw( +static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { + Rect bounds = BoxToRect(d, b); ThemeBrush brush = (state & TTK_STATE_BACKGROUND) ? kThemeBrushModelessDialogBackgroundInactive : kThemeBrushModelessDialogBackgroundActive; - Rect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); BEGIN_DRAWING(d) ChkErr(SetThemeBackground, brush, 32, true); @@ -778,6 +789,23 @@ static void BackgroundElementDraw( END_DRAWING } +static void BackgroundElementDraw( + void *clientData, void *elementRecord, Tk_Window tkwin, + Drawable d, Ttk_Box b, unsigned int state) +{ + FillElementDraw( + clientData, elementRecord, tkwin, + d, Ttk_WinBox(tkwin), state); +} + +static Ttk_ElementSpec FillElementSpec = { + TK_STYLE_VERSION_2, + sizeof(NullElement), + TtkNullElementOptions, + TtkNullElementSize, + FillElementDraw +}; + static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), @@ -837,8 +865,8 @@ static void TreeHeaderElementDraw( Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParms *parms = clientData; - ThemeButtonDrawInfo info; Rect bounds = BoxToRect(d, b); + ThemeButtonDrawInfo info; info.state = Ttk_StateTableLookup(ThemeStateTable, state); info.value = Ttk_StateTableLookup(ButtonValueTable, state); @@ -872,30 +900,28 @@ static void DisclosureElementSize( int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { SInt32 s; - - ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s); - *widthPtr = s; - ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s); - *heightPtr = s; + GetThemeMetric(kThemeMetricDisclosureTriangleWidth, &s); *widthPtr = s; + GetThemeMetric(kThemeMetricDisclosureTriangleHeight, &s); *heightPtr = s; } static void DisclosureElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { - ThemeButtonDrawInfo info; Rect bounds = BoxToRect(d, b); + ThemeButtonDrawInfo info; if (state & TTK_TREEVIEW_STATE_LEAF) { return; } + info.state = Ttk_StateTableLookup(ThemeStateTable, state); info.value = Ttk_StateTableLookup(DisclosureValueTable, state); info.adornment = kThemeAdornmentDrawIndicatorOnly; BEGIN_DRAWING(d) - ChkErr(DrawThemeButton, &bounds, kThemeDisclosureTriangle, &info, NULL, - DontErase, NULL, 0); + ChkErr(DrawThemeButton, + &bounds, kThemeDisclosureTriangle, &info, NULL, DontErase, NULL, 0); END_DRAWING } @@ -986,26 +1012,27 @@ static int AquaTheme_Init(Tcl_Interp *interp) /* * Elements: */ - Ttk_RegisterElementSpec(themePtr,"background",&BackgroundElementSpec,0); - Ttk_RegisterElementSpec(themePtr,"Toolbar.background", - &ToolbarBackgroundElementSpec, 0); + Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0); + Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0); + Ttk_RegisterElementSpec(themePtr, "Toolbar.background", + &ToolbarBackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Button.button", - &ButtonElementSpec, &PushButtonParms); + &ButtonElementSpec, &PushButtonParms); Ttk_RegisterElementSpec(themePtr, "Checkbutton.button", - &ButtonElementSpec, &CheckBoxParms); + &ButtonElementSpec, &CheckBoxParms); Ttk_RegisterElementSpec(themePtr, "Radiobutton.button", - &ButtonElementSpec, &RadioButtonParms); + &ButtonElementSpec, &RadioButtonParms); Ttk_RegisterElementSpec(themePtr, "Toolbutton.border", - &ButtonElementSpec, &BevelButtonParms); + &ButtonElementSpec, &BevelButtonParms); Ttk_RegisterElementSpec(themePtr, "Menubutton.button", - &ButtonElementSpec, &PopupButtonParms); + &ButtonElementSpec, &PopupButtonParms); Ttk_RegisterElementSpec(themePtr, "Combobox.button", - &ComboboxElementSpec, 0); + &ComboboxElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator", - &DisclosureElementSpec, &DisclosureParms); + &DisclosureElementSpec, &DisclosureParms); Ttk_RegisterElementSpec(themePtr, "Treeheading.cell", - &TreeHeaderElementSpec, &ListHeaderParms); + &TreeHeaderElementSpec, &ListHeaderParms); Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0); @@ -1026,7 +1053,7 @@ static int AquaTheme_Init(Tcl_Interp *interp) * we do all the drawing in the ".track" element and leave the .pbar out. */ Ttk_RegisterElementSpec(themePtr,"Scale.trough", - &TrackElementSpec, &ScaleData); + &TrackElementSpec, &ScaleData); Ttk_RegisterElementSpec(themePtr,"Scale.slider",&SliderElementSpec,0); Ttk_RegisterElementSpec(themePtr,"Progressbar.track", &PbarElementSpec, 0); diff --git a/tests/font.test b/tests/font.test index 3dce0f7..c82e366 100644 --- a/tests/font.test +++ b/tests/font.test @@ -6,7 +6,7 @@ # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: font.test,v 1.15 2007/04/24 15:54:30 hobbs Exp $ +# RCS: @(#) $Id: font.test,v 1.15.2.1 2007/11/21 16:46:28 dgp Exp $ package require tcltest 2.1 eval tcltest::configure $argv @@ -309,8 +309,8 @@ test font-8.4 {font command: families} { test font-9.1 {font command: measure: arguments} { # (skip < 0) - list [catch {font measure xyz -displayof} msg] $msg -} {1 {value for "-displayof" missing}} + list [catch {expr {[font measure xyz -displayof]>0}} msg] $msg +} {0 1} test font-9.2 {font command: measure: arguments} { # (objc - skip != 4) list [catch {font measure} msg] $msg @@ -327,6 +327,15 @@ test font-9.5 {font command: measure} { # Tk_TextWidth() expr [font measure $fixed "abcdefg"]==[font measure $fixed "a"]*7 } {1} +test font-9.6 {font command: measure -d} { + list [catch {expr {[font measure $fixed -d] > 0}} msg] $msg +} {0 1} +test font-9.7 {font command: measure -d with -displayof} { + list [catch {expr {[font measure $fixed -displayof . -d] > 0}} msg] $msg +} {0 1} +test font-9.8 {font command: measure: arguments} { + list [catch {font measure $fixed -displayof .} msg] $msg +} {1 {wrong # args: should be "font measure font ?-displayof window? text"}} test font-10.1 {font command: metrics: arguments} { list [catch {font metrics xyz -displayof} msg] $msg diff --git a/tests/ttk/scrollbar.test b/tests/ttk/scrollbar.test index f91659a..565d299 100644 --- a/tests/ttk/scrollbar.test +++ b/tests/ttk/scrollbar.test @@ -1,11 +1,42 @@ # -# $Id: scrollbar.test,v 1.1 2006/10/31 01:42:27 hobbs Exp $ +# $Id: scrollbar.test,v 1.1.2.1 2007/11/21 16:46:28 dgp Exp $ # package require Tk 8.5 package require tcltest ; namespace import -force tcltest::* loadTestedCommands +testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] + +test scrollbar-swapout-1 "Use core scrollbars on OSX..." -constraints { + coreScrollbar +} -body { + ttk::scrollbar .sb -command "yadda" + list [winfo class .sb] [.sb cget -command] +} -result [list Scrollbar yadda] -cleanup { + destroy .sb +} + +test scrollbar-swapout-2 "... unless -style is specified ..." -constraints { + coreScrollbar +} -body { + ttk::style layout Vertical.Custom.TScrollbar \ + [ttk::style layout Vertical.TScrollbar] ; # See #1833339 + ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar + list [winfo class .sb] [.sb cget -command] [.sb cget -style] +} -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { + destroy .sb +} + +test scrollbar-swapout-3 "... or -class." -constraints { + coreScrollbar +} -body { + ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar + list [winfo class .sb] [.sb cget -command] +} -result [list Custom.TScrollbar yadda] -cleanup { + destroy .sb +} + test scrollbar-1.0 "Setup" -body { ttk::scrollbar .tsb } -result .tsb diff --git a/tests/ttk/ttk.test b/tests/ttk/ttk.test index 4f91eb0..cd3291b 100644 --- a/tests/ttk/ttk.test +++ b/tests/ttk/ttk.test @@ -587,6 +587,19 @@ test ttk-14.3 "-textvariable in nonexistant namespace" -body { -match glob -cleanup { destroy .tw } +test ttk-15.1 "style element create: insufficient args" -body { + ttk::style element create +} -returnCodes 1 -match glob -result "wrong # args:*" +test ttk-15.2 "style element create: insufficient args" -body { + ttk::style element create plain.background +} -returnCodes 1 -match glob -result "wrong # args:*" +test ttk-15.3 "style element create: insufficient args" -body { + ttk::style element create plain.background from +} -returnCodes 1 -match glob -result "wrong # args:*" +test ttk-15.4 "style element create: valid" -body { + ttk::style element create plain.background from default +} -returnCodes 0 -result "" + eval destroy [winfo children .] tcltest::cleanupTests diff --git a/unix/configure b/unix/configure index 4d45e0f..bbe6c9e 100755 --- a/unix/configure +++ b/unix/configure @@ -1476,7 +1476,7 @@ echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then echo "$as_me:$LINENO: result: loading" >&5 echo "${ECHO_T}loading" >&6 - . ${TCL_BIN_DIR}/tclConfig.sh + . "${TCL_BIN_DIR}/tclConfig.sh" else echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6 @@ -5216,12 +5216,12 @@ fi # Use updated header definitions where possible cat >>confdefs.h <<\_ACEOF -#define _XOPEN_SOURCE 1 +#define _XOPEN_SOURCE_EXTENDED 1 _ACEOF cat >>confdefs.h <<\_ACEOF -#define _XOPEN_SOURCE_EXTENDED 1 +#define _XOPEN_SOURCE 1 _ACEOF LIBS="$LIBS -lxnet" # Use the XOPEN network library @@ -6158,9 +6158,24 @@ echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6 fi + if test "$tcl_cv_cc_visibility_hidden" != yes; then + + +cat >>confdefs.h <<\_ACEOF +#define MODULE_SCOPE __private_extern__ +_ACEOF + + +fi + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + +cat >>confdefs.h <<\_ACEOF +#define MAC_OSX_TCL 1 +_ACEOF + PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' echo "$as_me:$LINENO: checking whether to use CoreFoundation" >&5 @@ -6345,21 +6360,6 @@ fi fi - if test "$tcl_cv_cc_visibility_hidden" != yes; then - - -cat >>confdefs.h <<\_ACEOF -#define MODULE_SCOPE __private_extern__ -_ACEOF - - -fi - - -cat >>confdefs.h <<\_ACEOF -#define MAC_OSX_TCL 1 -_ACEOF - ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -9406,7 +9406,7 @@ ac_x_header_dirs=' /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Intrinsic.h. + # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -9414,7 +9414,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/Intrinsic.h> +#include <X11/Xlib.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -9441,7 +9441,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Intrinsic.h"; then + if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi @@ -9455,18 +9455,18 @@ if test "$ac_x_libraries" = no; then # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS - LIBS="-lXt $LIBS" + LIBS="-lX11 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/Intrinsic.h> +#include <X11/Xlib.h> int main () { -XtMalloc (0) +XrmInitialize () ; return 0; } diff --git a/unix/configure.in b/unix/configure.in index 84b66a6..0739a21 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.134.2.8 2007/10/27 04:23:18 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.134.2.9 2007/11/21 16:46:30 dgp Exp $ AC_INIT([tk],[8.5]) AC_PREREQ(2.59) diff --git a/unix/tcl.m4 b/unix/tcl.m4 index 5b6f6eb..3cc5dc9 100644 --- a/unix/tcl.m4 +++ b/unix/tcl.m4 @@ -231,6 +231,7 @@ AC_DEFUN([SC_PATH_TKCONFIG], [ fi done fi + # check in a few other private locations if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ @@ -282,7 +283,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [ if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then AC_MSG_RESULT([loading]) - . ${TCL_BIN_DIR}/tclConfig.sh + . "${TCL_BIN_DIR}/tclConfig.sh" else AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) fi @@ -1287,8 +1288,8 @@ dnl AC_CHECK_TOOL(AR, ar) ;; HP-UX-*.11.*) # Use updated header definitions where possible - AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?]) + AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?]) LIBS="$LIBS -lxnet" # Use the XOPEN network library AS_IF([test "`uname -m`" = ia64], [ @@ -1660,9 +1661,14 @@ dnl AC_CHECK_TOOL(AR, ar) AS_IF([test $tcl_cv_ld_search_paths_first = yes], [ LDFLAGS="$LDFLAGS -Wl,-search_paths_first" ]) + AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ + AC_DEFINE(MODULE_SCOPE, [__private_extern__], + [Compiler support for module scope symbols]) + ]) CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) PLAT_OBJS='${MAC_OSX_OBJS}' PLAT_SRCS='${MAC_OSX_SRCS}' AC_MSG_CHECKING([whether to use CoreFoundation]) @@ -1718,11 +1724,6 @@ dnl AC_CHECK_TOOL(AR, ar) ]) ]) ]) - AS_IF([test "$tcl_cv_cc_visibility_hidden" != yes], [ - AC_DEFINE(MODULE_SCOPE, [__private_extern__], - [Compiler support for module scope symbols]) - ]) - AC_DEFINE(MAC_OSX_TCL, 1, [Is this a Mac I see before me?]) ;; NEXTSTEP-*) SHLIB_CFLAGS="" diff --git a/unix/tk.spec b/unix/tk.spec index 19d02f8..a393410 100644 --- a/unix/tk.spec +++ b/unix/tk.spec @@ -1,4 +1,4 @@ -# $Id: tk.spec,v 1.25.2.3 2007/10/27 04:23:18 dgp Exp $ +# $Id: tk.spec,v 1.25.2.4 2007/11/21 16:46:30 dgp Exp $ # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} diff --git a/win/configure.in b/win/configure.in index ded20b5..c59fbe7 100644 --- a/win/configure.in +++ b/win/configure.in @@ -3,7 +3,7 @@ # generate the file "configure", which is run during Tk installation # to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.66.2.4 2007/10/27 04:23:18 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.66.2.5 2007/11/21 16:46:30 dgp Exp $ AC_INIT(../generic/tk.h) AC_PREREQ(2.59) diff --git a/win/makefile.vc b/win/makefile.vc index 561d9ad..6798902 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2004 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.103.2.5 2007/10/19 14:35:35 dgp Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.103.2.6 2007/11/21 16:46:31 dgp Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -534,12 +534,13 @@ tktest: setup $(TKTEST) $(CAT32) test: test-classic test-ttk test-classic: setup $(TKTEST) $(TKLIB) $(CAT32) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= !if $(TCLINSTALL) - set PATH=$(_TCLDIR)\bin;$(PATH) + @set PATH=$(_TCLDIR)\bin;$(PATH) !else - set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif !if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" $(TKTEST) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) | $(CAT32) @@ -548,12 +549,13 @@ test-classic: setup $(TKTEST) $(TKLIB) $(CAT32) !endif test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= !if $(TCLINSTALL) - set PATH=$(_TCLDIR)\bin;$(PATH) + @set PATH=$(_TCLDIR)\bin;$(PATH) !else - set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif !if "$(OS)" == "Windows_NT" || "$(MSVCDIR)" == "IDE" $(TKTEST) "$(ROOT)/tests/ttk/all.tcl" $(TESTFLAGS) | $(CAT32) @@ -562,32 +564,51 @@ test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32) !endif runtest: setup $(TKTEST) $(TKLIB) $(CAT32) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= !if $(TCLINSTALL) - set PATH=$(_TCLDIR)\bin;$(PATH) + @set PATH=$(_TCLDIR)\bin;$(PATH) !else - set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(TKTEST) rundemo: setup $(TKTEST) $(TKLIB) $(CAT32) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= !if $(TCLINSTALL) - set PATH=$(_TCLDIR)\bin;$(PATH) + @set PATH=$(_TCLDIR)\bin;$(PATH) !else - set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) !endif $(TKTEST) $(ROOT)\library\demos\widget shell: setup $(WISH) - set TCL_LIBRARY=$(TCL_LIBRARY) - set TK_LIBRARY=$(TK_LIBRARY) - $(WISH) << - console show + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= +!if $(TCLINSTALL) + @set PATH=$(_TCLDIR)\bin;$(PATH) +!else + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) +!endif + $(WISH) << + console show << +dbgshell: setup $(WISH) + @set TCL_LIBRARY=$(TCL_LIBRARY:\=/) + @set TK_LIBRARY=$(TK_LIBRARY:\=/) + @set TCLLIBPATH= +!if $(TCLINSTALL) + @set PATH=$(_TCLDIR)\bin;$(PATH) +!else + @set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH) +!endif + windbg $(WISH) + setup: @if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR) @if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR) diff --git a/win/tkWinFont.c b/win/tkWinFont.c index 5ccdc81..078e521 100644 --- a/win/tkWinFont.c +++ b/win/tkWinFont.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tkWinFont.c,v 1.32.2.3 2007/11/01 16:37:25 dgp Exp $ + * RCS: @(#) $Id: tkWinFont.c,v 1.32.2.4 2007/11/21 16:46:31 dgp Exp $ */ #include "tkWinInt.h" @@ -1393,11 +1393,14 @@ InitFont( Tcl_ExternalToUtfDString(systemEncoding, buf, -1, &faceString); fontPtr->font.fid = (Font) fontPtr; + fontPtr->hwnd = hwnd; + fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading; faPtr = &fontPtr->font.fa; faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString)); + faPtr->size = - TkFontGetPoints(tkwin, -(tm.tmHeight - tm.tmInternalLeading)); + TkFontGetPoints(tkwin, -(fontPtr->pixelSize)); faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL; faPtr->slant = (tm.tmItalic != 0) ? TK_FS_ITALIC : TK_FS_ROMAN; @@ -1410,9 +1413,6 @@ InitFont( fmPtr->maxWidth = tm.tmMaxCharWidth; fmPtr->fixed = !(tm.tmPitchAndFamily & TMPF_FIXED_PITCH); - fontPtr->hwnd = hwnd; - fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading; - fontPtr->numSubFonts = 1; fontPtr->subFontArray = fontPtr->staticSubFonts; InitSubFont(hdc, hFont, 1, &fontPtr->subFontArray[0]); diff --git a/win/ttkWinXPTheme.c b/win/ttkWinXPTheme.c index d26d046..fde13bd 100644 --- a/win/ttkWinXPTheme.c +++ b/win/ttkWinXPTheme.c @@ -1,5 +1,5 @@ /* - * $Id: ttkWinXPTheme.c,v 1.12.2.2 2007/11/12 19:22:40 dgp Exp $ + * $Id: ttkWinXPTheme.c,v 1.12.2.3 2007/11/21 16:46:31 dgp Exp $ * * Tk theme engine which uses the Windows XP "Visual Styles" API * Adapted from Georgios Petasis' XP theme patch. @@ -43,6 +43,7 @@ typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme, typedef HRESULT (STDAPICALLTYPE GetThemePartSizeProc)(HTHEME,HDC, int iPartId, int iStateId, RECT *prc, enum THEMESIZE eSize, SIZE *psz); +typedef int (STDAPICALLTYPE GetThemeSysSizeProc)(HTHEME,int); /* GetThemeTextExtent and DrawThemeText only used with BROKEN_TEXT_ELEMENT */ typedef HRESULT (STDAPICALLTYPE GetThemeTextExtentProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, LPCWSTR pszText, int iCharCount, @@ -58,6 +59,7 @@ typedef struct OpenThemeDataProc *OpenThemeData; CloseThemeDataProc *CloseThemeData; GetThemePartSizeProc *GetThemePartSize; + GetThemeSysSizeProc *GetThemeSysSize; DrawThemeBackgroundProc *DrawThemeBackground; DrawThemeTextProc *DrawThemeText; GetThemeTextExtentProc *GetThemeTextExtent; @@ -110,6 +112,7 @@ LoadXPThemeProcs(HINSTANCE *phlib) if ( LOADPROC(OpenThemeData) && LOADPROC(CloseThemeData) && LOADPROC(GetThemePartSize) + && LOADPROC(GetThemeSysSize) && LOADPROC(DrawThemeBackground) && LOADPROC(GetThemeTextExtent) && LOADPROC(DrawThemeText) @@ -368,8 +371,8 @@ typedef struct /* XP element specifications */ Ttk_StateTable *statemap; /* Map Tk states to XP states */ Ttk_Padding padding; /* See NOTE-GetThemeMargins */ int flags; -# define IGNORE_THEMESIZE 0x1 /* See NOTE-GetThemePartSize */ -# define PAD_MARGINS 0x2 /* See NOTE-GetThemeMargins */ +# define IGNORE_THEMESIZE 0x80000000 /* See NOTE-GetThemePartSize */ +# define PAD_MARGINS 0x40000000 /* See NOTE-GetThemeMargins */ } ElementInfo; typedef struct @@ -536,6 +539,41 @@ static Ttk_ElementSpec GenericElementSpec = }; /*---------------------------------------------------------------------- + * +++ Sized element implementation. + * + * Used for elements which are handled entirely by the XP Theme API, + * but that require a fixed size adjustment. + * Note that GetThemeSysSize calls through to GetSystemMetrics + */ + +static void +GenericSizedElementSize( + void *clientData, void *elementRecord, Tk_Window tkwin, + int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) +{ + ElementData *elementData = clientData; + + if (!InitElementData(elementData, tkwin, 0)) + return; + + GenericElementSize(clientData, elementRecord, tkwin, + widthPtr, heightPtr, paddingPtr); + + *widthPtr = elementData->procs->GetThemeSysSize(NULL, + (elementData->info->flags >> 8) & 0xff); + *heightPtr = elementData->procs->GetThemeSysSize(NULL, + elementData->info->flags & 0xff); +} + +static Ttk_ElementSpec GenericSizedElementSpec = { + TK_STYLE_VERSION_2, + sizeof(NullElement), + TtkNullElementOptions, + GenericSizedElementSize, + GenericElementDraw +}; + +/*---------------------------------------------------------------------- * +++ Scrollbar thumb element. * Same as a GenericElement, but don't draw in the disabled state. */ @@ -853,8 +891,9 @@ static ElementInfo ElementInfoTable[] = { edittext_statemap, PAD(1, 1, 1, 1), 0 }, { "Combobox.field", &GenericElementSpec, L"EDIT", EP_EDITTEXT, combotext_statemap, PAD(1, 1, 1, 1), 0 }, - { "Combobox.downarrow", &GenericElementSpec, L"COMBOBOX", - CP_DROPDOWNBUTTON, combobox_statemap, NOPAD, 0 }, + { "Combobox.downarrow", &GenericSizedElementSpec, L"COMBOBOX", + CP_DROPDOWNBUTTON, combobox_statemap, NOPAD, + (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, { "Vertical.Scrollbar.trough", &GenericElementSpec, L"SCROLLBAR", SBP_UPPERTRACKVERT, scrollbar_statemap, NOPAD, 0 }, { "Vertical.Scrollbar.thumb", &ThumbElementSpec, L"SCROLLBAR", @@ -867,14 +906,18 @@ static ElementInfo ElementInfoTable[] = { SBP_THUMBBTNHORZ, scrollbar_statemap, NOPAD, 0 }, { "Horizontal.Scrollbar.grip", &GenericElementSpec, L"SCROLLBAR", SBP_GRIPPERHORZ, scrollbar_statemap, NOPAD, 0 }, - { "Scrollbar.uparrow", &GenericElementSpec, L"SCROLLBAR", - SBP_ARROWBTN, uparrow_statemap, NOPAD, 0 }, - { "Scrollbar.downarrow", &GenericElementSpec, L"SCROLLBAR", - SBP_ARROWBTN, downarrow_statemap, NOPAD, 0 }, - { "Scrollbar.leftarrow", &GenericElementSpec, L"SCROLLBAR", - SBP_ARROWBTN, leftarrow_statemap, NOPAD, 0 }, - { "Scrollbar.rightarrow", &GenericElementSpec, L"SCROLLBAR", - SBP_ARROWBTN, rightarrow_statemap, NOPAD, 0 }, + { "Scrollbar.uparrow", &GenericSizedElementSpec, L"SCROLLBAR", + SBP_ARROWBTN, uparrow_statemap, NOPAD, + (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, + { "Scrollbar.downarrow", &GenericSizedElementSpec, L"SCROLLBAR", + SBP_ARROWBTN, downarrow_statemap, NOPAD, + (SM_CXVSCROLL << 8) | SM_CYVSCROLL }, + { "Scrollbar.leftarrow", &GenericSizedElementSpec, L"SCROLLBAR", + SBP_ARROWBTN, leftarrow_statemap, NOPAD, + (SM_CXHSCROLL << 8) | SM_CYHSCROLL }, + { "Scrollbar.rightarrow", &GenericSizedElementSpec, L"SCROLLBAR", + SBP_ARROWBTN, rightarrow_statemap, NOPAD, + (SM_CXHSCROLL << 8) | SM_CYHSCROLL }, { "Horizontal.Scale.slider", &GenericElementSpec, L"TRACKBAR", TKP_THUMB, scale_statemap, NOPAD, 0 }, { "Vertical.Scale.slider", &GenericElementSpec, L"TRACKBAR", |