From 5a01c1718d0e4d22ca532721611e0546c5512e33 Mon Sep 17 00:00:00 2001 From: Joe Mistachkin Date: Mon, 19 Sep 2016 18:52:19 +0000 Subject: Permit static linking to the MSVCRT as a stand-alone option. Enable WinXP SDK compatibility. --- win/rules.vc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/win/rules.vc b/win/rules.vc index 0d8cd6b..503df50 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -159,7 +159,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE +COMPILERFLAGS =-W3 -DUNICODE -D_UNICODE -D_USING_V110_SDK71_=1 # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] @@ -230,6 +230,10 @@ STATIC_BUILD = 1 !else STATIC_BUILD = 0 !endif +!if [nmakehlp -f $(OPTS) "nomsvcrt"] +!message *** Doing nomsvcrt +MSVCRT = 0 +!else !if [nmakehlp -f $(OPTS) "msvcrt"] !message *** Doing msvcrt MSVCRT = 1 @@ -240,6 +244,7 @@ MSVCRT = 1 MSVCRT = 0 !endif !endif +!endif !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 -- cgit v0.12 From 713d51c8519164eee84302b30e4f36706e2e1952 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 21 Sep 2016 12:40:22 +0000 Subject: Make it more likely that compiles with VS2012/VS2013 actually work on Windows XP. See: [https://tedwvc.wordpress.com/2014/01/01/how-to-target-xp-with-vc2012-or-vc2013-and-continue-to-use-the-windows-8-x-sdk/] --- win/Makefile.in | 2 +- win/rules.vc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/win/Makefile.in b/win/Makefile.in index 1d18b60..632e216 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -171,7 +171,7 @@ NO_DEPRECATED_FLAGS = #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) -CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ $(NO_DEPRECATED_FLAGS) +CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ $(NO_DEPRECATED_FLAGS) -D_ATL_XP_TARGETING # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ diff --git a/win/rules.vc b/win/rules.vc index a43fac6..e38fd1a 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -159,7 +159,7 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif -COMPILERFLAGS =-W3 +COMPILERFLAGS =-W3 /D_ATL_XP_TARGETING # In v13 -GL and -YX are incompatible. !if [nmakehlp -c -YX] -- cgit v0.12 From 17993a942afc2c375f311dd73083e4f1d3339dab Mon Sep 17 00:00:00 2001 From: patthoyts Date: Wed, 21 Sep 2016 23:41:44 +0000 Subject: [3126428] Repaint ttk labels and buttons when the image is changed. In Tk the images associated with labels and buttons have their image changed callback set to cause the widget to be redrawn if the image is changed in any way. However, this has not been done for the ttk equivalent widgets. --- generic/ttk/ttkButton.c | 13 +++++++++++-- generic/ttk/ttkImage.c | 36 +++++++++++++++++++++++++++++++++--- generic/ttk/ttkTheme.h | 2 ++ 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/generic/ttk/ttkButton.c b/generic/ttk/ttkButton.c index bc44f25..c00754b 100644 --- a/generic/ttk/ttkButton.c +++ b/generic/ttk/ttkButton.c @@ -136,6 +136,15 @@ BaseCleanup(void *recordPtr) TtkFreeImageSpec(basePtr->base.imageSpec); } +static void +BaseImageChanged( + ClientData clientData, int x, int y, int width, int height, + int imageWidth, int imageHeight) +{ + Base *basePtr = (Base *)clientData; + TtkResizeWidget(&basePtr->core); +} + static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Base *basePtr = recordPtr; @@ -149,8 +158,8 @@ static int BaseConfigure(Tcl_Interp *interp, void *recordPtr, int mask) } if (basePtr->base.imageObj) { - imageSpec = TtkGetImageSpec( - interp, basePtr->core.tkwin, basePtr->base.imageObj); + imageSpec = TtkGetImageSpecEx( + interp, basePtr->core.tkwin, basePtr->base.imageObj, BaseImageChanged, basePtr); if (!imageSpec) { goto error; } diff --git a/generic/ttk/ttkImage.c b/generic/ttk/ttkImage.c index 2b12864..c435a50 100644 --- a/generic/ttk/ttkImage.c +++ b/generic/ttk/ttkImage.c @@ -25,6 +25,8 @@ struct TtkImageSpec { int mapCount; /* #state-specific overrides */ Ttk_StateSpec *states; /* array[mapCount] of states ... */ Tk_Image *images; /* ... per-state images to use */ + Tk_ImageChangedProc *imageChanged; + ClientData imageChangedClientData; }; /* NullImageChanged -- @@ -34,15 +36,41 @@ static void NullImageChanged(ClientData clientData, int x, int y, int width, int height, int imageWidth, int imageHeight) { /* No-op */ } +/* ImageSpecImageChanged -- + * Image changes should trigger a repaint. + */ +static void ImageSpecImageChanged(ClientData clientData, + int x, int y, int width, int height, int imageWidth, int imageHeight) +{ + Ttk_ImageSpec *imageSpec = (Ttk_ImageSpec *)clientData; + if (imageSpec->imageChanged != NULL) { + imageSpec->imageChanged(imageSpec->imageChangedClientData, + x, y, width, height, + imageWidth, imageHeight); + } +} + /* TtkGetImageSpec -- * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. - * Result must be released using TtkFreeImageSpec. + * Result must be released using TtkFreeImageSpec. * - * TODO: Need a variant of this that takes a user-specified ImageChanged proc */ Ttk_ImageSpec * TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) { + return TtkGetImageSpecEx(interp, tkwin, objPtr, NULL, NULL); +} + +/* TtkGetImageSpecEx -- + * Constructs a Ttk_ImageSpec * from a Tcl_Obj *. + * Result must be released using TtkFreeImageSpec. + * imageChangedProc will be called when not NULL when + * the image changes to allow widgets to repaint. + */ +Ttk_ImageSpec * +TtkGetImageSpecEx(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, + Tk_ImageChangedProc *imageChangedProc, ClientData imageChangedClientData) +{ Ttk_ImageSpec *imageSpec = 0; int i = 0, n = 0, objc; Tcl_Obj **objv; @@ -52,6 +80,8 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) imageSpec->mapCount = 0; imageSpec->states = 0; imageSpec->images = 0; + imageSpec->imageChanged = imageChangedProc; + imageSpec->imageChangedClientData = imageChangedClientData; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) { goto error; @@ -73,7 +103,7 @@ TtkGetImageSpec(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr) /* Get base image: */ imageSpec->baseImage = Tk_GetImage( - interp, tkwin, Tcl_GetString(objv[0]), NullImageChanged, NULL); + interp, tkwin, Tcl_GetString(objv[0]), ImageSpecImageChanged, imageSpec); if (!imageSpec->baseImage) { goto error; } diff --git a/generic/ttk/ttkTheme.h b/generic/ttk/ttkTheme.h index 7bf2a7f..9251dea 100644 --- a/generic/ttk/ttkTheme.h +++ b/generic/ttk/ttkTheme.h @@ -372,6 +372,8 @@ MODULE_SCOPE void Ttk_RegisterNamedColor(Ttk_ResourceCache, const char *, XColor typedef struct TtkImageSpec Ttk_ImageSpec; TTKAPI Ttk_ImageSpec *TtkGetImageSpec(Tcl_Interp *, Tk_Window, Tcl_Obj *); +TTKAPI Ttk_ImageSpec *TtkGetImageSpecEx(Tcl_Interp *, Tk_Window, Tcl_Obj *, + Tk_ImageChangedProc *, ClientData); TTKAPI void TtkFreeImageSpec(Ttk_ImageSpec *); TTKAPI Tk_Image TtkSelectImage(Ttk_ImageSpec *, Ttk_State); -- cgit v0.12 From 1b5c660e330eddb121d8400dafafffa917beeb46 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Thu, 22 Sep 2016 13:42:38 +0000 Subject: Correct expansion of the spinbox textarea for the vista theme. The spinbox textarea should stretch to fill the widget and does so with all except the vista theme. Added a test to check for this expansion to avoid regression. Fix identified Kumba on StackOverflow ( https://stackoverflow.com/a/36393680/291641 ) --- library/ttk/vistaTheme.tcl | 2 +- tests/ttk/spinbox.test | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/library/ttk/vistaTheme.tcl b/library/ttk/vistaTheme.tcl index 99410cb..3f75f51 100644 --- a/library/ttk/vistaTheme.tcl +++ b/library/ttk/vistaTheme.tcl @@ -133,7 +133,7 @@ namespace eval ttk::theme::vista { Spinbox.background -sticky news -children { Spinbox.padding -sticky news -children { Spinbox.innerbg -sticky news -children { - Spinbox.textarea -expand 1 -sticky {} + Spinbox.textarea -expand 1 } } Spinbox.uparrow -side top -sticky ens diff --git a/tests/ttk/spinbox.test b/tests/ttk/spinbox.test index 32b77af..08f2bda 100644 --- a/tests/ttk/spinbox.test +++ b/tests/ttk/spinbox.test @@ -199,6 +199,27 @@ test spinbox-2.4 "current command -- value not in list" -constraints nyi -setup destroy .sb } -result -1 +test spinbox-3.0 "textarea should expand to fill widget" -setup { + set SBV 5 + set ::spinbox_test {} + ttk::spinbox .sb -from 0 -to 10 -textvariable SBV +} -body { + grid .sb -sticky ew + grid columnconfigure . 0 -weight 1 + bind . { + after idle { + wm geometry . "210x80" + after 100 {set ::spinbox_test [.sb identify element 5 5]} + } + bind . {} + } + after 500 {set ::spinbox_wait 1} ; vwait ::spinbox_wait + set ::spinbox_test +} -cleanup { + destroy .sb + unset -nocomplain ::spinbox_test SBV +} -result {textarea} + # nostomp: NB intentional difference between ttk::spinbox and tk::spinbox; # see also #1439266 # -- cgit v0.12