ADDED ChangeLog Index: ChangeLog ================================================================== --- /dev/null +++ ChangeLog @@ -0,0 +1,550 @@ +1999-04-09 + + * generic/tkWindow.c: Fixed deadlock situation when the Initialize() + function returns without releasing the mutex. Found while testing + Bug 1700, during safe.test (tk). + +1999-04-06 + + * generic/tkMain.c (Tk_MainEx): Changed to reset result before + calling Tcl_EvalFile. The ensures that error messages will be + generated cleanly. + + * tests/winfo.test: Enabled tests that previously failed. + +1999-04-05 + + * library/bgerror.tcl: + * library/button.tcl: + * library/clrpick.tcl: + * library/console.tcl: + * library/dialog.tcl: + * library/entry.tcl: + * library/focus.tcl: + * library/listbox.tcl: + * library/menu.tcl: + * library/msgbox.tcl: + * library/palette.tcl: + * library/scale.tcl: + * library/scrlbar.tcl: + * library/tearoff.tcl: + * library/text.tcl: + * library/tk.tcl: Lots of minor performance improvements + contributed by Jeffrey Hobbs. [Bug: 1118] + + * win/tkWinWm.c (Tk_WmCmd): Fixed bad code in tracing + suboption. [Bug: 1519] + + * library/tkfbox.tcl: Change to restore button text after an + action to avoid the sticky "Open" button in a save dialog. + [Bug: 1640] + + * library/entry.tcl: Fixed so selection is returned using the + -show character during cut and paste operations. [Bug: 1687] + +1999-04-5 + + * generic/tkInt.decls: + * generic/tkIntXlibDecls.h: + * generic/tkStubInit.c: + * xlib/xgc.c: + * xlib/X11/Xlib.h: + * xlib/X11/Xutil.h: Added more X functions to the Win & Mac stubs + tables. + +1999-04-05 + + * unix/configure.in: + * generic/tkCanvPs.c: Added configure test for pw_gecos field in + pwd to support OS/390. [Bug: 1724] + +1999-04-02 + + * tests/text.test: + * generic/tkText.c: Fixed handling of Unicode in text searches. + The -count option was returning byte counts instead of character + counts. [Bug: 1056, 1148, 1666] + +1999-04-01 + + * generic/tk.decls: + * generic/tk.h: + * generic/tkStubInit.c: + * generic/tkWindow.c: + * unix/Makefile.in: + * win/makefile.vc: Tk now uses its own stub library to store + pointers to its own stubs table. + + * doc/dde.n: (removed) + * doc/send.n: + * generic/tk.decls: + * tests/winSend.test: + * generic/tkPlatDecls.h: + * win/tkWinSend.c: Removed the DDE-based send and dde commands, + they were causing Tk to lock up when any window on the system was + not processing its message queue (more importantly, windows in Tcl + and Tk). The send command needs to be rewritten to prevent the + deadlock situation (soon). The dde command is being pushed into + its own package and will provide almost all of the capabilities + that send did before (using a "dde eval" command), not yet + completed. + +1999-03-31 + + * win/tkWinSend.c: Modified dde/send code to work properly on + Win95/Win98. String lengths are not returned properly by DDE, so + NULL terminate all strings going in and ignore the string length + coming back out. Do not destroy handles until all necessary work + on those handles (and child handles) is done. + +1999-03-30 + + * generic/tkWindow.c (Tk_DestroyWindow): Image handlers are now + finalized before the font subsystem since complex image handlers + may contain references to fonts (e.g. Tix compound images). + [Bug: 1603] + +1999-03-29 + + * doc/MeasureChar.3: + * doc/TextLayout.3: + * generic/tk.decls: + * generic/tkCanvText.c: + * generic/tkEntry.c: + * generic/tkFont.c: + * generic/tkListbox.c: + * generic/tkMessage.c: + * mac/tkMacFont.c: + * unix/tkUnixButton.c: + * unix/tkUnixFont.c: + * unix/tkUnixMenu.c: + * win/tkWinFont.c: + * win/tkWinMenu.c: Standardized text layout and font interfaces + so they are consistent with respect to byte versus character + oriented indices. The layout functions all manipulate character + oriented values while the lower level measurement functions all + operate on byte oriented values. This distinction was not clear + and so the functions were being used improperly in a number of + places. [Bug: 1053, 747, 749, 1646] + + * generic/tk.decls: Eliminated uses of C++ STL types string and + list from declarations. + + * generic/tkFont.c: Changes to named fonts were not being + propagated in some cases. [Bug: 1144] + + * xlib/X11/Xlib.h: + * generic/tkInt.decls: Added XParseColor to xlib stub + tables. [Bug: 1574] + + * doc/GetBitmap.3: + * generic/tkBitmap.c (BitmapInit): Eliminated use of Tk_Uid's in + bitmaps. Added a few CONST declarations. + +1999-03-29 + + * unix/configure.in: + * unix/Makefile.in: + * win/makefile.vc: + * generic/tkDecls.h: + * generic/tkIntDecls.h: + * generic/tkIntPlatDecls.h: + * generic/tkPlatDecls.h: + * generic/tkIntXlibDecls.h: Removed stub functions. Always use the + Tcl stubs when building with --enable-shared. + + +1999-03-26 + + * generic/tkTextIndex.c: + * tests/testIndex.test: Avoid looking past the beginning of the + array storing data for the text widget (.t index end-2c). Added + test case to check for the bug. [Bug 991] + + * generic/tkConsole.c: Copy static strings into a Tcl_DString + before passing to Tcl_Eval, in case the compiler puts static + strings into read-only memory. + +1999-03-26 + + * unix/configure.in: + --nameble-shared is now the default and builds Tk as a shared + library; specify --disable-shared to build a static Tk library + and shell. + +1999-03-26 + + * library/menu.tcl: Fixed bug reported by Bryan Oakley in the + menubutton bindings. There was a false assumption that there was + always a menu attached to the button. [Bug 1116] + +1999-03-26 + + * unix/configure.in: Removed --enable-tcl-stub. Linking Tk to Tcl + stubs is causing too many problems when linking executables like wish. + Until the Tk is a fully loadable extension, linking against the Tcl + stubs is not supported in Tk. + +1999-03-19 + + * generic/tkBitmap.c: + * generic/tkCursor.c: + * generic/tkGC.c: When creating hash tables that key off of XID + handles, make sure to pass TCL_ONE_WORD_KEYS. XIDs are guaranteed + to be 32bit numbers, although on some 64bit systems (including 64bit + Solaris 7) they are packed into a 64bit value where the upper 32bits + are zero. The normal method of sizeof(XID)/sizeof(int) causes the + hash table code to assume that the XID is a pointer to an array of + two ints, which it is not. Tk now supports 64bit Solaris 7. + +1999-03-17 + + * win/makefile.vc: + * generic/tk.h: Changed to use TCL_BETA_RELEASE macro, and fixed + so this works in rc files. + + * win/makefile.vc: + * win/makefile.bc: + * win/README: + * unix/configure.in: + * generic/tk.h: + * README: Updated version to 8.1b3. + +1999-03-14 + + * unix/configure.in: Added missing stub related definitions. + + * unix/Makefile.in: Install tkDecls.h in addition to tk.h. + + * generic/tkStubLib.c: Added flags to ensure we are using Tcl + stub macros. + +1999-03-11 + + * generic/tkInt.decls: Added reserved slot for XSetDashes for use + by the dash patch. + +1999-03-10 + + * xlib/xdraw.c: + * xlib/X11/Xlib.h: + * mac/tkMac.h: + * mac/tkMacInt.h: + * mac/tkMacPort.h: + * mac/tkMacXStubs.c: + * mac/tkMacAppInit.c: + * mac/tkMacCursor.c: + * win/makefile.vc: + * win/tkWin.h: + * win/tkWinInt.h: + * win/tkWinPort.h: + * win/winMain.c: + * generic/tk.h: + * generic/tkInt.h: + * generic/tk.decls: + * generic/tkInt.decls: + * generic/tkDecls.h: + * generic/tkPlatDecls.h: + * generic/tkIntDecls.h: + * generic/tkIntPlatDecls.h: + * generic/tkIntXlibDecls.h: + * generic/tkStubs.c: + * generic/tkPlatStubs.c: + * generic/tkIntStubs.c: + * generic/tkIntPlatStubs.c: + * generic/tkIntXlibStubs.c: + * generic/tkStubInit.c: + * generic/tkStubLib.c: + * generic/tkBind.c: + * generic/tkCmds.c: + * generic/tkConfig.c: + * generic/tkConsole.c: + * generic/tkCursor.c: + * generic/tkGrab.c: + * generic/tkImgPhoto.c: + * generic/tkMain.c: + * generic/tkMenu.c: + * generic/tkPointer.c: + * generic/tkTextDisp.c: + * generic/tkWindow.c: + * unix/tkUnixInt.h: + * unix/tkUnixPort.h: + * unix/Makefile.in: + * unix/configure.in: + * unix/tkConfig.sh.in: + * unix/tkUnix.c: + * unix/tkUnix3d.c: + * unix/tkUnixDraw.c: + * unix/tkUnixFont.c: + * unix/tkUnixMenubu.c: Stubs implementation for 8.1. Tk_Main() is + replaced with a macro which calls Tk_MainEx(). Tk can link to the Tcl + stubs library, wish links directly to Tcl and Tk. Use + --enable-tcl-stubs to link Tk to the Tcl stubs library (Unix), on + by default on Windows. Exported all public functions through the + stubs mechanism (see the *.decls files) and many of the internal + functions. Most of the changes dealt with shifting around the + function declarations in the header files. Mac code may not + compile, but it shouldn't take much work to fix this. + + * mac/tkMacMenu.c: Added dummy TkpMenuThreadInit for Mac to be + consistent with Unix and Windows versions. + +1999-03-08 + + * win/tkWinWm.c: Toplevel class no longer shared between + threads. + + * win/tkWinX.c: Multiple threads no longer share the same + TkDisplay structure. Required because TkDisplay stores much + thread-specific data for a given thread. + + * win/tkWinSend.c: Moved application instance handle out + out thread-local storage. DDE was failing to initialize + when the instance handles were different between threads. + + * win/makefile.vc: Added THREADDEFINES for building with + threads enabled. + + * generic/tkMenu.c: + * win/tkWinMenu.c: + * unix/tkUnixMenu.c: Added TkpMenuThreadInit for initializing + thread-specific Menu state. + +1999-03-01 + + * win/tkWinWm.c: + * win/tkWinPointer.c: + * win/tkWinInt.h: Fix "focus -force" for Windows. The Win32 API + function SetForegroundWindow() does not work unless the window + handle is a toplevel window (a Windows toplevel). The handle + being passed was a Tk toplevel, which is a child of the Windows + toplevel. + +1999-02-26 + + * win/cat.c: Remove this file, use the one in the Tcl source directory. + + * win/makefile.vc: Remove the wishc.exe from the default targets. Add + a separate console-wish target to build it. The need for a + console-wish will go away soon, so we don't want to encourage its + use. + +1999-02-25 + + * win/tkWinWm.c: Properly initialize the tsdPtr->firstWindow field. + + * win/cat.c: Code for cat32.exe, copied from the Tcl sources. Required + in order to run the test suite from the makefile + + * win/winMain.c: Add main() for a console-based wishc.exe, which meant + adding code to disable the call to Tk_ConsoleInit(). + + * generic/tkConsole.c: Check the standard handles before creating the + new standard channels. This allows a windows app that has stdin, + stdout, or stderr to correctly connect to them. + + * generic/tkMain.c: Add a proper check for the interactive mode, since + the standard channels may actually be connected in windows mode or + even in the console-based wish. + + * win/makefile.vc: Add targets for wishc.exe (console-based wish) and + cat32.exe (for testing). Fix the test suite target so it can be run + from the makefile (which can happen since the standard handles have + been fixed). + +1999-02-12 + + * generic/tkMenuButton.h: + * generic/tkMenuButton.c: + * mac/tkMacMenubutton.c: + * mac/tkMacDefault.h + * unix/tkUnixMenubu.c: Eliminated Tk_Uids used by -state option. + * unix/tkUnixDefault.h + * win/tkWinDefault.h + + + * generic/tk.h: + * generic/tkScale.h: + * generic/tkScale.c: + * generic/tkWindow.c: + * unix/tkUnixScale.c: + * unix/tkUnixDefault.h: + * unix/tkWinDefault.h: + * mac/tkMacDefault.h: Objectified scale widget. + + * win/tkWinX.c: Removed Thread-specific data from process + initialization code that was stopping the Tk Dll from + loading. + +1999-02-11 + + * README: + * generic/tk.h: + * unix/configure.in: + * win/README: + * win/makefile.bc: + * win/makefile.vc: Updated version to 8.1b2. + + * unix/tkUnixSend.c: Fixed one more Tcl_*ObjVar instance. + +1999-02-04 + + * Various cleanup related to the Tcl_Eval and Tcl_ObjSetVar + changes in Tcl. + + INTEGRATED PATCHES FROM 8.0.5b2: + + * win/tkWinMenu.c (TkpDestroyMenu): Changed so modalMenuPtr is + cleared when it is being destroyed. + + * generic/tkImgPhoto.c: Changed so color tables are freed + immediately instead of being delayed. This ensures that color + tables are properly disposed at process exit. + + * library/prolog.ps: Changed string that determines font height to + include European character with an umlaut. + + * generic/tkImgBmap.c (ImgBmapConfigureInstance): If an image + mask changed but ended up with the same XID, the GC failed to be + updated and so the new mask was not used. [Bug: 970] + + * generic/tkFocus.c (SetFocus): Changed so focus window is always + set if -force is specified. This fixes the problem on Windows + where Tk does not activate the window if it already has focus. + + * generic/tkConsole.c: Fixed so errors in console eval are + reported properly. Eliminated duplicate result messages. [Bug: 973] + + * win/tkWinWm.c: Changed so windows that aren't resizable don't + have resize handles and the zoom box is disabled. + + * win/tkWinInt.h: + * win/tkWinPointer.c: Changed to cancel the mouse timer when a + user initiated move/resize loop begins. + + * unix/configure.in: TK_LD_SEARCH_FLAGS was set incorrectly if + SHLIB_LD_LIBS='${LIBS}', and shared linking is performed through + the C compiler. Systems affected are Linux, MP-RAS and NEXTSTEP, + but also with gcc on many more systems. [Bug: 908] + + * win/makefile.vc: First stab at install target. Fixed quoting so + paths with spaces work. + + * tests/main.test: + * tests/unixWm.test: Better cleanup of temporary files. + + * mac/tkMacAppInit.c: + * generic/tkTest.c: + * generic/tkAppInit.c: + * win/winMain.c: Changed some EXTERN declarations to extern + since they are not defining exported interfaces. This avoids + generating useless declspec() attributes and makes the windows + makefile simpler. + + * library/menu.tcl (tkMenuFind): Changed so keyboard shortcuts + will only be found in the current toplevel. Previously, they + might be found in menus attached to other toplevels that might not + even be mapped. [Bug: 924] + + * generic/tkCanvLine.c: Changed to treat zero width lines like + they have width 1 for purposes of selection. [Bug: 925] + + * win/tkWinFont.c (Tk_MeasureChars): Added a workaround for a bug + in GetTextExtentExPoint on Win NT 4.0/Japanese. [Bug: 1006] + + * unix/tkUnixSend.c (Tk_SetAppName): Fixed uninitialized memory + access bug. [Bug: 919] + +1999-1-28 + + * generic/tkGrid.c: Fixed bug in "grid forget" that failed to cancel + pending idle handlers, resulting in a crash in a few odd cases. + +1999-01-06 + + * generic/tk.h, generic/tkGet.c, generic/tkConfig.c, + * generic/tkOldConfig.c, generic/tkEntry.c, generic/tkMenubutton.c, + * generic/tkMenubutton.h, generic/tkScale.c, generic/tkScale.h, + * generic/tkTextDisplay.c, generic/tkText.c, unix/tkUnixMenubu.c, + * unix/tkUnixScale.c, mac/tkMacMenu.c, mac/tkMacMenubutton.c, + + Removed global Tk_Uids dealing with "-state" configuration option + and added new TK_CONFIG_STATE configSpec that doesn't use + Tk_Uids. + +1998-12-11 === Tk 8.1b1 Release === + +1998-12-11 + + * generic/tkMain.c (Tk_Main): Fixed improper command line encoding + handling. + +1998-12-08 + + * win/tkWinClipboard.c (TkSelGetSelection, TkWinClipboardRender): + Changed to handle multibyte characters properly. [Bug: 935] + +1998-12-07 + + * library/xmfbox.tcl (tkMotifFDialog_Create): In the cached case, + the data array was not being initialized with the correct set of + widgets. + +1998-12-4 + + * Changed patchLevel to 8.1b1 + + * generic/tkMenu.c (ConfigureMenuCloneEntries): The -menu configuration + option was being incorrectly specified as just "menu". + +1998-11-30 + + * generic/tkButton.c (ConfigureButton): The error result was + getting lost when restoring configuration options. [Bug: 619] + +1998-11-25 + + * unix/tkUnixFont.c (GetFontAttributes): Initialize an unspecified + family to an empty string. + (FontMapLoadPage): if the font included characters below 32, the + index computation was incorrect because the range was shifted up + to 32. + (CreateClosestFont): check for empty locale as well as NULL. + + * generic/tkFont.c (TkFontParseXLFD): initialize charset to + iso8859-1 if no charset is specified. + + * mac/tkMacHLEvents.c (OdocHandler): added conversion from + external string to UTF [Bug: 869] + + * integrated tk8.0.4 changes. + + * generic/tkBind.c: fixed deletion order bug where a crash would + result if a binding deleted "." + + * generic/tkMenu.c (MenuWidgetObjCmd): disabled menu entries were + getting reenabled whenever the mouse passed over the entry [Bug: 860] + + * unix/tkUnixMenu.c (TkpComputeStandardMenuGeometry): hidemargin + option was not honored properly in menus [Bug: 859] + +1998-11-24 + + * tkMacMenu.c, tkUnixMenu.c, tkWinMenu.c, tkMenuDraw.c, tkMenu.h, + * tkMenu.c: Backed out the previous fix for bug 620 and + eliminated a bunch of code that created unnecessary objects. + Changed back to using internal types instead of objects for many + configuration options. There are many more fixes like this that + could be made, but some require a little restructuring of the + code. In any case the leaks are fixed and there is a lot less + allocation happening. [Bug: 620] + +1998-11-19 + + * tkMenu.c (DestroyMenuEntry): fixed memory leaks [Bug: 620] + + * tkWinX.c (GetTranslatedKey): fixed bad code merge + + * tkWinWm.c, tkWinMenu.c: fixed titles and menus so they properly + display Unicode [Bug: 819] + Index: README ================================================================== --- README +++ README @@ -1,42 +1,94 @@ -The Tk Toolkit +README: Tk -SCCS: @(#) README 1.47 97/11/20 12:48:16 + Tk is maintained, enhanced, and distributed freely as a + service to the Tcl community by Scriptics Corporation. + +RCS: @(#) $Id: README,v 1.1.4.6 1999/03/17 22:06:27 stanton Exp $ + +Contents +-------- + 1. Introduction + 2. Documentation + 3. Compiling and installing Tk + 4. Getting started + 5. Summary of changes in Tk 8.1 + 6. Development tools + 7. Tcl newsgroup + 8. Tcl contributed archive + 9. Tcl Resource Center + 10. Mailing lists + 11. Support and bug fixes + 12. Tk version numbers 1. Introduction --------------- -This directory and its descendants contain the sources and documentation -for Tk, an X11 toolkit implemented with the Tcl scripting language. The -information here corresponds to Tk 8.0p2, which is the second patch update -for Tk 8.0. This release is designed to work with Tcl 8.0p2 and may not -work with any other version of Tcl. - -Tk 8.0 is a major release with significant new features such as native -look and feel on Macintoshes and PCs, a new font mechanism, application -embedding, and proper support for Safe-Tcl. See below for details. -There should be no backward incompatibilities in Tk 8.0 that affect -scripts. This patch release fixes various bugs in Tk 8.0; there are no -feature changes relative to Tk 8.0. - -Note: with Tk 8.0 the Tk version number skipped from 4.2 to 8.0. The -jump was made in order to synchronize the Tcl and Tk version numbers. +This directory contains the sources and documentation for Tk, an X11 +toolkit implemented with the Tcl scripting language. The information +here corresponds to release 8.1b3, which is the third beta release +for Tk 8.1. This release is mostly feature complete but may have bugs +and be missing some minor features. This release is for early +adopters who are willing to help us find and fix problems. Please let +us know about any problems you uncover. + +The most important change in Tk 8.1 is that it supports the new +internationalization features in Tcl 8.1. It also contains a new +library for handling configuration options some of the widgets have +been converted to use the Tcl object facilities. For details on +features, incompatibilities, and potential problems with this release, +see the Tcl/Tk 8.1 Web page at + + http://www.scriptics.com/software/8.1.html + +or refer to the "changes" file in this directory, which contains a +historical record of all changes to Tk. + +Tk is a freely available open source package. You can do virtually +anything you like with it, such as modifying it, redistributing it, +and selling it either in whole or in part. See the file +"license.terms" for complete information. 2. Documentation ---------------- -The best way to get started with Tk is to read one of the introductory -books on Tcl and Tk: +The best way to get started with Tk is to read about Tk on the +Scriptics Web site at: + + http://www.scriptics.com/scripting + +Another good way to get started with Tcl is to read one of the +introductory books on Tcl: Practical Programming in Tcl and Tk, 2nd Edition, by Brent Welch, Prentice-Hall, 1997, ISBN 0-13-616830-2 Tcl and the Tk Toolkit, by John Ousterhout, Addison-Wesley, 1994, ISBN 0-201-63337-X Exploring Expect, by Don Libes, O'Reilly and Associates, 1995, ISBN 1-56592-090-2 + +Other books are listed at +http://www.scriptics.com/resource/doc/books/ + +There is also an official home for Tcl and Tk on the Scriptics Web site: + + http://www.scriptics.com + +These Web pages include information about the latest releases, products +related to Tcl and Tk, reports on bug fixes and porting issues, HTML +versions of the manual pages, and pointers to many other Tcl/Tk Web +pages at other sites. Check them out! + +If you are porting Tk 3.6 scripts to Tk 4.0 or later releases, you may +find the Postscript file doc/tk4.0.ps useful. It is a porting guide +that summarizes the new features and discusses how to deal with the +changes in Tk 4.0 that are not backwards compatible. + +2a. Unix Documentation +---------------------- The "doc" subdirectory in this release contains a complete set of reference manual entries for Tk. Files with extension ".1" are for programs such as wish; files with extension ".3" are for C library procedures; and files with extension ".n" describe Tcl commands. To @@ -49,72 +101,43 @@ program supports it, you should be able to access the Tcl manual entries using the normal "man" mechanisms, such as man wish -If you are porting Tk 3.6 scripts to Tk 4.0 or later releases, you may -find the Postscript file doc/tk4.0.ps useful. It is a porting guide -that summarizes the new features and discusses how to deal with the -changes in Tk 4.0 that are not backwards compatible. - -There is also an official home for Tcl and Tk on the Web: - http://www.smli.com/research/tcl -These Web pages include release updates, reports on bug fixes and porting -issues, HTML versions of the manual pages, and pointers to many other -Tcl/Tk Web pages at other sites. Check them out! +2b. Windows Documentation +------------------------- + +The "doc/help" subdirectory in this release contains a complete set of +Windows help files for TclPro. Once you install this Tcl release, a +shortcut to the Windows help Tcl documentation will appear in the +"Start" menu: + + Start | Programs | Tk | Tk Help 3. Compiling and installing Tk ------------------------------ This release contains everything you should need to compile and run -Tk under UNIX, Macintoshes, and PCs (either Windows NT, Windows 95, -or Win 3.1 with Win32s). +Tk under UNIX, PCs (either Windows NT, Windows 95, or Win 3.1 with +Win32s), and Macintoshes. Before trying to compile Tk you should do the following things: (a) Check for a binary release. Pre-compiled binary releases are - available now for PCs and Macintoshes, and several flavors of - UNIX. Binary releases are much easier to install than source - releases. To find out whether a binary release is available for - your platform, check the home page for the Sun Tcl/Tk project - (http://www.sunlabs.com/research/tcl) and also check in the FTP - directory from which you retrieved the base distribution. + available now for PCs, Macintoshes, and several flavors of UNIX. + Binary releases are much easier to install than source releases. + To find out whether a binary release is available for your + platform, check the Scriptics Tcl Resource Center + (http://www.scriptics.com/resource). Also, check in + the FTP directory from which you retrieved the base + distribution. (b) Make sure you have the most recent patch release. Look in the FTP directory from which you retrieved this distribution to see if it has been updated with patches. Patch releases fix bugs without changing any features, so you should normally use the latest patch release for the version of Tk that you want. - Patch releases are available in two forms. A file like - tk8.0p1.tar.Z is a complete release for patch level 1 of Tk - version 8.0. If there is a file with a higher patch level than - this release, just fetch the file with the highest patch level - and use it. - - Patches are also available in the form of patch files that just - contain the changes from one patch level to another. These - files have names like tk8.0p1.patch, tk8.0p2.patch, etc. They - may also have .gz or .Z extensions to indicate compression. To - use one of these files, you apply it to an existing release with - the "patch" program. Patches must be applied in order: - tk8.0p1.patch must be applied to an unpatched Tk 8.0 release - to produce a Tk 8.0p1 release; tk8.0p2.patch can then be - applied to Tk 8.0p1 to produce Tk 8.0p2, and so on. To apply an - uncompressed patch file such as tk8.0p1.patch, invoke a shell - command like the following from the directory containing this - file: - patch -p < tk8.0p1.patch - If the patch file has a .gz extension, it was compressed with - gzip. To apply it, invoke a command like the following: - gunzip -c tk8.0p1.patch.gz | patch -p - If the patch file has a .Z extension, it was compressed with - compress. To apply it, invoke a command like the following: - zcat tk8.0p1.patch.Z | patch -p - If you're applying a patch to a release that has already been - compiled, then before applying the patch you should cd to the - "unix" subdirectory and type "make distclean" to restore the - directory to a pristine state. Once you've done this, change to the "unix" subdirectory if you're compiling under UNIX, "win" if you're compiling under Windows, or "mac" if you're compiling on a Macintosh. Then follow the instructions in the README file in that directory for compiling Tk, installing it, @@ -121,183 +144,46 @@ and running the test suite. 4. Getting started ------------------ -The best way to get started with Tk is by reading one of the introductory -books. +The best way to get started with Tk is by reading one of the +introductory books. See the documentation section above for more +details. The subdirectory library/demos contains a number of pre-canned scripts that demonstrate various features of Tk. See the README file in the directory for a description of what's available. The file -library/demos/widget is a script that you can use to invoke many individual -demonstrations of Tk's facilities, see the code that produced the demos, -and modify the code to try out alternatives. +library/demos/widget is a script that you can use to invoke many +individual demonstrations of Tk's facilities, see the code that +produced the demos, and modify the code to try out alternatives. -5. Summary of changes in Tk 8.0 +5. Summary of changes in Tk 8.1 ------------------------------- -Here is a list of the most important new features in Tk 8.0. The -release also includes several smaller feature changes and bug fixes. -See the "changes" file for a complete list of all changes. - - 1. Native look and feel. The widgets have been rewritten to provide - (nearly?) native look and feel on the Macintosh and PC. Many - widgets, including scrollbars, menus, and the button family, are - implemented with native platform widgets. Others, such as entries - and texts, have been modified to emulate native look and feel. - These changes are backwards compatible except that (a) some - configuration options are now ignored on some platforms and (b) you - must use the new menu mechanism described below to native look and - feel for menus. - - 2. There is a new interface for creating menus, where a menubar is - implemented as a menu widget instead of a frame containing menubuttons. - The -menu option for a toplevel is used to specify the name of the - menubar; the menu will be displayed *outside* the toplevel using - different mechanisms on each platform (e.g. on the Macintosh the menu - will appear at the top of the screen). See the menu demos in the - widget demo for examples. The old style of menu still works, but - does not provide native look and feel. Menus have several new - features: - - New "-columnbreak" and "-hideMargin" options make it possible - to create multi-column menus. - - It is now possible to manipulate the Apple and Help menus on - the Macintosh, and the system menu on Windows. It is also - possible to have a right justified Help menu on Unix. - - Menus now issue the virtual event <> whenever the - current item changes. Applications can use this to generate - help messages. - - There is a new "-direction" option for menubuttons, which - controls where the menu pops up revenues to the button. - - 3. The font mechanism in Tk has been completely reworked: - - Font names need not be nasty X LFDs: more intuitive names - like {Times 12 Bold} can also be used. See the manual entry - font.n for details. - - Font requests always succeed now. If the requested font is - not available, Tk finds the closest available font and uses - that one. - - Tk now supports named fonts whose precise attributes can be - changed dynamically. If a named font is changed, any widget - using that font updates itself to reflect the change. - - There is a new command "font" for creating named fonts and - querying various information about fonts. - - There are now officially supported C APIs for measuring and - displaying text. If you use these APIs now, your code will - automatically handle international text when internationalization - is added to Tk in a future release. See the manual entries - MeasureChar.3, TextLayout.3, and FontId.3. - - The old C procedures Tk_GetFontStruct, Tk_NameOfFontStruct, - and Tk_FreeFontStruct have been replaced with more portable - procedures Tk_GetFont, Tk_NameOfFont, and Tk_FreeFont. - - 4. Application embedding. It is now possible to embedded one Tcl/Tk - application inside another, using the -container option on frame - widgets and the -use option for toplevel widgets or on the command - line for wish. Embedding should be fully functional under Unix, - but the implementation is incomplete on the Macintosh and PC. - - 5. Tk now works correctly with Safe-Tcl: it can be loaded into - safe interpreters using safe::loadTk. - - 6. Text widgets now allow images to be embedded directly in the - text without using embedded windows. This is more efficient and - provides smoother scrolling. - - 7. Buttons have a new -default option for drawing default rings in - a platform-specific manner. - - 8. There is a new "gray75" bitmap, and the "gray25" bitmap is now - really 25% on (due to an ancient mistake, it had been only 12% on). - The Macintosh now supports native bitmaps, including new builtin - bitmaps "stop", "caution", and "note", plus the ability to use - bitmaps in the application's resource fork. - - 9. The "destroy" command now ignores windows that don't exist - instead of generating an error. - -Tk 8.0 introduces the following incompatibilities that may affect Tcl/Tk -scripts that worked under Tk 4.2 and earlier releases: - - 1. Font specifications such as "Times 12" now interpret the size - as points, whereas it used to be pixels (this was actually a bug, - since the behavior was documented as points). To get pixels now, - use a negative size such as "Times -12". - - 2. The -transient option for menus is no longer supported. You can - achieve the same effect with the -type field. - - 3. In the canvas "coords" command, polygons now return only the - points that were explicitly specified when the polygon was created - (they used to return an extra point if the polygon wasn't originally - closed). Internally, polygons are still closed automatically for - purposes of display and hit detection; the extra point just isn't - returned by the "coords" command. - - 4. The photo image mechanism now uses Tcl_Channels instead of FILEs, - in order to make it portable. FILEs are no longer used anywhere - in Tk. The procedure Tk_FindPhoto now requires an extra "interp" - argument in order to fix a bug where images in different interpreters - with the same name could get confused. - - 5. The procedures Tk_GetFontStruct, Tk_NameOfFontStruct, - and Tk_FreeFontStruct have been removed. - -Note: the new compiler in Tcl 8.0 may also affect Tcl/Tk scripts; check -the Tcl documentation for information on incompatibilities introduced by -Tcl 8.0. - -6. Tcl/Tk newsgroup -------------------- - -There is a network news group "comp.lang.tcl" intended for the exchange -of information about Tcl, Tk, and related applications. Feel free to use -this newsgroup both for general information questions and for bug reports. -We read the newsgroup and will attempt to fix bugs and problems reported -to it. - -When using comp.lang.tcl, please be sure that your e-mail return address -is correctly set in your postings. This allows people to respond directly -to you, rather than the entire newsgroup, for answers that are not of -general interest. A bad e-mail return address may prevent you from -getting answers to your questions. You may have to reconfigure your news -reading software to ensure that it is supplying valid e-mail addresses. - -7. Mailing lists +6. Development tools +-------------------- + +A high quality set of commercial development tools is now available to +accelerate your Tk application development. Scriptics' TclPro +product provides a debugger, static code checker, packaging utility, +and bytecode compiler. Visit the Scriptics Web site at: + + http://www.scriptics.com/tclpro + +for more information on TclPro and for a free 30-day evaluation +download. + +7. Tcl newsgroup ---------------- -A couple of Mailing List have been set up to discuss Macintosh or -Windows related Tcl issues. In order to use these Mailing Lists you -must have access to the internet. If you have access to the WWW the -home pages for these mailing lists are located at the following URLs: - - http://www.sunlabs.com/research/tcl/lists/mactcl-list.html - - -and- - - http://www.sunlabs.com/research/tcl/lists/wintcl-list.html - -The home pages contain information about the lists and an HTML archive -of all the past messages on the list. To subscribe send a message to: - - listserv@sunlabs.sun.com - -In the body of the message (the subject will be ignored) put: - - subscribe mactcl Joe Blow - -Replacing Joe Blow with your real name, of course. (Use wintcl -instead of mactcl if your interested in the Windows list.) If you -would just like to receive more information about the list without -subscribing but the line: - - information mactcl - -in the body instead (or wintcl). - -8. Tcl/Tk contributed archive +There is a network news group "comp.lang.tcl" intended for the +exchange of information about Tcl, Tk, and related applications. The +newsgroup is a greata place to ask general information questions. For +bug reports, please see the "Support and bug fixes" section below. + +8. Tcl contributed archive -------------------------- Many people have created exciting packages and applications based on Tcl and/or Tk and made them freely available to the Tcl community. An archive of these contributions is kept on the machine ftp.neosoft.com. You @@ -304,78 +190,151 @@ can access the archive using anonymous FTP; the Tcl contributed archive is in the directory "/pub/tcl". The archive also contains several FAQ ("frequently asked questions") documents that provide solutions to problems that are commonly encountered by TCL newcomers. -9. Support and bug fixes ------------------------- - -We're very interested in receiving bug reports and suggestions for -improvements. We prefer that you send this information to the -comp.lang.tcl newsgroup rather than to any of us at Sun. We'll see -anything on comp.lang.tcl, and in addition someone else who reads -comp.lang.tcl may be able to offer a solution. The normal turn-around -time for bugs is 3-6 weeks. Enhancements may take longer and may not -happen at all unless there is widespread support for them (we're -trying to slow the rate at which Tk turns into a kitchen sink). It's -very difficult to make incompatible changes to Tcl at this point, due -to the size of the installed base. - -When reporting bugs, please provide a short wish script that we can -use to reproduce the bug. Make sure that the script runs with a -bare-bones wish and doesn't depend on any extensions or other -programs, particularly those that exist only at your site. Also, -please include three additional pieces of information with the -script: +9. Tcl Resource Center +---------------------- + +Visit http://www.scriptics.com/resource/ to see an annotated index of +many Tcl resources available on the World Wide Web. This includes +papers, books, and FAQs, as well as development tools, extensions, +applications, binary releases, and patches. You can also recommend +additional URLs for the resource center using the forms labeled "Add a +Resource". + +10. Mailing lists +----------------- + +A couple of Mailing List have been set up to discuss Macintosh or +Windows related Tcl issues. To subscribe send a message to: + + wintcl-request@tclconsortium.org + mactcl-request@tclconsortium.org + +In the body of the message (the subject will be ignored) put: + + subscribe mactcl Joe Smith + +Replacing Joe Smith with your real name, of course. (Use wintcl +instead of mactcl if your interested in the Windows list.) If you +would just like to receive more information about the list without +subscribing put the line: + + information mactcl + +in the body instead (or wintcl). + +11. Support and bug fixes +------------------------- + +Scriptics is very interested in receiving bug reports, patches, and +suggestions for improvements. We prefer that you send this +information to us via the bug form on the Scriptics Web site, rather +than emailing us directly. The bug form is at: + + http://www.scriptics.com/support/bugForm.html + +The bug form was designed to give uniform structure to bug reports as +well as to solicit enough information to minimize followup questions. +The bug form also includes an option to automatically post your report +on comp.lang.tcl. We strongly recommend that you select this option +because someone else who reads comp.lang.tcl may be able to offer a +solution. + +When reporting bugs, please provide full information about the Tcl/Tk +version and the platform on which you are running Tcl/Tk. Also, +please include a short wish script that we can use to reproduce the +bug. Make sure that the script runs with a bare-bones wish and +doesn't depend on any extensions or other programs, particularly those +that exist only at your site. Also, please include three additional +pieces of information with the script: + (a) how do we use the script to make the problem happen (e.g. what things do we click on, in what order)? (b) what happens when you do these things (presumably this is undesirable)? (c) what did you expect to happen instead? -The Tcl/Tk community is too large for us to provide much individual -support for users. If you need help we suggest that you post questions -to comp.lang.tcl. We read the newsgroup and will attempt to answer -esoteric questions for which no-one else is likely to know the answer. -In addition, Tcl/Tk support and training are available commercially from -NeoSoft (info@neosoft.com), Computerized Processes Unlimited -(gwl@cpu.com), and Data Kinetics (education@dkl.com). - -10. Release organization ------------------------- +We will log and follow-up on each bug, although we cannot promise a +specific turn-around time. Enhancements may take longer and may not +happen at all unless there is widespread support for them (we're +trying to slow the rate at which Tcl/Tk turns into a kitchen sink). +It's very difficult to make incompatible changes to Tcl/Tk at this +point, due to the size of the installed base. + +The Tcl community is too large for us to provide much individual +support for users. If you need help we suggest that you post +questions to comp.lang.tcl. We read the newsgroup and will attempt to +answer esoteric questions for which no-one else is likely to know the +answer. In addition, Tcl/Tk support and training are available +commercially from Scriptics at: + + http://www.scriptics.com/training + +Also see the following Web site for links to other organizations that +offer Tcl/Tk training: + + http://www.scriptics.com/resource/commercial/training + +12. Tk version numbers +---------------------- + +You can test the current version of Tk by examining the +tk_version and tk_patchLevel variables. The tk_patchLevel +variable follows the naming rules outlined below (e.g., 8.0.5). +The tk_version just has the major.minor numbers in it (e.g., 8.0) Each Tk release is identified by two numbers separated by a dot, e.g. -3.2 or 3.3. If a new release contains changes that are likely to break +3.6 or 4.0. If a new release contains changes that are likely to break existing C code or Tcl scripts then the major release number increments and the minor number resets to zero: 3.0, 4.0, etc. If a new release contains only bug fixes and compatible changes, then the minor number -increments without changing the major number, e.g. 3.1, 3.2, etc. If +increments without changing the major number, e.g. 4.1, 4.2, etc. If you have C code or Tcl scripts that work with release X.Y, then they should also work with any release X.Z as long as Z > Y. -Alpha and beta releases have an additional suffix of the form a2 or b1. -For example, Tk 3.3b1 is the first beta release of Tk version 3.3, -Tk 3.3b2 is the second beta release, and so on. A beta release is an -initial version of a new release, used to fix bugs and bad features -before declaring the release stable. An alpha release is like a beta -release, except it's likely to need even more work before it's "ready -for prime time". New releases are normally preceded by one or more -alpha and beta releases. We hope that lots of people will try out -the alpha and beta releases and report problems. We'll make new alpha/ -beta releases to fix the problems, until eventually there is a beta -release that appears to be stable. Once this occurs we'll make the -final release. +Alpha and beta releases have an additional suffix of the form a2 or +b1. For example, Tk 4.0b1 is the first beta release of Tk version +4.0, Tk 4.0b2 is the second beta release, and so on. A beta release +is an initial version of a new release, used to fix bugs and bad +features before declaring the release stable. An alpha release is +like a beta release, except it's likely to need even more work before +it's "ready for prime time". New releases are normally preceded by +one or more alpha and beta releases. We hope that lots of people will +try out the alpha and beta releases and report problems. We'll make +new alpha/beta releases to fix the problems, until eventually there is +a beta release that appears to be stable. Once this occurs we'll make +the final release. We can't promise to maintain compatibility among alpha and beta releases. For example, release 4.1b2 may not be backward compatible with 4.1b1, even though the final 4.1 release will be backward compatible with 4.0. This allows us to change new features as we find problems during beta testing. -We'll try to minimize incompatibilities between beta releases, but if a -major problem turns up then we'll fix it even if it introduces an +We'll try to minimize incompatibilities between beta releases, but if +a major problem turns up then we'll fix it even if it introduces an incompatibility. Once the official release is made then there won't be any more incompatibilities until the next release with a new major version number. -Patch releases have a suffix such as p1 or p2. These releases contain -bug fixes only. A patch release (e.g Tk 4.1p2) should be completely -compatible with the base release from which it is derived (e.g. Tk -4.1), and you should normally use the highest available patch release. +(Note: This compatibility is true for Tcl scripts, but historically +the Tcl C APIs have changed enough between releases that you may need +to work a bit to upgrade extensions.) + +Patch releases now have a suffix such as ".4" or ".5". Prior to +version 8.0.3, patch releases had the suffix "p1" or "p2". So, the +8.0 release went to 8.0p1, 8.0p2, 8.0.3, 8.0.4, and 8.0.5. The alphas +and betas continue to use the 'a' and 'b' letters in their +tk_patchLevel. Patch releases normally contain bug fixes only. A +patch release (e.g Tk 8.0.5) should be completely compatible with the +base release from which it is derived (e.g. Tk 8.0), and you should +normally use the highest available patch release. + +Note: with Tk 8.0 the Tk version number skipped from 4.2 to 8.0. The +jump was made in order to synchronize the Tcl and Tk version numbers. + +13. Thank You +------------- + +We'd like to express our thanks to the Tcl community for all the +helpful suggestions, bug reports, and patches we have received. +Tcl/Tk has improved vastly and will continue to do so with your help. Index: changes ================================================================== --- changes +++ changes @@ -1,10 +1,10 @@ This file summarizes all changes made to Tk since version 1.0 was released on March 13, 1991. Changes that aren't backward compatible are marked specially. -SCCS: @(#) changes 1.252 97/11/25 08:31:19 +RCS: @(#) $Id: changes,v 1.1.4.13 1999/04/06 05:48:56 welch Exp $ 3/16/91 (bug fix) Modified tkWindow.c to remove Tk's Tcl commands from the interpreter when the main window is deleted (otherwise there will be dangling pointers to the non-existent window). @@ -4007,24 +4007,24 @@ 9/18/97 (bug fix) Revamped Macintosh focus code. Cut, Copy & Paste virtual events now go to the correct (focus) window. (RJ) 9/19/97 (bug fix) Made Macintosh tearoff menus non-resizable. (RJ) + +10/9/97 (bug fix) Default font for new canvas text items was hardcoded to +"Helvetica 12" instead of using DEF_CANVTEXT_FONT defined in +tk{platform}Default.h like all the other widget settings. (CCS) 10/9/97 (bug fix) Image code could cause crashes during "exit" under some conditions (such as an image named "place"). (JO) 10/9/97 (bug fix) Fixed bug that sometimes prevented listboxes from scrolling far enough horizontally to see the rightmost character. (JO) -10/9/97 (bug fix) Default font for new canvas text items was hardcoded to -"Helvetica 12" instead of using DEF_CANVTEXT_FONT defined in -tk{platform}Default.h like all the other widget settings. (CCS) - -10/10/97 (bug fix) In canvas text items, if the text ended with a \n, it -was not counted in the bbox height, as it did in tk4.2. This caused -"hello\n" to be the same height as "hello" and you couldn't see the +10/10/97 (bug fix) In canvas text items, if the text ended with a \n, it +was not counted in the bbox height, as it did in tk4.2. This caused +"hello\n" to be the same height as "hello" and you couldn't see the cursor positioned on the next line. (CCS) 10/10/97 (bug fix) The grid geometry manager didn't always properly forget about windows after a "grid forget" or "grid remove" command: the windows could reappear on the screen later. (JO) @@ -4125,5 +4125,460 @@ 11/20/97 (enhancement) Made the changes required to work with the new Apple Universal Headers V. 3.0 so we can compile with CW Pro 2.0 (JI) ----------------- Released 8.0p2, 11/25/97 ----------------------- + +11/25/97 (security bug fix + added feature) Tk Safe Init now asks +the master's safe::TkInit for the 'argv' to use. This is transparently +dealt with by the safe::loadTk API. New optional "-display displayName" +argument to safe::loadTk, and the "-use" argument accepts both window +Ids and Tk window names: see loadTk(n). Made the ":0.0" default display +work on the Mac as it works on Windows and Unix. (DL) + +12/3/97 (bug fix/optimization) Removed unneeded and potentially dangerous +instances of double evaluations if "if" and "expr" statements from +the library files. It is recommended that unless you need a double +evaluation you always use "expr {...}" instead of "expr ..." and +"if {...} ..." instead of "if ... ...". It will also be faster +thanks to the byte compiler. (DL) + +12/3/97 (new feature) Added support for browser/plugin style embedding, +and made various other fixes to get the plugin working on the Mac. (JI) + +12/8/97 (bug fix) on Windows, using "winfo pathname" before "." was mapped +was crashing. (DL) + +---- Shipped as part of the plugin2.0b5 as 8.0p2Plugin1, Dec 8th 97 ---- + +12/97 (bug fix) more Macintosh embeding fixes needed for the plugin. (JI) + +Jan/9/98 (improvement) Allow applications to have custom init script +without having to patch the Tk core: Tk_Init will use an existing +"tkInit" proc if one exists in the interp where one tries to install Tk +instead of defining it's own (tkInit is the transient proc defined in +generic/tkInitScript.h that searches and sources tk.tcl and defines +the 'correct' tk_library). (DL) + +---- Shipped as part of the plugin2.0 as 8.0p2Plugin2, Jan 15th 98 ---- + +6/3/98 (bug fix) Fixed bugs in the tk_getOpenFile under Unix. + 1) If the -initialdir option was "." the result would be "././foo.tcl" + instead of an absolute path, like the Windows interface. + 2) There is a traceVar on the data(selectPath) where the script was + assumes the window exists. (BS) + +6/12/98 (feature change) Focus -force now sets the foreground window +on Windows platforms in addition to moving the focus. (SS) + +6/12/98 (bug fix) Fixed bug in Windows font measurement that did not +take kerning into account. (BS) + +6/24/98 (bug fix) On Unix, fixed -initialdir switch to tk_getOpenFile +and tk_getSaveFile to convert the specified directory to an absolute +path and to use the current working directory if the specified +directory does not exist. (SS) + +6/25/98 (bug fix) On Unix, both the Tk and the Motif file dialogs +would fail if the -parent flag changed between two parent windows that +had been previously used as file dialog parents. (SS) + +6/29/98 (compatibility patch) Added reserved fields to several Tk +structures to match additions made by Jan Nijtmans dash patch. This +means that extensions can be compiled against the dash patch +and still work with unpatched Tk, and vice versa. + +7/6/98 (bug fix) Added keysym definitions for the new keys on the +Microsoft keyboards. You can bind to , , and , +but you cannot use the Win keys as modifiers. (SS, BW) + +7/6/98 (new feature) Added support for the Macintosh Appearance Manager. (JI) + +7/24/98 (feature change) Eliminated the static variable that sets +tk_library and simplified search order for tk.tcl. The tk_library +variable can now be set before calling Tk_Init to avoid doing any +searches. If it isn't set, then Tk checks env(TK_LIBRARY), relative +to tcl_library, an install directory relative to the executable, a +source directory relative to the executable, and a tk directory +relative to the source heirarchy containing the executable. See the +comment at the top of generic/tkInitScript.h for more details. (SS) + +7/27/98 (bug fix) The bbox for coords in the canvas were incorrectly +including the center of the coord as part of the bound area. (RJ) + +8/4/98 (bug fix) Fixed memory leak in Windows menu code. (SS) + +8/4/98 (bug fix) Fixed bug where bgerror's were not being generated +from menu callbacks on Windows. (SS) + +8/4/98 (bug fix) Alt-key bindings were not being handled properly +under Windows, resulting in annoying beeps. (SS) + +8/4/98 (bug fix) Fixed bug in Windows menubar handling that allowed +a shared menubar to be deleted when any window using it was deleted. (SS) + +8/4/98 (feature change) Introduced TkReadBitmapFile to replace +XReadBitmapFile so that all Tk file opens go through the Tcl channel +mechanism. This lets us wrap applications that define their own +bitmaps and cursors. Note that XReadBitmapFile is no longer +emulated for non-unix platforms platforms (RJ, BW) + +8/5/98 (bug fix) binding in entries was masking the virtual +event <> binding to Shift-Insert on Windows. (SS) + +8/5/98 (bug fix) wm frame would crash if the window had not been +mapped yet on Windows. (SS) + +8/5/98 (bug fix) Local grabs did not exclude menus or the caption bar +under Windows. (SS) + +8/5/98 (bug fix) Reduced message traffic by setting +WS_EX_NOPARENTNOTIFY on TkChild windows. (SS) + +8/6/98 (feature change) Changed tkInitScript.h to use the new +tcl_findLibrary procedure to locate its script library. (BW) + +8/10/98 (bug fix) Added special case to font code to limit the +length of displayed strings to avoid wrap-around bugs in some +PC X servers when the pixel length of the string exceeds 0x7fff. (SS) + +8/12/98 (bug fix) Macintosh, lock down some of the resources +associated with menus to try and stabilise the menu system +on memory limited machines. (JI) + +8/12/98 (windows build change) Moved the tkConsole.obj into the tk80.dll +on windows. If you build your own Tk main program, you no longer +need to compile and link this yourself. (SKS) + +-------- Released 8.0.3 to the Tcl Consortium CD-ROM project, 8/13/98 ------ + +10/5/98 (new feature) Added the event "MouseWheel" that will fire on +Windows applications in response to mouse wheel movement. You can +bind to the MouseWheel event and use the %D substitution to get the +delta the wheel moved. The "event generate" command has also been +enhanced with the -delta flag so you can generate these events from +Tcl. See the bind and event man pages for more details. The listbox +and text widgets' default bindings have been updated to understand +MouseWheel events. (RJ) + +10/12/98 (performance improvement) Added hash table to canvas widget +that holds numeric ids for items. The hash table makes item lookup +almost constant time which improves certain canvas operations +(exspecially for canvases with large number items). Thanks to Mark +Weissman and Jan Nijtmans +for submitting this improvement. (RJ) + +10/15/98 (bug fix) The -fill option to text items in the canvas did +not allow the empty string as an argument (meaning transparent) even +though every other item type did. Thanks to Sebastian Wangnick + for supplying this patch. (RJ) + +10/20/98 (feature change) The Makefile and configure scripts have been +changed for IRIX to build n32 binaries instead of the old 32 abi +format. If you have extensions built with the o32 abi's you will need +to update them to n32 for them to work with Tcl. (RJ) +*** POTENTIAL INCOMPATIBILITY *** + +11/10/98 (feature change) The Macintosh menus will use the Appearance +Theme backgrounds, separators and menu shape, if Appearance version +1.0.1 or greater is installed. The version of Appearance that shipped +with MacOS 8.0 so it will not work with a straight 8.0, but it will +with MacOS 8.1 or later. (JI) + +----------------- Released 8.0.4, 11/20/98 ----------------------- + +11/24/98 (bug fix) On some X servers, XQueryLoadFont will always +return a font, even if the name is meaningless. This prevents Tk from +parsing the font name, so now we perform a quick sanity check on the +name before letting X have it. (stanton) + +12/30/98 (bug fix) Fixed bug in "grid forget" that failed to cancel +pending idle handlers, resulting in a crash in a few odd cases. (stanton) + +1/28/99 (configure change) Now support -pipe option on gcc. (RJ) + +2/4/99 (bug fix) Changed so color tables in photo images are freed +immediately instead of being delayed. This ensures that color tables +are properly disposed at process exit. (stanton) + +2/4/99 (bug fix) Changed postscript template to include a European +character with an umlaut when determining font height. (stanton) + +2/4/99 (bug fix) If an image bitmap mask changed but ended up with the +same XID, the GC failed to be updated and so the new mask was +not used. (stanton) + +2/4/99 (bug fix) Changed so focus window is always set if -force is +specified. This fixes the problem on Windows where Tk does not +activate the window if it already has focus. (stanton) + +2/4/99 (bug fix) Fixed so errors in console eval are reported +properly. Eliminated duplicate result messages. (stanton) + +2/4/99 (bug fix) Under Windows, changed so toplevels that aren't +resizable don't have resize handles and the zoom box is disabled. (stanton) + +2/4/99 (bug fix) Changed to cancel the mouse timer when a user +initiated move/resize loop begins on Windows. (stanton) + +2/4/99 (configure change) TK_LD_SEARCH_FLAGS was set incorrectly if +SHLIB_LD_LIBS='${LIBS}', and shared linking is performed through the C +compiler. Systems affected are Linux, MP-RAS and NEXTSTEP, but also +with gcc on many more systems. + +2/4/99 (bug fix) Changed some EXTERN declarations to extern since they +are not defining exported interfaces. This avoids generating useless +declspec() attributes and makes the Windows makefile simpler. (stanton) + +2/4/99 (bug fix) Changed so keyboard shortcuts will only be found in +the current toplevel. Previously, they might be found in menus +attached to other toplevels that might not even be mapped. (stanton) +*** POTENTIAL INCOMPATIBILITY *** + +2/4/99 (bug fix) Changed to treat zero width lines in the canvas like +they have width 1 for purposes of selection. (stanton) + +2/4/99 (bug fix) Added a workaround for a bug in GetTextExtentExPoint +on Win NT 4.0/Japanese that cause a crash in some cases. (stanton) + +2/4/99 (bug fix) Fixed uninitialized memory access bug in Unix send +code. (stanton) + +---------------------------------------------------------- +Changes for Tk 8.0 go above this line. +Changes for Tk 8.1 go below this line. +---------------------------------------------------------- + +1/16/98 (new feature) Tk now supports international characters sets: + - Font display mechanism overhauled to display Unicode strings + containing full set of international characters. You do not need + Unicode fonts on your system in order to use tk or see international + characters. For those familiar with the Japanese or Chinese patches, + there is no "-kanjifont" option. Characters from any available fonts + will automatically be used if the widget's originally selected font is + not capable of displaying a given character. + - Textual widgets are international aware. For instance, cursor + positioning commands would now move the cursor forwards/back by 1 + international character, not by 1 byte. + - Input Method Editors (IMEs) work on Mac and Windows. Unix is still in + progress. + +7/7/97 (new feature) The send command now works for Microsoft +Windows. It is implemented using Dynamic Data Exchange, and a new +command, dde, allows Tk to send more generic DDE commands to other +applications. (SRP) + +11/3/97 (new feature) Major overhaul of code that manages configuration +options to use Tcl_Obj structures instead of strings: + - There is a new set of procedures including Tk_CreateOptionTable, + Tk_InitOptions, and Tk_SetOptions, which replace Tk_ConfigureWidget + and related procedures. The old procedures are still available. + The new procedures use a new format for configuration tables. + See SetOptions.3 for more information. + - There are new procedures Tk_AllocColorFromObj, Tk_GetColorFromObj, + and Tk_FreeColorFromObj to manage colors using objects to hold the + name of the color and cache the corresponding XColor pointer. + There are similar procedures Tk_Alloc3DBorderFromObj, + Tk_AllocBitmapFromObj, Tk_AllocCursorFromObj, Tk_AllocFontFromObj, + and so on to manage borders, bitmaps, cursors, and fonts. + - The old-style procedures such as Tk_GetColor and Tk_GetBitmap no + longer take Tk_Uids for arguments; they just take strings. + - Menus, labels, buttons, checkbuttons, and radiobuttons have been + converted to use the new object-based configuration library. + (SRP & JO) + +11/7/97 (improvement) Changed code referring to "interp->result" to call +accessor functions like Tcl_SetResult(). + +12/23/97 (fix) Fixed transparency and web optimized the palette of +the images/ Tcl powered logos. (DL) + +12/16/97 (bug fix) Canvas and text "bind" subcommands generated an +error with no message if called to fetch a binding that didn't exist. +They now silently return without an error like the "bind" command. (SS) + +1/13/98 (bug fix) Keysyms for international characters were not being +reported properly under Windows. (SS) + +----------------- Released 8.1a1, 1/22/98 ----------------------- + +2/4/98 (bug fix) Calling XFreeFontNames() twice if couldn't allocate +font. (CCS) + +2/10/98 (bug fix) Inlined prolog.ps in tkCanvPs.c to make it accessible +from safe interpreters: canvas postscript now works in safe interps +(like in tk8.0plugin). (DL) + +2/11/98 (bug fix) Windows "send" to a remote interp wasn't propagating +$errorInfo correctly from the remote interp to the local invoking interp. +(CCS) + +2/11/98 (bug fix) Windows "send" should have accepted "--" to mean "no more +arguments". (CCS) + +2/11/98 (bug fix) Windows "send" was concatenating its arguments +incorrectly (not consistent with "eval", "uplevel", or Unix "send"). (CCS) + +2/18/98 (bug fix) Macintosh radiobuttons and checkbuttons now color +their backgrounds correctly under Appearance. The controls gadgets themselves +however, remain the Theme colors. (JI) + +2/18/98 (improvement) The corner pixels that peek through around the +rounded corners of the Mac button widget are now controlled by the +-highlightbackground, rather than the -background option. (JI) + +2/18/98 (improvement) Implemented the intra-application Send on the +Mac (RJ) + +2/18/98 (bug fix) Under X, a problem mapping from a fontStructPtr to an +XLFD (no XA_FONT attribute) would lead to dereferencing NULL. (CCS) + +----------------- Released 8.1a2, Feb 20 1998 ----------------------- + +10/21/98 (bug fix) Tk_UnderlineChars did not handle UTF strings properly +so underline indices were in bytes instead of characters. (stanton) + +11/19/98 (bug fix) Fixed menus and titles so they properly display +Unicode characters under Windows. [Bug: 819] (stanton) + +11/24/98 (bug fix) Fixed a bunch of memory leaks in the Windows menu +code. [Bug: 620] (stanton) + +11/25/98 (bug fix) Various small bug fixes: (stanton) + - hidemargin option was not honored properly in menus [Bug: 859] + - disabled menu entries were getting reenabled whenever the + mouse passed over the entry [Bug: 860] + - fixed deletion order bug where a crash would result if a + binding deleted "." + +11/30/98 (bug fix) The error result was getting lost when restoring +configuration options in buttons. [Bug: 619] (stanton) + +12/8/98 (bug fix) The Windows clipboard was not correctly traslating +multibyte characters. [Bug: 935] (stanton) + +----------------- Released 8.1b1, Dec 11 1998 ----------------------- + +1/29/99 (bug fix) Fixed bug in "grid forget" that failed to cancel +pending idle handlers, resulting in a crash in a few odd +cases. (stanton) + +2/4/99 (bug fix): Fixed uninitialized memory access in +Tk_SetAppName. [Bug: 919] (stanton) + +2/4/99 (bug fix): Added a workaround for a bug in GetTextExtentExPoint +on Win NT 4.0/Japanese. [Bug: 1006] (stanton) + +2/4/99 (bug fix): Changed so keyboard shortcuts for menus will only be +found in the current toplevel. Previously, they might be found in +menus attached to other toplevels that might not even be mapped. +[Bug: 924] (stanton) + +2/4/99 (bug fix): Changed to treat zero width lines in the canvas like +they have width 1 for purposes of selection. [Bug: 925] (stanton) + +2/4/99 (bug fix): TK_LD_SEARCH_FLAGS was set incorrectly if +SHLIB_LD_LIBS='${LIBS}', and shared linking is performed through the C +compiler. Systems affected are Linux, MP-RAS and NEXTSTEP, but also +with gcc on many more systems. [Bug: 908] (stanton) + +2/4/99 (feature enhancement): Changed so windows that aren't resizable +don't have resize handles and the zoom box is disabled on +Windows. (stanton) + +2/4/99 (bug fix): Fixed so errors in console eval are reported +properly. Eliminated duplicate result messages. [Bug: 973] (stanton) + +2/4/99 (bug fix): Changed so focus window is always set if -force is +specified. This fixes the problem on Windows where Tk does not +activate the window if it already has focus. (stanton) + +2/4/99 (bug fix): If an image mask changed but ended up with the same +XID, the GC failed to be updated and so the new mask was not +used. [Bug: 970] (stanton) + +2/12/99 (new feature): Tk is now thread safe. You enable this by +configuring with --enable-threads. Tcl must also be compiled with +--enable-threads. See Tcl for more information about the threading +interfaces. (lfb) + +2/25/99 (bug fix) Under Windows, wish can now inherit pipe handles on +stdio so it is possible to use the wish executable in a command +pipeline to capture the output of puts or read from the pipe with +gets. (redman) + +3/1/99 (bug fix) Under Windows, Tk was not properly handling focus and +activation changes in some cases. (redman) + +3/10/99 (new feature) Tk now uses the new stub library feature in Tcl. +The Tk library now contains no direct references to any symbols in +Tcl. In addition, there is a new Tk_MainEx() function that takes an +interpreter as an argument. See the Tcl documentation for more +information about the stubs mechanism. (redman) + +3/14/99 (feature change) Test suite now uses "test" namespace to +define the test procedure and other auxiliary procedures as well as +global variables. + - Global array testConfige is now called ::test::testConfig. + - Global variable VERBOSE is now called ::test::verbose, and + ::test::verbose no longer works with numerical values. We've + switched to a bitwise character string. You can set + ::test::verbose by using the -verbose option on the Tk command + line. + - Global variable TESTS is now called ::test::matchingTests, and + can be set on the Tk command line via the -match option. + - There is now a ::test::skipTests variable (works similarly to + ::test::matchTests) that can be set on the Tk command line via + the -match option. + - The test suite can now be run in any working directory. When + you run "make test", the working directory is nolonger switched + to ../tests. +(hirschl) +*** POTENTIAL INCOMPATIBILITY *** + +----------------- Released 8.1b2, March 16, 1999 --------------------- + +3/23/99 (feature change) Test suite now uses "tcltest" namespace to +define the test procedure and other auxiliary procedures as well as +global variables. The previously chosen "test" namespace was thought +to be too generic and likely to create conflits. +(hirschl) +*** POTENTIAL INCOMPATIBILITY *** + +3/26/99 [bug fix] Fixed bug reported by Bryan Oakley in the +menubutton bindings. There was a false assumption that there was +always a menu attached to the button. [Bug 1116] (surles) + +3/26/99 (feature change) Removed --enable-tcl-stub from the configure +script. Linking Tk to Tcl stubs is causing too many problems when +linking executables like wish. Until the Tk is a fully loadable +extension, linking against the Tcl stubs is not supported in Tk. +(redman) + +3/26/99 (feature change) --nameble-shared is now the default and builds +Tk as a shared library; specify --disable-shared to build a static Tk +library and shell. +*** POTENTIAL INCOMPATIBILITY *** + +3/29/99 (api change) Standardized text layout and font interfaces +so they are consistent with respect to byte versus character +oriented indices. The layout functions all manipulate character +oriented values while the lower level measurement functions all +operate on byte oriented values. (stanton) + +4/1/99 (bug fix) Image handlers are finalized before the font subsystem +to fix crashes during finalization of complex widgets. (stanton) + +4/1/99 (feature change) Removed the send command on Windows. Moved +the DDE basis of that command out to its own extension. The send +implementation on top of DDE was causing Tk to lock up in some cases. +(redman) + +4/5/99 (bug fix) Fixed handling of Unicode in text searches. The +-count option was returning byte counts instead of character counts. + +4/5/99 (feature change) Cut and paste to an entry widget returns the +selection instead of the widget contents, which can be different if the +-show option is used to hide the display. (stanton) + +--------------- Released 8.1b3, April 6, 1999 ---------------------- + Index: compat/limits.h ================================================================== --- compat/limits.h +++ compat/limits.h @@ -11,11 +11,11 @@ * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) limits.h 1.8 96/07/08 18:00:13 + * RCS: @(#) $Id: limits.h,v 1.1.4.1 1998/09/30 02:15:14 stanton Exp $ */ #define LONG_MIN 0x80000000 #define LONG_MAX 0x7fffffff #define INT_MIN 0x80000000 Index: compat/stdlib.h ================================================================== --- compat/stdlib.h +++ compat/stdlib.h @@ -7,16 +7,16 @@ * This file is needed even on many systems with their own * stdlib.h (e.g. SunOS) because not all stdlib.h files * declare all the procedures needed here (such as strtod). * * Copyright (c) 1991 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. + * Copyright (c) 1994-1998 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) stdlib.h 1.10 96/02/15 14:43:54 + * RCS: @(#) $Id: stdlib.h,v 1.1.4.2 1998/09/30 02:15:15 stanton Exp $ */ #ifndef _STDLIB #define _STDLIB Index: compat/unistd.h ================================================================== --- compat/unistd.h +++ compat/unistd.h @@ -10,11 +10,11 @@ * notice appear in all copies. The University of California * makes no representations about the suitability of this * software for any purpose. It is provided "as is" without * express or implied warranty. * - * SCCS: @(#) unistd.h 1.7 96/02/15 14:43:57 + * RCS: @(#) $Id: unistd.h,v 1.1.4.1 1998/09/30 02:15:15 stanton Exp $ */ #ifndef _UNISTD #define _UNISTD Index: doc/3DBorder.3 ================================================================== --- doc/3DBorder.3 +++ doc/3DBorder.3 @@ -1,25 +1,33 @@ '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) 3DBorder.3 1.23 96/11/17 15:03:05 +'\" RCS: @(#) $Id: 3DBorder.3,v 1.1.4.2 1998/09/30 02:15:16 stanton Exp $ '\" .so man.macros -.TH Tk_Get3DBorder 3 4.0 Tk "Tk Library Procedures" +.TH Tk_Alloc3DBorderFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_Get3DBorder, Tk_Draw3DRectangle, Tk_Fill3DRectangle, Tk_Draw3DPolygon, Tk_Fill3DPolygon, Tk_3DVerticalBevel, Tk_3DHorizontalBevel, Tk_SetBackgroundFromBorder, Tk_NameOf3DBorder, Tk_3DBorderColor, Tk_3DBorderGC, Tk_Free3DBorder \- draw borders with three-dimensional appearance +Tk_Alloc3DBorderFromObj, Tk_Get3DBorder, Tk_Get3DBorderFromObj, Tk_Draw3DRectangle, Tk_Fill3DRectangle, Tk_Draw3DPolygon, Tk_Fill3DPolygon, Tk_3DVerticalBevel, Tk_3DHorizontalBevel, Tk_SetBackgroundFromBorder, Tk_NameOf3DBorder, Tk_3DBorderColor, Tk_3DBorderGC, Tk_Free3DBorderFromObj, Tk_Free3DBorder \- draw borders with three-dimensional appearance .SH SYNOPSIS .nf \fB#include \fR .sp +.VS 8.1 +Tk_3DBorder +\fBTk_Alloc3DBorderFromObj(\fIinterp, tkwin, objPtr\fB)\fR +.sp Tk_3DBorder \fBTk_Get3DBorder(\fIinterp, tkwin, colorName\fB)\fR +.sp +Tk_3DBorder +\fBTk_Get3DBorderFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp void \fBTk_Draw3DRectangle(\fItkwin, drawable, border, x, y, width, height, borderWidth, relief\fB)\fR .sp void @@ -46,23 +54,32 @@ XColor * \fBTk_3DBorderColor(\fIborder\fB)\fR .sp GC * \fBTk_3DBorderGC(\fItkwin, border, which\fB)\fR +.sp +.VS 8.1 +\fBTk_Free3DBorderFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp \fBTk_Free3DBorder(\fIborder\fB)\fR .SH ARGUMENTS .AS "Tk_3DBorder" borderWidth .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window (for all procedures except \fBTk_Get3DBorder\fR, must be the window for which the border was allocated). -.AP Tk_Uid colorName in -Textual description of color corresponding to background (flat areas). -Illuminated edges will be brighter than this and shadowed edges will -be darker than this. +.AP Tcl_Obj *objPtr in +.VS 8.1 +Pointer to object whose value describes color corresponding to +background (flat areas). Illuminated edges will be brighter than +this and shadowed edges will be darker than this. +.AP char *colorName in +Same as \fIobjPtr\fR except value is supplied as a string rather +than an object. +.VE .AP Drawable drawable in X token for window or pixmap; indicates where graphics are to be drawn. Must either be the X window for \fItkwin\fR or a pixmap with the same screen and depth as \fItkwin\fR. .AP Tk_3DBorder border in @@ -127,26 +144,46 @@ .BE .SH DESCRIPTION .PP These procedures provide facilities for drawing window borders in a -way that produces a three-dimensional appearance. \fBTk_Get3DBorder\fR +way that produces a three-dimensional appearance. +.VS 8.1 +\fBTk_Alloc3DBorderFromObj\fR allocates colors and Pixmaps needed to draw a border in the window -given by the \fItkwin\fR argument. The \fIcolorName\fR -argument indicates what colors should be used in the border. -\fIColorName\fR may be any value acceptable to \fBTk_GetColor\fR. -The color indicated by \fIcolorName\fR will not actually be used in +given by the \fItkwin\fR argument. The value of \fIobjPtr\fR +is a standard Tk color name that determines the border colors. +The color indicated by \fIobjPtr\fR will not actually be used in the border; it indicates the background color for the window (i.e. a color for flat surfaces). The illuminated portions of the border will appear brighter than indicated -by \fIcolorName\fR, and the shadowed portions of the border will appear -darker than \fIcolorName\fR. +by \fIobjPtr\fR, and the shadowed portions of the border will appear +darker than \fIobjPtr\fR. .PP -\fBTk_Get3DBorder\fR returns a token that may be used in later calls +\fBTk_Alloc3DBorderFromObj\fR returns a token that may be used in later calls to \fBTk_Draw3DRectangle\fR. If an error occurs in allocating information -for the border (e.g. \fIcolorName\fR isn't a legal color specifier), +for the border (e.g. a bogus color name was given) then NULL is returned and an error message is left in \fIinterp->result\fR. +If it returns successfully, \fBTk_Alloc3DBorderFromObj\fR caches +information about the return value in \fIobjPtr\fR, which speeds up +future calls to \fBTk_Alloc3DBorderFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.PP +\fBTk_Get3DBorder\fR is identical to \fBTk_Alloc3DBorderFromObj\fR except +that the color is specified with a string instead of an object. This +prevents \fBTk_Get3DBorder\fR from caching the return value, so +\fBTk_Get3DBorder\fR is less efficient than \fBTk_Alloc3DBorderFromObj\fR. +.PP +\fBTk_Get3DBorderFromObj\fR returns the token for an existing border, given +the window and color name used to create the border. +\fBTk_Get3DBorderFromObj\fR doesn't actually create the border; it must +already have been created with a previous call to +\fBTk_Alloc3DBorderFromObj\fR or \fBTk_Get3DBorder\fR. The return +value is cached in \fIobjPtr\fR, which speeds up +future calls to \fBTk_Get3DBorderFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.VE .PP Once a border structure has been created, \fBTk_Draw3DRectangle\fR may be invoked to draw the border. The \fItkwin\fR argument specifies the window for which the border was allocated, and \fIdrawable\fR @@ -169,11 +206,11 @@ a groove or ridge around the exterior of the rectangle. .PP \fBTk_Fill3DRectangle\fR is somewhat like \fBTk_Draw3DRectangle\fR except that it first fills the rectangular area with the background color (one corresponding -to the \fIcolorName\fR used to create \fIborder\fR). Then it calls +to the color used to create \fIborder\fR). Then it calls \fBTk_Draw3DRectangle\fR to draw a border just inside the outer edge of the rectangular area. The argument \fIrelief\fR indicates the desired effect (TK_RELIEF_FLAT means no border should be drawn; all that happens is to fill the rectangle with the background color). .PP @@ -226,25 +263,23 @@ bottom bevel should be drawn with 0 for both arguments. .PP The procedure \fBTk_SetBackgroundFromBorder\fR will modify the background pixel and/or pixmap of \fItkwin\fR to produce a result compatible with \fIborder\fR. For color displays, the resulting background will -just be the color given by the \fIcolorName\fR argument passed to -\fBTk_Get3DBorder\fR when \fIborder\fR was created; for monochrome +just be the color specified when \fIborder\fR was created; for monochrome displays, the resulting background will be a light stipple pattern, in order to distinguish the background from the illuminated portion of the border. .PP Given a token for a border, the procedure \fBTk_NameOf3DBorder\fR -will return the \fIcolorName\fR string that was passed to -\fBTk_Get3DBorder\fR to create the border. +will return the color name that was used to create the border. .PP The procedure \fBTk_3DBorderColor\fR returns the XColor structure that will be used for flat surfaces drawn for its \fIborder\fR argument by procedures like \fBTk_Fill3DRectangle\fR. -The return value corresponds to the \fIcolorName\fR passed to -\fBTk_Get3DBorder\fR. +The return value corresponds to the color name that was used to +create the border. The XColor, and its associated pixel value, will remain allocated as long as \fIborder\fR exists. .PP The procedure \fBTk_3DBorderGC\fR returns one of the X graphics contexts that are used to draw the border. @@ -251,12 +286,20 @@ The argument \fIwhich\fR selects which one of the three possible GC's: TK_3D_FLAT_GC returns the context used for flat surfaces, TK_3D_LIGHT_GC returns the context for light shadows, and TK_3D_DARK_GC returns the context for dark shadows. .PP -When a border is no longer needed, \fBTk_Free3DBorder\fR should -be called to release the resources associated with the border. -There should be exactly one call to \fBTk_Free3DBorder\fR for -each call to \fBTk_Get3DBorder\fR. +.VS 8.1 +When a border is no longer needed, \fBTk_Free3DBorderFromObj\fR +or \fBTk_Free3DBorder\fR should +be called to release the resources associated with it. +For \fBTk_Free3DBorderFromObj\fR the border to release is specified +with the window and color name used to create the +border; for \fBTk_Free3DBorder\fR the border to release is specified +with the Tk_3DBorder token for the border. +There should be exactly one call to \fBTk_Free3DBorderFromObj\fR or +\fBTk_Free3DBorder\fR for each call to \fBTk_Alloc3DBorderFromObj\fR +or \fBTk_Get3DBorder\fR. +.VE .SH KEYWORDS -3D, background, border, color, depressed, illumination, polygon, raised, shadow, three-dimensional effect +3D, background, border, color, depressed, illumination, object, polygon, raised, shadow, three-dimensional effect Index: doc/BindTable.3 ================================================================== --- doc/BindTable.3 +++ doc/BindTable.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) BindTable.3 1.5 96/03/26 18:03:09 +'\" RCS: @(#) $Id: BindTable.3,v 1.1.4.1 1998/09/30 02:15:16 stanton Exp $ '\" .so man.macros .TH Tk_CreateBindingTable 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CanvPsY.3 ================================================================== --- doc/CanvPsY.3 +++ doc/CanvPsY.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CanvPsY.3 1.6 96/03/26 18:03:26 +'\" RCS: @(#) $Id: CanvPsY.3,v 1.1.4.1 1998/09/30 02:15:17 stanton Exp $ '\" .so man.macros .TH Tk_CanvasPsY 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CanvTkwin.3 ================================================================== --- doc/CanvTkwin.3 +++ doc/CanvTkwin.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CanvTkwin.3 1.8 96/08/27 13:21:54 +'\" RCS: @(#) $Id: CanvTkwin.3,v 1.1.4.1 1998/09/30 02:15:18 stanton Exp $ '\" .so man.macros .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CanvTxtInfo.3 ================================================================== --- doc/CanvTxtInfo.3 +++ doc/CanvTxtInfo.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CanvTxtInfo.3 1.8 96/03/26 18:03:51 +'\" RCS: @(#) $Id: CanvTxtInfo.3,v 1.1.4.1 1998/09/30 02:15:18 stanton Exp $ '\" .so man.macros .TH Tk_CanvasTextInfo 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/Clipboard.3 ================================================================== --- doc/Clipboard.3 +++ doc/Clipboard.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) Clipboard.3 1.5 96/03/26 18:04:10 +'\" RCS: @(#) $Id: Clipboard.3,v 1.1.4.1 1998/09/30 02:15:18 stanton Exp $ '\" .so man.macros .TH Tk_ClipboardClear 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/ClrSelect.3 ================================================================== --- doc/ClrSelect.3 +++ doc/ClrSelect.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ClrSelect.3 1.10 96/08/27 13:21:16 +'\" RCS: @(#) $Id: ClrSelect.3,v 1.1.4.1 1998/09/30 02:15:19 stanton Exp $ '\" .so man.macros .TH Tk_ClearSelection 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/ConfigWidg.3 ================================================================== --- doc/ConfigWidg.3 +++ doc/ConfigWidg.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ConfigWidg.3 1.30 96/08/27 13:21:18 +'\" RCS: @(#) $Id: ConfigWidg.3,v 1.1.4.2 1998/09/30 02:15:19 stanton Exp $ '\" .so man.macros .TH Tk_ConfigureWidget 3 4.1 Tk "Tk Library Procedures" .BS .SH NAME @@ -24,14 +24,15 @@ .sp int \fBTk_ConfigureInfo(\fIinterp, tkwin, specs, widgRec, argvName, flags\fB)\fR .sp int +\fBTk_ConfigureValue(\fIinterp, tkwin, specs, widgRec, argvName, flags\fB)\fR .sp \fBTk_FreeOptions(\fIspecs, widgRec, display, flags\fB)\fR .SH ARGUMENTS -.AS Tk_ConfigSpec *widgRec +.AS Tk_ConfigSpec *widgRec in/out .AP Tcl_Interp *interp in Interpreter to use for returning error messages. .AP Tk_Window tkwin in Window used to represent widget (needed to set up X resources). .AP Tk_ConfigSpec *specs in Index: doc/ConfigWind.3 ================================================================== --- doc/ConfigWind.3 +++ doc/ConfigWind.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ConfigWind.3 1.27 96/08/27 13:21:19 +'\" RCS: @(#) $Id: ConfigWind.3,v 1.1.4.1 1998/09/30 02:15:20 stanton Exp $ '\" .so man.macros .TH Tk_ConfigureWindow 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CoordToWin.3 ================================================================== --- doc/CoordToWin.3 +++ doc/CoordToWin.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CoordToWin.3 1.9 96/03/26 18:05:14 +'\" RCS: @(#) $Id: CoordToWin.3,v 1.1.4.1 1998/09/30 02:15:47 stanton Exp $ '\" .so man.macros .TH Tk_CoordsToWindow 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtErrHdlr.3 ================================================================== --- doc/CrtErrHdlr.3 +++ doc/CrtErrHdlr.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CrtErrHdlr.3 1.12 96/03/26 18:05:30 +'\" RCS: @(#) $Id: CrtErrHdlr.3,v 1.1.4.1 1998/09/30 02:15:47 stanton Exp $ '\" .so man.macros .TH Tk_CreateErrorHandler 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtGenHdlr.3 ================================================================== --- doc/CrtGenHdlr.3 +++ doc/CrtGenHdlr.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CrtGenHdlr.3 1.9 96/03/26 18:06:21 +'\" RCS: @(#) $Id: CrtGenHdlr.3,v 1.1.4.1 1998/09/30 02:15:47 stanton Exp $ '\" .so man.macros .TH Tk_CreateGenericHandler 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtImgType.3 ================================================================== --- doc/CrtImgType.3 +++ doc/CrtImgType.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CrtImgType.3 1.9 97/08/08 15:43:15 +'\" RCS: @(#) $Id: CrtImgType.3,v 1.1.4.1 1998/09/30 02:15:48 stanton Exp $ '\" .so man.macros .TH Tk_CreateImageType 3 8.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtItemType.3 ================================================================== --- doc/CrtItemType.3 +++ doc/CrtItemType.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1994-1995 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CrtItemType.3 1.7 96/02/16 10:30:28 +'\" RCS: @(#) $Id: CrtItemType.3,v 1.1.4.1 1998/09/30 02:15:48 stanton Exp $ '\" .so man.macros .TH Tk_CreateItemType 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtPhImgFmt.3 ================================================================== --- doc/CrtPhImgFmt.3 +++ doc/CrtPhImgFmt.3 @@ -7,11 +7,11 @@ '\" '\" Author: Paul Mackerras (paulus@cs.anu.edu.au), '\" Department of Computer Science, '\" Australian National University. '\" -'\" SCCS: @(#) CrtPhImgFmt.3 1.10 97/10/31 12:58:54 +'\" RCS: @(#) $Id: CrtPhImgFmt.3,v 1.1.4.1 1998/09/30 02:15:49 stanton Exp $ '\" .so man.macros .TH Tk_CreatePhotoImageFormat 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtSelHdlr.3 ================================================================== --- doc/CrtSelHdlr.3 +++ doc/CrtSelHdlr.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) CrtSelHdlr.3 1.18 96/08/27 13:21:21 +'\" RCS: @(#) $Id: CrtSelHdlr.3,v 1.1.4.1 1998/09/30 02:15:49 stanton Exp $ '\" .so man.macros .TH Tk_CreateSelHandler 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/CrtWindow.3 ================================================================== --- doc/CrtWindow.3 +++ doc/CrtWindow.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" @(#) CrtWindow.c 1.21 96/11/01 09:42:20 +'\" RCS: @(#) $Id: CrtWindow.3,v 1.1.4.2 1998/09/30 02:15:49 stanton Exp $ '\" .so man.macros .TH Tk_CreateWindow 3 4.2 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/DeleteImg.3 ================================================================== --- doc/DeleteImg.3 +++ doc/DeleteImg.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) DeleteImg.3 1.4 96/03/26 18:07:21 +'\" RCS: @(#) $Id: DeleteImg.3,v 1.1.4.1 1998/09/30 02:15:50 stanton Exp $ '\" .so man.macros .TH Tk_DeleteImage 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/DrawFocHlt.3 ================================================================== --- doc/DrawFocHlt.3 +++ doc/DrawFocHlt.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) DrawFocHlt.3 1.4 96/03/26 18:07:35 +'\" RCS: @(#) $Id: DrawFocHlt.3,v 1.1.4.1 1998/09/30 02:15:50 stanton Exp $ '\" .so man.macros .TH Tk_DrawFocusHighlight 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/EventHndlr.3 ================================================================== --- doc/EventHndlr.3 +++ doc/EventHndlr.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) EventHndlr.3 1.15 96/03/14 10:55:08 +'\" RCS: @(#) $Id: EventHndlr.3,v 1.1.4.1 1998/09/30 02:15:51 stanton Exp $ '\" .so man.macros .TH Tk_CreateEventHandler 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/FindPhoto.3 ================================================================== --- doc/FindPhoto.3 +++ doc/FindPhoto.3 @@ -7,11 +7,11 @@ '\" '\" Author: Paul Mackerras (paulus@cs.anu.edu.au), '\" Department of Computer Science, '\" Australian National University. '\" -'\" "@(#) FindPhoto.3 1.11 97/08/22 18:52:33" +'\" RCS: @(#) $Id: FindPhoto.3,v 1.1.4.1 1998/09/30 02:15:51 stanton Exp $ '\" .so man.macros .TH Tk_FindPhoto 3 8.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/FontId.3 ================================================================== --- doc/FontId.3 +++ doc/FontId.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) FontId.3 1.4 97/11/04 18:03:07 +'\" RCS: @(#) $Id: FontId.3,v 1.1.4.1 1998/09/30 02:15:51 stanton Exp $ '\" .so man.macros .TH Tk_FontId 3 8.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/FreeXId.3 ================================================================== --- doc/FreeXId.3 +++ doc/FreeXId.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) FreeXId.3 1.5 96/03/26 18:07:59 +'\" RCS: @(#) $Id: FreeXId.3,v 1.1.4.1 1998/09/30 02:15:52 stanton Exp $ '\" .so man.macros .TH Tk_FreeXId 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GeomReq.3 ================================================================== --- doc/GeomReq.3 +++ doc/GeomReq.3 @@ -4,11 +4,11 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" -'\" SCCS: @(#) GeomReq.3 1.11 96/03/26 18:08:21 +'\" RCS: @(#) $Id: GeomReq.3,v 1.1.4.1 1998/09/30 02:15:52 stanton Exp $ '\" .so man.macros .TH Tk_GeometryRequest 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetAnchor.3 ================================================================== --- doc/GetAnchor.3 +++ doc/GetAnchor.3 @@ -1,60 +1,82 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetAnchor.3 1.9 96/03/26 18:08:45 +'\" RCS: @(#) $Id: GetAnchor.3,v 1.1.4.2 1998/09/30 02:15:52 stanton Exp $ '\" .so man.macros -.TH Tk_GetAnchor 3 "" Tk "Tk Library Procedures" +.TH Tk_GetAnchorFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions +Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions .SH SYNOPSIS .nf \fB#include \fR +.sp +.VS 8.1 +int +\fBTk_GetAnchorFromObj(\fIinterp, objPtr, anchorPtr\fB)\fR +.VE .sp int \fBTk_GetAnchor(\fIinterp, string, anchorPtr\fB)\fR .sp char * \fBTk_NameOfAnchor(\fIanchor\fB)\fR .SH ARGUMENTS .AS "Tk_Anchor" *anchorPtr .AP Tcl_Interp *interp in -Interpreter to use for error reporting. +Interpreter to use for error reporting, or NULL. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value contains name of anchor point: \fBn\fR, \fBne\fR, +\fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR; +internal rep will be modified to cache corresponding Tk_Anchor. .AP char *string in -String containing name of anchor point: one of ``n'', ``ne'', ``e'', ``se'', -``s'', ``sw'', ``w'', ``nw'', or ``center''. +Same as \fIobjPtr\fR except description of anchor point is passed as +a string. +.VE .AP int *anchorPtr out Pointer to location in which to store anchor position corresponding to -\fIstring\fR. +\fIobjPtr\fR or \fIstring\fR. .AP Tk_Anchor anchor in Anchor position, e.g. \fBTCL_ANCHOR_CENTER\fR. .BE .SH DESCRIPTION .PP -\fBTk_GetAnchor\fR places in \fI*anchorPtr\fR an anchor position +.VS 8.1 +\fBTk_GetAnchorFromObj\fR places in \fI*anchorPtr\fR an anchor position (enumerated type \fBTk_Anchor\fR) -corresponding to \fIstring\fR, which will be one of +corresponding to \fIobjPtr\fR's value. The result will be one of \fBTK_ANCHOR_N\fR, \fBTK_ANCHOR_NE\fR, \fBTK_ANCHOR_E\fR, \fBTK_ANCHOR_SE\fR, \fBTK_ANCHOR_S\fR, \fBTK_ANCHOR_SW\fR, \fBTK_ANCHOR_W\fR, \fBTK_ANCHOR_NW\fR, or \fBTK_ANCHOR_CENTER\fR. Anchor positions are typically used for indicating a point on an object -that will be used to position that object, e.g. \fBTK_ANCHOR_N\fR means +that will be used to position the object, e.g. \fBTK_ANCHOR_N\fR means position the top center point of the object at a particular place. .PP Under normal circumstances the return value is \fBTCL_OK\fR and \fIinterp\fR is unused. If \fIstring\fR doesn't contain a valid anchor position -or an abbreviation of one of these names, then an error message is -stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and -\fI*anchorPtr\fR is unmodified. +or an abbreviation of one of these names, \fBTCL_ERROR\fR is returned, +\fI*anchorPtr\fR is unmodified, and an error message is +stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL. +\fBTk_GetAnchorFromObj\fR caches information about the return +value in \fIobjPtr\fR, which speeds up future calls to +\fBTk_GetAnchorFromObj\fR with the same \fIobjPtr\fR. +.PP +\fBTk_GetAnchor\fR is identical to \fBTk_GetAnchorFromObj\fR except +that the description of the anchor is specified with a string instead +of an object. This prevents \fBTk_GetAnchor\fR from caching the +return value, so \fBTk_GetAnchor\fR is less efficient than +\fBTk_GetAnchorFromObj\fR. +.VE .PP \fBTk_NameOfAnchor\fR is the logical inverse of \fBTk_GetAnchor\fR. Given an anchor position such as \fBTK_ANCHOR_N\fR it returns a statically-allocated string corresponding to \fIanchor\fR. If \fIanchor\fR isn't a legal anchor value, then Index: doc/GetBitmap.3 ================================================================== --- doc/GetBitmap.3 +++ doc/GetBitmap.3 @@ -1,44 +1,63 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetBitmap.3 1.27 97/08/22 18:52:11 +'\" RCS: @(#) $Id: GetBitmap.3,v 1.1.4.4 1999/04/07 00:36:10 stanton Exp $ '\" .so man.macros -.TH Tk_GetBitmap 3 8.0 Tk "Tk Library Procedures" +.TH Tk_AllocBitmapFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetBitmap, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmap, Tk_GetBitmapFromData \- maintain database of single-plane pixmaps +Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmapFromObj, Tk_FreeBitmap, Tk_GetBitmapFromData \- maintain database of single-plane pixmaps .SH SYNOPSIS .nf \fB#include \fR .sp +.VS 8.1 +Pixmap +\fBTk_GetBitmapFromObj(\fIinterp, tkwin, objPtr\fB)\fR +.sp +Pixmap +\fBTk_GetBitmap(\fIinterp, tkwin, info\fB)\fR +.sp Pixmap -\fBTk_GetBitmap(\fIinterp, tkwin, id\fB)\fR +\fBTk_GetBitmapFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp int -\fBTk_DefineBitmap(\fIinterp, nameId, source, width, height\fB)\fR +\fBTk_DefineBitmap(\fIinterp, name, source, width, height\fB)\fR .sp -Tk_Uid +char * \fBTk_NameOfBitmap(\fIdisplay, bitmap\fB)\fR .sp \fBTk_SizeOfBitmap(\fIdisplay, bitmap, widthPtr, heightPtr\fB)\fR +.sp +.VS 8.1 +\fBTk_FreeBitmapFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp \fBTk_FreeBitmap(\fIdisplay, bitmap\fB)\fR .SH ARGUMENTS .AS "unsigned long" *pixelPtr .AP Tcl_Interp *interp in -Interpreter to use for error reporting. +Interpreter to use for error reporting; if NULL then no error message +is left after errors. .AP Tk_Window tkwin in Token for window in which the bitmap will be used. -.AP Tk_Uid id in -Description of bitmap; see below for possible values. -.AP Tk_Uid nameId in +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value describes desired bitmap; internal rep will be +modified to cache pointer to corresponding Pixmap. +.AP "CONST char" *info in +Same as \fIobjPtr\fR except description of bitmap is passed as a string and +resulting Pixmap isn't cached. +.VE +.AP "CONST char" *name in Name for new bitmap to be defined. .AP char *source in Data for bitmap, in standard bitmap format. Must be stored in static memory whose value will never change. .AP "int" width in @@ -50,25 +69,28 @@ .AP "int" *heightPtr out Pointer to word to fill in with \fIbitmap\fR's height. .AP Display *display in Display for which \fIbitmap\fR was allocated. .AP Pixmap bitmap in -Identifier for a bitmap allocated by \fBTk_GetBitmap\fR. +Identifier for a bitmap allocated by \fBTk_AllocBitmapFromObj\fR or +\fBTk_GetBitmap\fR. .BE .SH DESCRIPTION .PP These procedures manage a collection of bitmaps (one-plane pixmaps) being used by an application. The procedures allow bitmaps to be re-used efficiently, thereby avoiding server overhead, and also allow bitmaps to be named with character strings. .PP -\fBTk_GetBitmap\fR takes as argument a Tk_Uid describing a bitmap. -It returns a Pixmap identifier for a bitmap corresponding to the -description. It re-uses an existing bitmap, if possible, and -creates a new one otherwise. At present, \fIid\fR must have -one of the following forms: +.VS 8.1 +\fBTk_AllocBitmapFromObj\fR returns a Pixmap identifier for a bitmap +that matches the description in \fIobjPtr\fR and is suitable for use +in \fItkwin\fR. It re-uses an existing bitmap, if possible, and +creates a new one otherwise. \fIObjPtr\fR's value must have one +of the following forms: +.VE .TP 20 \fB@\fIfileName\fR \fIFileName\fR must be the name of a file containing a bitmap description in the standard X11 or X10 format. .TP 20 @@ -164,19 +186,39 @@ .TP 12 \fBcaution\fR A triangle with an exclamation point. .RE .LP -Under normal conditions, \fBTk_GetBitmap\fR +.VS 8.1 +Under normal conditions, \fBTk_AllocBitmapFromObj\fR returns an identifier for the requested bitmap. If an error -occurs in creating the bitmap, such as when \fIid\fR refers +occurs in creating the bitmap, such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR is returned and an error -message is left in \fIinterp->result\fR. +message is left in \fIinterp\fR's result if \fIinterp\fR isn't +NULL. \fBTk_AllocBitmapFromObj\fR caches information about the return +value in \fIobjPtr\fR, which speeds up future calls to procedures +such as \fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmapFromObj\fR. +.PP +\fBTk_GetBitmap\fR is identical to \fBTk_AllocBitmapFromObj\fR except +that the description of the bitmap is specified with a string instead +of an object. This prevents \fBTk_GetBitmap\fR from caching the +return value, so \fBTk_GetBitmap\fR is less efficient than +\fBTk_AllocBitmapFromObj\fR. +.PP +\fBTk_GetBitmapFromObj\fR returns the token for an existing bitmap, given +the window and description used to create the bitmap. +\fBTk_GetBitmapFromObj\fR doesn't actually create the bitmap; the bitmap +must already have been created with a previous call to +\fBTk_AllocBitmapFromObj\fR or \fBTk_GetBitmap\fR. The return +value is cached in \fIobjPtr\fR, which speeds up +future calls to \fBTk_GetBitmapFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.VE .PP \fBTk_DefineBitmap\fR associates a name with in-memory bitmap data so that the name can be used in later -calls to \fBTk_GetBitmap\fR. The \fInameId\fR +calls to \fBTk_AllocBitmapFromObj\fR or \fBTk_GetBitmap\fR. The \fInameId\fR argument gives a name for the bitmap; it must not previously have been used in a call to \fBTk_DefineBitmap\fR. The arguments \fIsource\fR, \fIwidth\fR, and \fIheight\fR describe the bitmap. \fBTk_DefineBitmap\fR normally returns TCL_OK; if an error occurs @@ -184,83 +226,93 @@ TCL_ERROR is returned and an error message is left in \fIinterp->result\fR. Note: \fBTk_DefineBitmap\fR expects the memory pointed to by \fIsource\fR to be static: \fBTk_DefineBitmap\fR doesn't make a private copy of this memory, but uses the bytes pointed to -by \fIsource\fR later in calls to \fBTk_GetBitmap\fR. +by \fIsource\fR later in calls to \fBTk_AllocBitmapFromObj\fR or +\fBTk_GetBitmap\fR. .PP Typically \fBTk_DefineBitmap\fR is used by \fB#include\fR-ing a bitmap file directly into a C program and then referencing the variables defined by the file. For example, suppose there exists a file \fBstip.bitmap\fR, which was created by the \fBbitmap\fR program and contains a stipple pattern. The following code uses \fBTk_DefineBitmap\fR to define a new bitmap named \fBfoo\fR: +.VS .CS Pixmap bitmap; #include "stip.bitmap" -Tk_DefineBitmap(interp, Tk_GetUid("foo"), stip_bits, +Tk_DefineBitmap(interp, "foo", stip_bits, stip_width, stip_height); \&... -bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("foo")); +bitmap = Tk_GetBitmap(interp, tkwin, "foo"); .CE +.VE This code causes the bitmap file to be read at compile-time and incorporates the bitmap information into the program's executable image. The same bitmap file could be read at run-time using \fBTk_GetBitmap\fR: +.VS .CS Pixmap bitmap; -bitmap = Tk_GetBitmap(interp, tkwin, Tk_GetUid("@stip.bitmap")); +bitmap = Tk_GetBitmap(interp, tkwin, "@stip.bitmap"); .CE +.VE The second form is a bit more flexible (the file could be modified after the program has been compiled, or a different string could be provided to read a different file), but it is a little slower and requires the bitmap file to exist separately from the program. .PP -\fBTk_GetBitmap\fR maintains a -database of all the bitmaps that are currently in use. +Tk maintains a database of all the bitmaps that are currently in use. Whenever possible, it will return an existing bitmap rather than creating a new one. +When a bitmap is no longer used, Tk will release it automatically. This approach can substantially reduce server overhead, so -\fBTk_GetBitmap\fR should generally be used in preference to Xlib -procedures like \fBXReadBitmapFile\fR. +\fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmap\fR should generally +be used in preference to Xlib procedures like \fBXReadBitmapFile\fR. .PP -The bitmaps returned by \fBTk_GetBitmap\fR +The bitmaps returned by \fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmap\fR are shared, so callers should never modify them. If a bitmap must be modified dynamically, then it should be created by calling Xlib procedures such as \fBXReadBitmapFile\fR or \fBXCreatePixmap\fR directly. .PP The procedure \fBTk_NameOfBitmap\fR is roughly the inverse of \fBTk_GetBitmap\fR. -Given an X Pixmap argument, it returns the \fIid\fR that was +Given an X Pixmap argument, it returns the textual description that was passed to \fBTk_GetBitmap\fR when the bitmap was created. \fIBitmap\fR must have been the return value from a previous -call to \fBTk_GetBitmap\fR. +call to \fBTk_AllocBitmapFromObj\fR or \fBTk_GetBitmap\fR. .PP \fBTk_SizeOfBitmap\fR returns the dimensions of its \fIbitmap\fR argument in the words pointed to by the \fIwidthPtr\fR and \fIheightPtr\fR arguments. As with \fBTk_NameOfBitmap\fR, -\fIbitmap\fR must have been created by \fBTk_GetBitmap\fR. +\fIbitmap\fR must have been created by \fBTk_AllocBitmapFromObj\fR or +\fBTk_GetBitmap\fR. .PP -When a bitmap returned by \fBTk_GetBitmap\fR -is no longer needed, \fBTk_FreeBitmap\fR should be called to release it. -There should be exactly one call to \fBTk_FreeBitmap\fR for -each call to \fBTk_GetBitmap\fR. -When a bitmap is no longer in use anywhere (i.e. it has been freed as -many times as it has been gotten) \fBTk_FreeBitmap\fR will release -it to the X server and delete it from the database. +.VS 8.1 +When a bitmap is no longer needed, \fBTk_FreeBitmapFromObj\fR or +\fBTk_FreeBitmap\fR should be called to release it. +For \fBTk_FreeBitmapFromObj\fR the bitmap to release is specified +with the same information used to create it; for +\fBTk_FreeBitmap\fR the bitmap to release is specified +with its Pixmap token. +There should be exactly one call to \fBTk_FreeBitmapFromObj\fR +or \fBTk_FreeBitmap\fR for each call to \fBTk_AllocBitmapFromObj\fR or +\fBTk_GetBitmap\fR. +.VE .SH BUGS In determining whether an existing bitmap can be used to satisfy -a new request, \fBTk_GetBitmap\fR -considers only the immediate value of its \fIid\fR argument. For +a new request, \fBTk_AllocBitmapFromObj\fR and \fBTk_GetBitmap\fR +consider only the immediate value of the string description. For example, when a file name is passed to \fBTk_GetBitmap\fR, \fBTk_GetBitmap\fR will assume it is safe to re-use an existing bitmap created from the same file name: it will not check to see whether the file itself has changed, or whether the current directory has changed, thereby causing the name to refer to a different file. .SH KEYWORDS bitmap, pixmap Index: doc/GetCapStyl.3 ================================================================== --- doc/GetCapStyl.3 +++ doc/GetCapStyl.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetCapStyl.3 1.9 96/03/26 18:09:14 +'\" RCS: @(#) $Id: GetCapStyl.3,v 1.1.4.1 1998/09/30 02:15:53 stanton Exp $ '\" .so man.macros .TH Tk_GetCapStyle 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetClrmap.3 ================================================================== --- doc/GetClrmap.3 +++ doc/GetClrmap.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetClrmap.3 1.5 96/03/26 18:09:27 +'\" RCS: @(#) $Id: GetClrmap.3,v 1.1.4.1 1998/09/30 02:15:53 stanton Exp $ '\" .so man.macros .TH Tk_GetColormap 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetColor.3 ================================================================== --- doc/GetColor.3 +++ doc/GetColor.3 @@ -1,63 +1,87 @@ '\" -'\" Copyright (c) 1990, 1991 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1990-1991 The Regents of the University of California. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetColor.3 1.22 96/08/27 13:21:26 +'\" RCS: @(#) $Id: GetColor.3,v 1.1.4.2 1998/09/30 02:15:54 stanton Exp $ '\" .so man.macros -.TH Tk_GetColor 3 4.0 Tk "Tk Library Procedures" +.TH Tk_AllocColorFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetColor, Tk_GetColorByValue, Tk_NameOfColor, Tk_FreeColor \- maintain database of colors +Tk_AllocColorFromObj, Tk_GetColor, Tk_GetColorFromObj, Tk_GetColorByValue, Tk_NameOfColor, Tk_FreeColorFromObj, Tk_FreeColor \- maintain database of colors .SH SYNOPSIS .nf \fB#include \fR +.VS 8.1 +.sp +XColor * +\fBTk_AllocColorFromObj(\fIinterp, tkwin, objPtr\fB)\fR +.sp +XColor * +\fBTk_GetColor(\fIinterp, tkwin, name\fB)\fR .sp XColor * -\fBTk_GetColor\fR(\fIinterp, tkwin, nameId\fB)\fR +\fBTk_GetColorFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp XColor * -\fBTk_GetColorByValue\fR(\fItkwin, prefPtr\fB)\fR +\fBTk_GetColorByValue(\fItkwin, prefPtr\fB)\fR .sp char * \fBTk_NameOfColor(\fIcolorPtr\fB)\fR .sp GC -\fBTk_GCForColor\fR(\fIcolorPtr, drawable\fR) +\fBTk_GCForColor(\fIcolorPtr, drawable\fB)\fR +.sp +.VS 8.1 +\fBTk_FreeColorFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp \fBTk_FreeColor(\fIcolorPtr\fB)\fR .SH ARGUMENTS .AS "Tcl_Interp" *colorPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which color will be used. -.AP Tk_Uid nameId in -Textual description of desired color. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value describes desired color; internal rep will be +modified to cache pointer to corresponding (XColor *). +.AP char *name in +Same as \fIobjPtr\fR except description of color is passed as a string and +resulting (XColor *) isn't cached. +.VE .AP XColor *prefPtr in Indicates red, green, and blue intensities of desired color. .AP XColor *colorPtr in Pointer to X color information. Must have been allocated by previous -call to \fBTk_GetColor\fR or \fBTk_GetColorByValue\fR, except when passed -to \fBTk_NameOfColor\fR. +call to \fBTk_AllocColorFromObj\fR, \fBTk_GetColor\fR or +\fBTk_GetColorByValue\fR, except when passed to \fBTk_NameOfColor\fR. .AP Drawable drawable in Drawable in which the result graphics context will be used. Must have same screen and depth as the window for which the color was allocated. .BE .SH DESCRIPTION +.VS 8.1 +.PP +These procedures manage the colors being used by a Tk application. +They allow colors to be shared whenever possible, so that colormap +space is preserved, and they pick closest available colors when +colormap space is exhausted. .PP -The \fBTk_GetColor\fR and \fBTk_GetColorByValue\fR procedures -locate pixel values that may be used to render particular -colors in the window given by \fItkwin\fR. In \fBTk_GetColor\fR -the desired color is specified with a Tk_Uid (\fInameId\fR), which -may have any of the following forms: +Given a textual description of a color, \fBTk_AllocColorFromObj\fR +locates a pixel value that may be used to render the color +in a particular window. The desired color is specified with an +object whose string value must have one of the following forms: +.VE .TP 20 \fIcolorname\fR Any of the valid textual names for a color defined in the server's color database file, such as \fBred\fR or \fBPeachPuff\fR. .TP 20 @@ -74,73 +98,93 @@ colors to be specified with 4-bit, 8-bit, 12-bit or 16-bit values. When fewer than 16 bits are provided for each color, they represent the most significant bits of the color. For example, #3a7 is the same as #3000a0007000. .PP -In \fBTk_GetColorByValue\fR, the desired color is indicated with -the \fIred\fR, \fIgreen\fR, and \fIblue\fR fields of the structure -pointed to by \fIcolorPtr\fR. -.PP -If \fBTk_GetColor\fR or \fBTk_GetColorByValue\fR is successful -in allocating the desired color, then it returns a pointer to +.VS 8.1 +\fBTk_AllocColorFromObj\fR returns a pointer to an XColor structure; the structure indicates the exact intensities of the allocated color (which may differ slightly from those requested, depending on the limitations of the screen) and a pixel value -that may be used to draw in the color. -If the colormap for \fItkwin\fR is full, \fBTk_GetColor\fR -and \fBTk_GetColorByValue\fR will use the closest existing color -in the colormap. -If \fBTk_GetColor\fR encounters an error while allocating -the color (such as an unknown color name) then NULL is returned and -an error message is stored in \fIinterp->result\fR; -\fBTk_GetColorByValue\fR never returns an error. +that may be used to draw with the color in \fItkwin\fR. +If an error occurs in \fBTk_AllocColorFromObj\fR (such as an unknown +color name) then NULL is returned and an error message is stored in +\fIinterp\fR's result if \fIinterp\fR isn't NULL. +If the colormap for \fItkwin\fR is full, \fBTk_AllocColorFromObj\fR +will use the closest existing color in the colormap. +\fBTk_AllocColorFromObj\fR caches information about +the return value in \fIobjPtr\fR, which speeds up future calls to procedures +such as \fBTk_AllocColorFromObj\fR and \fBTk_GetColorFromObj\fR. +.PP +\fBTk_GetColor\fR is identical to \fBTk_AllocColorFromObj\fR except +that the description of the color is specified with a string instead +of an object. This prevents \fBTk_GetColor\fR from caching the +return value, so \fBTk_GetColor\fR is less efficient than +\fBTk_AllocColorFromObj\fR. +.PP +\fBTk_GetColorFromObj\fR returns the token for an existing color, given +the window and description used to create the color. +\fBTk_GetColorFromObj\fR doesn't actually create the color; the color +must already have been created with a previous call to +\fBTk_AllocColorFromObj\fR or \fBTk_GetColor\fR. The return +value is cached in \fIobjPtr\fR, which speeds up +future calls to \fBTk_GetColorFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.VE +.PP +\fBTk_GetColorByValue\fR is similar to \fBTk_GetColor\fR except that +the desired color is indicated with the \fIred\fR, \fIgreen\fR, and +\fIblue\fR fields of the structure pointed to by \fIcolorPtr\fR. .PP -\fBTk_GetColor\fR and \fBTk_GetColorByValue\fR maintain a database +This package maintains a database of all the colors currently in use. -If the same \fInameId\fR is requested multiple times from -\fBTk_GetColor\fR (e.g. by different windows), or if the +If the same color is requested multiple times from +\fBTk_GetColor\fR or \fBTk_AllocColorFromObj\fR (e.g. by different +windows), or if the same intensities are requested multiple times from \fBTk_GetColorByValue\fR, then existing pixel values will be re-used. Re-using an existing pixel avoids any interaction -with the X server, which makes the allocation much more -efficient. For this reason, you should generally use -\fBTk_GetColor\fR or \fBTk_GetColorByValue\fR -instead of Xlib procedures like \fBXAllocColor\fR, -\fBXAllocNamedColor\fR, or \fBXParseColor\fR. +with the window server, which makes the allocation much more +efficient. These procedures also provide a portable interface that +works across all platforms. For this reason, you should generally use +\fBTk_AllocColorFromObj\fR, \fBTk_GetColor\fR, or \fBTk_GetColorByValue\fR +instead of lower level procedures like \fBXAllocColor\fR. .PP -Since different calls to \fBTk_GetColor\fR or \fBTk_GetColorByValue\fR +Since different calls to this package may return the same shared pixel value, callers should never change the color of a pixel returned by the procedures. If you need to change a color value dynamically, you should use \fBXAllocColorCells\fR to allocate the pixel value for the color. .PP The procedure \fBTk_NameOfColor\fR is roughly the inverse of \fBTk_GetColor\fR. If its \fIcolorPtr\fR argument was created -by \fBTk_GetColor\fR, then the return value is the \fInameId\fR -string that was passed to \fBTk_GetColor\fR to create the +by \fBTk_AllocColorFromObj\fR or \fBTk_GetColor\fR then the return value +is the string that was used to create the color. If \fIcolorPtr\fR was created by a call to \fBTk_GetColorByValue\fR, or by any other mechanism, then the return value is a string that could be passed to \fBTk_GetColor\fR to return the same color. Note: the string returned by \fBTk_NameOfColor\fR is -only guaranteed to persist until the next call to \fBTk_NameOfColor\fR. +only guaranteed to persist until the next call to +\fBTk_NameOfColor\fR. .PP -\fBTk_GCForColor\fR returns a graphics context whose \fBForeground\fR +\fBTk_GCForColor\fR returns a graphics context whose \fBforeground\fR field is the pixel allocated for \fIcolorPtr\fR and whose other fields all have default values. This provides an easy way to do basic drawing with a color. The graphics context is cached with the color and will exist only as long as \fIcolorPtr\fR exists; it is freed when the last reference to \fIcolorPtr\fR is freed by calling \fBTk_FreeColor\fR. .PP -When a pixel value returned by \fBTk_GetColor\fR or -\fBTk_GetColorByValue\fR is no longer -needed, \fBTk_FreeColor\fR should be called to release the color. -There should be exactly one call to \fBTk_FreeColor\fR for -each call to \fBTk_GetColor\fR or \fBTk_GetColorByValue\fR. -When a pixel value is no longer in -use anywhere (i.e. it has been freed as many times as it has been gotten) -\fBTk_FreeColor\fR will release it to the X server and delete it from -the database. - +.VS 8.1 +When a color is no longer needed \fBTk_FreeColorFromObj\fR or +\fBTk_FreeColor\fR should be called to release it. +For \fBTk_FreeColorFromObj\fR the color to release is specified +with the same information used to create it; for +\fBTk_FreeColor\fR the color to release is specified +with a pointer to its XColor structure. +There should be exactly one call to \fBTk_FreeColorFromObj\fR +or \fBTk_FreeColor\fR for each call to \fBTk_AllocColorFromObj\fR, +\fBTk_GetColor\fR, or \fBTk_GetColorByValue\fR. +.VE .SH KEYWORDS -color, intensity, pixel value +color, intensity, object, pixel value Index: doc/GetCursor.3 ================================================================== --- doc/GetCursor.3 +++ doc/GetCursor.3 @@ -1,45 +1,63 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetCursor.3 1.23 96/08/27 13:21:26 +'\" RCS: @(#) $Id: GetCursor.3,v 1.1.4.2 1998/09/30 02:15:54 stanton Exp $ '\" .so man.macros -.TH Tk_GetCursor 3 4.1 Tk "Tk Library Procedures" +.TH Tk_AllocCursorFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetCursor, Tk_GetCursorFromData, Tk_NameOfCursor, Tk_FreeCursor \- maintain database of cursors +Tk_AllocCursorFromObj, Tk_GetCursor, Tk_GetCursorFromObj, Tk_GetCursorFromData, Tk_NameOfCursor, Tk_FreeCursorFromObj, Tk_FreeCursor \- maintain database of cursors .SH SYNOPSIS .nf \fB#include \fR .sp +.VS 8.1 +Tk_Cursor +\fBTk_AllocCursorFromObj(\fIinterp, tkwin, objPtr\fB)\fR +.sp +Tk_Cursor +\fBTk_GetCursor(\fIinterp, tkwin, name\fB)\fR +.sp Tk_Cursor -\fBTk_GetCursor(\fIinterp, tkwin, nameId\fB)\fR +\fBTk_GetCursorFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp Tk_Cursor \fBTk_GetCursorFromData(\fIinterp, tkwin, source, mask, width, height, xHot, yHot, fg, bg\fB)\fR .sp char * \fBTk_NameOfCursor(\fIdisplay, cursor\fB)\fR +.sp +.VS 8.1 +\fBTk_FreeCursorFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp \fBTk_FreeCursor(\fIdisplay, cursor\fB)\fR .SH ARGUMENTS .AS "unsigned long" *pixelPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Token for window in which the cursor will be used. -.AP Tk_Uid nameId in -Description of cursor; see below for possible values. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +Description of cursor; see below for possible values. Internal rep will be +modified to cache pointer to corresponding Tk_Cursor. +.AP char *name in +Same as \fIobjPtr\fR except description of cursor is passed as a string and +resulting Tk_Cursor isn't cached. +.VE .AP char *source in -Data for cursor bitmap, in standard bitmap format. +Data for cursor cursor, in standard cursor format. .AP char *mask in -Data for mask bitmap, in standard bitmap format. +Data for mask cursor, in standard cursor format. .AP "int" width in Width of \fIsource\fR and \fImask\fR. .AP "int" height in Height of \fIsource\fR and \fImask\fR. .AP "int" xHot in @@ -51,32 +69,39 @@ .AP Tk_Uid bg in Textual description of background color for cursor. .AP Display *display in Display for which \fIcursor\fR was allocated. .AP Tk_Cursor cursor in -Opaque Tk identifier for cursor. If passed to\fBTk_FreeCursor\fR, must +Opaque Tk identifier for cursor. If passed to \fBTk_FreeCursor\fR, must have been returned by some previous call to \fBTk_GetCursor\fR or \fBTk_GetCursorFromData\fR. .BE .SH DESCRIPTION .PP These procedures manage a collection of cursors being used by an application. The procedures allow cursors to be re-used efficiently, thereby avoiding server overhead, and also -allow cursors to be named with character strings (actually Tk_Uids). +allow cursors to be named with character strings. .PP -\fBTk_GetCursor\fR takes as argument a Tk_Uid describing a cursor, -and returns an opaque Tk identifier for a cursor corresponding to the -description. -It re-uses an existing cursor if possible and -creates a new one otherwise. \fINameId\fR must be a standard Tcl +.VS 8.1 +\fBTk_AllocCursorFromObj\fR takes as argument an object describing a +cursor, and returns an opaque Tk identifier for a cursor corresponding +to the description. It re-uses an existing cursor if possible and +creates a new one otherwise. \fBTk_AllocCursorFromObj\fR caches +information about the return value in \fIobjPtr\fR, which speeds up +future calls to procedures such as \fBTk_AllocCursorFromObj\fR and +\fBTk_GetCursorFromObj\fR. If an error occurs in creating the cursor, +such as when \fIobjPtr\fR refers to a non-existent file, then \fBNone\fR +is returned and an error message will be stored in \fIinterp\fR's result +if \fIinterp\fR isn't NULL. \fIObjPtr\fR must contain a standard Tcl list with one of the following forms: +.VE .TP \fIname\fR\0[\fIfgColor\fR\0[\fIbgColor\fR]] -\fIName\fR is the name of a cursor in the standard X cursor font, -i.e., any of the names defined in \fBcursorfont.h\fR, without +\fIName\fR is the name of a cursor in the standard X cursor cursor, +i.e., any of the names defined in \fBcursorcursor.h\fR, without the \fBXC_\fR. Some example values are \fBX_cursor\fR, \fBhand2\fR, or \fBleft_ptr\fR. Appendix B of ``The X Window System'' by Scheifler & Gettys has illustrations showing what each of these cursors looks like. If \fIfgColor\fR and \fIbgColor\fR are both specified, they give the foreground and background colors to use @@ -84,25 +109,27 @@ may be used). If only \fIfgColor\fR is specified, then there will be no background color: the background will be transparent. If no colors are specified, then the cursor will use black for its foreground color and white for its background color. - -The Macintosh version of Tk also supports all of the X cursors. -Tk on the Mac will also accept any of the standard Mac cursors +.RS +.PP +The Macintosh version of Tk supports all of the X cursors and +will also accept any of the standard Mac cursors including \fBibeam\fR, \fBcrosshair\fR, \fBwatch\fR, \fBplus\fR, and \fBarrow\fR. In addition, Tk will load Macintosh cursor resources of the types \fBcrsr\fR (color) and \fBCURS\fR (black and white) by the name of the of the resource. The application and all its open dynamic library's resource files will be searched for the named cursor. If there are conflicts color cursors will always be loaded in preference to black and white cursors. +.RE .TP \fB@\fIsourceName\0maskName\0fgColor\0bgColor\fR In this form, \fIsourceName\fR and \fImaskName\fR are the names of -files describing bitmaps for the cursor's source bits and mask. -Each file must be in standard X11 or X10 bitmap format. +files describing cursors for the cursor's source bits and mask. +Each file must be in standard X11 or X10 cursor format. \fIFgColor\fR and \fIbgColor\fR indicate the colors to use for the cursor, in any of the forms acceptable to \fBTk_GetColor\fR. This form of the command will not work on Macintosh or Windows computers. .TP @@ -109,15 +136,32 @@ \fB@\fIsourceName\0fgColor\fR This form is similar to the one above, except that the source is used as mask also. This means that the cursor's background is transparent. This form of the command will not work on Macintosh or Windows computers. +.PP +.VS 8.1 +\fBTk_GetCursor\fR is identical to \fBTk_AllocCursorFromObj\fR except +that the description of the cursor is specified with a string instead +of an object. This prevents \fBTk_GetCursor\fR from caching the +return value, so \fBTk_GetCursor\fR is less efficient than +\fBTk_AllocCursorFromObj\fR. +.PP +\fBTk_GetCursorFromObj\fR returns the token for an existing cursor, given +the window and description used to create the cursor. +\fBTk_GetCursorFromObj\fR doesn't actually create the cursor; the cursor +must already have been created with a previous call to +\fBTk_AllocCursorFromObj\fR or \fBTk_GetCursor\fR. The return +value is cached in \fIobjPtr\fR, which speeds up +future calls to \fBTk_GetCursorFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.VE .PP \fBTk_GetCursorFromData\fR allows cursors to be created from -in-memory descriptions of their source and mask bitmaps. \fISource\fR -points to standard bitmap data for the cursor's source bits, and -\fImask\fR points to standard bitmap data describing +in-memory descriptions of their source and mask cursors. \fISource\fR +points to standard cursor data for the cursor's source bits, and +\fImask\fR points to standard cursor data describing which pixels of \fIsource\fR are to be drawn and which are to be considered transparent. \fIWidth\fR and \fIheight\fR give the dimensions of the cursor, \fIxHot\fR and \fIyHot\fR indicate the location of the cursor's hot-spot (the point that is reported when an event occurs), and \fIfg\fR and \fIbg\fR describe the cursor's @@ -133,48 +177,57 @@ cursor = Tk_GetCursorFromData(interp, tkwin, source_bits, mask_bits, source_width, source_height, source_x_hot, source_y_hot, Tk_GetUid("red"), Tk_GetUid("blue")); .CE .PP -Under normal conditions, \fBTk_GetCursor\fR and \fBTk_GetCursorFromData\fR +Under normal conditions \fBTk_GetCursorFromData\fR will return an identifier for the requested cursor. If an error -occurs in creating the cursor, such as when \fInameId\fR refers -to a non-existent file, then \fBNone\fR is returned and an error -message will be stored in \fIinterp->result\fR. +occurs in creating the cursor then \fBNone\fR is returned and an error +message will be stored in \fIinterp\fR's result. .PP -\fBTk_GetCursor\fR and \fBTk_GetCursorFromData\fR maintain a +\fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, and +\fBTk_GetCursorFromData\fR maintain a database of all the cursors they have created. Whenever possible, -a call to \fBTk_GetCursor\fR or \fBTk_GetCursorFromData\fR will +a call to \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, or +\fBTk_GetCursorFromData\fR will return an existing cursor rather than creating a new one. This approach can substantially reduce server overhead, so the Tk procedures should generally be used in preference to Xlib procedures like \fBXCreateFontCursor\fR or \fBXCreatePixmapCursor\fR, which -create a new cursor on each call. +create a new cursor on each call. The Tk procedures are also more +portable than the lower-level X procedures. .PP The procedure \fBTk_NameOfCursor\fR is roughly the inverse of \fBTk_GetCursor\fR. If its \fIcursor\fR argument was created -by \fBTk_GetCursor\fR, then the return value is the \fInameId\fR +by \fBTk_GetCursor\fR, then the return value is the \fIname\fR argument that was passed to \fBTk_GetCursor\fR to create the cursor. If \fIcursor\fR was created by a call to \fBTk_GetCursorFromData\fR, or by any other mechanism, then the return value is a hexadecimal string giving the X identifier for the cursor. Note: the string returned by \fBTk_NameOfCursor\fR is only guaranteed to persist until the next call to \fBTk_NameOfCursor\fR. Also, this call is not portable except for cursors returned by \fBTk_GetCursor\fR. .PP -When a cursor returned by \fBTk_GetCursor\fR or \fBTk_GetCursorFromData\fR -is no longer needed, \fBTk_FreeCursor\fR should be called to release it. +.VS 8.1 +When a cursor returned by \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, +or \fBTk_GetCursorFromData\fR +is no longer needed, \fBTk_FreeCursorFromObj\fR or +\fBTk_FreeCursor\fR should be called to release it. +For \fBTk_FreeCursorFromObj\fR the cursor to release is specified +with the same information used to create it; for +\fBTk_FreeCursor\fR the cursor to release is specified +with its Tk_Cursor token. There should be exactly one call to \fBTk_FreeCursor\fR for -each call to \fBTk_GetCursor\fR or \fBTk_GetCursorFromData\fR. -When a cursor is no longer in use anywhere (i.e. it has been freed as -many times as it has been gotten) \fBTk_FreeCursor\fR will release -it to the X server and remove it from the database. +each call to \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, +or \fBTk_GetCursorFromData\fR. +.VE .SH BUGS In determining whether an existing cursor can be used to satisfy -a new request, \fBTk_GetCursor\fR and \fBTk_GetCursorFromData\fR +a new request, \fBTk_AllocCursorFromObj\fR, \fBTk_GetCursor\fR, +and \fBTk_GetCursorFromData\fR consider only the immediate values of their arguments. For example, when a file name is passed to \fBTk_GetCursor\fR, \fBTk_GetCursor\fR will assume it is safe to re-use an existing cursor created from the same file name: it will not check to see whether the file itself has changed, or whether the current Index: doc/GetFont.3 ================================================================== --- doc/GetFont.3 +++ doc/GetFont.3 @@ -1,74 +1,122 @@ '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetFont.3 1.11 96/07/31 14:07:40 +'\" RCS: @(#) $Id: GetFont.3,v 1.1.4.2 1998/09/30 02:15:55 stanton Exp $ '\" .so man.macros -.TH Tk_GetFont 3 "" Tk "Tk Library Procedures" +.TH Tk_AllocFontFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetFont, Tk_NameOfFont, Tk_FreeFont \- maintain database of fonts +Tk_AllocFontFromObj, Tk_GetFont, Tk_GetFontFromObj, Tk_NameOfFont, Tk_FreeFontFromObj, Tk_FreeFont \- maintain database of fonts .SH SYNOPSIS .nf \fB#include \fR .sp +.VS 8.1 +Tk_Font +\fBTk_AllocFontFromObj(\fIinterp, tkwin, objPtr\fB)\fR +.sp +Tk_Font +\fBTk_GetFont(\fIinterp, tkwin, string\fB)\fR +.sp Tk_Font -\fBTk_GetFont(\fIinterp, tkwin, string\fB)\fR +\fBTk_GetFontFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp char * \fBTk_NameOfFont(\fItkfont\fB)\fR +.sp +.VS 8.1 +Tk_Font +\fBTk_FreeFontFromObj(\fItkwin, objPtr\fB)\fR +.VE .sp void \fBTk_FreeFont(\fItkfont\fB)\fR .SH ARGUMENTS .AS "const char" *tkfont .AP "Tcl_Interp" *interp in -Interpreter to use for error reporting. +Interpreter to use for error reporting. If NULL, then no error +messages are left after errors. .AP Tk_Window tkwin in -Token for window on the display in which font will be used. +Token for window in which font will be used. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +Gives name or description of font. See documentation +for the \fBfont\fR command for details on acceptable formats. +Internal rep will be modified to cache corresponding Tk_Font. .AP "const char" *string in -Name or description of desired font. See documentation for the \fBfont\fR -command for details on acceptable formats. +Same as \fIobjPtr\fR except description of font is passed as a string and +resulting Tk_Font isn't cached. +.VE .AP Tk_Font tkfont in Opaque font token. .BE .SH DESCRIPTION .PP -\fBTk_GetFont\fR finds the font indicated by \fIstring\fR and returns a -token that represents the font. The return value can be used in subsequent -calls to procedures such as \fBTk_FontMetrics\fR, \fBTk_MeasureChars\fR, and -\fBTk_FreeFont\fR. The token returned by \fBTk_GetFont\fR will remain -valid until \fBTk_FreeFont\fR is called to release it. \fIString\fR can -be either a symbolic name or a font description; see the documentation for -the \fBfont\fR command for a description of the valid formats. If -\fBTk_GetFont\fR is unsuccessful (because, for example, \fIstring\fR was -not a valid font specification) then it returns \fBNULL\fR and stores an -error message in \fIinterp->result\fR. +.VS 8.1 +\fBTk_AllocFontFromObj\fR finds the font indicated by \fIobjPtr\fR and +returns a token that represents the font. The return value can be used +in subsequent calls to procedures such as \fBTk_FontMetrics\fR, +\fBTk_MeasureChars\fR, and \fBTk_FreeFont\fR. The Tk_Font token +will remain valid until +\fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR is called to release it. +\fIObjPtr\fR can contain either a symbolic name or a font description; see +the documentation for the \fBfont\fR command for a description of the +valid formats. If \fBTk_AllocFontFromObj\fR is unsuccessful (because, +for example, \fIobjPtr\fR did not contain a valid font specification) then it +returns \fBNULL\fR and leaves an error message in \fIinterp\fR's result +if \fIinterp\fR isn't NULL. \fBTk_AllocFontFromObj\fR caches +information about the return +value in \fIobjPtr\fR, which speeds up future calls to procedures +such as \fBTk_AllocFontFromObj\fR and \fBTk_GetFontFromObj\fR. +.PP +\fBTk_GetFont\fR is identical to \fBTk_AllocFontFromObj\fR except +that the description of the font is specified with a string instead +of an object. This prevents \fBTk_GetFont\fR from caching the +matching Tk_Font, so \fBTk_GetFont\fR is less efficient than +\fBTk_AllocFontFromObj\fR. +.PP +\fBTk_GetFontFromObj\fR returns the token for an existing font, given +the window and description used to create the font. +\fBTk_GetFontFromObj\fR doesn't actually create the font; the font +must already have been created with a previous call to +\fBTk_AllocFontFromObj\fR or \fBTk_GetFont\fR. The return +value is cached in \fIobjPtr\fR, which speeds up +future calls to \fBTk_GetFontFromObj\fR with the same \fIobjPtr\fR +and \fItkwin\fR. +.VE .PP -\fBTk_GetFont\fR maintains a database of all fonts it has allocated. If -the same \fIstring\fR is requested multiple times (e.g. by different -windows or for different purposes), then additional calls for the same -\fIstring\fR will be handled without involving the platform-specific -graphics server. +\fBTk_AllocFontFromObj\fR and \fBTk_GetFont\fR maintain +a database of all fonts they have allocated. If +the same font is requested multiple times (e.g. by different +windows or for different purposes), then a single Tk_Font will be +shared for all uses. The underlying resources will be freed automatically +when no-one is using the font anymore. .PP The procedure \fBTk_NameOfFont\fR is roughly the inverse of \fBTk_GetFont\fR. Given a \fItkfont\fR that was created by -\fBTk_GetFont\fR, the return value is the \fIstring\fR argument that was +\fBTk_GetFont\fR (or \fBTk_AllocFontFromObj\fR), the return value is +the \fIstring\fR argument that was passed to \fBTk_GetFont\fR to create the font. The string returned by \fBTk_NameOfFont\fR is only guaranteed to persist until the \fItkfont\fR is deleted. The caller must not modify this string. .PP -When a font returned by \fBTk_GetFont\fR is no longer needed, -\fBTk_FreeFont\fR should be called to release it. There should be -exactly one call to \fBTk_FreeFont\fR for each call to \fBTk_GetFont\fR. -When a font is no longer in use anywhere (i.e. it has been freed as many -times as it has been gotten) \fBTk_FreeFont\fR will release any -platform-specific storage and delete it from the database. +.VS 8.1 +When a font is no longer needed, +\fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR should be called to +release it. For \fBTk_FreeFontFromObj\fR the font to release is specified +with the same information used to create it; for +\fBTk_FreeFont\fR the font to release is specified +with its Tk_Font token. There should be +exactly one call to \fBTk_FreeFontFromObj\fR or \fBTk_FreeFont\fR +for each call to \fBTk_AllocFontFromObj\fR or \fBTk_GetFont\fR. +.VE .SH KEYWORDS font Index: doc/GetGC.3 ================================================================== --- doc/GetGC.3 +++ doc/GetGC.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetGC.3 1.11 96/03/26 18:10:14 +'\" RCS: @(#) $Id: GetGC.3,v 1.1.4.1 1998/09/30 02:15:55 stanton Exp $ '\" .so man.macros .TH Tk_GetGC 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetImage.3 ================================================================== --- doc/GetImage.3 +++ doc/GetImage.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetImage.3 1.8 96/03/26 18:10:29 +'\" RCS: @(#) $Id: GetImage.3,v 1.1.4.1 1998/09/30 02:15:55 stanton Exp $ '\" .so man.macros .TH Tk_GetImage 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetJoinStl.3 ================================================================== --- doc/GetJoinStl.3 +++ doc/GetJoinStl.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetJoinStl.3 1.8 96/03/26 18:10:46 +'\" RCS: @(#) $Id: GetJoinStl.3,v 1.1.4.1 1998/09/30 02:15:56 stanton Exp $ '\" .so man.macros .TH Tk_GetJoinStyle 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetJustify.3 ================================================================== --- doc/GetJustify.3 +++ doc/GetJustify.3 @@ -1,46 +1,59 @@ '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetJustify.3 1.11 96/08/27 13:21:27 +'\" RCS: @(#) $Id: GetJustify.3,v 1.1.4.2 1998/09/30 02:15:56 stanton Exp $ '\" .so man.macros -.TH Tk_GetJustify 3 4.0 Tk "Tk Library Procedures" +.TH Tk_GetJustifyFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles +Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles .SH SYNOPSIS .nf \fB#include \fR .sp -Tk_Justify +.VS 8.1 +int +\fBTk_GetJustifyFromObj(\fIinterp, objPtr, justifyPtr\fB)\fR +.sp +int \fBTk_GetJustify(\fIinterp, string, justifyPtr\fB)\fR .sp char * \fBTk_NameOfJustify(\fIjustify\fB)\fR .SH ARGUMENTS .AS "Tk_Justify" *justifyPtr .AP Tcl_Interp *interp in -Interpreter to use for error reporting. +Interpreter to use for error reporting, or NULL. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value contains name of justification style (\fBleft\fR, \fBright\fR, or +\fBcenter\fR). The +internal rep will be modified to cache corresponding justify value. .AP char *string in -String containing name of justification style (``left'', ``right'', or -``center''). +Same as \fIobjPtr\fR except description of justification style is passed as +a string. +.VE .AP int *justifyPtr out Pointer to location in which to store justify value corresponding to -\fIstring\fR. +\fIobjPtr\fR or \fIstring\fR. .AP Tk_Justify justify in Justification style (one of the values listed below). .BE .SH DESCRIPTION .PP -\fBTk_GetJustify\fR places in \fI*justifyPtr\fR the justify value -corresponding to \fIstring\fR. This value will be one of the following: +.VS 8.1 +\fBTk_GetJustifyFromObj\fR places in \fI*justifyPtr\fR the justify value +corresponding to \fIobjPtr\fR's value. +.VE +This value will be one of the following: .TP \fBTK_JUSTIFY_LEFT\fR Means that the text on each line should start at the left edge of the line; as a result, the right edges of lines may be ragged. .TP @@ -50,20 +63,31 @@ .TP \fBTK_JUSTIFY_CENTER\fR Means that the text on each line should be centered; as a result, both the left and right edges of lines may be ragged. .PP +.VS 8.1 Under normal circumstances the return value is \fBTCL_OK\fR and \fIinterp\fR is unused. -If \fIstring\fR doesn't contain a valid justification style -or an abbreviation of one of these names, then an error message is -stored in \fIinterp->result\fR, \fBTCL_ERROR\fR is returned, and -\fI*justifyPtr\fR is unmodified. +If \fIobjPtr\fR doesn't contain a valid justification style +or an abbreviation of one of these names, \fBTCL_ERROR\fR is returned, +\fI*justifyPtr\fR is unmodified, and an error message is +stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL. +\fBTk_GetJustifyFromObj\fR caches information about the return +value in \fIobjPtr\fR, which speeds up future calls to +\fBTk_GetJustifyFromObj\fR with the same \fIobjPtr\fR. +.PP +\fBTk_GetJustify\fR is identical to \fBTk_GetJustifyFromObj\fR except +that the description of the justification is specified with a string instead +of an object. This prevents \fBTk_GetJustify\fR from caching the +return value, so \fBTk_GetJustify\fR is less efficient than +\fBTk_GetJustifyFromObj\fR. +.VE .PP \fBTk_NameOfJustify\fR is the logical inverse of \fBTk_GetJustify\fR. Given a justify value it returns a statically-allocated string corresponding to \fIjustify\fR. If \fIjustify\fR isn't a legal justify value, then ``unknown justification style'' is returned. .SH KEYWORDS center, fill, justification, string Index: doc/GetOption.3 ================================================================== --- doc/GetOption.3 +++ doc/GetOption.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetOption.3 1.9 96/03/26 18:11:11 +'\" RCS: @(#) $Id: GetOption.3,v 1.1.4.1 1998/09/30 02:15:56 stanton Exp $ '\" .so man.macros .TH Tk_GetOption 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetPixels.3 ================================================================== --- doc/GetPixels.3 +++ doc/GetPixels.3 @@ -1,49 +1,71 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetPixels.3 1.8 96/03/26 18:11:30 +'\" RCS: @(#) $Id: GetPixels.3,v 1.1.4.2 1998/09/30 02:15:57 stanton Exp $ '\" .so man.macros -.TH Tk_GetPixels 3 "" Tk "Tk Library Procedures" +.TH Tk_GetPixelsFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetPixels, Tk_GetScreenMM \- translate between strings and screen units +Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate between strings and screen units .SH SYNOPSIS .nf \fB#include \fR .sp +.VS 8.1 +int +\fBTk_GetPixelsFromObj(\fIinterp, tkwin, objPtr, intPtr\fB)\fR +.VE +.sp int \fBTk_GetPixels(\fIinterp, tkwin, string, intPtr\fB)\fR +.sp +.VS 8.1 +int +\fBTk_GetMMFromObj(\fIinterp, tkwin, objPtr, doublePtr\fB)\fR +.VE .sp int \fBTk_GetScreenMM(\fIinterp, tkwin, string, doublePtr\fB)\fR .SH ARGUMENTS .AS "Tcl_Interp" *joinPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP Tk_Window tkwin in Window whose screen geometry determines the conversion between absolute -units and pixels. +units and pixels. +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value specifies a distance on the screen; +internal rep will be modified to cache converted distance. .AP char *string in -String that specifies a distance on the screen. +Same as \fIobjPtr\fR except specification of distance is passed as +a string. +.VE .AP int *intPtr out Pointer to location in which to store converted distance in pixels. .AP double *doublePtr out Pointer to location in which to store converted distance in millimeters. .BE .SH DESCRIPTION .PP -These two procedures take as argument a specification of distance on -the screen (\fIstring\fR) and compute the corresponding distance -either in integer pixels or floating-point millimeters. -In either case, \fIstring\fR specifies a screen distance as a +These procedures take as argument a specification of distance on +.VS 8.1 +the screen (\fIobjPtr\fR or \fIstring\fR) and compute the +.VE +corresponding distance either in integer pixels or floating-point millimeters. +In either case, +.VS 8.1 +\fIobjPtr\fR or \fIstring\fR +.VE +specifies a screen distance as a floating-point number followed by one of the following characters that indicates units: .TP The number specifies a distance in pixels. @@ -59,18 +81,31 @@ .TP \fBp\fR The number specifies a distance in printer's points (1/72 inch) on the screen. .PP -\fBTk_GetPixels\fR converts \fIstring\fR to the nearest even -number of pixels and stores that value at \fI*intPtr\fR. -\fBTk_GetScreenMM\fR converts \fIstring\fR to millimeters and -stores the double-precision floating-point result at \fI*doublePtr\fR. -.PP -Both procedures return \fBTCL_OK\fR under normal circumstances. -If an error occurs (e.g. \fIstring\fR contains a number followed +.VS 8.1 +\fBTk_GetPixelsFromObj\fR converts the value of \fIobjPtr\fR to the +nearest even number of pixels and stores that value at \fI*intPtr\fR. +It returns \fBTCL_OK\fR under normal circumstances. +If an error occurs (e.g. \fIobjPtr\fR contains a number followed by a character that isn't one of the ones above) then \fBTCL_ERROR\fR is returned and an error message is left -in \fIinterp->result\fR. +in \fIinterp\fR's result if \fIinterp\fR isn't NULL. +\fBTk_GetPixelsFromObj\fR caches information about the return +value in \fIobjPtr\fR, which speeds up future calls to +\fBTk_GetPixelsFromObj\fR with the same \fIobjPtr\fR. +.PP +\fBTk_GetPixels\fR is identical to \fBTk_GetPixelsFromObj\fR except +that the screen distance is specified with a string instead +of an object. This prevents \fBTk_GetPixels\fR from caching the +return value, so \fBTk_GetAnchor\fR is less efficient than +\fBTk_GetPixelsFromObj\fR. +.PP +\fBTk_GetMMFromObj\fR and \fBTk_GetScreenMM\fR are similar to +\fBTk_GetPixelsFromObj\fR and \fBTk_GetPixels\fR (respectively) except +that they convert the screen distance to millimeters and +store a double-precision floating-point result at \fI*doublePtr\fR. +.VE .SH KEYWORDS centimeters, convert, inches, millimeters, pixels, points, screen units Index: doc/GetPixmap.3 ================================================================== --- doc/GetPixmap.3 +++ doc/GetPixmap.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetPixmap.3 1.7 96/03/26 18:11:47 +'\" RCS: @(#) $Id: GetPixmap.3,v 1.1.4.1 1998/09/30 02:15:57 stanton Exp $ '\" .so man.macros .TH Tk_GetPixmap 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetRelief.3 ================================================================== --- doc/GetRelief.3 +++ doc/GetRelief.3 @@ -1,22 +1,27 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. -'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1994-1998 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetRelief.3 1.11 96/11/17 14:54:49 +'\" RCS: @(#) $Id: GetRelief.3,v 1.1.4.2 1998/09/30 02:15:57 stanton Exp $ '\" .so man.macros -.TH Tk_GetRelief 3 "" Tk "Tk Library Procedures" +.TH Tk_GetReliefFromObj 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME -Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values +Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values .SH SYNOPSIS .nf \fB#include \fR +.sp +.VS 8.1 +int +\fBTk_GetReliefFromObj(\fIinterp, objPtr, reliefPtr\fB)\fR +.VE .sp int \fBTk_GetRelief(\fIinterp, name, reliefPtr\fB)\fR .sp char * @@ -23,37 +28,54 @@ \fBTk_NameOfRelief(\fIrelief\fB)\fR .SH ARGUMENTS .AS "Tcl_Interp" *reliefPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. -.AP char *name in -String containing relief name (one of ``flat'', ``groove'', -``raised'', ``ridge'', ``solid'', or ``sunken''). +.VS 8.1 br +.AP Tcl_Obj *objPtr in/out +String value contains name of relief (one of \fBflat\fR, \fBgroove\fR, +\fBraised\fR, \fBridge\fR, \fBsolid\fR, or \fBsunken\fR); +internal rep will be modified to cache corresponding relief value. +.AP char *string in +Same as \fIobjPtr\fR except description of relief is passed as +a string. +.VE .AP int *reliefPtr out Pointer to location in which to store relief value corresponding to -\fIname\fR. +\fIobjPtr\fR or \fIname\fR. .AP int relief in Relief value (one of TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE). .BE .SH DESCRIPTION .PP -\fBTk_GetRelief\fR places in \fI*reliefPtr\fR the relief value -corresponding to \fIname\fR. This value will be one of +.VS 8.1 +\fBTk_GetReliefFromObj\fR places in \fI*reliefPtr\fR the relief value +corresponding to the value of \fIobjPtr\fR. This value will be one of TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE. Under normal circumstances the return value is TCL_OK and \fIinterp\fR is unused. -If \fIname\fR doesn't contain one of the valid relief names -or an abbreviation of one of them, then an error message -is stored in \fIinterp->result\fR, -TCL_ERROR is returned, and \fI*reliefPtr\fR is unmodified. +If \fIobjPtr\fR doesn't contain one of the valid relief names +or an abbreviation of one of them, then TCL_ERROR is returned, +\fI*reliefPtr\fR is unmodified, and an error message +is stored in \fIinterp\fR's result if \fIinterp\fR isn't NULL. +\fBTk_GetReliefFromObj\fR caches information about the return +value in \fIobjPtr\fR, which speeds up future calls to +\fBTk_GetReliefFromObj\fR with the same \fIobjPtr\fR. +.PP +\fBTk_GetRelief\fR is identical to \fBTk_GetReliefFromObj\fR except +that the description of the relief is specified with a string instead +of an object. This prevents \fBTk_GetRelief\fR from caching the +return value, so \fBTk_GetRelief\fR is less efficient than +\fBTk_GetReliefFromObj\fR. +.VE .PP \fBTk_NameOfRelief\fR is the logical inverse of \fBTk_GetRelief\fR. -Given a relief value it returns the corresponding string (``flat'', -``raised'', ``sunken'', ``groove'', ``solid'', or ``ridge''). +Given a relief value it returns the corresponding string (\fBflat\fR, +\fBraised\fR, \fBsunken\fR, \fBgroove\fR, \fBsolid\fR, or \fBridge\fR). If \fIrelief\fR isn't a legal relief value, then ``unknown relief'' is returned. .SH KEYWORDS name, relief, string Index: doc/GetRootCrd.3 ================================================================== --- doc/GetRootCrd.3 +++ doc/GetRootCrd.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetRootCrd.3 1.9 96/03/26 18:12:16 +'\" RCS: @(#) $Id: GetRootCrd.3,v 1.1.4.1 1998/09/30 02:15:58 stanton Exp $ '\" .so man.macros .TH Tk_GetRootCoords 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetScroll.3 ================================================================== --- doc/GetScroll.3 +++ doc/GetScroll.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetScroll.3 1.7 96/03/26 18:12:29 +'\" RCS: @(#) $Id: GetScroll.3,v 1.1.4.1 1998/09/30 02:15:58 stanton Exp $ '\" .so man.macros .TH Tk_GetScrollInfo 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetSelect.3 ================================================================== --- doc/GetSelect.3 +++ doc/GetSelect.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetSelect.3 1.16 96/08/27 13:21:28 +'\" RCS: @(#) $Id: GetSelect.3,v 1.1.4.1 1998/09/30 02:15:58 stanton Exp $ '\" .so man.macros .TH Tk_GetSelection 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetUid.3 ================================================================== --- doc/GetUid.3 +++ doc/GetUid.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetUid.3 1.10 96/03/26 18:12:55 +'\" RCS: @(#) $Id: GetUid.3,v 1.1.4.1 1998/09/30 02:15:59 stanton Exp $ '\" .so man.macros .TH Tk_GetUid 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetVRoot.3 ================================================================== --- doc/GetVRoot.3 +++ doc/GetVRoot.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetVRoot.3 1.10 96/08/27 13:21:28 +'\" RCS: @(#) $Id: GetVRoot.3,v 1.1.4.1 1998/09/30 02:15:59 stanton Exp $ '\" .so man.macros .TH Tk_GetVRootGeometry 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/GetVisual.3 ================================================================== --- doc/GetVisual.3 +++ doc/GetVisual.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) GetVisual.3 1.9 96/03/26 18:13:20 +'\" RCS: @(#) $Id: GetVisual.3,v 1.1.4.1 1998/09/30 02:15:59 stanton Exp $ '\" .so man.macros .TH Tk_GetVisual 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/HandleEvent.3 ================================================================== --- doc/HandleEvent.3 +++ doc/HandleEvent.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) HandleEvent.3 1.6 96/03/26 18:13:34 +'\" RCS: @(#) $Id: HandleEvent.3,v 1.1.4.1 1998/09/30 02:16:00 stanton Exp $ '\" .so man.macros .TH Tk_HandleEvent 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/IdToWindow.3 ================================================================== --- doc/IdToWindow.3 +++ doc/IdToWindow.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) IdToWindow.3 1.4 96/03/26 18:14:08 +'\" RCS: @(#) $Id: IdToWindow.3,v 1.1.4.1 1998/09/30 02:16:00 stanton Exp $ '\" .so man.macros .TH Tk_IdToWindow 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/ImgChanged.3 ================================================================== --- doc/ImgChanged.3 +++ doc/ImgChanged.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ImgChanged.3 1.6 96/03/26 18:14:18 +'\" RCS: @(#) $Id: ImgChanged.3,v 1.1.4.1 1998/09/30 02:16:01 stanton Exp $ '\" .so man.macros .TH Tk_ImageChanged 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/InternAtom.3 ================================================================== --- doc/InternAtom.3 +++ doc/InternAtom.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) InternAtom.3 1.8 96/03/26 18:14:31 +'\" RCS: @(#) $Id: InternAtom.3,v 1.1.4.1 1998/09/30 02:16:01 stanton Exp $ '\" .so man.macros .TH Tk_InternAtom 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/MainLoop.3 ================================================================== --- doc/MainLoop.3 +++ doc/MainLoop.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MainLoop.3 1.3 96/03/26 18:15:01 +'\" RCS: @(#) $Id: MainLoop.3,v 1.1.4.1 1998/09/30 02:16:01 stanton Exp $ '\" .so man.macros .TH Tk_MainLoop 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/MainWin.3 ================================================================== --- doc/MainWin.3 +++ doc/MainWin.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MainWin.3 1.5 96/03/26 18:15:15 +'\" RCS: @(#) $Id: MainWin.3,v 1.1.4.1 1998/09/30 02:16:02 stanton Exp $ '\" .so man.macros .TH Tk_MainWindow 3 7.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/MaintGeom.3 ================================================================== --- doc/MaintGeom.3 +++ doc/MaintGeom.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MaintGeom.3 1.7 96/03/26 18:15:30 +'\" RCS: @(#) $Id: MaintGeom.3,v 1.1.4.1 1998/09/30 02:16:02 stanton Exp $ '\" .so man.macros .TH Tk_MaintainGeometry 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/ManageGeom.3 ================================================================== --- doc/ManageGeom.3 +++ doc/ManageGeom.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ManageGeom.3 1.18 96/08/27 13:21:30 +'\" RCS: @(#) $Id: ManageGeom.3,v 1.1.4.1 1998/09/30 02:16:03 stanton Exp $ '\" .so man.macros .TH Tk_ManageGeometry 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/MapWindow.3 ================================================================== --- doc/MapWindow.3 +++ doc/MapWindow.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MapWindow.3 1.12 97/01/29 08:50:08 +'\" RCS: @(#) $Id: MapWindow.3,v 1.1.4.1 1998/09/30 02:16:03 stanton Exp $ '\" .so man.macros .TH Tk_MapWindow 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/MeasureChar.3 ================================================================== --- doc/MeasureChar.3 +++ doc/MeasureChar.3 @@ -2,32 +2,32 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MeasureChar.3 1.5 97/06/10 17:33:36 +'\" RCS: @(#) $Id: MeasureChar.3,v 1.1.4.3 1999/03/30 04:12:54 stanton Exp $ '\" .so man.macros -.TH Tk_MeasureChars 3 "" Tk "Tk Library Procedures" +.TH Tk_MeasureChars 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME Tk_MeasureChars, Tk_TextWidth, Tk_DrawChars, Tk_UnderlineChars \- routines to measure and display simple single-line strings. .SH SYNOPSIS .nf \fB#include \fR .sp int -\fBTk_MeasureChars(\fItkfont, string, maxChars, maxPixels, flags, lengthPtr\fB)\fR +\fBTk_MeasureChars(\fItkfont, string, numBytes, maxPixels, flags, lengthPtr\fB)\fR .sp int -\fBTk_TextWidth(\fItkfont, string, numChars\fB)\fR +\fBTk_TextWidth(\fItkfont, string, numBytes\fB)\fR .sp void -\fBTk_DrawChars(\fIdisplay, drawable, gc, tkfont, string, numChars, x, y\fB)\fR +\fBTk_DrawChars(\fIdisplay, drawable, gc, tkfont, string, numBytes, x, y\fB)\fR .sp void -\fBTk_UnderlineChars(\fIdisplay, drawable, gc, tkfont, string, x, y, firstChar, lastChar\fB)\fR +\fBTk_UnderlineChars(\fIdisplay, drawable, gc, tkfont, string, x, y, firstByte, lastByte\fB)\fR .sp .SH ARGUMENTS .AS "const char" firstChar .AP Tk_Font tkfont in Token for font in which text is to be drawn or measured. Must have been @@ -35,13 +35,15 @@ .AP "const char" *string in Text to be measured or displayed. Need not be null terminated. Any non-printing meta-characters in the string (such as tabs, newlines, and other control characters) will be measured or displayed in a platform-dependent manner. -.AP int maxChars in -The maximum number of characters to consider when measuring \fIstring\fR. -Must be greater than or equal to 0. +.VS 8.1 +.AP int numBytes in +The maximum number of bytes to consider when measuring or drawing +\fIstring\fR. Must be greater than or equal to 0. +.VE 8.1 .AP int maxPixels in If \fImaxPixels\fR is greater than 0, it specifies the longest permissible line length in pixels. Characters from \fIstring\fR are processed only until this many pixels have been covered. If \fImaxPixels\fR is <= 0, then the line length is unbounded and the \fIflags\fR argument is ignored. @@ -57,13 +59,10 @@ word that did fit; if not even one letter of the word fit, then the first letter will still be returned. .AP int *lengthPtr out Filled with the number of pixels occupied by the number of characters returned as the result of \fBTk_MeasureChars\fR. -.AP int numChars in -The total number of characters to measure or draw from \fIstring\fR. Must -be greater than or equal to 0. .AP Display *display in Display on which to draw. .AP Drawable drawable in Window or pixmap in which to draw. .AP GC gc in @@ -70,27 +69,35 @@ Graphics context for drawing characters. The font selected into this GC must be the same as the \fItkfont\fR. .AP int "x, y" in Coordinates at which to place the left edge of the baseline when displaying \fIstring\fR. -.AP int firstChar in -The index of the first character to underline in the \fIstring\fR. -Underlining begins at the left edge of this character. -.AP int lastChar in -The index of the last character up to which the underline will -be drawn. The character specified by \fIlastChar\fR will not itself be -underlined. +.VS 8.1 +.AP int firstByte in +The index of the first byte of the first character to underline in the +\fIstring\fR. Underlining begins at the left edge of this character. +.AP int lastByte in +The index of the first byte of the last character up to which the +underline will be drawn. The character specified by \fIlastByte\fR +will not itself be underlined. +.VE 8.1 .BE .SH DESCRIPTION .PP These routines are for measuring and displaying simple single-font, single-line, strings. To measure and display single-font, multi-line, justified text, refer to the documentation for \fBTk_ComputeTextLayout\fR. There is no programming interface in the core of Tk that supports multi-font, multi-line text; support for that behavior must be built on -top of simpler layers. +top of simpler layers. +.VS 8.1 +Note that the interfaces described here are +byte-oriented not character-oriented, so index values coming from Tcl +scripts need to be converted to byte offsets using the +\fBTcl_UtfAtIndex\fR and related routines. +.VE 8.1 .PP A glyph is the displayable picture of a letter, number, or some other symbol. Not all character codes in a given font have a glyph. Characters such as tabs, newlines/returns, and control characters that have no glyph are measured and displayed by these procedures in a @@ -101,14 +108,14 @@ platform-independent expansion of tab characters into columns and newlines/returns into multi-line text. .PP \fBTk_MeasureChars\fR is used both to compute the length of a given string and to compute how many characters from a string fit in a given -amount of space. The return value is the number of characters from +amount of space. The return value is the number of bytes from \fIstring\fR that fit in the space specified by \fImaxPixels\fR subject to the conditions described by \fIflags\fR. If all characters fit, the return -value will be \fImaxChars\fR. \fI*lengthPtr\fR is filled with the computed +value will be \fInumBytes\fR. \fI*lengthPtr\fR is filled with the computed width, in pixels, of the portion of the string that was measured. For example, if the return value is 5, then \fI*lengthPtr\fR is filled with the distance between the left edge of \fIstring\fR[0] and the right edge of \fIstring\fR[4]. .PP Index: doc/MoveToplev.3 ================================================================== --- doc/MoveToplev.3 +++ doc/MoveToplev.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) MoveToplev.3 1.8 96/03/26 18:16:11 +'\" RCS: @(#) $Id: MoveToplev.3,v 1.1.4.1 1998/09/30 02:16:04 stanton Exp $ '\" .so man.macros .TH Tk_MoveToplevelWindow 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/Name.3 ================================================================== --- doc/Name.3 +++ doc/Name.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) Name.3 1.14 97/01/29 08:50:09 +'\" RCS: @(#) $Id: Name.3,v 1.1.4.1 1998/09/30 02:16:04 stanton Exp $ '\" .so man.macros .TH Tk_Name 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/NameOfImg.3 ================================================================== --- doc/NameOfImg.3 +++ doc/NameOfImg.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) NameOfImg.3 1.4 96/03/26 18:16:37 +'\" RCS: @(#) $Id: NameOfImg.3,v 1.1.4.1 1998/09/30 02:16:04 stanton Exp $ '\" .so man.macros .TH Tk_NameOfImage 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/OwnSelect.3 ================================================================== --- doc/OwnSelect.3 +++ doc/OwnSelect.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) OwnSelect.3 1.16 96/08/27 13:21:31 +'\" RCS: @(#) $Id: OwnSelect.3,v 1.1.4.1 1998/09/30 02:16:05 stanton Exp $ '\" .so man.macros .TH Tk_OwnSelection 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/ParseArgv.3 ================================================================== --- doc/ParseArgv.3 +++ doc/ParseArgv.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) ParseArgv.3 1.17 97/10/31 12:58:44 +'\" RCS: @(#) $Id: ParseArgv.3,v 1.1.4.1 1998/09/30 02:16:05 stanton Exp $ '\" .so man.macros .TH Tk_ParseArgv 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/QWinEvent.3 ================================================================== --- doc/QWinEvent.3 +++ doc/QWinEvent.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) QWinEvent.3 1.4 96/03/26 18:17:16 +'\" RCS: @(#) $Id: QWinEvent.3,v 1.1.4.1 1998/09/30 02:16:05 stanton Exp $ '\" .so man.macros .TH Tk_QueueWindowEvent 3 7.5 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/Restack.3 ================================================================== --- doc/Restack.3 +++ doc/Restack.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) Restack.3 1.5 96/03/26 18:17:32 +'\" RCS: @(#) $Id: Restack.3,v 1.1.4.1 1998/09/30 02:16:06 stanton Exp $ '\" .so man.macros .TH Tk_RestackWindow 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/RestrictEv.3 ================================================================== --- doc/RestrictEv.3 +++ doc/RestrictEv.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) RestrictEv.3 1.13 96/08/27 13:21:55 +'\" RCS: @(#) $Id: RestrictEv.3,v 1.1.4.1 1998/09/30 02:16:06 stanton Exp $ '\" .so man.macros .TH Tk_RestrictEvents 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/SetAppName.3 ================================================================== --- doc/SetAppName.3 +++ doc/SetAppName.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) SetAppName.3 1.13 97/06/10 17:33:48 +'\" RCS: @(#) $Id: SetAppName.3,v 1.1.4.1 1998/09/30 02:16:07 stanton Exp $ '\" .so man.macros .TH Tk_SetAppName 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/SetClass.3 ================================================================== --- doc/SetClass.3 +++ doc/SetClass.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) SetClass.3 1.12 96/03/26 18:18:10 +'\" RCS: @(#) $Id: SetClass.3,v 1.1.4.1 1998/09/30 02:16:07 stanton Exp $ '\" .so man.macros .TH Tk_SetClass 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/SetGrid.3 ================================================================== --- doc/SetGrid.3 +++ doc/SetGrid.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) SetGrid.3 1.11 96/08/27 13:21:33 +'\" RCS: @(#) $Id: SetGrid.3,v 1.1.4.1 1998/09/30 02:16:07 stanton Exp $ '\" .so man.macros .TH Tk_SetGrid 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME ADDED doc/SetOptions.3 Index: doc/SetOptions.3 ================================================================== --- /dev/null +++ doc/SetOptions.3 @@ -0,0 +1,502 @@ +'\" +'\" Copyright (c) 1998 Sun Microsystems, Inc. +'\" +'\" See the file "license.terms" for information on usage and redistribution +'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +'\" +'\" RCS: @(#) $Id: SetOptions.3,v 1.1.2.2 1998/09/30 02:16:08 stanton Exp $ +'\" +.so man.macros +.TH Tk_SetOptions 3 8.1 Tk "Tk Library Procedures" +.BS +.SH NAME +Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions, Tk_Offset \- process configuration options +.SH SYNOPSIS +.nf +\fB#include \fR +.sp +Tk_OptionTable +\fBTk_CreateOptionTable(\fIinterp, templatePtr\fB)\fR +.sp +\fBTk_DeleteOptionTable(\fIoptionTable\fB)\fR +.sp +int +\fBTk_InitOptions(\fIinterp, recordPtr, optionTable, tkwin\fB)\fR +.sp +int +\fBTk_SetOptions(\fIinterp, recordPtr, optionTable, objc, objv, tkwin, savePtr, maskPtr\fB)\fR +.sp +\fBTk_FreeSavedOptions(\fIsavedPtr\fB)\fR +.sp +\fBTk_RestoreSavedOptions(\fIsavedPtr\fB)\fR +.sp +Tcl_Obj * +\fBTk_GetOptionValue(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fB)\fR +.sp +Tcl_Obj * +\fBTk_GetOptionInfo(\fIinterp, recordPtr, optionTable, namePtr, tkwin\fB)\fR +.sp +\fBTk_FreeConfigOptions(\fIrecordPtr, optionTable, tkwin\fB)\fR +.sp +int +\fBTk_Offset(\fItype, field\fB)\fR +.SH ARGUMENTS +.AS Tk_SavedOptions "*CONST objv[]" in/out +.AP Tcl_Interp *interp in +A Tcl interpreter. Most procedures use this only for returning error +messages; if it is NULL then no error messages are returned. For +\fBTk_CreateOptionTable\fR the value cannot be NULL; it gives the +interpreter in which the option table will be used. +.AP Tk_OptionSpec *templatePtr in +Points to an array of static information that describes the configuration +options that are supported. Used to build a Tk_OptionTable. The information +pointed to by this argument must exist for the lifetime of the Tk_OptionTable. +.AP Tk_OptionTable optionTable in +Token for an option table. Must have been returned by a previous call +to \fBTk_CreateOptionTable\fR. +.AP char *recordPtr in/out +Points to structure in which values of configuration options are stored; +fields of this record are modified by procedures such as \fBTk_SetOptions\fR +and read by procedures such as \fBTk_GetOptionValue\fR. +.AP Tk_Window tkwin in +For options such as TK_OPTION_COLOR, this argument indicates +the window in which the option will be used. If \fIoptionTable\fR uses +no window-dependent options, then a NULL value may be supplied for +this argument. +.AP int objc in +Number of values in \fIobjv\fR. +.AP Tcl_Obj "*CONST objv[]" in +Command-line arguments for setting configuring options. +.AP Tk_SavedOptions *savePtr out +If not NULL, the structure pointed to by this argument is filled +in with the old values of any options that were modified and old +values are restored automatically if an error occurs in \fBTk_SetOptions\fR. +.AP int *maskPtr out +If not NULL, the word pointed to by \fImaskPtr\fR is filled in with the +bit-wise OR of the \fItypeMask\fR fields for the options that +were modified. +.AP Tk_SavedOptions *savedPtr in/out +Points to a structure previously filled in by \fBTk_SetOptions\fR with +old values of modified options. +.AP Tcl_Obj *namePtr in +The value of this object is the name of a particular option. If NULL +is passed to \fBTk_GetOptionInfo\fR then information is returned for +all options. Must not be NULL when \fBTk_GetOptionValue\fR is called. +.AP "type name" type in +The name of the type of a record. +.AP "field name" field in +The name of a field in records of type \fItype\fR. +.BE +.SH DESCRIPTION +.PP +These procedures handle most of the details of parsing configuration +options such as those for Tk widgets. Given a description of what +options are supported, these procedures handle all the details of +parsing options and storing their values into a C structure associated +with the widget or object. The procedures were designed primarily for +widgets in Tk, but they can also be used for other kinds of objects that +have configuration options. In the rest of this manual page ``widget'' will +be used to refer to the object whose options are being managed; in +practice the object may not actually be a widget. The term ``widget +record'' is used to refer to the C-level structure in +which information about a particular widget or object is stored. +.PP +Note: the easiest way to learn how to use these procedures is to +look at a working example. In Tk, the simplest example is the code +that implements the button family of widgets, which is an \fBtkButton.c\fR. +Other examples are in \fBtkSquare.c\fR and \fBtkMenu.c\fR. +.PP +In order to use these procedures, the code that implements the widget +must contain a static array of Tk_OptionSpec structures. This is a +template that describes the various options supported by that class of +widget; there is a separate template for each kind of widget. The +template contains information such as the name of each option, its type, +its default value, and where the value of the option is stored in the +widget record. See TEMPLATES below for more detail. +.PP +In order to process configuration options efficiently, the static +template must be augmented with additional information that is available +only at runtime. The procedure \fBTk_CreateOptionTable\fR creates this +dynamic information from the template and returns a Tk_OptionTable token +that describes both the static and dynamic information. All of the +other procedures, such as \fBTk_SetOptions\fR, take a Tk_OptionTable +token as argument. Typically, \fBTk_CreateOptionTable\fR is called the +first time that a widget of a particular class is created and the +resulting Tk_OptionTable is used in the future for all widgets of that +class. A Tk_OptionTable may be used only in a single interpreter, given +by the \fIinterp\fR argument to \fBTk_CreateOptionTable\fR. When an +option table is no longer needed \fBTk_DeleteOptionTable\fR should be +called to free all of its resources. All of the option tables +for a Tcl interpreter are freed automatically if the interpreter is deleted. +.PP +\fBTk_InitOptions\fR is invoked when a new widget is created to set +the default values for all of the widget's configuration options. +\fBTk_InitOptions\fR is passed a token for an option table (\fIoptionTable\fR) +and a pointer to a widget record (\fIrecordPtr\fR), which is the C +structure that holds information about this widget. \fBTk_InitOptions\fR +uses the information in the option table to +choose an appropriate default for each option, then it stores the default +value directly into the widget record, overwriting any information that +was already present in the widget record. \fBTk_InitOptions\fR normally +returns TCL_OK. If an error occurred while setting the default values +(e.g., because a default value was erroneous) then TCL_ERROR is returned +and an error message is left in \fIinterp\fR's result if \fIinterp\fR +isn't NULL. +.PP +\fBTk_SetOptions\fR is invoked to modify configuration options based +on information specified in a Tcl command. The command might be one that +creates a new widget, or a command that modifies options on an existing +widget. The \fIobjc\fR and \fIobjv\fR arguments describe the +values of the arguments from the Tcl command. \fIObjv\fR must contain +an even number of objects: the first object of each pair gives the name of +an option and the second object gives the new value for that option. +\fBTk_SetOptions\fR looks up each name in \fIoptionTable\fR, checks that +the new value of the option conforms to the type in \fIoptionTable\fR, +and stores the value of the option into the widget record given by +\fIrecordPtr\fR. \fBTk_SetOptions\fR normally returns TCL_OK. If +an error occurred (such as an unknown option name or an illegal option +value) then TCL_ERROR is returned and an error message is left in +\fIinterp\fR's result if \fIinterp\fR isn't NULL. +.PP +\fBTk_SetOptions\fR has two additional features. First, if the +\fImaskPtr\fR argument isn't NULL then it points to an integer +value that is filled in with information about the options that were +modified. For each option in the template passed to +\fBTk_CreateOptionTable\fR there is a \fItypeMask\fR field. The +bits of this field are defined by the code that implements the widget; +for example, each bit might correspond to a particular configuration option. +Alternatively, bits might be used functionally. For example, one bit might +be used for redisplay: all options that affect the widget's display, such +that changing the option requires the widget to be redisplayed, might have +that bit set. Another bit might indicate that the geometry of the widget +must be recomputed, and so on. \fBTk_SetOptions\fR OR's together the +\fItypeMask\fR fields from all the options that were modified and returns +this value at *\fImaskPtr\fR; the caller can then use this information +to optimize itself so that, for example, it doesn't redisplay the widget +if the modified options don't affect the widget's appearance. +.PP +The second additional feature of \fBTk_SetOptions\fR has to do with error +recovery. If an error occurs while processing configuration options, this +feature makes it possible to restore all the configuration options to their +previous values. Errors can occur either while processing options in +\fBTk_SetOptions\fR or later in the caller. In many cases the caller does +additional processing after \fBTk_SetOptions\fR returns; for example, it +might use an option value to set a trace on a variable and may detect +an error if the variable is an array instead of a scalar. Error recovery +is enabled by passing in a non-NULL value for the \fIsavePtr\fR argument +to \fBTk_SetOptions\fR; this should be a pointer to an uninitialized +Tk_SavedOptions structure on the caller's stack. \fBTk_SetOptions\fR +overwrites the structure pointed to by \fIsavePtr\fR with information +about the old values of any options modified by the procedure. +If \fBTk_SetOptions\fR returns successfully, the +caller uses the structure in one of two ways. If the caller completes +its processing of the new options without any errors, then it must pass +the structure to \fBTk_FreeSavedOptions\fR so that the old values can be +freed. If the caller detects an error in its processing of the new +options, then it should pass the structure to \fBTk_RestoreSavedOptions\fR, +which will copy the old values back into the widget record and free +the new values. +If \fBTk_SetOptions\fR detects an error then it automatically restores +any options that had already been modified and leaves *\fIsavePtr\fR in +an empty state: the caller need not call either \fBTk_FreeSavedOptions\fR or +\fBTk_RestoreSavedOptions\fR. +If the \fIsavePtr\fR argument to \fBTk_SetOptions\fR is NULL then +\fBTk_SetOptions\fR frees each old option value immediately when it sets a new +value for the option. In this case, if an error occurs in the third +option, the old values for the first two options cannot be restored. +.PP +\fBTk_GetOptionValue\fR returns the current value of a configuration option +for a particular widget. The \fInamePtr\fR argument contains the name of +an option; \fBTk_GetOptionValue\fR uses \fIoptionTable\fR +to lookup the option and extract its value from the widget record +pointed to by \fIrecordPtr\fR, then it returns an object containing +that value. If an error occurs (e.g., because \fInamePtr\fR contains an +unknown option name) then NULL is returned and an error message is left +in \fIinterp\fR's result unless \fIinterp\fR is NULL. +.PP +\fBTk_GetOptionInfo\fR returns information about configuration options in +a form suitable for \fBconfigure\fR widget commands. If the \fInamePtr\fR +argument is not NULL, it points to an object that gives the name of a +configuration option; \fBTk_GetOptionInfo\fR returns an object containing +a list with five elements, which are the name of the option, the name and +class used for the option in the option database, the default value for +the option, and the current value for the option. If the \fInamePtr\fR +argument is NULL, then \fBTk_GetOptionInfo\fR returns information about +all options in the form of a list of lists; each sublist describes one +option. Synonym options are handled differently depending on whether +\fInamePtr\fR is NULL: if \fInamePtr\fR is NULL then the sublist for +each synonym option has only two elements, which are the name of the +option and the name of the other option that it refers to; if \fInamePtr\fR +is non-NULL and names a synonym option then the object returned +is the five-element list +for the other option that the synonym refers to. If an error occurs +(e.g., because \fInamePtr\fR contains an unknown option name) then NULL +is returned and an error message is left in \fIinterp\fR's result unless +\fIinterp\fR is NULL. +.PP +\fBTk_FreeConfigOptions\fR must be invoked when a widget is deleted. +It frees all of the resources associated with any of the configuration +options defined in \fIrecordPtr\fR by \fIoptionTable\fR. +.PP +The \fBTk_Offset\fR macro is provided as a safe way of generating the +\fIobjOffset\fR and \fIinternalOffset\fR values for entries in +Tk_OptionSpec structures. It takes two arguments: the name of a type +of record, and the name of a field in that record. It returns the byte +offset of the named field in records of the given type. + +.SH "TEMPLATES" +.PP +The array of Tk_OptionSpec structures passed to \fBTk_CreateOptionTable\fR +via its \fItemplatePtr\fR argument describes the configuration options +supported by a particular class of widgets. Each structure specifies +one configuration option and has the following fields: +.CS +typedef struct { + Tk_OptionType \fItype\fR; + char *\fIoptionName\fR; + char *\fIdbName\fR; + char *\fIdbClass\fR; + char *\fIdefValue\fR; + int \fIobjOffset\fR; + int \fIinternalOffset\fR; + int \fIflags\fR; + ClientData \fIclientData\fR; + int \fItypeMask\fR; +} Tk_OptionSpec; +.CE +The \fItype\fR field indicates what kind of configuration option this is +(e.g. TK_OPTION_COLOR for a color value, or TK_OPTION_INT for +an integer value). \fIType\fR determines how the +value of the option is parsed (more on this below). +The \fIoptionName\fR field is a string such as \fB\-font\fR or \fB\-bg\fR; +it is the name used for the option in Tcl commands and passed to +procedures via the \fIobjc\fR or \fInamePtr\fR arguments. +The \fIdbName\fR and \fIdbClass\fR fields are used by \fBTk_InitOptions\fR +to look up a default value for this option in the option database; if +\fIdbName\fR is NULL then the option database is not used by +\fBTk_InitOptions\fR for this option. The \fIdefValue\fR field +specifies a default value for this configuration option if no +value is specified in the option database. The \fIobjOffset\fR and +\fIinternalOffset\fR fields indicate where to store the value of this +option in widget records (more on this below); values for the \fIobjOffset\fR +and \fIinternalOffset\fR fields should always be generated with the +\fBTk_Offset\fR macro. +The \fIflags\fR field contains additional information +to control the processing of this configuration option (see below +for details). +\fIClientData\fR provides additional type-specific data needed +by certain types. For instance, for TK_OPTION_COLOR types, +\fIclientData\fR is a string giving the default value to use on +monochrome displays. See the descriptions of the different types +below for details. +The last field, \fItypeMask\fR, is used by \fBTk_SetOptions\fR to +return information about which options were modified; see the description +of \fBTk_SetOptions\fR above for details. +.PP +When \fBTk_InitOptions\fR and \fBTk_SetOptions\fR store the value of an +option into the widget record, they can do it in either of two ways. +If the \fIobjOffset\fR field of the Tk_OptionSpec is greater than +or equal to zero, then the value of the option is stored as a +(Tcl_Obj *) at the location in the widget record given by \fIobjOffset\fR. +If the \fIinternalOffset\fR field of the Tk_OptionSpec is +greater than or equal to zero, then the value of the option is stored +in a type-specific internal form at the location in the widget record +given by \fIinternalOffset\fR. For example, if the option's type is +TK_OPTION_INT then the internal form is an integer. If the +\fIobjOffset\fR or \fIinternalOffset\fR field is negative then the +value is not stored in that form. At least one of the offsets must be +greater than or equal to zero. +.PP +The \fIflags\fR field consists of one or more bits ORed together. At +present only a single flag is supported: TK_OPTION_NULL_OK. If +this bit is set for an option then an empty string will be accepted as +the value for the option and the resulting internal form will be a +NULL pointer or \fBNone\fR, depending on the type of the option. +If the flag is not set then empty strings will result +in errors. +TK_OPTION_NULL_OK is typically used to allow a +feature to be turned off entirely, e.g. set a cursor value to +\fBNone\fR so that a window simply inherits its parent's cursor. +Not all option types support the TK_OPTION_NULL_OK +flag; for those that do, there is an explicit indication of that fact +in the descriptions below. +.PP +The \fItype\fR field of each Tk_OptionSpec structure determines +how to parse the value of that configuration option. The +legal value for \fItype\fR, and the corresponding actions, are +described below. If the type requires a \fItkwin\fR value to be +passed into procedures like \fBTk_SetOptions\fR, or if it uses +the \fIclientData\fR field of the Tk_OptionSpec, then it is indicated +explicitly; if not mentioned, the type requires neither \fItkwin\fR +nor \fIclientData\fR. +.TP +\fBTK_OPTION_ANCHOR\fR +The value must be a standard anchor position such as \fBne\fR or +\fBcenter\fR. The internal form is a Tk_Anchor value like the ones +returned by \fBTk_GetAnchorFromObj\fR. +.TP +\fBTK_OPTION_BITMAP\fR +The value must be a standard Tk bitmap name. The internal form is a +Pixmap token like the ones returned by \fBTk_AllocBitmapFromObj\fR. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_BOOLEAN\fR +The value must be a standard boolean value such as \fBtrue\fR or +\fBno\fR. The internal form is an integer with value 0 or 1. +.TP +\fBTK_OPTION_BORDER\fR +The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. +The internal form is a Tk_3DBorder token like the ones returned +by \fBTk_Alloc3DBorderFromObj\fR. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_COLOR\fR +The value must be a standard color name such as \fBred\fR or \fB#ff8080\fR. +The internal form is an (XColor *) token like the ones returned by +\fBTk_AllocColorFromObj\fR. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_CURSOR\fR +The value must be a standard cursor name such as \fBcross\fR or \fB@foo\fR. +The internal form is a Tk_Cursor token like the ones returned by +\fBTk_AllocCursorFromObj\fR. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR, and when the option is set the cursor +for the window is changed by calling \fBXDefineCursor\fR. This +option type also supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_DOUBLE\fR +The string value must be a floating-point number in +the format accepted by \fBstrtol\fR. The internal form is a C +\fBdouble\fR value. +.TP +\fBTK_OPTION_END\fR +Marks the end of the template. There must be a Tk_OptionSpec structure +with \fItype\fR TK_OPTION_END at the end of each template. If the +\fIclientData\fR field of this structure isn't NULL, then it points to +an additional array of Tk_OptionSpec's, which is itself terminated by +another TK_OPTION_END entry. Templates may be chained arbitrarily +deeply. This feature allows common options to be shared by several +widget classes. +.TP +\fBTK_OPTION_FONT\fR +The value must be a standard font name such as \fBTimes 16\fR. +The internal form is a Tk_Font handle like the ones returned by +\fBTk_AllocFontFromObj\fR. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR, and it supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_INT\fR +The string value must be an integer in the format accepted by +\fBstrtol\fR (e.g. \fB0\fR and \fB0x\fR prefixes may be used to +specify octal or hexadecimal numbers, respectively). The internal +form is a C \fBint\fR value. +.TP +\fBTK_OPTION_JUSTIFY\fR +The value must be a standard justification value such as \fBleft\fR. +The internal form is a Tk_Justify like the values returned by +\fBTk_GetJustifyFromObj\fR. +.TP +\fBTK_OPTION_PIXELS\fR +The value must specify a screen distance such as \fB2i\fR or \fB6.4\fR. +The internal form is an integer value giving a +distance in pixels, like the values returned by +\fBTk_GetPixelsFromObj\fR. Note: if the \fIobjOffset\fR field isn't +used then information about the original value of this option will be lost. +See \fBOBJOFFSET VS. INTERNALOFFSET\fR below for details. +.TP +\fBTK_OPTION_RELIEF\fR +The value must be standard relief such as \fBraised\fR. +The internal form is an integer relief value such as +TK_RELIEF_RAISED. +.TP +\fBTK_OPTION_STRING\fR +The value may be any string. The internal form is a (char *) pointer +that points to a dynamically allocated copy of the value. +This option type supports the TK_OPTION_NULL_OK flag. +.TP +\fBTK_OPTION_STRING_TABLE\fR +For this type, \fIclientData\fR is a pointer to an array of strings +suitable for passing to \fBTcl_GetIndexFromObj\fR. The value must +be one of the strings in the table, or a unique abbreviation of +one of the strings. The internal form is an integer giving the index +into the table of the matching string, like the return value +from \fBTcl_GetStringFromObj\fR. +.TP +\fBTK_OPTION_SYNONYM\fR +This type is used to provide alternative names for an option (for +example, \fB\-bg\fR is often used as a synonym for \fB\-background\fR). +The \fBclientData\fR field is a (char *) pointer that gives +the name of another option in the same table. Whenever the +synonym option is used, the information from the other option +will be used instead. +.TP +\fBTK_OPTION_WINDOW\fR +The value must be a window path name. The internal form is a +\fBTk_Window\fR token for the window. +This option type requires \fItkwin\fR to be supplied to procedures +such as \fBTk_SetOptions\fR (in order to identify the application), +and it supports the TK_OPTION_NULL_OK flag. + +.SH "STORAGE MANAGEMENT ISSUES" +.PP +If a field of a widget record has its offset stored in the \fIobjOffset\fR +or \fIinternalOffset\fR field of a Tk_OptionSpec structure then the +procedures described here will handle all of the storage allocation and +resource management issues associated with the field. When the value +of an option is changed, \fBTk_SetOptions\fR (or \fBTk_FreeSavedOptions\fR +will automatically free any resources associated with the old value, such as +Tk_Fonts for TK_OPTION_FONT options or dynamically allocated memory for +TK_OPTION_STRING options. For an option stored as an object using the +\fIobjOffset\fR field of a Tk_OptionSpec, the widget record shares the +object pointed to by the \fIobjv\fR value from the call to +\fBTk_SetOptions\fR. The reference count for this object is incremented +when a pointer to it is stored in the widget record and decremented when +the option is modified. When the widget is deleted +\fBTk_FreeConfigOptions\fR should be invoked; it will free the resources +associated with all options and decrement reference counts for any +objects. +.PP +However, the widget code is responsible for storing NULL or \fBNone\fR in +all pointer and token fields before invoking \fBTk_InitOptions\fR. +This is needed to allow proper cleanup in the rare case where +an error occurs in \fBTk_InitOptions\fR. + +.SH "OBJOFFSET VS. INTERNALOFFSET" +.PP +In most cases it is simplest to use the \fIinternalOffset\fR field of +a Tk_OptionSpec structure and not the \fIobjOffset\fR field. This +makes the internal form of the value immediately available to the +widget code so the value doesn't have to be extracted from an object +each time it is used. However, there are two cases where the +\fIobjOffset\fR field is useful. The first case is for +TK_OPTION_PIXELS options. In this case, the internal form is +an integer pixel value that is valid only for a particular screen. +If the value of the option is retrieved, it will be returned as a simple +number. For example, after the command \fB.b configure \-borderwidth 2m\fR, +the command \fB.b configure \-borderwidth\fR might return 7, which is the +integer pixel value corresponding to \fB2m\fR. Unfortunately, this loses +the original screen-independent value. Thus for TK_OPTION_PIXELS options +it is better to use the \fIobjOffset\fR field. In this case the original +value of the option is retained in the object and can be returned when +the option is retrieved. In most cases it is convenient to use the +\fIinternalOffset\fR field field as well, so that the integer value is +immediately available for use in the widget code (alternatively, +\fBTk_GetPixelsFromObj\fR can be used to extract the integer value from +the object whenever it is needed). Note: the problem of losing information +on retrievals exists only for TK_OPTION_PIXELS options. +.PP +The second reason to use the \fIobjOffset\fR field is in order to +implement new types of options not supported by these procedures. +To implement a new type of option, use TK_OPTION_STRING as +the type in the Tk_OptionSpec structure and set the \fIobjOffset\fR field +but not the \fIinternalOffset\fR field. Then, after calling +\fBTk_SetOptions\fR, convert the object to internal form yourself. + +.SH KEYWORDS +anchor, bitmap, boolean, border, color, configuration option, +cursor, double, font, integer, justify, +pixels, relief, screen distance, synonym Index: doc/SetVisual.3 ================================================================== --- doc/SetVisual.3 +++ doc/SetVisual.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) SetVisual.3 1.10 96/03/26 18:18:39 +'\" RCS: @(#) $Id: SetVisual.3,v 1.1.4.1 1998/09/30 02:16:08 stanton Exp $ '\" .so man.macros .TH Tk_SetWindowVisual 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/StrictMotif.3 ================================================================== --- doc/StrictMotif.3 +++ doc/StrictMotif.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) StrictMotif.3 1.4 96/03/26 18:18:52 +'\" RCS: @(#) $Id: StrictMotif.3,v 1.1.4.1 1998/09/30 02:16:08 stanton Exp $ '\" .so man.macros .TH Tk_StrictMotif 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/TextLayout.3 ================================================================== --- doc/TextLayout.3 +++ doc/TextLayout.3 @@ -2,14 +2,14 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) TextLayout.3 1.6 96/12/16 16:48:12 +'\" RCS: @(#) $Id: TextLayout.3,v 1.1.4.2 1999/03/30 04:12:54 stanton Exp $ '\" .so man.macros -.TH Tk_ComputeTextLayout 3 "" Tk "Tk Library Procedures" +.TH Tk_ComputeTextLayout 3 8.1 Tk "Tk Library Procedures" .BS .SH NAME Tk_ComputeTextLayout, Tk_FreeTextLayout, Tk_DrawTextLayout, Tk_UnderlineTextLayout, Tk_PointToChar, Tk_CharBbox, Tk_DistanceToTextLayout, Tk_IntersectTextLayout, Tk_TextLayoutToPostscript \- routines to measure and display single-font, multi-line, justified text. .SH SYNOPSIS .nf @@ -53,11 +53,14 @@ stored in the text layout. The \fIstring\fR must remain valid for the lifetime of the text layout. .AP int numChars in The number of characters to consider from \fIstring\fR. If \fInumChars\fR is less than 0, then assumes \fIstring\fR is null -terminated and uses \fBstrlen(\fIstring\fB)\fR. +.VS 8.1 +terminated and uses \fBTcl_NumUtfChars\fR to determine the length of +\fIstring\fR. +.VE .AP int wrapLength in Longest permissible line length, in pixels. Lines in \fIstring\fR will automatically be broken at word boundaries and wrapped when they reach this length. If \fIwrapLength\fR is too small for even a single character to fit on a line, it will be expanded to allow one character to @@ -131,11 +134,18 @@ These routines are for measuring and displaying single-font, multi-line, justified text. To measure and display simple single-font, single-line strings, refer to the documentation for \fBTk_MeasureChars\fR. There is no programming interface in the core of Tk that supports multi-font, multi-line text; support for that behavior must be built on top of -simpler layers. +simpler layers. +.VS 8.1 +Note that unlike the lower level text display routines, the functions +described here all operate on character-oriented lengths and indices +rather than byte-oriented values. See the description of +\fBTcl_UtfAtIndex\fR for more details on converting between character +and byte offsets. +.VE 8.1 .PP The routines described here are built on top of the programming interface described in the \fBTk_MeasureChars\fR documentation. Tab characters and newline/return characters may be treated specially by these procedures, but all other characters are passed through to the lower level. Index: doc/Tk_Init.3 ================================================================== --- doc/Tk_Init.3 +++ doc/Tk_Init.3 @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) Tk_Init.3 1.3 96/03/26 18:19:08 +'\" RCS: @(#) $Id: Tk_Init.3,v 1.1.4.1 1998/09/30 02:16:09 stanton Exp $ '\" .so man.macros .TH Tk_Init 3 4.1 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/Tk_Main.3 ================================================================== --- doc/Tk_Main.3 +++ doc/Tk_Main.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) Tk_Main.3 1.7 96/03/26 18:19:21 +'\" RCS: @(#) $Id: Tk_Main.3,v 1.1.4.1 1998/09/30 02:16:10 stanton Exp $ '\" .so man.macros .TH Tk_Main 3 4.0 Tk "Tk Library Procedures" .BS .SH NAME Index: doc/WindowId.3 ================================================================== --- doc/WindowId.3 +++ doc/WindowId.3 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) WindowId.3 1.16 97/01/29 08:50:10 +'\" RCS: @(#) $Id: WindowId.3,v 1.1.4.1 1998/09/30 02:16:10 stanton Exp $ '\" .so man.macros .TH Tk_WindowId 3 "" Tk "Tk Library Procedures" .BS .SH NAME Index: doc/bell.n ================================================================== --- doc/bell.n +++ doc/bell.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) bell.n 1.8 96/03/26 18:19:55 +'\" RCS: @(#) $Id: bell.n,v 1.1.4.1 1998/09/30 02:16:10 stanton Exp $ '\" .so man.macros .TH bell n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/bind.n ================================================================== --- doc/bind.n +++ doc/bind.n @@ -1,16 +1,17 @@ '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. +'\" Copyright (c) 1998 by Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) bind.n 1.41 96/10/03 18:27:05 +'\" RCS: @(#) $Id: bind.n,v 1.1.4.2 1998/11/25 21:16:29 stanton Exp $ '\" .so man.macros -.TH bind n 4.1 Tk "Tk Built-In Commands" +.TH bind n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bind \- Arrange for X events to invoke Tcl scripts .SH SYNOPSIS @@ -156,23 +157,62 @@ time and space requirement. .SH "EVENT TYPES" .PP The \fItype\fR field may be any of the standard X event types, with a -few extra abbreviations. Below is a list of all the valid types; -where two names appear together, they are synonyms. +few extra abbreviations. The \fItype\fR field will also accept a +couple non-standard X event types that were added to better support +the Macintosh and Windows platforms. Below is a list of all the valid +types; where two names appear together, they are synonyms. .DS C .ta 5c 10c -\fBButtonPress, Button Expose Map -ButtonRelease FocusIn Motion -Circulate FocusOut Property +\fBActivate Enter Map +ButtonPress, Button Expose Motion +.VS +ButtonRelease FocusIn MouseWheel +.VE +Circulate FocusOut Property Colormap Gravity Reparent Configure KeyPress, Key Unmap -Destroy KeyRelease Visibility -Enter Leave Activate -Deactivate\fR +Deactivate KeyRelease Visibility +Destroy Leave\fR .DE +.PP +.VS +Most of the above events have the same fields and behaviors as events +in the X Windowing system. You can find more detailed descriptions of +these events in any X window programming book. A couple of the events +are extensions to the X event system to support features unique to the +Macintosh and Windows platforms. We provide a little more detail on +these events here. These include: +.IP \fBActivate\fR 5 +.IP \fBDeactivate\fR 5 +These two events are sent to every sub-window of a toplevel when they +change state. In addition to the focus Window, the Macintosh platform +and Windows platforms have a notion of an active window (which often +has but is not required to have the focus). On the Macintosh, widgets +in the active window have a different appearance than widgets in +deactive windows. The \fBActivate\fR event is sent to all the +sub-windows in a toplevel when it changes from being deactive to +active. Likewise, the \fBDeactive\fR event is sent when the window's +state changes from active to deactive. There are no useful percent +substitutions you would make when binding to these events. +.IP \fBMouseWheel\fR 5 +Some mice on the Windows platform support a mouse wheel which is used +for scrolling documents without using the scrollbars. By rolling the +wheel, the system will generate \fBMouseWheel\fR events that the +application can use to scroll. Like \fBKey\fR events the event is +always routed to the window that currently has focus. When the event +is received you can use the \fB%D\fR substitution to get the +\fIdelta\fR field for the event which is a integer value of motion +that the mouse wheel has moved. The smallest value for which the +system will report is defined by the OS. On Windows 95 & 98 machines +this value is at least 120 before it is reported. However, higher +resolution devices may be available in the future. The sign of the +value determines which direction your widget should scroll. Positive +values should scroll up and negative values should scroll down. +.VE .PP The last part of a long event specification is \fIdetail\fR. In the case of a \fBButtonPress\fR or \fBButtonRelease\fR event, it is the number of a button (1-5). If a button number is given, then only an event on that particular button will match; if no button number is @@ -256,11 +296,11 @@ .IP \fB%f\fR 5 The \fIfocus\fR field from the event (\fB0\fR or \fB1\fR). Valid only for \fBEnter\fR and \fBLeave\fR events. .IP \fB%h\fR 5 .VS -The \fIheight\fR field from the event. Valid only for \fBConfigure\fR and +The \fIheight\fR field from the event. Valid for the \fBConfigure\fR and \fBExpose\fR events. .VE .IP \fB%k\fR 5 The \fIkeycode\fR field from the event. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events. @@ -306,10 +346,19 @@ work of translating from the event to an ASCII character. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events. .IP \fB%B\fR 5 The \fIborder_width\fR field from the event. Valid only for \fBConfigure\fR events. +.VS +.IP \fB%D\fR 5 +This reports the \fIdelta\fR value of a \fBMouseWheel\fR event. The +\fIdelta\fR value represents the rotation units the mouse wheel has +been moved. On Windows 95 & 98 systems the smallest value for the +delta is 120. Future systems may support higher resolution values for +the delta. The sign of the value represents the direction the mouse +wheel was scrolled. +.VE .IP \fB%E\fR 5 The \fIsend_event\fR field from the event. Valid for all event types. .IP \fB%K\fR 5 The keysym corresponding to the event, substituted as a textual string. Valid only for \fBKeyPress\fR and \fBKeyRelease\fR events. Index: doc/bindtags.n ================================================================== --- doc/bindtags.n +++ doc/bindtags.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) bindtags.n 1.9 96/11/30 14:54:49 +'\" RCS: @(#) $Id: bindtags.n,v 1.1.4.1 1998/09/30 02:16:11 stanton Exp $ '\" .so man.macros .TH bindtags n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/bitmap.n ================================================================== --- doc/bitmap.n +++ doc/bitmap.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) bitmap.n 1.10 96/03/29 14:48:41 +'\" RCS: @(#) $Id: bitmap.n,v 1.1.4.1 1998/09/30 02:16:11 stanton Exp $ '\" .so man.macros .TH bitmap n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/button.n ================================================================== --- doc/button.n +++ doc/button.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) button.n 1.40 97/10/31 12:58:48 +'\" RCS: @(#) $Id: button.n,v 1.1.4.1 1998/09/30 02:16:12 stanton Exp $ '\" .so man.macros .TH button n 4.4 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/canvas.n ================================================================== --- doc/canvas.n +++ doc/canvas.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) canvas.n 1.58 97/10/31 12:58:45 +'\" RCS: @(#) $Id: canvas.n,v 1.1.4.2 1998/11/25 21:16:29 stanton Exp $ '\" .so man.macros .TH canvas n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! @@ -1444,10 +1444,11 @@ This option defaults to \fBcenter\fR. .TP \fB\-fill \fIcolor\fR \fIColor\fR specifies a color to use for filling the text characters; it may have any of the forms accepted by \fBTk_GetColor\fR. +If \fIcolor\fR is an empty string then the text will be transparent. If this option isn't specified then it defaults to \fBblack\fR. .TP \fB\-font \fIfontName\fR Specifies the font to use for the text item. \fIFontName\fR may be any string acceptable to \fBTk_GetFontStruct\fR. Index: doc/checkbutton.n ================================================================== --- doc/checkbutton.n +++ doc/checkbutton.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) checkbutton.n 1.40 96/11/20 12:51:21 +'\" RCS: @(#) $Id: checkbutton.n,v 1.1.4.1 1998/09/30 02:16:13 stanton Exp $ '\" .so man.macros .TH checkbutton n 4.4 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/chooseColor.n ================================================================== --- doc/chooseColor.n +++ doc/chooseColor.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) chooseColor.n 1.4 96/09/19 17:01:44 +'\" RCS: @(#) $Id: chooseColor.n,v 1.1.4.1 1998/09/30 02:16:13 stanton Exp $ '\" .so man.macros .TH tk_chooseColor n 4.2 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/clipboard.n ================================================================== --- doc/clipboard.n +++ doc/clipboard.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) clipboard.n 1.9 96/03/26 18:21:12 +'\" RCS: @(#) $Id: clipboard.n,v 1.1.4.1 1998/09/30 02:16:14 stanton Exp $ '\" .so man.macros .TH clipboard n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/destroy.n ================================================================== --- doc/destroy.n +++ doc/destroy.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) destroy.n 1.14 96/12/12 17:54:59 +'\" RCS: @(#) $Id: destroy.n,v 1.1.4.1 1998/09/30 02:16:15 stanton Exp $ '\" .so man.macros .TH destroy n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/dialog.n ================================================================== --- doc/dialog.n +++ doc/dialog.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) dialog.n 1.9 96/09/06 09:20:58 +'\" RCS: @(#) $Id: dialog.n,v 1.1.4.1 1998/09/30 02:16:15 stanton Exp $ '\" .so man.macros .TH tk_dialog n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/entry.n ================================================================== --- doc/entry.n +++ doc/entry.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) entry.n 1.41 97/10/31 12:58:44 +'\" RCS: @(#) $Id: entry.n,v 1.1.4.1 1998/09/30 02:16:16 stanton Exp $ '\" .so man.macros .TH entry n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/event.n ================================================================== --- doc/event.n +++ doc/event.n @@ -1,15 +1,16 @@ '\" '\" Copyright (c) 1996 Sun Microsystems, Inc. +'\" Copyright (c) 1998 by Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) event.n 1.6 97/10/31 12:58:54 +'\" RCS: @(#) $Id: event.n,v 1.1.4.2 1998/11/25 21:16:29 stanton Exp $ '\" .so man.macros -.TH event n 4.4 Tk "Tk Built-In Commands" +.TH event n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME event \- Miscellaneous event facilities: define virtual events and generate events .SH SYNOPSIS @@ -102,10 +103,23 @@ .TP \fB\-count\fI number\fR \fINumber\fR must be an integer; it specifies the \fIcount\fR field for the event. Valid for \fBExpose\fR events. Corresponds to the \fB%c\fR substitution for binding scripts. +.TP +\fB\-delta\fI number\fR +.VS +\fINumber\fR must be an integer; it specifies the \fIdelta\fR field +for the \fBMouseWheel\fR event. The \fIdelta\fR refers to the +direction and magnitude the mouse wheel was rotated. Note the value +is not a screen distance but are units of motion in the mouse wheel. +Typically these values are multiples of 120. For example, 120 should +scroll the text widget up 4 lines and -240 would scroll the text +widget down 8 lines. Of course, other widgets may define different +behaviors for mouse wheel motion. This field corresponds to the +\fB%D\fR substitution for binding scripts. +.VE .TP \fB\-detail\fI detail\fR \fIDetail\fR specifies the \fIdetail\fR field for the event and must be one of the following: .RS Index: doc/focus.n ================================================================== --- doc/focus.n +++ doc/focus.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) focus.n 1.22 96/08/27 13:21:42 +'\" RCS: @(#) $Id: focus.n,v 1.1.4.1 1998/09/30 02:16:17 stanton Exp $ '\" .so man.macros .TH focus n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/focusNext.n ================================================================== --- doc/focusNext.n +++ doc/focusNext.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) focusNext.n 1.10 96/03/26 18:22:23 +'\" RCS: @(#) $Id: focusNext.n,v 1.1.4.1 1998/09/30 02:16:17 stanton Exp $ '\" .so man.macros .TH tk_focusNext n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/font.n ================================================================== --- doc/font.n +++ doc/font.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) font.n 1.10 97/08/22 18:52:18 +'\" RCS: @(#) $Id: font.n,v 1.1.4.1 1998/09/30 02:16:18 stanton Exp $ '\" .so man.macros .TH font n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/frame.n ================================================================== --- doc/frame.n +++ doc/frame.n @@ -4,11 +4,11 @@ '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" '\" -'\" SCCS: @(#) frame.n 1.30 97/10/31 12:58:48 +'\" RCS: @(#) $Id: frame.n,v 1.1.4.1 1998/09/30 02:16:18 stanton Exp $ '\" .so man.macros .TH frame n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/getOpenFile.n ================================================================== --- doc/getOpenFile.n +++ doc/getOpenFile.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) getOpenFile.n 1.8 96/12/08 21:14:31 +'\" RCS: @(#) $Id: getOpenFile.n,v 1.1.4.1 1998/09/30 02:16:18 stanton Exp $ '\" .so man.macros .TH tk_getOpenFile n 4.2 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! @@ -57,14 +57,16 @@ discussion on the contents of \fIfilePatternList\fR. .TP \fB\-initialdir\fR \fIdirectory\fR Specifies that the files in \fIdirectory\fR should be displayed when the dialog pops up. If this parameter is not specified, then -the files in the current working directory are displayed. This -option may not always work on the Macintosh. This is not a bug. -Rather, the \fIGeneral Controls\fR control panel on the Mac allows the -end user to override the application default directory. +the files in the current working directory are displayed. If the +parameter specifies a relative path, the return value will convert the +relative path to an absolute path. This option may not always work on +the Macintosh. This is not a bug. Rather, the \fIGeneral Controls\fR +control panel on the Mac allows the end user to override the +application default directory. .TP \fB\-initialfile\fR \fIfilename\fR Specifies a filename to be displayed in the dialog when it pops up. This option is ignored by the \fBtk_getOpenFile\fR command. .TP Index: doc/grab.n ================================================================== --- doc/grab.n +++ doc/grab.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) grab.n 1.15 96/03/26 18:22:48 +'\" RCS: @(#) $Id: grab.n,v 1.1.4.1 1998/09/30 02:16:19 stanton Exp $ '\" .so man.macros .TH grab n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/grid.n ================================================================== --- doc/grid.n +++ doc/grid.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) grid.n 1.15 96/12/13 16:46:35 +'\" RCS: @(#) $Id: grid.n,v 1.1.4.1 1998/09/30 02:16:19 stanton Exp $ '\" .so man.macros .TH grid n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/image.n ================================================================== --- doc/image.n +++ doc/image.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) image.n 1.10 96/03/26 18:23:05 +'\" RCS: @(#) $Id: image.n,v 1.1.4.1 1998/09/30 02:16:20 stanton Exp $ '\" .so man.macros .TH image n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/label.n ================================================================== --- doc/label.n +++ doc/label.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) label.n 1.30 97/10/31 12:58:49 +'\" RCS: @(#) $Id: label.n,v 1.1.4.1 1998/09/30 02:16:20 stanton Exp $ '\" .so man.macros .TH label n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/listbox.n ================================================================== --- doc/listbox.n +++ doc/listbox.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) listbox.n 1.38 97/10/31 12:58:47 +'\" RCS: @(#) $Id: listbox.n,v 1.1.4.1 1998/09/30 02:16:20 stanton Exp $ '\" .so man.macros .TH listbox n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/loadTk.n ================================================================== --- doc/loadTk.n +++ doc/loadTk.n @@ -2,20 +2,20 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) loadTk.n 1.5 97/08/18 17:44:43 +'\" RCS: @(#) $Id: loadTk.n,v 1.1.4.2 1998/09/30 02:16:21 stanton Exp $ '\" .so man.macros .TH "Safe Tk" n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME loadTk \- Load Tk into a safe interpreter. .SH SYNOPSIS -\fB::safe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? +\fB::safe::loadTk \fIslave\fR ?\fB\-use\fR \fIwindowId\fR? ?\fB\-display\fR \fIdisplayName\fR? .BE Safe Tk is based on Safe Tcl, which provides a mechanism that allows restricted and mediated access to auto-loading and packages for safe interpreters. @@ -29,58 +29,48 @@ in the named safe interpreter and then loads Tk into it. The command returns the name of the safe interpreter. If \fB\-use\fR is specified, the window identified by the specified system dependent identifier \fIwindowId\fR is used to contain the \fB``.''\fR window of the safe interpreter; it can be any valid id, eventually -referencing a window belonging to another application. -Otherwise, a new toplevel window is created for the \fB``.''\fR window of -the safe interpreter. +referencing a window belonging to another application. As a convenience, +if the window you plan to use is a Tk Window of the application you +can use the window name (eg: \fB.x.y\fR) instead of its window Id +(\fB[winfo id .x.y]\fR). +When \fB\-use\fR is not specified, +a new toplevel window is created for the \fB``.''\fR window of +the safe interpreter. On X11 if you want the embedded window +to use another display than the default one, specify it with +\fB\-display\fR. See the \fBSECURITY ISSUES\fR section below for implementation details. .SH SECURITY ISSUES .PP Please read the \fBsafe\fR manual page for Tcl to learn about the basic security considerations for Safe Tcl. .PP -Information in the safe interpreter should never be trusted for security -purposes. -However, because Tk initialization of the safe interpreter do use -local information, it is unsafe if the safe interpreter -could have gained control before Tk is loaded. -This will be fixed in an upcoming release, by making Tk initialization in a -safe interpreter use only information found in the interpreter's master -instead of relying on the (un)safe interpreter state. -.PP -You should therefore use \fBsafe::loadTk $slave\fR as soon as possible -after \fBsafe::interpCreate\fR and before any code is evaluated in the safe -interpreter. -The preferred sequence is: -.CS -set slave [::safe::loadTk [::safe::interpCreate]] -.CE -If you want to prevent safe interpreters from loading Tk entirely, you -should create the interpreter as follows: -.CS -::safe::interpCreate \-nostatics \-accesspath \fI{directories...}\fR -.CE -and you must also insure that the virtual access path \fIdirectories\fR for -the interpreter does not contain a dynamically loadable version of Tk. -.PP \fB::safe::loadTk\fR adds the value of \fBtk_library\fR taken from the master interpreter to the virtual access path of the safe interpreter so that auto-loading will work in the safe interpreter. -It also sets \fBenv(DISPLAY)\fR in the safe interpreter to the value of -\fBenv(DISPLAY)\fR in the master interpreter, if it exists. -Finally, it sets the slave's Tcl variable \fBargv\fR to \fB\-use\fR -\fIwindowId\fR in the safe interpreter. - +.PP +.PP +Tk initialization is now safe with respect to not trusting +the slave's state for startup. \fB::safe::loadTk\fR +registers the slave's name so +when the Tk initialization (\fBTk_SafeInit\fR) is called +and in turn calls the master's \fB::safe::InitTk\fR it will +return the desired \fBargv\fR equivalent (\fB\-use\fR +\fIwindowId\fR, correct \fB\-display\fR, etc...). +.PP When \fB\-use\fR is not used, the new toplevel created is specially decorated so the user is always aware that the user interface presented comes from a potentially unsafe code and can easily delete the corresponding interpreter. +.PP +On X11, conflicting \fB\-use\fR and \fB\-display\fR are likely +to generate a fatal X error. .SH "SEE ALSO" safe(n), interp(n), library(n), load(n), package(n), source(n), unknown(n) .SH KEYWORDS alias, auto\-loading, auto_mkindex, load, master interpreter, safe interpreter, slave interpreter, source Index: doc/lower.n ================================================================== --- doc/lower.n +++ doc/lower.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) lower.n 1.9 96/06/14 14:19:56 +'\" RCS: @(#) $Id: lower.n,v 1.1.4.1 1998/09/30 02:16:21 stanton Exp $ '\" .so man.macros .TH lower n 3.3 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/menu.n ================================================================== --- doc/menu.n +++ doc/menu.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) menu.n 1.61 97/10/31 12:58:40 +'\" RCS: @(#) $Id: menu.n,v 1.1.4.1 1998/09/30 02:16:21 stanton Exp $ '\" .so man.macros .TH menu n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/menubar.n ================================================================== --- doc/menubar.n +++ doc/menubar.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) menubar.n 1.13 96/08/27 13:21:45 +'\" RCS: @(#) $Id: menubar.n,v 1.1.4.1 1998/09/30 02:16:22 stanton Exp $ '\" .so man.macros .TH tk_menuBar n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/menubutton.n ================================================================== --- doc/menubutton.n +++ doc/menubutton.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) menubutton.n 1.36 97/10/31 12:58:49 +'\" RCS: @(#) $Id: menubutton.n,v 1.1.4.1 1998/09/30 02:16:22 stanton Exp $ '\" .so man.macros .TH menubutton n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/message.n ================================================================== --- doc/message.n +++ doc/message.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) message.n 1.32 97/10/31 12:58:50 +'\" RCS: @(#) $Id: message.n,v 1.1.4.1 1998/09/30 02:16:23 stanton Exp $ '\" .so man.macros .TH message n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/messageBox.n ================================================================== --- doc/messageBox.n +++ doc/messageBox.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) messageBox.n 1.5 96/09/19 17:02:40 +'\" RCS: @(#) $Id: messageBox.n,v 1.1.4.2 1999/04/09 21:04:44 surles Exp $ '\" .so man.macros .TH tk_messageBox n 4.2 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! @@ -78,13 +78,13 @@ .RE .PP .SH EXAMPLE .CS set answer [tk_messageBox \-message "Really quit?" \-type yesno \-icon question] -case $answer { +switch -- $answer { yes exit no {tk_messageBox \-message "I know you like this application!" \-type ok} } .CE .SH KEYWORDS message box Index: doc/option.n ================================================================== --- doc/option.n +++ doc/option.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) option.n 1.10 96/03/26 18:25:08 +'\" RCS: @(#) $Id: option.n,v 1.1.4.1 1998/09/30 02:16:23 stanton Exp $ '\" .so man.macros .TH option n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/optionMenu.n ================================================================== --- doc/optionMenu.n +++ doc/optionMenu.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) optionMenu.n 1.5 96/03/26 18:25:21 +'\" RCS: @(#) $Id: optionMenu.n,v 1.1.4.1 1998/09/30 02:16:24 stanton Exp $ '\" .so man.macros .TH tk_optionMenu n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/options.n ================================================================== --- doc/options.n +++ doc/options.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) options.n 1.47 97/05/31 17:12:19 +'\" RCS: @(#) $Id: options.n,v 1.1.4.1 1998/09/30 02:16:24 stanton Exp $ '\" .so man.macros .TH options n 4.4 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/pack-old.n ================================================================== --- doc/pack-old.n +++ doc/pack-old.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) pack-old.n 1.12 96/03/26 18:25:44 +'\" RCS: @(#) $Id: pack-old.n,v 1.1.4.1 1998/09/30 02:16:24 stanton Exp $ '\" .so man.macros .TH pack-old n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/pack.n ================================================================== --- doc/pack.n +++ doc/pack.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) pack.n 1.19 96/08/27 13:21:48 +'\" RCS: @(#) $Id: pack.n,v 1.1.4.1 1998/09/30 02:16:25 stanton Exp $ '\" .so man.macros .TH pack n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/palette.n ================================================================== --- doc/palette.n +++ doc/palette.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1995-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) palette.n 1.5 96/03/26 18:26:11 +'\" RCS: @(#) $Id: palette.n,v 1.1.4.1 1998/09/30 02:16:25 stanton Exp $ '\" .so man.macros .TH tk_setPalette n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/photo.n ================================================================== --- doc/photo.n +++ doc/photo.n @@ -7,11 +7,11 @@ '\" '\" Author: Paul Mackerras (paulus@cs.anu.edu.au), '\" Department of Computer Science, '\" Australian National University. '\" -'\" "@(#) photo.n 1.12 97/10/14 10:52:30" +'\" RCS: @(#) $Id: photo.n,v 1.1.4.1 1998/09/30 02:16:26 stanton Exp $ '\" .so man.macros .TH photo n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/place.n ================================================================== --- doc/place.n +++ doc/place.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) place.n 1.13 96/08/27 13:21:49 +'\" RCS: @(#) $Id: place.n,v 1.1.4.1 1998/09/30 02:16:26 stanton Exp $ '\" .so man.macros .TH place n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/popup.n ================================================================== --- doc/popup.n +++ doc/popup.n @@ -2,11 +2,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) popup.n 1.5 96/03/26 18:26:45 +'\" RCS: @(#) $Id: popup.n,v 1.1.4.1 1998/09/30 02:16:27 stanton Exp $ '\" .so man.macros .TH tk_popup n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/radiobutton.n ================================================================== --- doc/radiobutton.n +++ doc/radiobutton.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) radiobutton.n 1.41 97/10/31 12:58:51 +'\" RCS: @(#) $Id: radiobutton.n,v 1.1.4.1 1998/09/30 02:16:27 stanton Exp $ '\" .so man.macros .TH radiobutton n 4.4 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/raise.n ================================================================== --- doc/raise.n +++ doc/raise.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) raise.n 1.9 96/06/14 14:20:02 +'\" RCS: @(#) $Id: raise.n,v 1.1.4.1 1998/09/30 02:16:27 stanton Exp $ '\" .so man.macros .TH raise n 3.3 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/scale.n ================================================================== --- doc/scale.n +++ doc/scale.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) scale.n 1.32 97/10/31 12:58:51 +'\" RCS: @(#) $Id: scale.n,v 1.1.4.1 1998/09/30 02:16:28 stanton Exp $ '\" .so man.macros .TH scale n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/scrollbar.n ================================================================== --- doc/scrollbar.n +++ doc/scrollbar.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) scrollbar.n 1.33 97/10/31 12:58:52 +'\" RCS: @(#) $Id: scrollbar.n,v 1.1.4.1 1998/09/30 02:16:28 stanton Exp $ '\" .so man.macros .TH scrollbar n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/selection.n ================================================================== --- doc/selection.n +++ doc/selection.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) selection.n 1.18 96/08/27 13:21:51 +'\" RCS: @(#) $Id: selection.n,v 1.1.4.1 1998/09/30 02:16:29 stanton Exp $ '\" .so man.macros .TH selection n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/send.n ================================================================== --- doc/send.n +++ doc/send.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) send.n 1.18 96/08/27 13:21:47 +'\" RCS: @(#) $Id: send.n,v 1.1.4.3 1999/04/02 23:50:11 redman Exp $ '\" .so man.macros .TH send n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! @@ -68,12 +68,12 @@ Communication can be reenabled by invoking the \fBtk appname\fR command. .SH SECURITY .PP -The \fBsend\fR command is potentially a serious security loophole, -since any application that can connect to your X server can send +The \fBsend\fR command is potentially a serious security loophole. On Unix, +any application that can connect to your X server can send scripts to your applications. These incoming scripts can use Tcl to read and write your files and invoke subprocesses under your name. Host-based access control such as that provided by \fBxhost\fR is particularly insecure, since it allows anyone with an account @@ -85,8 +85,13 @@ is enabled (i.e. only certain hosts can establish connections) and (b) the list of enabled hosts is empty. This means that applications cannot connect to your server unless they use some other form of authorization such as that provide by \fBxauth\fR. - +.VS +Under Windows, \fBsend\fR is currently disabled. Most of the +functionality is provided by the \fBdde\fR command instead. +.VE .SH KEYWORDS -application, name, remote execution, security, send +.VS +application, dde, name, remote execution, security, send +.VE Index: doc/text.n ================================================================== --- doc/text.n +++ doc/text.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) text.n 1.68 97/10/31 12:58:41 +'\" RCS: @(#) $Id: text.n,v 1.1.4.1 1998/09/30 02:16:29 stanton Exp $ '\" .so man.macros .TH text n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/tk.n ================================================================== --- doc/tk.n +++ doc/tk.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) tk.n 1.15 97/05/20 20:32:56 +'\" RCS: @(#) $Id: tk.n,v 1.1.4.1 1998/09/30 02:16:30 stanton Exp $ '\" .so man.macros .TH tk n 4.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/tkerror.n ================================================================== --- doc/tkerror.n +++ doc/tkerror.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) tkerror.n 1.19 97/10/31 12:58:53 +'\" RCS: @(#) $Id: tkerror.n,v 1.1.4.1 1998/09/30 02:16:30 stanton Exp $ '\" .so man.macros .TH tkerror n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/tkvars.n ================================================================== --- doc/tkvars.n +++ doc/tkvars.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) tkvars.n 1.22 96/08/27 13:21:38 +'\" RCS: @(#) $Id: tkvars.n,v 1.1.4.1 1998/09/30 02:16:31 stanton Exp $ '\" .so man.macros .TH tkvars n 4.1 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/tkwait.n ================================================================== --- doc/tkwait.n +++ doc/tkwait.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) tkwait.n 1.13 96/07/31 08:19:23 +'\" RCS: @(#) $Id: tkwait.n,v 1.1.4.1 1998/09/30 02:16:31 stanton Exp $ '\" .so man.macros .TH tkwait n "" Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/toplevel.n ================================================================== --- doc/toplevel.n +++ doc/toplevel.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) toplevel.n 1.29 97/10/31 12:58:53 +'\" RCS: @(#) $Id: toplevel.n,v 1.1.4.1 1998/09/30 02:16:31 stanton Exp $ '\" .so man.macros .TH toplevel n 8.0 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/winfo.n ================================================================== --- doc/winfo.n +++ doc/winfo.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1997 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) winfo.n 1.45 97/01/25 13:45:04 +'\" RCS: @(#) $Id: winfo.n,v 1.1.4.1 1998/09/30 02:16:32 stanton Exp $ '\" .so man.macros .TH winfo n 4.3 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/wish.1 ================================================================== --- doc/wish.1 +++ doc/wish.1 @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) wish.1 1.30 97/10/31 12:58:43 +'\" RCS: @(#) $Id: wish.1,v 1.1.4.1 1998/09/30 02:16:32 stanton Exp $ '\" .so man.macros .TH wish 1 8.0 Tk "Tk Applications" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: doc/wm.n ================================================================== --- doc/wm.n +++ doc/wm.n @@ -3,11 +3,11 @@ '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" SCCS: @(#) wm.n 1.37 96/10/14 11:07:58 +'\" RCS: @(#) $Id: wm.n,v 1.1.4.1 1998/09/30 02:16:33 stanton Exp $ '\" .so man.macros .TH wm n 4.3 Tk "Tk Built-In Commands" .BS '\" Note: do not modify the .SH NAME line immediately below! Index: generic/README ================================================================== --- generic/README +++ generic/README @@ -1,5 +1,5 @@ This directory contains Tk source files that work on all the platforms where Tk runs (e.g. UNIX, PCs, and Macintoshes). Platform-specific sources are in the directories ../unix, ../win, and ../mac. -SCCS ID: @(#) README 1.1 95/09/11 14:02:45 +RCS ID: @(#) $Id: README,v 1.1.4.1 1998/09/30 02:16:33 stanton Exp $ Index: generic/default.h ================================================================== --- generic/default.h +++ generic/default.h @@ -8,11 +8,11 @@ * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) default.h 1.4 96/02/07 17:33:39 + * RCS: @(#) $Id: default.h,v 1.1.4.1 1998/09/30 02:16:34 stanton Exp $ */ #ifndef _DEFAULT #define _DEFAULT Index: generic/ks_names.h ================================================================== --- generic/ks_names.h +++ generic/ks_names.h @@ -1,7 +1,8 @@ /* * This file is generated from $(INCLUDESRC)/keysymdef.h. Do not edit. + * RCS: $Id: ks_names.h,v 1.1.4.1 1998/09/30 02:16:34 stanton Exp $ */ { "BackSpace", 0xFF08 }, { "Tab", 0xFF09 }, { "Linefeed", 0xFF0A }, { "Clear", 0xFF0B }, @@ -18,10 +19,13 @@ { "Down", 0xFF54 }, { "Prior", 0xFF55 }, { "Next", 0xFF56 }, { "End", 0xFF57 }, { "Begin", 0xFF58 }, +{ "Win_L", 0xFF5B }, +{ "Win_R", 0xFF5C }, +{ "App", 0xFF5D }, { "Select", 0xFF60 }, { "Print", 0xFF61 }, { "Execute", 0xFF62 }, { "Insert", 0xFF63 }, { "Undo", 0xFF65 }, ADDED generic/prolog.ps Index: generic/prolog.ps ================================================================== --- /dev/null +++ generic/prolog.ps @@ -0,0 +1,284 @@ +%%BeginProlog +50 dict begin + +% This is a standard prolog for Postscript generated by Tk's canvas +% widget. +% RCS: @(#) $Id: prolog.ps,v 1.1.2.2 1998/09/30 02:16:35 stanton Exp $ + +% The definitions below just define all of the variables used in +% any of the procedures here. This is needed for obscure reasons +% explained on p. 716 of the Postscript manual (Section H.2.7, +% "Initializing Variables," in the section on Encapsulated Postscript). + +/baseline 0 def +/stipimage 0 def +/height 0 def +/justify 0 def +/lineLength 0 def +/spacing 0 def +/stipple 0 def +/strings 0 def +/xoffset 0 def +/yoffset 0 def +/tmpstip null def + +% Define the array ISOLatin1Encoding (which specifies how characters are +% encoded for ISO-8859-1 fonts), if it isn't already present (Postscript +% level 2 is supposed to define it, but level 1 doesn't). + +systemdict /ISOLatin1Encoding known not { + /ISOLatin1Encoding [ + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /space /exclam /quotedbl /numbersign /dollar /percent /ampersand + /quoteright + /parenleft /parenright /asterisk /plus /comma /minus /period /slash + /zero /one /two /three /four /five /six /seven + /eight /nine /colon /semicolon /less /equal /greater /question + /at /A /B /C /D /E /F /G + /H /I /J /K /L /M /N /O + /P /Q /R /S /T /U /V /W + /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore + /quoteleft /a /b /c /d /e /f /g + /h /i /j /k /l /m /n /o + /p /q /r /s /t /u /v /w + /x /y /z /braceleft /bar /braceright /asciitilde /space + /space /space /space /space /space /space /space /space + /space /space /space /space /space /space /space /space + /dotlessi /grave /acute /circumflex /tilde /macron /breve /dotaccent + /dieresis /space /ring /cedilla /space /hungarumlaut /ogonek /caron + /space /exclamdown /cent /sterling /currency /yen /brokenbar /section + /dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen + /registered /macron + /degree /plusminus /twosuperior /threesuperior /acute /mu /paragraph + /periodcentered + /cedillar /onesuperior /ordmasculine /guillemotright /onequarter + /onehalf /threequarters /questiondown + /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla + /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex + /Idieresis + /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply + /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn + /germandbls + /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla + /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex + /idieresis + /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide + /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn + /ydieresis + ] def +} if + +% font ISOEncode font +% This procedure changes the encoding of a font from the default +% Postscript encoding to ISOLatin1. It's typically invoked just +% before invoking "setfont". The body of this procedure comes from +% Section 5.6.1 of the Postscript book. + +/ISOEncode { + dup length dict begin + {1 index /FID ne {def} {pop pop} ifelse} forall + /Encoding ISOLatin1Encoding def + currentdict + end + + % I'm not sure why it's necessary to use "definefont" on this new + % font, but it seems to be important; just use the name "Temporary" + % for the font. + + /Temporary exch definefont +} bind def + +% StrokeClip +% +% This procedure converts the current path into a clip area under +% the assumption of stroking. It's a bit tricky because some Postscript +% interpreters get errors during strokepath for dashed lines. If +% this happens then turn off dashes and try again. + +/StrokeClip { + {strokepath} stopped { + (This Postscript printer gets limitcheck overflows when) = + (stippling dashed lines; lines will be printed solid instead.) = + [] 0 setdash strokepath} if + clip +} bind def + +% desiredSize EvenPixels closestSize +% +% The procedure below is used for stippling. Given the optimal size +% of a dot in a stipple pattern in the current user coordinate system, +% compute the closest size that is an exact multiple of the device's +% pixel size. This allows stipple patterns to be displayed without +% aliasing effects. + +/EvenPixels { + % Compute exact number of device pixels per stipple dot. + dup 0 matrix currentmatrix dtransform + dup mul exch dup mul add sqrt + + % Round to an integer, make sure the number is at least 1, and compute + % user coord distance corresponding to this. + dup round dup 1 lt {pop 1} if + exch div mul +} bind def + +% width height string StippleFill -- +% +% Given a path already set up and a clipping region generated from +% it, this procedure will fill the clipping region with a stipple +% pattern. "String" contains a proper image description of the +% stipple pattern and "width" and "height" give its dimensions. Each +% stipple dot is assumed to be about one unit across in the current +% user coordinate system. This procedure trashes the graphics state. + +/StippleFill { + % The following code is needed to work around a NeWSprint bug. + + /tmpstip 1 index def + + % Change the scaling so that one user unit in user coordinates + % corresponds to the size of one stipple dot. + 1 EvenPixels dup scale + + % Compute the bounding box occupied by the path (which is now + % the clipping region), and round the lower coordinates down + % to the nearest starting point for the stipple pattern. Be + % careful about negative numbers, since the rounding works + % differently on them. + + pathbbox + 4 2 roll + 5 index div dup 0 lt {1 sub} if cvi 5 index mul 4 1 roll + 6 index div dup 0 lt {1 sub} if cvi 6 index mul 3 2 roll + + % Stack now: width height string y1 y2 x1 x2 + % Below is a doubly-nested for loop to iterate across this area + % in units of the stipple pattern size, going up columns then + % across rows, blasting out a stipple-pattern-sized rectangle at + % each position + + 6 index exch { + 2 index 5 index 3 index { + % Stack now: width height string y1 y2 x y + + gsave + 1 index exch translate + 5 index 5 index true matrix tmpstip imagemask + grestore + } for + pop + } for + pop pop pop pop pop +} bind def + +% -- AdjustColor -- +% Given a color value already set for output by the caller, adjusts +% that value to a grayscale or mono value if requested by the CL +% variable. + +/AdjustColor { + CL 2 lt { + currentgray + CL 0 eq { + .5 lt {0} {1} ifelse + } if + setgray + } if +} bind def + +% x y strings spacing xoffset yoffset justify stipple DrawText -- +% This procedure does all of the real work of drawing text. The +% color and font must already have been set by the caller, and the +% following arguments must be on the stack: +% +% x, y - Coordinates at which to draw text. +% strings - An array of strings, one for each line of the text item, +% in order from top to bottom. +% spacing - Spacing between lines. +% xoffset - Horizontal offset for text bbox relative to x and y: 0 for +% nw/w/sw anchor, -0.5 for n/center/s, and -1.0 for ne/e/se. +% yoffset - Vertical offset for text bbox relative to x and y: 0 for +% nw/n/ne anchor, +0.5 for w/center/e, and +1.0 for sw/s/se. +% justify - 0 for left justification, 0.5 for center, 1 for right justify. +% stipple - Boolean value indicating whether or not text is to be +% drawn in stippled fashion. If text is stippled, +% procedure StippleText must have been defined to call +% StippleFill in the right way. +% +% Also, when this procedure is invoked, the color and font must already +% have been set for the text. + +/DrawText { + /stipple exch def + /justify exch def + /yoffset exch def + /xoffset exch def + /spacing exch def + /strings exch def + + % First scan through all of the text to find the widest line. + + /lineLength 0 def + strings { + stringwidth pop + dup lineLength gt {/lineLength exch def} {pop} ifelse + newpath + } forall + + % Compute the baseline offset and the actual font height. + + 0 0 moveto (TXygqPZ) false charpath + pathbbox dup /baseline exch def + exch pop exch sub /height exch def pop + newpath + + % Translate coordinates first so that the origin is at the upper-left + % corner of the text's bounding box. Remember that x and y for + % positioning are still on the stack. + + translate + lineLength xoffset mul + strings length 1 sub spacing mul height add yoffset mul translate + + % Now use the baseline and justification information to translate so + % that the origin is at the baseline and positioning point for the + % first line of text. + + justify lineLength mul baseline neg translate + + % Iterate over each of the lines to output it. For each line, + % compute its width again so it can be properly justified, then + % display it. + + strings { + dup stringwidth pop + justify neg mul 0 moveto + stipple { + + % The text is stippled, so turn it into a path and print + % by calling StippledText, which in turn calls StippleFill. + % Unfortunately, many Postscript interpreters will get + % overflow errors if we try to do the whole string at + % once, so do it a character at a time. + + gsave + /char (X) def + { + char 0 3 -1 roll put + currentpoint + gsave + char true charpath clip StippleText + grestore + char stringwidth translate + moveto + } forall + grestore + } {show} ifelse + 0 spacing neg translate + } forall +} bind def + +%%EndProlog ADDED generic/tk.decls Index: generic/tk.decls ================================================================== --- /dev/null +++ generic/tk.decls @@ -0,0 +1,1122 @@ +# tk.decls -- +# +# This file contains the declarations for all supported public +# functions that are exported by the Tk library via the stubs table. +# This file is used to generate the tkDecls.h, tkPlatDecls.h, +# tkStub.c, and tkPlatStub.c files. +# +# +# Copyright (c) 1998-1999 by Scriptics Corporation. +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +# RCS: @(#) $Id: tk.decls,v 1.2.2.3 1999/04/01 21:58:49 redman Exp $ + +library tk + +# Define the tk interface with 3 sub interfaces: +# tkPlat - platform specific public +# tkInt - generic private +# tkPlatInt - platform specific private + +interface tk +hooks {tkPlat tkInt tkIntPlat tkIntXlib} + +# Declare each of the functions in the public Tk interface. Note that +# the an index should never be reused for a different function in order +# to preserve backwards compatibility. + +declare 0 generic { + void Tk_MainLoop (void) +} + +declare 1 generic { + XColor *Tk_3DBorderColor (Tk_3DBorder border) +} + +declare 2 generic { + GC Tk_3DBorderGC (Tk_Window tkwin, Tk_3DBorder border, \ + int which) +} + +declare 3 generic { + void Tk_3DHorizontalBevel (Tk_Window tkwin, \ + Drawable drawable, Tk_3DBorder border, int x, \ + int y, int width, int height, int leftIn, \ + int rightIn, int topBevel, int relief) +} + +declare 4 generic { + void Tk_3DVerticalBevel (Tk_Window tkwin, \ + Drawable drawable, Tk_3DBorder border, int x, \ + int y, int width, int height, int leftBevel, \ + int relief) +} + +declare 5 generic { + void Tk_AddOption (Tk_Window tkwin, char *name, \ + char *value, int priority) +} + +declare 6 generic { + void Tk_BindEvent (Tk_BindingTable bindingTable, \ + XEvent *eventPtr, Tk_Window tkwin, int numObjects, \ + ClientData *objectPtr) +} + +declare 7 generic { + void Tk_CanvasDrawableCoords (Tk_Canvas canvas, \ + double x, double y, short *drawableXPtr, \ + short *drawableYPtr) +} + +declare 8 generic { + void Tk_CanvasEventuallyRedraw (Tk_Canvas canvas, int x1, int y1, \ + int x2, int y2) +} + +declare 9 generic { + int Tk_CanvasGetCoord (Tcl_Interp *interp, \ + Tk_Canvas canvas, char *str, double *doublePtr) +} + +declare 10 generic { + Tk_CanvasTextInfo *Tk_CanvasGetTextInfo (Tk_Canvas canvas) +} + +declare 11 generic { + int Tk_CanvasPsBitmap (Tcl_Interp *interp, \ + Tk_Canvas canvas, Pixmap bitmap, int x, int y, \ + int width, int height) +} + +declare 12 generic { + int Tk_CanvasPsColor (Tcl_Interp *interp, \ + Tk_Canvas canvas, XColor *colorPtr) +} + +declare 13 generic { + int Tk_CanvasPsFont (Tcl_Interp *interp, \ + Tk_Canvas canvas, Tk_Font font) +} + +declare 14 generic { + void Tk_CanvasPsPath (Tcl_Interp *interp, \ + Tk_Canvas canvas, double *coordPtr, int numPoints) +} + +declare 15 generic { + int Tk_CanvasPsStipple (Tcl_Interp *interp, \ + Tk_Canvas canvas, Pixmap bitmap) +} + +declare 16 generic { + double Tk_CanvasPsY (Tk_Canvas canvas, double y) +} + +declare 17 generic { + void Tk_CanvasSetStippleOrigin (Tk_Canvas canvas, GC gc) +} + +declare 18 generic { + int Tk_CanvasTagsParseProc (ClientData clientData, Tcl_Interp *interp, \ + Tk_Window tkwin, char *value, char *widgRec, int offset) +} + +declare 19 generic { + char * Tk_CanvasTagsPrintProc (ClientData clientData, Tk_Window tkwin, \ + char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) +} + +declare 20 generic { + Tk_Window Tk_CanvasTkwin (Tk_Canvas canvas) +} + +declare 21 generic { + void Tk_CanvasWindowCoords (Tk_Canvas canvas, double x, double y, \ + short *screenXPtr, short *screenYPtr) +} + +declare 22 generic { + void Tk_ChangeWindowAttributes (Tk_Window tkwin, unsigned long valueMask, \ + XSetWindowAttributes *attsPtr) +} + +declare 23 generic { + int Tk_CharBbox (Tk_TextLayout layout, int index, int *xPtr, \ + int *yPtr, int *widthPtr, int *heightPtr) +} + +declare 24 generic { + void Tk_ClearSelection (Tk_Window tkwin, Atom selection) +} + +declare 25 generic { + int Tk_ClipboardAppend (Tcl_Interp *interp,Tk_Window tkwin, \ + Atom target, Atom format, char* buffer) +} + +declare 26 generic { + int Tk_ClipboardClear (Tcl_Interp *interp, Tk_Window tkwin) +} + +declare 27 generic { + int Tk_ConfigureInfo (Tcl_Interp *interp, \ + Tk_Window tkwin, Tk_ConfigSpec *specs, \ + char *widgRec, char *argvName, int flags) +} + +declare 28 generic { + int Tk_ConfigureValue (Tcl_Interp *interp, \ + Tk_Window tkwin, Tk_ConfigSpec *specs, \ + char *widgRec, char *argvName, int flags) +} + +declare 29 generic { + int Tk_ConfigureWidget (Tcl_Interp *interp, \ + Tk_Window tkwin, Tk_ConfigSpec *specs, \ + int argc, char **argv, char *widgRec, \ + int flags) +} + +declare 30 generic { + void Tk_ConfigureWindow (Tk_Window tkwin, \ + unsigned int valueMask, XWindowChanges *valuePtr) +} + +declare 31 generic { + Tk_TextLayout Tk_ComputeTextLayout (Tk_Font font, \ + CONST char *str, int numChars, int wrapLength, \ + Tk_Justify justify, int flags, int *widthPtr, \ + int *heightPtr) +} + +declare 32 generic { + Tk_Window Tk_CoordsToWindow (int rootX, int rootY, Tk_Window tkwin) +} + +declare 33 generic { + unsigned long Tk_CreateBinding (Tcl_Interp *interp, \ + Tk_BindingTable bindingTable, ClientData object, \ + char *eventStr, char *command, int append) +} + +declare 34 generic { + Tk_BindingTable Tk_CreateBindingTable (Tcl_Interp *interp) +} + +declare 35 generic { + Tk_ErrorHandler Tk_CreateErrorHandler (Display *display, \ + int errNum, int request, int minorCode, \ + Tk_ErrorProc *errorProc, ClientData clientData) +} + +declare 36 generic { + void Tk_CreateEventHandler (Tk_Window token, \ + unsigned long mask, Tk_EventProc *proc, \ + ClientData clientData) +} + +declare 37 generic { + void Tk_CreateGenericHandler (Tk_GenericProc *proc, ClientData clientData) +} + +declare 38 generic { + void Tk_CreateImageType (Tk_ImageType *typePtr) +} + +declare 39 generic { + void Tk_CreateItemType (Tk_ItemType *typePtr) +} + +declare 40 generic { + void Tk_CreatePhotoImageFormat (Tk_PhotoImageFormat *formatPtr) +} + +declare 41 generic { + void Tk_CreateSelHandler (Tk_Window tkwin, \ + Atom selection, Atom target, \ + Tk_SelectionProc *proc, ClientData clientData, \ + Atom format) +} + +declare 42 generic { + Tk_Window Tk_CreateWindow (Tcl_Interp *interp, \ + Tk_Window parent, char *name, char *screenName) +} + +declare 43 generic { + Tk_Window Tk_CreateWindowFromPath (Tcl_Interp *interp, Tk_Window tkwin, \ + char *pathName, char *screenName) +} + +declare 44 generic { + int Tk_DefineBitmap (Tcl_Interp *interp, CONST char *name, char *source, \ + int width, int height) +} + +declare 45 generic { + void Tk_DefineCursor (Tk_Window window, Tk_Cursor cursor) +} + +declare 46 generic { + void Tk_DeleteAllBindings (Tk_BindingTable bindingTable, ClientData object) +} + +declare 47 generic { + int Tk_DeleteBinding (Tcl_Interp *interp, \ + Tk_BindingTable bindingTable, ClientData object, \ + char *eventStr) +} + +declare 48 generic { + void Tk_DeleteBindingTable (Tk_BindingTable bindingTable) +} + +declare 49 generic { + void Tk_DeleteErrorHandler (Tk_ErrorHandler handler) +} + +declare 50 generic { + void Tk_DeleteEventHandler (Tk_Window token, \ + unsigned long mask, Tk_EventProc *proc, \ + ClientData clientData) +} + +declare 51 generic { + void Tk_DeleteGenericHandler (Tk_GenericProc *proc, ClientData clientData) +} + +declare 52 generic { + void Tk_DeleteImage (Tcl_Interp *interp, char *name) +} + +declare 53 generic { + void Tk_DeleteSelHandler (Tk_Window tkwin, Atom selection, Atom target) +} + +declare 54 generic { + void Tk_DestroyWindow (Tk_Window tkwin) +} + +declare 55 generic { + char * Tk_DisplayName (Tk_Window tkwin) +} + +declare 56 generic { + int Tk_DistanceToTextLayout (Tk_TextLayout layout, int x, int y) +} + +declare 57 generic { + void Tk_Draw3DPolygon (Tk_Window tkwin, \ + Drawable drawable, Tk_3DBorder border, \ + XPoint *pointPtr, int numPoints, int borderWidth, \ + int leftRelief) +} + +declare 58 generic { + void Tk_Draw3DRectangle (Tk_Window tkwin, Drawable drawable, \ + Tk_3DBorder border, int x, int y, int width, int height, \ + int borderWidth, int relief) +} + +declare 59 generic { + void Tk_DrawChars (Display *display, Drawable drawable, GC gc, \ + Tk_Font tkfont, CONST char *source, int numBytes, int x, int y) +} + +declare 60 generic { + void Tk_DrawFocusHighlight (Tk_Window tkwin, GC gc, int width, \ + Drawable drawable) +} + +declare 61 generic { + void Tk_DrawTextLayout (Display *display, \ + Drawable drawable, GC gc, Tk_TextLayout layout, \ + int x, int y, int firstChar, int lastChar) +} + +declare 62 generic { + void Tk_Fill3DPolygon (Tk_Window tkwin, \ + Drawable drawable, Tk_3DBorder border, \ + XPoint *pointPtr, int numPoints, int borderWidth, \ + int leftRelief) +} + +declare 63 generic { + void Tk_Fill3DRectangle (Tk_Window tkwin, \ + Drawable drawable, Tk_3DBorder border, int x, \ + int y, int width, int height, int borderWidth, \ + int relief) +} + +declare 64 generic { + Tk_PhotoHandle Tk_FindPhoto (Tcl_Interp *interp, char *imageName) +} + +declare 65 generic { + Font Tk_FontId (Tk_Font font) +} + +declare 66 generic { + void Tk_Free3DBorder (Tk_3DBorder border) +} + +declare 67 generic { + void Tk_FreeBitmap (Display *display, Pixmap bitmap) +} + +declare 68 generic { + void Tk_FreeColor (XColor *colorPtr) +} + +declare 69 generic { + void Tk_FreeColormap (Display *display, Colormap colormap) +} + +declare 70 generic { + void Tk_FreeCursor (Display *display, Tk_Cursor cursor) +} + +declare 71 generic { + void Tk_FreeFont (Tk_Font f) +} + +declare 72 generic { + void Tk_FreeGC (Display *display, GC gc) +} + +declare 73 generic { + void Tk_FreeImage (Tk_Image image) +} + +declare 74 generic { + void Tk_FreeOptions (Tk_ConfigSpec *specs, \ + char *widgRec, Display *display, int needFlags) +} + +declare 75 generic { + void Tk_FreePixmap (Display *display, Pixmap pixmap) +} + +declare 76 generic { + void Tk_FreeTextLayout (Tk_TextLayout textLayout) +} + +declare 77 generic { + void Tk_FreeXId (Display *display, XID xid) +} + +declare 78 generic { + GC Tk_GCForColor (XColor *colorPtr, Drawable drawable) +} + +declare 79 generic { + void Tk_GeometryRequest (Tk_Window tkwin, int reqWidth, int reqHeight) +} + +declare 80 generic { + Tk_3DBorder Tk_Get3DBorder (Tcl_Interp *interp, Tk_Window tkwin, \ + Tk_Uid colorName) +} + +declare 81 generic { + void Tk_GetAllBindings (Tcl_Interp *interp, \ + Tk_BindingTable bindingTable, ClientData object) +} + +declare 82 generic { + int Tk_GetAnchor (Tcl_Interp *interp, \ + char *str, Tk_Anchor *anchorPtr) +} + +declare 83 generic { + char * Tk_GetAtomName (Tk_Window tkwin, Atom atom) +} + +declare 84 generic { + char * Tk_GetBinding (Tcl_Interp *interp, \ + Tk_BindingTable bindingTable, ClientData object, \ + char *eventStr) +} + +declare 85 generic { + Pixmap Tk_GetBitmap (Tcl_Interp *interp, Tk_Window tkwin, CONST char * str) +} + +declare 86 generic { + Pixmap Tk_GetBitmapFromData (Tcl_Interp *interp, \ + Tk_Window tkwin, char *source, int width, int height) +} + +declare 87 generic { + int Tk_GetCapStyle (Tcl_Interp *interp, char *str, int *capPtr) +} + +declare 88 generic { + XColor * Tk_GetColor (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name) +} + +declare 89 generic { + XColor * Tk_GetColorByValue (Tk_Window tkwin, XColor *colorPtr) +} + +declare 90 generic { + Colormap Tk_GetColormap (Tcl_Interp *interp, Tk_Window tkwin, char *str) +} + +declare 91 generic { + Tk_Cursor Tk_GetCursor (Tcl_Interp *interp, Tk_Window tkwin, \ + Tk_Uid str) +} + +declare 92 generic { + Tk_Cursor Tk_GetCursorFromData (Tcl_Interp *interp, \ + Tk_Window tkwin, char *source, char *mask, \ + int width, int height, int xHot, int yHot, \ + Tk_Uid fg, Tk_Uid bg) +} + +declare 93 generic { + Tk_Font Tk_GetFont (Tcl_Interp *interp, \ + Tk_Window tkwin, CONST char *str) +} + +declare 94 generic { + Tk_Font Tk_GetFontFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 95 generic { + void Tk_GetFontMetrics (Tk_Font font, Tk_FontMetrics *fmPtr) +} + +declare 96 generic { + GC Tk_GetGC (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr) +} + +declare 97 generic { + Tk_Image Tk_GetImage (Tcl_Interp *interp, Tk_Window tkwin, char *name, \ + Tk_ImageChangedProc *changeProc, ClientData clientData) +} + +declare 98 generic { + ClientData Tk_GetImageMasterData (Tcl_Interp *interp, \ + char *name, Tk_ImageType **typePtrPtr) +} + +declare 99 generic { + Tk_ItemType * Tk_GetItemTypes (void) +} + +declare 100 generic { + int Tk_GetJoinStyle (Tcl_Interp *interp, char *str, int *joinPtr) +} + +declare 101 generic { + int Tk_GetJustify (Tcl_Interp *interp, \ + char *str, Tk_Justify *justifyPtr) +} + +declare 102 generic { + int Tk_GetNumMainWindows (void) +} + +declare 103 generic { + Tk_Uid Tk_GetOption (Tk_Window tkwin, char *name, char *className) +} + +declare 104 generic { + int Tk_GetPixels (Tcl_Interp *interp, \ + Tk_Window tkwin, char *str, int *intPtr) +} + +declare 105 generic { + Pixmap Tk_GetPixmap (Display *display, Drawable d, \ + int width, int height, int depth) +} + +declare 106 generic { + int Tk_GetRelief (Tcl_Interp *interp, char *name, int *reliefPtr) +} + +declare 107 generic { + void Tk_GetRootCoords (Tk_Window tkwin, int *xPtr, int *yPtr) +} + +declare 108 generic { + int Tk_GetScrollInfo (Tcl_Interp *interp, \ + int argc, char **argv, double *dblPtr, int *intPtr) +} + +declare 109 generic { + int Tk_GetScreenMM (Tcl_Interp *interp, \ + Tk_Window tkwin, char *str, double *doublePtr) +} + +declare 110 generic { + int Tk_GetSelection (Tcl_Interp *interp, \ + Tk_Window tkwin, Atom selection, Atom target, \ + Tk_GetSelProc *proc, ClientData clientData) +} + +declare 111 generic { + Tk_Uid Tk_GetUid (CONST char *str) +} + +declare 112 generic { + Visual * Tk_GetVisual (Tcl_Interp *interp, \ + Tk_Window tkwin, char *str, int *depthPtr, \ + Colormap *colormapPtr) +} + +declare 113 generic { + void Tk_GetVRootGeometry (Tk_Window tkwin, \ + int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) +} + +declare 114 generic { + int Tk_Grab (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal) +} + +declare 115 generic { + void Tk_HandleEvent (XEvent *eventPtr) +} + +declare 116 generic { + Tk_Window Tk_IdToWindow (Display *display, Window window) +} + +declare 117 generic { + void Tk_ImageChanged (Tk_ImageMaster master, int x, int y, \ + int width, int height, int imageWidth, int imageHeight) +} + +declare 118 generic { + int Tk_Init (Tcl_Interp *interp) +} + +declare 119 generic { + Atom Tk_InternAtom (Tk_Window tkwin, char *name) +} + +declare 120 generic { + int Tk_IntersectTextLayout (Tk_TextLayout layout, int x, int y, \ + int width, int height) +} + +declare 121 generic { + void Tk_MaintainGeometry (Tk_Window slave, \ + Tk_Window master, int x, int y, int width, int height) +} + +declare 122 generic { + Tk_Window Tk_MainWindow (Tcl_Interp *interp) +} + +declare 123 generic { + void Tk_MakeWindowExist (Tk_Window tkwin) +} + +declare 124 generic { + void Tk_ManageGeometry (Tk_Window tkwin, \ + Tk_GeomMgr *mgrPtr, ClientData clientData) +} + +declare 125 generic { + void Tk_MapWindow (Tk_Window tkwin) +} + +declare 126 generic { + int Tk_MeasureChars (Tk_Font tkfont, \ + CONST char *source, int numBytes, int maxPixels, \ + int flags, int *lengthPtr) +} + +declare 127 generic { + void Tk_MoveResizeWindow (Tk_Window tkwin, \ + int x, int y, int width, int height) +} + +declare 128 generic { + void Tk_MoveWindow (Tk_Window tkwin, int x, int y) +} + +declare 129 generic { + void Tk_MoveToplevelWindow (Tk_Window tkwin, int x, int y) +} + +declare 130 generic { + char * Tk_NameOf3DBorder (Tk_3DBorder border) +} + +declare 131 generic { + char * Tk_NameOfAnchor (Tk_Anchor anchor) +} + +declare 132 generic { + char * Tk_NameOfBitmap (Display *display, Pixmap bitmap) +} + +declare 133 generic { + char * Tk_NameOfCapStyle (int cap) +} + +declare 134 generic { + char * Tk_NameOfColor (XColor *colorPtr) +} + +declare 135 generic { + char * Tk_NameOfCursor (Display *display, Tk_Cursor cursor) +} + +declare 136 generic { + char * Tk_NameOfFont (Tk_Font font) +} + +declare 137 generic { + char * Tk_NameOfImage (Tk_ImageMaster imageMaster) +} + +declare 138 generic { + char * Tk_NameOfJoinStyle (int join) +} + +declare 139 generic { + char * Tk_NameOfJustify (Tk_Justify justify) +} + +declare 140 generic { + char * Tk_NameOfRelief (int relief) +} + +declare 141 generic { + Tk_Window Tk_NameToWindow (Tcl_Interp *interp, \ + char *pathName, Tk_Window tkwin) +} + +declare 142 generic { + void Tk_OwnSelection (Tk_Window tkwin, \ + Atom selection, Tk_LostSelProc *proc, \ + ClientData clientData) +} + +declare 143 generic { + int Tk_ParseArgv (Tcl_Interp *interp, \ + Tk_Window tkwin, int *argcPtr, char **argv, \ + Tk_ArgvInfo *argTable, int flags) +} + +declare 144 generic { + void Tk_PhotoPutBlock (Tk_PhotoHandle handle, \ + Tk_PhotoImageBlock *blockPtr, int x, int y, \ + int width, int height) +} + +declare 145 generic { + void Tk_PhotoPutZoomedBlock (Tk_PhotoHandle handle, \ + Tk_PhotoImageBlock *blockPtr, int x, int y, \ + int width, int height, int zoomX, int zoomY, \ + int subsampleX, int subsampleY) +} + +declare 146 generic { + int Tk_PhotoGetImage (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr) +} + +declare 147 generic { + void Tk_PhotoBlank (Tk_PhotoHandle handle) +} + +declare 148 generic { + void Tk_PhotoExpand (Tk_PhotoHandle handle, int width, int height ) +} + +declare 149 generic { + void Tk_PhotoGetSize (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr) +} + +declare 150 generic { + void Tk_PhotoSetSize (Tk_PhotoHandle handle, int width, int height) +} + +declare 151 generic { + int Tk_PointToChar (Tk_TextLayout layout, int x, int y) +} + +declare 152 generic { + int Tk_PostscriptFontName (Tk_Font tkfont, Tcl_DString *dsPtr) +} + +declare 153 generic { + void Tk_PreserveColormap (Display *display, Colormap colormap) +} + +declare 154 generic { + void Tk_QueueWindowEvent (XEvent *eventPtr, Tcl_QueuePosition position) +} + +declare 155 generic { + void Tk_RedrawImage (Tk_Image image, int imageX, \ + int imageY, int width, int height, \ + Drawable drawable, int drawableX, int drawableY) +} + +declare 156 generic { + void Tk_ResizeWindow (Tk_Window tkwin, int width, int height) +} + +declare 157 generic { + int Tk_RestackWindow (Tk_Window tkwin, int aboveBelow, Tk_Window other) +} + +declare 158 generic { + Tk_RestrictProc *Tk_RestrictEvents (Tk_RestrictProc *proc, \ + ClientData arg, ClientData *prevArgPtr) +} + +declare 159 generic { + int Tk_SafeInit (Tcl_Interp *interp) +} + +declare 160 generic { + char * Tk_SetAppName (Tk_Window tkwin, char *name) +} + +declare 161 generic { + void Tk_SetBackgroundFromBorder (Tk_Window tkwin, Tk_3DBorder border) +} + +declare 162 generic { + void Tk_SetClass (Tk_Window tkwin, char *className) +} + +declare 163 generic { + void Tk_SetGrid (Tk_Window tkwin, int reqWidth, int reqHeight, \ + int gridWidth, int gridHeight) +} + +declare 164 generic { + void Tk_SetInternalBorder (Tk_Window tkwin, int width) +} + +declare 165 generic { + void Tk_SetWindowBackground (Tk_Window tkwin, unsigned long pixel) +} + +declare 166 generic { + void Tk_SetWindowBackgroundPixmap (Tk_Window tkwin, Pixmap pixmap) +} + +declare 167 generic { + void Tk_SetWindowBorder (Tk_Window tkwin, unsigned long pixel) +} + +declare 168 generic { + void Tk_SetWindowBorderWidth (Tk_Window tkwin, int width) +} + +declare 169 generic { + void Tk_SetWindowBorderPixmap (Tk_Window tkwin, Pixmap pixmap) +} + +declare 170 generic { + void Tk_SetWindowColormap (Tk_Window tkwin, Colormap colormap) +} + +declare 171 generic { + int Tk_SetWindowVisual (Tk_Window tkwin, Visual *visual, int depth,\ + Colormap colormap) +} + +declare 172 generic { + void Tk_SizeOfBitmap (Display *display, Pixmap bitmap, int *widthPtr, \ + int *heightPtr) +} + +declare 173 generic { + void Tk_SizeOfImage (Tk_Image image, int *widthPtr, int *heightPtr) +} + +declare 174 generic { + int Tk_StrictMotif (Tk_Window tkwin) +} + +declare 175 generic { + void Tk_TextLayoutToPostscript (Tcl_Interp *interp, Tk_TextLayout layout) +} + +declare 176 generic { + int Tk_TextWidth (Tk_Font font, CONST char *str, int numBytes) +} + +declare 177 generic { + void Tk_UndefineCursor (Tk_Window window) +} + +declare 178 generic { + void Tk_UnderlineChars (Display *display, \ + Drawable drawable, GC gc, Tk_Font tkfont, \ + CONST char *source, int x, int y, int firstByte, \ + int lastByte) +} + +declare 179 generic { + void Tk_UnderlineTextLayout (Display *display, Drawable drawable, GC gc, \ + Tk_TextLayout layout, int x, int y, \ + int underline) +} + +declare 180 generic { + void Tk_Ungrab (Tk_Window tkwin) +} + +declare 181 generic { + void Tk_UnmaintainGeometry (Tk_Window slave, Tk_Window master) +} + +declare 182 generic { + void Tk_UnmapWindow (Tk_Window tkwin) +} + +declare 183 generic { + void Tk_UnsetGrid (Tk_Window tkwin) +} + +declare 184 generic { + void Tk_UpdatePointer (Tk_Window tkwin, int x, int y, int state) +} + +# new functions for 8.1 + +declare 185 generic { + Pixmap Tk_AllocBitmapFromObj (Tcl_Interp *interp, Tk_Window tkwin, \ + Tcl_Obj *objPtr) +} + +declare 186 generic { + Tk_3DBorder Tk_Alloc3DBorderFromObj (Tcl_Interp *interp, Tk_Window tkwin, \ + Tcl_Obj *objPtr) +} + +declare 187 generic { + XColor * Tk_AllocColorFromObj (Tcl_Interp *interp, Tk_Window tkwin, \ + Tcl_Obj *objPtr) +} + +declare 188 generic { + Tk_Cursor Tk_AllocCursorFromObj (Tcl_Interp *interp, Tk_Window tkwin, \ + Tcl_Obj *objPtr) +} + +declare 189 generic { + Tk_Font Tk_AllocFontFromObj (Tcl_Interp *interp, Tk_Window tkwin, \ + Tcl_Obj *objPtr) + +} + +declare 190 generic { + Tk_OptionTable Tk_CreateOptionTable (Tcl_Interp *interp, \ + CONST Tk_OptionSpec *templatePtr) +} + +declare 191 generic { + void Tk_DeleteOptionTable (Tk_OptionTable optionTable) +} + +declare 192 generic { + void Tk_Free3DBorderFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 193 generic { + void Tk_FreeBitmapFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 194 generic { + void Tk_FreeColorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 195 generic { + void Tk_FreeConfigOptions (char *recordPtr, Tk_OptionTable optionToken, \ + Tk_Window tkwin) + +} + +declare 196 generic { + void Tk_FreeSavedOptions (Tk_SavedOptions *savePtr) +} + +declare 197 generic { + void Tk_FreeCursorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 198 generic { + void Tk_FreeFontFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 199 generic { + Tk_3DBorder Tk_Get3DBorderFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 200 generic { + int Tk_GetAnchorFromObj (Tcl_Interp *interp, Tcl_Obj *objPtr, \ + Tk_Anchor *anchorPtr) +} + +declare 201 generic { + Pixmap Tk_GetBitmapFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 202 generic { + XColor * Tk_GetColorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 203 generic { + Tk_Cursor Tk_GetCursorFromObj (Tk_Window tkwin, Tcl_Obj *objPtr) +} + +declare 204 generic { + Tcl_Obj * Tk_GetOptionInfo (Tcl_Interp *interp, \ + char *recordPtr, Tk_OptionTable optionTable, \ + Tcl_Obj *namePtr, Tk_Window tkwin) +} + +declare 205 generic { + Tcl_Obj * Tk_GetOptionValue (Tcl_Interp *interp, char *recordPtr, \ + Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin) +} + +declare 206 generic { + int Tk_GetJustifyFromObj (Tcl_Interp *interp, \ + Tcl_Obj *objPtr, Tk_Justify *justifyPtr) +} + +declare 207 generic { + int Tk_GetMMFromObj (Tcl_Interp *interp, \ + Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr) +} + +declare 208 generic { + int Tk_GetPixelsFromObj (Tcl_Interp *interp, \ + Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr) +} + +declare 209 generic { + int Tk_GetReliefFromObj (Tcl_Interp *interp, \ + Tcl_Obj *objPtr, int *resultPtr) +} + +declare 210 generic { + int Tk_GetScrollInfoObj (Tcl_Interp *interp, \ + int objc, Tcl_Obj *CONST objv[], double *dblPtr, int *intPtr) +} + +declare 211 generic { + int Tk_InitOptions ( + Tcl_Interp *interp, char *recordPtr, \ + Tk_OptionTable optionToken, Tk_Window tkwin) +} + +declare 212 generic { + void Tk_MainEx (int argc, char **argv, Tcl_AppInitProc *appInitProc, \ + Tcl_Interp *interp) +} + +declare 213 generic { + void Tk_RestoreSavedOptions (Tk_SavedOptions *savePtr) +} + +declare 214 generic { + int Tk_SetOptions (Tcl_Interp *interp, char *recordPtr, \ + Tk_OptionTable optionTable, int objc, \ + Tcl_Obj *CONST objv[], Tk_Window tkwin, \ + Tk_SavedOptions *savePtr, int *maskPtr) +} + + +# Define the platform specific public Tk interface. These functions are +# only available on the designated platform. + +interface tkPlat + +# Unix specific functions +# (none) + +# Windows specific functions + +declare 0 win { + Window Tk_AttachHWND (Tk_Window tkwin, HWND hwnd) +} + +declare 1 win { + HINSTANCE Tk_GetHINSTANCE (void) +} + +declare 2 win { + HWND Tk_GetHWND (Window window) +} + +declare 3 win { + Tk_Window Tk_HWNDToWindow (HWND hwnd) +} + +declare 4 win { + void Tk_PointerEvent (HWND hwnd, int x, int y) +} + +declare 5 win { + int Tk_TranslateWinEvent (HWND hwnd, \ + UINT message, WPARAM wParam, LPARAM lParam, LRESULT *result) +} + +# Mac specific functions + +declare 0 mac { + void Tk_MacSetEmbedHandler ( \ + Tk_MacEmbedRegisterWinProc *registerWinProcPtr, \ + Tk_MacEmbedGetGrafPortProc *getPortProcPtr, \ + Tk_MacEmbedMakeContainerExistProc *containerExistProcPtr, \ + Tk_MacEmbedGetClipProc *getClipProc, \ + Tk_MacEmbedGetOffsetInParentProc *getOffsetProc) +} + +declare 1 mac { + void Tk_MacTurnOffMenus (void) +} + +declare 2 mac { + void Tk_MacTkOwnsCursor (int tkOwnsIt) +} + +declare 3 mac { + void TkMacInitMenus (Tcl_Interp *interp) +} + +declare 4 mac { + void TkMacInitAppleEvents (Tcl_Interp *interp) +} + +declare 5 mac { + int TkMacConvertEvent (EventRecord *eventPtr) +} + +declare 6 mac { + int TkMacConvertTkEvent (EventRecord *eventPtr, Window window) +} + +declare 7 mac { + void TkGenWMConfigureEvent (Tk_Window tkwin, \ + int x, int y, int width, int height, int flags) +} + +declare 8 mac { + void TkMacInvalClipRgns (TkWindow *winPtr) +} + +declare 9 mac { + int TkMacHaveAppearance (void) +} + +declare 10 mac { + GWorldPtr TkMacGetDrawablePort (Drawable drawable) +} + Index: generic/tk.h ================================================================== --- generic/tk.h +++ generic/tk.h @@ -4,16 +4,17 @@ * Declarations for Tk-related things that are visible * outside of the Tk module itself. * * Copyright (c) 1989-1994 The Regents of the University of California. * Copyright (c) 1994 The Australian National University. - * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1994-1998 Sun Microsystems, Inc. + * Copyright (c) 1998-1999 Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tk.h 1.211 97/11/20 12:44:45 + * RCS: @(#) $Id: tk.h,v 1.1.4.15 1999/04/01 21:58:49 redman Exp $ */ #ifndef _TK #define _TK @@ -22,37 +23,27 @@ * and update the version numbers: * * unix/configure.in * win/makefile.bc * win/makefile.vc - * library/tk.tcl - * - * The release level should be 0 for alpha, 1 for beta, and 2 for - * final/patch. The release serial value is the number that follows the - * "a", "b", or "p" in the patch level; for example, if the patch level - * is 4.3b2, TK_RELEASE_SERIAL is 2. It restarts at 1 whenever the - * release level is changed, except for the final release, which should - * be 0. - * + * README + * library/tk.tcl (only if major.minor changes, not patchlevel) + * mac/README (only if major.minor changes, not patchlevel) + * win/README (only if major.minor changes, not patchlevel) + * unix/README (only if major.minor changes, not patchlevel) + * You may also need to update some of these files when the numbers change * for the version of Tcl that this release of Tk is compiled against. */ #define TK_MAJOR_VERSION 8 -#define TK_MINOR_VERSION 0 -#define TK_RELEASE_LEVEL 2 -#define TK_RELEASE_SERIAL 2 - -#define TK_VERSION "8.0" -#define TK_PATCH_LEVEL "8.0p2" - -/* - * A special definition used to allow this header file to be included - * in resource files. - */ - -#ifndef RESOURCE_INCLUDED +#define TK_MINOR_VERSION 1 +#define TK_RELEASE_LEVEL TCL_BETA_RELEASE +#define TK_RELEASE_SERIAL 3 + +#define TK_VERSION "8.1" +#define TK_PATCH_LEVEL "8.1b3" /* * The following definitions set up the proper options for Macintosh * compilers. We use this method because there is no autoconf equivalent. */ @@ -64,10 +55,18 @@ #endif #ifndef _TCL # include #endif + +/* + * A special definition used to allow this header file to be included + * in resource files. + */ + +#ifndef RESOURCE_INCLUDED + #ifndef _XLIB_H # ifdef MAC_TCL # include # include # else @@ -75,10 +74,15 @@ # endif #endif #ifdef __STDC__ # include #endif + +#ifdef BUILD_tk +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif /* * Decide whether or not to use input methods. */ @@ -95,10 +99,11 @@ typedef struct Tk_Cursor_ *Tk_Cursor; typedef struct Tk_ErrorHandler_ *Tk_ErrorHandler; typedef struct Tk_Font_ *Tk_Font; typedef struct Tk_Image__ *Tk_Image; typedef struct Tk_ImageMaster_ *Tk_ImageMaster; +typedef struct Tk_OptionTable_ *Tk_OptionTable; typedef struct Tk_TextLayout_ *Tk_TextLayout; typedef struct Tk_Window_ *Tk_Window; typedef struct Tk_3DBorder_ *Tk_3DBorder; /* @@ -106,57 +111,167 @@ */ typedef char *Tk_Uid; /* - * Structure used to specify how to handle argv options. - */ - -typedef struct { - char *key; /* The key string that flags the option in the - * argv array. */ - int type; /* Indicates option type; see below. */ - char *src; /* Value to be used in setting dst; usage - * depends on type. */ - char *dst; /* Address of value to be modified; usage - * depends on type. */ - char *help; /* Documentation message describing this option. */ -} Tk_ArgvInfo; - -/* - * Legal values for the type field of a Tk_ArgvInfo: see the user - * documentation for details. - */ - -#define TK_ARGV_CONSTANT 15 -#define TK_ARGV_INT 16 -#define TK_ARGV_STRING 17 -#define TK_ARGV_UID 18 -#define TK_ARGV_REST 19 -#define TK_ARGV_FLOAT 20 -#define TK_ARGV_FUNC 21 -#define TK_ARGV_GENFUNC 22 -#define TK_ARGV_HELP 23 -#define TK_ARGV_CONST_OPTION 24 -#define TK_ARGV_OPTION_VALUE 25 -#define TK_ARGV_OPTION_NAME_VALUE 26 -#define TK_ARGV_END 27 - -/* - * Flag bits for passing to Tk_ParseArgv: - */ - -#define TK_ARGV_NO_DEFAULTS 0x1 -#define TK_ARGV_NO_LEFTOVERS 0x2 -#define TK_ARGV_NO_ABBREV 0x4 -#define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8 + * The enum below defines the valid types for Tk configuration options + * as implemented by Tk_InitOptions, Tk_SetOptions, etc. + */ + +typedef enum { + TK_OPTION_BOOLEAN, + TK_OPTION_INT, + TK_OPTION_DOUBLE, + TK_OPTION_STRING, + TK_OPTION_STRING_TABLE, + TK_OPTION_COLOR, + TK_OPTION_FONT, + TK_OPTION_BITMAP, + TK_OPTION_BORDER, + TK_OPTION_RELIEF, + TK_OPTION_CURSOR, + TK_OPTION_JUSTIFY, + TK_OPTION_ANCHOR, + TK_OPTION_SYNONYM, + TK_OPTION_PIXELS, + TK_OPTION_WINDOW, + TK_OPTION_END +} Tk_OptionType; + +/* + * Structures of the following type are used by widgets to specify + * their configuration options. Typically each widget has a static + * array of these structures, where each element of the array describes + * a single configuration option. The array is passed to + * Tk_CreateOptionTable. + */ + +typedef struct Tk_OptionSpec { + Tk_OptionType type; /* Type of option, such as TK_OPTION_COLOR; + * see definitions above. Last option in + * table must have type TK_OPTION_END. */ + char *optionName; /* Name used to specify option in Tcl + * commands. */ + char *dbName; /* Name for option in option database. */ + char *dbClass; /* Class for option in database. */ + char *defValue; /* Default value for option if not specified + * in command line, the option database, + * or the system. */ + int objOffset; /* Where in record to store a Tcl_Obj * that + * holds the value of this option, specified + * as an offset in bytes from the start of + * the record. Use the Tk_Offset macro to + * generate values for this. -1 means don't + * store the Tcl_Obj in the record. */ + int internalOffset; /* Where in record to store the internal + * representation of the value of this option, + * such as an int or XColor *. This field + * is specified as an offset in bytes + * from the start of the record. Use the + * Tk_Offset macro to generate values for it. + * -1 means don't store the internal + * representation in the record. */ + int flags; /* Any combination of the values defined + * below. */ + ClientData clientData; /* An alternate place to put option-specific + * data. Used for the monochrome default value + * for colors, etc. */ + int typeMask; /* An arbitrary bit mask defined by the + * class manager; typically bits correspond + * to certain kinds of options such as all + * those that require a redisplay when they + * change. Tk_SetOptions returns the bit-wise + * OR of the typeMasks of all options that + * were changed. */ +} Tk_OptionSpec; + +/* + * Flag values for Tk_OptionSpec structures. These flags are shared by + * Tk_ConfigSpec structures, so be sure to coordinate any changes + * carefully. + */ + +#define TK_OPTION_NULL_OK 1 + +/* + * Macro to use to fill in "offset" fields of Tk_OptionSpecs. + * Computes number of bytes from beginning of structure to a + * given field. + */ + +#ifdef offsetof +#define Tk_Offset(type, field) ((int) offsetof(type, field)) +#else +#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field)) +#endif + +/* + * The following two structures are used for error handling. When + * configuration options are being modified, the old values are + * saved in a Tk_SavedOptions structure. If an error occurs, then the + * contents of the structure can be used to restore all of the old + * values. The contents of this structure are for the private use + * Tk. No-one outside Tk should ever read or write any of the fields + * of these structures. + */ + +typedef struct Tk_SavedOption { + struct TkOption *optionPtr; /* Points to information that describes + * the option. */ + Tcl_Obj *valuePtr; /* The old value of the option, in + * the form of a Tcl object; may be + * NULL if the value wasn't saved as + * an object. */ + double internalForm; /* The old value of the option, in + * some internal representation such + * as an int or (XColor *). Valid + * only if optionPtr->specPtr->objOffset + * is < 0. The space must be large + * enough to accommodate a double, a + * long, or a pointer; right now it + * looks like a double is big + * enough. Also, using a double + * guarantees that the field is + * properly aligned for storing large + * values. */ +} Tk_SavedOption; + +#ifdef TCL_MEM_DEBUG +# define TK_NUM_SAVED_OPTIONS 2 +#else +# define TK_NUM_SAVED_OPTIONS 20 +#endif + +typedef struct Tk_SavedOptions { + char *recordPtr; /* The data structure in which to + * restore configuration options. */ + Tk_Window tkwin; /* Window associated with recordPtr; + * needed to restore certain options. */ + int numItems; /* The number of valid items in + * items field. */ + Tk_SavedOption items[TK_NUM_SAVED_OPTIONS]; + /* Items used to hold old values. */ + struct Tk_SavedOptions *nextPtr; /* Points to next structure in list; + * needed if too many options changed + * to hold all the old values in a + * single structure. NULL means no + * more structures. */ +} Tk_SavedOptions; /* * Structure used to describe application-specific configuration * options: indicates procedures to call to parse an option and - * to return a text string describing an option. + * to return a text string describing an option. THESE ARE + * DEPRECATED; PLEASE USE THE NEW STRUCTURES LISTED ABOVE. + */ + +/* + * This is a temporary flag used while tkObjConfig and new widgets + * are in development. */ + +#ifndef __NO_OLD_CONFIG typedef int (Tk_OptionParseProc) _ANSI_ARGS_((ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, char *value, char *widgRec, int offset)); typedef char *(Tk_OptionPrintProc) _ANSI_ARGS_((ClientData clientData, @@ -207,64 +322,83 @@ /* * Type values for Tk_ConfigSpec structures. See the user * documentation for details. */ -#define TK_CONFIG_BOOLEAN 1 -#define TK_CONFIG_INT 2 -#define TK_CONFIG_DOUBLE 3 -#define TK_CONFIG_STRING 4 -#define TK_CONFIG_UID 5 -#define TK_CONFIG_COLOR 6 -#define TK_CONFIG_FONT 7 -#define TK_CONFIG_BITMAP 8 -#define TK_CONFIG_BORDER 9 -#define TK_CONFIG_RELIEF 10 -#define TK_CONFIG_CURSOR 11 -#define TK_CONFIG_ACTIVE_CURSOR 12 -#define TK_CONFIG_JUSTIFY 13 -#define TK_CONFIG_ANCHOR 14 -#define TK_CONFIG_SYNONYM 15 -#define TK_CONFIG_CAP_STYLE 16 -#define TK_CONFIG_JOIN_STYLE 17 -#define TK_CONFIG_PIXELS 18 -#define TK_CONFIG_MM 19 -#define TK_CONFIG_WINDOW 20 -#define TK_CONFIG_CUSTOM 21 -#define TK_CONFIG_END 22 - -/* - * Macro to use to fill in "offset" fields of Tk_ConfigInfos. - * Computes number of bytes from beginning of structure to a - * given field. - */ - -#ifdef offsetof -#define Tk_Offset(type, field) ((int) offsetof(type, field)) -#else -#define Tk_Offset(type, field) ((int) ((char *) &((type *) 0)->field)) -#endif +typedef enum { + TK_CONFIG_BOOLEAN, TK_CONFIG_INT, TK_CONFIG_DOUBLE, TK_CONFIG_STRING, + TK_CONFIG_UID, TK_CONFIG_COLOR, TK_CONFIG_FONT, TK_CONFIG_BITMAP, + TK_CONFIG_BORDER, TK_CONFIG_RELIEF, TK_CONFIG_CURSOR, + TK_CONFIG_ACTIVE_CURSOR, TK_CONFIG_JUSTIFY, TK_CONFIG_ANCHOR, + TK_CONFIG_SYNONYM, TK_CONFIG_CAP_STYLE, TK_CONFIG_JOIN_STYLE, + TK_CONFIG_PIXELS, TK_CONFIG_MM, TK_CONFIG_WINDOW, TK_CONFIG_CUSTOM, + TK_CONFIG_END +} Tk_ConfigTypes; /* * Possible values for flags argument to Tk_ConfigureWidget: */ #define TK_CONFIG_ARGV_ONLY 1 /* - * Possible flag values for Tk_ConfigInfo structures. Any bits at + * Possible flag values for Tk_ConfigSpec structures. Any bits at * or above TK_CONFIG_USER_BIT may be used by clients for selecting * certain entries. Before changing any values here, coordinate with - * tkConfig.c (internal-use-only flags are defined there). + * tkOldConfig.c (internal-use-only flags are defined there). */ -#define TK_CONFIG_COLOR_ONLY 1 -#define TK_CONFIG_MONO_ONLY 2 -#define TK_CONFIG_NULL_OK 4 +#define TK_CONFIG_NULL_OK 1 +#define TK_CONFIG_COLOR_ONLY 2 +#define TK_CONFIG_MONO_ONLY 4 #define TK_CONFIG_DONT_SET_DEFAULT 8 #define TK_CONFIG_OPTION_SPECIFIED 0x10 #define TK_CONFIG_USER_BIT 0x100 +#endif /* __NO_OLD_CONFIG */ + +/* + * Structure used to specify how to handle argv options. + */ + +typedef struct { + char *key; /* The key string that flags the option in the + * argv array. */ + int type; /* Indicates option type; see below. */ + char *src; /* Value to be used in setting dst; usage + * depends on type. */ + char *dst; /* Address of value to be modified; usage + * depends on type. */ + char *help; /* Documentation message describing this option. */ +} Tk_ArgvInfo; + +/* + * Legal values for the type field of a Tk_ArgvInfo: see the user + * documentation for details. + */ + +#define TK_ARGV_CONSTANT 15 +#define TK_ARGV_INT 16 +#define TK_ARGV_STRING 17 +#define TK_ARGV_UID 18 +#define TK_ARGV_REST 19 +#define TK_ARGV_FLOAT 20 +#define TK_ARGV_FUNC 21 +#define TK_ARGV_GENFUNC 22 +#define TK_ARGV_HELP 23 +#define TK_ARGV_CONST_OPTION 24 +#define TK_ARGV_OPTION_VALUE 25 +#define TK_ARGV_OPTION_NAME_VALUE 26 +#define TK_ARGV_END 27 + +/* + * Flag bits for passing to Tk_ParseArgv: + */ + +#define TK_ARGV_NO_DEFAULTS 0x1 +#define TK_ARGV_NO_LEFTOVERS 0x2 +#define TK_ARGV_NO_ABBREV 0x4 +#define TK_ARGV_DONT_SKIP_FIRST_ARG 0x8 /* * Enumerated type for describing actions to be taken in response * to a restrictProc established by Tk_RestrictEvents. */ @@ -285,16 +419,16 @@ /* * Relief values returned by Tk_GetRelief: */ -#define TK_RELIEF_RAISED 1 -#define TK_RELIEF_FLAT 2 -#define TK_RELIEF_SUNKEN 4 -#define TK_RELIEF_GROOVE 8 -#define TK_RELIEF_RIDGE 16 -#define TK_RELIEF_SOLID 32 +#define TK_RELIEF_FLAT 0 +#define TK_RELIEF_GROOVE 1 +#define TK_RELIEF_RAISED 2 +#define TK_RELIEF_RIDGE 3 +#define TK_RELIEF_SOLID 4 +#define TK_RELIEF_SUNKEN 5 /* * "Which" argument values for Tk_3DBorderGC: */ @@ -407,15 +541,18 @@ *--------------------------------------------------------------------------- */ #define VirtualEvent (LASTEvent) #define ActivateNotify (LASTEvent + 1) #define DeactivateNotify (LASTEvent + 2) -#define TK_LASTEVENT (LASTEvent + 3) +#define MouseWheelEvent (LASTEvent + 3) +#define TK_LASTEVENT (LASTEvent + 4) -#define VirtualEventMask (1L << 30) +#define MouseWheelMask (1L << 28) + #define ActivateMask (1L << 29) -#define TK_LASTEVENT (LASTEvent + 3) +#define VirtualEventMask (1L << 30) +#define TK_LASTEVENT (LASTEvent + 4) /* * A virtual event shares most of its fields with the XKeyEvent and * XButtonEvent structures. 99% of the time a virtual event will be @@ -658,10 +795,17 @@ * canvas units. Set by item-specific * code and guaranteed to contain every * pixel drawn in item. Item area * includes x1 and y1 but not x2 * and y2. */ + struct Tk_Item *prevPtr; /* Previous in display list of all + * items in this canvas. Later items + * in list are drawn just below earlier + * ones. */ + int reserved1; /* This padding is for compatibility */ + char *reserved2; /* with Jan Nijtmans dash patch */ + int reserved3; /* *------------------------------------------------------------------ * Starting here is additional type-specific stuff; see the * declarations for individual types to see what is part of @@ -712,10 +856,12 @@ int maxBytes)); typedef void Tk_ItemInsertProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int beforeThis, char *string)); typedef void Tk_ItemDCharsProc _ANSI_ARGS_((Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last)); + +#ifndef __NO_OLD_CONFIG typedef struct Tk_ItemType { char *name; /* The name of this type of item, such * as "line". */ int itemSize; /* Total amount of space needed for @@ -760,11 +906,17 @@ * an item. */ Tk_ItemDCharsProc *dCharsProc; /* Procedure to delete characters * from an item. */ struct Tk_ItemType *nextPtr; /* Used to link types together into * a list. */ + char *reserved1; /* Reserved for future extension. */ + int reserved2; /* Carefully compatible with */ + char *reserved3; /* Jan Nijtmans dash patch */ + char *reserved4; } Tk_ItemType; + +#endif /* * The following structure provides information about the selection and * the insertion cursor. It is needed by only a few items, such as * those that display text. It is shared by the generic canvas code @@ -780,20 +932,21 @@ XColor *selFgColorPtr; /* Foreground color for selected text. * Read-only to items. */ Tk_Item *selItemPtr; /* Pointer to selected item. NULL means * selection isn't in this canvas. * Writable by items. */ - int selectFirst; /* Index of first selected character. - * Writable by items. */ - int selectLast; /* Index of last selected character. - * Writable by items. */ + int selectFirst; /* Character index of first selected + * character. Writable by items. */ + int selectLast; /* Character index of last selected + * character. Writable by items. */ Tk_Item *anchorItemPtr; /* Item corresponding to "selectAnchor": * not necessarily selItemPtr. Read-only * to items. */ - int selectAnchor; /* Fixed end of selection (i.e. "select to" - * operation will use this as one end of the - * selection). Writable by items. */ + int selectAnchor; /* Character index of fixed end of + * selection (i.e. "select to" operation will + * use this as one end of the selection). + * Writable by items. */ Tk_3DBorder insertBorder; /* Used to draw vertical bar for insertion * cursor. Read-only to items. */ int insertWidth; /* Total width of insertion cursor. Read-only * to items. */ int insertBorderWidth; /* Width of 3-D border around insert cursor. @@ -862,10 +1015,11 @@ * image. */ struct Tk_ImageType *nextPtr; /* Next in list of all image types currently * known. Filled in by Tk, not by image * manager. */ + char *reserved; /* reserved for future expansion */ }; /* *-------------------------------------------------------------- * @@ -894,10 +1048,11 @@ int pixelSize; /* Address difference between successive * pixels in the same line. */ int offset[3]; /* Address differences between the red, green * and blue components of the pixel and the * pixel as a whole. */ + int reserved; /* Reserved for extensions (dash patch) */ } Tk_PhotoImageBlock; /* * Procedure prototypes and structures used in reading and * writing photo images: @@ -997,10 +1152,24 @@ #define Tk_AfterCmd Tcl_AfterCmd #define Tk_EventuallyFree Tcl_EventuallyFree #define Tk_FreeProc Tcl_FreeProc #define Tk_Preserve Tcl_Preserve #define Tk_Release Tcl_Release + +/* Removed Tk_Main, use macro instead */ +#define Tk_Main(argc, argv, proc) \ + Tk_MainEx(argc, argv, proc, Tcl_CreateInterp()) + +char *Tk_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, char *version, int exact)); + +#ifndef USE_TK_STUBS + +#define Tk_InitStubs(interp, version, exact) \ + Tcl_PkgRequire(interp, "Tk", version, exact) + +#endif + /* *-------------------------------------------------------------- * * Additional procedure types defined by Tk. @@ -1028,511 +1197,18 @@ * Exported procedures and variables. * *-------------------------------------------------------------- */ -EXTERN XColor * Tk_3DBorderColor _ANSI_ARGS_((Tk_3DBorder border)); -EXTERN GC Tk_3DBorderGC _ANSI_ARGS_((Tk_Window tkwin, - Tk_3DBorder border, int which)); -EXTERN void Tk_3DHorizontalBevel _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, int x, - int y, int width, int height, int leftIn, - int rightIn, int topBevel, int relief)); -EXTERN void Tk_3DVerticalBevel _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, int x, - int y, int width, int height, int leftBevel, - int relief)); -EXTERN void Tk_AddOption _ANSI_ARGS_((Tk_Window tkwin, char *name, - char *value, int priority)); -EXTERN void Tk_BindEvent _ANSI_ARGS_((Tk_BindingTable bindingTable, - XEvent *eventPtr, Tk_Window tkwin, int numObjects, - ClientData *objectPtr)); -EXTERN void Tk_CanvasDrawableCoords _ANSI_ARGS_((Tk_Canvas canvas, - double x, double y, short *drawableXPtr, - short *drawableYPtr)); -EXTERN void Tk_CanvasEventuallyRedraw _ANSI_ARGS_(( - Tk_Canvas canvas, int x1, int y1, int x2, - int y2)); -EXTERN int Tk_CanvasGetCoord _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, char *string, - double *doublePtr)); -EXTERN Tk_CanvasTextInfo *Tk_CanvasGetTextInfo _ANSI_ARGS_((Tk_Canvas canvas)); -EXTERN int Tk_CanvasPsBitmap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Pixmap bitmap, int x, int y, - int width, int height)); -EXTERN int Tk_CanvasPsColor _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, XColor *colorPtr)); -EXTERN int Tk_CanvasPsFont _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Tk_Font font)); -EXTERN void Tk_CanvasPsPath _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, double *coordPtr, int numPoints)); -EXTERN int Tk_CanvasPsStipple _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Canvas canvas, Pixmap bitmap)); -EXTERN double Tk_CanvasPsY _ANSI_ARGS_((Tk_Canvas canvas, double y)); -EXTERN void Tk_CanvasSetStippleOrigin _ANSI_ARGS_(( - Tk_Canvas canvas, GC gc)); -EXTERN int Tk_CanvasTagsParseProc _ANSI_ARGS_(( - ClientData clientData, Tcl_Interp *interp, - Tk_Window tkwin, char *value, char *widgRec, - int offset)); -EXTERN char * Tk_CanvasTagsPrintProc _ANSI_ARGS_(( - ClientData clientData, Tk_Window tkwin, - char *widgRec, int offset, - Tcl_FreeProc **freeProcPtr)); -EXTERN Tk_Window Tk_CanvasTkwin _ANSI_ARGS_((Tk_Canvas canvas)); -EXTERN void Tk_CanvasWindowCoords _ANSI_ARGS_((Tk_Canvas canvas, - double x, double y, short *screenXPtr, - short *screenYPtr)); -EXTERN void Tk_ChangeWindowAttributes _ANSI_ARGS_((Tk_Window tkwin, - unsigned long valueMask, - XSetWindowAttributes *attsPtr)); -EXTERN int Tk_CharBbox _ANSI_ARGS_((Tk_TextLayout layout, - int index, int *xPtr, int *yPtr, int *widthPtr, - int *heightPtr)); -EXTERN void Tk_ClearSelection _ANSI_ARGS_((Tk_Window tkwin, - Atom selection)); -EXTERN int Tk_ClipboardAppend _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Atom target, Atom format, - char* buffer)); -EXTERN int Tk_ClipboardClear _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin)); -EXTERN int Tk_ConfigureInfo _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, - char *widgRec, char *argvName, int flags)); -EXTERN int Tk_ConfigureValue _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, - char *widgRec, char *argvName, int flags)); -EXTERN int Tk_ConfigureWidget _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_ConfigSpec *specs, - int argc, char **argv, char *widgRec, - int flags)); -EXTERN void Tk_ConfigureWindow _ANSI_ARGS_((Tk_Window tkwin, - unsigned int valueMask, XWindowChanges *valuePtr)); -EXTERN Tk_TextLayout Tk_ComputeTextLayout _ANSI_ARGS_((Tk_Font font, - CONST char *string, int numChars, int wrapLength, - Tk_Justify justify, int flags, int *widthPtr, - int *heightPtr)); -EXTERN Tk_Window Tk_CoordsToWindow _ANSI_ARGS_((int rootX, int rootY, - Tk_Window tkwin)); -EXTERN unsigned long Tk_CreateBinding _ANSI_ARGS_((Tcl_Interp *interp, - Tk_BindingTable bindingTable, ClientData object, - char *eventString, char *command, int append)); -EXTERN Tk_BindingTable Tk_CreateBindingTable _ANSI_ARGS_((Tcl_Interp *interp)); -EXTERN Tk_ErrorHandler Tk_CreateErrorHandler _ANSI_ARGS_((Display *display, - int errNum, int request, int minorCode, - Tk_ErrorProc *errorProc, ClientData clientData)); -EXTERN void Tk_CreateEventHandler _ANSI_ARGS_((Tk_Window token, - unsigned long mask, Tk_EventProc *proc, - ClientData clientData)); -EXTERN void Tk_CreateGenericHandler _ANSI_ARGS_(( - Tk_GenericProc *proc, ClientData clientData)); -EXTERN void Tk_CreateImageType _ANSI_ARGS_(( - Tk_ImageType *typePtr)); -EXTERN void Tk_CreateItemType _ANSI_ARGS_((Tk_ItemType *typePtr)); -EXTERN void Tk_CreatePhotoImageFormat _ANSI_ARGS_(( - Tk_PhotoImageFormat *formatPtr)); -EXTERN void Tk_CreateSelHandler _ANSI_ARGS_((Tk_Window tkwin, - Atom selection, Atom target, - Tk_SelectionProc *proc, ClientData clientData, - Atom format)); -EXTERN Tk_Window Tk_CreateWindow _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window parent, char *name, char *screenName)); -EXTERN Tk_Window Tk_CreateWindowFromPath _ANSI_ARGS_(( - Tcl_Interp *interp, Tk_Window tkwin, - char *pathName, char *screenName)); -EXTERN int Tk_DefineBitmap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Uid name, char *source, int width, - int height)); -EXTERN void Tk_DefineCursor _ANSI_ARGS_((Tk_Window window, - Tk_Cursor cursor)); -EXTERN void Tk_DeleteAllBindings _ANSI_ARGS_(( - Tk_BindingTable bindingTable, ClientData object)); -EXTERN int Tk_DeleteBinding _ANSI_ARGS_((Tcl_Interp *interp, - Tk_BindingTable bindingTable, ClientData object, - char *eventString)); -EXTERN void Tk_DeleteBindingTable _ANSI_ARGS_(( - Tk_BindingTable bindingTable)); -EXTERN void Tk_DeleteErrorHandler _ANSI_ARGS_(( - Tk_ErrorHandler handler)); -EXTERN void Tk_DeleteEventHandler _ANSI_ARGS_((Tk_Window token, - unsigned long mask, Tk_EventProc *proc, - ClientData clientData)); -EXTERN void Tk_DeleteGenericHandler _ANSI_ARGS_(( - Tk_GenericProc *proc, ClientData clientData)); -EXTERN void Tk_DeleteImage _ANSI_ARGS_((Tcl_Interp *interp, - char *name)); -EXTERN void Tk_DeleteSelHandler _ANSI_ARGS_((Tk_Window tkwin, - Atom selection, Atom target)); -EXTERN void Tk_DestroyWindow _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN char * Tk_DisplayName _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN int Tk_DistanceToTextLayout _ANSI_ARGS_(( - Tk_TextLayout layout, int x, int y)); -EXTERN void Tk_Draw3DPolygon _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, - XPoint *pointPtr, int numPoints, int borderWidth, - int leftRelief)); -EXTERN void Tk_Draw3DRectangle _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, int x, - int y, int width, int height, int borderWidth, - int relief)); -EXTERN void Tk_DrawChars _ANSI_ARGS_((Display *display, - Drawable drawable, GC gc, Tk_Font tkfont, - CONST char *source, int numChars, int x, - int y)); -EXTERN void Tk_DrawFocusHighlight _ANSI_ARGS_((Tk_Window tkwin, - GC gc, int width, Drawable drawable)); -EXTERN void Tk_DrawTextLayout _ANSI_ARGS_((Display *display, - Drawable drawable, GC gc, Tk_TextLayout layout, - int x, int y, int firstChar, int lastChar)); -EXTERN void Tk_Fill3DPolygon _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, - XPoint *pointPtr, int numPoints, int borderWidth, - int leftRelief)); -EXTERN void Tk_Fill3DRectangle _ANSI_ARGS_((Tk_Window tkwin, - Drawable drawable, Tk_3DBorder border, int x, - int y, int width, int height, int borderWidth, - int relief)); -EXTERN Tk_PhotoHandle Tk_FindPhoto _ANSI_ARGS_((Tcl_Interp *interp, - char *imageName)); -EXTERN Font Tk_FontId _ANSI_ARGS_((Tk_Font font)); -EXTERN void Tk_Free3DBorder _ANSI_ARGS_((Tk_3DBorder border)); -EXTERN void Tk_FreeBitmap _ANSI_ARGS_((Display *display, - Pixmap bitmap)); -EXTERN void Tk_FreeColor _ANSI_ARGS_((XColor *colorPtr)); -EXTERN void Tk_FreeColormap _ANSI_ARGS_((Display *display, - Colormap colormap)); -EXTERN void Tk_FreeCursor _ANSI_ARGS_((Display *display, - Tk_Cursor cursor)); -EXTERN void Tk_FreeFont _ANSI_ARGS_((Tk_Font)); -EXTERN void Tk_FreeGC _ANSI_ARGS_((Display *display, GC gc)); -EXTERN void Tk_FreeImage _ANSI_ARGS_((Tk_Image image)); -EXTERN void Tk_FreeOptions _ANSI_ARGS_((Tk_ConfigSpec *specs, - char *widgRec, Display *display, int needFlags)); -EXTERN void Tk_FreePixmap _ANSI_ARGS_((Display *display, - Pixmap pixmap)); -EXTERN void Tk_FreeTextLayout _ANSI_ARGS_(( - Tk_TextLayout textLayout)); -EXTERN void Tk_FreeXId _ANSI_ARGS_((Display *display, XID xid)); -EXTERN GC Tk_GCForColor _ANSI_ARGS_((XColor *colorPtr, - Drawable drawable)); -EXTERN void Tk_GeometryRequest _ANSI_ARGS_((Tk_Window tkwin, - int reqWidth, int reqHeight)); -EXTERN Tk_3DBorder Tk_Get3DBorder _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_Uid colorName)); -EXTERN void Tk_GetAllBindings _ANSI_ARGS_((Tcl_Interp *interp, - Tk_BindingTable bindingTable, ClientData object)); -EXTERN int Tk_GetAnchor _ANSI_ARGS_((Tcl_Interp *interp, - char *string, Tk_Anchor *anchorPtr)); -EXTERN char * Tk_GetAtomName _ANSI_ARGS_((Tk_Window tkwin, - Atom atom)); -EXTERN char * Tk_GetBinding _ANSI_ARGS_((Tcl_Interp *interp, - Tk_BindingTable bindingTable, ClientData object, - char *eventString)); -EXTERN Pixmap Tk_GetBitmap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_Uid string)); -EXTERN Pixmap Tk_GetBitmapFromData _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *source, - int width, int height)); -EXTERN int Tk_GetCapStyle _ANSI_ARGS_((Tcl_Interp *interp, - char *string, int *capPtr)); -EXTERN XColor * Tk_GetColor _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_Uid name)); -EXTERN XColor * Tk_GetColorByValue _ANSI_ARGS_((Tk_Window tkwin, - XColor *colorPtr)); -EXTERN Colormap Tk_GetColormap _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *string)); -EXTERN Tk_Cursor Tk_GetCursor _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tk_Uid string)); -EXTERN Tk_Cursor Tk_GetCursorFromData _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *source, char *mask, - int width, int height, int xHot, int yHot, - Tk_Uid fg, Tk_Uid bg)); -EXTERN Tk_Font Tk_GetFont _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, CONST char *string)); -EXTERN Tk_Font Tk_GetFontFromObj _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Tcl_Obj *objPtr)); -EXTERN void Tk_GetFontMetrics _ANSI_ARGS_((Tk_Font font, - Tk_FontMetrics *fmPtr)); -EXTERN GC Tk_GetGC _ANSI_ARGS_((Tk_Window tkwin, - unsigned long valueMask, XGCValues *valuePtr)); -EXTERN Tk_Image Tk_GetImage _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *name, - Tk_ImageChangedProc *changeProc, - ClientData clientData)); -EXTERN ClientData Tk_GetImageMasterData _ANSI_ARGS_ ((Tcl_Interp *interp, - char *name, Tk_ImageType **typePtrPtr)); -EXTERN Tk_ItemType * Tk_GetItemTypes _ANSI_ARGS_((void)); -EXTERN int Tk_GetJoinStyle _ANSI_ARGS_((Tcl_Interp *interp, - char *string, int *joinPtr)); -EXTERN int Tk_GetJustify _ANSI_ARGS_((Tcl_Interp *interp, - char *string, Tk_Justify *justifyPtr)); -EXTERN int Tk_GetNumMainWindows _ANSI_ARGS_((void)); -EXTERN Tk_Uid Tk_GetOption _ANSI_ARGS_((Tk_Window tkwin, char *name, - char *className)); -EXTERN int Tk_GetPixels _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *string, int *intPtr)); -EXTERN Pixmap Tk_GetPixmap _ANSI_ARGS_((Display *display, Drawable d, - int width, int height, int depth)); -EXTERN int Tk_GetRelief _ANSI_ARGS_((Tcl_Interp *interp, - char *name, int *reliefPtr)); -EXTERN void Tk_GetRootCoords _ANSI_ARGS_ ((Tk_Window tkwin, - int *xPtr, int *yPtr)); -EXTERN int Tk_GetScrollInfo _ANSI_ARGS_((Tcl_Interp *interp, - int argc, char **argv, double *dblPtr, - int *intPtr)); -EXTERN int Tk_GetScreenMM _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *string, double *doublePtr)); -EXTERN int Tk_GetSelection _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, Atom selection, Atom target, - Tk_GetSelProc *proc, ClientData clientData)); -EXTERN Tk_Uid Tk_GetUid _ANSI_ARGS_((CONST char *string)); -EXTERN Visual * Tk_GetVisual _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, char *string, int *depthPtr, - Colormap *colormapPtr)); -EXTERN void Tk_GetVRootGeometry _ANSI_ARGS_((Tk_Window tkwin, - int *xPtr, int *yPtr, int *widthPtr, - int *heightPtr)); -EXTERN int Tk_Grab _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, int grabGlobal)); -EXTERN void Tk_HandleEvent _ANSI_ARGS_((XEvent *eventPtr)); -EXTERN Tk_Window Tk_IdToWindow _ANSI_ARGS_((Display *display, - Window window)); -EXTERN void Tk_ImageChanged _ANSI_ARGS_(( - Tk_ImageMaster master, int x, int y, - int width, int height, int imageWidth, - int imageHeight)); -EXTERN int Tk_Init _ANSI_ARGS_((Tcl_Interp *interp)); -EXTERN Atom Tk_InternAtom _ANSI_ARGS_((Tk_Window tkwin, - char *name)); -EXTERN int Tk_IntersectTextLayout _ANSI_ARGS_(( - Tk_TextLayout layout, int x, int y, int width, - int height)); -EXTERN void Tk_Main _ANSI_ARGS_((int argc, char **argv, - Tcl_AppInitProc *appInitProc)); -EXTERN void Tk_MainLoop _ANSI_ARGS_((void)); -EXTERN void Tk_MaintainGeometry _ANSI_ARGS_((Tk_Window slave, - Tk_Window master, int x, int y, int width, - int height)); -EXTERN Tk_Window Tk_MainWindow _ANSI_ARGS_((Tcl_Interp *interp)); -EXTERN void Tk_MakeWindowExist _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN void Tk_ManageGeometry _ANSI_ARGS_((Tk_Window tkwin, - Tk_GeomMgr *mgrPtr, ClientData clientData)); -EXTERN void Tk_MapWindow _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN int Tk_MeasureChars _ANSI_ARGS_((Tk_Font tkfont, - CONST char *source, int maxChars, int maxPixels, - int flags, int *lengthPtr)); -EXTERN void Tk_MoveResizeWindow _ANSI_ARGS_((Tk_Window tkwin, - int x, int y, int width, int height)); -EXTERN void Tk_MoveWindow _ANSI_ARGS_((Tk_Window tkwin, int x, - int y)); -EXTERN void Tk_MoveToplevelWindow _ANSI_ARGS_((Tk_Window tkwin, - int x, int y)); -EXTERN char * Tk_NameOf3DBorder _ANSI_ARGS_((Tk_3DBorder border)); -EXTERN char * Tk_NameOfAnchor _ANSI_ARGS_((Tk_Anchor anchor)); -EXTERN char * Tk_NameOfBitmap _ANSI_ARGS_((Display *display, - Pixmap bitmap)); -EXTERN char * Tk_NameOfCapStyle _ANSI_ARGS_((int cap)); -EXTERN char * Tk_NameOfColor _ANSI_ARGS_((XColor *colorPtr)); -EXTERN char * Tk_NameOfCursor _ANSI_ARGS_((Display *display, - Tk_Cursor cursor)); -EXTERN char * Tk_NameOfFont _ANSI_ARGS_((Tk_Font font)); -EXTERN char * Tk_NameOfImage _ANSI_ARGS_(( - Tk_ImageMaster imageMaster)); -EXTERN char * Tk_NameOfJoinStyle _ANSI_ARGS_((int join)); -EXTERN char * Tk_NameOfJustify _ANSI_ARGS_((Tk_Justify justify)); -EXTERN char * Tk_NameOfRelief _ANSI_ARGS_((int relief)); -EXTERN Tk_Window Tk_NameToWindow _ANSI_ARGS_((Tcl_Interp *interp, - char *pathName, Tk_Window tkwin)); -EXTERN void Tk_OwnSelection _ANSI_ARGS_((Tk_Window tkwin, - Atom selection, Tk_LostSelProc *proc, - ClientData clientData)); -EXTERN int Tk_ParseArgv _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window tkwin, int *argcPtr, char **argv, - Tk_ArgvInfo *argTable, int flags)); -EXTERN void Tk_PhotoPutBlock _ANSI_ARGS_((Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height)); -EXTERN void Tk_PhotoPutZoomedBlock _ANSI_ARGS_(( - Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr, int x, int y, - int width, int height, int zoomX, int zoomY, - int subsampleX, int subsampleY)); -EXTERN int Tk_PhotoGetImage _ANSI_ARGS_((Tk_PhotoHandle handle, - Tk_PhotoImageBlock *blockPtr)); -EXTERN void Tk_PhotoBlank _ANSI_ARGS_((Tk_PhotoHandle handle)); -EXTERN void Tk_PhotoExpand _ANSI_ARGS_((Tk_PhotoHandle handle, - int width, int height )); -EXTERN void Tk_PhotoGetSize _ANSI_ARGS_((Tk_PhotoHandle handle, - int *widthPtr, int *heightPtr)); -EXTERN void Tk_PhotoSetSize _ANSI_ARGS_((Tk_PhotoHandle handle, - int width, int height)); -EXTERN int Tk_PointToChar _ANSI_ARGS_((Tk_TextLayout layout, - int x, int y)); -EXTERN int Tk_PostscriptFontName _ANSI_ARGS_((Tk_Font tkfont, - Tcl_DString *dsPtr)); -EXTERN void Tk_PreserveColormap _ANSI_ARGS_((Display *display, - Colormap colormap)); -EXTERN void Tk_QueueWindowEvent _ANSI_ARGS_((XEvent *eventPtr, - Tcl_QueuePosition position)); -EXTERN void Tk_RedrawImage _ANSI_ARGS_((Tk_Image image, int imageX, - int imageY, int width, int height, - Drawable drawable, int drawableX, int drawableY)); -EXTERN void Tk_ResizeWindow _ANSI_ARGS_((Tk_Window tkwin, - int width, int height)); -EXTERN int Tk_RestackWindow _ANSI_ARGS_((Tk_Window tkwin, - int aboveBelow, Tk_Window other)); -EXTERN Tk_RestrictProc *Tk_RestrictEvents _ANSI_ARGS_((Tk_RestrictProc *proc, - ClientData arg, ClientData *prevArgPtr)); -EXTERN int Tk_SafeInit _ANSI_ARGS_((Tcl_Interp *interp)); -EXTERN char * Tk_SetAppName _ANSI_ARGS_((Tk_Window tkwin, - char *name)); -EXTERN void Tk_SetBackgroundFromBorder _ANSI_ARGS_(( - Tk_Window tkwin, Tk_3DBorder border)); -EXTERN void Tk_SetClass _ANSI_ARGS_((Tk_Window tkwin, - char *className)); -EXTERN void Tk_SetGrid _ANSI_ARGS_((Tk_Window tkwin, - int reqWidth, int reqHeight, int gridWidth, - int gridHeight)); -EXTERN void Tk_SetInternalBorder _ANSI_ARGS_((Tk_Window tkwin, - int width)); -EXTERN void Tk_SetWindowBackground _ANSI_ARGS_((Tk_Window tkwin, - unsigned long pixel)); -EXTERN void Tk_SetWindowBackgroundPixmap _ANSI_ARGS_(( - Tk_Window tkwin, Pixmap pixmap)); -EXTERN void Tk_SetWindowBorder _ANSI_ARGS_((Tk_Window tkwin, - unsigned long pixel)); -EXTERN void Tk_SetWindowBorderWidth _ANSI_ARGS_((Tk_Window tkwin, - int width)); -EXTERN void Tk_SetWindowBorderPixmap _ANSI_ARGS_((Tk_Window tkwin, - Pixmap pixmap)); -EXTERN void Tk_SetWindowColormap _ANSI_ARGS_((Tk_Window tkwin, - Colormap colormap)); -EXTERN int Tk_SetWindowVisual _ANSI_ARGS_((Tk_Window tkwin, - Visual *visual, int depth, - Colormap colormap)); -EXTERN void Tk_SizeOfBitmap _ANSI_ARGS_((Display *display, - Pixmap bitmap, int *widthPtr, - int *heightPtr)); -EXTERN void Tk_SizeOfImage _ANSI_ARGS_((Tk_Image image, - int *widthPtr, int *heightPtr)); -EXTERN int Tk_StrictMotif _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN void Tk_TextLayoutToPostscript _ANSI_ARGS_(( - Tcl_Interp *interp, Tk_TextLayout layout)); -EXTERN int Tk_TextWidth _ANSI_ARGS_((Tk_Font font, - CONST char *string, int numChars)); -EXTERN void Tk_UndefineCursor _ANSI_ARGS_((Tk_Window window)); -EXTERN void Tk_UnderlineChars _ANSI_ARGS_((Display *display, - Drawable drawable, GC gc, Tk_Font tkfont, - CONST char *source, int x, int y, int firstChar, - int lastChar)); -EXTERN void Tk_UnderlineTextLayout _ANSI_ARGS_(( - Display *display, Drawable drawable, GC gc, - Tk_TextLayout layout, int x, int y, - int underline)); -EXTERN void Tk_Ungrab _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN void Tk_UnmaintainGeometry _ANSI_ARGS_((Tk_Window slave, - Tk_Window master)); -EXTERN void Tk_UnmapWindow _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN void Tk_UnsetGrid _ANSI_ARGS_((Tk_Window tkwin)); -EXTERN void Tk_UpdatePointer _ANSI_ARGS_((Tk_Window tkwin, - int x, int y, int state)); +#include "tkDecls.h" /* * Tcl commands exported by Tk: */ -EXTERN int Tk_AfterCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_BellCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_BindCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_BindtagsCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ButtonCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_CanvasCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_CheckbuttonCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ClipboardCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ChooseColorCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ChooseFontCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_DestroyCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_EntryCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_EventCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_FileeventCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_FrameCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_FocusCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_FontObjCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); -EXTERN int Tk_GetOpenFileCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_GetSaveFileCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_GrabCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_GridCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ImageCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_LabelCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ListboxCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_LowerCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_MenuCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_MenubuttonCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_MessageBoxCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_MessageCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_OptionCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_PackCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_PlaceCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_RadiobuttonCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_RaiseCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ScaleCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ScrollbarCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_SelectionCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_SendCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_TextCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_TkObjCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); -EXTERN int Tk_TkwaitCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_ToplevelCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_UpdateCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); -EXTERN int Tk_WinfoObjCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int objc, - Tcl_Obj *CONST objv[])); -EXTERN int Tk_WmCmd _ANSI_ARGS_((ClientData clientData, - Tcl_Interp *interp, int argc, char **argv)); #endif /* RESOURCE_INCLUDED */ + +#undef TCL_STORAGE_CLASS +#define TCL_STORAGE_CLASS DLLIMPORT + #endif /* _TK */ Index: generic/tk3d.c ================================================================== --- generic/tk3d.c +++ generic/tk3d.c @@ -8,55 +8,171 @@ * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tk3d.c 1.60 97/01/13 17:23:10 - */ - -#include - -/* - * Hash table to map from a border's values (color, etc.) to a - * Border structure for those values. - */ - -static Tcl_HashTable borderTable; -typedef struct { - Tk_Uid colorName; /* Color for border. */ - Colormap colormap; /* Colormap used for allocating border - * colors. */ - Screen *screen; /* Screen on which border will be drawn. */ -} BorderKey; - -static int initialized = 0; /* 0 means static structures haven't - * been initialized yet. */ + * RCS: @(#) $Id: tk3d.c,v 1.1.4.4 1998/12/13 08:16:00 lfb Exp $ + */ + +#include "tk3d.h" + +/* + * The following table defines the string values for reliefs, which are + * used by Tk_GetReliefFromObj. + */ + +static char *reliefStrings[] = {"flat", "groove", "raised", "ridge", "solid", + "sunken", (char *) NULL}; /* * Forward declarations for procedures defined in this file: */ -static void BorderInit _ANSI_ARGS_((void)); +static void BorderInit _ANSI_ARGS_((TkDisplay *dispPtr)); +static void DupBorderObjProc _ANSI_ARGS_((Tcl_Obj *srcObjPtr, + Tcl_Obj *dupObjPtr)); +static void FreeBorderObjProc _ANSI_ARGS_((Tcl_Obj *objPtr)); static int Intersect _ANSI_ARGS_((XPoint *a1Ptr, XPoint *a2Ptr, XPoint *b1Ptr, XPoint *b2Ptr, XPoint *iPtr)); +static void InitBorderObj _ANSI_ARGS_((Tcl_Obj *objPtr)); static void ShiftLine _ANSI_ARGS_((XPoint *p1Ptr, XPoint *p2Ptr, int distance, XPoint *p3Ptr)); + +/* + * The following structure defines the implementation of the "border" Tcl + * object, used for drawing. The border object remembers the hash table entry + * associated with a border. The actual allocation and deallocation of the + * border should be done by the configuration package when the border option + * is set. + */ + +static Tcl_ObjType borderObjType = { + "border", /* name */ + FreeBorderObjProc, /* freeIntRepProc */ + DupBorderObjProc, /* dupIntRepProc */ + NULL, /* updateStringProc */ + NULL /* setFromAnyProc */ +}; + +/* + *---------------------------------------------------------------------- + * + * Tk_Alloc3DBorderFromObj -- + * + * Given a Tcl_Obj *, map the value to a corresponding + * Tk_3DBorder structure based on the tkwin given. + * + * Results: + * The return value is a token for a data structure describing a + * 3-D border. This token may be passed to procedures such as + * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented + * the border from being created then NULL is returned and an error + * message will be left in the interp's result. + * + * Side effects: + * The border is added to an internal database with a reference + * count. For each call to this procedure, there should eventually + * be a call to Tk_FreeBorderFromObj so that the database is + * cleaned up when borders aren't in use anymore. + * + *---------------------------------------------------------------------- + */ + +Tk_3DBorder +Tk_Alloc3DBorderFromObj(interp, tkwin, objPtr) + Tcl_Interp *interp; /* Interp for error results. */ + Tk_Window tkwin; /* Need the screen the border is used on.*/ + Tcl_Obj *objPtr; /* Object giving name of color for window + * background. */ +{ + TkBorder *borderPtr; + + if (objPtr->typePtr != &borderObjType) { + InitBorderObj(objPtr); + } + borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1; + + /* + * If the object currently points to a TkBorder, see if it's the + * one we want. If so, increment its reference count and return. + */ + + if (borderPtr != NULL) { + if (borderPtr->resourceRefCount == 0) { + /* + * This is a stale reference: it refers to a border that's + * no longer in use. Clear the reference. + */ + + FreeBorderObjProc(objPtr); + borderPtr = NULL; + } else if ((Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + borderPtr->resourceRefCount++; + return (Tk_3DBorder) borderPtr; + } + } + + /* + * The object didn't point to the border that we wanted. Search + * the list of borders with the same name to see if one of the + * others is the right one. + */ + + /* + * If the cached value is NULL, either the object type was not a + * color going in, or the object is a color type but had + * previously been freed. + * + * If the value is not NULL, the internal rep is the value + * of the color the last time this object was accessed. Check + * the screen and colormap of the last access, and if they + * match, we are done. + */ + + if (borderPtr != NULL) { + TkBorder *firstBorderPtr = + (TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr); + FreeBorderObjProc(objPtr); + for (borderPtr = firstBorderPtr ; borderPtr != NULL; + borderPtr = borderPtr->nextPtr) { + if ((Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + borderPtr->resourceRefCount++; + borderPtr->objRefCount++; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr; + return (Tk_3DBorder) borderPtr; + } + } + } + + /* + * Still no luck. Call Tk_Get3DBorder to allocate a new border. + */ + + borderPtr = (TkBorder *) Tk_Get3DBorder(interp, tkwin, + Tcl_GetString(objPtr)); + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr; + if (borderPtr != NULL) { + borderPtr->objRefCount++; + } + return (Tk_3DBorder) borderPtr; +} /* *-------------------------------------------------------------- * * Tk_Get3DBorder -- * * Create a data structure for displaying a 3-D border. * * Results: - * The return value is a token for a data structure - * describing a 3-D border. This token may be passed - * to Tk_Draw3DRectangle and Tk_Free3DBorder. If an - * error prevented the border from being created then - * NULL is returned and an error message will be left - * in interp->result. + * The return value is a token for a data structure describing a + * 3-D border. This token may be passed to procedures such as + * Tk_Draw3DRectangle and Tk_Free3DBorder. If an error prevented + * the border from being created then NULL is returned and an error + * message will be left in the interp's result. * * Side effects: * Data structures, graphics contexts, etc. are allocated. * It is the caller's responsibility to eventually call * Tk_Free3DBorder to release the resources. @@ -67,74 +183,79 @@ Tk_3DBorder Tk_Get3DBorder(interp, tkwin, colorName) Tcl_Interp *interp; /* Place to store an error message. */ Tk_Window tkwin; /* Token for window in which border will * be drawn. */ - Tk_Uid colorName; /* String giving name of color + char *colorName; /* String giving name of color * for window background. */ { - BorderKey key; Tcl_HashEntry *hashPtr; - register TkBorder *borderPtr; + TkBorder *borderPtr, *existingBorderPtr; int new; XGCValues gcValues; - - if (!initialized) { - BorderInit(); - } - - /* - * First, check to see if there's already a border that will work - * for this request. - */ - - key.colorName = colorName; - key.colormap = Tk_Colormap(tkwin); - key.screen = Tk_Screen(tkwin); - - hashPtr = Tcl_CreateHashEntry(&borderTable, (char *) &key, &new); + XColor *bgColorPtr; + TkDisplay *dispPtr; + + dispPtr = ((TkWindow *) tkwin)->dispPtr; + + if (!dispPtr->borderInit) { + BorderInit(dispPtr); + } + + hashPtr = Tcl_CreateHashEntry(&dispPtr->borderTable, colorName, &new); if (!new) { - borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr); - borderPtr->refCount++; + existingBorderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr); + for (borderPtr = existingBorderPtr; borderPtr != NULL; + borderPtr = borderPtr->nextPtr) { + if ((Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + borderPtr->resourceRefCount++; + return (Tk_3DBorder) borderPtr; + } + } } else { - XColor *bgColorPtr; - - /* - * No satisfactory border exists yet. Initialize a new one. - */ - - bgColorPtr = Tk_GetColor(interp, tkwin, colorName); - if (bgColorPtr == NULL) { + existingBorderPtr = NULL; + } + + /* + * No satisfactory border exists yet. Initialize a new one. + */ + + bgColorPtr = Tk_GetColor(interp, tkwin, colorName); + if (bgColorPtr == NULL) { + if (new) { Tcl_DeleteHashEntry(hashPtr); - return NULL; - } - - borderPtr = TkpGetBorder(); - borderPtr->screen = Tk_Screen(tkwin); - borderPtr->visual = Tk_Visual(tkwin); - borderPtr->depth = Tk_Depth(tkwin); - borderPtr->colormap = key.colormap; - borderPtr->refCount = 1; - borderPtr->bgColorPtr = bgColorPtr; - borderPtr->darkColorPtr = NULL; - borderPtr->lightColorPtr = NULL; - borderPtr->shadow = None; - borderPtr->bgGC = None; - borderPtr->darkGC = None; - borderPtr->lightGC = None; - borderPtr->hashPtr = hashPtr; - Tcl_SetHashValue(hashPtr, borderPtr); - - /* - * Create the information for displaying the background color, - * but delay the allocation of shadows until they are actually - * needed for drawing. - */ - - gcValues.foreground = borderPtr->bgColorPtr->pixel; - borderPtr->bgGC = Tk_GetGC(tkwin, GCForeground, &gcValues); - } + } + return NULL; + } + + borderPtr = TkpGetBorder(); + borderPtr->screen = Tk_Screen(tkwin); + borderPtr->visual = Tk_Visual(tkwin); + borderPtr->depth = Tk_Depth(tkwin); + borderPtr->colormap = Tk_Colormap(tkwin); + borderPtr->resourceRefCount = 1; + borderPtr->objRefCount = 0; + borderPtr->bgColorPtr = bgColorPtr; + borderPtr->darkColorPtr = NULL; + borderPtr->lightColorPtr = NULL; + borderPtr->shadow = None; + borderPtr->bgGC = None; + borderPtr->darkGC = None; + borderPtr->lightGC = None; + borderPtr->hashPtr = hashPtr; + borderPtr->nextPtr = existingBorderPtr; + Tcl_SetHashValue(hashPtr, borderPtr); + + /* + * Create the information for displaying the background color, + * but delay the allocation of shadows until they are actually + * needed for drawing. + */ + + gcValues.foreground = borderPtr->bgColorPtr->pixel; + borderPtr->bgGC = Tk_GetGC(tkwin, GCForeground, &gcValues); return (Tk_3DBorder) borderPtr; } /* *-------------------------------------------------------------- @@ -206,11 +327,11 @@ Tk_NameOf3DBorder(border) Tk_3DBorder border; /* Token for border. */ { TkBorder *borderPtr = (TkBorder *) border; - return ((BorderKey *) borderPtr->hashPtr->key.words)->colorName; + return borderPtr->hashPtr->key.string; } /* *-------------------------------------------------------------------- * @@ -301,41 +422,157 @@ void Tk_Free3DBorder(border) Tk_3DBorder border; /* Token for border to be released. */ { - register TkBorder *borderPtr = (TkBorder *) border; + TkBorder *borderPtr = (TkBorder *) border; Display *display = DisplayOfScreen(borderPtr->screen); - - borderPtr->refCount--; - if (borderPtr->refCount == 0) { - TkpFreeBorder(borderPtr); - if (borderPtr->bgColorPtr != NULL) { - Tk_FreeColor(borderPtr->bgColorPtr); - } - if (borderPtr->darkColorPtr != NULL) { - Tk_FreeColor(borderPtr->darkColorPtr); - } - if (borderPtr->lightColorPtr != NULL) { - Tk_FreeColor(borderPtr->lightColorPtr); - } - if (borderPtr->shadow != None) { - Tk_FreeBitmap(display, borderPtr->shadow); - } - if (borderPtr->bgGC != None) { - Tk_FreeGC(display, borderPtr->bgGC); - } - if (borderPtr->darkGC != None) { - Tk_FreeGC(display, borderPtr->darkGC); - } - if (borderPtr->lightGC != None) { - Tk_FreeGC(display, borderPtr->lightGC); - } - Tcl_DeleteHashEntry(borderPtr->hashPtr); + TkBorder *prevPtr; + + borderPtr->resourceRefCount--; + if (borderPtr->resourceRefCount > 0) { + return; + } + + prevPtr = (TkBorder *) Tcl_GetHashValue(borderPtr->hashPtr); + TkpFreeBorder(borderPtr); + if (borderPtr->bgColorPtr != NULL) { + Tk_FreeColor(borderPtr->bgColorPtr); + } + if (borderPtr->darkColorPtr != NULL) { + Tk_FreeColor(borderPtr->darkColorPtr); + } + if (borderPtr->lightColorPtr != NULL) { + Tk_FreeColor(borderPtr->lightColorPtr); + } + if (borderPtr->shadow != None) { + Tk_FreeBitmap(display, borderPtr->shadow); + } + if (borderPtr->bgGC != None) { + Tk_FreeGC(display, borderPtr->bgGC); + } + if (borderPtr->darkGC != None) { + Tk_FreeGC(display, borderPtr->darkGC); + } + if (borderPtr->lightGC != None) { + Tk_FreeGC(display, borderPtr->lightGC); + } + if (prevPtr == borderPtr) { + if (borderPtr->nextPtr == NULL) { + Tcl_DeleteHashEntry(borderPtr->hashPtr); + } else { + Tcl_SetHashValue(borderPtr->hashPtr, borderPtr->nextPtr); + } + } else { + while (prevPtr->nextPtr != borderPtr) { + prevPtr = prevPtr->nextPtr; + } + prevPtr->nextPtr = borderPtr->nextPtr; + } + if (borderPtr->objRefCount == 0) { ckfree((char *) borderPtr); } } + +/* + *---------------------------------------------------------------------- + * + * Tk_Free3DBorderFromObj -- + * + * This procedure is called to release a border allocated by + * Tk_Alloc3DBorderFromObj. It does not throw away the Tcl_Obj *; + * it only gets rid of the hash table entry for this border + * and clears the cached value that is normally stored in the object. + * + * Results: + * None. + * + * Side effects: + * The reference count associated with the border represented by + * objPtr is decremented, and the border's resources are released + * to X if there are no remaining uses for it. + * + *---------------------------------------------------------------------- + */ + +void +Tk_Free3DBorderFromObj(tkwin, objPtr) + Tk_Window tkwin; /* The window this border lives in. Needed + * for the screen and colormap values. */ + Tcl_Obj *objPtr; /* The Tcl_Obj * to be freed. */ +{ + Tk_Free3DBorder(Tk_Get3DBorderFromObj(tkwin, objPtr)); +} + +/* + *--------------------------------------------------------------------------- + * + * FreeBorderObjProc -- + * + * This proc is called to release an object reference to a border. + * Called when the object's internal rep is released or when + * the cached borderPtr needs to be changed. + * + * Results: + * None. + * + * Side effects: + * The object reference count is decremented. When both it + * and the hash ref count go to zero, the border's resources + * are released. + * + *--------------------------------------------------------------------------- + */ + +static void +FreeBorderObjProc(objPtr) + Tcl_Obj *objPtr; /* The object we are releasing. */ +{ + TkBorder *borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1; + + if (borderPtr != NULL) { + borderPtr->objRefCount--; + if ((borderPtr->objRefCount == 0) + && (borderPtr->resourceRefCount == 0)) { + ckfree((char *) borderPtr); + } + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL; + } +} + +/* + *--------------------------------------------------------------------------- + * + * DupBorderObjProc -- + * + * When a cached border object is duplicated, this is called to + * update the internal reps. + * + * Results: + * None. + * + * Side effects: + * The border's objRefCount is incremented and the internal rep + * of the copy is set to point to it. + * + *--------------------------------------------------------------------------- + */ + +static void +DupBorderObjProc(srcObjPtr, dupObjPtr) + Tcl_Obj *srcObjPtr; /* The object we are copying from. */ + Tcl_Obj *dupObjPtr; /* The object we are copying to. */ +{ + TkBorder *borderPtr = (TkBorder *) srcObjPtr->internalRep.twoPtrValue.ptr1; + + dupObjPtr->typePtr = srcObjPtr->typePtr; + dupObjPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr; + + if (borderPtr != NULL) { + borderPtr->objRefCount++; + } +} /* *---------------------------------------------------------------------- * * Tk_SetBackgroundFromBorder -- @@ -359,10 +596,39 @@ { register TkBorder *borderPtr = (TkBorder *) border; Tk_SetWindowBackground(tkwin, borderPtr->bgColorPtr->pixel); } + +/* + *---------------------------------------------------------------------- + * + * Tk_GetReliefFromObj -- + * + * Return an integer value based on the value of the objPtr. + * + * Results: + * The return value is a standard Tcl result. If an error occurs during + * conversion, an error message is left in the interpreter's result + * unless "interp" is NULL. + * + * Side effects: + * The object gets converted by Tcl_GetIndexFromObj. + * + *---------------------------------------------------------------------- + */ + +int +Tk_GetReliefFromObj(interp, objPtr, resultPtr) + Tcl_Interp *interp; /* Used for error reporting. */ + Tcl_Obj *objPtr; /* The object we are trying to get the + * value from. */ + int *resultPtr; /* Where to place the answer. */ +{ + return Tcl_GetIndexFromObj(interp, objPtr, reliefStrings, "relief", 0, + resultPtr); +} /* *---------------------------------------------------------------------- * * Tk_GetRelief -- @@ -405,12 +671,15 @@ } else if ((c == 's') && (strncmp(name, "solid", length) == 0)) { *reliefPtr = TK_RELIEF_SOLID; } else if ((c == 's') && (strncmp(name, "sunken", length) == 0)) { *reliefPtr = TK_RELIEF_SUNKEN; } else { - sprintf(interp->result, "bad relief type \"%.50s\": must be %s", + char buf[200]; + + sprintf(buf, "bad relief type \"%.50s\": must be %s", name, "flat, groove, raised, ridge, solid, or sunken"); + Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; } return TCL_OK; } @@ -780,14 +1049,15 @@ * *------------------------------------------------------------- */ static void -BorderInit() +BorderInit(dispPtr) + TkDisplay * dispPtr; /* Used to access thread-specific data. */ { - initialized = 1; - Tcl_InitHashTable(&borderTable, sizeof(BorderKey)/sizeof(int)); + dispPtr->borderInit = 1; + Tcl_InitHashTable(&dispPtr->borderTable, TCL_STRING_KEYS); } /* *-------------------------------------------------------------- * @@ -945,5 +1215,172 @@ } else { iPtr->y = (p + q/2)/q; } return 0; } + +/* + *---------------------------------------------------------------------- + * + * Tk_Get3DBorderFromObj -- + * + * Returns the border referred to by a Tcl object. The border must + * already have been allocated via a call to Tk_Alloc3DBorderFromObj + * or Tk_Get3DBorder. + * + * Results: + * Returns the Tk_3DBorder that matches the tkwin and the string rep + * of the name of the border given in objPtr. + * + * Side effects: + * If the object is not already a border, the conversion will free + * any old internal representation. + * + *---------------------------------------------------------------------- + */ + +Tk_3DBorder +Tk_Get3DBorderFromObj(tkwin, objPtr) + Tk_Window tkwin; + Tcl_Obj *objPtr; /* The object whose string value selects + * a border. */ +{ + TkBorder *borderPtr = NULL; + Tcl_HashEntry *hashPtr; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + + if (objPtr->typePtr != &borderObjType) { + InitBorderObj(objPtr); + } + + borderPtr = (TkBorder *) objPtr->internalRep.twoPtrValue.ptr1; + if (borderPtr != NULL) { + if ((borderPtr->resourceRefCount > 0) + && (Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + /* + * The object already points to the right border structure. + * Just return it. + */ + + return (Tk_3DBorder) borderPtr; + } + hashPtr = borderPtr->hashPtr; + FreeBorderObjProc(objPtr); + } else { + hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, + Tcl_GetString(objPtr)); + if (hashPtr == NULL) { + goto error; + } + } + + /* + * At this point we've got a hash table entry, off of which hang + * one or more TkBorder structures. See if any of them will work. + */ + + for (borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr); + (borderPtr != NULL); borderPtr = borderPtr->nextPtr) { + if ((Tk_Screen(tkwin) == borderPtr->screen) + && (Tk_Colormap(tkwin) == borderPtr->colormap)) { + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) borderPtr; + borderPtr->objRefCount++; + return (Tk_3DBorder) borderPtr; + } + } + + error: + panic("Tk_Get3DBorderFromObj called with non-existent border!"); + /* + * The following code isn't reached; it's just there to please compilers. + */ + return NULL; +} + +/* + *---------------------------------------------------------------------- + * + * InitBorderObj -- + * + * Attempt to generate a border internal form for the Tcl object + * "objPtr". + * + * Results: + * The return value is a standard Tcl result. If an error occurs during + * conversion, an error message is left in the interpreter's result + * unless "interp" is NULL. + * + * Side effects: + * If no error occurs, a blank internal format for a border value + * is intialized. The final form cannot be done without a Tk_Window. + * + *---------------------------------------------------------------------- + */ + +static void +InitBorderObj(objPtr) + Tcl_Obj *objPtr; /* The object to convert. */ +{ + Tcl_ObjType *typePtr; + + /* + * Free the old internalRep before setting the new one. + */ + + Tcl_GetString(objPtr); + typePtr = objPtr->typePtr; + if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { + (*typePtr->freeIntRepProc)(objPtr); + } + objPtr->typePtr = &borderObjType; + objPtr->internalRep.twoPtrValue.ptr1 = (VOID *) NULL; +} + +/* + *---------------------------------------------------------------------- + * + * TkDebugBorder -- + * + * This procedure returns debugging information about a border. + * + * Results: + * The return value is a list with one sublist for each TkBorder + * corresponding to "name". Each sublist has two elements that + * contain the resourceRefCount and objRefCount fields from the + * TkBorder structure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +Tcl_Obj * +TkDebugBorder(tkwin, name) + Tk_Window tkwin; /* The window in which the border will be + * used (not currently used). */ + char *name; /* Name of the desired color. */ +{ + TkBorder *borderPtr; + Tcl_HashEntry *hashPtr; + Tcl_Obj *resultPtr, *objPtr; + TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; + + resultPtr = Tcl_NewObj(); + hashPtr = Tcl_FindHashEntry(&dispPtr->borderTable, name); + if (hashPtr != NULL) { + borderPtr = (TkBorder *) Tcl_GetHashValue(hashPtr); + if (borderPtr == NULL) { + panic("TkDebugBorder found empty hash table entry"); + } + for ( ; (borderPtr != NULL); borderPtr = borderPtr->nextPtr) { + objPtr = Tcl_NewObj(); + Tcl_ListObjAppendElement(NULL, objPtr, + Tcl_NewIntObj(borderPtr->resourceRefCount)); + Tcl_ListObjAppendElement(NULL, objPtr, + Tcl_NewIntObj(borderPtr->objRefCount)); + Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); + } + } + return resultPtr; +} Index: generic/tk3d.h ================================================================== --- generic/tk3d.h +++ generic/tk3d.h @@ -2,40 +2,55 @@ * tk3d.h -- * * Declarations of types and functions shared by the 3d border * module. * - * Copyright (c) 1996 by Sun Microsystems, Inc. + * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tk3d.h 1.1 96/11/04 13:52:59 + * RCS: @(#) $Id: tk3d.h,v 1.1.4.2 1998/09/30 02:16:37 stanton Exp $ */ #ifndef _TK3D #define _TK3D #include +#ifdef BUILD_tk +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLEXPORT +#endif + /* - * One of the following data structures is allocated for - * each 3-D border currently in use. Structures of this - * type are indexed by borderTable, so that a single - * structure can be shared for several uses. + * One of the following data structures is allocated for each 3-D border + * currently in use. Structures of this type are indexed by + * borderTable, so that a single structure can be shared for several + * uses. */ -typedef struct { +typedef struct TkBorder { Screen *screen; /* Screen on which the border will be used. */ Visual *visual; /* Visual for all windows and pixmaps using * the border. */ int depth; /* Number of bits per pixel of drawables where * the border will be used. */ Colormap colormap; /* Colormap out of which pixels are * allocated. */ - int refCount; /* Number of different users of - * this border. */ + int resourceRefCount; /* Number of active uses of this color (each + * active use corresponds to a call to + * Tk_Alloc3DBorderFromObj or Tk_Get3DBorder). + * If this count is 0, then this structure + * is no longer valid and it isn't present + * in borderTable: it is being kept around + * only because there are objects referring + * to it. The structure is freed when + * resourceRefCount and objRefCount are + * both 0. */ + int objRefCount; /* The number of Tcl objects that reference + * this structure. */ XColor *bgColorPtr; /* Background color (intensity * between lightColorPtr and * darkColorPtr). */ XColor *darkColorPtr; /* Color for darker areas (must free when * deleting structure). NULL means shadows @@ -56,10 +71,15 @@ GC lightGC; /* Used to draw lighter parts of * the border. None means the shadow colors * haven't been allocated yet. */ Tcl_HashEntry *hashPtr; /* Entry in borderTable (needed in * order to delete structure). */ + struct TkBorder *nextPtr; /* Points to the next TkBorder structure with + * the same color name. Borders with the + * same name but different screens or + * colormaps are chained together off a + * single entry in borderTable. */ } TkBorder; /* * Maximum intensity for a color: @@ -74,6 +94,9 @@ EXTERN TkBorder * TkpGetBorder _ANSI_ARGS_((void)); EXTERN void TkpGetShadows _ANSI_ARGS_((TkBorder *borderPtr, Tk_Window tkwin)); EXTERN void TkpFreeBorder _ANSI_ARGS_((TkBorder *borderPtr)); +# undef TCL_STORAGE_CLASS +# define TCL_STORAGE_CLASS DLLIMPORT + #endif /* _TK3D */ Index: generic/tkArgv.c ================================================================== --- generic/tkArgv.c +++ generic/tkArgv.c @@ -3,16 +3,16 @@ * * This file contains a procedure that handles table-based * argv-argc parsing. * * Copyright (c) 1990-1994 The Regents of the University of California. - * Copyright (c) 1994 Sun Microsystems, Inc. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkArgv.c 1.21 97/04/25 16:50:27 + * RCS: @(#) $Id: tkArgv.c,v 1.1.4.2 1998/09/30 02:16:37 stanton Exp $ */ #include "tkPort.h" #include "tk.h" @@ -43,11 +43,11 @@ * Process an argv array according to a table of expected * command-line options. See the manual page for more details. * * Results: * The return value is a standard Tcl return value. If an - * error occurs then an error message is left in interp->result. + * error occurs then an error message is left in the interp's result. * Under normal conditions, both *argcPtr and *argv are modified * to return the arguments that couldn't be processed here (they * didn't match the option table, or followed an TK_ARGV_REST * argument). * @@ -289,14 +289,18 @@ Tk_AddOption(tkwin, argv[srcIndex], argv[srcIndex+1], TK_INTERACTIVE_PRIO); srcIndex += 2; argc -= 2; break; - default: - sprintf(interp->result, "bad argument type %d in Tk_ArgvInfo", + default: { + char buf[64 + TCL_INTEGER_SPACE]; + + sprintf(buf, "bad argument type %d in Tk_ArgvInfo", infoPtr->type); + Tcl_SetResult(interp, buf, TCL_VOLATILE); return TCL_ERROR; + } } } /* * If we broke out of the loop because of an OPT_REST argument, @@ -326,11 +330,11 @@ * PrintUsage -- * * Generate a help string describing command-line options. * * Results: - * Interp->result will be modified to hold a help string + * The interp's result will be modified to hold a help string * describing all the options in argTable, plus all those * in the default table unless TK_ARGV_NO_DEFAULTS is * specified in flags. * * Side effects: @@ -351,11 +355,11 @@ { register Tk_ArgvInfo *infoPtr; int width, i, numSpaces; #define NUM_SPACES 20 static char spaces[] = " "; - char tmp[30]; + char tmp[TCL_DOUBLE_SPACE]; /* * First, compute the width of the widest option key, so that we * can make everything line up. */ Index: generic/tkAtom.c ================================================================== --- generic/tkAtom.c +++ generic/tkAtom.c @@ -11,11 +11,11 @@ * Copyright (c) 1994 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkAtom.c 1.13 96/02/15 18:51:34 + * RCS: @(#) $Id: tkAtom.c,v 1.1.4.1 1998/09/30 02:16:38 stanton Exp $ */ #include "tkPort.h" #include "tkInt.h" Index: generic/tkBind.c ================================================================== --- generic/tkBind.c +++ generic/tkBind.c @@ -3,20 +3,25 @@ * * This file provides procedures that associate Tcl commands * with X events or sequences of X events. * * Copyright (c) 1989-1994 The Regents of the University of California. - * Copyright (c) 1994-1996 Sun Microsystems, Inc. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1998 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tkBind.c 1.133 97/07/01 17:59:53 + * RCS: @(#) $Id: tkBind.c,v 1.1.4.8 1999/04/03 02:54:15 redman Exp $ */ #include "tkPort.h" #include "tkInt.h" + +#ifdef __WIN32__ +#include "tkWinInt.h" +#endif /* * File structure: * * Structure definitions and static variables. @@ -337,10 +342,12 @@ * screen, so it can be restored after * a binding has executed. */ PendingBinding *pendingList;/* The list of pending C bindings, kept in * case a C or Tcl binding causes the target * window to be deleted. */ + int deleted; /* 1 the application has been deleted but + * the structure has been preserved. */ } BindInfo; /* * In X11R4 and earlier versions, XStringToKeysym is ridiculously * slow. The data structure and hash table below, along with the @@ -371,10 +378,11 @@ * Set to non-zero when the package-wide static variables have been * initialized. */ static int initialized = 0; +TCL_DECLARE_MUTEX(bindMutex) /* * A hash table is kept to map from the string names of event * modifiers to information about those modifiers. The structure * for storing this information, and the hash table built at @@ -493,10 +501,11 @@ {"Circulate", CirculateNotify, StructureNotifyMask}, {"Property", PropertyNotify, PropertyChangeMask}, {"Colormap", ColormapNotify, ColormapChangeMask}, {"Activate", ActivateNotify, ActivateMask}, {"Deactivate", DeactivateNotify, ActivateMask}, + {"MouseWheel", MouseWheelEvent, MouseWheelMask}, {(char *) NULL, 0, 0} }; static Tcl_HashTable eventTable; /* @@ -565,11 +574,26 @@ /* ColormapNotify */ COLORMAP, /* ClientMessage */ 0, /* MappingNotify */ 0, /* VirtualEvent */ VIRTUAL, /* Activate */ ACTIVATE, - /* Deactivate */ ACTIVATE + /* Deactivate */ ACTIVATE, + /* MouseWheel */ KEY +}; + +/* + * The following table is used to map between the location where an + * generated event should be queued and the string used to specify the + * location. + */ + +static TkStateMap queuePosition[] = { + {-1, "now"}, + {TCL_QUEUE_HEAD, "head"}, + {TCL_QUEUE_MARK, "mark"}, + {TCL_QUEUE_TAIL, "tail"}, + {-2, NULL} }; /* * The following tables are used as a two-way map between X's internal * numeric values for fields in an XEvent and the strings used in Tcl. The @@ -642,21 +666,27 @@ static int GetVirtualEvent _ANSI_ARGS_((Tcl_Interp *interp, VirtualEventTable *vetPtr, char *virtString)); static Tk_Uid GetVirtualEventUid _ANSI_ARGS_((Tcl_Interp *interp, char *virtString)); static int HandleEventGenerate _ANSI_ARGS_((Tcl_Interp *interp, - Tk_Window main, int argc, char **argv)); + Tk_Window main, int objc, + Tcl_Obj *CONST objv[])); static void InitKeymapInfo _ANSI_ARGS_((TkDisplay *dispPtr)); static void InitVirtualEventTable _ANSI_ARGS_(( VirtualEventTable *vetPtr)); static PatSeq * MatchPatterns _ANSI_ARGS_((TkDisplay *dispPtr, BindingTable *bindPtr, PatSeq *psPtr, PatSeq *bestPtr, ClientData *objectPtr, PatSeq **sourcePtrPtr)); +static int NameToWindow _ANSI_ARGS_((Tcl_Interp *interp, + Tk_Window main, Tcl_Obj *objPtr, + Tk_Window *tkwinPtr)); static int ParseEventDescription _ANSI_ARGS_((Tcl_Interp *interp, char **eventStringPtr, Pattern *patPtr, unsigned long *eventMaskPtr)); +static void SetKeycodeAndState _ANSI_ARGS_((Tk_Window tkwin, + KeySym keySym, XEvent *eventPtr)); /* * The following define is used as a short circuit for the callback * procedure to evaluate a TclBinding. The actual evaluation of the * binding is handled inline, because special things have to be done @@ -700,41 +730,45 @@ * They are only initialized once, no matter how many interps are * created. */ if (!initialized) { - Tcl_HashEntry *hPtr; - ModInfo *modPtr; - EventInfo *eiPtr; - int dummy; + Tcl_MutexLock(&bindMutex); + if (!initialized) { + Tcl_HashEntry *hPtr; + ModInfo *modPtr; + EventInfo *eiPtr; + int dummy; #ifdef REDO_KEYSYM_LOOKUP - KeySymInfo *kPtr; - - Tcl_InitHashTable(&keySymTable, TCL_STRING_KEYS); - Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS); - for (kPtr = keyArray; kPtr->name != NULL; kPtr++) { - hPtr = Tcl_CreateHashEntry(&keySymTable, kPtr->name, &dummy); - Tcl_SetHashValue(hPtr, kPtr->value); - hPtr = Tcl_CreateHashEntry(&nameTable, (char *) kPtr->value, - &dummy); - Tcl_SetHashValue(hPtr, kPtr->name); - } + KeySymInfo *kPtr; + + Tcl_InitHashTable(&keySymTable, TCL_STRING_KEYS); + Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS); + for (kPtr = keyArray; kPtr->name != NULL; kPtr++) { + hPtr = Tcl_CreateHashEntry(&keySymTable, kPtr->name, &dummy); + Tcl_SetHashValue(hPtr, kPtr->value); + hPtr = Tcl_CreateHashEntry(&nameTable, (char *) kPtr->value, + &dummy); + Tcl_SetHashValue(hPtr, kPtr->name); + } #endif /* REDO_KEYSYM_LOOKUP */ - Tcl_InitHashTable(&modTable, TCL_STRING_KEYS); - for (modPtr = modArray; modPtr->name != NULL; modPtr++) { - hPtr = Tcl_CreateHashEntry(&modTable, modPtr->name, &dummy); - Tcl_SetHashValue(hPtr, modPtr); - } - - Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS); - for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) { - hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &dummy); - Tcl_SetHashValue(hPtr, eiPtr); - } - initialized = 1; + Tcl_InitHashTable(&modTable, TCL_STRING_KEYS); + for (modPtr = modArray; modPtr->name != NULL; modPtr++) { + hPtr = Tcl_CreateHashEntry(&modTable, modPtr->name, &dummy); + Tcl_SetHashValue(hPtr, modPtr); + } + + Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS); + for (eiPtr = eventArray; eiPtr->name != NULL; eiPtr++) { + hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &dummy); + Tcl_SetHashValue(hPtr, eiPtr); + } + initialized = 1; + } + Tcl_MutexUnlock(&bindMutex); } mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp); bindInfoPtr = (BindInfo *) ckalloc(sizeof(BindInfo)); @@ -741,10 +775,11 @@ InitVirtualEventTable(&bindInfoPtr->virtualEventTable); bindInfoPtr->screenInfo.curDispPtr = NULL; bindInfoPtr->screenInfo.curScreenIndex = -1; bindInfoPtr->screenInfo.bindingDepth = 0; bindInfoPtr->pendingList = NULL; + bindInfoPtr->deleted = 0; mainPtr->bindInfo = (TkBindInfo) bindInfoPtr; TkpInitializeMenuBindings(mainPtr->interp, mainPtr->bindingTable); } @@ -774,10 +809,12 @@ Tk_DeleteBindingTable(mainPtr->bindingTable); mainPtr->bindingTable = NULL; bindInfoPtr = (BindInfo *) mainPtr->bindInfo; DeleteVirtualEventTable(&bindInfoPtr->virtualEventTable); + bindInfoPtr->deleted = 1; + Tcl_EventuallyFree((ClientData) bindInfoPtr, Tcl_Free); mainPtr->bindInfo = NULL; } /* *-------------------------------------------------------------- @@ -888,11 +925,11 @@ * Tk_BindEvent may execute the command in the binding. * * Results: * The return value is 0 if an error occurred while setting * up the binding. In this case, an error message will be - * left in interp->result. If all went well then the return + * left in the interp's result. If all went well then the return * value is a mask of the event types that must be made * available to Tk_BindEvent in order to properly detect when * this binding triggers. This value can be used to determine * what events to select for in a window, for example. * @@ -993,11 +1030,11 @@ * Tk_BindEvent may callback the procedure in the binding. * * Results: * The return value is 0 if an error occurred while setting * up the binding. In this case, an error message will be - * left in interp->result. If all went well then the return + * left in the interp's result. If all went well then the return * value is a mask of the event types that must be made * available to Tk_BindEvent in order to properly detect when * this binding triggers. This value can be used to determine * what events to select for in a window, for example. * @@ -1077,11 +1114,11 @@ * * Remove an event binding from a binding table. * * Results: * The result is a standard Tcl return value. If an error - * occurs then interp->result will contain an error message. + * occurs then the interp's result will contain an error message. * * Side effects: * The binding given by object and eventString is removed * from bindingTable. * @@ -1172,11 +1209,11 @@ * The return value is a pointer to the command string * associated with eventString for object in the domain * given by bindingTable. If there is no binding for * eventString, or if eventString is improperly formed, * then NULL is returned and an error message is left in - * interp->result. The return value is semi-static: it + * the interp's result. The return value is semi-static: it * will persist until the binding is changed or deleted. * * Side effects: * None. * @@ -1215,11 +1252,11 @@ * * Return a list of event strings for all the bindings * associated with a given object. * * Results: - * There is no return value. Interp->result is modified to + * There is no return value. The interp's result is modified to * hold a Tcl list with one entry for each binding associated * with object in bindingTable. Each entry in the list * contains the event string associated with one binding. * * Side effects: @@ -1379,13 +1416,13 @@ ClientData *objectPtr; /* Array of one or more objects * to check for a matching binding. */ { BindingTable *bindPtr; TkDisplay *dispPtr; + ScreenInfo *screenPtr; BindInfo *bindInfoPtr; TkDisplay *oldDispPtr; - ScreenInfo *screenPtr; XEvent *ringPtr; PatSeq *vMatchDetailList, *vMatchNoDetailList; int flags, oldScreen, i, deferModal; unsigned int matchCount, matchSpace; Tcl_Interp *interp; @@ -1612,16 +1649,16 @@ if (matchCount >= matchSpace) { PendingBinding *new; unsigned int oldSize, newSize; oldSize = sizeof(staticPending) - - sizeof(staticPending.matchArray) - + matchSpace * sizeof(PatSeq*); + - sizeof(staticPending.matchArray) + + matchSpace * sizeof(PatSeq*); matchSpace *= 2; newSize = sizeof(staticPending) - - sizeof(staticPending.matchArray) - + matchSpace * sizeof(PatSeq*); + - sizeof(staticPending.matchArray) + + matchSpace * sizeof(PatSeq*); new = (PendingBinding *) ckalloc(newSize); memcpy((VOID *) new, (VOID *) pendingPtr, oldSize); if (pendingPtr != &staticPending) { ckfree((char *) pendingPtr); } @@ -1648,11 +1685,11 @@ * in order, dealing with "break" and "continue" exceptions * appropriately. * * There are two tricks here: * 1. Bindings can be invoked from in the middle of Tcl commands, - * where interp->result is significant (for example, a widget + * where the interp's result is significant (for example, a widget * might be deleted because of an error in creating it, so the * result contains an error message that is eventually going to * be returned by the creating command). To preserve the result, * we save it in a dynamic string. * 2. The binding's action can potentially delete the binding, @@ -1679,10 +1716,17 @@ screenPtr->curScreenIndex = Tk_ScreenNumber(tkwin); ChangeScreen(interp, dispPtr->name, screenPtr->curScreenIndex); } if (matchCount > 0) { + /* + * Remember the list of pending C binding callbacks, so we can mark + * them as deleted and not call them if the act of evaluating a C + * or Tcl binding deletes a C binding callback or even the whole + * window. + */ + pendingPtr->nextPtr = bindInfoPtr->pendingList; pendingPtr->tkwin = tkwin; pendingPtr->deleted = 0; bindInfoPtr->pendingList = pendingPtr; } @@ -1698,14 +1742,24 @@ p = Tcl_DStringValue(&scripts); end = p + Tcl_DStringLength(&scripts); i = 0; + /* + * Be carefule when dereferencing screenPtr or bindInfoPtr. If we + * evaluate something that destroys ".", bindInfoPtr would have been + * freed, but we can tell that by first checking to see if + * winPtr->mainPtr == NULL. + */ + + Tcl_Preserve((ClientData) bindInfoPtr); while (p < end) { int code; - screenPtr->bindingDepth++; + if (!bindInfoPtr->deleted) { + screenPtr->bindingDepth++; + } Tcl_AllowExceptions(interp); if (*p == '\0') { PatSeq *psPtr; @@ -1727,11 +1781,14 @@ } else { code = Tcl_GlobalEval(interp, p); p += strlen(p); } p++; - screenPtr->bindingDepth--; + + if (!bindInfoPtr->deleted) { + screenPtr->bindingDepth--; + } if (code != TCL_OK) { if (code == TCL_CONTINUE) { /* * Do nothing: just go on to the next command. */ @@ -1757,12 +1814,12 @@ if (deferModal) { (*winPtr->classProcsPtr->modalProc)(tkwin, eventPtr); } } - if ((screenPtr->bindingDepth != 0) && - ((oldDispPtr != screenPtr->curDispPtr) + if (!bindInfoPtr->deleted && (screenPtr->bindingDepth != 0) + && ((oldDispPtr != screenPtr->curDispPtr) || (oldScreen != screenPtr->curScreenIndex))) { /* * Some other binding script is currently executing, but its * screen is no longer current. Change the current display @@ -1775,23 +1832,31 @@ } Tcl_DStringResult(interp, &savedResult); Tcl_DStringFree(&scripts); if (matchCount > 0) { - PendingBinding **curPtrPtr; - - for (curPtrPtr = &bindInfoPtr->pendingList; ; ) { - if (*curPtrPtr == pendingPtr) { - *curPtrPtr = pendingPtr->nextPtr; - break; - } - curPtrPtr = &(*curPtrPtr)->nextPtr; + if (!bindInfoPtr->deleted) { + /* + * Delete the pending list from the list of pending scripts + * for this window. + */ + + PendingBinding **curPtrPtr; + + for (curPtrPtr = &bindInfoPtr->pendingList; ; ) { + if (*curPtrPtr == pendingPtr) { + *curPtrPtr = pendingPtr->nextPtr; + break; + } + curPtrPtr = &(*curPtrPtr)->nextPtr; + } } if (pendingPtr != &staticPending) { ckfree((char *) pendingPtr); } } + Tcl_Release((ClientData) bindInfoPtr); } /* *--------------------------------------------------------------------------- * @@ -2162,11 +2227,12 @@ } newBest: bestPtr = matchPtr; bestSourcePtr = sourcePtr; - nextSequence: continue; + nextSequence: + continue; } *sourcePtrPtr = bestSourcePtr; return bestPtr; } @@ -2206,11 +2272,14 @@ int spaceNeeded, cvtFlags; /* Used to substitute string as proper Tcl * list element. */ int number, flags, length; #define NUM_SIZE 40 char *string; + Tcl_DString buf; char numStorage[NUM_SIZE+1]; + + Tcl_DStringInit(&buf); if (eventPtr->type < TK_LASTEVENT) { flags = flagArray[eventPtr->type]; } else { flags = 0; @@ -2241,12 +2310,14 @@ switch (before[1]) { case '#': number = eventPtr->xany.serial; goto doNumber; case 'a': - TkpPrintWindowId(numStorage, eventPtr->xconfigure.above); - string = numStorage; + if (flags & CONFIG) { + TkpPrintWindowId(numStorage, eventPtr->xconfigure.above); + string = numStorage; + } goto doString; case 'b': number = eventPtr->xbutton.button; goto doNumber; case 'c': @@ -2356,46 +2427,24 @@ } goto doNumber; case 'A': if (flags & KEY) { - int numChars; - - /* - * If we're using input methods and this is a keypress - * event, invoke XmbTkFindStateString. Otherwise just use - * the older XTkFindStateString. - */ - -#ifdef TK_USE_INPUT_METHODS - Status status; - if ((winPtr->inputContext != NULL) - && (eventPtr->type == KeyPress)) { - numChars = XmbLookupString(winPtr->inputContext, - &eventPtr->xkey, numStorage, NUM_SIZE, - (KeySym *) NULL, &status); - if ((status != XLookupChars) - && (status != XLookupBoth)) { - numChars = 0; - } - } else { - numChars = XLookupString(&eventPtr->xkey, numStorage, - NUM_SIZE, (KeySym *) NULL, - (XComposeStatus *) NULL); - } -#else /* TK_USE_INPUT_METHODS */ - numChars = XLookupString(&eventPtr->xkey, numStorage, - NUM_SIZE, (KeySym *) NULL, - (XComposeStatus *) NULL); -#endif /* TK_USE_INPUT_METHODS */ - numStorage[numChars] = '\0'; - string = numStorage; + Tcl_DStringFree(&buf); + string = TkpGetString(winPtr, eventPtr, &buf); } goto doString; case 'B': number = eventPtr->xcreatewindow.border_width; goto doNumber; + case 'D': + /* + * This is used only by the MouseWheel event. + */ + + number = eventPtr->xkey.keycode; + goto doNumber; case 'E': number = (int) eventPtr->xany.send_event; goto doNumber; case 'K': if (flags & KEY) { @@ -2480,10 +2529,11 @@ Tcl_DStringValue(dsPtr) + length, cvtFlags | TCL_DONT_USE_BRACES); Tcl_DStringSetLength(dsPtr, length + spaceNeeded); before += 2; } + Tcl_DStringFree(&buf); } /* *---------------------------------------------------------------------- * @@ -2512,11 +2562,11 @@ char *dispName; /* Name of new display. */ int screenIndex; /* Index of new screen. */ { Tcl_DString cmd; int code; - char screen[30]; + char screen[TCL_INTEGER_SPACE]; Tcl_DStringInit(&cmd); Tcl_DStringAppend(&cmd, "tkScreenChanged ", 16); Tcl_DStringAppend(&cmd, dispName, -1); sprintf(screen, ".%d", screenIndex); @@ -2546,91 +2596,100 @@ * *---------------------------------------------------------------------- */ int -Tk_EventCmd(clientData, interp, argc, argv) - ClientData clientData; /* Main window associated with - * interpreter. */ +Tk_EventObjCmd(clientData, interp, objc, objv) + ClientData clientData; /* Main window associated with interpreter. */ Tcl_Interp *interp; /* Current interpreter. */ - int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ + int objc; /* Number of arguments. */ + Tcl_Obj *CONST objv[]; /* Argument objects. */ { - int i; - size_t length; - char *option; + int index; Tk_Window tkwin; VirtualEventTable *vetPtr; TkBindInfo bindInfo; - - if (argc < 2) { - Tcl_AppendResult(interp, "wrong # args: should be \"", - argv[0], " option ?arg1?\"", (char *) NULL); - return TCL_ERROR; - } - - option = argv[1]; - length = strlen(option); - if (length == 0) { - goto badopt; - } + static char *optionStrings[] = { + "add", "delete", "generate", "info", + NULL + }; + enum options { + EVENT_ADD, EVENT_DELETE, EVENT_GENERATE, EVENT_INFO + }; tkwin = (Tk_Window) clientData; bindInfo = ((TkWindow *) tkwin)->mainPtr->bindInfo; vetPtr = &((BindInfo *) bindInfo)->virtualEventTable; - if (strncmp(option, "add", length) == 0) { - if (argc < 4) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " add virtual sequence ?sequence ...?\"", (char *) NULL); - return TCL_ERROR; - } - for (i = 3; i < argc; i++) { - if (CreateVirtualEvent(interp, vetPtr, argv[2], argv[i]) - != TCL_OK) { - return TCL_ERROR; - } - } - } else if (strncmp(option, "delete", length) == 0) { - if (argc < 3) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " delete virtual ?sequence sequence ...?\"", - (char *) NULL); - return TCL_ERROR; - } - if (argc == 3) { - return DeleteVirtualEvent(interp, vetPtr, argv[2], NULL); - } - for (i = 3; i < argc; i++) { - if (DeleteVirtualEvent(interp, vetPtr, argv[2], argv[i]) - != TCL_OK) { - return TCL_ERROR; - } - } - } else if (strncmp(option, "generate", length) == 0) { - if (argc < 4) { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " generate window event ?options?\"", (char *) NULL); - return TCL_ERROR; - } - return HandleEventGenerate(interp, tkwin, argc - 2, argv + 2); - } else if (strncmp(option, "info", length) == 0) { - if (argc == 2) { - GetAllVirtualEvents(interp, vetPtr); - return TCL_OK; - } else if (argc == 3) { - return GetVirtualEvent(interp, vetPtr, argv[2]); - } else { - Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], - " info ?virtual?\"", (char *) NULL); - return TCL_ERROR; - } - } else { - badopt: - Tcl_AppendResult(interp, "bad option \"", argv[1], - "\": should be add, delete, generate, info", (char *) NULL); - return TCL_ERROR; + if (objc < 2) { + Tcl_WrongNumArgs(interp, 1, objv, "option ?arg?"); + return TCL_ERROR; + } + if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, + &index) != TCL_OK) { + return TCL_ERROR; + } + + switch ((enum options) index) { + case EVENT_ADD: { + int i; + char *name, *event; + + if (objc < 4) { + Tcl_WrongNumArgs(interp, 2, objv, + "virtual sequence ?sequence ...?"); + return TCL_ERROR; + } + name = Tcl_GetStringFromObj(objv[2], NULL); + for (i = 3; i < objc; i++) { + event = Tcl_GetStringFromObj(objv[i], NULL); + if (CreateVirtualEvent(interp, vetPtr, name, event) != TCL_OK) { + return TCL_ERROR; + } + } + break; + } + case EVENT_DELETE: { + int i; + char *name, *event; + + if (objc < 3) { + Tcl_WrongNumArgs(interp, 2, objv, + "virtual ?sequence sequence ...?"); + return TCL_ERROR; + } + name = Tcl_GetStringFromObj(objv[2], NULL); + if (objc == 3) { + return DeleteVirtualEvent(interp, vetPtr, name, NULL); + } + for (i = 3; i < objc; i++) { + event = Tcl_GetStringFromObj(objv[i], NULL); + if (DeleteVirtualEvent(interp, vetPtr, name, event) != TCL_OK) { + return TCL_ERROR; + } + } + break; + } + case EVENT_GENERATE: { + if (objc < 4) { + Tcl_WrongNumArgs(interp, 2, objv, "window event ?options?"); + return TCL_ERROR; + } + return HandleEventGenerate(interp, tkwin, objc - 2, objv + 2); + } + case EVENT_INFO: { + if (objc == 2) { + GetAllVirtualEvents(interp, vetPtr); + return TCL_OK; + } else if (objc == 3) { + return GetVirtualEvent(interp, vetPtr, + Tcl_GetStringFromObj(objv[2], NULL)); + } else { + Tcl_WrongNumArgs(interp, 2, objv, "?virtual?"); + return TCL_ERROR; + } + } } return TCL_OK; } /* @@ -2713,12 +2772,12 @@ * already exist. * * Results: * The return value is TCL_ERROR if an error occured while * creating the virtual binding. In this case, an error message - * will be left in interp->result. If all went well then the return - * value is TCL_OK. + * will be left in the interp's result. If all went well then the + * return value is TCL_OK. * * Side effects: * The virtual event may cause future calls to Tk_BindEvent to * behave differently than they did previously. * @@ -2819,11 +2878,11 @@ * will be removed. Otherwise, just the specified definition * of the virtual event will be removed. * * Results: * The result is a standard Tcl return value. If an error - * occurs then interp->result will contain an error message. + * occurs then the interp's result will contain an error message. * It is not an error to attempt to delete a virtual event that * does not exist or a definition that does not exist. * * Side effects: * The virtual event given by virtString may be removed from the @@ -2871,11 +2930,14 @@ */ eventPSPtr = FindSequence(interp, &vetPtr->patternTable, NULL, eventString, 0, 0, &eventMask); if (eventPSPtr == NULL) { - return (interp->result[0] != '\0') ? TCL_ERROR : TCL_OK; + char *string; + + string = Tcl_GetStringResult(interp); + return (string[0] != '\0') ? TCL_ERROR : TCL_OK; } } for (iPhys = poPtr->numOwned; --iPhys >= 0; ) { PatSeq *psPtr = poPtr->patSeqs[iPhys]; @@ -2973,16 +3035,16 @@ * * Return the list of physical events that can invoke the * given virtual event. * * Results: - * The return value is TCL_OK and interp->result is filled with the + * The return value is TCL_OK and the interp's result is filled with the * string representation of the physical events associated with the * virtual event; if there are no physical events for the given virtual - * event, interp->result is filled with and empty string. If the + * event, the interp's result is filled with and empty string. If the * virtual event string is improperly formed, then TCL_ERROR is - * returned and an error message is left in interp->result. + * returned and an error message is left in the interp's result. * * Side effects: * None. * *--------------------------------------------------------------------------- @@ -3030,11 +3092,11 @@ * * Return a list that contains the names of all the virtual * event defined. * * Results: - * There is no return value. Interp->result is modified to + * There is no return value. The interp's result is modified to * hold a Tcl list with one entry for each virtual event in * nameTable. * * Side effects: * None. @@ -3099,60 +3161,76 @@ * default setting is synchronous. * *--------------------------------------------------------------------------- */ static int -HandleEventGenerate(interp, main, argc, argv) - Tcl_Interp *interp; /* Interp for error messages and name lookup. */ - Tk_Window main; /* Main window associated with interp. */ - int argc; /* Number of arguments. */ - char **argv; /* Argument strings. */ -{ - Pattern pat; - Tk_Window tkwin; - char *p; - unsigned long eventMask; - int count, i, state, flags, synch; +HandleEventGenerate(interp, mainWin, objc, objv) + Tcl_Interp *interp; /* Interp for errors return and name lookup. */ + Tk_Window mainWin; /* Main window associated with interp. */ + int objc; /* Number of arguments. */ + Tcl_Obj *CONST objv[]; /* Argument objects. */ +{ + XEvent event; + char *name, *p; + int count, flags, synch, i, number; Tcl_QueuePosition pos; - XEvent event; - - if (argv[0][0] == '.') { - tkwin = Tk_NameToWindow(interp, argv[0], main); - if (tkwin == NULL) { - return TCL_ERROR; - } - } else { - if (TkpScanWindowId(NULL, argv[0], &i) != TCL_OK) { - Tcl_AppendResult(interp, "bad window name/identifier \"", - argv[0], "\"", (char *) NULL); - return TCL_ERROR; - } - tkwin = Tk_IdToWindow(Tk_Display(main), (Window) i); - if ((tkwin == NULL) || (((TkWindow *) main)->mainPtr - != ((TkWindow *) tkwin)->mainPtr)) { - Tcl_AppendResult(interp, "window id \"", argv[0], - "\" doesn't exist in this application", (char *) NULL); - return TCL_ERROR; - } - } - - p = argv[1]; + Pattern pat; + Tk_Window tkwin, tkwin2; + TkWindow *mainPtr; + unsigned long eventMask; + static char *fieldStrings[] = { + "-when", "-above", "-borderwidth", "-button", + "-count", "-delta", "-detail", "-focus", + "-height", + "-keycode", "-keysym", "-mode", "-override", + "-place", "-root", "-rootx", "-rooty", + "-sendevent", "-serial", "-state", "-subwindow", + "-time", "-width", "-window", "-x", + "-y", NULL + }; + enum field { + EVENT_WHEN, EVENT_ABOVE, EVENT_BORDER, EVENT_BUTTON, + EVENT_COUNT, EVENT_DELTA, EVENT_DETAIL, EVENT_FOCUS, + EVENT_HEIGHT, + EVENT_KEYCODE, EVENT_KEYSYM, EVENT_MODE, EVENT_OVERRIDE, + EVENT_PLACE, EVENT_ROOT, EVENT_ROOTX, EVENT_ROOTY, + EVENT_SEND, EVENT_SERIAL, EVENT_STATE, EVENT_SUBWINDOW, + EVENT_TIME, EVENT_WIDTH, EVENT_WINDOW, EVENT_X, + EVENT_Y + }; + + if (NameToWindow(interp, mainWin, objv[0], &tkwin) != TCL_OK) { + return TCL_ERROR; + } + + mainPtr = (TkWindow *) mainWin; + if ((tkwin == NULL) + || (mainPtr->mainPtr != ((TkWindow *) tkwin)->mainPtr)) { + char *name; + + name = Tcl_GetStringFromObj(objv[0], NULL); + Tcl_AppendResult(interp, "window id \"", name, + "\" doesn't exist in this application", (char *) NULL); + return TCL_ERROR; + } + + name = Tcl_GetStringFromObj(objv[1], NULL); + + p = name; + eventMask = 0; count = ParseEventDescription(interp, &p, &pat, &eventMask); if (count == 0) { return TCL_ERROR; } if (count != 1) { - interp->result = "Double or Triple modifier not allowed"; + Tcl_SetResult(interp, "Double or Triple modifier not allowed", + TCL_STATIC); return TCL_ERROR; } if (*p != '\0') { - interp->result = "only one event specification allowed"; - return TCL_ERROR; - } - if (argc & 1) { - Tcl_AppendResult(interp, "value for \"", argv[argc - 1], - "\" missing", (char *) NULL); + Tcl_SetResult(interp, "only one event specification allowed", + TCL_STATIC); return TCL_ERROR; } memset((VOID *) &event, 0, sizeof(event)); event.xany.type = pat.eventType; @@ -3162,39 +3240,12 @@ event.xany.display = Tk_Display(tkwin); flags = flagArray[event.xany.type]; if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) { event.xkey.state = pat.needMods; - if (flags & KEY) { - /* - * When mapping from a keysym to a keycode, need information about - * the modifier state that should be used so that when they call - * XKeycodeToKeysym taking into account the xkey.state, they will - * get back the original keysym. - */ - - if (pat.detail.keySym == NoSymbol) { - event.xkey.keycode = 0; - } else { - event.xkey.keycode = XKeysymToKeycode(event.xany.display, - pat.detail.keySym); - } - if (event.xkey.keycode != 0) { - for (state = 0; state < 4; state++) { - if (XKeycodeToKeysym(event.xany.display, - event.xkey.keycode, state) == pat.detail.keySym) { - if (state & 1) { - event.xkey.state |= ShiftMask; - } - if (state & 2) { - TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - event.xkey.state |= dispPtr->modeModMask; - } - break; - } - } - } + if ((flags & KEY) && (event.xany.type != MouseWheelEvent)) { + SetKeycodeAndState(tkwin, pat.detail.keySym, &event); } else if (flags & BUTTON) { event.xbutton.button = pat.detail.button; } else if (flags & VIRTUAL) { ((XVirtualEvent *) &event)->name = pat.detail.name; } @@ -3208,377 +3259,491 @@ * of the event. */ synch = 1; pos = TCL_QUEUE_TAIL; - for (i = 2; i < argc; i += 2) { - char *field, *value; - Tk_Window tkwin2; - int number; - KeySym keysym; - - field = argv[i]; - value = argv[i+1]; - - if (strcmp(field, "-when") == 0) { - if (strcmp(value, "now") == 0) { - synch = 1; - } else if (strcmp(value, "head") == 0) { - pos = TCL_QUEUE_HEAD; - synch = 0; - } else if (strcmp(value, "mark") == 0) { - pos = TCL_QUEUE_MARK; - synch = 0; - } else if (strcmp(value, "tail") == 0) { - pos = TCL_QUEUE_TAIL; - synch = 0; - } else { - Tcl_AppendResult(interp, "bad position \"", value, - "\": should be now, head, mark, tail", (char *) NULL); - return TCL_ERROR; - } - } else if (strcmp(field, "-above") == 0) { - if (value[0] == '.') { - tkwin2 = Tk_NameToWindow(interp, value, main); - if (tkwin2 == NULL) { - return TCL_ERROR; - } - number = Tk_WindowId(tkwin2); - } else if (TkpScanWindowId(interp, value, &number) - != TCL_OK) { - return TCL_ERROR; - } - if (flags & CONFIG) { - event.xconfigure.above = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-borderwidth") == 0) { - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & (CREATE|CONFIG)) { - event.xcreatewindow.border_width = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-button") == 0) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & BUTTON) { - event.xbutton.button = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-count") == 0) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & EXPOSE) { - event.xexpose.count = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-detail") == 0) { - number = TkFindStateNum(interp, field, notifyDetail, value); - if (number < 0) { - return TCL_ERROR; - } - if (flags & FOCUS) { - event.xfocus.detail = number; - } else if (flags & CROSSING) { - event.xcrossing.detail = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-focus") == 0) { - if (Tcl_GetBoolean(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & CROSSING) { - event.xcrossing.focus = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-height") == 0) { - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & EXPOSE) { - event.xexpose.height = number; - } else if (flags & CONFIG) { - event.xconfigure.height = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-keycode") == 0) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & KEY) { - event.xkey.keycode = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-keysym") == 0) { - keysym = TkStringToKeysym(value); - if (keysym == NoSymbol) { - Tcl_AppendResult(interp, "unknown keysym \"", value, - "\"", (char *) NULL); - return TCL_ERROR; - } - /* - * When mapping from a keysym to a keycode, need information about - * the modifier state that should be used so that when they call - * XKeycodeToKeysym taking into account the xkey.state, they will - * get back the original keysym. - */ - - number = XKeysymToKeycode(event.xany.display, keysym); - if (number == 0) { - Tcl_AppendResult(interp, "no keycode for keysym \"", value, - "\"", (char *) NULL); - return TCL_ERROR; - } - for (state = 0; state < 4; state++) { - if (XKeycodeToKeysym(event.xany.display, (unsigned) number, - state) == keysym) { - if (state & 1) { - event.xkey.state |= ShiftMask; - } - if (state & 2) { - TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; - event.xkey.state |= dispPtr->modeModMask; - } - break; - } - } - if (flags & KEY) { - event.xkey.keycode = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-mode") == 0) { - number = TkFindStateNum(interp, field, notifyMode, value); - if (number < 0) { - return TCL_ERROR; - } - if (flags & CROSSING) { - event.xcrossing.mode = number; - } else if (flags & FOCUS) { - event.xfocus.mode = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-override") == 0) { - if (Tcl_GetBoolean(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & CREATE) { - event.xcreatewindow.override_redirect = number; - } else if (flags & MAP) { - event.xmap.override_redirect = number; - } else if (flags & REPARENT) { - event.xreparent.override_redirect = number; - } else if (flags & CONFIG) { - event.xconfigure.override_redirect = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-place") == 0) { - number = TkFindStateNum(interp, field, circPlace, value); - if (number < 0) { - return TCL_ERROR; - } - if (flags & CIRC) { - event.xcirculate.place = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-root") == 0) { - if (value[0] == '.') { - tkwin2 = Tk_NameToWindow(interp, value, main); - if (tkwin2 == NULL) { - return TCL_ERROR; - } - number = Tk_WindowId(tkwin2); - } else if (TkpScanWindowId(interp, value, &number) - != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.root = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-rootx") == 0) { - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.x_root = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-rooty") == 0) { - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.y_root = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-sendevent") == 0) { - if (isdigit(UCHAR(value[0]))) { - /* - * Allow arbitrary integer values for the field; they - * are needed by a few of the tests in the Tk test suite. - */ - - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - } else { - if (Tcl_GetBoolean(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - } - event.xany.send_event = number; - } else if (strcmp(field, "-serial") == 0) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - event.xany.serial = number; - } else if (strcmp(field, "-state") == 0) { - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL)) { - event.xkey.state = number; - } else { - event.xcrossing.state = number; - } - } else if (flags & VISIBILITY) { - number = TkFindStateNum(interp, field, visNotify, value); - if (number < 0) { - return TCL_ERROR; - } - event.xvisibility.state = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-subwindow") == 0) { - if (value[0] == '.') { - tkwin2 = Tk_NameToWindow(interp, value, main); - if (tkwin2 == NULL) { - return TCL_ERROR; - } - number = Tk_WindowId(tkwin2); - } else if (TkpScanWindowId(interp, value, &number) - != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.subwindow = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-time") == 0) { - if (Tcl_GetInt(interp, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.time = (Time) number; - } else if (flags & PROP) { - event.xproperty.time = (Time) number; - } else { - goto badopt; - } - } else if (strcmp(field, "-width") == 0) { - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - if (flags & EXPOSE) { - event.xexpose.width = number; - } else if (flags & (CREATE|CONFIG)) { - event.xcreatewindow.width = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-window") == 0) { - if (value[0] == '.') { - tkwin2 = Tk_NameToWindow(interp, value, main); - if (tkwin2 == NULL) { - return TCL_ERROR; - } - number = Tk_WindowId(tkwin2); - } else if (TkpScanWindowId(interp, value, &number) - != TCL_OK) { - return TCL_ERROR; - } - if (flags & (CREATE|DESTROY|UNMAP|MAP|REPARENT|CONFIG - |GRAVITY|CIRC)) { - event.xcreatewindow.window = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-x") == 0) { - int rootX, rootY; - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - Tk_GetRootCoords(tkwin, &rootX, &rootY); - rootX += number; - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.x = number; - event.xkey.x_root = rootX; - } else if (flags & EXPOSE) { - event.xexpose.x = number; - } else if (flags & (CREATE|CONFIG|GRAVITY)) { - event.xcreatewindow.x = number; - } else if (flags & REPARENT) { - event.xreparent.x = number; - } else { - goto badopt; - } - } else if (strcmp(field, "-y") == 0) { - int rootX, rootY; - if (Tk_GetPixels(interp, tkwin, value, &number) != TCL_OK) { - return TCL_ERROR; - } - Tk_GetRootCoords(tkwin, &rootX, &rootY); - rootY += number; - if (flags & (KEY_BUTTON_MOTION_VIRTUAL|CROSSING)) { - event.xkey.y = number; - event.xkey.y_root = rootY; - } else if (flags & EXPOSE) { - event.xexpose.y = number; - } else if (flags & (CREATE|CONFIG|GRAVITY)) { - event.xcreatewindow.y = number; - } else if (flags & REPARENT) { - event.xreparent.y = number; - } else { - goto badopt; - } - } else { - badopt: - Tcl_AppendResult(interp, "bad option to ", argv[1], - " event: \"", field, "\"", (char *) NULL); - return TCL_ERROR; - } - } - + for (i = 2; i < objc; i += 2) { + Tcl_Obj *optionPtr, *valuePtr; + int index; + + optionPtr = objv[i]; + valuePtr = objv[i + 1]; + + if (Tcl_GetIndexFromObj(interp, optionPtr, fieldStrings, "option", + TCL_EXACT, &index) != TCL_OK) { + return TCL_ERROR; + } + if (objc & 1) { + /* + * This test occurs after Tcl_GetIndexFromObj() so that + * "event generate