Import Tix 8.4.3.5 (as of svn r86089)

This commit is contained in:
Zachary Ware
2017-05-22 16:16:49 -05:00
parent d239d63057
commit 80ba28babb
769 changed files with 136423 additions and 0 deletions

130
win/README.txt Normal file
View File

@@ -0,0 +1,130 @@
RCS $Id: README.txt,v 1.7 2004/10/02 01:25:52 hobbs Exp $
--- Build Tix binaries for the Win32 platform ---
Before you start
================
If you are not familiar with Windows or do not have a working
win32 compiler, you can download a Tix windows binary from
http://tix.sourceforge.net/
This site also has more information in case you get stuck, such as
who to contact for questions.
Required Tcl/Tk versions
========================
You need Tcl/Tk 8.2 or later. Prior versions are no longer
supported. Tcl 8.4 is the recommended version.
Supported Compilers
===================
* MSVC++ 6: use makefile.vc
* cygwin + mingw/gcc | MSVC: use ../configure
If you don't want to pay for the VC++ compiler, you can get Cygwin
from http://www.cygwin.com/. mingw/gcc is the recommended Windows
gcc variant.
No other compilers are currently supported.
Please post your patches to http://tix.sourceforge.net.
Customizing your build
======================
The recommended method of customizing your build is to create a file
called "Makefile" in this directory. Set the MAKE variables that you
want to modify. Then, include the makefile.vc.
You can look at the top of the makefile for the variables that you can
modify.
For example, if you use VC++, and you want to change the version
of Tcl/Tk to build with, create a Makefile like this:
------------------------------------------------------------------
# My own makefile ...
TCL_MAJOR = 8
TCL_MINOR = 4
TCL_PATCH = 7
!include "makefile.vc"
------------------------------------------------------------------
The advantage of this method is you can reuse your customization
Makefile across different Tix source releases without doing the
same modifications again and again.
Building the binaries
=====================
+ First, you need to download the Tcl/Tk sources and install them to
along with Tix inside the same directory. You can download Tcl/Tk from
http://www.tcl.tk/
+ If you use VC++: build both Tcl and Tk using the win/makefile.vc
files that come with Tcl and Tk.
+ If you use Cygwin, download the Tcl binary distribution of the
same version as the Tcl/Tk sources from
http://www.tcl.tk/ and install it on your PC.
+ Create the customization Makefile for Tix as mentioned above.
+ Execute your favorite MAKE program in this directory.
E.g., if you use VC++:
cd win
nmake
If you use Cygwin:
cd win
make
This should produce various .DLL and .EXE files in the Release or
Debug subdirectories.
Testing your build
==================
Run the following command in this directory to run the Tix
regression test suite.
nmake test -- with VC++, or
make test -- with Cygwin
Run the following command in this directory to run the Tix
widget demos.
nmake rundemos -- with VC++, or
make rundemos -- with Cygwin
Installing Tix
==============
The makefiles in this directory has a crude method of installing
Tix on your local machine. E.g.,
nmake install
The default installation directory is C:\Tcl. You can customize this
location by setting the INSTALL_DIR variable in your customization
Makefile.
Nevertheless, if you're planning a wide distribution of Tix across
many PC's, you probably need to create an installer program or use
more advanced administrator tools.
Using Tix in your Tcl scripts
=============================
Once Tix is installed properly on your machine, simple execute the
"package require Tix" command in your Tcl scripts to access the
Tix features.
See the file ../demos/widget for examples.

38
win/example.vc6 Normal file
View File

@@ -0,0 +1,38 @@
# Where the Tcl and Tk. They must be in the same directory
# If you want to run "nmake tests", this *must* be an absolute filename.
SRC_ROOT = ..\..
# Set the TCL version. The TK version are assumed to be equal. The default
# is 8.4.7.
TCL_MAJOR = 8
TCL_MINOR = 4
TCL_PATCH = 7
# Uncomment the following if you had compiled Tcl with debugging symbols
#TCL_DBGX = d
# Uncomment the following if you had compiled Tk with debugging symbols
#TK_DBGX = d
# Comment this out if you don't want to compile with stubs
USESTUBS = 1
# Comment this out if you want to compile with debugging symbols
NODEBUG = 1
# Where to install Tix. By default it installs at the default Tcl
# installation directory C:\Tcl
INSTALL_DIR = C:\Progra~1\Tcl
# TOOLS32 = location of VC++ 32-bit development tools.
# TOOLS32_rc = location of VC++ rc program
#
# Visual C++ 6.0
#
TOOLS32 = c:\Program Files\Microsoft Visual Studio\VC98
TOOLS32_rc = c:\Program Files\Microsoft Visual Studio\Common\MSDev98
!include "makefile.vc"

26
win/make_pkgIndex.tcl Normal file
View File

@@ -0,0 +1,26 @@
# make_pkgIndex.tcl
#
# Creates a pkgIndex.tcl file for in the Windows installation
# directory
#
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# $Id: make_pkgIndex.tcl,v 1.4 2008/03/17 23:08:12 hobbs Exp $
if {[llength $argv] != 3} {
puts "usage: $argv0 <pkgIndex.tcl> <tix dll name> <tix version>"
exit -1
}
set fd [open [lindex $argv 0] {WRONLY TRUNC CREAT}]
puts -nonewline $fd "package ifneeded Tix [lindex $argv 2] "
puts -nonewline $fd "\[list load \[file join \$dir "
puts -nonewline $fd "[file tail [lindex $argv 1]]\] Tix\]"
puts $fd ""
puts -nonewline $fd "package ifneeded wm_default 1.0 "
puts -nonewline $fd "\[list source \[file join \$dir pref WmDefault.tcl\]\]"
puts $fd ""
close $fd

437
win/makefile.vc Normal file
View File

@@ -0,0 +1,437 @@
# -*- mode: makefile; fill-column: 75; tab-width: 8; coding: iso-latin-1-dos -*-
# $Id: makefile.vc,v 1.22 2008/03/17 23:16:01 hobbs Exp $
#
#----------------------------------------------------------------------
# makefile.vc --
#
# Visual C++ 6.0 makefile for Tix.
#
# This makefile builds the Tix DLL and EXE files. You can also
# use this makefile to install Tix in your local machine (see
# common.mak) for details.
#
# This makefile requires Tcl/Tk versions 8.2 or later.
#
# Copyright (c) 1993-1999 Ioi Kim Lam.
# Copyright (c) 2000-2001 Tix Project Group.
#
# See the file "license.terms" for information on usage and
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#----------------------------------------------------------------------
#
# XXX makefile.vc no longer maintained - it *may* work ... or not
# XXX use the toplevel configure/make with msys or cygwin on Windows
#
######################################################################
# Customization section:
#
# Normally you shouldn't modify this file directory to customize
# the make procedure. See README.txt in this directory for a better
# way.
#
######################################################################
# Where the Tcl and Tk. They must be in the same directory
!IFNDEF SRC_ROOT
SRC_ROOT = ..\..
!ENDIF
# Set the TCL version. The TK version are assumed to be equal. The default
# is 8.3.3.
!IFNDEF TCL_MAJOR
TCL_MAJOR = 8
!ENDIF
!IFNDEF TCL_MINOR
TCL_MINOR = 6
!ENDIF
!IFNDEF TCL_PATCH
TCL_PATCH = 1
!ENDIF
TK_MAJOR = $(TCL_MAJOR)
TK_MINOR = $(TCL_MINOR)
TK_PATCH = $(TCL_PATCH)
# Uncomment the following if you had compiled Tcl with debugging symbols
!IFNDEF TCL_DBGX
#TCL_DBGX = d
!ENDIF
# Uncomment the following if you had compiled Tk with debugging symbols
!IFNDEF TK_DBGX
#TK_DBGX = d
!ENDIF
# TOOLS32 = location of VC++ 32-bit development tools.
# TOOLS32_rc = location of VC++ rc program
!IFNDEF TOOLS32
#
# Visual C++ 6.0
#
TOOLS32 = c:\Program Files\Microsoft Visual Studio\VC98
TOOLS32_rc = c:\Program Files\Microsoft Visual Studio\Common\MSDev98
!ENDIF
# Set this to the appropriate value of /MACHINE: for your platform
!IFNDEF MACHINE
MACHINE = IX86
!ENDIF
# Comment this out if you don't want to compile with stubs
!IFNDEF USESTUBS
USESTUBS = 1
!ENDIF
# Comment this out if you want to compile with debugging symbols
!IFNDEF NODEBUG
NODEBUG = 1
!ENDIF
# Where to install Tix. By default it installs at the default Tcl
# installation directory C:\Tcl
!IFNDEF INSTALLDIR
INSTALLDIR = C:\Tcl
!ENDIF
######################################################################
# Do not modify below this line
######################################################################
default: all
######################################################################
# Development tool specific definitions
######################################################################
#
# Build tools
#
cc32 = cl.exe
link32 = link.exe
include32 = -I"$(TOOLS32)\include"
RMDIR = rd
MKDIR = md
RM = del
#
# Link flags
#
!IF "$(NODEBUG)" == "1"
ldebug = /RELEASE
!ELSE
ldebug = -debug -debugtype:cv
!ENDIF
# declarations common to all linker options
lcommon = /RELEASE /NOLOGO
# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(MACHINE)" == "IX86"
lflags = $(lcommon) /MACHINE:$(MACHINE)
!ELSE
lflags = $(lcommon) /MACHINE:$(MACHINE)
!ENDIF
dlllflags = $(lflags) -dll
baselibs = kernel32.lib $(optlibs) advapi32.lib user32.lib
winlibs = $(baselibs) gdi32.lib comdlg32.lib
#
# Compile flags
#
# makefile.vc in Tk claims -O2 is buggy and so uses -Ot, so we do the same)
!IF "$(NODEBUG)" == "1"
optflags = -Oti -Gs
!ELSE
optflags = -Od -Zi
!ENDIF
cvarsdll = -DWIN32 -D_WIN32 -D_MT -D_DLL -DSTDC_HEADERS
cflagsdll = $(cvarsdll) -c -W3 -nologo -Fp$(TMPDIR)\ -MD \
$(optflags)
######################################################################
# Project specific definitions
######################################################################
TIX_MAJOR = 8
TIX_MINOR = 4
TIX_PATCH = 3
ROOT = ..
WINDIR = $(ROOT)\win
GENERICDIR = $(ROOT)\generic
DOTVERSION = $(TIX_MAJOR).$(TIX_MINOR).$(TIX_PATCH)
#
# Choose to build with stubs or not
#
!IF ("$(TCL_MAJOR)" == "8") && ("$(TCL_MINOR)" == "0")
#
# Tcl 8.0 does not support stubs
#
STUBS_CFLAGS =
DLLDEPENDS = $(TK_LIB) $(TCL_LIB)
!ELSE
#
# Tcl 8.1 or later support stubs
#
!IF "$(USESTUBS)" == "1"
STUBS_CFLAGS = -DUSE_TCL_STUBS=1 -DUSE_TK_STUBS=1
DLLDEPENDS = $(TK_STUBLIB) $(TCL_STUBLIB)
!ELSE
STUBS_CFLAGS =
DLLDEPENDS = $(TK_LIB) $(TCL_LIB)
!ENDIF
!ENDIF
#
# Debugging options and where to output .obj and .dll files
#
!IF "$(NODEBUG)" == "1"
DBGX =
!ELSE
DBGX = g
!ENDIF
TMPDIR = $(BUILDDIRTOP)
#
# File and dir names for Tcl
#
TCL_TMPDIR = $(BUILDDIRTOP)
!IF "$(TCL_PATCH)" == ""
TCL_DIR = $(SRC_ROOT)\tcl$(TCL_MAJOR).$(TCL_MINOR)
TK_DIR = $(SRC_ROOT)\tk$(TCL_MAJOR).$(TCL_MINOR)
!ELSE
TCL_DIR = $(SRC_ROOT)\tcl$(TCL_MAJOR).$(TCL_MINOR).$(TCL_PATCH)
TK_DIR = $(SRC_ROOT)\tk$(TCL_MAJOR).$(TCL_MINOR)
!ENDIF
TCL_LIBDIR = $(TCL_DIR)\win\$(TCL_TMPDIR)
TCL_LIB = $(TCL_LIBDIR)\tcl$(TCL_MAJOR)$(TCL_MINOR)$(TCL_DBGX).lib
TCL_DLL = $(TCL_LIBDIR)\tcl$(TCL_MAJOR)$(TCL_MINOR)$(TCL_DBGX).dll
TCL_STUBLIB = $(TCL_LIBDIR)\tclstub$(TCL_MAJOR)$(TCL_MINOR).lib
TCLSH_EXE = $(TCL_LIBDIR)\tclsh$(TCL_MAJOR)$(TCL_MINOR)$(TCL_DBGX).exe
TK_LIBDIR = $(TK_DIR)\win\$(TK_TMPDIR)
TK_LIB = $(TK_LIBDIR)\tk$(TCL_MAJOR)$(TCL_MINOR)$(TCL_DBGX).lib
TK_DLL = $(TK_LIBDIR)\tk$(TCL_MAJOR)$(TCL_MINOR)$(TCL_DBGX).dll
#
# File and dir names for Tk
#
TK_TMPDIR = $(BUILDDIRTOP)
!IF "$(TK_PATCH)" == ""
TK_DIR = $(SRC_ROOT)\tk$(TK_MAJOR).$(TK_MINOR)
!ELSE
TK_DIR = $(SRC_ROOT)\tk$(TK_MAJOR).$(TK_MINOR).$(TK_PATCH)
!ENDIF
TK_LIBDIR = $(TK_DIR)\win\$(TK_TMPDIR)
TK_LIB = $(TK_LIBDIR)\tk$(TK_MAJOR)$(TK_MINOR)$(TK_DBGX).lib
TK_STUBLIB = $(TK_LIBDIR)\tkstub$(TK_MAJOR)$(TK_MINOR).lib
#
# File and dir names for Tix
#
TIX_LIB = $(TMPDIR)\tix$(TIX_MAJOR)$(TIX_MINOR)$(DBGX).lib
TIX_DLL = $(TMPDIR)\tix$(TIX_MAJOR)$(TIX_MINOR)$(DBGX).dll
TIX_PKGIDX = $(TMPDIR)\pkgIndex.tcl.src
TIX_DEFINES = -D__WIN32__
TIX_INCLUDES = $(include32) \
-I$(ROOT)\win -I$(ROOT)\generic \
-I$(TK_DIR)\generic -I$(TK_DIR)\win -I$(TK_DIR)\xlib \
-I$(TCL_DIR)\generic -I$(TCL_DIR)\win
TIX_CFLAGS = $(cflagsdll) $(TIX_INCLUDES) $(TIX_DEFINES)
######################################################################
# Project specific targets
######################################################################
all: $(TMPDIR) $(TIX_DLL) $(TIX_PKGIDX)
$(TMPDIR):
-$(MKDIR) $@
#
# Object files
#
TIX_DLL_OBJS = \
$(TMPDIR)\tixClass.obj \
$(TMPDIR)\tixCmds.obj \
$(TMPDIR)\tixCompat.obj \
$(TMPDIR)\tixDiImg.obj \
$(TMPDIR)\tixDiITxt.obj \
$(TMPDIR)\tixDiStyle.obj \
$(TMPDIR)\tixDItem.obj \
$(TMPDIR)\tixDiText.obj \
$(TMPDIR)\tixDiWin.obj \
$(TMPDIR)\tixError.obj \
$(TMPDIR)\tixForm.obj \
$(TMPDIR)\tixFormMisc.obj \
$(TMPDIR)\tixGeometry.obj \
$(TMPDIR)\tixGrid.obj \
$(TMPDIR)\tixGrData.obj \
$(TMPDIR)\tixGrRC.obj \
$(TMPDIR)\tixGrFmt.obj \
$(TMPDIR)\tixGrSel.obj \
$(TMPDIR)\tixGrUtl.obj \
$(TMPDIR)\tixHLCol.obj \
$(TMPDIR)\tixHLHdr.obj \
$(TMPDIR)\tixHLInd.obj \
$(TMPDIR)\tixHList.obj \
$(TMPDIR)\tixImgCmp.obj \
$(TMPDIR)\tixImgXpm.obj \
$(TMPDIR)\tixInit.obj \
$(TMPDIR)\tixList.obj \
$(TMPDIR)\tixMethod.obj \
$(TMPDIR)\tixNBFrame.obj \
$(TMPDIR)\tixOption.obj \
$(TMPDIR)\tixSmpLs.obj \
$(TMPDIR)\tixScroll.obj \
$(TMPDIR)\tixTList.obj \
$(TMPDIR)\tixUtils.obj \
$(TMPDIR)\tixWCmpt.obj \
$(TMPDIR)\tixWidget.obj \
$(TMPDIR)\tixWinDraw.obj \
$(TMPDIR)\tixWinXpm.obj \
$(TMPDIR)\tixWinWm.obj
#
# .EXE and .DLL files
#
# (ToDo) $(TIX_DLL) doesn't have resources to define its icon, etc.
#
$(TIX_DLL): $(TIX_DLL_OBJS)
$(link32) $(ldebug) $(dlllflags) $(DLLDEPENDS) $(winlibs) \
-out:$@ @<<
$(TIX_DLL_OBJS)
<<
$(_VC_MANIFEST_EMBED_DLL)
$(TIX_PKGIDX): make_pkgIndex.tcl makefile.vc
set TCL_LIBRARY=$(TCL_DIR)\library
$(TCLSH_EXE) make_pkgIndex.tcl $@ $(TIX_DLL) $(DOTVERSION)
#
# Implicit rules
#
{$(GENERICDIR)}.c{$(TMPDIR)}.obj:
$(cc32) $(TIX_CFLAGS) $(STUBS_CFLAGS) -DBUILD_tix -Fo$@ $<
{$(WINDIR)}.c{$(TMPDIR)}.obj:
$(cc32) $(TIX_CFLAGS) $(STUBS_CFLAGS) -DBUILD_tix -Fo$@ $<
######################################################################
# Test:
######################################################################
oldtest:
set TCL_LIBRARY=$(TCL_DIR)\library
set TK_LIBRARY=$(TK_DIR)\library
@echo "===================================================="
@echo "running old-style tests"
@echo "===================================================="
$(TCLSH_EXE) ../tests/Driver.tcl
newtest:
set TCL_LIBRARY=$(TCL_DIR)\library
set TK_LIBRARY=$(TK_DIR)\library
@echo "===================================================="
@echo "running new-style tests"
@echo "===================================================="
set TIX_LIBRARY=$(ROOT)\library
$(TCLSH_EXE) ..\tests\all.tcl
copydlls::
copy /y $(TCL_DLL) $(TMPDIR)
copy /y $(TK_DLL) $(TMPDIR)
test: copydlls newtest
tests: copydlls newtest
rundemos:
set TCL_LIBRARY=$(TCL_DIR)\library
set TK_LIBRARY=$(TK_DIR)\library
set TIX_LIBRARY=$(ROOT)\library
$(WISH) ..\demos\widget
######################################################################
# Clean up
######################################################################
clean:
-del $(TIX_LIB)
-del $(TIX_DLL)
-del $(TIX_PKGIDX)
-del $(TMPDIR)\*.obj
-del $(TMPDIR)\*.exp
-del $(TMPDIR)\*.res
-del $(TMPDIR)\*.def
-del $(TMPDIR)\*.pch
-del $(TMPDIR)\*.pdb
-del $(TMPDIR)\*.lib
-del *.pdb
######################################################################
# Install
######################################################################
LIB_INSTALL_DIR = $(INSTALL_DIR)\lib\tix$(DOTVERSION)
INCLUDE_INSTALL_DIR = $(INSTALL_DIR)\include
install: all
-@$(MKDIR) "$(LIB_INSTALL_DIR)"
@echo installing $(TIX_DLL)
@copy "$(TIX_DLL)" "$(LIB_INSTALL_DIR)"
@echo installing $(TIX_LIB)
@copy "$(TIX_LIB)" "$(LIB_INSTALL_DIR)"
@echo installing library files
-@$(MKDIR) "$(LIB_INSTALL_DIR)"
-@$(MKDIR) "$(LIB_INSTALL_DIR)\pref"
-@$(MKDIR) "$(LIB_INSTALL_DIR)\bitmaps"
-@$(MKDIR) "$(LIB_INSTALL_DIR)\demos"
-@$(MKDIR) "$(LIB_INSTALL_DIR)\demos\bitmaps"
-@$(MKDIR) "$(LIB_INSTALL_DIR)\demos\samples"
xcopy /y "$(ROOT)\library" "$(LIB_INSTALL_DIR)"
copy /y "$(TIX_PKGIDX)" "$(LIB_INSTALL_DIR)\pkgIndex.tcl"
xcopy /y "$(ROOT)\library\pref" "$(LIB_INSTALL_DIR)\pref"
xcopy /y "$(ROOT)\library\bitmaps" "$(LIB_INSTALL_DIR)\bitmaps"
xcopy /y "$(ROOT)\demos" "$(LIB_INSTALL_DIR)\demos"
xcopy /y "$(ROOT)\demos\samples" "$(LIB_INSTALL_DIR)\demos\samples"
xcopy /y "$(ROOT)\demos\bitmaps" "$(LIB_INSTALL_DIR)\demos\bitmaps"

50
win/python.mak Normal file
View File

@@ -0,0 +1,50 @@
# Most of it was copied from tcl's rule.vc
TOOLS32 = $(VCINSTALLDIR)
!if $(DEBUG)
BUILDDIRTOP = Debug
NODEBUG = 0
TCL_DBGX = g
!else
BUILDDIRTOP = Release
NODEBUG = 1
!endif
VCVER=0
!if ![echo VCVERSION=_MSC_VER > vercl.x] \
&& ![cl -nologo -TC -P vercl.x $(ERRNULL)]
!include vercl.i
!if $(VCVERSION) >= 1600
VCVER=10
!elseif $(VCVERSION) >= 1500
VCVER=9
!elseif $(VCVERSION) >= 1400
VCVER=8
!elseif $(VCVERSION) >= 1300
VCVER=7
!elseif $(VCVERSION) >= 1200
VCVER=6
!endif
!endif
!if "$(MACHINE)" != "IX86"
BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
!endif
!if $(VCVER) > 6
BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
!endif
TCL_MAJOR=8
TCL_MINOR=5
TCL_PATCH=15
# Since MSVC8 we must deal with manifest resources.
_VC_MANIFEST_EMBED_EXE=
_VC_MANIFEST_EMBED_DLL=
!if $(VCVERSION) >= 1400
_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
!endif
!include makefile.vc

39
win/tixWCmpt.c Normal file
View File

@@ -0,0 +1,39 @@
/* $Id: tixWCmpt.c,v 1.3 2004/03/28 02:44:57 hobbs Exp $ */
/*
* tixWCmpt.c --
*
* Windows compatibility module: implements missing functions in Windows.
*/
#include <tixPort.h>
#include <tixInt.h>
/*
*----------------------------------------------------------------------
*
* DllEntryPoint --
*
* This wrapper function is used by Windows to invoke the
* initialization code for the DLL. If we are compiling
* with Visual C++, this routine will be renamed to DllMain.
* routine.
*
* Results:
* Returns TRUE;
*
* Side effects:
* None.
*
*----------------------------------------------------------------------
*/
BOOL APIENTRY
DllEntryPoint(hInst, reason, reserved)
HINSTANCE hInst; /* Library instance handle. */
DWORD reason; /* Reason this function is being called. */
LPVOID reserved; /* Not used. */
{
return TRUE;
}

243
win/tixWinDefault.h Normal file
View File

@@ -0,0 +1,243 @@
/*
* tixWinDefault.h --
*
* This file defines the defaults for all options for all of
* the Tix widgets.
*
* Copyright (c) 2000 Tix Project Group.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* $Id: tixWinDefault.h,v 1.3 2000/12/24 06:48:27 ioilam Exp $
*/
#ifndef TIX_WIN_DEFAULT
#define TIX_WIN_DEFAULT
#define CTL_BOLD_FONT "{MS Sans Serif} 8 bold"
#define TIX_EDITOR_BG "SystemWindow"
#define TIX_BORDER_WIDTH "2"
#define TIX_HIGHLIGHT_THICKNESS "0"
/*
* Compound image
*/
#define DEF_CMPIMAGE_BG_COLOR NORMAL_BG
#define DEF_CMPIMAGE_BG_MONO WHITE
#define DEF_CMPIMAGE_FG_COLOR BLACK
#define DEF_CMPIMAGE_FG_MONO BLACK
#define DEF_CMPIMAGE_FONT CTL_FONT
/*
* tixHList widget
*/
#define DEF_HLIST_BG_COLOR TIX_EDITOR_BG
#define DEF_HLIST_BG_MONO WHITE
#define DEF_HLIST_BORDER_WIDTH TIX_BORDER_WIDTH
#define DEF_HLIST_BROWSE_COMMAND ""
#define DEF_HLIST_COMMAND ""
#define DEF_HLIST_COLUMNS "1"
#define DEF_HLIST_CURSOR ""
#define DEF_HLIST_DISPLAY_MODE "tree"
#define DEF_HLIST_DRAG_COMMAND ""
#define DEF_HLIST_DRAW_BRANCH "true"
#define DEF_HLIST_DROP_COMMAND ""
#define DEF_HLIST_FONT CTL_FONT
#define DEF_HLIST_FG_COLOR BLACK
#define DEF_HLIST_FG_MONO BLACK
#define DEF_HLIST_HEADER "0"
#define DEF_HLIST_HEIGHT "10"
#define DEF_HLIST_HIGHLIGHT_COLOR BLACK
#define DEF_HLIST_HIGHLIGHT_MONO BLACK
#define DEF_HLIST_HIGHLIGHT_WIDTH TIX_HIGHLIGHT_THICKNESS
#define DEF_HLIST_RELIEF "sunken"
#define DEF_HLIST_ORIENT "vertical"
#define DEF_HLIST_PADX "2"
#define DEF_HLIST_PADY "2"
#define DEF_HLIST_GAP "5"
#define DEF_HLIST_INDENT "10"
#define DEF_HLIST_INDICATOR "0"
#define DEF_HLIST_INDICATOR_CMD ""
#define DEF_HLIST_ITEM_TYPE "text"
#define DEF_HLIST_SELECT_BG_COLOR SELECT_BG
#define DEF_HLIST_SELECT_FG_COLOR SELECT_FG
#define DEF_HLIST_SELECT_BG_MONO BLACK
#define DEF_HLIST_SELECT_FG_MONO WHITE
#define DEF_HLIST_SELECT_MODE "browse"
#define DEF_HLIST_SELECT_BORDERWIDTH "0"
#define DEF_HLIST_SEPARATOR "."
#define DEF_HLIST_SIZE_COMMAND ""
#define DEF_HLIST_TAKE_FOCUS "1"
#define DEF_HLIST_WIDTH "20"
#define DEF_HLIST_WIDE_SELECT "true"
#define DEF_HLIST_Y_SCROLL_COMMAND ""
#define DEF_HLIST_X_SCROLL_COMMAND ""
/*
* HList Entry
*/
#define DEF_HLISTENTRY_BITMAP ""
#define DEF_HLISTENTRY_DATA ""
#define DEF_HLISTENTRY_GAP "4"
#define DEF_HLISTENTRY_IMAGE ""
#define DEF_HLISTENTRY_JUSTIFY "left"
#define DEF_HLISTENTRY_NAME ""
#define DEF_HLISTENTRY_PADX "2"
#define DEF_HLISTENTRY_PADY "2"
#define DEF_HLISTENTRY_STATE "normal"
#define DEF_HLISTENTRY_TEXT ""
#define DEF_HLISTENTRY_UNDERLINE "-1"
#define DEF_HLISTENTRY_WIDGET ""
#define DEF_HLISTENTRY_WLENGTH "0"
/*
* HList Entry
*/
#define DEF_HLISTHEADER_BG_COLOR NORMAL_BG
#define DEF_HLISTHEADER_BG_MONO WHITE
#define DEF_HLISTHEADER_BORDER_WIDTH TIX_BORDER_WIDTH
#define DEF_HLISTHEADER_RELIEF "raised"
/*
* tixNBFrame widget
*/
#define DEF_NOTEBOOKFRAME_INACTIVE_BG_COLOR NORMAL_BG
#define DEF_NOTEBOOKFRAME_INACTIVE_BG_MONO WHITE
#define DEF_NOTEBOOKFRAME_BACKPAGE_COLOR NORMAL_BG
#define DEF_NOTEBOOKFRAME_BACKPAGE_MONO WHITE
#define DEF_NOTEBOOKFRAME_BG_COLOR NORMAL_BG
#define DEF_NOTEBOOKFRAME_BG_MONO WHITE
#define DEF_NOTEBOOKFRAME_DISABLED_FG_COLOR DISABLED
#define DEF_NOTEBOOKFRAME_DISABLED_FG_MONO ""
#define DEF_NOTEBOOKFRAME_FOCUS_COLOR BLACK
#define DEF_NOTEBOOKFRAME_FOCUS_MONO BLACK
#define DEF_NOTEBOOKFRAME_BORDER_WIDTH TIX_BORDER_WIDTH
#define DEF_NOTEBOOKFRAME_CURSOR ""
#define DEF_NOTEBOOKFRAME_FONT CTL_FONT
#define DEF_NOTEBOOKFRAME_FG_COLOR BLACK
#define DEF_NOTEBOOKFRAME_FG_MONO BLACK
#define DEF_NOTEBOOKFRAME_RELIEF "raised"
#define DEF_NOTEBOOKFRAME_SLAVE "1"
#define DEF_NOTEBOOKFRAME_TAKE_FOCUS "1"
#define DEF_NOTEBOOKFRAME_WIDTH "10"
#define DEF_NOTEBOOKFRAME_TABPADX "5"
#define DEF_NOTEBOOKFRAME_TABPADY "2"
/*
* tixTList.h
*/
#define DEF_TLIST_BG_COLOR TIX_EDITOR_BG
#define DEF_TLIST_BG_MONO WHITE
#define DEF_TLIST_BORDER_WIDTH TIX_BORDER_WIDTH
#define DEF_TLIST_BROWSE_COMMAND ""
#define DEF_TLIST_COMMAND ""
#define DEF_TLIST_CURSOR ""
#define DEF_TLIST_FONT CTL_FONT
#define DEF_TLIST_FG_COLOR BLACK
#define DEF_TLIST_FG_MONO BLACK
#define DEF_TLIST_HEIGHT "10"
#define DEF_TLIST_HIGHLIGHT_COLOR BLACK
#define DEF_TLIST_HIGHLIGHT_MONO BLACK
#define DEF_TLIST_HIGHLIGHT_WIDTH TIX_HIGHLIGHT_THICKNESS
#define DEF_TLIST_ITEM_TYPE "text"
#define DEF_TLIST_RELIEF "sunken"
#define DEF_TLIST_ORIENT "vertical"
#define DEF_TLIST_PADX "2"
#define DEF_TLIST_PADY "2"
#define DEF_TLIST_SELECT_BG_COLOR SELECT_BG
#define DEF_TLIST_SELECT_FG_COLOR SELECT_FG
#define DEF_TLIST_SELECT_BG_MONO BLACK
#define DEF_TLIST_SELECT_FG_MONO WHITE
#define DEF_TLIST_SELECT_MODE "browse"
#define DEF_TLIST_SELECT_BORDERWIDTH "0"
#define DEF_TLIST_STATE "normal"
#define DEF_TLIST_SIZE_COMMAND ""
#define DEF_TLIST_TAKE_FOCUS "1"
#define DEF_TLIST_WIDTH "20"
#define DEF_TLIST_Y_SCROLL_COMMAND ""
#define DEF_TLIST_X_SCROLL_COMMAND ""
/*
* Grid widget
*/
#define DEF_GRID_BG_COLOR NORMAL_BG
#define DEF_GRID_BG_MONO WHITE
#define DEF_GRID_BORDER_WIDTH TIX_BORDER_WIDTH
#define DEF_GRID_BROWSE_COMMAND ""
#define DEF_GRID_COMMAND ""
#define DEF_GRID_CURSOR ""
#define DEF_GRID_DEFAULT_WIDTH "40"
#define DEF_GRID_DEFAULT_HEIGHT "20"
#define DEF_GRID_EDITDONE_COMMAND ""
#define DEF_GRID_EDITNOTIFY_COMMAND ""
#define DEF_GRID_FLOATING_ROWS "0"
#define DEF_GRID_FLOATING_COLS "0"
#define DEF_GRID_FONT CTL_FONT
#define DEF_GRID_FG_COLOR BLACK
#define DEF_GRID_FG_MONO BLACK
#define DEF_GRID_FORMAT_COMMAND ""
#define DEF_GRID_HEIGHT "10"
#define DEF_GRID_HIGHLIGHT_COLOR BLACK
#define DEF_GRID_HIGHLIGHT_MONO BLACK
#define DEF_GRID_HIGHLIGHT_WIDTH TIX_HIGHLIGHT_THICKNESS
#define DEF_GRID_LEFT_MARGIN "1"
#define DEF_GRID_ITEM_TYPE "text"
#define DEF_GRID_RELIEF "sunken"
#define DEF_GRID_PADX "2"
#define DEF_GRID_PADY "2"
#define DEF_GRID_SELECT_BG_COLOR SELECT_BG
#define DEF_GRID_SELECT_FG_COLOR SELECT_FG
#define DEF_GRID_SELECT_BG_MONO BLACK
#define DEF_GRID_SELECT_FG_MONO WHITE
#define DEF_GRID_SELECT_MODE "single"
#define DEF_GRID_SELECT_UNIT "row"
#define DEF_GRID_SELECT_BORDERWIDTH "0"
#define DEF_GRID_STATE "normal"
#define DEF_GRID_SIZE_COMMAND ""
#define DEF_GRID_TAKE_FOCUS "1"
#define DEF_GRID_TOP_MARGIN "1"
#define DEF_GRID_WIDTH "4"
#define DEF_GRID_Y_SCROLL_COMMAND ""
#define DEF_GRID_X_SCROLL_COMMAND ""
/*----------------------------------------------------------------------
*
* default options for Text Display Items/Styles
*
*----------------------------------------------------------------------
*/
#define DEF_TEXTITEM_STYLE ""
#define DEF_TEXTITEM_TEXT ""
#define DEF_TEXTITEM_UNDERLINE "-1"
#define DEF_TEXTITEM_TYPE "text"
#define DEF_TEXTSTYLE_NORMAL_FG_COLOR NORMAL_FG
#define DEF_TEXTSTYLE_NORMAL_FG_MONO BLACK
#define DEF_TEXTSTYLE_NORMAL_BG_COLOR TIX_EDITOR_BG
#define DEF_TEXTSTYLE_NORMAL_BG_MONO WHITE
#define DEF_TEXTSTYLE_ACTIVE_FG_COLOR NORMAL_FG
#define DEF_TEXTSTYLE_ACTIVE_FG_MONO WHITE
#define DEF_TEXTSTYLE_ACTIVE_BG_COLOR ACTIVE_BG
#define DEF_TEXTSTYLE_ACTIVE_BG_MONO BLACK
#define DEF_TEXTSTYLE_SELECTED_FG_COLOR SELECT_FG
#define DEF_TEXTSTYLE_SELECTED_FG_MONO WHITE
#define DEF_TEXTSTYLE_SELECTED_BG_COLOR SELECT_BG
#define DEF_TEXTSTYLE_SELECTED_BG_MONO BLACK
#define DEF_TEXTSTYLE_DISABLED_FG_COLOR BLACK
#define DEF_TEXTSTYLE_DISABLED_FG_MONO BLACK
#define DEF_TEXTSTYLE_DISABLED_BG_COLOR TIX_EDITOR_BG
#define DEF_TEXTSTYLE_DISABLED_BG_MONO WHITE
#define DEF_TEXTSTYLE_PADX "2"
#define DEF_TEXTSTYLE_PADY "2"
#define DEF_TEXTSTYLE_FONT CTL_FONT
#define DEF_TEXTSTYLE_JUSTIFY "left"
#define DEF_TEXTSTYLE_WLENGTH "0"
#define DEF_TEXTSTYLE_ANCHOR "w"
#endif /* TIX_WIN_DEFAULT */

413
win/tixWinDraw.c Normal file
View File

@@ -0,0 +1,413 @@
/*
* tixWinDraw.c --
*
* Implement the Windows specific function calls for drawing.
*
* Copyright (c) 1993-1999 Ioi Kim Lam.
* Copyright (c) 2000 Tix Project Group.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* $Id: tixWinDraw.c,v 1.5 2004/03/28 02:44:57 hobbs Exp $
*/
#include <tkWinInt.h>
#include <tixInt.h>
#include <tixPort.h>
/*----------------------------------------------------------------------
*
* TixpDrawTmpLine --
*
* Draws a "temporarily" line on the desktop window with XOR
* drawing mode. This function is used by the PanedWindow and
* ResizeHandler to draw the rubberband lines. Calling the
* function again with the same parameters cancels the temporary
* lines without affecting what was originally on the screen.
*
* Results:
* None.
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
void
TixpDrawTmpLine(x1, y1, x2, y2, tkwin)
int x1;
int y1;
int x2;
int y2;
Tk_Window tkwin;
{
HWND desktop;
HDC hdc;
HPEN hpen;
HGDIOBJ old;
desktop = GetDesktopWindow();
hdc = GetWindowDC(desktop);
hpen = CreatePen(PS_SOLID, 0, RGB(255,255,255));
old = SelectObject(hdc, hpen);
SetROP2(hdc, R2_XORPEN);
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
SelectObject(hdc, old);
DeleteObject(hpen);
ReleaseDC(desktop, hdc);
}
/*
*----------------------------------------------------------------------
*
* TixpDrawAnchorLines --
*
* See comments near Tix_DrawAnchorLines in tixUtils.c.
*
* Results:
* None.
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
void
TixpDrawAnchorLines(display, drawable, gc, x, y, w, h)
Display *display;
Drawable drawable;
GC gc;
int x;
int y;
int w;
int h;
{
HDC hdc;
TkWinDCState state;
RECT rect;
if (w < 2 || h < 2) {
/*
* Area too small to show effect. Don't bother
*/
return;
}
hdc = TkWinGetDrawableDC(display, drawable, &state);
rect.left = x;
rect.top = y;
rect.right = x+w;
rect.bottom = y+h;
DrawFocusRect(hdc, &rect);
TkWinReleaseDrawableDC(drawable, hdc, &state);
}
/*
*----------------------------------------------------------------------
*
* TixpStartSubRegionDraw --
*
* This function is used by the Tix DItem code to implement
* clipped rendering -- if a DItem is larger than the region
* where the DItem is displayed (with the Tix_DItemDisplay
* function), we clip the DItem so that all the rendering
* happens inside the region.
*
* This Win32 implementation is tricky (which explains why the
* TixpSubRegDrawXXX API looks so arcane.) Tk does not support
* a portable API for setting the clip region of a GC. We could
* hack into Tk's Win32 implementation of GC to get the clipping
* to work, but that may run into future incompatibilities.
*
* For a clean and (almost) portable, albeit a bit slow,
* implemetation of clipping, we allocate a pixmap when clipping
* is required. All subsequent drawing goes into this
* pixmap. When TixpEndSubRegionDraw is called we then copy from
* the pixmap back to the destination drawable.
*
* Results:
* None.
*
* Side effects:
* A Tk pixmap may be created and saved into subRegPtr->pixmap in
* for the clipped drawing operations.
*
*----------------------------------------------------------------------
*/
void
TixpStartSubRegionDraw(display, drawable, gc, subRegPtr, origX, origY,
x, y, width, height, needWidth, needHeight)
Display *display;
Drawable drawable;
GC gc;
TixpSubRegion * subRegPtr;
int origX;
int origY;
int x;
int y;
int width;
int height;
int needWidth;
int needHeight;
{
TkWinDrawable * wdrPtr;
int depth;
if ((width < needWidth) || (height < needHeight)) {
subRegPtr->origX = origX;
subRegPtr->origY = origY;
subRegPtr->x = x;
subRegPtr->y = y;
subRegPtr->width = width;
subRegPtr->height = height;
/*
* Find out the depth of the drawable and create a pixmap of
* the same depth.
*/
wdrPtr = (TkWinDrawable *)drawable;
if (wdrPtr->type == TWD_BITMAP) {
depth = wdrPtr->bitmap.depth;
} else {
depth = wdrPtr->window.winPtr->depth;
}
subRegPtr->pixmap = Tk_GetPixmap(display, drawable, width, height,
depth);
if (subRegPtr->pixmap != None) {
/*
* It could be None if we have somehow exhausted the Windows
* GDI resources.
*/
XCopyArea(display, drawable, subRegPtr->pixmap, gc, x, y,
(unsigned) width, (unsigned) height, 0, 0);
}
} else {
subRegPtr->pixmap = None;
}
}
/*----------------------------------------------------------------------
* TixpEndSubRegionDraw --
*
*
*----------------------------------------------------------------------
*/
void
TixpEndSubRegionDraw(display, drawable, gc, subRegPtr)
Display *display;
Drawable drawable;
GC gc;
TixpSubRegion * subRegPtr;
{
if (subRegPtr->pixmap != None) {
XCopyArea(display, subRegPtr->pixmap, drawable, gc, 0, 0,
(unsigned) subRegPtr->width, (unsigned) subRegPtr->height,
subRegPtr->x, subRegPtr->y);
Tk_FreePixmap(display, subRegPtr->pixmap);
subRegPtr->pixmap = None;
}
}
void
TixpSubRegSetClip(display, subRegPtr, gc)
Display *display;
TixpSubRegion * subRegPtr;
GC gc;
{
/* Do nothing */
}
void
TixpSubRegUnsetClip(display, subRegPtr, gc)
Display *display;
TixpSubRegion * subRegPtr;
GC gc;
{
/* Do nothing */
}
/*
*----------------------------------------------------------------------
*
* TixpSubRegDisplayText --
*
* Display a text string on one or more lines in a sub region.
*
* Results:
* See TkDisplayText
*
* Side effects:
* See TkDisplayText
*
*----------------------------------------------------------------------
*/
void
TixpSubRegDisplayText(display, drawable, gc, subRegPtr, font, string,
numChars, x, y, length, justify, underline)
Display *display; /* X display to use for drawing text. */
Drawable drawable; /* Window or pixmap in which to draw the
* text. */
GC gc; /* Graphics context to use for drawing text. */
TixpSubRegion * subRegPtr; /* Information about the subregion */
TixFont font; /* Font that determines geometry of text
* (should be same as font in gc). */
CONST84 char *string; /* String to display; may contain embedded
* newlines. */
int numChars; /* Number of characters to use from string. */
int x, y; /* Pixel coordinates within drawable of
* upper left corner of display area. */
int length; /* Line length in pixels; used to compute
* word wrap points and also for
* justification. Must be > 0. */
Tk_Justify justify; /* How to justify lines. */
int underline; /* Index of character to underline, or < 0
* for no underlining. */
{
if (subRegPtr->pixmap != None) {
TixDisplayText(display, subRegPtr->pixmap, font, string,
numChars, x - subRegPtr->x, y - subRegPtr->y,
length, justify, underline, gc);
} else {
TixDisplayText(display, drawable, font, string,
numChars, x, y, length, justify, underline, gc);
}
}
/*----------------------------------------------------------------------
* TixpSubRegFillRectangle --
*
*
*----------------------------------------------------------------------
*/
void
TixpSubRegFillRectangle(display, drawable, gc, subRegPtr, x, y, width, height)
Display *display; /* X display to use for drawing rectangle. */
Drawable drawable; /* Window or pixmap in which to draw the
* rectangle. */
GC gc; /* Graphics context to use for drawing. */
TixpSubRegion * subRegPtr; /* Information about the subregion */
int x, y; /* Pixel coordinates within drawable of
* upper left corner of display area. */
int width, height; /* Size of the rectangle. */
{
if (subRegPtr->pixmap != None) {
XFillRectangle(display, subRegPtr->pixmap, gc,
x - subRegPtr->x, y - subRegPtr->y, width, height);
} else {
XFillRectangle(display, drawable, gc, x, y, width, height);
}
}
/*----------------------------------------------------------------------
* TixpSubRegDrawImage --
*
* Draws a Tk image in a subregion.
*----------------------------------------------------------------------
*/
void
TixpSubRegDrawImage(subRegPtr, image, imageX, imageY, width, height,
drawable, drawableX, drawableY)
TixpSubRegion * subRegPtr;
Tk_Image image;
int imageX;
int imageY;
int width;
int height;
Drawable drawable;
int drawableX;
int drawableY;
{
Drawable dest;
if (subRegPtr->pixmap != None) {
dest = subRegPtr->pixmap;
drawableX -= subRegPtr->x;
drawableY -= subRegPtr->y;
} else {
dest = drawable;
}
Tk_RedrawImage(image, imageX, imageY, width, height, dest,
drawableX, drawableY);
}
void
TixpSubRegDrawBitmap(display, drawable, gc, subRegPtr, bitmap, src_x, src_y,
width, height, dest_x, dest_y, plane)
Display *display;
Drawable drawable;
GC gc;
TixpSubRegion * subRegPtr;
Pixmap bitmap;
int src_x, src_y;
int width, height;
int dest_x, dest_y;
unsigned long plane;
{
XSetClipOrigin(display, gc, dest_x, dest_y);
if (subRegPtr->pixmap != None) {
XCopyPlane(display, bitmap, subRegPtr->pixmap, gc, src_x, src_y,
width, height, dest_x - subRegPtr->x, dest_y - subRegPtr->y,
plane);
} else {
XCopyPlane(display, bitmap, drawable, gc, src_x, src_y, width, height,
dest_x, dest_y, plane);
}
XSetClipOrigin(display, gc, 0, 0);
}
/*
*----------------------------------------------------------------------
*
* TixpSubRegDrawAnchorLines --
*
* Draw anchor lines inside the given sub region.
*
* Results:
* None.
*
* Side effects:
* None
*
*----------------------------------------------------------------------
*/
void
TixpSubRegDrawAnchorLines(display, drawable, gc, subRegPtr, x, y, w, h)
Display *display; /* Display to draw on. */
Drawable drawable; /* Drawable to draw on. */
GC gc; /* Use the foreground color of this GC. */
TixpSubRegion * subRegPtr; /* Describes the subregion. */
int x; /* x pos of top-left corner of anchor rect */
int y; /* y pos of top-left corner of anchor rect */
int w; /* width of anchor rect */
int h; /* height of anchor rect */
{
Drawable dest;
if (subRegPtr->pixmap != None) {
dest = subRegPtr->pixmap;
x -= subRegPtr->x;
y -= subRegPtr->y;
} else {
dest = drawable;
}
TixpDrawAnchorLines(display, dest, gc, x, y, w, h);
}

23
win/tixWinInt.h Normal file
View File

@@ -0,0 +1,23 @@
/* $Id: tixWinInt.h,v 1.1.1.1 2000/05/17 11:08:55 idiscovery Exp $ */
/*
* tixWinInt.h
*
* Internal header file for Tix on the Windows platform.
*
* Copyright (c) 1996, Expert Interface Technologies
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#ifndef _TIX_WIN_INT_H_
#define _TIX_WIN_INT_H_
#ifndef _TIX_INT_H_
#include "tixInt.h"
#endif
#endif /* _TIX_WIN_INT_H_ */

46
win/tixWinPort.h Normal file
View File

@@ -0,0 +1,46 @@
/* $Id: tixWinPort.h,v 1.3 2004/03/28 02:44:57 hobbs Exp $ */
/*
* tixWinPort.h --
*
* This header file handles porting issues that occur because of
* differences between systems. It reads in platform specific
* portability files.
*
* Copyright (c) 1996, Expert Interface Technologies
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#ifndef _TIX_WINPORT_H_
#define _TIX_WINPORT_H_
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/timeb.h>
#include <time.h>
#include <io.h>
#include <fcntl.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
struct _TixpSubRegion {
Pixmap pixmap;
int origX, origY;
int x, y;
int width, height;
};
typedef unsigned char UNSIGNED_CHAR;
#endif /* _TIX_WINPORT_H_ */

27
win/tixWinWm.c Normal file
View File

@@ -0,0 +1,27 @@
/* $Id: tixWinWm.c,v 1.1.1.1 2000/05/17 11:08:55 idiscovery Exp $ */
/*
* tixWinWm.c --
*
* Functions related to window management that are specific to
* the Windows platform
*
* Copyright (c) 1996, Expert Interface Technologies
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#include "tixWinInt.h"
int
TixpSetWindowParent(interp, tkwin, newParent, parentId)
Tcl_Interp * interp;
Tk_Window tkwin;
Tk_Window newParent;
int parentId;
{
return TCL_OK;
}

311
win/tixWinXpm.c Normal file
View File

@@ -0,0 +1,311 @@
/* $Id: tixWinXpm.c,v 1.2 2004/03/28 02:44:57 hobbs Exp $ */
/*
* tixWinImgXpm.c --
*
* Implement the Windows specific function calls for the pixmap
* image type.
*
* Copyright (c) 1996, Expert Interface Technologies
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
*/
#include <tkWinInt.h>
#include <tix.h>
#include <tixImgXpm.h>
typedef struct PixmapData {
HDC bitmapDC; /* Bitmap used on Windows platforms */
HDC maskDC; /* Mask used on Windows platforms */
HBITMAP bitmap, bitmapOld;
HBITMAP maskBm, maskBmOld;
} PixmapData;
static void CopyTransparent _ANSI_ARGS_((Display* display,
HDC srcDC, Drawable dest,
int src_x, int src_y, int width,
int height, int dest_x, int dest_y,
HDC maskDC));
/*----------------------------------------------------------------------
* TixpInitPixmapInstance --
*
* Initializes the platform-specific data of a pixmap instance
*
*----------------------------------------------------------------------
*/
void
TixpInitPixmapInstance(masterPtr, instancePtr)
PixmapMaster *masterPtr; /* Pointer to master for image. */
PixmapInstance *instancePtr;/* The pixmap instance. */
{
PixmapData * dataPtr;
dataPtr = (PixmapData *)ckalloc(sizeof(PixmapData));
dataPtr->maskDC = NULL;
dataPtr->bitmapDC = NULL;
instancePtr->clientData = (ClientData)dataPtr;
}
/*----------------------------------------------------------------------
* TixpXpmAllocTmpBuffer --
*
* Allocate a temporary space to draw the image.
*
*----------------------------------------------------------------------
*/
void
TixpXpmAllocTmpBuffer(masterPtr, instancePtr, imagePtr, maskPtr)
PixmapMaster * masterPtr;
PixmapInstance * instancePtr;
XImage ** imagePtr;
XImage ** maskPtr;
{
XImage * image = NULL; /* Unused. Always return NULL. */
XImage * mask;
Display *display = Tk_Display(instancePtr->tkwin);
int depth;
int maskSize;
int i;
int wordBits = sizeof(WORD)*8; /* # of bits in WORD */
int wordBytes = sizeof(WORD)/sizeof(char); /* # of bytes in WORD */
int words_per_line;
depth = Tk_Depth(instancePtr->tkwin);
instancePtr->pixmap = Tk_GetPixmap(display,
Tk_WindowId(instancePtr->tkwin),
masterPtr->size[0], masterPtr->size[1], depth);
mask = (XImage*)ckalloc(sizeof(XImage));
mask->width = masterPtr->size[0];
mask->height = masterPtr->size[1];
/*
* In Windows, each scan line in the the mask data must be aligned
* to words. The padding bits must be zero'ed.
*/
words_per_line = (mask->width + (wordBits-1))/wordBits;
mask->bytes_per_line = words_per_line * wordBytes;
maskSize = mask->bytes_per_line * mask->height;
mask->data = (char *)ckalloc(maskSize);
for (i=0; i<maskSize; i++) {
mask->data[i] = 0;
}
*imagePtr = image;
*maskPtr = mask;
}
void
TixpXpmFreeTmpBuffer(masterPtr, instancePtr, image, mask)
PixmapMaster * masterPtr;
PixmapInstance * instancePtr;
XImage * image;
XImage * mask;
{
if (image) {
ckfree((char*)image->data);
image->data = NULL;
XDestroyImage(image);
}
if (mask) {
ckfree((char*)mask->data);
mask->data = NULL;
ckfree((char*)mask);
}
}
/*----------------------------------------------------------------------
* TixpXpmSetPixel --
*
* Sets the pixel at the given (x,y) coordinate to be the given
* color.
*----------------------------------------------------------------------
*/
void
TixpXpmSetPixel(instancePtr, image, mask, x, y, colorPtr, isTranspPtr)
PixmapInstance * instancePtr;
XImage * image;
XImage * mask;
int x;
int y;
XColor * colorPtr;
int * isTranspPtr;
{
char * p;
int n;
GC gc;
XGCValues gcValues;
Display *display = Tk_Display(instancePtr->tkwin);
if (colorPtr != NULL) {
gcValues.foreground = colorPtr->pixel;
gc = Tk_GetGC(instancePtr->tkwin, GCForeground, &gcValues);
XDrawRectangle(display, instancePtr->pixmap, gc, x, y, 1, 1);
Tk_FreeGC(display, gc);
}
p = mask->data;
p+= y*(mask->bytes_per_line);
p+= x/8;
n = x%8;
if (colorPtr != NULL) {
*p |= (1 << (7-n));
} else {
*p &= ~(1 << (7-n));
*isTranspPtr = 1;
}
}
/*----------------------------------------------------------------------
* TixpXpmRealizePixmap --
*
* On Unix: Create the pixmap from the buffer.
* On Windows: Free the mask if there are no transparent pixels.
*----------------------------------------------------------------------
*/
void
TixpXpmRealizePixmap(masterPtr, instancePtr, image, mask, isTransp)
PixmapMaster * masterPtr;
PixmapInstance * instancePtr;
XImage * image;
XImage * mask;
{
Display *display = Tk_Display(instancePtr->tkwin);
PixmapData *dataPtr = (PixmapData*)instancePtr->clientData;
HDC dc, bitmapDC;
TkWinDCState dcState;
HBITMAP bitmap, bitmapOld;
int w, h;
w = masterPtr->size[0];
h = masterPtr->size[1];
dc = TkWinGetDrawableDC(display, instancePtr->pixmap, &dcState);
bitmapDC = CreateCompatibleDC(dc);
bitmap = CreateCompatibleBitmap(dc, w, h);
bitmapOld = SelectObject(bitmapDC, bitmap);
BitBlt(bitmapDC, 0, 0, w, h, dc, 0, 0, SRCCOPY);
if (isTransp) {
HDC maskDC;
HBITMAP maskBm, maskBmOld;
/*
* There are transparent pixels. We need a mask.
*/
maskDC = CreateCompatibleDC(dc);
maskBm = CreateBitmap(w, h, 1, 1, (CONST VOID*)mask->data);
maskBmOld = SelectObject(maskDC, maskBm);
BitBlt(bitmapDC, 0, 0, w, h, maskDC, 0, 0, SRCAND);
BitBlt(maskDC, 0, 0, w, h, maskDC, 0, 0, NOTSRCCOPY);
dataPtr->maskDC = maskDC;
dataPtr->maskBm = maskBm;
dataPtr->maskBmOld = maskBmOld;
} else {
dataPtr->maskDC = NULL;
}
dataPtr->bitmapDC = bitmapDC;
dataPtr->bitmap = bitmap;
dataPtr->bitmapOld = bitmapOld;
TkWinReleaseDrawableDC(instancePtr->pixmap, dc, &dcState);
}
void
TixpXpmFreeInstanceData(instancePtr, delete, display)
PixmapInstance *instancePtr; /* Pixmap instance. */
int delete; /* Should the instance data structure
* be deleted as well? */
Display * display; /* Unused on Windows. */
{
PixmapData *dataPtr = (PixmapData*)instancePtr->clientData;
if (dataPtr->maskDC != NULL) {
DeleteObject(SelectObject(dataPtr->maskDC,
dataPtr->maskBmOld));
DeleteDC(dataPtr->maskDC);
dataPtr->maskDC = NULL;
}
if (dataPtr->bitmapDC != NULL) {
DeleteObject(SelectObject(dataPtr->bitmapDC,
dataPtr->bitmapOld));
DeleteDC(dataPtr->bitmapDC);
dataPtr->bitmapDC = NULL;
}
if (delete) {
ckfree((char*)dataPtr);
instancePtr->clientData = NULL;
}
}
void
TixpXpmDisplay(clientData, display, drawable, imageX, imageY, width,
height, drawableX, drawableY)
ClientData clientData; /* Pointer to PixmapInstance structure for
* for instance to be displayed. */
Display *display; /* Display on which to draw image. */
Drawable drawable; /* Pixmap or window in which to draw image. */
int imageX, imageY; /* Upper-left corner of region within image
* to draw. */
int width, height; /* Dimensions of region within image to draw.*/
int drawableX, drawableY; /* Coordinates within drawable that
* correspond to imageX and imageY. */
{
PixmapInstance *instancePtr = (PixmapInstance *) clientData;
PixmapData *dataPtr = (PixmapData*)instancePtr->clientData;
CopyTransparent(display, dataPtr->bitmapDC, drawable,
imageX, imageY, width, height,
drawableX, drawableY, dataPtr->maskDC);
}
static void
CopyTransparent(display, srcDC, dest, src_x, src_y, width, height, dest_x,
dest_y, maskDC)
Display* display;
HDC srcDC;
Drawable dest;
int src_x;
int src_y;
int width;
int height;
int dest_x;
int dest_y;
HDC maskDC;
{
HDC destDC;
TkWinDCState destState;
destDC = TkWinGetDrawableDC(display, dest, &destState);
if (maskDC) {
BitBlt(destDC, dest_x, dest_y, width, height, maskDC, src_x, src_y,
SRCAND);
BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
SRCPAINT);
} else {
BitBlt(destDC, dest_x, dest_y, width, height, srcDC, src_x, src_y,
SRCCOPY);
}
TkWinReleaseDrawableDC(dest, destDC, &destState);
}