Import Tk 8.6.8

This commit is contained in:
Cheryl Sabella
2018-02-22 14:31:15 -05:00
parent b1c28856bb
commit 8e57feeeb9
193 changed files with 6172 additions and 4033 deletions

View File

@@ -27,6 +27,7 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
mandir = @mandir@
# The following definition can be set to non-null for special systems
@@ -169,7 +170,7 @@ LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@
#CFLAGS = $(CFLAGS_DEBUG)
#CFLAGS = $(CFLAGS_OPTIMIZE)
#CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE)
CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE
CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -DUNICODE -D_UNICODE -D_ATL_XP_TARGETING
# Special compiler flags to use when building man2tcl on Windows.
MAN2TCLFLAGS = @MAN2TCLFLAGS@

0
win/buildall.vc.bat Normal file → Executable file
View File

2
win/configure vendored Normal file → Executable file
View File

@@ -1312,7 +1312,7 @@ SHELL=/bin/sh
TK_VERSION=8.6
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=6
TK_PATCH_LEVEL=".6"
TK_PATCH_LEVEL=".8"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------

View File

@@ -14,7 +14,7 @@ SHELL=/bin/sh
TK_VERSION=8.6
TK_MAJOR_VERSION=8
TK_MINOR_VERSION=6
TK_PATCH_LEVEL=".6"
TK_PATCH_LEVEL=".8"
VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION
#------------------------------------------------------------------------

View File

@@ -1,537 +0,0 @@
#
# Makefile for Borland C++ 5.5 (or C++ Builder 5), adapted from the makefile
# for Visual C++ that came with tk 8.3.3
#
# Some "not so obvious" details in this makefile are preceded by a comment
# "maintenance hint", which tries to explain what's going on. Better to
# leave those in place.
# Helmut Giese, July 2002
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Copyright (c) 1995-1997 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Does not depend on the presence of any environment variables in
# order to compile tcl; all needed information is derived from
# location of the compiler directories.
#
# Project directories
#
# ROOT = top of source tree
#
# TMPDIR = location where .obj files should be stored during build
#
# TOOLS32 = location of Borland development tools.
#
# TCLDIR = location of top of Tcl source hierarchy
#
ROOT = ..
TCLDIR = ..\..\tcl8.4
INSTALLDIR = D:\tmp\tcl
# If you have C++ Builder 5 or the free Borland C++ 5.5 compiler
# adapt the following paths as appropriate for your system
TOOLS32 = d:\cbld5
TOOLS32_rc = d:\cbld5
#TOOLS32 = c:\bc55
#TOOLS32_rc = c:\bc55
cc32 = "$(TOOLS32)\bin\bcc32.exe"
link32 = "$(TOOLS32)\bin\ilink32.exe"
lib32 = "$(TOOLS32)\bin\tlib.exe"
rc32 = "$(TOOLS32_rc)\bin\brcc32.exe"
include32 = -I"$(TOOLS32)\include;$(TOOLS32)\include\mfc"
libpath32 = -L"$(TOOLS32)\lib"
# Uncomment the following line to compile with thread support
#THREADDEFINES = -DTCL_THREADS=1
# Allow definition of NDEBUG via command line
# Set NODEBUG to 0 to compile with symbols
!if !defined(NODEBUG)
NODEBUG = 1
!endif
# uncomment the following two lines to compile with TCL_MEM_DEBUG
#DEBUGDEFINES =-DTCL_MEM_DEBUG
######################################################################
# Do not modify below this line
######################################################################
TCLNAMEPREFIX = tcl
TKNAMEPREFIX = tk
WISHNAMEPREFIX = wish
VERSION = 84
DOTVERSION = 8.4
TCLSTUBPREFIX = $(TCLNAMEPREFIX)stub
TKSTUBPREFIX = $(TKNAMEPREFIX)stub
BINROOT = .
!IF "$(NODEBUG)" == "1"
TMPDIRNAME = Release
DBGX =
!ELSE
TMPDIRNAME = Debug
DBGX =
#DBGX = d
!ENDIF
TMPDIR = $(BINROOT)\$(TMPDIRNAME)
OUTDIRNAME = $(TMPDIRNAME)
OUTDIR = $(TMPDIR)
TCLLIB = $(TCLNAMEPREFIX)$(VERSION)$(DBGX).lib
TCLPLUGINLIB = $(TCLNAMEPREFIX)$(VERSION)p.lib
TCLSTUBLIB = $(TCLSTUBPREFIX)$(VERSION)$(DBGX).lib
TKDLLNAME = $(TKNAMEPREFIX)$(VERSION)$(DBGX).dll
TKDLL = $(OUTDIR)\$(TKDLLNAME)
TKLIB = $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)$(DBGX).lib
TKSTUBLIBNAME = $(TKSTUBPREFIX)$(VERSION)$(DBGX).lib
TKSTUBLIB = $(OUTDIR)\$(TKSTUBLIBNAME)
TKPLUGINDLLNAME = $(TKNAMEPREFIX)$(VERSION)p$(DBG).dll
TKPLUGINDLL = $(OUTDIR)\$(TKPLUGINDLLNAME)
TKPLUGINLIB = $(OUTDIR)\$(TKNAMEPREFIX)$(VERSION)p$(DBGX).lib
WISH = $(OUTDIR)\$(WISHNAMEPREFIX)$(VERSION)$(DBGX).exe
WISHC = $(OUTDIR)\$(WISHNAMEPREFIX)c$(VERSION)$(DBGX).exe
WISHP = $(OUTDIR)\$(WISHNAMEPREFIX)p$(VERSION)$(DBGX).exe
TKTEST = $(OUTDIR)\$(TKNAMEPREFIX)test.exe
CAT32 = $(TMPDIR)\cat32.exe
BIN_INSTALL_DIR = $(INSTALLDIR)\bin
INCLUDE_INSTALL_DIR = $(INSTALLDIR)\include
LIB_INSTALL_DIR = $(INSTALLDIR)\lib
SCRIPT_INSTALL_DIR = $(LIB_INSTALL_DIR)\tk$(DOTVERSION)
WISHOBJS = \
$(TMPDIR)\winMain.obj
TKTESTOBJS = \
$(TMPDIR)\tkTest.obj \
$(TMPDIR)\tkSquare.obj \
$(TMPDIR)\testMain.obj \
$(TMPDIR)\tkOldTest.obj \
$(TMPDIR)\tkWinTest.obj \
$(TCLLIBDIR)\tclThreadTest.obj
XLIBOBJS = \
$(TMPDIR)\xcolors.obj \
$(TMPDIR)\xdraw.obj \
$(TMPDIR)\xgc.obj \
$(TMPDIR)\ximage.obj \
$(TMPDIR)\xutil.obj
TKOBJS = \
$(TMPDIR)\tkConsole.obj \
$(TMPDIR)\tkUnixMenubu.obj \
$(TMPDIR)\tkUnixScale.obj \
$(XLIBOBJS) \
$(TMPDIR)\tkWin3d.obj \
$(TMPDIR)\tkWin32Dll.obj \
$(TMPDIR)\tkWinButton.obj \
$(TMPDIR)\tkWinClipboard.obj \
$(TMPDIR)\tkWinColor.obj \
$(TMPDIR)\tkWinConfig.obj \
$(TMPDIR)\tkWinCursor.obj \
$(TMPDIR)\tkWinDialog.obj \
$(TMPDIR)\tkWinDraw.obj \
$(TMPDIR)\tkWinEmbed.obj \
$(TMPDIR)\tkWinFont.obj \
$(TMPDIR)\tkWinImage.obj \
$(TMPDIR)\tkWinInit.obj \
$(TMPDIR)\tkWinKey.obj \
$(TMPDIR)\tkWinMenu.obj \
$(TMPDIR)\tkWinPixmap.obj \
$(TMPDIR)\tkWinPointer.obj \
$(TMPDIR)\tkWinRegion.obj \
$(TMPDIR)\tkWinScrlbr.obj \
$(TMPDIR)\tkWinSend.obj \
$(TMPDIR)\tkWinWindow.obj \
$(TMPDIR)\tkWinWm.obj \
$(TMPDIR)\tkWinX.obj \
$(TMPDIR)\stubs.obj \
$(TMPDIR)\tk3d.obj \
$(TMPDIR)\tkArgv.obj \
$(TMPDIR)\tkAtom.obj \
$(TMPDIR)\tkBind.obj \
$(TMPDIR)\tkBitmap.obj \
$(TMPDIR)\tkBusy.obj \
$(TMPDIR)\tkButton.obj \
$(TMPDIR)\tkCanvArc.obj \
$(TMPDIR)\tkCanvBmap.obj \
$(TMPDIR)\tkCanvImg.obj \
$(TMPDIR)\tkCanvLine.obj \
$(TMPDIR)\tkCanvPoly.obj \
$(TMPDIR)\tkCanvPs.obj \
$(TMPDIR)\tkCanvText.obj \
$(TMPDIR)\tkCanvUtil.obj \
$(TMPDIR)\tkCanvWind.obj \
$(TMPDIR)\tkCanvas.obj \
$(TMPDIR)\tkClipboard.obj \
$(TMPDIR)\tkCmds.obj \
$(TMPDIR)\tkColor.obj \
$(TMPDIR)\tkConfig.obj \
$(TMPDIR)\tkCursor.obj \
$(TMPDIR)\tkEntry.obj \
$(TMPDIR)\tkError.obj \
$(TMPDIR)\tkEvent.obj \
$(TMPDIR)\tkFileFilter.obj \
$(TMPDIR)\tkFocus.obj \
$(TMPDIR)\tkFont.obj \
$(TMPDIR)\tkFrame.obj \
$(TMPDIR)\tkGC.obj \
$(TMPDIR)\tkGeometry.obj \
$(TMPDIR)\tkGet.obj \
$(TMPDIR)\tkGrab.obj \
$(TMPDIR)\tkGrid.obj \
$(TMPDIR)\tkImage.obj \
$(TMPDIR)\tkImgBmap.obj \
$(TMPDIR)\tkImgGIF.obj \
$(TMPDIR)\tkImgPPM.obj \
$(TMPDIR)\tkImgPhoto.obj \
$(TMPDIR)\tkImgPhInstance.obj \
$(TMPDIR)\tkImgUtil.obj \
$(TMPDIR)\tkListbox.obj \
$(TMPDIR)\tkMacWinMenu.obj \
$(TMPDIR)\tkMain.obj \
$(TMPDIR)\tkMenu.obj \
$(TMPDIR)\tkMenubutton.obj \
$(TMPDIR)\tkMenuDraw.obj \
$(TMPDIR)\tkMessage.obj \
$(TMP_DIR)\tkPanedWindow.obj \
$(TMPDIR)\tkObj.obj \
$(TMPDIR)\tkOldConfig.obj \
$(TMPDIR)\tkOption.obj \
$(TMPDIR)\tkPack.obj \
$(TMPDIR)\tkPlace.obj \
$(TMPDIR)\tkPointer.obj \
$(TMPDIR)\tkRectOval.obj \
$(TMPDIR)\tkScale.obj \
$(TMPDIR)\tkScrollbar.obj \
$(TMPDIR)\tkSelect.obj \
$(TMPDIR)\tkText.obj \
$(TMPDIR)\tkTextBTree.obj \
$(TMPDIR)\tkTextDisp.obj \
$(TMPDIR)\tkTextImage.obj \
$(TMPDIR)\tkTextIndex.obj \
$(TMPDIR)\tkTextMark.obj \
$(TMPDIR)\tkTextTag.obj \
$(TMPDIR)\tkTextWind.obj \
$(TMPDIR)\tkTrig.obj \
$(TMPDIR)\tkUtil.obj \
$(TMPDIR)\tkVisual.obj \
$(TMPDIR)\tkStubInit.obj \
$(TMPDIR)\tkWindow.obj
# Maintenance hint: Please have multiple members of TKSTUBOBJS be separated
# by exactly one ' ' (see below the rule for making TKSTUBLIB)
TKSTUBOBJS = $(TMPDIR)\tkStubLib.obj
WINDIR = $(ROOT)\win
GENERICDIR = $(ROOT)\generic
XLIBDIR = $(ROOT)\xlib
BITMAPDIR = $(ROOT)\bitmaps
TCLLIBDIR = $(TCLDIR)\win\$(OUTDIRNAME)
RCDIR = $(WINDIR)\rc
TK_INCLUDES = -I$(WINDIR) -I$(GENERICDIR) -I$(BITMAPDIR) -I$(XLIBDIR) \
-I$(TCLDIR)\generic -I$(TCLDIR)\win
TK_DEFINES = -D_WIN32 $(DEBUGDEFINES) $(THREADDEFINES) SUPPORT_CONFIG_EMBEDDED
######################################################################
# Compile flags
######################################################################
!IF "$(NODEBUG)" == "1"
# these macros cause maximum optimization and no symbols
cdebug = -v- -vi- -O2 -D_DEBUG
!ELSE
# these macros enable debugging
cdebug = -k -Od -r- -v -vi- -y
!ENDIF
SYSDEFINES = _MT;NO_STRICT;_NO_VCL
# declarations common to all compiler options
cbase = -3 -a4 -c -g0 -tWM -Ve -Vx -X-
WARNINGS = -w-rch -w-pch -w-par -w-dup -w-pro -w-dpu
ccons = -tWC
CFLAGS = $(cdebug) $(cbase) $(WARNINGS) -D$(SYSDEFINES)
CON_CFLAGS = $(CFLAGS) $(TK_DEFINES) $(include32) $(ccons)
WISH_CFLAGS = $(CFLAGS) $(include32) $(TK_INCLUDES) $(TK_DEFINES)
TK_CFLAGS = $(CFLAGS) $(include32) $(TK_INCLUDES) $(TK_DEFINES) \
-DUSE_TCL_STUBS
######################################################################
# Link flags
######################################################################
!IF "$(NODEBUG)" == "1"
ldebug =
!ELSE
ldebug = -v
!ENDIF
# declarations common to all linker options
LNFLAGS = -D"" -Gn -I$(TMPDIR) -x $(ldebug) $(libpath32)
# -Gi: create lib file (is -Gl in doc)
# -aa: Windows app, -ap: Windows console app
LNFLAGS_DLL = -ap -Gi -Tpd
LNFLAGS_CONS = -ap -Tpe
LNFLAGS_GUI = -aa -Tpe
LNLIBS = import32 cw32mt
######################################################################
# Project specific targets
######################################################################
all: setup $(WISH) $(CAT32)
install: install-binaries install-libraries
plugin: setup $(TKPLUGINDLL) $(WISHP)
tktest: setup $(TKTEST) $(CAT32)
# Maintenance hint: We want to set environment variables before calling tktest.
# If we do this in the form of normal commands, they will not persist up to
# the call of tktest. Therfore we put all commands wanted into a batch file.
# The normal way of using 'echo >x.bat' and 'echo >>x.bat' does not work here
# because we cannot write '... > tktest.txt' this way. Hence this advanced
# form of loop hopping:
# - Have MAKE produce a temporary file with the content we want.
# - Use it as input to the COPY command to produce a batch file.
# - Run the batch file and be happy.
#
test: setup $(TKTEST) $(TKLIB) $(CAT32)
copy &&!
set TCL_LIBRARY=$(TCLDIR)/library
set PATH=$(TCLDIR)\win\$(TMPDIRNAME);$(PATH)
$(TKTEST) $(ROOT)/tests/all.tcl > tktest.txt
! _test.bat
_test.bat
# del _test.bat
runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
echo set TCL_LIBRARY=$(TCLDIR)/library > _test2.bat
echo set PATH=$(TCLDIR)\win\$(TMPDIRNAME);$(PATH) >> _test2.bat
echo $(TKTEST) >> _test2.bat
_test2.bat
# del _test2.bat
console-wish : all $(WISHC)
stubs:
$(TCLDIR)\win\$(TMPDIRNAME)\tclsh$(VERSION)$(DBGX) \
$(TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \
$(GENERICDIR)\tk.decls $(GENERICDIR)\tkInt.decls
setup:
@mkd $(TMPDIR)
@mkd $(OUTDIR)
install-binaries:
@mkd "$(BIN_INSTALL_DIR)"
copy $(TKDLL) "$(BIN_INSTALL_DIR)"
copy $(WISH) "$(BIN_INSTALL_DIR)"
@mkd "$(LIB_INSTALL_DIR)"
copy $(TKLIB) "$(LIB_INSTALL_DIR)"
install-libraries:
@mkd "$(INCLUDE_INSTALL_DIR)"
@mkd "$(INCLUDE_INSTALL_DIR)\X11"
copy "$(GENERICDIR)\tk.h" "$(INCLUDE_INSTALL_DIR)"
copy "$(GENERICDIR)\tkDecls.h" "$(INCLUDE_INSTALL_DIR)"
copy "$(GENERICDIR)\tkPlatDecls.h" "$(INCLUDE_INSTALL_DIR)"
copy "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)"
xcopy "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11"
@mkd "$(SCRIPT_INSTALL_DIR)"
@mkd "$(SCRIPT_INSTALL_DIR)\images"
@mkd "$(SCRIPT_INSTALL_DIR)\demos"
@mkd "$(SCRIPT_INSTALL_DIR)\demos\images"
@mkd "$(SCRIPT_INSTALL_DIR)\msgs"
xcopy "$(ROOT)\library" "$(SCRIPT_INSTALL_DIR)"
xcopy "$(ROOT)\library\images" "$(SCRIPT_INSTALL_DIR)\images"
xcopy "$(ROOT)\library\demos" "$(SCRIPT_INSTALL_DIR)\demos"
xcopy "$(ROOT)\library\demos\images" "$(SCRIPT_INSTALL_DIR)\demos\images"
xcopy "$(ROOT)\library\msgs" "$(SCRIPT_INSTALL_DIR)\msgs"
$(TKLIB): $(TKDLL) $(TKSTUBLIB)
# Maintenance hint: The macro puts a '+-' before the first member of
# TKSTUBOBJS, than replaces any ' ' with ' +-' - together putting '+-' in
# front of any member of TKSTUBOBJS (provided, they are separated in their
# defintion by just one space).
#
# The first time you *make* this target, you will get a warning
# tkStubLib not found in library
# This is (probably) because of the '-' option, telling TLIB to remove
# 'tkStubLib' when it does not yet exist. Forcing a re-make when it already
# exists avoids this warning.
#
$(TKSTUBLIB): $(TKSTUBOBJS)
$(lib32) $@ +-$(TKSTUBOBJS: = +-)
# $(lib32) $@ @&&!
#+-$(TKSTUBOBJS: = &^
#+-)
#!
$(TKDLL): $(TKOBJS) $(TMPDIR)\tk.res
$(link32) $(ldebug) $(LNFLAGS) $(LNFLAGS_DLL) $(TOOLS32)\lib\c0d32 @&&!
$(TKOBJS), $@, -x, $(LNLIBS) $(TCLLIBDIR)\$(TCLSTUBLIB),, $(TMPDIR)\tk.res
!
$(TKPLUGINLIB): $(TKPLUGINDLL)
#$(TKPLUGINDLL): $(TKOBJS) $(TMPDIR)\tk.res
# $(link32) $(ldebug) $(dlllflags) \
# -out:$@ $(TMPDIR)\tk.res $(TCLLIBDIR)\$(TCLPLUGINLIB) \
# $(guilibsdll) @<<
# $(TKOBJS)
#<<
$(WISH): $(WISHOBJS) $(TKLIB) $(TMPDIR)\wish.res
$(link32) $(ldebug) -S:2400000 $(LNFLAGS) $(LNFLAGS_GUI) $(TOOLS32)\lib\c0x32 @&&!
$(WISHOBJS), $@, -x, $(LNLIBS) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB),, $(TMPDIR)\wish.res
!
$(WISHC): $(WISHOBJS) $(TKLIB) $(TMPDIR)\wish.res
$(link32) $(ldebug) -S:2400000 $(LNFLAGS) $(LNFLAGS_CONS) $(TOOLS32)\lib\c0x32 @&&!
$(WISHOBJS), $@, -x, $(LNLIBS) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB),, $(TMPDIR)\wish.res
!
$(WISHP): $(WISHOBJS) $(TKPLUGINLIB) $(TMPDIR)\wish.res
$(link32) $(ldebug) $(guilflags) $(TMPDIR)\wish.res -out:$@ \
$(guilibsdll) $(TCLLIBDIR)\$(TCLPLUGINLIB) \
$(TKPLUGINLIB) $(WISHOBJS)
$(TKTEST): $(TKTESTOBJS) $(TKLIB) $(TMPDIR)\wish.res
$(link32) $(ldebug) -S:2400000 $(LNFLAGS) $(LNFLAGS_GUI) $(TOOLS32)\lib\c0x32 @&&!
$(TKTESTOBJS), $@, -x, $(LNLIBS) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB),, $(TMPDIR)\wish.res
!
# $(link32) $(ldebug) $(guilflags) $(TMPDIR)\wish.res -out:$@ \
# $(guilibsdll) $(TCLLIBDIR)\$(TCLLIB) $(TKLIB) $(TKTESTOBJS)
#$(CAT32): $(TCLDIR)\win\cat.c
# $(cc32) $(CON_CFLAGS) -o$(TMPDIR)\cat.obj $?
# $(link32) $(conlflags) -out:$@ -stack:16384 $(TMPDIR)\cat.obj $(conlibs)
$(CAT32): $(TCLDIR)\win\cat.c
$(cc32) $(CONS_CFLAGS) -o$(TMPDIR)\cat.obj $?
$(link32) $(ldebug) $(LNFLAGS) $(LNFLAGS_CONS) $(TOOLS32)\lib\c0x32 \
$(TMPDIR)\cat.obj, $@, -x, $(LNLIBS),,
#
# Regenerate the stubs files.
#
genstubs:
tclsh$(VERSION) $(TCLDIR)\tools\genStubs.tcl $(GENERICDIR) \
$(GENERICDIR)\tk.decls $(GENERICDIR)\tkInt.decls
#
# Special case object file targets
#
$(TMPDIR)\testMain.obj: $(WINDIR)\winMain.c
$(cc32) $(WISH_CFLAGS) -DTK_TEST -o$@ $?
$(TMPDIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
$(TMPDIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
$(TMPDIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
$(TMPDIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
$(TMPDIR)\winMain.obj: $(WINDIR)\winMain.c
$(cc32) $(WISH_CFLAGS) -o$@ $?
$(TMPDIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c
$(cc32) $(TK_CFLAGS) -DSTATIC_BUILD -o$@ $?
#
# Implicit rules
#
{$(XLIBDIR)}.c{$(TMPDIR)}.obj:
$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -o$@ $<
{$(GENERICDIR)}.c{$(TMPDIR)}.obj:
$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -o$@ $<
{$(WINDIR)}.c{$(TMPDIR)}.obj:
$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -o$@ $<
{$(ROOT)\unix}.c{$(TMPDIR)}.obj:
$(cc32) -DDLL_BUILD -DBUILD_tk $(TK_CFLAGS) -o$@ $<
{$(RCDIR)}.rc{$(TMPDIR)}.res:
$(rc32) -I"$(GENERICDIR)" -I"$(TOOLS32)\include" -I"$(TCLDIR)\generic" \
-D$(USERDEFINES);$(SYSDEFINES) -fo$@ $<
clean:
-@del $(OUTDIR)\*.exp
-@del $(OUTDIR)\*.lib
-@del $(OUTDIR)\*.dll
-@del $(OUTDIR)\*.exe
-@del $(OUTDIR)\*.pdb
-@del $(TMPDIR)\*.pch
-@del $(TMPDIR)\*.obj
-@del $(TMPDIR)\*.res
-@del $(TMPDIR)\*.exe
-@rmd $(OUTDIR)
-@rmd $(TMPDIR)
# dependencies
$(TMPDIR)\tk.res: \
$(RCDIR)\buttons.bmp \
$(RCDIR)\cursor*.cur \
$(RCDIR)\tk.ico
$(GENERICDIR)/default.h: $(WINDIR)/tkWinDefault.h
$(GENERICDIR)/tkButton.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkCanvas.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkEntry.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkFrame.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkListbox.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkMenubutton.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkMessage.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkScale.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkScrollbar.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkText.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/default.h
$(GENERICDIR)/tkText.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextBTree.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextDisp.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextImage.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextIndex.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextMark.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextTag.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkTextWind.c: $(GENERICDIR)/tkText.h
$(GENERICDIR)/tkMacWinMenu.c: $(GENERICDIR)/tkMenu.h
$(GENERICDIR)/tkMenu.c: $(GENERICDIR)/tkMenu.h
$(GENERICDIR)/tkMenuDraw.c: $(GENERICDIR)/tkMenu.h
$(WINDIR)/tkWinMenu.c: $(GENERICDIR)/tkMenu.h

View File

@@ -11,37 +11,20 @@
# Copyright (c) 2001-2005 ActiveState Corporation.
# Copyright (c) 2001-2004 David Gravereaux.
# Copyright (c) 2003-2008 Pat Thoyts.
# Copyright (c) 2017 Ashok P. Nadkarni
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
MSG = ^
You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
Platform SDK first to setup the environment. Jump to this line to read^
the build instructions.
!error $(MSG)
!endif
#------------------------------------------------------------------------------
# HOW TO USE this makefile:
# General usage:
# nmake [-nologo] -f makefile.vc [TARGET|MACRODEF [TARGET|MACRODEF] [...]]
#
# 1) It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the
# environment. This is used as a check to see if vcvars32.bat had been
# run prior to running nmake or during the installation of Microsoft
# Visual C++, MSVCDir had been set globally and the PATH adjusted.
# Either way is valid.
# For MACRODEF, see TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md)
# or examine Sections 6-8 in rules.vc. This makefile has the following
# values for the OPTS macro in addition to the ones described there.
# noxp = If you do not have the uxtheme.h header then you
# cannot include support for XP themeing.
# square = Include the demo square widget.
#
# You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
# directory to setup the proper environment, if needed, for your
# current setup. This is a needed bootstrap requirement and allows the
# swapping of different environments to be easier.
#
# 2) To use the Platform SDK (not expressly needed), run setenv.bat after
# vcvars32.bat according to the instructions for it. This can also
# turn on the 64-bit compiler, if your SDK has it.
#
# 3) Targets are:
# Possible values for TARGET are:
# release -- Builds the core, the shell and the dlls. (default)
# dlls -- Just builds the windows extensions.
# shell -- Just builds the shell and the core.
@@ -62,136 +45,59 @@ the build instructions.
# troff manual pages found in $(ROOT)\doc. You need to
# have installed the HTML Help Compiler package from Microsoft
# to produce the .chm file.
# winhelp -- Builds the windows .hlp file for Tcl from the troff man
# files found in $(ROOT)\doc.
#
# 4) Macros usable on the commandline:
# TCLDIR=<path>
# Sets the location for where to find the Tcl headers and
# libraries. The install point is assumed when not specified.
# Tk does need the source directory, though. Tk comes very close
# to not needing the sources, but does, in fact, require them.
# The steps to setup a Visual C++ environment depend on which
# version of Visual Studio and/or the Windows SDK you are building
# against and are not described here. The simplest method is generally
# to start a command shell using one of the short cuts installed by
# Visual Studio/Windows SDK for the appropriate target architecture.
#
# INSTALLDIR=<path>
# Sets where to install Tcl from the built binaries.
# C:\Progra~1\Tcl is assumed when not specified.
# NOTE: For older (Visual C++ 6 or the 2003 SDK), to use the Platform
# SDK (not expressly needed), run setenv.bat after vcvars32.bat
# according to the instructions for it. This can also turn on the
# 64-bit compiler, if your SDK has it.
#
# OPTS=loimpact,msvcrt,nothreads,noxp,pdbs,profile,square,static,staticpkg,symbols,unchecked,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
# Examples:
# Assumign Tcl sources lie in ../../tcl
# c:\tcl_src\win\>nmake -f makefile.vc release
# If Tcl sources are not in ../../tcl, use the TCLDIR macro to specify dir
# c:\tcl_src\win\>nmake -f makefile.vc release TCLDIR=c:\src\tcl
# Run the test suite
# c:\tcl_src\win\>nmake -f makefile.vc test
# Install Tk in location specified by INSTALLDIR macro
# c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
# Build release with PDF files
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=pdbs
# Build debug version
# c:\tcl_src\win\>nmake -f makefile.vc release OPTS=symbols
#
# loimpact = Adds a flag for how NT treats the heap to keep memory
# in use, low. This is said to impact alloc performance.
# msvcrt = Affects the static option only to switch it from
# using libcmt(d) as the C runtime [by default] to
# msvcrt(d). This is useful for static embedding
# support.
# nothreads= Turns off full multithreading support.
# noxp = If you do not have the uxtheme.h header then you
# cannot include support for XP themeing.
# square = Include the demo square widget.
# static = Builds a static library of the core instead of a
# dll. The shell will be static (and large), as well.
# staticpkg= Affects the static option only to switch wishXX.exe
# to have the dde and reg extension linked inside it.
# pdbs = Build detached symbols for release builds.
# profile = Adds profiling hooks. Map file is assumed.
# thrdalloc = Use the thread allocator (shared global free pool)
# This is the default on threaded builds.
# tclalloc = Use the old non-thread allocator
# symbols = Debug build. Links to the debug C runtime, disables
# optimizations and creates pdb symbols files.
# unchecked = Allows a symbols build to not use the debug
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
#
# STATS=compdbg,memdbg,none
# Sets optional memory and bytecode compiler debugging code added
# to the core. The default is for none. Any combination of the
# above may be used (comma separated). 'none' will over-ride
# everything to nothing.
#
# compdbg = Enables byte compilation logging.
# memdbg = Enables the debugging memory allocator.
#
# CHECKS=64bit,fullwarn,nodep,none
# Sets special macros for checking compatability.
#
# 64bit = Enable 64bit portability warnings (if available)
# fullwarn = Builds with full compiler and link warnings enabled.
# Very verbose.
# nodep = Turns off compatability macros to ensure the core
# isn't being built with deprecated functions.
#
# MACHINE=(ALPHA|AMD64|IA64|IX86)
# Set the machine type used for the compiler, linker, and
# resource compiler. This hook is needed to tell the tools
# when alternate platforms are requested. IX86 is the default
# when not specified. If the CPU environment variable has been
# set (ie: recent Platform SDK) then MACHINE is set from CPU.
#
# TMP_DIR=<path>
# OUT_DIR=<path>
# Hooks to allow the intermediate and output directories to be
# changed. $(OUT_DIR) is assumed to be
# $(BINROOT)\(Release|Debug) based on if symbols are requested.
# $(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
#
# TESTPAT=<file>
# Reads the tests requested to be run from this file.
#
# 5) Examples:
#
# Basic syntax of calling nmake looks like this:
# nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
#
# Standard (no frills)
# c:\tk_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
# Setting environment for using Microsoft Visual C++ tools.
# c:\tk_src\win\>nmake -f makefile.vc release
# c:\tk_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
#
# Building for Win64
# c:\tk_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
# Setting environment for using Microsoft Visual C++ tools.
# c:\tk_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
# Targeting Windows pre64 RETAIL
# c:\tk_src\win\>nmake -f makefile.vc MACHINE=IA64
#
#------------------------------------------------------------------------------
#==============================================================================
###############################################################################
# //==================================================================\\
# >>[ -> Do not modify below this line. <- ]<<
# >>[ Please, use the commandline macros to modify how Tcl is built. ]<<
# >>[ If you need more features, send us a patch for more macros. ]<<
# \\==================================================================//
###############################################################################
#==============================================================================
#------------------------------------------------------------------------------
!if !exist("makefile.vc")
MSG = ^
You must run this makefile only from the directory it is in.^
Please `cd` to its location first.
!error $(MSG)
!endif
# The PROJECT macro is used by rules.vc for generating appropriate
# macros and rules.
PROJECT = tk
!include "rules.vc"
# Default target to build if no target is specified. If unspecified, the
# rules.vc file will set up "all" as the target.
DEFAULT_BUILD_TARGET = release
# We have a custom resource file
RCFILE = tk.rc
# The rules.vc file does much of the hard work in terms of defining
# the build configuration, macros, output directories etc.
!include "rules-ext.vc"
# TCLINSTALL is set to 1 by rules.vc to indicate we are building against
# an installed Tcl and 0 if building against Tcl source. Tk needs the latter.
!message TCLINSTALL=$(TCLINSTALL)
!if $(TCLINSTALL)
!message *** Warning: Tk requires the source distribution of Tcl to build from,
!message *** at this time, sorry. Please set the TCLDIR macro to point to the
!message *** Tcl sources.
!endif
# Extra makefile options processing...
# Extra makefile options processing for non-standard OPTS values ...
!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
HAVE_UXTHEME_H = 1
TTK_SQUARE_WIDGET = 0
@@ -210,33 +116,11 @@ TTK_SQUARE_WIDGET = 0
!endif
!endif
STUBPREFIX = $(PROJECT)stub
WISHNAMEPREFIX = wish
BINROOT = $(MAKEDIR) # originally .
ROOT = $(MAKEDIR)\.. # originally ..
TK_LIBRARY = $(ROOT)\library
TKIMPLIB = "$(OUT_DIR)\$(PROJECT)$(TK_VERSION)$(SUFX).lib"
TKLIBNAME = $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
TKLIB = "$(OUT_DIR)\$(TKLIBNAME)"
TKSTUBLIBNAME = $(STUBPREFIX)$(TK_VERSION).lib
TKSTUBLIB = "$(OUT_DIR)\$(TKSTUBLIBNAME)"
WISH = "$(OUT_DIR)\$(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe"
WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(TK_VERSION)$(SUFX).exe"
WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe"
TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe"
CAT32 = "$(OUT_DIR)\cat32.exe"
LIB_INSTALL_DIR = $(_INSTALLDIR)\lib
BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
DOC_INSTALL_DIR = $(_INSTALLDIR)\doc
SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_DOTVERSION)
INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include
WISHOBJS = \
$(TMP_DIR)\winMain.obj \
!if $(TCL_USE_STATIC_PACKAGES)
@@ -409,17 +293,15 @@ TKSTUBOBJS = \
$(TMP_DIR)\tkStubLib.obj \
$(TMP_DIR)\ttkStubLib.obj
WINDIR = $(ROOT)\win
GENERICDIR = $(ROOT)\generic
### The following paths CANNOT have spaces in them as they appear on
### the left side of implicit rules.
XLIBDIR = $(ROOT)\xlib
TTKDIR = $(ROOT)\generic\ttk
BITMAPDIR = $(ROOT)\bitmaps
DOCDIR = $(ROOT)\doc
RCDIR = $(WINDIR)\rc
TK_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(BITMAPDIR)" -I"$(XLIBDIR)" \
$(TCL_INCLUDES)
# Additional include and C macro definitions for the implicit rules
# defined in rules.vc
PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)"
CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \
@@ -432,110 +314,10 @@ CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \
-DTTK_SQUARE_WIDGET=1 \
!endif
TK_DEFINES =-DBUILD_ttk $(OPTDEFINES) $(CONFIG_DEFS) -Dinline=__inline
PRJ_DEFINES = -DBUILD_ttk $(CONFIG_DEFS) -Dinline=__inline -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------
!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
### We can't use -O2 because sometimes it causes problems.
cdebug = $(OPTIMIZATIONS)
!else
cdebug =
!endif
!if $(SYMBOLS)
cdebug = $(cdebug) -Zi
!endif
!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug = -Zi -Od $(DEBUGFLAGS)
!else
cdebug = -Zi -WX $(DEBUGFLAGS)
!endif
### Declarations common to all compiler options
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif
BASE_CFLAGS = $(cdebug) $(cflags) $(crt) $(TK_INCLUDES)
TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS
CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
WISH_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES)
STUB_CFLAGS = $(cflags) $(cdebug) $(TK_DEFINES)
#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------
!if $(DEBUG)
ldebug = -debug -debugtype:cv
!else
ldebug = -release -opt:ref -opt:icf,3
!if $(SYMBOLS)
ldebug = $(ldebug) -debug -debugtype:cv
!endif
!endif
### Declarations common to all linker options
lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
!if $(PROFILE)
lflags = $(lflags) -profile
!endif
!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
lflags = $(lflags) -nodefaultlib:libucrt.lib
!endif
!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags = $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
### Align sections for speed in loading by choosing the virtual page size.
lflags = $(lflags) -align:4096
!endif
!if $(LOIMPACT)
lflags = $(lflags) -ws:aggressive
!endif
dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
tcllibs = $(TCLSTUBLIB) $(TCLIMPLIB)
baselibs = netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
baselibs = $(baselibs) bufferoverflowU.lib
!endif
!endif
!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
baselibs = $(baselibs) ucrt.lib
!endif
guilibs = $(baselibs) gdi32.lib
# Additional Link libraries needed beyond those in rules.vc
PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib
#---------------------------------------------------------------------
@@ -546,7 +328,6 @@ guilibs = $(baselibs) gdi32.lib
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
#---------------------------------------------------------------------
# Project specific targets
#---------------------------------------------------------------------
@@ -558,12 +339,13 @@ cwish: $(WISHC)
install: install-binaries install-libraries install-docs
tktest: setup $(TKTEST) $(CAT32)
setup: default-setup
test: test-classic test-ttk
test-classic: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -574,7 +356,7 @@ test-classic: setup $(TKTEST) $(TKLIB) $(CAT32)
test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -585,7 +367,7 @@ test-ttk: setup $(TKTEST) $(TKLIB) $(CAT32)
runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -596,7 +378,7 @@ runtest: setup $(TKTEST) $(TKLIB) $(CAT32)
rundemo: setup $(TKTEST) $(TKLIB) $(CAT32)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -607,7 +389,7 @@ rundemo: setup $(TKTEST) $(TKLIB) $(CAT32)
shell: setup $(WISH)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -620,7 +402,7 @@ shell: setup $(WISH)
dbgshell: setup $(WISH)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TK_LIBRARY=$(TK_LIBRARY:\=/)
@set TK_LIBRARY=$(LIBDIR:\=/)
@set TCLLIBPATH=
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
@@ -629,51 +411,48 @@ dbgshell: setup $(WISH)
!endif
windbg $(WISH)
setup:
@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
!if !$(STATIC_BUILD)
$(TKIMPLIB): $(TKLIB)
!endif
!if $(STATIC_BUILD)
$(TKLIB): $(TKOBJS)
!if $(STATIC_BUILD)
$(lib32) -nologo -out:$@ @<<
$(LIBCMD) @<<
$**
<<
!else
$(link32) $(dlllflags) -base:@$(COFFBASE),tk -out:$@ $(guilibs) \
$(TCLSTUBLIB) @<<
$(TKLIB): $(TKOBJS)
$(DLLCMD) @<<
$**
<<
$(_VC_MANIFEST_EMBED_DLL)
-@del $*.exp
!endif
@if exist $*.exp del $*.exp
$(TKIMPLIB): $(TKLIB)
!endif # $(STATIC_BUILD)
$(TKSTUBLIB): $(TKSTUBOBJS)
$(lib32) -nologo -nodefaultlib -out:$@ $**
$(LIBCMD) -nodefaultlib $**
$(WISH): $(WISHOBJS) $(TKSTUBLIB) $(TKIMPLIB)
$(link32) $(guilflags) -stack:2300000 -out:$@ $(guilibs) $(tcllibs) $**
$(GUIEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
$(WISHC): $(WISHOBJS) $(TKSTUBLIB) $(TKIMPLIB)
$(link32) $(conlflags) -stack:2300000 -out:$@ $(guilibs) $(tcllibs) $**
$(CONEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
$(TKTEST): $(TKTESTOBJS) $(TKSTUBLIB) $(TKIMPLIB)
$(link32) $(guilflags) -stack:2300000 -out:$@ $(guilibs) $(tcllibs) $**
$(GUIEXECMD) -stack:2300000 $**
$(_VC_MANIFEST_EMBED_EXE)
$(CAT32): $(_TCLDIR)\win\cat.c
$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $?
$(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj $(baselibs)
$(cc32) $(cflags) $(crt) -D_CRT_NONSTDC_NO_DEPRECATE -DCONSOLE -Fo$(TMP_DIR)\ $?
$(CONEXECMD) -DCONSOLE -stack:16384 $(TMP_DIR)\cat.obj
$(_VC_MANIFEST_EMBED_EXE)
#---------------------------------------------------------------------
@@ -694,12 +473,13 @@ genstubs:
# Build the Windows HTML help file.
#---------------------------------------------------------------------
# NOTE: you can define HHC on the command-line to override this
!ifndef HHC
HHC=""%ProgramFiles%\HTML Help Workshop\hhc.exe""
!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
HHC="%ProgramFiles(x86)%\HTML Help Workshop\hhc.exe"
!else
HHC="%ProgramFiles%\HTML Help Workshop\hhc.exe"
!endif
HTMLDIR=$(ROOT)\html
HTMLBASE=TclTk$(VERSION)
HTMLBASE=TclTk$(TCL_VERSION)
HHPFILE=$(HTMLDIR)\$(HTMLBASE).hhp
CHMFILE=$(HTMLDIR)\$(HTMLBASE).chm
@@ -708,14 +488,14 @@ htmlhelp: chmsetup $(CHMFILE)
$(CHMFILE): $(DOCDIR)\*
@$(TCLSH) $(TCLTOOLSDIR)\tcltk-man2html.tcl
@echo Compiling HTML help project
@$(HHC) <<$(HHPFILE) >NUL
@"$(HHC)" <<$(HHPFILE) >NUL
[OPTIONS]
Compatibility=1.1 or later
Compiled file=$(HTMLBASE).chm
Display compile progress=no
Error log file=$(HTMLBASE).log
Language=0x409 English (United States)
Title=Tcl/Tk $(DOT_VERSION) Help
Title=Tcl/Tk $(TCL_DOTVERSION) Help
[FILES]
contents.htm
docs.css
@@ -730,137 +510,54 @@ UserCmd
chmsetup:
@if not exist $(HTMLDIR)\nul mkdir $(HTMLDIR)
#-------------------------------------------------------------------------
# Build the old-style Windows .hlp file
#-------------------------------------------------------------------------
HLPBASE = $(PROJECT)$(TK_VERSION)
HELPFILE = $(OUT_DIR)\$(HLPBASE).hlp
HELPCNT = $(OUT_DIR)\$(HLPBASE).cnt
DOCTMP_DIR = $(OUT_DIR)\$(PROJECT)_docs
HELPRTF = $(DOCTMP_DIR)\$(PROJECT).rtf
MAN2HELP = $(DOCTMP_DIR)\man2help.tcl
MAN2HELP2 = $(DOCTMP_DIR)\man2help2.tcl
INDEX = $(DOCTMP_DIR)\index.tcl
BMP = $(DOCTMP_DIR)\lamp.bmp
BMP_NOPATH = lamp.bmp
MAN2TCL = $(DOCTMP_DIR)\man2tcl.exe
winhelp: docsetup $(HELPFILE)
docsetup:
@if not exist $(DOCTMP_DIR)\nul mkdir $(DOCTMP_DIR)
$(MAN2HELP) $(MAN2HELP2) $(INDEX): $(TCLTOOLSDIR)\$$(@F)
$(CPY) $(TCLTOOLSDIR)\$(@F) $(@D)
$(BMP):
$(CPY) $(WINDIR)\rc\$(@F) $(@D)
$(HELPFILE): $(HELPRTF) $(BMP)
cd $(DOCTMP_DIR)
start /wait hcrtf.exe -x <<$(PROJECT).hpj
[OPTIONS]
COMPRESS=12 Hall Zeck
LCID=0x409 0x0 0x0 ; English (United States)
TITLE=Tk Reference Manual
BMROOT=.
CNT=$(@B).cnt
HLP=$(@B).hlp
[FILES]
$(PROJECT).rtf
[WINDOWS]
main="Tcl/Tk Reference Manual",,27648,(r15263976),(r4227327)
[CONFIG]
BrowseButtons()
CreateButton(1, "Web", ExecFile("http://www.tcl.tk"))
CreateButton(2, "SF", ExecFile("http://sf.net/projects/tcl"))
CreateButton(3, "Wiki", ExecFile("http://wiki.tcl.tk"))
CreateButton(4, "FAQ", ExecFile("http://www.purl.org/NET/Tcl-FAQ/"))
<<
cd $(MAKEDIR)
@$(CPY) "$(DOCTMP_DIR)\$(@B).hlp" "$(OUT_DIR)"
@$(CPY) "$(DOCTMP_DIR)\$(@B).cnt" "$(OUT_DIR)"
$(MAN2TCL): $(TCLTOOLSDIR)\$$(@B).c
$(cc32) $(TK_CFLAGS) -Fo$(@D)\ $(TCLTOOLSDIR)\$(@B).c
$(link32) $(conlflags) -out:$@ -stack:16384 $(@D)\man2tcl.obj
$(_VC_MANIFEST_EMBED_EXE)
$(HELPRTF): $(MAN2TCL) $(MAN2HELP) $(MAN2HELP2) $(INDEX)
$(TCLSH) $(MAN2HELP) -bitmap $(BMP_NOPATH) $(PROJECT) $(TK_VERSION) $(DOCDIR:\=/)
install-docs:
!if exist($(HELPFILE))
$(CPY) "$(HELPFILE)" "$(DOC_INSTALL_DIR)\"
$(CPY) "$(HELPCNT)" "$(DOC_INSTALL_DIR)\"
$(TCLSH) <<
puts "Installing $(PROJECT)'s helpfile contents into Tcl's ..."
set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(TK_VERSION).cnt" r]
while {![eof $$f]} {
if {[regexp {:Include $(PROJECT)([0-9]{2}).cnt} [gets $$f] dummy ver]} {
if {$$ver == $(TK_VERSION)} {
puts "Already installed."
exit
} else {
# do something here logical to remove (or replace) it.
puts "$$ver != $(TK_VERSION), unfinished code path, die, die!"
exit 1
}
}
}
close $$f
set f [open "$(DOC_INSTALL_DIR:\=/)/tcl$(TK_VERSION).cnt" a]
puts $$f {:Include $(HLPBASE).cnt}
close $$f
<<
start /wait winhlp32 -g $(DOC_INSTALL_DIR)\tcl$(TK_VERSION).hlp
!if exist("$(CHMFILE)")
@echo Installing compiled HTML help
@$(CPY) "$(CHMFILE)" "$(DOC_INSTALL_DIR)\"
!endif
# "emacs font-lock highlighting fix
#---------------------------------------------------------------------
# Special case object file targets
#---------------------------------------------------------------------
$(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c
$(cc32) $(WISH_CFLAGS) -DTK_TEST \
$(cc32) $(appcflags_nostubs) -DTK_TEST \
-DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
$(TMP_DIR)\tkTest.obj: $(GENERICDIR)\tkTest.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
$(cc32) $(appcflags_nostubs) -Fo$@ $?
$(TMP_DIR)\tkOldTest.obj: $(GENERICDIR)\tkOldTest.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
$(cc32) $(appcflags_nostubs) -Fo$@ $?
$(TMP_DIR)\tkWinTest.obj: $(WINDIR)\tkWinTest.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
$(cc32) $(appcflags_nostubs) -Fo$@ $?
$(TMP_DIR)\tkSquare.obj: $(GENERICDIR)\tkSquare.c
$(cc32) $(WISH_CFLAGS) -Fo$@ $?
$(cc32) $(appcflags_nostubs) -Fo$@ $?
$(TMP_DIR)\winMain.obj: $(WINDIR)\winMain.c
$(cc32) $(WISH_CFLAGS) \
$(cc32) $(appcflags_nostubs) \
-DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \
-Fo$@ $?
$(TMP_DIR)\tkMain2.obj: $(GENERICDIR)\tkMain.c
$(cc32) -DBUILD_tk $(TK_CFLAGS) -DTK_ASCII_MAIN -Fo$@ $?
$(cc32) $(pkgcflags) -DTK_ASCII_MAIN -Fo$@ $?
# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported
# and no reference made to a C runtime.
$(TMP_DIR)\tkStubLib.obj : $(GENERICDIR)\tkStubLib.c
$(cc32) $(STUB_CFLAGS) $(TK_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
$(cc32) $(stubscflags) -Fo$@ $?
$(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in
@nmakehlp -s << $** >$@
@MACHINE@ $(MACHINE:IX86=X86)
@TK_WIN_VERSION@ $(TK_DOTVERSION).0.0
@TK_WIN_VERSION@ $(DOTVERSION).0.0
<<
#---------------------------------------------------------------------
@@ -908,37 +605,20 @@ $(TMP_DIR)\tk.res: \
#---------------------------------------------------------------------
{$(XLIBDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$(CCPKGCMD) @<<
$<
<<
{$(TTKDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$(CCPKGCMD) @<<
$<
<<
{$(ROOT)\unix}.c{$(TMP_DIR)}.obj::
$(cc32) -DBUILD_tk $(TK_CFLAGS) -Fo$(TMP_DIR)\ @<<
$(CCPKGCMD) @<<
$<
<<
{$(RCDIR)}.rc{$(TMP_DIR)}.res:
$(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" $(TCL_INCLUDES) \
-d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
-d TCL_THREADS=$(TCL_THREADS) \
-d STATIC_BUILD=$(STATIC_BUILD) \
$<
$(TMP_DIR)\tk.res: $(TMP_DIR)\wish.exe.manifest
$(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest
@@ -953,7 +633,7 @@ $(TMP_DIR)\wish.res: $(TMP_DIR)\wish.exe.manifest
install-binaries:
@echo installing binaries
@$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\"
!if $(TKLIB) != $(TKIMPLIB)
!if "$(TKLIB)" != "$(TKIMPLIB)"
@$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\"
!endif
@$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\"
@@ -964,7 +644,7 @@ install-binaries:
if {[catch {package present Tcl 8.6.0}]} { return }
if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)]
|| ([info exists ::argv] && ("-display" in $$::argv)))} {
package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(TK_DOTVERSION).dll] Tk]
package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(DOTVERSION).dll] Tk]
} else {
package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk]
}
@@ -982,16 +662,16 @@ install-libraries:
@$(CPY) "$(GENERICDIR)\tkIntXlibDecls.h" "$(INCLUDE_INSTALL_DIR)\"
@$(CPY) "$(XLIBDIR)\X11\*.h" "$(INCLUDE_INSTALL_DIR)\X11\"
@echo installing script library
@$(CPY) "$(ROOT)\library\*" "$(SCRIPT_INSTALL_DIR)\"
@$(CPY) "$(LIBDIR)\*" "$(SCRIPT_INSTALL_DIR)\"
@echo installing theme library
@$(CPY) "$(ROOT)\library\ttk\*" "$(SCRIPT_INSTALL_DIR)\ttk\"
@echo installing demos
@$(CPY) "$(ROOT)\library\demos\*" "$(SCRIPT_INSTALL_DIR)\demos\"
@$(CPY) "$(ROOT)\library\demos\images\*" "$(SCRIPT_INSTALL_DIR)\demos\images\"
@$(CPY) "$(LIBDIR)\ttk\*" "$(SCRIPT_INSTALL_DIR)\ttk\"
@echo installing images
@$(CPY) "$(ROOT)\library\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
@$(CPY) "$(LIBDIR)\images\*" "$(SCRIPT_INSTALL_DIR)\images\"
@echo installing language files
@$(CPY) "$(ROOT)\library\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
@$(CPY) "$(LIBDIR)\msgs\*" "$(SCRIPT_INSTALL_DIR)\msgs\"
@echo installing demos
@$(CPY) "$(DEMODIR)\*" "$(DEMO_INSTALL_DIR)\"
@$(CPY) "$(DEMODIR)\images\*" "$(DEMO_INSTALL_DIR)\images\"
#"
@@ -999,8 +679,11 @@ install-libraries:
# Clean up
#---------------------------------------------------------------------
clean: default-clean
realclean: hose
hose: default-hose
tidy:
!if $(TKLIB) != $(TKIMPLIB)
!if "$(TKLIB)" != "$(TKIMPLIB)"
@echo Removing $(TKLIB) ...
@if exist $(TKLIB) del $(TKLIB)
!endif
@@ -1013,24 +696,3 @@ tidy:
@echo Removing $(TKSTUBLIB) ...
@if exist $(TKSTUBLIB) del $(TKSTUBLIB)
clean:
@echo Cleaning $(TMP_DIR)\* ...
@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
@echo Cleaning $(WINDIR)\nmakehlp.obj ...
@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
@echo Cleaning $(WINDIR)\nmakehlp.exe ...
@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
@echo Cleaning $(WINDIR)\_junk.pch ...
@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
@echo Cleaning $(WINDIR)\vercl.x ...
@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
@echo Cleaning $(WINDIR)\vercl.i ...
@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
@echo Cleaning $(WINDIR)\versions.vc ...
@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
realclean: hose
hose:
@echo Hosing $(OUT_DIR)\* ...
@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)

View File

@@ -39,14 +39,14 @@
#endif
/* protos */
static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static int LocateDependency(const char *keyfile);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);
@@ -74,6 +74,7 @@ main(
char msg[300];
DWORD dwWritten;
int chars;
char *s;
/*
* Make sure children (cl.exe and link.exe) are kept quiet.
@@ -102,16 +103,16 @@ main(
}
return CheckForCompilerFeature(argv[2]);
case 'l':
if (argc != 3) {
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option>\n"
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForLinkerFeature(argv[2]);
return CheckForLinkerFeature(&argv[2], argc-2);
case 'f':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
@@ -153,8 +154,13 @@ main(
&dwWritten, NULL);
return 0;
}
printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
return 0;
s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
if (s && *s) {
printf("%s\n", s);
return 0;
} else
return 1; /* Version not found. Return non-0 exit code */
case 'Q':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
@@ -166,6 +172,18 @@ main(
return 2;
}
return QualifyPath(argv[2]);
case 'L':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -L keypath\n"
"Emit the fully qualified path of directory containing keypath\n"
"exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return LocateDependency(argv[2]);
}
}
chars = snprintf(msg, sizeof(msg) - 1,
@@ -313,7 +331,8 @@ CheckForCompilerFeature(
static int
CheckForLinkerFeature(
const char *option)
const char **options,
int count)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
@@ -322,7 +341,8 @@ CheckForLinkerFeature(
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
char cmdline[100];
int i;
char cmdline[255];
hProcess = GetCurrentProcess();
@@ -368,7 +388,11 @@ CheckForLinkerFeature(
* Append our option for testing.
*/
lstrcat(cmdline, option);
for (i = 0; i < count; i++) {
lstrcat(cmdline, " \"");
lstrcat(cmdline, options[i]);
lstrcat(cmdline, "\"");
}
ok = CreateProcess(
NULL, /* Module name. */
@@ -433,7 +457,9 @@ CheckForLinkerFeature(
return !(strstr(Out.buffer, "LNK1117") != NULL ||
strstr(Err.buffer, "LNK1117") != NULL ||
strstr(Out.buffer, "LNK4044") != NULL ||
strstr(Err.buffer, "LNK4044") != NULL);
strstr(Err.buffer, "LNK4044") != NULL ||
strstr(Out.buffer, "LNK4224") != NULL ||
strstr(Err.buffer, "LNK4224") != NULL);
}
static DWORD WINAPI
@@ -686,6 +712,97 @@ QualifyPath(
return 0;
}
/*
* Implements LocateDependency for a single directory. See that command
* for an explanation.
* Returns 0 if found after printing the directory.
* Returns 1 if not found but no errors.
* Returns 2 on any kind of error
* Basically, these are used as exit codes for the process.
*/
static int LocateDependencyHelper(const char *dir, const char *keypath)
{
HANDLE hSearch;
char path[MAX_PATH+1];
int dirlen, keylen, ret;
WIN32_FIND_DATA finfo;
if (dir == NULL || keypath == NULL)
return 2; /* Have no real error reporting mechanism into nmake */
dirlen = strlen(dir);
if ((dirlen + 3) > sizeof(path))
return 2;
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
#if 0 /* This function is not available in Visual C++ 6 */
/*
* Use numerics 0 -> FindExInfoStandard,
* 1 -> FindExSearchLimitToDirectories,
* as these are not defined in Visual C++ 6
*/
hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
#else
hSearch = FindFirstFile(path, &finfo);
#endif
if (hSearch == INVALID_HANDLE_VALUE)
return 1; /* Not found */
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
do {
int sublen;
/*
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
sublen = strlen(finfo.cFileName);
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
continue; /* Path does not fit, assume not matched */
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
if (PathFileExists(path)) {
/* Found a match, print to stdout */
path[dirlen+1+sublen] = '\0';
QualifyPath(path);
ret = 0;
break;
}
} while (FindNextFile(hSearch, &finfo));
FindClose(hSearch);
return ret;
}
/*
* LocateDependency --
*
* Locates a dependency for a package.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
int i, ret;
static char *paths[] = {"..", "..\\..", "..\\..\\.."};
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
if (ret == 0)
return ret;
}
return ret;
}
/*
* Local variables:
* mode: c

File diff suppressed because it is too large Load Diff

View File

@@ -331,7 +331,7 @@ TkWinClipboardRender(
#ifdef UNICODE
Tcl_DStringInit(&ds);
Tcl_UtfToUniCharDString(rawText, -1, &ds);
Tcl_WinUtfToTChar(rawText, -1, &ds);
ckfree(rawText);
handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE,
(unsigned) Tcl_DStringLength(&ds) + 2);
@@ -414,16 +414,7 @@ UpdateClipboard(
OpenClipboard(hwnd);
EmptyClipboard();
/*
* CF_UNICODETEXT is only supported on NT, but it it is prefered when
* possible.
*/
if (TkWinGetPlatformId() != VER_PLATFORM_WIN32_WINDOWS) {
SetClipboardData(CF_UNICODETEXT, NULL);
} else {
SetClipboardData(CF_TEXT, NULL);
}
SetClipboardData(CF_UNICODETEXT, NULL);
CloseClipboard();
TkWinUpdatingClipboard(FALSE);
}

View File

@@ -644,12 +644,7 @@ static void LoadShellProcs()
if (shell32_handle != NULL)
return; /* We have already been through here. */
/*
* XXX - Note we never call FreeLibrary. There is no point because
* shell32.dll is loaded at startup anyways and stays for the duration
* of the process so why bother with keeping track of when to unload
*/
shell32_handle = LoadLibrary(TEXT("shell32.dll"));
shell32_handle = GetModuleHandle(TEXT("shell32.dll"));
if (shell32_handle == NULL) /* Should never happen but check anyways. */
return;
@@ -1379,17 +1374,27 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
goto vamoose;
if (optsPtr->extObj != NULL) {
wstr = Tcl_GetUnicode(optsPtr->extObj);
Tcl_DString ds;
const char *src;
src = Tcl_GetString(optsPtr->extObj);
wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->extObj->length, &ds);
if (wstr[0] == L'.')
++wstr;
hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr);
Tcl_DStringFree(&ds);
if (FAILED(hr))
goto vamoose;
}
if (optsPtr->titleObj != NULL) {
hr = fdlgIf->lpVtbl->SetTitle(fdlgIf,
Tcl_GetUnicode(optsPtr->titleObj));
Tcl_DString ds;
const char *src;
src = Tcl_GetString(optsPtr->titleObj);
wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->titleObj->length, &ds);
hr = fdlgIf->lpVtbl->SetTitle(fdlgIf, wstr);
Tcl_DStringFree(&ds);
if (FAILED(hr))
goto vamoose;
}
@@ -1464,12 +1469,14 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
SIGDN_FILESYSPATH, &wstr);
if (SUCCEEDED(hr)) {
Tcl_DString fnds;
ConvertExternalFilename(wstr, &fnds);
CoTaskMemFree(wstr);
Tcl_ListObjAppendElement(
interp, multiObj,
Tcl_NewStringObj(Tcl_DStringValue(&fnds),
Tcl_DStringLength(&fnds)));
Tcl_DStringFree(&fnds);
}
itemIf->lpVtbl->Release(itemIf);
if (FAILED(hr))
@@ -1490,10 +1497,12 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
&wstr);
if (SUCCEEDED(hr)) {
Tcl_DString fnds;
ConvertExternalFilename(wstr, &fnds);
resultObj = Tcl_NewStringObj(Tcl_DStringValue(&fnds),
Tcl_DStringLength(&fnds));
CoTaskMemFree(wstr);
Tcl_DStringFree(&fnds);
}
resultIf->lpVtbl->Release(resultIf);
}
@@ -1501,13 +1510,20 @@ static int GetFileNameVista(Tcl_Interp *interp, OFNOpts *optsPtr,
if (SUCCEEDED(hr)) {
if (filterPtr && optsPtr->typeVariableObj) {
UINT ftix;
hr = fdlgIf->lpVtbl->GetFileTypeIndex(fdlgIf, &ftix);
if (SUCCEEDED(hr)) {
/* Note ftix is a 1-based index */
if (ftix > 0 && ftix <= nfilters) {
Tcl_DString ftds;
Tcl_Obj *ftobj;
Tcl_WinTCharToUtf(filterPtr[ftix-1].pszName, -1, &ftds);
ftobj = Tcl_NewStringObj(Tcl_DStringValue(&ftds),
Tcl_DStringLength(&ftds));
Tcl_ObjSetVar2(interp, optsPtr->typeVariableObj, NULL,
Tcl_NewUnicodeObj(filterPtr[ftix-1].pszName, -1),
TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
ftobj, TCL_GLOBAL_ONLY|TCL_LEAVE_ERR_MSG);
Tcl_DStringFree(&ftds);
}
}
}
@@ -2786,6 +2802,9 @@ Tk_MessageBoxObjCmd(
};
ThreadSpecificData *tsdPtr =
Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData));
Tcl_DString titleBuf, tmpBuf;
const WCHAR *titlePtr, *tmpPtr;
const char *src;
defaultBtn = -1;
detailObj = NULL;
@@ -2896,7 +2915,9 @@ Tk_MessageBoxObjCmd(
: Tcl_NewUnicodeObj(NULL, 0);
Tcl_IncrRefCount(tmpObj);
if (detailObj) {
Tcl_AppendUnicodeToObj(tmpObj, L"\n\n", 2);
const Tcl_UniChar twoNL[] = { '\n', '\n' };
Tcl_AppendUnicodeToObj(tmpObj, twoNL, 2);
Tcl_AppendObjToObj(tmpObj, detailObj);
}
@@ -2915,8 +2936,18 @@ Tk_MessageBoxObjCmd(
tsdPtr->hBigIcon = TkWinGetIcon(parent, ICON_BIG);
tsdPtr->hMsgBoxHook = SetWindowsHookEx(WH_CBT, MsgBoxCBTProc, NULL,
GetCurrentThreadId());
winCode = MessageBox(hWnd, Tcl_GetUnicode(tmpObj),
titleObj ? Tcl_GetUnicode(titleObj) : L"", flags);
src = Tcl_GetString(tmpObj);
tmpPtr = Tcl_WinUtfToTChar(src, tmpObj->length, &tmpBuf);
if (titleObj != NULL) {
src = Tcl_GetString(titleObj);
titlePtr = Tcl_WinUtfToTChar(src, titleObj->length, &titleBuf);
} else {
titlePtr = L"";
Tcl_DStringInit(&titleBuf);
}
winCode = MessageBox(hWnd, tmpPtr, titlePtr, flags);
Tcl_DStringFree(&titleBuf);
Tcl_DStringFree(&tmpBuf);
UnhookWindowsHookEx(tsdPtr->hMsgBoxHook);
(void) Tcl_SetServiceMode(oldMode);
@@ -3451,7 +3482,7 @@ FontchooserShowCmd(
LF_FACESIZE-1);
Tcl_DStringFree(&ds);
lf.lfFaceName[LF_FACESIZE-1] = 0;
lf.lfHeight = -MulDiv(TkFontGetPoints(tkwin, fontPtr->fa.size),
lf.lfHeight = -MulDiv((int)(TkFontGetPoints(tkwin, fontPtr->fa.size) + 0.5),
GetDeviceCaps(hdc, LOGPIXELSY), 72);
if (fontPtr->fa.weight == TK_FW_BOLD) {
lf.lfWeight = FW_BOLD;

View File

@@ -486,7 +486,7 @@ XCopyPlane(
/*
*----------------------------------------------------------------------
*
* TkPutImage --
* TkPutImage, XPutImage --
*
* Copies a subimage from an in-memory image to a rectangle of of the
* specified drawable.
@@ -599,6 +599,21 @@ TkPutImage(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
int
XPutImage(
Display *display,
Drawable d, /* Destination drawable. */
GC gc,
XImage *image, /* Source image. */
int src_x, int src_y, /* Offset of subimage. */
int dest_x, int dest_y, /* Position of subimage origin in drawable. */
unsigned int width, unsigned int height)
/* Dimensions of subimage. */
{
return TkPutImage(NULL, 0, display, d, gc, image,
src_x, src_y, dest_x, dest_y, width, height);
}
/*
*----------------------------------------------------------------------
@@ -625,7 +640,6 @@ XFillRectangles(
int nrectangles)
{
HDC dc;
int i;
RECT rect;
TkWinDCState state;
HBRUSH brush, oldBrush;
@@ -666,25 +680,26 @@ XFillRectangles(
* result with the stipple pattern.
*/
for (i = 0; i < nrectangles; i++) {
bitmap = CreateCompatibleBitmap(dc, rectangles[i].width,
rectangles[i].height);
while (nrectangles-- > 0) {
bitmap = CreateCompatibleBitmap(dc, rectangles[0].width,
rectangles[0].height);
oldBitmap = SelectObject(dcMem, bitmap);
rect.left = 0;
rect.top = 0;
rect.right = rectangles[i].width;
rect.bottom = rectangles[i].height;
rect.right = rectangles[0].width;
rect.bottom = rectangles[0].height;
FillRect(dcMem, &rect, brush);
BitBlt(dc, rectangles[i].x, rectangles[i].y, rectangles[i].width,
rectangles[i].height, dcMem, 0, 0, COPYFG);
BitBlt(dc, rectangles[0].x, rectangles[0].y, rectangles[0].width,
rectangles[0].height, dcMem, 0, 0, COPYFG);
if (gc->fill_style == FillOpaqueStippled) {
FillRect(dcMem, &rect, bgBrush);
BitBlt(dc, rectangles[i].x, rectangles[i].y,
rectangles[i].width, rectangles[i].height, dcMem,
BitBlt(dc, rectangles[0].x, rectangles[0].y,
rectangles[0].width, rectangles[0].height, dcMem,
0, 0, COPYBG);
}
SelectObject(dcMem, oldBitmap);
DeleteObject(bitmap);
++rectangles;
}
DeleteDC(dcMem);
@@ -693,22 +708,24 @@ XFillRectangles(
DeleteObject(bgBrush);
} else {
if (gc->function == GXcopy) {
for (i = 0; i < nrectangles; i++) {
rect.left = rectangles[i].x;
rect.right = rect.left + rectangles[i].width;
rect.top = rectangles[i].y;
rect.bottom = rect.top + rectangles[i].height;
while (nrectangles-- > 0) {
rect.left = rectangles[0].x;
rect.right = rect.left + rectangles[0].width;
rect.top = rectangles[0].y;
rect.bottom = rect.top + rectangles[0].height;
FillRect(dc, &rect, brush);
++rectangles;
}
} else {
HPEN newPen = CreatePen(PS_NULL, 0, gc->foreground);
HPEN oldPen = SelectObject(dc, newPen);
oldBrush = SelectObject(dc, brush);
for (i = 0; i < nrectangles; i++) {
Rectangle(dc, rectangles[i].x, rectangles[i].y,
rectangles[i].x + rectangles[i].width + 1,
rectangles[i].y + rectangles[i].height + 1);
while (nrectangles-- > 0) {
Rectangle(dc, rectangles[0].x, rectangles[0].y,
rectangles[0].x + rectangles[0].width + 1,
rectangles[0].y + rectangles[0].height + 1);
++rectangles;
}
SelectObject(dc, oldBrush);
@@ -721,6 +738,52 @@ XFillRectangles(
return Success;
}
/*
*----------------------------------------------------------------------
*
* MakeAndStrokePath --
*
* This function draws a shape using a list of points, a stipple pattern,
* and the specified drawing function. It does it through creation of a
* so-called 'path' (see GDI documentation on MSDN).
*
* Results:
* None.
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
static void
MakeAndStrokePath(
HDC dc,
POINT *winPoints,
int npoints,
WinDrawFunc func) /* Name of the Windows GDI drawing function:
this is either Polyline or Polygon. */
{
BeginPath(dc);
func(dc, winPoints, npoints);
/*
* In the case of closed polylines, the first and last points
* are the same. We want miter or bevel join be rendered also
* at this point, this needs telling the Windows GDI that the
* path is closed.
*/
if (func == Polyline) {
if ((winPoints[0].x == winPoints[npoints-1].x) &&
(winPoints[0].y == winPoints[npoints-1].y)) {
CloseFigure(dc);
}
EndPath(dc);
StrokePath(dc);
} else {
EndPath(dc);
StrokeAndFillPath(dc);
}
}
/*
*----------------------------------------------------------------------
*
@@ -816,7 +879,7 @@ RenderObject(
SetPolyFillMode(dcMem, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
oldMemBrush = SelectObject(dcMem, CreateSolidBrush(gc->foreground));
func(dcMem, winPoints, npoints);
MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0, COPYFG);
/*
@@ -828,7 +891,7 @@ RenderObject(
if (gc->fill_style == FillOpaqueStippled) {
DeleteObject(SelectObject(dcMem,
CreateSolidBrush(gc->background)));
func(dcMem, winPoints, npoints);
MakeAndStrokePath(dcMem, winPoints, npoints, func);
BitBlt(dc, rect.left, rect.top, width, height, dcMem, 0, 0,
COPYBG);
}
@@ -844,7 +907,7 @@ RenderObject(
SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
func(dc, winPoints, npoints);
MakeAndStrokePath(dc, winPoints, npoints, func);
SelectObject(dc, oldPen);
}
DeleteObject(SelectObject(dc, oldBrush));
@@ -940,7 +1003,7 @@ XFillPolygon(
/*
*----------------------------------------------------------------------
*
* XDrawRectangle --
* XDrawRectangle, XDrawRectangles --
*
* Draws a rectangle.
*
@@ -985,11 +1048,32 @@ XDrawRectangle(
TkWinReleaseDrawableDC(d, dc, &state);
return Success;
}
int
XDrawRectangles(
Display *display,
Drawable d,
GC gc,
XRectangle rects[],
int nrects)
{
int ret = Success;
while (nrects-- > 0) {
ret = XDrawRectangle(display, d, gc, rects[0].x, rects[0].y,
rects[0].width, rects[0].height);
if (ret != Success) {
break;
}
++rects;
}
return ret;
}
/*
*----------------------------------------------------------------------
*
* XDrawArc --
* XDrawArc, XDrawArcs --
*
* Draw an arc.
*
@@ -1015,11 +1099,35 @@ XDrawArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 0);
}
int
XDrawArcs(
Display *display,
Drawable d,
GC gc,
XArc *arcs,
int narcs)
{
int ret = Success;
display->request++;
while (narcs-- > 0) {
ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
arcs[0].width, arcs[0].height,
arcs[0].angle1, arcs[0].angle2, 0);
if (ret != Success) {
break;
}
++arcs;
}
return ret;
}
/*
*----------------------------------------------------------------------
*
* XFillArc --
* XFillArc, XFillArcs --
*
* Draw a filled arc.
*
@@ -1045,6 +1153,30 @@ XFillArc(
return DrawOrFillArc(display, d, gc, x, y, width, height, start, extent, 1);
}
int
XFillArcs(
Display *display,
Drawable d,
GC gc,
XArc *arcs,
int narcs)
{
int ret = Success;
display->request++;
while (narcs-- > 0) {
ret = DrawOrFillArc(display, d, gc, arcs[0].x, arcs[0].y,
arcs[0].width, arcs[0].height,
arcs[0].angle1, arcs[0].angle2, 1);
if (ret != Success) {
break;
}
++arcs;
}
return ret;
}
/*
*----------------------------------------------------------------------

View File

@@ -262,16 +262,7 @@ void
TkpFontPkgInit(
TkMainInfo *mainPtr) /* The application being created. */
{
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
/*
* If running NT, then we will be calling some Unicode functions
* explictly. So, even if the Tcl system encoding isn't Unicode, make
* sure we convert to/from the Unicode char set.
*/
systemEncoding = TkWinGetUnicodeEncoding();
}
systemEncoding = TkWinGetUnicodeEncoding();
TkWinSetupSystemFonts(mainPtr);
}
@@ -571,7 +562,7 @@ TkpGetFontFromAttributes(
ReleaseDC(hwnd, hdc);
hFont = GetScreenFont(faPtr, faceName,
TkFontGetPixels(tkwin, faPtr->size), 0.0);
(int)(TkFontGetPixels(tkwin, faPtr->size) + 0.5), 0.0);
if (tkFontPtr == NULL) {
fontPtr = ckalloc(sizeof(WinFont));
} else {
@@ -743,7 +734,7 @@ void
TkpGetFontAttrsForChar(
Tk_Window tkwin, /* Window on the font's display */
Tk_Font tkfont, /* Font to query */
Tcl_UniChar c, /* Character of interest */
int c, /* Character of interest */
TkFontAttributes *faPtr) /* Output: Font attributes */
{
WinFont *fontPtr = (WinFont *) tkfont;
@@ -760,19 +751,19 @@ TkpGetFontAttrsForChar(
* character */
FontFamily *familyPtr = thisSubFontPtr->familyPtr;
HFONT oldfont; /* Saved font from the device context */
TEXTMETRICA tm; /* Font metrics of the selected subfont */
TEXTMETRIC tm; /* Font metrics of the selected subfont */
/*
* Get the font attributes.
*/
oldfont = SelectObject(hdc, thisSubFontPtr->hFont0);
GetTextMetricsA(hdc, &tm);
GetTextMetrics(hdc, &tm);
SelectObject(hdc, oldfont);
ReleaseDC(fontPtr->hwnd, hdc);
faPtr->family = familyPtr->faceName;
faPtr->size = TkFontGetPoints(tkwin,
tm.tmInternalLeading - tm.tmHeight);
(double)(tm.tmInternalLeading - tm.tmHeight));
faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
faPtr->slant = tm.tmItalic ? TK_FS_ITALIC : TK_FS_ROMAN;
faPtr->underline = (tm.tmUnderlined != 0);
@@ -828,7 +819,7 @@ Tk_MeasureChars(
HFONT oldFont;
WinFont *fontPtr;
int curX, moretomeasure;
Tcl_UniChar ch;
int ch;
SIZE size;
FontFamily *familyPtr;
Tcl_DString runString;
@@ -859,7 +850,7 @@ Tk_MeasureChars(
start = source;
end = start + numBytes;
for (p = start; p < end; ) {
next = p + Tcl_UtfToUniChar(p, &ch);
next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
familyPtr = lastSubFontPtr->familyPtr;
@@ -921,7 +912,7 @@ Tk_MeasureChars(
familyPtr = lastSubFontPtr->familyPtr;
Tcl_DStringInit(&runString);
for (p = start; p < end; ) {
next = p + Tcl_UtfToUniChar(p, &ch);
next = p + TkUtfToUniChar(p, &ch);
Tcl_UtfToExternal(NULL, familyPtr->encoding, p,
(int) (next - p), 0, NULL, buf, sizeof(buf), NULL,
&dstWrote, NULL);
@@ -970,13 +961,13 @@ Tk_MeasureChars(
*/
const char *lastWordBreak = NULL;
Tcl_UniChar ch2;
int ch2;
end = p;
p = source;
ch = ' ';
while (p < end) {
next = p + Tcl_UtfToUniChar(p, &ch2);
next = p + TkUtfToUniChar(p, &ch2);
if ((ch != ' ') && (ch2 == ' ')) {
lastWordBreak = p;
}
@@ -1118,7 +1109,7 @@ Tk_DrawChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
TEXTMETRICA tm;
TEXTMETRIC tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1145,7 +1136,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
GetTextMetricsA(dcMem, &tm);
GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1184,7 +1175,7 @@ Tk_DrawChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
TEXTMETRICA tm;
TEXTMETRIC tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1199,7 +1190,7 @@ Tk_DrawChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
GetTextMetricsA(dcMem, &tm);
GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1266,7 +1257,7 @@ TkDrawAngledChars(
HBRUSH oldBrush, stipple;
HBITMAP oldBitmap, bitmap;
HDC dcMem;
TEXTMETRICA tm;
TEXTMETRIC tm;
SIZE size;
if (twdPtr->type != TWD_BITMAP) {
@@ -1293,7 +1284,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
GetTextMetricsA(dcMem, &tm);
GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1332,7 +1323,7 @@ TkDrawAngledChars(
} else {
HBITMAP oldBitmap, bitmap;
HDC dcMem;
TEXTMETRICA tm;
TEXTMETRIC tm;
SIZE size;
dcMem = CreateCompatibleDC(dc);
@@ -1347,7 +1338,7 @@ TkDrawAngledChars(
*/
GetTextExtentPointA(dcMem, source, numBytes, &size);
GetTextMetricsA(dcMem, &tm);
GetTextMetrics(dcMem, &tm);
size.cx -= tm.tmOverhang;
bitmap = CreateCompatibleBitmap(dc, size.cx, size.cy);
oldBitmap = SelectObject(dcMem, bitmap);
@@ -1407,9 +1398,13 @@ TkpDrawCharsInContext(
* whole (not just the range) string when
* drawing. */
{
int widthUntilStart;
(void) numBytes; /*unused*/
Tk_MeasureChars(tkfont, source, rangeStart, -1, 0, &widthUntilStart);
Tk_DrawChars(display, drawable, gc, tkfont, source + rangeStart,
rangeLength, x, y);
rangeLength, x+widthUntilStart, y);
}
/*
@@ -1443,24 +1438,32 @@ MultiFontTextOut(
* string when drawing. */
double angle)
{
Tcl_UniChar ch;
int ch;
SIZE size;
HFONT oldFont;
FontFamily *familyPtr;
Tcl_DString runString;
const char *p, *end, *next;
SubFont *lastSubFontPtr, *thisSubFontPtr;
TEXTMETRICA tm;
TEXTMETRIC tm;
lastSubFontPtr = &fontPtr->subFontArray[0];
oldFont = SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
GetTextMetricsA(hdc, &tm);
GetTextMetrics(hdc, &tm);
end = source + numBytes;
for (p = source; p < end; ) {
next = p + Tcl_UtfToUniChar(p, &ch);
next = p + TkUtfToUniChar(p, &ch);
thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr);
if (thisSubFontPtr != lastSubFontPtr) {
/*
* The drawing API has a limit of 32767 pixels in one go.
* To avoid spending time on a rare case we do not measure each char,
* instead we limit to drawing chunks of 200 bytes since that works
* well in practice.
*/
if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) {
if (p > source) {
familyPtr = lastSubFontPtr->familyPtr;
Tcl_UtfToExternalDString(familyPtr->encoding, source,
@@ -1478,7 +1481,7 @@ MultiFontTextOut(
lastSubFontPtr = thisSubFontPtr;
source = p;
SelectFont(hdc, fontPtr, lastSubFontPtr, angle);
GetTextMetricsA(hdc, &tm);
GetTextMetrics(hdc, &tm);
}
p = next;
}
@@ -1556,7 +1559,7 @@ InitFont(
HDC hdc;
HWND hwnd;
HFONT oldFont;
TEXTMETRICA tm;
TEXTMETRIC tm;
Window window;
TkFontMetrics *fmPtr;
Tcl_Encoding encoding;
@@ -1569,7 +1572,7 @@ InitFont(
hdc = GetDC(hwnd);
oldFont = SelectObject(hdc, hFont);
GetTextMetricsA(hdc, &tm);
GetTextMetrics(hdc, &tm);
/*
* On any version NT, there may fonts with international names. Use the
@@ -1597,7 +1600,7 @@ InitFont(
faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString));
faPtr->size =
TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
TkFontGetPoints(tkwin, (double)-(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;
@@ -1940,7 +1943,8 @@ FindSubFontForChar(
SubFont *subFontPtr;
Tcl_DString ds;
if (ch < BASE_CHARS) {
if ((ch < BASE_CHARS) || (ch >= 0x10000)) {
return &fontPtr->subFontArray[0];
}
@@ -2188,7 +2192,7 @@ FontMapLoadPage(
{
FontFamily *familyPtr;
Tcl_Encoding encoding;
char src[TCL_UTF_MAX], buf[16];
char src[XMaxTransChars], buf[16];
USHORT *startCount, *endCount;
int i, j, bitOffset, end, segCount;

View File

@@ -181,6 +181,9 @@ TkWin32ErrorObj(
LPTSTR lpBuffer = NULL, p = NULL;
TCHAR sBuffer[30];
Tcl_Obj* errPtr = NULL;
#ifdef _UNICODE
Tcl_DString ds;
#endif
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD)hrError,
@@ -196,7 +199,9 @@ TkWin32ErrorObj(
}
#ifdef _UNICODE
errPtr = Tcl_NewUnicodeObj(lpBuffer, (int)wcslen(lpBuffer));
Tcl_WinTCharToUtf(lpBuffer, (int)wcslen(lpBuffer) * sizeof (WCHAR), &ds);
errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
#else
errPtr = Tcl_NewStringObj(lpBuffer, (int)strlen(lpBuffer));
#endif /* _UNICODE */

View File

@@ -21,7 +21,8 @@
* like a worthwhile improvement to use the table.
*/
#define MAX_KEYCODE 145 /* VK_SCROLL is the last entry in our table below */
#define MAX_KEYCODE 179 /* VK_MEDIA_PLAY_PAUSE is the last entry in our table below */
/* cf. https://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx */
static const KeySym keymap[] = {
NoSymbol, NoSymbol, NoSymbol, XK_Cancel, NoSymbol,
@@ -53,7 +54,13 @@ static const KeySym keymap[] = {
XK_F19, XK_F20, XK_F21, XK_F22, XK_F23,
XK_F24, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol, XK_Num_Lock,
XK_Scroll_Lock
XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*150 0x96*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*155 0x9b*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*160 0xa0*/
NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, /*165 0xa5*/
NoSymbol, NoSymbol, NoSymbol, XK_XF86AudioMute, XK_XF86AudioLowerVolume, /*170 0xaa*/
XK_XF86AudioRaiseVolume, XK_XF86AudioNext, XK_XF86AudioPrev, XK_XF86AudioStop, XK_XF86AudioPlay /*175 0xaf*/
};
/*
@@ -88,6 +95,8 @@ TkpGetString(
* result. */
{
XKeyEvent *keyEv = &eventPtr->xkey;
char buf[6];
int len;
Tcl_DStringInit(dsPtr);
if (keyEv->send_event == -1) {
@@ -95,30 +104,14 @@ TkpGetString(
Tcl_ExternalToUtfDString(TkWinGetKeyInputEncoding(),
keyEv->trans_chars, keyEv->nbytes, dsPtr);
}
} else if (keyEv->send_event == -2) {
/*
* Special case for win2000 multi-lingal IME input. xkey.trans_chars[]
* already contains a UNICODE char.
*/
int unichar;
char buf[TCL_UTF_MAX];
int len;
unichar = keyEv->trans_chars[1] & 0xff;
unichar <<= 8;
unichar |= keyEv->trans_chars[0] & 0xff;
len = Tcl_UniCharToUtf((Tcl_UniChar) unichar, buf);
Tcl_DStringAppend(dsPtr, buf, len);
} else if (keyEv->send_event == -3) {
/*
* Special case for WM_UNICHAR. xkey.trans_chars[] already contains a
* UTF-8 char.
* Special case for WM_UNICHAR and win2000 multi-lingal IME input
*/
Tcl_DStringAppend(dsPtr, keyEv->trans_chars, keyEv->nbytes);
len = TkUniCharToUtf(keyEv->keycode, buf);
Tcl_DStringAppend(dsPtr, buf, len);
} else {
/*
* This is an event generated from generic code. It has no nchars or
@@ -129,9 +122,6 @@ TkpGetString(
if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256))
|| (keysym == XK_Return) || (keysym == XK_Tab)) {
char buf[TCL_UTF_MAX];
int len;
len = Tcl_UniCharToUtf((Tcl_UniChar) (keysym & 255), buf);
Tcl_DStringAppend(dsPtr, buf, len);
}
@@ -196,18 +186,18 @@ KeycodeToKeysym(
{
BYTE keys[256];
int result, deadkey, shift;
char buf[4];
TCHAR buf[4];
unsigned int scancode = MapVirtualKey(keycode, 0);
/*
* Do not run keycodes of lock keys through ToAscii(). One of ToAscii()'s
* Do not run keycodes of lock keys through ToUnicode(). One of ToUnicode()'s
* side effects is to handle the lights on the keyboard, and we don't want
* to mess that up.
*/
if (noascii || keycode == VK_CAPITAL || keycode == VK_SCROLL ||
keycode == VK_NUMLOCK) {
goto skipToAscii;
goto skipToUnicode;
}
/*
@@ -248,24 +238,24 @@ KeycodeToKeysym(
keys[VK_NUMLOCK] = 1;
}
result = ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
result = ToUnicode(keycode, scancode, keys, buf, 4, 0);
if (result < 0) {
/*
* Win95/98: This was a dead char, which is now remembered by the
* keyboard. Call ToAscii() again to forget it.
* keyboard. Call ToUnicode() again to forget it.
* WinNT: This was a dead char, overwriting any previously remembered
* key. Calling ToAscii() again does not affect anything.
* key. Calling ToUnicode() again does not affect anything.
*/
ToAscii(keycode, scancode, keys, (LPWORD) buf, 0);
ToUnicode(keycode, scancode, keys, buf, 4, 0);
return XK_Multi_key;
}
if (result == 2) {
/*
* This was a dead char, and there were one previously remembered by
* the keyboard. Call ToAscii() again with proper parameters to
* the keyboard. Call ToUnicode() again with proper parameters to
* restore it.
*
* Get information about the old char
@@ -290,26 +280,26 @@ KeycodeToKeysym(
if (shift & 4) {
keys[VK_MENU] = 0x80;
}
ToAscii(deadkey, scancode, keys, (LPWORD) buf, 0);
ToUnicode(deadkey, scancode, keys, buf, 4, 0);
return XK_Multi_key;
}
/*
* Keycode mapped to a valid Latin-1 character. Since the keysyms for
* alphanumeric characters map onto Latin-1, we just return it.
* Keycode mapped to a valid Unicode character. Since the keysyms for
* alphanumeric characters map onto Unicode, we just return it.
*
* We treat 0x7F as a special case mostly for backwards compatibility. In
* versions of Tk<=8.2, Control-Backspace returned "XK_BackSpace" as the X
* Keysym. This was due to the fact that we did not initialize the keys
* array properly when we passed it to ToAscii, above. We had previously
* array properly when we passed it to ToUnicode, above. We had previously
* not been setting the state bit for the Control key. When we fixed that,
* we found that Control-Backspace on Windows is interpreted as ASCII-127
* (0x7F), which corresponds to the Delete key.
*
* Upon discovering this, we realized we had two choices: return XK_Delete
* or return XK_BackSpace. If we returned XK_Delete, that could be
* considered "more correct" (although the correctness would be dependant
* on whether you believe that ToAscii is doing the right thing in that
* considered "more correct" (although the correctness would be dependent
* on whether you believe that ToUnicode is doing the right thing in that
* case); however, this would break backwards compatibility, and worse, it
* would limit application programmers; they would effectively be unable
* to bind to <Control-Backspace> on Windows. We therefore chose instead
@@ -319,15 +309,15 @@ KeycodeToKeysym(
* XK_BackSpace).
*/
if (result == 1 && UCHAR(buf[0]) >= 0x20 && UCHAR(buf[0]) != 0x7F) {
return (KeySym) UCHAR(buf[0]);
if (result == 1 && buf[0] >= 0x20 && buf[0] != 0x7F) {
return (KeySym) buf[0];
}
/*
* Keycode is a non-alphanumeric key, so we have to do the lookup.
*/
skipToAscii:
skipToUnicode:
if (keycode > MAX_KEYCODE) {
return NoSymbol;
}
@@ -335,18 +325,24 @@ KeycodeToKeysym(
/*
* Windows only gives us an undifferentiated VK_CONTROL code (for
* example) when either Control key is pressed. To distinguish between
* left and right, we have to query the state of one of the two to
* determine which was actually pressed. So if the keycode indicates
* Control, Shift, or Menu (the key that everybody else calls Alt), do
* this extra test. If the right-side key was pressed, return the
* appropriate keycode. Otherwise, we fall through and rely on the
* keymap table to hold the correct keysym value.
* left and right, we use the Extended flag. Indeed, the right Control
* and Alt (aka Menu) keys are such extended keys (which their left
* counterparts are not).
* Regarding the shift case, Windows does not set the Extended flag for
* the neither the left nor the right shift key. As a consequence another
* way to distinguish between the two keys is to query the state of one
* of the two to determine which was actually pressed. So if the keycode
* indicates Shift, do this extra test. If the right-side key was
* pressed, return the appropriate keycode. Otherwise, we fall through
* and rely on the keymap table to hold the correct keysym value.
* Note: this little trick only works for KeyPress, not for KeyRelease,
* for reasons stated in bug [2945130]
*/
case VK_CONTROL:
if (GetKeyState(VK_RCONTROL) & 0x80) {
return XK_Control_R;
}
if (state & EXTENDED_MASK) {
return XK_Control_R;
}
break;
case VK_SHIFT:
if (GetKeyState(VK_RSHIFT) & 0x80) {
@@ -354,9 +350,9 @@ KeycodeToKeysym(
}
break;
case VK_MENU:
if (GetKeyState(VK_RMENU) & 0x80) {
return XK_Alt_R;
}
if (state & EXTENDED_MASK) {
return XK_Alt_R;
}
break;
}
return keymap[keycode];
@@ -576,7 +572,7 @@ TkpSetKeycodeAndState(
}
}
if (keySym >= 0x20) {
result = VkKeyScan((char) keySym);
result = VkKeyScan((TCHAR) keySym);
if (result != -1) {
shift = result >> 8;
if (shift & 1)
@@ -629,7 +625,7 @@ XKeysymToKeycode(
}
}
if (keysym >= 0x20) {
result = VkKeyScan((char) keysym);
result = VkKeyScan((TCHAR) keysym);
if (result != -1) {
return (KeyCode) (result & 0xff);
}

View File

@@ -900,7 +900,7 @@ TkWinMenuProc(
LRESULT lResult;
if (!TkWinHandleMenuEvent(&hwnd, &message, &wParam, &lParam, &lResult)) {
lResult = DefWindowProcA(hwnd, message, wParam, lParam);
lResult = DefWindowProc(hwnd, message, wParam, lParam);
}
return lResult;
}
@@ -999,7 +999,7 @@ TkWinEmbeddedMenuProc(
}
default:
lResult = DefWindowProcA(hwnd, message, wParam, lParam);
lResult = DefWindowProc(hwnd, message, wParam, lParam);
break;
}
return lResult;
@@ -2036,33 +2036,33 @@ TkWinMenuKeyObjCmd(
if (eventPtr->type == KeyPress) {
switch (keySym) {
case XK_Alt_L:
scanCode = MapVirtualKeyA(VK_LMENU, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_LMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29));
break;
case XK_Alt_R:
scanCode = MapVirtualKeyA(VK_RMENU, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_RMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_MENU,
(int) (scanCode << 16) | (1 << 29) | (1 << 24));
break;
case XK_F10:
scanCode = MapVirtualKeyA(VK_F10, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_F10, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, VK_F10, (int) (scanCode << 16));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
scanCode = MapVirtualKeyA(virtualKey, 0);
scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
XKeyEvent xkey = eventPtr->xkey;
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYDOWN, virtualKey,
(int) ((scanCode << 16) | (1 << 29)));
if (xkey.nbytes > 0) {
for (i = 0; i < xkey.nbytes; i++) {
CallWindowProcA(DefWindowProcA,
CallWindowProc(DefWindowProc,
Tk_GetHWND(Tk_WindowId(tkwin)), WM_SYSCHAR,
xkey.trans_chars[i],
(int) ((scanCode << 16) | (1 << 29)));
@@ -2073,28 +2073,28 @@ TkWinMenuKeyObjCmd(
} else if (eventPtr->type == KeyRelease) {
switch (keySym) {
case XK_Alt_L:
scanCode = MapVirtualKeyA(VK_LMENU, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_LMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_Alt_R:
scanCode = MapVirtualKeyA(VK_RMENU, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_RMENU, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_MENU, (int) (scanCode << 16) | (1 << 24)
| (0x111 << 29) | (1 << 30) | (1 << 31));
| (1 << 29) | (1 << 30) | (1 << 31));
break;
case XK_F10:
scanCode = MapVirtualKeyA(VK_F10, 0);
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
scanCode = MapVirtualKey(VK_F10, 0);
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, VK_F10,
(int) (scanCode << 16) | (1 << 30) | (1 << 31));
break;
default:
virtualKey = XKeysymToKeycode(winPtr->display, keySym);
scanCode = MapVirtualKeyA(virtualKey, 0);
scanCode = MapVirtualKey(virtualKey, 0);
if (0 != scanCode) {
CallWindowProcA(DefWindowProcA, Tk_GetHWND(Tk_WindowId(tkwin)),
CallWindowProc(DefWindowProc, Tk_GetHWND(Tk_WindowId(tkwin)),
WM_SYSKEYUP, virtualKey, (int) ((scanCode << 16)
| (1 << 29) | (1 << 30) | (1 << 31)));
}
@@ -3199,7 +3199,7 @@ SetDefaults(
HDC scratchDC;
int bold = 0;
int italic = 0;
TEXTMETRICA tm;
TEXTMETRIC tm;
int pointSize;
HFONT menuFont;
/* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */
@@ -3239,7 +3239,7 @@ SetDefaults(
&nc.metrics, 0);
menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont);
SelectObject(scratchDC, menuFont);
GetTextMetricsA(scratchDC, &tm);
GetTextMetrics(scratchDC, &tm);
GetTextFaceA(scratchDC, LF_FACESIZE, faceName);
pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading,
72, GetDeviceCaps(scratchDC, LOGPIXELSY));
@@ -3295,9 +3295,7 @@ SetDefaults(
*/
showMenuAccelerators = TRUE;
if (TkWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
SystemParametersInfoA(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
}
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &showMenuAccelerators, 0);
}
/*

View File

@@ -252,8 +252,14 @@ TkGetInterpNames(
LPOLESTR p = olestr + wcslen(oleszStub);
if (*p) {
Tcl_DString ds;
Tcl_WinTCharToUtf(p + 1, -1, &ds);
result = Tcl_ListObjAppendElement(interp,
objList, Tcl_NewUnicodeObj(p + 1, -1));
objList,
Tcl_NewStringObj(Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds)));
Tcl_DStringFree(&ds);
}
}
@@ -613,8 +619,7 @@ BuildMoniker(
LPMONIKER pmkItem = NULL;
Tcl_DString dString;
Tcl_DStringInit(&dString);
Tcl_UtfToUniCharDString(name, -1, &dString);
Tcl_WinUtfToTChar(name, -1, &dString);
hr = CreateFileMoniker((LPOLESTR)Tcl_DStringValue(&dString), &pmkItem);
Tcl_DStringFree(&dString);
if (SUCCEEDED(hr)) {
@@ -740,6 +745,8 @@ Send(
HRESULT hr = S_OK, ehr = S_OK;
Tcl_Obj *cmd = NULL;
DISPID dispid;
Tcl_DString ds;
const char *src;
cmd = Tcl_ConcatObj(objc, objv);
@@ -753,7 +760,10 @@ Send(
memset(&ei, 0, sizeof(ei));
vCmd.vt = VT_BSTR;
vCmd.bstrVal = SysAllocString(Tcl_GetUnicode(cmd));
src = Tcl_GetString(cmd);
Tcl_WinUtfToTChar(src, cmd->length, &ds);
vCmd.bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
dp.cArgs = 1;
dp.rgvarg = &vCmd;
@@ -774,7 +784,9 @@ Send(
ehr = VariantChangeType(&vResult, &vResult, 0, VT_BSTR);
if (SUCCEEDED(ehr)) {
Tcl_SetObjResult(interp, Tcl_NewUnicodeObj(vResult.bstrVal, -1));
Tcl_WinTCharToUtf(vResult.bstrVal, (int) SysStringLen(vResult.bstrVal) *
sizeof (WCHAR), &ds);
Tcl_DStringResult(interp, &ds);
}
/*
@@ -785,8 +797,11 @@ Send(
if (hr == DISP_E_EXCEPTION && ei.bstrSource != NULL) {
Tcl_Obj *opError, *opErrorCode, *opErrorInfo;
opError = Tcl_NewUnicodeObj(ei.bstrSource, -1);
Tcl_WinTCharToUtf(ei.bstrSource, (int) SysStringLen(ei.bstrSource) *
sizeof (WCHAR), &ds);
opError = Tcl_NewStringObj(Tcl_DStringValue(&ds),
Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_ListObjIndex(interp, opError, 0, &opErrorCode);
Tcl_SetObjErrorCode(interp, opErrorCode);
Tcl_ListObjIndex(interp, opError, 1, &opErrorInfo);
@@ -833,6 +848,8 @@ TkWinSend_SetExcepInfo(
ICreateErrorInfo *pCEI;
IErrorInfo *pEI, **ppEI = &pEI;
HRESULT hr;
Tcl_DString ds;
const char *src;
if (!pExcepInfo) {
return;
@@ -851,8 +868,16 @@ TkWinSend_SetExcepInfo(
Tcl_ListObjAppendElement(interp, opErrorCode, opErrorInfo);
/* TODO: Handle failure to append */
pExcepInfo->bstrDescription = SysAllocString(Tcl_GetUnicode(opError));
pExcepInfo->bstrSource = SysAllocString(Tcl_GetUnicode(opErrorCode));
src = Tcl_GetString(opError);
Tcl_WinUtfToTChar(src, opError->length, &ds);
pExcepInfo->bstrDescription =
SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
src = Tcl_GetString(opErrorCode);
Tcl_WinUtfToTChar(src, opErrorCode->length, &ds);
pExcepInfo->bstrSource =
SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
Tcl_DecrRefCount(opErrorCode);
pExcepInfo->scode = E_FAIL;

View File

@@ -370,6 +370,7 @@ Async(
{
HRESULT hr = S_OK;
VARIANT vCmd;
Tcl_DString ds;
VariantInit(&vCmd);
@@ -382,9 +383,13 @@ Async(
}
if (SUCCEEDED(hr) && obj->interp) {
Tcl_Obj *scriptPtr = Tcl_NewUnicodeObj(vCmd.bstrVal,
(int) SysStringLen(vCmd.bstrVal));
Tcl_Obj *scriptPtr;
Tcl_WinTCharToUtf(vCmd.bstrVal, (int) SysStringLen(vCmd.bstrVal) *
sizeof (WCHAR), &ds);
scriptPtr =
Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
TkWinSend_QueueCommand(obj->interp, scriptPtr);
}
@@ -424,6 +429,7 @@ Send(
VARIANT v;
register Tcl_Interp *interp = obj->interp;
Tcl_Obj *scriptPtr;
Tcl_DString ds;
if (interp == NULL) {
return S_OK;
@@ -434,17 +440,26 @@ Send(
return hr;
}
scriptPtr = Tcl_NewUnicodeObj(v.bstrVal, (int) SysStringLen(v.bstrVal));
Tcl_WinTCharToUtf(v.bstrVal, (int) SysStringLen(v.bstrVal) *
sizeof (WCHAR), &ds);
scriptPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_Preserve(interp);
Tcl_IncrRefCount(scriptPtr);
result = Tcl_EvalObjEx(interp, scriptPtr,
TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL);
Tcl_DecrRefCount(scriptPtr);
if (pvResult != NULL) {
Tcl_Obj *obj;
const char *src;
VariantInit(pvResult);
pvResult->vt = VT_BSTR;
pvResult->bstrVal = SysAllocString(Tcl_GetUnicode(
Tcl_GetObjResult(interp)));
obj = Tcl_GetObjResult(interp);
src = Tcl_GetString(obj);
Tcl_WinUtfToTChar(src, obj->length, &ds);
pvResult->bstrVal = SysAllocString((WCHAR *) Tcl_DStringValue(&ds));
Tcl_DStringFree(&ds);
}
if (result == TCL_ERROR) {
hr = DISP_E_EXCEPTION;

View File

@@ -515,6 +515,7 @@ TestgetwindowinfoObjCmd(
Tcl_Obj *childrenObj = NULL;
TCHAR buf[512];
int cch, cchBuf = 256;
Tcl_DString ds;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "hwnd");
@@ -542,7 +543,9 @@ TestgetwindowinfoObjCmd(
Tcl_NewLongObj(GetWindowLongA(INT2PTR(hwnd), GWL_ID)));
cch = GetWindowText(INT2PTR(hwnd), (LPTSTR)buf, cchBuf);
textObj = Tcl_NewUnicodeObj((LPCWSTR)buf, cch);
Tcl_WinTCharToUtf(buf, cch * sizeof (WCHAR), &ds);
textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
Tcl_DStringFree(&ds);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj);
Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6),

View File

@@ -590,7 +590,7 @@ XResizeWindow(
/*
*----------------------------------------------------------------------
*
* XRaiseWindow --
* XRaiseWindow, XLowerWindow --
*
* Change the stacking order of a window.
*
@@ -614,6 +614,18 @@ XRaiseWindow(
SetWindowPos(window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return Success;
}
int
XLowerWindow(
Display *display,
Window w)
{
HWND window = Tk_GetHWND(w);
display->request++;
SetWindowPos(window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
return Success;
}
/*
*----------------------------------------------------------------------
@@ -750,6 +762,33 @@ XChangeWindowAttributes(
return Success;
}
/*
*----------------------------------------------------------------------
*
* XReparentWindow --
*
* TODO: currently placeholder to satisfy Xlib stubs.
*
* Results:
* None.
*
* Side effects:
* TODO.
*
*----------------------------------------------------------------------
*/
int
XReparentWindow(
Display *display,
Window w,
Window parent,
int x,
int y)
{
return BadWindow;
}
/*
*----------------------------------------------------------------------
*

View File

@@ -81,6 +81,7 @@ typedef struct ThreadSpecificData {
TkDisplay *winDisplay; /* TkDisplay structure that represents Windows
* screen. */
int updatingClipboard; /* If 1, we are updating the clipboard. */
int surrogateBuffer; /* Buffer for first of surrogate pair. */
} ThreadSpecificData;
static Tcl_ThreadDataKey dataKey;
@@ -91,7 +92,7 @@ static Tcl_ThreadDataKey dataKey;
static void GenerateXEvent(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
static unsigned int GetState(UINT message, WPARAM wParam, LPARAM lParam);
static void GetTranslatedKey(XKeyEvent *xkey);
static void GetTranslatedKey(XKeyEvent *xkey, UINT type);
static void UpdateInputLanguage(int charset);
static int HandleIMEComposition(HWND hwnd, LPARAM lParam);
@@ -124,16 +125,13 @@ TkGetServerInfo(
OSVERSIONINFOW os;
if (!buffer[0]) {
HANDLE handle = LoadLibraryW(L"NTDLL");
HANDLE handle = GetModuleHandle(TEXT("NTDLL"));
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion");
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!getversion || getversion(&os)) {
GetVersionExW(&os);
}
if (handle) {
FreeLibrary(handle);
}
/* Write the first character last, preventing multi-thread issues. */
sprintf(buffer+1, "indows %d.%d %d %s", (int)os.dwMajorVersion,
(int)os.dwMinorVersion, (int)os.dwBuildNumber,
@@ -688,19 +686,6 @@ TkClipCleanup(
TkDisplay *dispPtr) /* Display associated with clipboard. */
{
if (dispPtr->clipWindow != NULL) {
/*
* Force the clipboard to be rendered if we are the clipboard owner.
*/
HWND hwnd = Tk_GetHWND(Tk_WindowId(dispPtr->clipWindow));
if (GetClipboardOwner() == hwnd) {
OpenClipboard(hwnd);
EmptyClipboard();
TkWinClipboardRender(dispPtr, CF_TEXT);
CloseClipboard();
}
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
dispPtr->applicationAtom);
Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom,
@@ -877,6 +862,23 @@ Tk_TranslateWinEvent(
return 1;
}
case WM_RENDERALLFORMATS: {
TkWindow *winPtr = (TkWindow *) Tk_HWNDToWindow(hwnd);
if (winPtr && OpenClipboard(hwnd)) {
/*
* Make sure that nobody had taken ownership of the clipboard
* before we opened it.
*/
if (GetClipboardOwner() == hwnd) {
TkWinClipboardRender(winPtr->dispPtr, CF_TEXT);
}
CloseClipboard();
}
return 1;
}
case WM_COMMAND:
case WM_NOTIFY:
case WM_VSCROLL:
@@ -911,15 +913,24 @@ Tk_TranslateWinEvent(
Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam));
return 1;
case WM_SYSKEYDOWN:
case WM_KEYDOWN:
if (wParam == VK_PACKET) {
/*
* This will trigger WM_CHAR event(s) with unicode data.
*/
*resultPtr =
PostMessageW(hwnd, message, HIWORD(lParam), LOWORD(lParam));
return 1;
}
/* else fall through */
case WM_CLOSE:
case WM_SETFOCUS:
case WM_KILLFOCUS:
case WM_DESTROYCLIPBOARD:
case WM_UNICHAR:
case WM_CHAR:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
case WM_KEYDOWN:
case WM_KEYUP:
case WM_MOUSEWHEEL:
GenerateXEvent(hwnd, message, wParam, lParam);
@@ -1147,7 +1158,8 @@ GenerateXEvent(
event.type = KeyPress;
event.xany.send_event = -1;
event.xkey.keycode = wParam;
GetTranslatedKey(&event.xkey);
GetTranslatedKey(&event.xkey, (message == WM_KEYDOWN) ? WM_CHAR :
WM_SYSCHAR);
break;
case WM_SYSKEYUP:
@@ -1197,17 +1209,35 @@ GenerateXEvent(
event.type = KeyPress;
event.xany.send_event = -1;
event.xkey.keycode = 0;
event.xkey.nbytes = 1;
event.xkey.trans_chars[0] = (char) wParam;
if ((int)wParam & 0xff00) {
int ch1 = wParam & 0xffff;
if (IsDBCSLeadByte((BYTE) wParam)) {
MSG msg;
if ((ch1 & 0xfc00) == 0xd800) {
tsdPtr->surrogateBuffer = ch1;
return;
}
if ((ch1 & 0xfc00) == 0xdc00) {
ch1 = ((tsdPtr->surrogateBuffer & 0x3ff) << 10) |
(ch1 & 0x3ff) | 0x10000;
tsdPtr->surrogateBuffer = 0;
}
event.xany.send_event = -3;
event.xkey.nbytes = 0;
event.xkey.keycode = ch1;
} else {
event.xkey.nbytes = 1;
event.xkey.trans_chars[0] = (char) wParam;
if ((PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
GetMessage(&msg, NULL, 0, 0);
event.xkey.nbytes = 2;
event.xkey.trans_chars[1] = (char) msg.wParam;
if (IsDBCSLeadByte((BYTE) wParam)) {
MSG msg;
if ((PeekMessage(&msg, NULL, WM_CHAR, WM_CHAR,
PM_NOREMOVE) != 0)
&& (msg.message == WM_CHAR)) {
GetMessage(&msg, NULL, WM_CHAR, WM_CHAR);
event.xkey.nbytes = 2;
event.xkey.trans_chars[1] = (char) msg.wParam;
}
}
}
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
@@ -1215,15 +1245,10 @@ GenerateXEvent(
break;
case WM_UNICHAR: {
char buffer[TCL_UTF_MAX+1];
int i;
event.type = KeyPress;
event.xany.send_event = -3;
event.xkey.keycode = wParam;
event.xkey.nbytes = Tcl_UniCharToUtf((int)wParam, buffer);
for (i=0; i<event.xkey.nbytes && i<TCL_UTF_MAX; ++i) {
event.xkey.trans_chars[i] = buffer[i];
}
event.xkey.nbytes = 0;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);
event.type = KeyRelease;
break;
@@ -1321,11 +1346,7 @@ GetState(
state &= ~mask;
}
if (HIWORD(lParam) & KF_EXTENDED) {
if (message == WM_SYSKEYDOWN || message == WM_KEYDOWN) {
state |= EXTENDED_MASK;
} else {
state &= ~EXTENDED_MASK;
}
state |= EXTENDED_MASK;
}
}
return state;
@@ -1352,19 +1373,20 @@ GetState(
static void
GetTranslatedKey(
XKeyEvent *xkey)
XKeyEvent *xkey,
UINT type)
{
MSG msg;
xkey->nbytes = 0;
while ((xkey->nbytes < XMaxTransChars)
&& PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) {
if ((msg.message != WM_CHAR) && (msg.message != WM_SYSCHAR)) {
&& (PeekMessageA(&msg, NULL, type, type, PM_NOREMOVE) != 0)) {
if (msg.message != type) {
break;
}
GetMessageA(&msg, NULL, 0, 0);
GetMessageA(&msg, NULL, type, type);
/*
* If this is a normal character message, we may need to strip off the
@@ -1505,7 +1527,7 @@ TkWinGetUnicodeEncoding(void)
*
* HandleIMEComposition --
*
* This function works around a definciency in some versions of Windows
* This function works around a deficiency in some versions of Windows
* 2000 to make it possible to entry multi-lingual characters under all
* versions of Windows 2000.
*
@@ -1535,6 +1557,7 @@ HandleIMEComposition(
{
HIMC hIMC;
int n;
int high = 0;
if ((lParam & GCS_RESULTSTR) == 0) {
/*
@@ -1552,18 +1575,18 @@ HandleIMEComposition(
n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, NULL, 0);
if (n > 0) {
char *buff = ckalloc(n);
WCHAR *buff = (WCHAR *) ckalloc(n);
TkWindow *winPtr;
XEvent event;
int i;
n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n);
n = ImmGetCompositionString(hIMC, GCS_RESULTSTR, buff, (unsigned) n) / 2;
/*
* Set up the fields pertinent to key event.
*
* We set send_event to the special value of -2, so that TkpGetString
* in tkWinKey.c knows that trans_chars[] already contains a UNICODE
* We set send_event to the special value of -3, so that TkpGetString
* in tkWinKey.c knows that keycode already contains a UNICODE
* char and there's no need to do encoding conversion.
*
* Note that the event *must* be zeroed out first; Tk plays cunning
@@ -1574,7 +1597,7 @@ HandleIMEComposition(
memset(&event, 0, sizeof(XEvent));
event.xkey.serial = winPtr->display->request++;
event.xkey.send_event = -2;
event.xkey.send_event = -3;
event.xkey.display = winPtr->display;
event.xkey.window = winPtr->window;
event.xkey.root = RootWindow(winPtr->display, winPtr->screenNum);
@@ -1582,8 +1605,6 @@ HandleIMEComposition(
event.xkey.state = TkWinGetModifierState();
event.xkey.time = TkpGetMS();
event.xkey.same_screen = True;
event.xkey.keycode = 0;
event.xkey.nbytes = 2;
for (i=0; i<n; ) {
/*
@@ -1591,9 +1612,16 @@ HandleIMEComposition(
* UNICODE character in the composition.
*/
event.xkey.trans_chars[0] = (char) buff[i++];
event.xkey.trans_chars[1] = (char) buff[i++];
event.xkey.keycode = buff[i++];
if ((event.xkey.keycode & 0xfc00) == 0xd800) {
high = ((event.xkey.keycode & 0x3ff) << 10) + 0x10000;
break;
} else if (high && (event.xkey.keycode & 0xfc00) == 0xdc00) {
event.xkey.keycode &= 0x3ff;
event.xkey.keycode += high;
high = 0;
}
event.type = KeyPress;
Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL);

View File

@@ -122,12 +122,15 @@ WndProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
case WM_THEMECHANGED:
/*
* Reset the application theme to 'xpnative' if present,
* which will in turn fall back to 'winnative' if XP theming
* is disabled.
* Reset the application theme.
* On windows, it is possible to sign in as a second user, change
* the theme to 'winnative' (by setting the ui to 'best performance'),
* which is a machine-wide change, and then sign back on to the original user.
* Ttk_UseTheme needs to be executed again in order to process the fallback
* from vista/xpnative to winnative.
*/
theme = Ttk_GetTheme(interp, "xpnative");
theme = Ttk_GetCurrentTheme(interp);
if (theme) {
Ttk_UseTheme(interp, theme);
/* @@@ What to do about errors here? */

View File

@@ -208,6 +208,8 @@ static Ttk_StateTable checkbox_statemap[] =
*/
static Ttk_StateTable radiobutton_statemap[] =
{
{RBS_UNCHECKEDDISABLED, TTK_STATE_ALTERNATE|TTK_STATE_DISABLED, 0},
{RBS_UNCHECKEDNORMAL, TTK_STATE_ALTERNATE, 0},
{RBS_CHECKEDDISABLED, TTK_STATE_SELECTED|TTK_STATE_DISABLED, 0},
{RBS_CHECKEDPRESSED, TTK_STATE_SELECTED|TTK_STATE_PRESSED, 0},
{RBS_CHECKEDHOT, TTK_STATE_SELECTED|TTK_STATE_ACTIVE, 0},