Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch bug6e8afe516d-87 Excluding Merge-Ins
This is equivalent to a diff from 8ad2b2d0 to b8fa3732
2019-08-28
| ||
19:34 | Merge TIP #532 implementation for 8.7 now that [c1c842ef7792] (new tkBind.c: wrong assumption about ButtonRelease to match Button presses) is fixed. check-in: f3ae247a user: fvogel tags: trunk | |
2019-08-13
| ||
10:24 | (cherry-pick): Final review: Don't use ALL_BUTTONS_MASK and ButtonNumberToMask() any more, since Tk has it's own macro/function for that now. Closed-Leaf check-in: b8fa3732 user: jan.nijtmans tags: bug6e8afe516d-87, tip-532 | |
10:09 | Final review: Don't use ALL_BUTTONS_MASK and ButtonNumberToMask() any more, since Tk has it's own macro/function for that now. check-in: 77c59955 user: jan.nijtmans tags: bug6e8afe516d, tip-532 | |
09:37 | Merge 8.7 check-in: 176c7b16 user: jan.nijtmans tags: bug6e8afe516d-87, tip-532 | |
2019-03-29
| ||
19:40 | Merge 8.6 check-in: fd419d47 user: jan.nijtmans tags: bug6e8afe516d, tip-532 | |
2019-02-03
| ||
20:32 | Propagate the call to TkpInitKeymapInfo in TkpOpenDisplay from Linux to Windows and macOS. check-in: fba343f0 user: fvogel tags: bug6e8afe516d-87, tip-532 | |
20:31 | Propagate the call to TkpInitKeymapInfo in TkpOpenDisplay from Linux to macOS. check-in: 8ad2b2d0 user: fvogel tags: bug6e8afe516d, tip-532 | |
20:22 | Propagate the call to TkpInitKeymapInfo in TkpOpenDisplay from Linux to Windows. check-in: a2d9055c user: fvogel tags: bug6e8afe516d, tip-532 | |
Changes to .fossil-settings/encoding-glob.
1 2 | win/buildall.vc.bat win/makefile.vc | < < | 1 2 3 | win/buildall.vc.bat win/makefile.vc win/rules.vc |
Changes to .project.
1 2 | <?xml version="1.0" encoding="UTF-8"?> <projectDescription> | | | 1 2 3 4 5 6 7 8 9 10 | <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>tk8.7</name> <comment></comment> <projects> </projects> <buildSpec> </buildSpec> <natures> </natures> |
︙ | ︙ |
Changes to ChangeLog.2002.
︙ | ︙ | |||
2234 2235 2236 2237 2238 2239 2240 | Removed setting inputContext to null in Tk_MakeWindowExist as it was redundant. * unix/tkUnixWm.c (CreateWrapper): Removed redundat setting of inputContext to null. * win/Makefile.in: changed gdb and shell targets to properly build | | | 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 | Removed setting inputContext to null in Tk_MakeWindowExist as it was redundant. * unix/tkUnixWm.c (CreateWrapper): Removed redundat setting of inputContext to null. * win/Makefile.in: changed gdb and shell targets to properly build all binaries before running (otherwise an error often occurred). 2002-03-28 David Gravereaux <[email protected]> * win/.cvsignore (new): * win/lamp.bmp (new): * win/makefile.vc: * win/nmakehlp.c (new): |
︙ | ︙ |
Changes to ChangeLog.2004.
︙ | ︙ | |||
807 808 809 810 811 812 813 | * doc/canvas.n: Add paragraph to make clearer what is going on with the default canvas origin. [Bug 956681] 2004-07-05 George Peter Staplin <[email protected]> * generic/tkEvent.c: TK_XIM_SPOT preprocessor usage was modified | | | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | * doc/canvas.n: Add paragraph to make clearer what is going on with the default canvas origin. [Bug 956681] 2004-07-05 George Peter Staplin <[email protected]> * generic/tkEvent.c: TK_XIM_SPOT preprocessor usage was modified slightly to fix a bug that occurred when TK_XIM_SPOT was defined as 0. Thanks to Joe Mistachkin for reporting this bug. 2004-07-05 Donal K. Fellows <[email protected]> TIP#158 IMPLEMENTATION * tests/bind.test: Allow Win apps to distinguish keys |
︙ | ︙ |
Deleted README.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Added README.md.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # README: Tk This is the **Tk 8.7a2** source distribution. You can get any source release of Tk from [our distribution site](https://sourceforge.net/projects/tcl/files/Tcl/). ## <a id="intro">1.</a> Introduction This directory contains the sources and documentation for Tk, a cross-platform GUI toolkit implemented with the Tcl scripting language. For details on features, incompatibilities, and potential problems with this release, see [the Tcl/Tk 8.7 Web page](https://www.tcl.tk/software/tcltk/8.7.html) or refer to the "changes" file in this directory, which contains a historical record of all changes to Tk. Tk is maintained, enhanced, and distributed freely by the Tcl community. Source code development and tracking of bug reports and feature requests takes place at [core.tcl-lang.org](https://core.tcl-lang.org/). Tcl/Tk release and mailing list services are [hosted by SourceForge](https://sourceforge.net/projects/tcl/) with the Tcl Developer Xchange hosted at [www.tcl-lang.org](https://www.tcl-lang.org). 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. ## <a id="tcl">2.</a> See Tcl README.md Please see the README.md file that comes with the associated Tcl release for more information. There are pointers there to extensive documentation. In addition, there are additional README files in the subdirectories of this distribution. |
Changes to changes.
︙ | ︙ | |||
5095 5096 5097 5098 5099 5100 5101 | correctly. (hobbs) 2001-08-28 (bug fix) fixed tk_chooseDirectory crash on Win95. (baker) 2001-08-28 (bug fix) removed 2 second 'raise' delay seen by some Unix window managers. (hobbs, baker) | | | 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 | correctly. (hobbs) 2001-08-28 (bug fix) fixed tk_chooseDirectory crash on Win95. (baker) 2001-08-28 (bug fix) removed 2 second 'raise' delay seen by some Unix window managers. (hobbs, baker) 2001-09-14 (bug fix) fixed memory leaks that occurred if errors were thrown while initializing the channel for an image. (darley) 2001-09-20 (new feature) --enable-64bit support was added for HP 11 when using the native compiler. 2001-10-03 (new feature) finalized Win64 support with latest RC1 release and SDK. (hobbs, stacy) |
︙ | ︙ | |||
7565 7566 7567 7568 7569 7570 7571 | 2018-10-17 (bug)[4b555a] hang in [$text search -all] (vogel,danckaert) 2018-10-30 (new platform) port to system changes in Mac OSX 10.14 (culler) 2018-11-04 (bug)[6b22d4] [treeview] binding fix (ohagan) - Released 8.6.9, November 16, 2018 - http://core.tcl-lang.org/tk/ for details - | > > > > > > > > > > > > > > > > > > > > > > > | 7565 7566 7567 7568 7569 7570 7571 7572 7573 7574 7575 7576 7577 7578 7579 7580 7581 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 | 2018-10-17 (bug)[4b555a] hang in [$text search -all] (vogel,danckaert) 2018-10-30 (new platform) port to system changes in Mac OSX 10.14 (culler) 2018-11-04 (bug)[6b22d4] [treeview] binding fix (ohagan) - Released 8.6.9, November 16, 2018 - http://core.tcl-lang.org/tk/ for details - Changes to 8.7a1 include all changes to the 8.6 line through 8.6.7, plus the following, which focuses on the high-level feature changes in this changeset (new minor version) rather than bug fixes: 2016-03-07 (feature)[841280] spinbox autoswap -to/-from to get ordering (vogel) 2016-03-27 (feature)[38dc27] Support <Button-6> & <Button-7> (nijtmans) 2016-08-29 (TIP 449) [text] undo/redo return character range (vogel) 2016-11-02 (feature) Removed undocumented command [tk_getFileType] (vogel) *** POTENTIAL INCOMPATIBILITY *** 2017-02-05 (bug)[c0dbdd] Compatibility fonts shadowed system fonts (vogel) 2017-03-21 (TIP 442) display text in a progressbar (zaumseil) 2017-04-13 \u escaped content in msg files converted to true utf-8 (nijtmans) 2017-08-28 (TIP 166) Extended color notation for alpha channel (bachmann) --- Released 8.7a1, September 8, 2017 --- http://core.tcl.tk/tk/ for details |
Deleted compat/stdlib.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Deleted compat/unistd.h.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to doc/3DBorder.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1993 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1993 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. '\" .TH Tk_Alloc3DBorderFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME 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 |
︙ | ︙ |
Changes to doc/BindTable.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateBindingTable 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateBindingTable, Tk_DeleteBindingTable, Tk_CreateBinding, Tk_DeleteBinding, Tk_GetBinding, Tk_GetAllBindings, Tk_DeleteAllBindings, Tk_BindEvent \- invoke scripts in response to X events .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CanvPsY.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_CanvasPs 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CanvasPsY, Tk_CanvasPsBitmap, Tk_CanvasPsColor, Tk_CanvasPsFont, Tk_CanvasPsPath, Tk_CanvasPsStipple \- utility procedures for generating Postscript for canvases .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CanvTkwin.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_CanvasTkwin 3 4.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CanvasTkwin, Tk_CanvasGetCoord, Tk_CanvasDrawableCoords, Tk_CanvasSetStippleOrigin, Tk_CanvasWindowCoords, Tk_CanvasEventuallyRedraw, Tk_CanvasTagsOption \- utility procedures for canvas type managers .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CanvTxtInfo.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_CanvasTextInfo 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CanvasTextInfo \- additional information for managing text items in canvases .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/Clipboard.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_ClipboardClear 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ClipboardClear, Tk_ClipboardAppend \- Manage the clipboard .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ClrSelect.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_ClearSelection 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ClearSelection \- Deselect a selection .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ConfigWidg.3.
︙ | ︙ | |||
103 104 105 106 107 108 109 | .CS typedef struct { int \fItype\fR; const char *\fIargvName\fR; const char *\fIdbName\fR; const char *\fIdbClass\fR; const char *\fIdefValue\fR; | | | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | .CS typedef struct { int \fItype\fR; const char *\fIargvName\fR; const char *\fIdbName\fR; const char *\fIdbClass\fR; const char *\fIdefValue\fR; size_t \fIoffset\fR; int \fIspecFlags\fR; const Tk_CustomOption *\fIcustomPtr\fR; } \fBTk_ConfigSpec\fR; .CE The \fItype\fR field indicates what type of configuration option this is (e.g. \fBTK_CONFIG_COLOR\fR for a color value, or \fBTK_CONFIG_INT\fR for an integer value). The \fItype\fR field indicates how to use the |
︙ | ︙ | |||
157 158 159 160 161 162 163 | form, such as a color if \fItype\fR is \fBTK_CONFIG_COLOR\fR or an integer if \fItype\fR is \fBTK_CONFIG_INT\fR. This value is then stored in the record pointed to by \fIwidgRec\fR. This record is assumed to contain information relevant to the manager of the widget; its exact type is unknown to \fBTk_ConfigureWidget\fR. The \fIoffset\fR field of each \fIspecs\fR entry indicates where in \fIwidgRec\fR to store the information about this configuration option. You should use the | | < | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | form, such as a color if \fItype\fR is \fBTK_CONFIG_COLOR\fR or an integer if \fItype\fR is \fBTK_CONFIG_INT\fR. This value is then stored in the record pointed to by \fIwidgRec\fR. This record is assumed to contain information relevant to the manager of the widget; its exact type is unknown to \fBTk_ConfigureWidget\fR. The \fIoffset\fR field of each \fIspecs\fR entry indicates where in \fIwidgRec\fR to store the information about this configuration option. You should use the \fBoffsetof\fR macro to generate \fIoffset\fR values. The location indicated by \fIwidgRec\fR and \fIoffset\fR will be referred to as the .QW target in the descriptions below. .PP The \fItype\fR field of each entry in \fIspecs\fR determines what to do with the string value of that configuration option. The legal values for \fItype\fR, and the corresponding actions, are: .TP |
︙ | ︙ | |||
465 466 467 468 469 470 471 | for N different widget types, then N of the high-order bits will be used. Each \fIspecs\fR entry will have one of more of those bits set in its \fIspecFlags\fR field to indicate the widget types for which this entry is valid. When calling \fBTk_ConfigureWidget\fR, \fIflags\fR will have a single one of these bits set to select the entries for the desired widget type. For a working example of this feature, see the code in tkButton.c. | < < < < < < < | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | for N different widget types, then N of the high-order bits will be used. Each \fIspecs\fR entry will have one of more of those bits set in its \fIspecFlags\fR field to indicate the widget types for which this entry is valid. When calling \fBTk_ConfigureWidget\fR, \fIflags\fR will have a single one of these bits set to select the entries for the desired widget type. For a working example of this feature, see the code in tkButton.c. .SH TK_CONFIGUREINFO .PP The \fBTk_ConfigureInfo\fR procedure may be used to obtain information about one or all of the options for a given widget. Given a token for a window (\fItkwin\fR), a table describing the configuration options for a class of widgets (\fIspecs\fR), a pointer to a widget record containing the current information for |
︙ | ︙ |
Changes to doc/ConfigWind.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. '\" .TH Tk_ConfigureWindow 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ConfigureWindow, Tk_MoveWindow, Tk_ResizeWindow, Tk_MoveResizeWindow, Tk_SetWindowBorderWidth, Tk_ChangeWindowAttributes, Tk_SetWindowBackground, Tk_SetWindowBackgroundPixmap, Tk_SetWindowBorder, Tk_SetWindowBorderPixmap, Tk_SetWindowColormap, Tk_DefineCursor, Tk_UndefineCursor \- change window configuration or attributes .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CoordToWin.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. '\" .TH Tk_CoordsToWindow 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CoordsToWindow \- Find window containing a point .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CrtCmHdlr.3.
1 2 3 4 5 | '\" '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_CreateClientMessageHandler 3 "8.4" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateClientMessageHandler, Tk_DeleteClientMessageHandler \- associate procedure callback with ClientMessage type X events .SH SYNOPSIS .nf |
︙ | ︙ | |||
27 28 29 30 31 32 33 | \fBWM_PROTOCOL\fR. \fBTk_CreateClientMessageHandler\fR is intended for use by applications which need to watch X ClientMessage events, such as drag and drop applications. .PP The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | \fBWM_PROTOCOL\fR. \fBTk_CreateClientMessageHandler\fR is intended for use by applications which need to watch X ClientMessage events, such as drag and drop applications. .PP The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_ClientMessageProc\fR: .CS typedef int \fBTk_ClientMessageProc\fR( Tk_Window \fItkwin\fR, |
︙ | ︙ |
Changes to doc/CrtConsoleChan.3.
1 2 3 4 5 | '\" '\" Copyright (c) 2007 ActiveState Software Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2007 ActiveState Software Inc. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_InitConsoleChannels 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_InitConsoleChannels \- Install the console channels as standard channels .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CrtErrHdlr.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateErrorHandler 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateErrorHandler, Tk_DeleteErrorHandler \- handle X protocol errors .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CrtGenHdlr.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateGenericHandler 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateGenericHandler, Tk_DeleteGenericHandler \- associate procedure callback with all X events .SH SYNOPSIS .nf |
︙ | ︙ | |||
34 35 36 37 38 39 40 | as tracing X events, monitoring events on windows not owned by Tk, accessing X-related libraries that were not originally designed for use with Tk, and so on. .PP The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | as tracing X events, monitoring events on windows not owned by Tk, accessing X-related libraries that were not originally designed for use with Tk, and so on. .PP The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_GenericProc\fR: .CS typedef int \fBTk_GenericProc\fR( ClientData \fIclientData\fR, |
︙ | ︙ |
Changes to doc/CrtImgType.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateImageType 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateImageType, Tk_GetImageMasterData, Tk_InitImageArgs \- define new kind of image .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/CrtItemType.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_CreateItemType 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateItemType, Tk_GetItemTypes \- define new kind of canvas item .SH SYNOPSIS .nf |
︙ | ︙ | |||
60 61 62 63 64 65 66 | The first data structure is a Tk_ItemType; it contains information such as the name of the type and pointers to the standard procedures implemented by the type manager: .PP .CS typedef struct Tk_ItemType { const char *\fIname\fR; | | > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | The first data structure is a Tk_ItemType; it contains information such as the name of the type and pointers to the standard procedures implemented by the type manager: .PP .CS typedef struct Tk_ItemType { const char *\fIname\fR; size_t \fIitemSize\fR; Tk_ItemCreateProc *\fIcreateProc\fR; const Tk_ConfigSpec *\fIconfigSpecs\fR; Tk_ItemConfigureProc *\fIconfigProc\fR; Tk_ItemCoordProc *\fIcoordProc\fR; Tk_ItemDeleteProc *\fIdeleteProc\fR; Tk_ItemDisplayProc *\fIdisplayProc\fR; int \fIalwaysRedraw\fR; Tk_ItemPointProc *\fIpointProc\fR; Tk_ItemAreaProc *\fIareaProc\fR; Tk_ItemPostscriptProc *\fIpostscriptProc\fR; Tk_ItemScaleProc *\fIscaleProc\fR; Tk_ItemTranslateProc *\fItranslateProc\fR; Tk_ItemIndexProc *\fIindexProc\fR; Tk_ItemCursorProc *\fIicursorProc\fR; Tk_ItemSelectionProc *\fIselectionProc\fR; Tk_ItemInsertProc *\fIinsertProc\fR; Tk_ItemDCharsProc *\fIdCharsProc\fR; Tk_ItemType *\fInextPtr\fR; .VS "8.7, TIP164" Tk_ItemRotateProc *\fIrotateProc\fR; .VE "8.7, TIP164" } \fBTk_ItemType\fR; .CE .PP The fields of a Tk_ItemType structure are described in more detail later in this manual entry. When \fBTk_CreateItemType\fR is called, its \fItypePtr\fR argument must point to a structure with all of the fields initialized |
︙ | ︙ | |||
545 546 547 548 549 550 551 552 553 554 555 556 557 558 | .CE .PP The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning, and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be added to each x and y coordinate within the item. The type manager should adjust the item's coordinates and update the bounding box in the item's header. .SS INDEXPROC .PP \fItypePtr\->indexProc\fR is invoked by Tk to translate a string index specification into a numerical index, for example during the \fBindex\fR widget command. It is only relevant for item types that support indexable text or coordinates; \fItypePtr\->indexProc\fR may be specified as NULL for non-textual | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | .CE .PP The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning, and \fIdeltaX\fR and \fIdeltaY\fR give the amounts that should be added to each x and y coordinate within the item. The type manager should adjust the item's coordinates and update the bounding box in the item's header. .SS ROTATEPROC .VS "8.7, TIP164" .PP \fItypePtr\->rotateProc\fR is invoked by Tk to rotate a canvas item during the \fBrotate\fR widget command. The procedure must match the following prototype: .PP .CS typedef void \fBTk_ItemRotateProc\fR( Tk_Canvas \fIcanvas\fR, Tk_Item *\fIitemPtr\fR, double \fIoriginX\fR, double \fIoriginY\fR, double \fIangleRad\fR); .CE .PP The \fIcanvas\fR and \fIitemPtr\fR arguments have the usual meaning. \fIoriginX\fR and \fIoriginY\fR specify an origin relative to which the item is to be rotated, and \fIangleRad\fR gives the anticlockwise rotation to be applied in radians. The item should adjust the coordinates of its control points so that where they used to have coordinates \fIx\fR and \fIy\fR, they will have new coordinates \fIx\(fm\fR and \fIy\(fm\fR, where .PP .CS \fIrelX\fR = \fIx\fR - \fIoriginX\fR \fIrelY\fR = \fIy\fR - \fIoriginY\fR \fIx\(fm\fR = \fIoriginX\fR + \fIrelX\fR \(mu cos(\fIangleRad\fR) + \fIrelY\fR \(mu sin(\fIangleRad\fR) \fIy\(fm\fR = \fIoriginY\fR \(mi \fIrelX\fR \(mu sin(\fIangleRad\fR) + \fIrelY\fR \(mu cos(\fIangleRad\fR) .CE .PP The control points for an item are not necessarily the coordinates provided to the item when it is created (or via the \fItypePtr\->coordProc\fR), but could instead be derived from them. \fIrotateProc\fR must also update the bounding box in the item's header. .PP Item types do not need to provide a \fItypePtr\->rotateProc\fR. If the \fItypePtr\->rotateProc\fR is NULL, the \fItypePtr\->coordProc\fR will be used instead to retrieve and update the list of coordinates. .VE "8.7, TIP164" .SS INDEXPROC .PP \fItypePtr\->indexProc\fR is invoked by Tk to translate a string index specification into a numerical index, for example during the \fBindex\fR widget command. It is only relevant for item types that support indexable text or coordinates; \fItypePtr\->indexProc\fR may be specified as NULL for non-textual |
︙ | ︙ |
Changes to doc/CrtPhImgFmt.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Australian National University '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Australian National University '\" 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. '\" '\" Author: Paul Mackerras ([email protected]), '\" Department of Computer Science, '\" Australian National University. '\" .TH Tk_CreatePhotoImageFormat 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS |
︙ | ︙ |
Changes to doc/DeleteImg.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_DeleteImage 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_DeleteImage \- Destroy an image. .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/DrawFocHlt.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_DrawFocusHighlight 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_DrawFocusHighlight \- draw the traversal highlight ring for a widget .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/EventHndlr.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_CreateEventHandler 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateEventHandler, Tk_DeleteEventHandler \- associate procedure callback with an X event .SH SYNOPSIS .nf |
︙ | ︙ | |||
34 35 36 37 38 39 40 | .PP \fBTk_CreateEventHandler\fR arranges for \fIproc\fR to be invoked in the future whenever one of the event types specified by \fImask\fR occurs in the window specified by \fItkwin\fR. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | .PP \fBTk_CreateEventHandler\fR arranges for \fIproc\fR to be invoked in the future whenever one of the event types specified by \fImask\fR occurs in the window specified by \fItkwin\fR. The callback to \fIproc\fR will be made by \fBTk_HandleEvent\fR; this mechanism only works in programs that dispatch events through \fBTk_HandleEvent\fR (or through other Tk procedures that call \fBTk_HandleEvent\fR, such as \fBTcl_DoOneEvent\fR or \fBTk_MainLoop\fR). .PP \fIProc\fR should have arguments and result that match the type \fBTk_EventProc\fR: .CS typedef void \fBTk_EventProc\fR( ClientData \fIclientData\fR, |
︙ | ︙ |
Changes to doc/FreeXId.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_FreeXId 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_FreeXId \- make X resource identifier available for reuse .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_FreeXId(\fIdisplay, id\fB)\fR .SH ARGUMENTS .AS Display *display out .AP Display *display in Display for which \fIid\fR was allocated. .AP XID id in Identifier of X resource (window, font, pixmap, cursor, graphics context, or colormap) that is no longer in use. .BE .SH DESCRIPTION .PP This function is deprecated, it doesn't do anything since 2008-08-19. .SH KEYWORDS resource identifier |
Changes to doc/GeomReq.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GeometryRequest 3 "8.4" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder, Tk_SetInternalBorderEx \- specify desired geometry or internal border for a window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetAnchor.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 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. '\" .TH Tk_GetAnchorFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetAnchorFromObj, Tk_GetAnchor, Tk_NameOfAnchor \- translate between strings and anchor positions .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetBitmap.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 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. '\" .TH Tk_AllocBitmapFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_AllocBitmapFromObj, Tk_GetBitmap, Tk_GetBitmapFromObj, Tk_DefineBitmap, Tk_NameOfBitmap, Tk_SizeOfBitmap, Tk_FreeBitmapFromObj, Tk_FreeBitmap \- maintain database of single-plane pixmaps .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetCapStyl.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetCapStyle 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetCapStyle, Tk_NameOfCapStyle \- translate between strings and cap styles .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetClrmap.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GetColormap 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetColormap, Tk_PreserveColormap, Tk_FreeColormap \- allocate and free colormaps .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetDash.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1989-1993 The Regents of the University of California. '\" 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. '\" .TH Tk_GetDash 3 8.3 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetDash \- convert from string to valid dash structure. .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetGC.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetGC 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetGC, Tk_FreeGC \- maintain database of read-only graphics contexts .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetHINSTANCE.3.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_GetHISTANCE 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetHINSTANCE \- retrieve the global application instance handle .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetHWND.3.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" .TH HWND 3 8.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetHWND, Tk_AttachHWND \- manage interactions between the Windows handle and an X window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetImage.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GetImage 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage \- use an image in a widget .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetJoinStl.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetJoinStyle 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetJoinStyle, Tk_NameOfJoinStyle \- translate between strings and join styles .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetJustify.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 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. '\" .TH Tk_GetJustifyFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetJustifyFromObj, Tk_GetJustify, Tk_NameOfJustify \- translate between strings and justification styles .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetOption.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetOption 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetOption \- retrieve an option from the option database .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetPixels.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 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. '\" .TH Tk_GetPixelsFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetPixelsFromObj, Tk_GetPixels, Tk_GetMMFromObj, Tk_GetScreenMM \- translate between strings and screen units .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetPixmap.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetPixmap 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetPixmap, Tk_FreePixmap \- allocate and free pixmaps .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetRelief.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 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. '\" .TH Tk_GetReliefFromObj 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief \- translate between strings and relief values .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetRootCrd.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetRootCoords 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetRootCoords \- Compute root-window coordinates of window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetScroll.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GetScrollInfo 3 8.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetScrollInfoObj, Tk_GetScrollInfo \- parse arguments for scrolling commands .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp int \fBTk_GetScrollInfoObj(\fIinterp, objc, objv, fractionPtr, stepsPtr\fB)\fR .sp int \fBTk_GetScrollInfo(\fIinterp, argc, argv, fractionPtr, stepsPtr\fB)\fR .SH ARGUMENTS .AS "Tcl_Interp" *fractionPtr .AP Tcl_Interp *interp in Interpreter to use for error reporting. .AP int objc in Number of Tcl_Obj's in \fIobjv\fR array. .AP "Tcl_Obj *const" objv[] in |
︙ | ︙ | |||
46 47 48 49 50 51 52 | \fBTk_GetScrollInfoObj\fR parses the arguments expected by widget scrolling commands such as \fBxview\fR and \fByview\fR. It receives the entire list of words that make up a widget command and parses the words starting with \fIobjv\fR[2]. The words starting with \fIobjv\fR[2] must have one of the following forms: .CS \fBmoveto \fIfraction\fR | | | | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | \fBTk_GetScrollInfoObj\fR parses the arguments expected by widget scrolling commands such as \fBxview\fR and \fByview\fR. It receives the entire list of words that make up a widget command and parses the words starting with \fIobjv\fR[2]. The words starting with \fIobjv\fR[2] must have one of the following forms: .CS \fBmoveto \fIfraction\fR \fBscroll \fInumber\fB pages\fR \fBscroll \fInumber\fB units\fR .CE .LP Any of the \fBmoveto\fR, \fBscroll\fR, \fBpages\fR, and \fBunits\fR keywords may be abbreviated. If \fIobjv\fR has the \fBmoveto\fR form, \fBTK_SCROLL_MOVETO\fR is returned as result and \fI*fractionPtr\fR is filled in with the \fIfraction\fR argument to the command, which must be a proper real value. If \fIobjv\fR has the \fBscroll\fR form, \fBTK_SCROLL_PAGES\fR or \fBTK_SCROLL_UNITS\fR is returned and \fI*stepsPtr\fR is filled in with the \fInumber\fR value, which must be a proper integer. If an error occurs in parsing the arguments, \fBTK_SCROLL_ERROR\fR is returned and an error message is left in interpreter \fIinterp\fR's result. .PP \fBTk_GetScrollInfo\fR is identical in function to \fBTk_GetScrollInfoObj\fR. However, \fBTk_GetScrollInfo\fR accepts string arguments, making it more appropriate for use with legacy widgets. .SH KEYWORDS parse, scrollbar, scrolling command, xview, yview |
Changes to doc/GetSelect.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GetSelection 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetSelection \- retrieve the contents of a selection .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetUid.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetUid 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetUid, Tk_Uid \- convert from string to unique identifier .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetVRoot.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_GetVRootGeometry 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetVRootGeometry \- Get location and size of virtual root for window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/GetVisual.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_GetVisual 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetVisual \- translate from string to visual .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/Grab.3.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_Grab 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_Grab, Tk_Ungrab \- manipulate grab state in an application .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/HWNDToWindow.3.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_HWNDToWindow 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_HWNDToWindow \- Find Tk's window information for a Windows window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/HandleEvent.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. '\" .TH Tk_HandleEvent 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_HandleEvent \- invoke event handlers for window system events .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp \fBTk_HandleEvent\fR(\fIeventPtr\fR) .SH ARGUMENTS .AS XEvent *eventPtr .AP XEvent *eventPtr in Pointer to X event to dispatch to relevant handler(s). It is important that all unused fields of the structure be set to zero. .BE .SH DESCRIPTION .PP \fBTk_HandleEvent\fR is a lower-level procedure that deals with window events. It is called by \fBTcl_ServiceEvent\fR (and indirectly by \fBTcl_DoOneEvent\fR), and in a few other cases within Tk. It makes callbacks to any window event handlers (created by calls to \fBTk_CreateEventHandler\fR) that match \fIeventPtr\fR and then returns. In some cases it may be useful for an application to bypass the Tk event queue and call \fBTk_HandleEvent\fR directly instead of calling \fBTcl_QueueEvent\fR followed by \fBTcl_ServiceEvent\fR. |
︙ | ︙ |
Changes to doc/IdToWindow.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_IdToWindow 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_IdToWindow \- Find Tk's window information for an X window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ImgChanged.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_ImageChanged 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ImageChanged \- notify widgets that image needs to be redrawn .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/Inactive.3.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | 1 2 3 4 5 6 7 8 9 10 11 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" .TH Tk_GetUserInactiveTime 3 8.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_GetUserInactiveTime, Tk_ResetUserInactiveTime \- discover user inactivity time .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/InternAtom.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_InternAtom 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_InternAtom, Tk_GetAtomName \- manage cache of X atoms .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/MainLoop.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. '\" .TH Tk_MainLoop 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_MainLoop \- loop for events until all windows are deleted .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/MainWin.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_MainWindow 3 7.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_MainWindow, Tk_GetNumMainWindows \- functions for querying main window information .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/MaintGeom.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_MaintainGeometry 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_MaintainGeometry, Tk_UnmaintainGeometry \- maintain geometry of one window relative to another .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ManageGeom.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_ManageGeometry 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ManageGeometry \- arrange to handle geometry requests for a window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/MoveToplev.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1993 The Regents of the University of California. '\" 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. '\" .TH Tk_MoveToplevelWindow 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_MoveToplevelWindow \- Adjust the position of a top-level window .SH SYNOPSIS .nf |
︙ | ︙ | |||
42 43 44 45 46 47 48 | similar in function to the \fBwm geometry\fR Tcl command except that negative offsets cannot be specified. It is invoked by widgets such as menus that want to appear at a particular place on the screen. .PP When \fBTk_MoveToplevelWindow\fR is called it does not immediately pass on the new desired location to the window manager; it defers this action until all other outstanding work has been completed, | | | 42 43 44 45 46 47 48 49 50 51 | similar in function to the \fBwm geometry\fR Tcl command except that negative offsets cannot be specified. It is invoked by widgets such as menus that want to appear at a particular place on the screen. .PP When \fBTk_MoveToplevelWindow\fR is called it does not immediately pass on the new desired location to the window manager; it defers this action until all other outstanding work has been completed, using the \fBTcl_DoWhenIdle\fR mechanism. .SH KEYWORDS position, top-level window, window manager |
Changes to doc/Name.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_Name 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_Name, Tk_PathName, Tk_NameToWindow \- convert between names and window tokens .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/NameOfImg.3.
1 2 3 4 5 | '\" '\" 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. | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | '\" '\" 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. '\" .TH Tk_NameOfImage 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_NameOfImage \- Return name of image. .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp const char * \fBTk_NameOfImage\fR(\fIimageMaster\fR) .SH ARGUMENTS .AS Tk_ImageMaster imageMaster .AP Tk_ImageMaster imageMaster in Token for image, which was passed to image manager's \fIcreateProc\fR when the image was created. .BE .SH DESCRIPTION .PP This procedure is invoked by image managers to find out the name of an image. Given the token for the image, it returns the |
︙ | ︙ |
Changes to doc/OwnSelect.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_OwnSelection 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_OwnSelection \- make a window the owner of the primary selection .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ParseArgv.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1992 The Regents of the University of California. '\" 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. '\" .TH Tk_ParseArgv 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_ParseArgv \- process command-line options .SH SYNOPSIS .nf |
︙ | ︙ | |||
68 69 70 71 72 73 74 | .PP The \fIargTable\fR array specifies the kinds of arguments that are expected; each of its entries has the following structure: .CS typedef struct { const char *\fIkey\fR; int \fItype\fR; | | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | .PP The \fIargTable\fR array specifies the kinds of arguments that are expected; each of its entries has the following structure: .CS typedef struct { const char *\fIkey\fR; int \fItype\fR; void *\fIsrc\fR; void *\fIdst\fR; const char *\fIhelp\fR; } \fBTk_ArgvInfo\fR; .CE The \fIkey\fR field is a string such as .QW \-display or .QW \-bg |
︙ | ︙ | |||
308 309 310 311 312 313 314 | char *fileName = defaultFileName; Boolean exec = FALSE; /* * Define option descriptions. */ Tk_ArgvInfo argTable[] = { | | | | | | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | char *fileName = defaultFileName; Boolean exec = FALSE; /* * Define option descriptions. */ Tk_ArgvInfo argTable[] = { {"\-X", TK_ARGV_CONSTANT, (char *) 1, &debugFlag, "Turn on debugging printfs"}, {"\-N", TK_ARGV_INT, NULL, &numReps, "Number of repetitions"}, {"\-of", TK_ARGV_STRING, NULL, &fileName, "Name of file for output"}, {"x", TK_ARGV_REST, NULL, &exec, "File to exec, followed by any arguments (must be last argument)."}, {NULL, TK_ARGV_END, NULL, NULL, NULL} }; main(argc, argv) int argc; |
︙ | ︙ |
Changes to doc/QWinEvent.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_QueueWindowEvent 3 7.5 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CollapseMotionEvents, Tk_QueueWindowEvent \- Add a window event to the Tcl event queue .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/Restack.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_RestackWindow 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_RestackWindow \- Change a window's position in the stacking order .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/RestrictEv.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_RestrictEvents 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_RestrictEvents \- filter and selectively delay X events .SH SYNOPSIS .nf |
︙ | ︙ | |||
26 27 28 29 30 31 32 | .AP ClientData *prevArgPtr out Pointer to place to save argument to previous restrict procedure. .BE .SH DESCRIPTION .PP This procedure is useful in certain situations where applications are only prepared to receive certain X events. After | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | .AP ClientData *prevArgPtr out Pointer to place to save argument to previous restrict procedure. .BE .SH DESCRIPTION .PP This procedure is useful in certain situations where applications are only prepared to receive certain X events. After \fBTk_RestrictEvents\fR is called, \fBTcl_DoOneEvent\fR (and hence \fBTk_MainLoop\fR) will filter X input events through \fIproc\fR. \fIProc\fR indicates whether a given event is to be processed immediately, deferred until some later time (e.g. when the event restriction is lifted), or discarded. \fIProc\fR is a procedure with arguments and result that match the type \fBTk_RestrictProc\fR: .CS typedef Tk_RestrictAction \fBTk_RestrictProc\fR( ClientData \fIarg\fR, XEvent *\fIeventPtr\fR); .CE The \fIarg\fR argument is a copy of the \fIarg\fR passed to \fBTk_RestrictEvents\fR; it may be used to provide \fIproc\fR with information it needs to filter events. The \fIeventPtr\fR points to an event under consideration. \fIProc\fR returns a restrict action (enumerated type \fBTk_RestrictAction\fR) that indicates what \fBTcl_DoOneEvent\fR should do with the event. If the return value is \fBTK_PROCESS_EVENT\fR, then the event will be handled immediately. If the return value is \fBTK_DEFER_EVENT\fR, then the event will be left on the event queue for later processing. If the return value is \fBTK_DISCARD_EVENT\fR, then the event will be removed from the event queue and discarded without being processed. .PP \fBTk_RestrictEvents\fR uses its return value and \fIprevArgPtr\fR |
︙ | ︙ | |||
70 71 72 73 74 75 76 | for a particular event to occur on a particular window but you do not want to invoke any handlers for any other events). The .QW obvious solution in these situations is to call \fBXNextEvent\fR or \fBXWindowEvent\fR, but these procedures cannot be used because Tk keeps its own event queue that is separate from the X event queue. Instead, call \fBTk_RestrictEvents\fR to set up a filter, | | | 70 71 72 73 74 75 76 77 78 79 | for a particular event to occur on a particular window but you do not want to invoke any handlers for any other events). The .QW obvious solution in these situations is to call \fBXNextEvent\fR or \fBXWindowEvent\fR, but these procedures cannot be used because Tk keeps its own event queue that is separate from the X event queue. Instead, call \fBTk_RestrictEvents\fR to set up a filter, then call \fBTcl_DoOneEvent\fR to retrieve the desired event(s). .SH KEYWORDS delay, event, filter, restriction |
Changes to doc/SetAppName.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH Tk_SetAppName 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetAppName \- Set the name of an application for 'send' commands .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/SetCaret.3.
1 2 3 4 5 | '\" '\" Copyright (c) 2002 ActiveState Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2002 ActiveState Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_SetCaretPos 3 8.4 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetCaretPos \- set the display caret location .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/SetClass.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH Tk_SetClass 3 "" Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetClass, Tk_Class \- set or retrieve a window's class .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/SetClassProcs.3.
1 2 3 4 5 | '\" '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_SetClassProcs 3 8.4 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetClassProcs \- register widget specific procedures .SH SYNOPSIS .nf |
︙ | ︙ | |||
29 30 31 32 33 34 35 | .PP \fBTk_SetClassProcs\fR is called to register a set of procedures that are used as callbacks in different places. .PP The structure pointed to by \fIprocs\fR contains the following: .CS typedef struct Tk_ClassProcs { | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | .PP \fBTk_SetClassProcs\fR is called to register a set of procedures that are used as callbacks in different places. .PP The structure pointed to by \fIprocs\fR contains the following: .CS typedef struct Tk_ClassProcs { size_t \fIsize\fR; Tk_ClassWorldChangedProc *\fIworldChangedProc\fR; Tk_ClassCreateProc *\fIcreateProc\fR; Tk_ClassModalProc *\fImodalProc\fR; } \fBTk_ClassProcs\fR; .CE The \fIsize\fR field is used to simplify future expansion of the structure. It should always be set to (literally) \fBsizeof(Tk_ClassProcs)\fR. |
︙ | ︙ |
Changes to doc/SetGrid.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH Tk_SetGrid 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetGrid, Tk_UnsetGrid \- control the grid for interactive resizing .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/SetOptions.3.
1 2 3 4 5 | '\" '\" 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. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | '\" '\" 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. '\" .TH Tk_SetOptions 3 8.1 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_CreateOptionTable, Tk_DeleteOptionTable, Tk_InitOptions, Tk_SetOptions, Tk_FreeSavedOptions, Tk_RestoreSavedOptions, Tk_GetOptionValue, Tk_GetOptionInfo, Tk_FreeConfigOptions \- process configuration options .SH SYNOPSIS .nf \fB#include <tk.h>\fR .sp Tk_OptionTable \fBTk_CreateOptionTable(\fIinterp, templatePtr\fB)\fR .sp |
︙ | ︙ | |||
31 32 33 34 35 36 37 | 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 | < < < | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 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 .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 "const 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 void *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 \fBTK_OPTION_COLOR\fR, 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 |
︙ | ︙ | |||
235 236 237 238 239 240 241 | (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. | < < < < < < | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | (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. .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; const char *\fIoptionName\fR; const char *\fIdbName\fR; const char *\fIdbClass\fR; const char *\fIdefValue\fR; size_t \fIobjOffset\fR; size_t \fIinternalOffset\fR; int \fIflags\fR; const void *\fIclientData\fR; int \fItypeMask\fR; } \fBTk_OptionSpec\fR; .CE The \fItype\fR field indicates what kind of configuration option this is (e.g. \fBTK_OPTION_COLOR\fR for a color value, or \fBTK_OPTION_INT\fR for |
︙ | ︙ | |||
277 278 279 280 281 282 283 | \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 | | | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 | \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 \fBoffsetof\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 \fBTK_OPTION_COLOR\fR types, \fIclientData\fR is a string giving the default value to use on monochrome displays. See the descriptions of the different types |
︙ | ︙ |
Changes to doc/SetVisual.3.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH Tk_SetWindowVisual 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_SetWindowVisual \- change visual characteristics of window .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/StrictMotif.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_StrictMotif 3 4.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_StrictMotif \- Return value of tk_strictMotif variable .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/TkInitStubs.3.
1 2 3 4 5 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 1999 Scriptics Corporation '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Tk_InitStubs 3 8.4 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_InitStubs \- initialize the Tk stubs mechanism .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/Tk_Init.3.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH Tk_Init 3 8.0 Tk "Tk Library Procedures" .so man.macros .BS .SH NAME Tk_Init, Tk_SafeInit \- add Tk to an interpreter and make a new Tk application. .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/bell.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH bell n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bell \- Ring a display's bell .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/bind.n.
1 2 3 4 5 6 7 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | '\" '\" 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. '\" .TH bind n 8.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bind \- Arrange for X events to invoke Tcl scripts .SH SYNOPSIS |
︙ | ︙ | |||
348 349 350 351 352 353 354 | there is no reliable way to track changes to a window's position in the stacking order. .RE .SS "EVENT DETAILS" .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 | | | 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | there is no reliable way to track changes to a window's position in the stacking order. .RE .SS "EVENT DETAILS" .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\-9). If a button number is given, then only an event on that particular button will match; if no button number is given, then an event on any button will match. Note: giving a specific button number is different than specifying a button modifier; in the first case, it refers to a button being pressed or released, while in the second it refers to some other button that is already depressed when the matching event occurs. If a button number is given then \fItype\fR may be omitted: if will default |
︙ | ︙ | |||
562 563 564 565 566 567 568 | The path name of the window to which the event was reported (the \fIwindow\fR field from the event). Valid for all event types. .IP "\fB%X\fR, \fB%Y\fR" 5 The \fIx_root\fR and \fIy_root\fR fields from the event. If a virtual-root window manager is being used then the substituted values are the corresponding x-coordinate and y-coordinate in the virtual root. Valid only for | | | | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | The path name of the window to which the event was reported (the \fIwindow\fR field from the event). Valid for all event types. .IP "\fB%X\fR, \fB%Y\fR" 5 The \fIx_root\fR and \fIy_root\fR fields from the event. If a virtual-root window manager is being used then the substituted values are the corresponding x-coordinate and y-coordinate in the virtual root. Valid only for \fBButtonPress\fR, \fBButtonRelease\fR, \fBEnter\fR, \fBKeyPress\fR, \fBKeyRelease\fR, \fBLeave\fR and \fBMotion\fR events. Same meaning as \fB%x\fR and \fB%y\fR, except relative to the (virtual) root window. .LP The replacement string for a %-replacement is formatted as a proper Tcl list element. This means that spaces or special characters such as \fB$\fR and \fB{\fR may be preceded by backslashes. |
︙ | ︙ | |||
629 630 631 632 633 634 635 | The following tests are applied, in order, to determine which of several matching sequences is more specific: .RS .IP (a) an event pattern that specifies a specific button or key is more specific than one that does not; .IP (b) | | | > | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | The following tests are applied, in order, to determine which of several matching sequences is more specific: .RS .IP (a) an event pattern that specifies a specific button or key is more specific than one that does not; .IP (b) a sequence with the most highest-ordered patterns (in term of highest repetition count) is more specific than a sequence with less highest-ordered patterns; .IP (c) if the modifiers specified in one pattern are a subset of the modifiers in another pattern, then the pattern with more modifiers is more specific; .IP (d) a virtual event whose physical pattern matches the sequence is less specific than the same physical pattern that is not associated with a |
︙ | ︙ |
Changes to doc/bindtags.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH bindtags n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bindtags \- Determine which bindings apply to a window, and order of evaluation .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/bitmap.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH bitmap n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME bitmap \- Images that display two colors .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/busy.n.
︙ | ︙ | |||
24 25 26 27 28 29 30 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME | | > > | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH busy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME busy \- Make Tk widgets busy, temporarily blocking user interactions .SH SYNOPSIS \fBtk busy\fR \fIwindow \fR?\fIoptions\fR? .sp \fBtk busy busywindow \fIwindow\fR .sp \fBtk busy hold\fR \fIwindow \fR?\fIoptions\fR? .sp \fBtk busy configure \fIwindow\fR ?\fIoption value\fR?... .sp \fBtk busy forget\fR \fIwindow \fR?\fIwindow \fR?... .sp \fBtk busy current\fR ?\fIpattern\fR? .sp \fBtk busy status \fIwindow\fR .BE .SH DESCRIPTION .PP The \fBtk busy\fR command provides a simple means to block mouse pointer events from Tk widgets, while overriding the widget's cursor with a configurable busy cursor. Note this command does not prevent keyboard events from being sent to the widgets made busy. .SH INTRODUCTION .PP There are many times in applications where you want to temporarily restrict what actions the user can take. For example, an application could have a .QW Run |
︙ | ︙ | |||
124 125 126 127 128 129 130 | .PP The following operations are available for the \fBtk busy\fR command: .TP \fBtk busy \fIwindow\fR ?\fIoption value\fR?... . Shortcut for \fBtk busy hold\fR command. .TP | | < < | < | < < < < < | < < < < < | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | .PP The following operations are available for the \fBtk busy\fR command: .TP \fBtk busy \fIwindow\fR ?\fIoption value\fR?... . Shortcut for \fBtk busy hold\fR command. .TP \fBtk busy busywindow \fIwindow\fR . Returns the pathname of the busy window (i.e. the transparent window shielding the window appearing busy) created by the \fBtk busy hold\fR command for \fIwindow\fR, or the empty string if \fIwindow\fR is not busy. .TP \fBtk busy cget \fIwindow\fR \fIoption\fR . Queries the \fBtk busy\fR command configuration options for \fIwindow\fR. \fIWindow\fR must be the path name of a widget previously made busy by the \fBhold\fR operation. The command returns the present value of the specified \fIoption\fR. \fIOption\fR may have any of the values accepted by the |
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | specified for it by either \fBoption\fR command: .PP .CS option add *frame.busyCursor gumby option add *Frame.BusyCursor gumby .CE .RE .TP \fBtk busy forget \fIwindow\fR ?\fIwindow\fR?... . Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR, including the transparent window. User events will again be received by \fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed. \fIWindow\fR must be the name of a widget specified in the \fBhold\fR operation, otherwise an error is reported. .TP | > > > > > > | | | > > > > > | > > > > > > > > > > | | | < | < < < < < < < < < < < < < | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | specified for it by either \fBoption\fR command: .PP .CS option add *frame.busyCursor gumby option add *Frame.BusyCursor gumby .CE .RE .TP \fBtk busy current \fR?\fIpattern\fR? . Returns the pathnames of all widgets that are currently busy. If a \fIpattern\fR is given, only the path names of busy widgets matching \fIpattern\fR are returned. .TP \fBtk busy forget \fIwindow\fR ?\fIwindow\fR?... . Releases resources allocated by the \fBtk busy\fR command for \fIwindow\fR, including the transparent window. User events will again be received by \fIwindow\fR. Resources are also released when \fIwindow\fR is destroyed. \fIWindow\fR must be the name of a widget specified in the \fBhold\fR operation, otherwise an error is reported. .TP \fBtk busy hold \fIwindow\fR ?\fIoption value\fR?... . Makes the specified \fIwindow\fR (and its descendants in the Tk window hierarchy) appear busy. \fIWindow\fR must be a valid path name of a Tk widget. A transparent window is put in front of the specified window. This transparent window is mapped the next time idle tasks are processed, and the specified window and its descendants will be blocked from user interactions. Normally \fBupdate\fR should be called immediately afterward to insure that the hold operation is in effect before the application starts its processing. The command returns the pathname of the busy window that was created (i.e. the transparent window shielding the window appearing busy). The following configuration options are valid: .RS .TP \fB\-cursor \fIcursorName\fR . Specifies the cursor to be displayed when the widget is made busy. \fICursorName\fR can be in any form accepted by \fBTk_GetCursor\fR. The default cursor is \fBwait\fR on Windows and \fBwatch\fR on other platforms. .RE .TP \fBtk busy status \fIwindow\fR . Returns the status of a widget \fIwindow\fR. If \fIwindow\fR presently can not receive user interactions, \fB1\fR is returned, otherwise \fB0\fR. .SH "EVENT HANDLING" .SS BINDINGS .PP The event blocking feature is implemented by creating and mapping a transparent window that completely covers the widget. When the busy window is mapped, it invisibly shields the widget and its hierarchy from all events that may be sent. Like Tk widgets, busy windows have widget names in the Tk window hierarchy. This means that you can use the \fBbind\fR command to handle events in the busy window: .PP .CS \fBtk busy\fR hold .frame.canvas bind [\fBtk busy\fR busywindow .frame.canvas] <Enter> { ... } .CE .PP or .CS set busyWin [\fBtk busy\fR hold .frame.canvas] bind $busyWin <Enter> { ... } .CE .SS "ENTER/LEAVE EVENTS" .PP Mapping and unmapping busy windows generates Enter/Leave events for all widgets they cover. Please note this if you are tracking Enter/Leave events in widgets. .SS "KEYBOARD EVENTS" |
︙ | ︙ |
Changes to doc/canvas.n.
︙ | ︙ | |||
216 217 218 219 220 221 222 | It is possible to adjust the origin of the canvas coordinate system relative to the origin of the window using the \fBxview\fR and \fByview\fR widget commands; this is typically used for scrolling. Canvases do not support scaling or rotation of the canvas coordinate system relative to the window coordinate system. .PP | | > > > > | | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | It is possible to adjust the origin of the canvas coordinate system relative to the origin of the window using the \fBxview\fR and \fByview\fR widget commands; this is typically used for scrolling. Canvases do not support scaling or rotation of the canvas coordinate system relative to the window coordinate system. .PP Individual items may be moved, scaled .VS "8.7, TIP164" or rotated .VE "8.7, TIP164" using widget commands described below. .PP Note that the default origin of the canvas's visible area is coincident with the origin for the whole window as that makes bindings using the mouse position easier to work with; you only need to use the \fBcanvasx\fR and \fBcanvasy\fR widget commands if you adjust the origin of the visible area. However, this also means that any focus ring (as controlled by the \fB\-highlightthickness\fR option) and |
︙ | ︙ | |||
309 310 311 312 313 314 315 316 317 318 319 320 321 322 | .PP The second possible syntax is a character list containing only 5 possible characters .QW "\fB.,-_ \fR" . The space can be used to enlarge the space between other line elements, and cannot occur as the first position in the string. Some examples: .CS \-dash . \(-> \-dash {2 4} \-dash - \(-> \-dash {6 4} \-dash -. \(-> \-dash {6 4 2 4} \-dash -.. \(-> \-dash {6 4 2 4 2 4} \-dash {. } \(-> \-dash {2 8} \-dash , \(-> \-dash {4 4} | > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | .PP The second possible syntax is a character list containing only 5 possible characters .QW "\fB.,-_ \fR" . The space can be used to enlarge the space between other line elements, and cannot occur as the first position in the string. Some examples: .PP .CS \-dash . \(-> \-dash {2 4} \-dash - \(-> \-dash {6 4} \-dash -. \(-> \-dash {6 4 2 4} \-dash -.. \(-> \-dash {6 4 2 4 2 4} \-dash {. } \(-> \-dash {2 8} \-dash , \(-> \-dash {4 4} |
︙ | ︙ | |||
653 654 655 656 657 658 659 660 661 | See \fBINDICES\fR above for a description of the legal forms for \fIindex\fR. Note: the insertion cursor is only displayed in an item if that item currently has the keyboard focus (see the \fBfocus\fR widget command, above), but the cursor position may be set even when the item does not have the focus. This command returns an empty string. .TP \fIpathName \fBimove \fItagOrId index x y\fR | > > > > > > > > > > > > > > < > < | 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | See \fBINDICES\fR above for a description of the legal forms for \fIindex\fR. Note: the insertion cursor is only displayed in an item if that item currently has the keyboard focus (see the \fBfocus\fR widget command, above), but the cursor position may be set even when the item does not have the focus. This command returns an empty string. .TP \fIpathName \fBimage \fIimagename\fR ?\fIsubsample\fR? ?\fIzoom\fR? . Draw the canvas into the Tk photo image named \fIimagename\fR. If a \fB-scrollregion\fR has been defined then this will be the boundaries of the canvas region drawn and the final size of the photo image. Otherwise the widget width and height with an origin of 0,0 will be the size of the canvas region drawn and the final size of the photo image. Optionally an integer \fIsubsample\fR factor may be given and the photo image will be reduced in size. In addition to the \fIsubsample\fR an integer \fIzoom\fR factor can also be given and the photo image will be enlarged. The image background will be filled with the canvas background colour. The canvas widget does not need to be mapped for this widget command to work, but at least one of it's ancestors must be mapped. This command returns an empty string. .TP \fIpathName \fBimove \fItagOrId index x y\fR . This command causes the \fIindex\fR'th coordinate of each of the items indicated by \fItagOrId\fR to be relocated to the location (\fIx\fR,\fIy\fR). Each item interprets \fIindex\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, only line and polygon items may have their coordinates relocated this way. .TP \fIpathName \fBindex \fItagOrId index\fR . This command returns a decimal string giving the numerical index within \fItagOrId\fR corresponding to \fIindex\fR. \fIIndex\fR gives a textual description of the desired position as described in \fBINDICES\fR above. |
︙ | ︙ | |||
747 748 749 750 751 752 753 | Move each of the items given by \fItagOrId\fR in the canvas coordinate space by adding \fIxAmount\fR to the x-coordinate of each point associated with the item and \fIyAmount\fR to the y-coordinate of each point associated with the item. This command returns an empty string. .TP \fIpathName \fBmoveto \fItagOrId xPos yPos\fR | < > < | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | Move each of the items given by \fItagOrId\fR in the canvas coordinate space by adding \fIxAmount\fR to the x-coordinate of each point associated with the item and \fIyAmount\fR to the y-coordinate of each point associated with the item. This command returns an empty string. .TP \fIpathName \fBmoveto \fItagOrId xPos yPos\fR . Move the items given by \fItagOrId\fR in the canvas coordinate space so that the first coordinate pair of the bottommost item with tag \fItagOrId\fR is located at position (\fIxPos\fR,\fIyPos\fR). \fIxPos\fR and \fIyPos\fR may be the empty string, in which case the corresponding coordinate will be unchanged. All items matching \fItagOrId\fR remain in the same positions relative to each other. This command returns an empty string. .TP \fIpathName \fBpostscript \fR?\fIoption value option value ...\fR? . Generate a Postscript representation for part or all of the canvas. If the \fB\-file\fR option is specified then the Postscript is written to a file and an empty string is returned; otherwise the Postscript is returned as the result of the command. |
︙ | ︙ | |||
942 943 944 945 946 947 948 | Note: this command has no effect on window items. Window items always obscure other item types, and the stacking order of window items is determined by the \fBraise\fR command and \fBlower\fR command, not the \fBraise\fR widget command and \fBlower\fR widget command for canvases. .RE .TP \fIpathName \fBrchars \fItagOrId first last string\fR | < > > > > > > > > > > > > > > > > > > > > > | | 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | Note: this command has no effect on window items. Window items always obscure other item types, and the stacking order of window items is determined by the \fBraise\fR command and \fBlower\fR command, not the \fBraise\fR widget command and \fBlower\fR widget command for canvases. .RE .TP \fIpathName \fBrchars \fItagOrId first last string\fR . This command causes the text or coordinates between \fIfirst\fR and \fIlast\fR for each of the items indicated by \fItagOrId\fR to be replaced by \fIstring\fR. Each item interprets \fIfirst\fR and \fIlast\fR independently according to the rules described in \fBINDICES\fR above. Out of the standard set of items, text items support this operation by altering their text as directed, and line and polygon items support this operation by altering their coordinate list (in which case \fIstring\fR should be a list of coordinates to use as a replacement). The other items ignore this operation. .TP \fIpathName \fBrotate \fItagOrId xOrigin yOrigin angle\fR .VS "8.7, TIP164" Rotate the coordinates of all of the items given by \fItagOrId\fR in canvas coordinate space. \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the rotation operation and \fIangle\fR identifies the amount to rotate the coordinates anticlockwise, in degrees. (Negative values rotate clockwise.) This command returns an empty string. .RS .PP Implementation note: not all item types work the same with rotations. In particular,\fB bitmap\fR,\fB image\fR,\fB text\fR and\fB window\fR items only rotate their anchor points and do not rotate the items themselves about those points, and the \fBarc\fR, \fBoval\fR and \fBrectangle\fR types rotate about a computed center point instead of moving the bounding box coordinates directly. .PP Some items (currently \fBarc\fR and\fB text\fR) have angles in their options; this command \fIdoes not\fR affect those options. .RE .VE "8.7, TIP164" .TP \fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR . Rescale the coordinates of all of the items given by \fItagOrId\fR in canvas coordinate space. \fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling operation and \fIxScale\fR and \fIyScale\fR identify the scale |
︙ | ︙ | |||
1106 1107 1108 1109 1110 1111 1112 | \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | < < < > > > | 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat is \fBpages\fR then the view adjusts in units of nine-tenths the window's width. If \fInumber\fR is negative then information farther to the left becomes visible; if it is positive then information farther to the right becomes visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units of the \fBxScrollIncrement\fR option, if it is greater than zero, or in units of one-tenth the window's width otherwise. .RE .TP \fIpathName \fByview \fI?args\fR? . This command is used to query and change the vertical position of the information displayed in the canvas's window. It can take any of the following forms: |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | < < < > > > | 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 | \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. If \fIwhat\fR is \fBpages\fR then the view adjusts in units of nine-tenths the window's height. If \fInumber\fR is negative then higher information becomes visible; if it is positive then lower information becomes visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units of the \fByScrollIncrement\fR option, if it is greater than zero, or in units of one-tenth the window's height otherwise. .RE .SH "OVERVIEW OF ITEM TYPES" .PP The sections below describe the various types of items supported by canvas widgets. Each item type is characterized by two things: first, the form of the \fBcreate\fR command used to create instances of the type; and second, a set of configuration options |
︙ | ︙ | |||
1319 1320 1321 1322 1323 1324 1325 | For arcs, wide outlines will be drawn centered on the edges of the arc's region. .SH "STANDARD ITEM TYPES" .SS "ARC ITEMS" .PP Items of type \fBarc\fR appear on the display as arc-shaped regions. An arc is a section of an oval delimited by two angles (specified | | | | > > | 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | For arcs, wide outlines will be drawn centered on the edges of the arc's region. .SH "STANDARD ITEM TYPES" .SS "ARC ITEMS" .PP Items of type \fBarc\fR appear on the display as arc-shaped regions. An arc is a section of an oval delimited by two angles (specified by either the \fB\-start\fR and \fB\-extent\fR options or the \fB\-height\fR option) and displayed in one of several ways (specified by the \fB\-style\fR option). Arcs are created with widget commands of the following form: .CS \fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value ...\fR? \fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value ...\fR? .CE The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give the coordinates of two diagonally opposite corners of a rectangular region enclosing the oval that defines the arc (except when \fB\-height\fR is specified - see below). . After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR pairs, each of which sets one of the configuration options for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be used in \fBitemconfigure\fR widget commands to change the item's configuration. An arc item becomes the current item when the mouse pointer is over any part that is painted or (when fully transparent) that would be painted if both the \fB\-fill\fR and \fB\-outline\fR options were non-empty. |
︙ | ︙ | |||
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | modulo 360 is used as the extent. .TP \fB\-start \fIdegrees\fR Specifies the beginning of the angular range occupied by the arc. \fIDegrees\fR is given in units of degrees measured counter-clockwise from the 3-o'clock position; it may be either positive or negative. .TP \fB\-style \fItype\fR Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR (the default) then the arc's region is defined by a section of the oval's perimeter plus two line segments, one between the center of the oval and each end of the perimeter section. If \fItype\fR is \fBchord\fR then the arc's region is defined | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 | modulo 360 is used as the extent. .TP \fB\-start \fIdegrees\fR Specifies the beginning of the angular range occupied by the arc. \fIDegrees\fR is given in units of degrees measured counter-clockwise from the 3-o'clock position; it may be either positive or negative. .TP \fB\-height \fIdistance\fR Provides a shortcut for creating a circular arc segment by defining the distance of the mid-point of the arc from its chord. When this option is used the coordinates are interpreted as the start and end coordinates of the chord, and the options \fB\-start\fR and \fB-extent\fR are ignored. The value of \fIdistance\fR has the following meaning: .RS .PP .RS \fIdistance\fR > 0 creates a clockwise arc .br \fIdistance\fR < 0 creates an counter-clockwise arc .br \fIdistance\fR = 0 creates an arc as if this option had not been specified .RE .PP If you want the arc to have a specific radius, \fIr\fR, use the formula: .PP .RS \fIdistance\fR = \fIr\fR \(+- sqrt(\fIr\fR**2 - (chordLength / 2)**2) .RE .PP choosing the minus sign for the minor arc and the plus sign for the major arc. .PP Note that \fBitemcget \-height\fR always returns 0 so that introspection code can be kept simple. .RE .TP \fB\-style \fItype\fR Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR (the default) then the arc's region is defined by a section of the oval's perimeter plus two line segments, one between the center of the oval and each end of the perimeter section. If \fItype\fR is \fBchord\fR then the arc's region is defined |
︙ | ︙ | |||
1785 1786 1787 1788 1789 1790 1791 | \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for text items: .TP \fB\-angle \fIrotationDegrees\fR | < > < | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 | \fB\-stipple\fR \fB\-activestipple\fR \fB\-disabledstipple\fR \fB\-state\fR \fB\-tags\fR .DE The following extra options are supported for text items: .TP \fB\-angle \fIrotationDegrees\fR . \fIRotationDegrees\fR tells how many degrees to rotate the text anticlockwise about the positioning point for the text; it may have any floating-point value from 0.0 to 360.0. For example, if \fIrotationDegrees\fR is \fB90\fR, then the text will be drawn vertically from bottom to top. This option defaults to \fB0.0\fR. .TP \fB\-font \fIfontName\fR Specifies the font to use for the text item. \fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR. If this option is not specified, it defaults to a system-dependent font. .TP |
︙ | ︙ |
Changes to doc/chooseColor.n.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH tk_chooseColor n 4.2 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_chooseColor \- pops up a dialog box for the user to select a color. .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/colors.n.
︙ | ︙ | |||
780 781 782 783 784 785 786 | yellow4 139 139 0 YellowGreen 154 205 50 .DE .SH "PORTABILITY ISSUES" .TP \fBMac OS X\fR . | | > | < > | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | yellow4 139 139 0 YellowGreen 154 205 50 .DE .SH "PORTABILITY ISSUES" .TP \fBMac OS X\fR . On macOS, the following additional system colors are available. This first group contains all colors available in the HIToolbox library. (Note that in some cases the actual color values may depend on the current Appearance.) .RS .DS systemActiveAreaFill systemAlertActiveText systemAlertBackgroundActive systemAlertBackgroundInactive systemAlertInactiveText |
︙ | ︙ | |||
896 897 898 899 900 901 902 903 904 905 906 907 908 909 | systemRootMenuActiveText systemRootMenuDisabledText systemRootMenuSelectedText systemScrollBarDelimiterActive systemScrollBarDelimiterInactive systemSecondaryGroupBoxBackground systemSecondaryHighlightColor systemSheetBackground systemSheetBackgroundOpaque systemSheetBackgroundTransparent systemStaticAreaFill systemSystemDetailText systemTabFrontActiveText systemTabFrontInactiveText | > | 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 | systemRootMenuActiveText systemRootMenuDisabledText systemRootMenuSelectedText systemScrollBarDelimiterActive systemScrollBarDelimiterInactive systemSecondaryGroupBoxBackground systemSecondaryHighlightColor systemSelectedTabTextColor systemSheetBackground systemSheetBackgroundOpaque systemSheetBackgroundTransparent systemStaticAreaFill systemSystemDetailText systemTabFrontActiveText systemTabFrontInactiveText |
︙ | ︙ | |||
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | systemWhiteText systemWindowBody systemWindowHeaderActiveText systemWindowHeaderBackground systemWindowHeaderInactiveText .DE .RE .TP \fBWindows\fR . On Windows, the following additional system colors are available (note that the actual color values depend on the currently active OS theme): .RS .DS .ta 6c | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 | systemWhiteText systemWindowBody systemWindowHeaderActiveText systemWindowHeaderBackground systemWindowHeaderInactiveText .DE .RE . The second group of MacOS colors below are based on Apple's "semantic" NScolors. On OSX 10.14 (Mojave) and later these colors change value when Dark Mode is enabled. However, the change is only observable when the Apple window manager is drawing to the screen. So the \fBwinfo rgb\fR command will return the color coordinates used in the standard Aqua mode, even if Dark Mode has been selected in the system preferences. The numbered systemWindowBackgroundColors are used in the \fBttk::notebook\fR and \fBttk::labelframe\fR widgets to provide a contrasting background. Each numbered color constrasts with its predecessor. .RS .DS systemControlAccentColor systemControlTextColor systemDisabledControlTextColor systemLabelColor systemSelectedTextBackgroundColor systemSelectedTextColor systemTextBackgroundColor systemTextColor systemWindowBackgroundColor systemWindowBackgroundColor1 systemWindowBackgroundColor2 systemWindowBackgroundColor3 systemWindowBackgroundColor4 systemWindowBackgroundColor5 systemWindowBackgroundColor6 systemWindowBackgroundColor7 .DE .RE .TP \fBWindows\fR . On Windows, the following additional system colors are available (note that the actual color values depend on the currently active OS theme): .RS .DS .ta 6c |
︙ | ︙ |
Changes to doc/console.n.
1 2 3 4 5 | '\" '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2001 Donal K. Fellows '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH console n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME console \- Control the console on systems without a real console .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/cursors.n.
1 2 3 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 1998-2000 by Scriptics Corporation. '\" All rights reserved. '\" '\" Copyright (c) 2006-2007 Daniel A. Steffen <[email protected]> '\" .TH cursors n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME cursors \- mouse cursors available in Tk .BE |
︙ | ︙ |
Changes to doc/destroy.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH destroy n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME destroy \- Destroy one or more windows .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/dialog.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH tk_dialog n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_dialog \- Create modal dialog and wait for response .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/entry.n.
1 2 3 4 5 6 7 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" Copyright (c) 1994-1996 Sun Microsystems, Inc. '\" Copyright (c) 1998-2000 Scriptics Corporation. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH entry n 8.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME entry \- Create and manipulate 'entry' one-line text entry widgets .SH SYNOPSIS \fBentry\fR \fIpathName \fR?\fIoptions\fR? .SO \-background \-highlightthickness \-selectbackground \-borderwidth \-insertbackground \-selectborderwidth \-cursor \-insertborderwidth \-selectforeground \-exportselection \-insertofftime \-takefocus \-font \-insertontime \-textvariable \-foreground \-insertwidth \-xscrollcommand \-highlightbackground \-justify \-highlightcolor \-relief \-placeholder \-placeholderforeground .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-disabledbackground disabledBackground DisabledBackground Specifies the background color to use when the entry is disabled. If this option is the empty string, the normal background color is used. .OP \-disabledforeground disabledForeground DisabledForeground Specifies the foreground color to use when the entry is disabled. If |
︙ | ︙ | |||
399 400 401 402 403 404 405 | way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | < < | | | > > | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. .RE .SH "DEFAULT BINDINGS" .PP Tk automatically creates class bindings for entries that give them the following default behavior. In the descriptions below, .QW word refers to a contiguous group of letters, digits, or |
︙ | ︙ |
Changes to doc/focus.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH focus n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME focus \- Manage the input focus .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/focusNext.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH tk_focusNext n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_focusNext, tk_focusPrev, tk_focusFollowsMouse \- Utility procedures for managing the input focus. .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/fontchooser.n.
1 2 3 4 5 | '\" '\" Copyright (c) 2008 Daniel A. Steffen <[email protected]> '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2008 Daniel A. Steffen <[email protected]> '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH fontchooser n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME fontchooser \- control font selection dialog .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/frame.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH frame n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME frame \- Create and manipulate 'frame' simple container widgets .SH SYNOPSIS \fBframe\fR \fIpathName\fR ?\fIoptions\fR? .SO \-borderwidth \-highlightcolor \-pady \-cursor \-highlightthickness \-relief \-highlightbackground \-padx \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background background Background This option is the same as the standard \fB\-background\fR option except that its value may also be specified as an empty string. In this case, the widget will display no background or border, and no colors will be consumed from its colormap for its background and border. .VS "8.7, TIP262" An empty background will disable drawing the background image. .OP \-backgroundimage backgroundImage BackgroundImage This specifies an image to display on the frame's background within the border of the frame (i.e., the image will be clipped by the frame's highlight ring and border, if either are present); subwidgets of the frame will be drawn on top. The image must have been created with the \fBimage create\fR command. If specified as the empty string, no image will be displayed. .VE "8.7, TIP262" .OP \-class class Class Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. The \fB\-class\fR option may not be changed with the \fBconfigure\fR widget command. |
︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | Specifies the desired height for the window in any of the forms acceptable to \fBTk_GetPixels\fR. If this option is less than or equal to zero then the window will not request any size at all. Note that this sets the total height of the frame, any \fB\-borderwidth\fR or similar is not added. Normally \fB\-height\fR should not be used if a propagating geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the frame since the geometry manager will override the height of the frame. .OP \-visual visual Visual Specifies visual information for the new window in any of the forms accepted by \fBTk_GetVisual\fR. If this option is not specified, the new window will use the same visual as its parent. The \fB\-visual\fR option may not be modified with the \fBconfigure\fR widget command. | > > > > > > > > > | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | Specifies the desired height for the window in any of the forms acceptable to \fBTk_GetPixels\fR. If this option is less than or equal to zero then the window will not request any size at all. Note that this sets the total height of the frame, any \fB\-borderwidth\fR or similar is not added. Normally \fB\-height\fR should not be used if a propagating geometry manager, such as \fBgrid\fR or \fBpack\fR, is used within the frame since the geometry manager will override the height of the frame. .OP \-tile tile Tile .VS "8.7, TIP262" This specifies how to draw the background image (see \fB\-backgroundimage\fR) on the frame. If true (according to \fBTcl_GetBoolean\fR), the image will be tiled to fill the whole frame, with the origin of the first copy of the image being the top left of the interior of the frame. If false (the default), the image will be centered within the frame. .VE "8.7, TIP262" .OP \-visual visual Visual Specifies visual information for the new window in any of the forms accepted by \fBTk_GetVisual\fR. If this option is not specified, the new window will use the same visual as its parent. The \fB\-visual\fR option may not be modified with the \fBconfigure\fR widget command. |
︙ | ︙ | |||
87 88 89 90 91 92 93 | or in the option database to configure aspects of the frame such as its background color and relief. The \fBframe\fR command returns the path name of the new window. .PP A frame is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. The only features | | > > > > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | or in the option database to configure aspects of the frame such as its background color and relief. The \fBframe\fR command returns the path name of the new window. .PP A frame is a simple widget. Its primary purpose is to act as a spacer or container for complex window layouts. The only features of a frame are its background and an optional 3-D border to make the frame appear raised or sunken. .SH "WIDGET COMMAND" .PP The \fBframe\fR command creates a new Tcl command whose name is the same as the path name of the frame's window. This command may be used to invoke various operations on the widget. It has the following general form: .PP .CS \fIpathName option \fR?\fIarg arg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the frame widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for frame widgets: .TP \fIpathName \fBcget\fR \fIoption\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBframe\fR command. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? \fI?value option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no \fIoption\fR is specified). If |
︙ | ︙ |
Changes to doc/grab.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH grab n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME grab \- Confine pointer and keyboard events to a window sub-tree .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/grid.n.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH grid n 8.5 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME grid \- Geometry manager that arranges widgets in a grid .SH SYNOPSIS |
︙ | ︙ | |||
173 174 175 176 177 178 179 | .TP \fB\-sticky \fIstyle\fR . If a slave's cell is larger than its requested dimensions, this option may be used to position (or stretch) the slave within its cell. \fIStyle\fR is a string that contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | .TP \fB\-sticky \fIstyle\fR . If a slave's cell is larger than its requested dimensions, this option may be used to position (or stretch) the slave within its cell. \fIStyle\fR is a string that contains zero or more of the characters \fBn\fR, \fBs\fR, \fBe\fR or \fBw\fR. The string can optionally contain spaces or commas, but they are ignored. Each letter refers to a side (north, south, east, or west) that the slave will .QW stick to. If both \fBn\fR and \fBs\fR (or \fBe\fR and \fBw\fR) are specified, the slave will be stretched to fill the entire height (or width) of its cavity. The \fB\-sticky\fR option subsumes the combination of \fB\-anchor\fR and \fB\-fill\fR that is used by \fBpack\fR. |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | . Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. The configuration options for that window are forgotten, so that if the slave is managed once more by the grid geometry manager, the initial default settings are used. .TP \fBgrid info \fIslave\fR . Returns a list whose elements are the current configuration state of the slave given by \fIslave\fR in the same option-value form that might be specified to \fBgrid configure\fR. The first two elements of the list are | > > > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | . Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. The configuration options for that window are forgotten, so that if the slave is managed once more by the grid geometry manager, the initial default settings are used. .RS .PP .VS TIP518 If the last slave of the master becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the master; the master may choose to resize itself (or otherwise respond) to such a change. .VE TIP518 .RE .TP \fBgrid info \fIslave\fR . Returns a list whose elements are the current configuration state of the slave given by \fIslave\fR in the same option-value form that might be specified to \fBgrid configure\fR. The first two elements of the list are |
︙ | ︙ | |||
274 275 276 277 278 279 280 281 282 283 284 285 286 287 | Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, so that if the slave is managed once more by the grid geometry manager, the previous values are retained. .TP \fBgrid size \fImaster\fR . Returns the size of the grid (in columns then rows) for \fImaster\fR. The size is determined either by the \fIslave\fR occupying the largest row or column, or the largest column or row with a \fB\-minsize\fR, \fB\-weight\fR, or \fB\-pad\fR that is non-zero. | > > > > > > > > | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | Removes each of the \fIslave\fRs from grid for its master and unmaps their windows. The slaves will no longer be managed by the grid geometry manager. However, the configuration options for that window are remembered, so that if the slave is managed once more by the grid geometry manager, the previous values are retained. .RS .PP .VS TIP518 If the last slave of the master becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the master; the master may choose to resize itself (or otherwise respond) to such a change. .VE TIP518 .RE .TP \fBgrid size \fImaster\fR . Returns the size of the grid (in columns then rows) for \fImaster\fR. The size is determined either by the \fIslave\fR occupying the largest row or column, or the largest column or row with a \fB\-minsize\fR, \fB\-weight\fR, or \fB\-pad\fR that is non-zero. |
︙ | ︙ |
Changes to doc/image.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1994 The Regents of the University of California. '\" 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. '\" .TH image n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME image \- Create and manipulate images .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/label.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH label n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME label \- Create and manipulate 'label' non-interactive text or image widgets .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/listbox.n.
︙ | ︙ | |||
380 381 382 383 384 385 386 | \fIfraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | < < | > > > | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | \fIfraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR character units (the width of the \fB0\fR character) on the display. .RE .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in the widget's window. It can take any of the following forms: |
︙ | ︙ | |||
427 428 429 430 431 432 433 | way through the listbox, and so on. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | | < > > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | way through the listbox, and so on. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjusts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then earlier elements become visible; if it is positive then later elements become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by \fInumber\fR lines. .RE .SH "DEFAULT BINDINGS" .PP Tk automatically creates class bindings for listboxes that give them Motif-like behavior. Much of the behavior of a listbox is determined by its \fB\-selectmode\fR option, which selects one of four ways of dealing with the selection. |
︙ | ︙ |
Changes to doc/lower.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH lower n 3.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME lower \- Change a window's position in the stacking order .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/menu.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | .nf \fBmenu\fR \fIpathName \fR?\fIoptions\fR? \fBtk_menuSetFocus\fR \fIpathName\fR .SO \-activebackground \-borderwidth \-foreground \-activeborderwidth \-cursor \-relief \-activeforeground \-disabledforeground \-takefocus | | | | | | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | .nf \fBmenu\fR \fIpathName \fR?\fIoptions\fR? \fBtk_menuSetFocus\fR \fIpathName\fR .SO \-activebackground \-borderwidth \-foreground \-activeborderwidth \-cursor \-relief \-activeforeground \-disabledforeground \-takefocus \-background \-font \-activerelief .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-postcommand postCommand Command If this option is specified then it provides a Tcl command to execute each time the menu is posted. The command is invoked by the \fBpost\fR widget command before posting the menu. Note that in Tk 8.0 on Macintosh and Windows, all post-commands in a system of menus are executed before any of those menus are posted. This is due to the limitations in the individual platforms' menu managers. .OP \-selectcolor selectColor Background For menu entries that are check buttons or radio buttons, this option specifies the color to display in the indicator when the check button or radio button is selected. .OP \-tearoff tearOff TearOff This option must have a proper boolean value (default is false), which specifies whether or not the menu should include a tear-off entry at the top. If so, it will exist as entry 0 of the menu and the other entries will number starting at 1. The default menu bindings arrange for the menu to be torn off when the tear-off entry is invoked. This option is ignored under Aqua/Mac OS X, where menus cannot be torn off. .OP \-tearoffcommand tearOffCommand TearOffCommand If this option has a non-empty value, then it specifies a Tcl command to invoke whenever the menu is torn off. The actual command will consist of the value of this option, followed by a space, followed by the name of the menu window, followed by a space, followed by |
︙ | ︙ | |||
263 264 265 266 267 268 269 | contents are inserted into the standard Window menu of the user's menubar whenever the window's menubar is in front. The first items in the menu are provided by Mac OS X, and the names of the current toplevels are automatically appended after all the Tk-defined items and a separator. The Window menu on the Mac also allows toggling the window into a fullscreen state, and managing a tabbed window interface (multiple windows grouped into a single window) if supported by that | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | contents are inserted into the standard Window menu of the user's menubar whenever the window's menubar is in front. The first items in the menu are provided by Mac OS X, and the names of the current toplevels are automatically appended after all the Tk-defined items and a separator. The Window menu on the Mac also allows toggling the window into a fullscreen state, and managing a tabbed window interface (multiple windows grouped into a single window) if supported by that version of the operating system. .PP When Tk sees a .menubar.help menu on the Macintosh, the menu's contents are appended to the standard Help menu of the user's menubar whenever the window's menubar is in front. The first items in the menu are provided by Mac OS X. .PP When Tk sees a System menu on Windows, its items are appended to the |
︙ | ︙ | |||
466 467 468 469 470 471 472 | entry has a command associated with it then the result of that command is returned as the result of the \fBinvoke\fR widget command. Otherwise the result is an empty string. Note: invoking a menu entry does not automatically unpost the menu; the default bindings normally take care of this before invoking the \fBinvoke\fR widget command. .TP | | | > > | | | | | < | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | entry has a command associated with it then the result of that command is returned as the result of the \fBinvoke\fR widget command. Otherwise the result is an empty string. Note: invoking a menu entry does not automatically unpost the menu; the default bindings normally take care of this before invoking the \fBinvoke\fR widget command. .TP \fIpathName \fBpost \fIx y\fR ?\fIindex\fR? . Arrange for the menu to be displayed on the screen at the root-window coordinates given by \fIx\fR and \fIy\fR. If an index is specified the menu will be located so that the entry with that index is displayed at the point. These coordinates are adjusted if necessary to guarantee that the entire menu is visible on the screen. This command normally returns an empty string. If the \fB\-postcommand\fR option has been specified, then its value is executed as a Tcl script before posting the menu and the result of that script is returned as the result of the \fBpost\fR widget command. If an error returns while executing the command, then the error is returned without posting the menu. .TP \fIpathName \fBpostcascade \fIindex\fR . Posts the submenu associated with the cascade entry given by \fIindex\fR, and unposts any previously posted submenu. If \fIindex\fR does not correspond to a cascade entry, or if \fIpathName\fR is not posted, |
︙ | ︙ |
Changes to doc/menubar.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH tk_menuBar n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_menuBar, tk_bindForTraversal \- Obsolete support for menu bars .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/menubutton.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH menubutton n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME menubutton \- Create and manipulate 'menubutton' pop-up menu indicator widgets .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/message.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH message n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME message \- Create and manipulate 'message' non-interactive text widgets .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/option.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH option n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME option \- Add/retrieve window options to/from the option database .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/optionMenu.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH tk_optionMenu n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_optionMenu \- Create an option menubutton and its menu .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/options.n.
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | definition of active elements. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). .OP \-activeforeground activeForeground Background Specifies foreground color to use when drawing active elements. See above for definition of active elements. .OP \-anchor anchor Anchor Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the values \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. For example, \fBnw\fR means display the information such that its top-left corner is at the top-left corner of the widget. | > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | definition of active elements. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. This option is typically only available in widgets displaying more than one element at a time (e.g. menus but not buttons). .OP \-activeforeground activeForeground Background Specifies foreground color to use when drawing active elements. See above for definition of active elements. .OP \-activerelief activeRelief Relief Specifies the 3-D effect desired for the active item of the widget. See the \fB-relief\fR option for details. .OP \-anchor anchor Anchor Specifies how the information in a widget (e.g. text or a bitmap) is to be displayed in the widget. Must be one of the values \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. For example, \fBnw\fR means display the information such that its top-left corner is at the top-left corner of the widget. |
︙ | ︙ | |||
217 218 219 220 221 222 223 224 225 226 227 228 229 230 | this amount to the height it would normally need (as determined by the height of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space above and/or below what it displays inside. Most widgets only use this option for padding text: if they are displaying a bitmap or image, then they usually ignore padding options. .OP \-relief relief Relief Specifies the 3-D effect desired for the widget. Acceptable values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR, \fBsolid\fR, and \fBgroove\fR. The value indicates how the interior of the widget should appear relative to its exterior; for example, \fBraised\fR means the interior of | > > > > > > > > | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | this amount to the height it would normally need (as determined by the height of the things displayed in the widget); if the geometry manager can satisfy this request, the widget will end up with extra internal space above and/or below what it displays inside. Most widgets only use this option for padding text: if they are displaying a bitmap or image, then they usually ignore padding options. .OP \-placeholder placeHolder PlaceHolder Specifies a help text string to display if no text is otherwise displayed, that is when the widget is empty. The placeholder text is displayed using the values of the \fB\-font\fR and \fB\-justify\fR options. .OP \-placeholderforeground placeholderForeground PlaceholderForeground Specifies the foreground color to use when the placeholder text is displayed. If this option is the empty string, the default color gray70 is used. .OP \-relief relief Relief Specifies the 3-D effect desired for the widget. Acceptable values are \fBraised\fR, \fBsunken\fR, \fBflat\fR, \fBridge\fR, \fBsolid\fR, and \fBgroove\fR. The value indicates how the interior of the widget should appear relative to its exterior; for example, \fBraised\fR means the interior of |
︙ | ︙ |
Changes to doc/pack-old.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH pack-old n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME pack-old \- Obsolete syntax for packer geometry manager .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/pack.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH pack n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME pack \- Geometry manager that packs around edges of cavity .SH SYNOPSIS |
︙ | ︙ | |||
125 126 127 128 129 130 131 132 133 134 135 136 137 138 | than receiving default values. .RE .TP \fBpack forget \fIslave \fR?\fIslave ...\fR? Removes each of the \fIslave\fRs from the packing order for its master and unmaps their windows. The slaves will no longer be managed by the packer. .TP \fBpack info \fIslave\fR Returns a list whose elements are the current configuration state of the slave given by \fIslave\fR in the same option-value form that might be specified to \fBpack configure\fR. The first two elements of the list are .QW "\fB\-in \fImaster\fR" | > > > > > > > > | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | than receiving default values. .RE .TP \fBpack forget \fIslave \fR?\fIslave ...\fR? Removes each of the \fIslave\fRs from the packing order for its master and unmaps their windows. The slaves will no longer be managed by the packer. .RS .PP .VS TIP518 If the last slave of the master becomes unmanaged, this will also send the virtual event \fB<<NoManagedChild>>\fR to the master; the master may choose to resize itself (or otherwise respond) to such a change. .VE TIP518 .RE .TP \fBpack info \fIslave\fR Returns a list whose elements are the current configuration state of the slave given by \fIslave\fR in the same option-value form that might be specified to \fBpack configure\fR. The first two elements of the list are .QW "\fB\-in \fImaster\fR" |
︙ | ︙ |
Changes to doc/palette.n.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH tk_setPalette n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_setPalette, tk_bisque \- Modify the Tk color palette .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/panedwindow.n.
︙ | ︙ | |||
327 328 329 330 331 332 333 | adjusted. .PP When a pane is resized from outside (e.g. it is packed to expand and fill, and the containing toplevel is resized), space is added to the final (rightmost or bottommost) pane in the window. .PP Unlike slave windows managed by e.g. pack or grid, the panes managed by a | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | adjusted. .PP When a pane is resized from outside (e.g. it is packed to expand and fill, and the containing toplevel is resized), space is added to the final (rightmost or bottommost) pane in the window. .PP Unlike slave windows managed by e.g. pack or grid, the panes managed by a panedwindow do not change width or height to accommodate changes in the requested widths or heights of the panes, once these have become mapped. Therefore it may be advisable, particularly when creating layouts interactively, to not add a pane to the panedwindow widget until after the geometry requests of that pane has been finalized (i.e., all components of the pane inserted, all options affecting geometry set to their proper values, etc.). .SH "SEE ALSO" |
︙ | ︙ |
Changes to doc/photo.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1994 The Australian National University '\" 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. | | | | | | | | | < | | > | | | | > > > > | < | | | | | | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | '\" '\" Copyright (c) 1994 The Australian National University '\" 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. '\" '\" Author: Paul Mackerras ([email protected]), '\" Department of Computer Science, '\" Australian National University. '\" .TH photo n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME photo \- Full-color images .SH SYNOPSIS .nf \fBimage create photo \fR?\fIname\fR? ?\fIoptions\fR? \fIimageName \fBblank\fR \fIimageName \fBcget \fIoption\fR \fIimageName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? \fIimageName \fBcopy \fIsourceImage\fR ?\fIoption value(s) ...\fR? \fIimageName \fBdata\fR ?\fIoption value(s) ...\fR? \fIimageName \fBget \fIx y\fR ?\fIoption\fR? \fIimageName \fBput \fIdata\fR ?\fIoption value(s) ...\fR? \fIimageName \fBread \fIfilename\fR ?\fIoption value(s) ...\fR? \fIimageName \fBredither\fR \fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR? \fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR? .fi .BE .SH DESCRIPTION .PP A photo is an image whose pixels can display any color with a varying degree of transparency (the alpha channel). A photo image is stored internally in full color (32 bits per pixel), and is displayed using dithering if necessary. Image data for a photo image can be obtained from a file or a string, or it can be supplied from C code through a procedural interface. At present, only .VS 8.6 PNG, .VE 8.6 GIF and PPM/PGM formats are supported, but an interface exists to allow additional image file formats to be added easily. A photo image is (semi)transparent if the image data it was obtained from had transparency informaton. In regions where no image data has been supplied, it is fully transparent. Transparency may also be modified with the \fBtransparency set\fR subcommand. .SH "CREATING PHOTOS" .PP Like all images, photos are created using the \fBimage create\fR command. Photos support the following \fIoptions\fR: .TP \fB\-data \fIstring\fR . Specifies the contents of the image as a string. .VS 8.7 The string should contain data in the default list-of-lists form, .VE 8.7 binary data or, for some formats, base64-encoded data (this is currently guaranteed to be supported for PNG and GIF images). The format of the string must be one of those for which there is an image file format handler that will accept string data. If both the \fB\-data\fR and \fB\-file\fR options are specified, the \fB\-file\fR option takes precedence. .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the file format for the data specified with the \fB\-data\fR or \fB\-file\fR option and optional arguments passed to the format handler. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-file \fIname\fR . \fIname\fR gives the name of a file that is to be read to supply data for the photo image. The file format must be one of those for which there is an image file format handler that can read data. .TP |
︙ | ︙ | |||
229 230 231 232 233 234 235 | is set, the old contents of the destination image are discarded and the source image is used as-is. The default compositing rule is \fIoverlay\fR. .RE .TP \fIimageName \fBdata\fR ?\fIoption value(s) ...\fR? . | | > > > > > > | | | | | | | > | | | | < > > > > > | | > > > > > | | < | < < < | | | > > > > > > | | | > > > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | is set, the old contents of the destination image are discarded and the source image is used as-is. The default compositing rule is \fIoverlay\fR. .RE .TP \fIimageName \fBdata\fR ?\fIoption value(s) ...\fR? . Returns image data in the form of a string. .VS 8.7 The format of the string depends on the format handler. By default, a human readable format as a list of lists of pixel data is used, other formats can be chosen with the \fB-format\fR option. See \fBIMAGE FORMATS\fR below for details. .VE 8.7 The following options may be specified: .RS .TP \fB\-background\fI color\fR . If the color is specified, the data will not contain any transparency information. In all transparent pixels the color will be replaced by the specified color. .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the image file format handler to use and, optionally, arguments to the format handler. Specifically, this subcommand searches for the first handler whose name matches an initial substring of \fIformat-name\fR and which has the capability to write a string containing this image data. .VS 8.7 If this option is not given, this subcommand uses the default format that consists of a list (one element per row) of lists (one element per pixel/column) of colors in .QW \fB#\fIrrggbb\fR format (see \fBIMAGE FORMATS\fR below). .VE 8.7 Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular region of \fIimageName\fR to be returned. If only \fIx1\fR and \fIy1\fR are specified, the region extends from \fI(x1,y1)\fR to the bottom-right corner of \fIimageName\fR. If all four coordinates are given, they specify diagonally opposite corners of the rectangular region, including x1,y1 and excluding x2,y2. The default, if this option is not given, is the whole image. .TP \fB\-grayscale\fR . If this options is specified, the data will not contain color information. All pixel data will be transformed into grayscale. .RE .VS 8.7 .TP \fIimageName \fBget\fR \fIx y\fR ?\fB-withalpha\fR? . Returns the color of the pixel at coordinates (\fIx\fR,\fIy\fR) in the image as a list of three integers between 0 and 255, representing the red, green and blue components respectively. If the \fB-withalpha\fR option is specified, the returned list will have a fourth element representing the alpha value of the pixel as an integer between 0 and 255. .VE 8.7 .TP \fIimageName \fBput\fR \fIdata\fR ?\fIoption value(s) ...\fR? . Sets pixels in \fI imageName\fR to the data specified in \fIdata\fR. .VS 8.7 This command searches the list of image file format handlers for a handler that can interpret the data in \fIdata\fR, and then reads the image encoded within into \fIimageName\fR (the destination image). See \fBIMAGE FORMATS\fR below for details on formats for image data. .VE 8.7 The following options may be specified: .RS .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ..\fR?} . Specifies the format of the image data in \fIdata\fR and, optionally, arguments to be passed to the format handler. Specifically, only image file format handlers whose names begin with \fIformat-name\fR will be used while searching for an image data format handler to read the data. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-to \fIx1 y1\fR ?\fIx2 y2\fR? . Specifies the coordinates of the top-left corner (\fIx1\fR,\fIy1\fR) of the region of \fIimageName\fR into which the image data will be copied. The default position is (0,0). If \fIx2\fR,\fIy2\fR is given and \fIdata\fR is not large enough to cover the rectangle specified by this option, the image data extracted will be tiled so it covers the entire destination rectangle. If the region specified with this opion is smaller than the supplied \fIdata\fR, the exceeding data is silently discarded. Note that if \fIdata\fR specifies a single color value, then a region extending to the bottom-right corner represented by (\fIx2\fR,\fIy2\fR) will be filled with that color. .RE .TP \fIimageName \fBread\fR \fIfilename\fR ?\fIoption value(s) ...\fR? . Reads image data from the file named \fIfilename\fR into the image. This command first searches the list of image file format handlers for a handler that can interpret the data in \fIfilename\fR, and then reads the image in \fIfilename\fR into \fIimageName\fR (the destination image). The following options may be specified: .RS .TP \fB\-format {\fIformat-name\fR ?\fIoption value ..\fR?} . Specifies the format of the image data in \fIfilename\fR and, optionally, additional options to the format handler. Specifically, only image file format handlers whose names begin with \fIformat-name\fR will be used while searching for an image data format handler to read the data. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular sub-region of the image file data to be copied to the destination image. If only \fIx1\fR and \fIy1\fR are specified, the region extends from (\fIx1,y1\fR) to the bottom-right corner of the image in the image file. If all four coordinates are |
︙ | ︙ | |||
367 368 369 370 371 372 373 374 | displayed. .TP \fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR? . Allows examination and manipulation of the transparency information in the photo image. Several subcommands are available: .RS .TP | > | | > > > | > | | > > | > > > | > | | | | | | > > > | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | displayed. .TP \fIimageName \fBtransparency \fIsubcommand \fR?\fIarg arg ...\fR? . Allows examination and manipulation of the transparency information in the photo image. Several subcommands are available: .RS .VS 8.7 .TP \fIimageName \fBtransparency get \fIx y\fR ?\fB-alpha\fR? . Returns true if the pixel at (\fIx\fR,\fIy\fR) is fully transparent, false otherwise. If the option \fB-alpha\fR is passed, returns the alpha value of the pixel instead, as an integer in the range 0 to 255. .VE 8.7 .VS 8.7 .TP \fIimageName \fBtransparency set \fIx y\fR \fInewVal\fR ?\fB-alpha\fR? . Change the transparency of the pixel at (\fIx\fR,\fIy\fR) to \fInewVal.\fR If no additional option is passed, \fInewVal\fR is interpreted as a boolean and the pixel is made fully transparent if that value is true, fully opaque otherwise. If the \fB-alpha\fR option is passed, \fInewVal\fR is interpreted as an integral alpha value for the pixel, which must be in the range 0 to 255. .VE 8.7 .RE .TP \fIimageName \fBwrite \fIfilename\fR ?\fIoption value(s) ...\fR? . Writes image data from \fIimageName\fR to a file named \fIfilename\fR. The following options may be specified: .RS .TP \fB\-background\fI color\fR . If the color is specified, the data will not contain any transparency information. In all transparent pixels the color will be replaced by the specified color. .TP \fB\-format\fR {\fIformat-name\fR ?\fIoption value ...\fR?} . Specifies the name of the image file format handler to be used to write the data to the file and, optionally, options to pass to the format handler. Specifically, this subcommand searches for the first handler whose name matches an initial substring of \fIformat-name\fR and which has the capability to write an image file. If this option is not given, the format is guessed from the file extension. If that cannot be determined, this subcommand uses the first handler that has the capability to write an image file. Note: the value of this option must be a Tcl list. This means that the braces may be omitted if the argument has only one word. Also, instead of braces, double quotes may be used for quoting. .TP \fB\-from \fIx1 y1 x2 y2\fR . Specifies a rectangular region of \fIimageName\fR to be written to the image file. If only \fIx1\fR and \fIy1\fR are specified, the region extends from \fI(x1,y1)\fR to the bottom-right corner of \fIimageName\fR. If all four coordinates are given, they specify |
︙ | ︙ | |||
422 423 424 425 426 427 428 | .SH "IMAGE FORMATS" .PP The photo image code is structured to allow handlers for additional image file formats to be added easily. The photo image code maintains a list of these handlers. Handlers are added to the list by registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The standard Tk distribution comes with handlers for PPM/PGM, PNG and GIF | > > > > > | | | | | | | | < | | | | > > > > > > > > > > > > > > > > > > | | > > > > > > > > | > > > > > > > > | | | | > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | .SH "IMAGE FORMATS" .PP The photo image code is structured to allow handlers for additional image file formats to be added easily. The photo image code maintains a list of these handlers. Handlers are added to the list by registering them with a call to \fBTk_CreatePhotoImageFormat\fR. The standard Tk distribution comes with handlers for PPM/PGM, PNG and GIF formats, .VS 8.7 as well as the \fBdefault\fR handler to encode/decode image data in a human readable form. .VE 8.7 These handlers are automatically registered on initialization. .PP When reading an image file or processing string data specified with the \fB\-data\fR configuration option, the photo image code invokes each handler in turn until one is found that claims to be able to read the data in the file or string. Usually this will find the correct handler, but if it does not, the user may give a format name with the \fB\-format\fR option to specify which handler to use. In this case, the photo image code will try those handlers whose names begin with the string specified for the \fB\-format\fR option (the comparison is case-insensitive). For example, if the user specifies \fB\-format gif\fR, then a handler named GIF87 or GIF89 may be invoked, but a handler named JPEG may not (assuming that such handlers had been registered). .PP When writing image data to a file, the processing of the \fB\-format\fR option is slightly different: the string value given for the \fB\-format\fR option must begin with the complete name of the requested handler, and may contain additional information following that, which the handler can use, for example, to specify which variant to use of the formats supported by the handler. Note that not all image handlers may support writing transparency data to a file, even where the target image format does. .VS 8.7 .SS "THE DEFAULT IMAGE HANDLER" .PP The \fBdefault\fR image handler cannot be used to read or write data from/to a file. Its sole purpose is to encode and decode image data in string form in a clear text, human readable, form. The \fIimageName\fR \fBdata\fR subcommand uses this handler when no other format is specified. When reading image data from a string with \fIimageName\fR \fBput\fR or the \fB-data\fR option, the default handler is treated as the other handlers. .PP Image data in the \fBdefault\fR string format is a (top-to-bottom) list of scan-lines, with each scan-line being a (left-to-right) list of pixel data. Every scan-line has the same length. The color and, optionally, alpha value of each pixel is specified in any of the forms described in the \fBCOLOR FORMATS\fR section below. .VE 8.7 .SS "FORMAT SUBOPTIONS" .PP .VS 8.6 Image formats may support sub-options, wich ahre specified using additional words in the value to the \fB\-format\fR option. These suboptions can affect how image data is read or written to file or string. The nature and values of these options is up to the format handler. The built-in handlers support these suboptions: .VS 8.7 .TP \fBdefault \-colorformat\fI formatType\fR . The option is allowed when writing image data to a string with \fIimageName\fR \fBdata\fR. Specifies the format to use for the color string of each pixel. \fIformatType\fR may be one of: \fBrgb\fR to encode pixel data in the form \fB#\fIRRGGBB\fR, \fBrgba\fR to encode pixel data in the form \fB#\fIRRGGBBAA\fR or \fBlist\fR to encode pixel data as a list with four elements. See \fBCOLOR FORMATS\fR below for details. The default is \fBrgb\fR. .VE 8.7 .TP \fBgif \-index\fI indexValue\fR . The option has effect when reading image data from a file. When parsing a multi-part GIF image, Tk normally only accesses the first image. By giving the \fB\-index\fR sub-option, the \fIindexValue\fR'th value may be used instead. The \fIindexValue\fR must be an integer from 0 up to the number of image parts in the GIF data. .TP \fBpng \-alpha\fI alphaValue\fR . The option has effect when reading image data from a file. Specifies an additional alpha filtering for the overall image, which allows the background on which the image is displayed to show through. This usually also has the effect of desaturating the image. The \fIalphaValue\fR must be between 0.0 and 1.0. .TP \fBsvg \-dpi\fI dpiValue\fB \-scale\fI scaleValue\fB \-unit\fI unitValue\fR . \fIdpiValue\fR is used in conversion between given coordinates and screen resolution. The value must be greater than 0 and the default value is 96. \fIscaleValue\fR is used to scale the resulting image. The value must be greater than 0 and the default value is 1. \fIunitValue\fR is the unit of all coordinates in the SVG data. Available units are px (default, coordinates in pixel), pt (1/72 inch), pc (12 pt), mm , cm and in. The svg format supports a wide range of SVG features, but the full SVG standard is not available, for instance the 'text' feature is missing and silently ignores when reading the SVG data. The supported SVG features are: . .RS \fB elements:\fR g, path, rect, circle, ellipse, line, polyline, polygon, linearGradient, radialGradient, stop, defs, svg, style .PP \fB attributes:\fR width, height, viewBox, preserveAspectRatio with none, xMin, xMid, xMax, yMin, yMid, yMax, slice .PP \fB gradient attributes:\fR gradientUnits with objectBoundingBox, gradientTransform, cx, cy, r fx, fy x1, y1, x2, y2 spreadMethod with pad, reflect or repeat, xlink:href .PP \fB poly attributes: \fR points .PP \fB line attributes: \fR x1, y1, x2, y2 .PP \fB ellipse attributes: \fR cx, cy, rx, ry .PP \fB circle attributes: \fR cx, cy, r .PP \fB rectangle attributes: \fR x, y, width, height, rx, ry .PP \fB path attributes: \fR d with m, M, l, L, h, H, v, V, c, C, s, S, q, Q, t, T, a, A, z, Z .PP \fB style attributes: \fR display with none, visibility, hidden, visible, fill with nonzero and evenodd, opacity, fill-opacity, stroke, stroke-width, stroke-dasharray, stroke-dashoffset, stroke-opacity, stroke-linecap with butt, round and square, stroke-linejoin with miter, round and bevel, stroke-miterlimit fill-rule, font-size, transform with matrix, translate, scale, rotate, skewX and skewY, stop-color, stop-opacity, offset, id, class .RE . Currently only SVG images reading and conversion into (pixel-based format) photos is supported: Tk does not (yet) support bundling photo images in SVG vector graphics. .VE 8.6 .VS 8.7 .SH "COLOR FORMATS" .PP The default image handler can represent/parse color and alpha values of a pixel in one of the formats listed below. If a color format does not contain transparency information, full opacity is assumed. The available color formats are: .IP \(bu 3 The empty string - interpreted as full transparency, the color value is undefined. .IP \(bu 3 Any value accepted by \fBTk_GetColor\fR, optionally followed by an alpha suffix. The alpha suffix may be one of: .RS .TP \fB@\fR\fIA\fR . The alpha value \fIA\fR must be a fractional value in the range 0.0 (fully transparent) to 1.0 (fully opaque). .TP \fB#\fR\fIX\fR . The alpha value \fIX\fR is a hexadecimal digit that specifies an integer alpha value in the range 0 (fully transparent) to 255 (fully opaque). This is expanded in range from 4 bits wide to 8 bits wide by multiplication by 0x11. .TP \fB#\fR\fIXX\fR . The alpha value \fIXX\fR is passed as two hexadecimal digits that specify an integer alpha value in the range 0 (fully transparent) to 255 (fully opaque). .RE .IP \(bu 3 A Tcl list with three or four integers in the range 0 to 255, specifying the values for the red, green, blue and (optionally) alpha channels respectively. .IP \(bu 3 \fB#\fR\fIRGBA\fR format: a \fB#\fR followed by four hexadecimal digits, where each digit is the value for the red, green, blue and alpha channels respectively. Each digit will be expanded internally to 8 bits by multiplication by 0x11. .IP \(bu 3 \fB#\fR\fIRRGGBBAA\fR format: \fB#\fR followed by eight hexadecimal digits, where each pair of subsequent digits represents the value for the red, green, blue and alpha channels respectively. .VE 8.7 .SH "COLOR ALLOCATION" .PP When a photo image is displayed in a window, the photo image code allocates colors to use to display the image and dithers the image, if necessary, to display a reasonable approximation to the image using the colors that are available. The colors are allocated as a color cube, that is, the number of colors allocated is the product of the |
︙ | ︙ | |||
530 531 532 533 534 535 536 537 538 539 540 541 542 543 | .CS \fBimage create photo\fR icon \-file "icon.png" \fBimage create photo\fR iconDisabled \-file "icon.png" \e \-format "png \-alpha 0.5" button .b \-image icon \-disabledimage iconDisabled .CE .VE 8.6 .SH "SEE ALSO" image(n) .SH KEYWORDS photo, image, color '\" Local Variables: '\" mode: nroff '\" End: | > > > > > > > > > > > > > > > > > | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | .CS \fBimage create photo\fR icon \-file "icon.png" \fBimage create photo\fR iconDisabled \-file "icon.png" \e \-format "png \-alpha 0.5" button .b \-image icon \-disabledimage iconDisabled .CE .VE 8.6 .PP .VS 8.7 Create a green box with a simple shadow effect .PP .CS \fBimage create photo\fR foo # Make a simple graduated fill varying in alpha for the shadow for {set i 14} {$i > 0} {incr i -1} { set i2 [expr {$i + 30}] foo \fBput\fR [format black#%x [expr {15-$i}]] -to $i $i $i2 $i2 } # Put a solid green rectangle on top foo \fBput\fR #F080 -to 0 0 30 30 .VE 8.7 .CE .SH "SEE ALSO" image(n) .SH KEYWORDS photo, image, color '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/place.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH place n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME place \- Geometry manager for fixed or rubber-sheet placement .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/popup.n.
1 2 3 4 5 | '\" '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" 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. '\" .TH tk_popup n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk_popup \- Post a popup menu .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/raise.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990 The Regents of the University of California. '\" 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. '\" .TH raise n 3.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME raise \- Change a window's position in the stacking order .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/scale.n.
︙ | ︙ | |||
51 52 53 54 55 56 57 | Specifies the desired long dimension of the scale in screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR). For vertical scales this is the scale's height; for horizontal scales it is the scale's width. .OP \-resolution resolution Resolution A real value specifying the resolution for the scale. If this value is greater than zero then the scale's value will always be | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | Specifies the desired long dimension of the scale in screen units (i.e. any of the forms acceptable to \fBTk_GetPixels\fR). For vertical scales this is the scale's height; for horizontal scales it is the scale's width. .OP \-resolution resolution Resolution A real value specifying the resolution for the scale. If this value is greater than zero then the scale's value will always be rounded to an even multiple of this value, as will the endpoints of the scale. If the value is less than zero then no rounding occurs. Defaults to 1 (i.e., the value will be integral). .OP \-showvalue showValue ShowValue Specifies a boolean value indicating whether or not the current value of the scale is to be displayed. .OP \-sliderlength sliderLength SliderLength Specifies the size of the slider, measured in screen units along the slider's |
︙ | ︙ | |||
74 75 76 77 78 79 80 | If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the \fB\-activebackground\fR option. .OP \-tickinterval tickInterval TickInterval Must be a real value. Determines the spacing between numerical | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | If the scale is disabled then the value may not be changed and the scale will not activate. If the scale is active, the slider is displayed using the color specified by the \fB\-activebackground\fR option. .OP \-tickinterval tickInterval TickInterval Must be a real value. Determines the spacing between numerical tick marks displayed below or to the left of the slider. The values will all be displayed with the same number of decimal places, which will be enough to ensure they are all accurate to within 20% of a tick interval. If 0, no tick marks will be displayed. .OP \-to to To Specifies a real value corresponding to the right or bottom end of the scale. This value may be either less than or greater than the \fB\-from\fR option. .OP \-variable variable Variable Specifies the name of a global variable to link to the scale. Whenever the |
︙ | ︙ |
Changes to doc/scrollbar.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH scrollbar n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME scrollbar \- Create and manipulate 'scrollbar' scrolling control and indicator widgets .SH SYNOPSIS |
︙ | ︙ | |||
211 212 213 214 215 216 217 | The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP | < < < < < < < < < > > > > > > > > > | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP \fIprefix \fBscroll \fInumber \fBpages\fR . The widget should adjust its view by \fInumber\fR pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. \fINumber\fR is either 1, which means the next page should become visible, or \-1, which means that the previous page should become visible. .TP \fIprefix \fBscroll \fInumber \fBunits\fR . The widget should adjust its view by \fInumber\fR units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. \fINumber\fR is either 1, which means one unit should scroll off the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. .SH "OLD COMMAND SYNTAX" .PP In versions of Tk before 4.0, the \fBset\fR and \fBget\fR widget commands used a different form. This form is still supported for backward compatibility, but it is deprecated. In the old command syntax, the \fBset\fR widget command has the |
︙ | ︙ |
Changes to doc/send.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH send n 4.0 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME send \- Execute a command in a different application .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/spinbox.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2000 Jeffrey Hobbs. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | '\" '\" Copyright (c) 2000 Jeffrey Hobbs. '\" Copyright (c) 2000 Ajuba Solutions. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH spinbox n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME spinbox \- Create and manipulate 'spinbox' value spinner widgets .SH SYNOPSIS \fBspinbox\fR \fIpathName \fR?\fIoptions\fR? .SO \-activebackground \-highlightthickness \-repeatinterval \-background \-insertbackground \-selectbackground \-borderwidth \-insertborderwidth \-selectborderwidth \-cursor \-insertontime \-selectforeground \-exportselection \-insertwidth \-takefocus \-font \-insertofftime \-textvariable \-foreground \-justify \-xscrollcommand \-highlightbackground \-relief \-highlightcolor \-repeatdelay \-placeholder \-placeholderforeground .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-buttonbackground buttonBackground Background The background color to be used for the spin buttons. .OP \-buttoncursor buttonCursor Cursor The cursor to be used when over the spin buttons. If this is empty (the default), a default cursor will be used. |
︙ | ︙ | |||
50 51 52 53 54 55 56 | when using the \fB\-from\fR and \fB\-to\fR range. This must be a format specifier of the form \fB%<pad>.<pad>f\fR, as it will format a floating-point number. .OP \-from from From A floating-point value corresponding to the lowest value for a spinbox, to be used in conjunction with \fB\-to\fR and \fB\-increment\fR. When all are specified correctly, the spinbox will use these values to control its | | > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | when using the \fB\-from\fR and \fB\-to\fR range. This must be a format specifier of the form \fB%<pad>.<pad>f\fR, as it will format a floating-point number. .OP \-from from From A floating-point value corresponding to the lowest value for a spinbox, to be used in conjunction with \fB\-to\fR and \fB\-increment\fR. When all are specified correctly, the spinbox will use these values to control its contents. If this value is greater than the \fB\-to\fR option, then \fB\-from\fR and \fB\-to\fR values are automatically swapped. If \fB\-values\fR is specified, it supersedes this option. .OP "\-invalidcommand or \-invcmd" invalidCommand InvalidCommand Specifies a script to eval when \fB\-validatecommand\fR returns 0. Setting it to an empty string disables this feature (the default). The best use of this option is to set it to \fIbell\fR. See \fBVALIDATION\fR below for more information. .OP \-increment increment Increment |
︙ | ︙ | |||
79 80 81 82 83 84 85 | displayed, the contents will not be selectable, and the spinbox may be displayed in a different color, depending on the values of the \fB\-disabledforeground\fR and \fB\-disabledbackground\fR options. .OP \-to to To A floating-point value corresponding to the highest value for the spinbox, to be used in conjunction with \fB\-from\fR and \fB\-increment\fR. When all are specified correctly, the spinbox will use these values to control | | > | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | displayed, the contents will not be selectable, and the spinbox may be displayed in a different color, depending on the values of the \fB\-disabledforeground\fR and \fB\-disabledbackground\fR options. .OP \-to to To A floating-point value corresponding to the highest value for the spinbox, to be used in conjunction with \fB\-from\fR and \fB\-increment\fR. When all are specified correctly, the spinbox will use these values to control its contents. If this value is less than the \fB\-from\fR option, then \fB\-from\fR and \fB\-to\fR values are automatically swapped. If \fB\-values\fR is specified, it supersedes this option. .OP \-validate validate Validate Specifies the mode in which validation should operate: \fBnone\fR, \fBfocus\fR, \fBfocusin\fR, \fBfocusout\fR, \fBkey\fR, or \fBall\fR. It defaults to \fBnone\fR. When you want validation, you must explicitly state which mode you wish to use. See \fBVALIDATION\fR below for more. .OP "\-validatecommand or \-vcmd" validateCommand ValidateCommand |
︙ | ︙ | |||
464 465 466 467 468 469 470 | way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. | | < < | | > > | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | way through the text appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR or an abbreviation of one of these. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. .RE .SH "DEFAULT BINDINGS" .PP Tk automatically creates class bindings for spinboxes that give them the following default behavior. In the descriptions below, .QW word |
︙ | ︙ |
Changes to doc/text.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH text n 8.5 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME text, tk_textCopy, tk_textCut, tk_textPaste \- Create and manipulate 'text' hypertext editing widgets .SH SYNOPSIS |
︙ | ︙ | |||
1305 1306 1307 1308 1309 1310 1311 | The insert, delete, edit undo and edit redo commands or the user can set or clear the modified flag. If \fIboolean\fR is specified, sets the modified flag of the widget to \fIboolean\fR. .TP \fIpathName \fBedit redo\fR . When the \fB\-undo\fR option is true, reapplies the last undone edits provided | | > | | > | | | 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | The insert, delete, edit undo and edit redo commands or the user can set or clear the modified flag. If \fIboolean\fR is specified, sets the modified flag of the widget to \fIboolean\fR. .TP \fIpathName \fBedit redo\fR . When the \fB\-undo\fR option is true, reapplies the last undone edits provided no other edits were done since then, and returns a list of indices indicating what ranges were changed by the redo operation. Generates an error when the redo stack is empty. Does nothing when the \fB\-undo\fR option is false. .TP \fIpathName \fBedit reset\fR . Clears the undo and redo stacks. .TP \fIpathName \fBedit separator\fR . Inserts a separator (boundary) on the undo stack. Does nothing when the \fB\-undo\fR option is false. .TP \fIpathName \fBedit undo\fR . Undoes the last edit action when the \fB\-undo\fR option is true, and returns a list of indices indicating what ranges were changed by the undo operation. An edit action is defined as all the insert and delete commands that are recorded on the undo stack in between two separators. Generates an error when the undo stack is empty. Does nothing when the \fB\-undo\fR option is false. .RE .TP \fIpathName \fBget\fR ?\fB\-displaychars\fR? ?\fB\-\-\fR? \fIindex1\fR ?\fIindex2 ...\fR? . Return a range of characters from the text. The return value will be all the characters in the text starting with the one whose index is \fIindex1\fR and |
︙ | ︙ | |||
1924 1925 1926 1927 1928 1929 1930 | Adjusts the view in the window so that \fIfraction\fR of the horizontal span of the text is off-screen to the left. \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to | | | | | | > > | < < | 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 | Adjusts the view in the window so that \fIfraction\fR of the horizontal span of the text is off-screen to the left. \fIFraction\fR is a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR . This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBpages\fR, \fBpixels\fR, or \fBunits\fR. If \fIwhat\fR is \fBpages\fR or \fBunits\fR then \fInumber\fR must be an integer, otherwise number may be specified in any of the forms acceptable to \fBTk_GetPixels\fR, such as .QW 2.0c or .QW 1i (the result is rounded to the nearest integer value. If no units are given, pixels are assumed). If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view adjusts by \fInumber\fR pixels; if it is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. .RE .TP \fIpathName \fByview \fR?\fIargs\fR? . This command is used to query and change the vertical position of the text in |
︙ | ︙ | |||
1972 1973 1974 1975 1976 1977 1978 | the widget will never scroll beyond the last pixel, and so a value of 1 will effectively be rounded back to whatever fraction ensures the last pixel is at the bottom of the window, and some other pixel is at the top. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjust the view in the window up or down according to | | | | | | 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 | the widget will never scroll beyond the last pixel, and so a value of 1 will effectively be rounded back to whatever fraction ensures the last pixel is at the bottom of the window, and some other pixel is at the top. .TP \fIpathName \fByview scroll \fInumber what\fR . This command adjust the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fIWhat\fR must be \fBpages\fR, \fBpixels\fR, or \fBunits\fR. If \fIwhat\fR is \fBunits\fR or \fBpages\fR then \fInumber\fR must be an integer, otherwise number may be specified in any of the forms acceptable to \fBTk_GetPixels\fR, such as .QW 2.0c or .QW 1i (the result is rounded to the nearest integer value. If no units are given, pixels are assumed). If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by \fInumber\fR lines on the display; if it is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls; if it is \fBpixels\fR then the view |
︙ | ︙ | |||
2151 2152 2153 2154 2155 2156 2157 | .IP [28] Control-o opens a new line by inserting a newline character in front of the insertion cursor without moving the insertion cursor. .IP [29] Meta-backspace and Meta-Delete delete the word to the left of the insertion cursor. .IP [30] | < < < > > > | 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 | .IP [28] Control-o opens a new line by inserting a newline character in front of the insertion cursor without moving the insertion cursor. .IP [29] Meta-backspace and Meta-Delete delete the word to the left of the insertion cursor. .IP [30] Control-t reverses the order of the two characters to the right of the insertion cursor. .IP [31] Control-x deletes whatever is selected in the text widget after copying it to the clipboard. .IP [32] Control-z undoes the last edit action if the \fB\-undo\fR option is true. Does nothing otherwise. .IP [33] Control-Z (or Control-y on Windows) reapplies the last undone edit action if the \fB\-undo\fR option is true. Does nothing otherwise. .PP |
︙ | ︙ |
Changes to doc/tk.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH tk n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk \- Manipulate Tk internal state .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/tk4.0.ps.
︙ | ︙ | |||
12 13 14 15 16 17 18 | % FrameMaker. % NOTE % This file fixes the problem with NeWS printers dithering color output. % Any questions should be sent to [email protected] % % Known Problems: % Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1 | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | % FrameMaker. % NOTE % This file fixes the problem with NeWS printers dithering color output. % Any questions should be sent to [email protected] % % Known Problems: % Due to bugs in Transcript, the 'PS-Adobe-' is omitted from line 1 /FMversion (3.0) def % Set up Color vs. Black-and-White /FMPrintInColor { % once-thru loop gimmick % See if we're a NeWSprint printer /currentcanvas where { pop systemdict /separationdict known exit |
︙ | ︙ | |||
34 35 36 37 38 39 40 | % } if systemdict /colorimage known systemdict /currentcolortransfer known and exit } loop def % Uncomment the following line to force b&w on color printer % /FMPrintInColor false def | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | % } if systemdict /colorimage known systemdict /currentcolortransfer known and exit } loop def % Uncomment the following line to force b&w on color printer % /FMPrintInColor false def /FrameDict 195 dict def systemdict /errordict known not {/errordict 10 dict def errordict /rangecheck {stop} put} if % The readline in 23.0 doesn't recognize cr's as nl's on AppleTalk FrameDict /tmprangecheck errordict /rangecheck get put errordict /rangecheck {FrameDict /bug true put} put FrameDict /bug false put mark % Some PS machines read past the CR, so keep the following 3 lines together! currentfile 5 string readline 00 0000000000 cleartomark errordict /rangecheck FrameDict /tmprangecheck get put FrameDict /bug get { /readline { /gstring exch def /gfile exch def /gindex 0 def { gfile read pop dup 10 eq {exit} if dup 13 eq {exit} if gstring exch gindex exch put /gindex gindex 1 add def } loop pop gstring 0 gindex getinterval true } def } if /FMVERSION { FMversion ne { /Times-Roman findfont 18 scalefont setfont 100 100 moveto (FrameMaker version does not match postscript_prolog!) dup = show showpage } if } def /FMLOCAL { FrameDict begin 0 def end } def /gstring FMLOCAL /gfile FMLOCAL /gindex FMLOCAL /orgxfer FMLOCAL /orgproc FMLOCAL /organgle FMLOCAL /orgfreq FMLOCAL /yscale FMLOCAL /xscale FMLOCAL /manualfeed FMLOCAL /paperheight FMLOCAL /paperwidth FMLOCAL /FMDOCUMENT { array /FMfonts exch def /#copies exch def FrameDict begin 0 ne dup {setmanualfeed} if /manualfeed exch def /paperheight exch def /paperwidth exch def /yscale exch def /xscale exch def currenttransfer cvlit /orgxfer exch def currentscreen cvlit /orgproc exch def /organgle exch def /orgfreq exch def setpapername manualfeed {true} {papersize} ifelse {manualpapersize} {false} ifelse {desperatepapersize} if end } def /pagesave FMLOCAL /orgmatrix FMLOCAL /landscape FMLOCAL /FMBEGINPAGE { FrameDict begin /pagesave save def 3.86 setmiterlimit /landscape exch 0 ne def landscape { 90 rotate 0 exch neg translate pop } {pop pop} ifelse xscale yscale scale /orgmatrix matrix def gsave } def /FMENDPAGE { grestore pagesave restore end showpage } def /FMFONTDEFINE { FrameDict begin findfont ReEncode 1 index exch definefont FMfonts 3 1 roll put end } def /FMFILLS { FrameDict begin array /fillvals exch def end } def /FMFILL { FrameDict begin fillvals 3 1 roll put end } def /FMNORMALIZEGRAPHICS { newpath 0.0 0.0 moveto 1 setlinewidth 0 setlinecap 0 0 0 sethsbcolor 0 setgray } bind def /fx FMLOCAL /fy FMLOCAL /fh FMLOCAL /fw FMLOCAL /llx FMLOCAL /lly FMLOCAL /urx FMLOCAL /ury FMLOCAL /FMBEGINEPSF { end /FMEPSF save def /showpage {} def FMNORMALIZEGRAPHICS [/fy /fx /fh /fw /ury /urx /lly /llx] {exch def} forall fx fy translate rotate fw urx llx sub div fh ury lly sub div scale llx neg lly neg translate } bind def /FMENDEPSF { FMEPSF restore FrameDict begin } bind def FrameDict begin /setmanualfeed { %%BeginFeature *ManualFeed True statusdict /manualfeed true put %%EndFeature } def /max {2 copy lt {exch} if pop} bind def /min {2 copy gt {exch} if pop} bind def /inch {72 mul} def /pagedimen { paperheight sub abs 16 lt exch paperwidth sub abs 16 lt and {/papername exch def} {pop} ifelse } def /papersizedict FMLOCAL /setpapername { /papersizedict 14 dict def papersizedict begin /papername /unknown def /Letter 8.5 inch 11.0 inch pagedimen /LetterSmall 7.68 inch 10.16 inch pagedimen /Tabloid 11.0 inch 17.0 inch pagedimen /Ledger 17.0 inch 11.0 inch pagedimen /Legal 8.5 inch 14.0 inch pagedimen /Statement 5.5 inch 8.5 inch pagedimen /Executive 7.5 inch 10.0 inch pagedimen |
︙ | ︙ | |||
233 234 235 236 237 238 239 | /A4 {a4tray a4} def /A4Small {a4tray a4small} def /B4 {b4tray b4} def /B5 {b5tray b5} def /unknown {unknown} def papersizedict dup papername known {papername} {/unknown} ifelse get end | | | | | | | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | /A4 {a4tray a4} def /A4Small {a4tray a4small} def /B4 {b4tray b4} def /B5 {b5tray b5} def /unknown {unknown} def papersizedict dup papername known {papername} {/unknown} ifelse get end /FMdicttop countdictstack 1 add def statusdict begin stopped end countdictstack -1 FMdicttop {pop end} for } def /manualpapersize { papersizedict begin /Letter {letter} def /LetterSmall {lettersmall} def /Tabloid {11x17} def /Ledger {ledger} def /Legal {legal} def /Statement {statement} def /Executive {executive} def /A3 {a3} def /A4 {a4} def /A4Small {a4small} def /B4 {b4} def /B5 {b5} def /unknown {unknown} def papersizedict dup papername known {papername} {/unknown} ifelse get end stopped } def /desperatepapersize { statusdict /setpageparams known { paperwidth paperheight 0 1 statusdict begin {setpageparams} stopped pop end } if } def /savematrix { orgmatrix currentmatrix pop } bind def /restorematrix { |
︙ | ︙ | |||
310 311 312 313 314 315 316 | /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl /periodcentered /quotesinglbase /quotedblbase /perthousand /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve /Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron ] def | | | | | | | | | | | | | | 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | /fraction /currency /guilsinglleft /guilsinglright /fi /fl /daggerdbl /periodcentered /quotesinglbase /quotedblbase /perthousand /Acircumflex /Ecircumflex /Aacute /Edieresis /Egrave /Iacute /Icircumflex /Idieresis /Igrave /Oacute /Ocircumflex /.notdef /Ograve /Uacute /Ucircumflex /Ugrave /dotlessi /circumflex /tilde /macron /breve /dotaccent /ring /cedilla /hungarumlaut /ogonek /caron ] def /ReEncode { dup length dict begin { 1 index /FID ne {def} {pop pop} ifelse } forall 0 eq {/Encoding DiacriticEncoding def} if currentdict end } bind def /graymode true def /bwidth FMLOCAL /bpside FMLOCAL /bstring FMLOCAL /onbits FMLOCAL /offbits FMLOCAL /xindex FMLOCAL /yindex FMLOCAL /x FMLOCAL /y FMLOCAL /setpattern { /bwidth exch def /bpside exch def /bstring exch def /onbits 0 def /offbits 0 def freq sangle landscape {90 add} if {/y exch def /x exch def /xindex x 1 add 2 div bpside mul cvi def /yindex y 1 add 2 div bpside mul cvi def bstring yindex bwidth mul xindex 8 idiv add get 1 7 xindex 8 mod sub bitshift and 0 ne {/onbits onbits 1 add def 1} |
︙ | ︙ | |||
366 367 368 369 370 371 372 | orgfreq organgle orgproc cvx setscreen } if } bind def /HUE FMLOCAL /SAT FMLOCAL /BRIGHT FMLOCAL /Colors FMLOCAL | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | orgfreq organgle orgproc cvx setscreen } if } bind def /HUE FMLOCAL /SAT FMLOCAL /BRIGHT FMLOCAL /Colors FMLOCAL FMPrintInColor { /HUE 0 def /SAT 0 def /BRIGHT 0 def % array of arrays Hue and Sat values for the separations [HUE BRIGHT] /Colors [[0 0 ] % black [0 0 ] % white [0.00 1.0] % red [0.37 1.0] % green [0.60 1.0] % blue [0.50 1.0] % cyan [0.83 1.0] % magenta [0.16 1.0] % comment / yellow ] def /BEGINBITMAPCOLOR { BITMAPCOLOR} def /BEGINBITMAPCOLORc { BITMAPCOLORc} def /BEGINBITMAPTRUECOLOR { BITMAPTRUECOLOR } def /BEGINBITMAPTRUECOLORc { BITMAPTRUECOLORc } def /K { Colors exch get dup 0 get /HUE exch store 1 get /BRIGHT exch store HUE 0 eq BRIGHT 0 eq and {1.0 SAT sub setgray} {HUE SAT BRIGHT sethsbcolor} ifelse } def /FMsetgray { /SAT exch 1.0 exch sub store HUE 0 eq BRIGHT 0 eq and {1.0 SAT sub setgray} {HUE SAT BRIGHT sethsbcolor} ifelse } bind def } { /BEGINBITMAPCOLOR { BITMAPGRAY} def /BEGINBITMAPCOLORc { BITMAPGRAYc} def /BEGINBITMAPTRUECOLOR { BITMAPTRUEGRAY } def /BEGINBITMAPTRUECOLORc { BITMAPTRUEGRAYc } def /FMsetgray {setgray} bind def /K { pop } def } ifelse /normalize { transform round exch round exch itransform } bind def /dnormalize { dtransform round exch round exch idtransform } bind def /lnormalize { 0 dtransform exch cvi 2 idiv 2 mul 1 add exch idtransform pop } bind def /H { lnormalize setlinewidth } bind def /Z { setlinecap } bind def /fillvals FMLOCAL /X { fillvals exch get dup type /stringtype eq {8 1 setpattern} {grayness} ifelse } bind def /V { gsave eofill grestore } bind def /N { stroke } bind def /M {newpath moveto} bind def /E {lineto} bind def /D {curveto} bind def /O {closepath} bind def /n FMLOCAL /L { /n exch def newpath normalize moveto 2 1 n {pop normalize lineto} for } bind def /Y { L closepath } bind def /x1 FMLOCAL /x2 FMLOCAL /y1 FMLOCAL /y2 FMLOCAL /rad FMLOCAL /R { /y2 exch def /x2 exch def /y1 exch def /x1 exch def x1 y1 x2 y1 x2 y2 x1 y2 4 Y } bind def /RR { /rad exch def normalize /y2 exch def /x2 exch def normalize /y1 exch def /x1 exch def newpath x1 y1 rad add moveto x1 y2 x2 y2 rad arcto x2 y2 x2 y1 rad arcto x2 y1 x1 y1 rad arcto x1 y1 x1 y2 rad arcto closepath 16 {pop} repeat } bind def /C { grestore gsave R clip } bind def /FMpointsize FMLOCAL /F { FMfonts exch get FMpointsize scalefont setfont } bind def /Q { /FMpointsize exch def F } bind def /T { moveto show } bind def /RF { rotate 0 ne {-1 1 scale} if } bind def /TF { gsave moveto RF show grestore } bind def /P { moveto 0 32 3 2 roll widthshow } bind def /PF { gsave moveto RF 0 32 3 2 roll widthshow grestore } bind def /S { moveto 0 exch ashow } bind def /SF { gsave moveto RF 0 exch ashow grestore } bind def /B { moveto 0 32 4 2 roll 0 exch awidthshow } bind def /BF { gsave moveto RF 0 32 4 2 roll 0 exch awidthshow grestore } bind def /G { gsave newpath normalize translate 0.0 0.0 moveto dnormalize scale 0.0 0.0 1.0 5 3 roll arc closepath fill grestore } bind def /A { gsave savematrix newpath 2 index 2 div add exch 3 index 2 div sub exch normalize 2 index 2 div sub exch 3 index 2 div add exch translate scale 0.0 0.0 1.0 5 3 roll arc restorematrix stroke grestore } bind def /x FMLOCAL /y FMLOCAL /w FMLOCAL /h FMLOCAL /xx FMLOCAL /yy FMLOCAL /ww FMLOCAL /hh FMLOCAL /FMsaveobject FMLOCAL /FMoptop FMLOCAL /FMdicttop FMLOCAL /BEGINPRINTCODE { /FMdicttop countdictstack 1 add def /FMoptop count 4 sub def /FMsaveobject save def userdict begin /showpage {} def FMNORMALIZEGRAPHICS 3 index neg 3 index neg translate } bind def /ENDPRINTCODE { count -1 FMoptop {pop pop} for countdictstack -1 FMdicttop {pop end} for FMsaveobject restore } bind def /gn { 0 { 46 mul cf read pop 32 sub dup 46 lt {exit} if 46 sub add } loop add } bind def /str FMLOCAL /cfs { /str sl string def 0 1 sl 1 sub {str exch val put} for str def } bind def /ic [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0223 0 {0 hx} {1 hx} {2 hx} {3 hx} {4 hx} {5 hx} {6 hx} {7 hx} {8 hx} {9 hx} {10 hx} {11 hx} {12 hx} {13 hx} {14 hx} {15 hx} {16 hx} {17 hx} {18 hx} {19 hx} {gn hx} {0} {1} {2} {3} {4} {5} {6} {7} {8} {9} {10} {11} {12} {13} {14} {15} {16} {17} {18} {19} {gn} {0 wh} {1 wh} {2 wh} {3 wh} |
︙ | ︙ | |||
651 652 653 654 655 656 657 | /val FMLOCAL /ws FMLOCAL /im FMLOCAL /bs FMLOCAL /cs FMLOCAL /len FMLOCAL /pos FMLOCAL | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | /val FMLOCAL /ws FMLOCAL /im FMLOCAL /bs FMLOCAL /cs FMLOCAL /len FMLOCAL /pos FMLOCAL /ms { /sl exch def /val 255 def /ws cfs /im cfs /val 0 def /bs cfs /cs cfs } bind def 400 ms /ip { is 0 cf cs readline pop { ic exch get exec add } forall pop } bind def /wh { /len exch def /pos exch def ws 0 len getinterval im pos len getinterval copy pop pos len } bind def /bl { /len exch def /pos exch def bs 0 len getinterval im pos len getinterval copy pop pos len } bind def /s1 1 string def /fl { /len exch def /pos exch def /val cf s1 readhexstring pop 0 get def pos 1 pos len add 1 sub {im exch val put} for pos len } bind def /hx { 3 copy getinterval cf exch readhexstring pop pop } bind def /h FMLOCAL /w FMLOCAL /d FMLOCAL /lb FMLOCAL /bitmapsave FMLOCAL /is FMLOCAL /cf FMLOCAL /wbytes { dup 8 eq {pop} {1 eq {7 add 8 idiv} {3 add 4 idiv} ifelse} ifelse } bind def /BEGINBITMAPBWc { 1 {} COMMONBITMAPc } bind def /BEGINBITMAPGRAYc { 8 {} COMMONBITMAPc } bind def /BEGINBITMAP2BITc { 2 {} COMMONBITMAPc } bind def /COMMONBITMAPc { /r exch def /d exch def gsave translate rotate scale /h exch def /w exch def /lb w d wbytes def sl lb lt {lb ms} if /bitmapsave save def r /is im 0 lb getinterval def ws 0 lb getinterval is copy pop /cf currentfile def w h d [w 0 0 h neg 0 h] {ip} image bitmapsave restore grestore } bind def /BEGINBITMAPBW { 1 {} COMMONBITMAP } bind def /BEGINBITMAPGRAY { 8 {} COMMONBITMAP } bind def /BEGINBITMAP2BIT { 2 {} COMMONBITMAP } bind def /COMMONBITMAP { /r exch def /d exch def gsave translate rotate scale /h exch def /w exch def /bitmapsave save def r /is w d wbytes string def /cf currentfile def w h d [w 0 0 h neg 0 h] {cf is readhexstring pop} image bitmapsave restore grestore } bind def /proc1 FMLOCAL /proc2 FMLOCAL /newproc FMLOCAL /Fmcc { /proc2 exch cvlit def |
︙ | ︙ | |||
809 810 811 812 813 814 815 | setcolortransfer {pop 0} setundercolorremoval {} setblackgeneration } bind def /tran FMLOCAL /fakecolorsetup { /tran 256 string def | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | setcolortransfer {pop 0} setundercolorremoval {} setblackgeneration } bind def /tran FMLOCAL /fakecolorsetup { /tran 256 string def 0 1 255 {/indx exch def tran indx red indx get 77 mul green indx get 151 mul blue indx get 28 mul add add 256 idiv put} for currenttransfer {255 mul cvi tran exch get 255.0 div} exch Fmcc settransfer } bind def /BITMAPCOLOR { /d 8 def gsave translate rotate scale /h exch def /w exch def /bitmapsave save def colorsetup /is w d wbytes string def /cf currentfile def w h d [w 0 0 h neg 0 h] {cf is readhexstring pop} {is} {is} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPCOLORc { /d 8 def gsave translate rotate scale /h exch def /w exch def /lb w d wbytes def sl lb lt {lb ms} if /bitmapsave save def colorsetup /is im 0 lb getinterval def ws 0 lb getinterval is copy pop /cf currentfile def w h d [w 0 0 h neg 0 h] {ip} {is} {is} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUECOLORc { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def ws 0 w getinterval is copy pop /cf currentfile def w h 8 [w 0 0 h neg 0 h] {ip} {gip} {bip} true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUECOLOR { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def /gis w string def /bis w string def /cf currentfile def w h 8 [w 0 0 h neg 0 h] { cf is readhexstring pop } { cf gis readhexstring pop } { cf bis readhexstring pop } true 3 colorimage bitmapsave restore grestore } bind def /BITMAPTRUEGRAYc { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def ws 0 w getinterval is copy pop /cf currentfile def w h 8 [w 0 0 h neg 0 h] {ip gip bip w gray} image bitmapsave restore grestore } bind def /ww FMLOCAL /r FMLOCAL /g FMLOCAL /b FMLOCAL /i FMLOCAL /gray { /ww exch def /b exch def /g exch def /r exch def 0 1 ww 1 sub { /i exch def r i get .299 mul g i get .587 mul b i get .114 mul add add r i 3 -1 roll floor cvi put } for r } bind def /BITMAPTRUEGRAY { gsave translate rotate scale /h exch def /w exch def /bitmapsave save def /is w string def /gis w string def /bis w string def /cf currentfile def w h 8 [w 0 0 h neg 0 h] { cf is readhexstring pop cf gis readhexstring pop cf bis readhexstring pop w gray} image bitmapsave restore grestore } bind def /BITMAPGRAY { 8 {fakecolorsetup} COMMONBITMAP } bind def /BITMAPGRAYc { 8 {fakecolorsetup} COMMONBITMAPc } bind def /ENDBITMAP { } bind def end /ALDsave FMLOCAL /ALDmatrix matrix def ALDmatrix currentmatrix pop /StartALD { /ALDsave save def savematrix ALDmatrix setmatrix } bind def |
︙ | ︙ |
Changes to doc/tk_mac.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 2011 Kevin Walzer. '\" Copyright (c) 2011 Donal K. Fellows. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | '\" '\" Copyright (c) 2011 Kevin Walzer. '\" Copyright (c) 2011 Donal K. Fellows. '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH tk::mac n 8.6 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tk::mac \- Access Mac-Specific Functionality on OS X from Tk .SH SYNOPSIS .nf \fB::tk::mac::DoScriptFile\fR \fB::tk::mac::DoScriptText\fR \fB::tk::mac::ShowPreferences\fR \fB::tk::mac::OpenApplication\fR \fB::tk::mac::ReopenApplication\fR \fB::tk::mac::OpenDocument \fIfile...\fR \fB::tk::mac::PrintDocument \fIfile...\fR \fB::tk::mac::Quit\fR \fB::tk::mac::OnHide\fR \fB::tk::mac::OnShow\fR \fB::tk::mac::ShowHelp\fR \fB::tk::mac::PerformService\fR \fB::tk::mac::LaunchURL \fIURL...\fR \fB::tk::mac::GetAppPath\fR \fB::tk::mac::standardAboutPanel\fR \fB::tk::mac::useCompatibilityMetrics \fIboolean\fR \fB::tk::mac::CGAntialiasLimit \fIlimit\fR \fB::tk::mac::antialiasedtext \fInumber\fR \fB::tk::mac::useThemedToplevel \fIboolean\fR \fB::tk::mac::iconBitmap \fIname width height \-kind value\fR .fi .BE .SH "EVENT HANDLER CALLBACKS" .PP The Aqua/Mac OS X application environment defines a number of additional events that applications should respond to. These events are mapped by Tk to calls to commands in the \fB::tk::mac\fR namespace; unless otherwise noted, if the command is absent, no action will be taken. .TP \fB::tk::mac::DoScriptFile\fR . The default Apple Event handler for AEDoScriptHandler. This command, if defined, executes a Tcl file when an AppleScript sends a .QW "do script" command to Wish with a file path as a parameter. .TP \fB::tk::mac::DoScriptText\fR . The default Apple Event handler for AEDoScriptHandler. This command, if defined, executes Tcl code when an AppleScript sends a .QW "do script" command to Wish with Tcl code or a Tcl procedure as a parameter. .TP \fB::tk::mac::ShowPreferences\fR . The default Apple Event handler for kAEShowPreferences, .QW pref . The application menu .QW "Preferences" menu item is only enabled when this proc is defined. Typically this command is |
︙ | ︙ | |||
57 58 59 60 61 62 63 | } .CE .RE .TP \fB::tk::mac::OpenApplication\fR . If a proc of this name is defined, this proc fill fire when your application | | | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | } .CE .RE .TP \fB::tk::mac::OpenApplication\fR . If a proc of this name is defined, this proc fill fire when your application is initially opened. It is the default Apple Event handler for kAEOpenApplication, .QW oapp . .TP \fB::tk::mac::ReopenApplication\fR . If a proc of this name is defined it is the default Apple Event handler for kAEReopenApplication, |
︙ | ︙ | |||
106 107 108 109 110 111 112 | .RE .TP \fB::tk::mac::PrintDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , | | | < | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | .RE .TP \fB::tk::mac::PrintDocument \fIfile...\fR . If a proc of this name is defined it is the default Apple Event handler for kAEPrintDocuments, .QW pdoc , the Apple Event sent when your application is asked to print a document. It takes a single absolute file path as an argument. .TP \fB::tk::mac::Quit\fR . If a proc of this name is defined it is the default Apple Event handler for kAEQuitApplication, .QW quit , the Apple Event sent when your application is asked to be quit, e.g. via the |
︙ | ︙ | |||
137 138 139 140 141 142 143 | .TP \fB::tk::mac::ShowHelp\fR . Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | .TP \fB::tk::mac::ShowHelp\fR . Customizes behavior of Apple Help menu; if this procedure is not defined, the platform-specific standard Help menu item .QW "YourApp Help" performs the default Cocoa action of showing the Help Book configured in the application's Info.plist (or displaying an alert if no Help Book is set). .TP \fB::tk::mac::PerformService\fR . Executes a Tcl procedure called from the macOS .QW Services menu in the Application menu item. The .QW Services menu item allows for inter-application communication; data from one application, such as selected text, can be sent to another application for processing, for example to Safari as a search item for Google, or to TextEdit to be appended to a file. An example of the proc is below, and should be rewritten in an application script for customization: .RS .PP .CS proc ::tk::mac::PerformService {} { set data [clipboard get] $w insert end $data } .CE .RE Note that the mechanism for retrieving the data is from the clipboard; there is no other supported way to obtain the data. If the Services process is not desired, the NSServices keys can be deleted from the application's Info.plist file. The underlying code supporting this command also allows the text, entry and ttk::entry widgets to access services from other applications via the Services menu. The NSPortName key in Wish's Info.plist file is currently set as .QW "Wish" ; if a developer changes the name of the Wish executable to something else, this key should be modified with the same name. .TP \fB::tk::mac::LaunchURL \fIURL...\fR . If defined, launches a URL within Tk. This would be used if a Tk application wants to handle a URL itself, such as displaying data from an RSS feed, rather than launching a default application to handle the URL, although it can defined as such. Wish includes a stub URL scheme of .QW foo:// in the CFBundleURLSchemes key of its Info.plist file; this should be customized for the specific URL scheme the developer wants to support. .TP \fB::tk::mac::GetAppPath\fR . Returns the current applications's file path. .TP .SH "ADDITIONAL DIALOGS" .PP The Aqua/Mac OS X defines additional dialogs that applications should support. .TP \fB::tk::mac::standardAboutPanel\fR . |
︙ | ︙ |
Changes to doc/tkvars.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH tkvars n 4.1 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME geometry, tk_library, tk_patchLevel, tk_strictMotif, tk_version \- Variables used or set by Tk .BE |
︙ | ︙ |
Changes to doc/tkwait.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1992 The Regents of the University of California. '\" 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. '\" .TH tkwait n "" Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME tkwait \- Wait for variable to change or window to be destroyed .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/toplevel.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH toplevel n 8.4 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME toplevel \- Create and manipulate 'toplevel' main and popup window widgets .SH SYNOPSIS \fBtoplevel\fR \fIpathName \fR?\fIoptions\fR? .SO \-borderwidth \-highlightcolor \-pady \-cursor \-highlightthickness \-relief \-highlightbackground \-padx \-takefocus .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background background Background This option is the same as the standard \fB\-background\fR option except that its value may also be specified as an empty string. In this case, the widget will display no background or border, and no colors will be consumed from its colormap for its background and border. .VS "8.7, TIP262" An empty background will disable drawing the background image. .OP \-backgroundimage backgroundImage BackgroundImage This specifies an image to display on the toplevel's background within the border of the toplevel (i.e., the image will be clipped by the toplevel's highlight ring and border, if either are present) on top of the background; subwidgets of the toplevel will be drawn on top. The image must have been created with the \fBimage create\fR command. If specified as the empty string, no image will be displayed. .VE "8.7, TIP262" .OP \-class class Class Specifies a class for the window. This class will be used when querying the option database for the window's other options, and it will also be used later for other purposes such as bindings. The \fB\-class\fR option may not be changed with the \fBconfigure\fR widget command. |
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 | Specifies the screen on which to place the new window. Any valid screen name may be used, even one associated with a different display. Defaults to the same screen as its parent. This option is special in that it may not be specified via the option database, and it may not be modified with the \fBconfigure\fR widget command. .OP \-use use Use This option is used for embedding. If the value is not an empty string, it must be the window identifier of a container window, specified as a hexadecimal string like the ones returned by the \fBwinfo id\fR command. The toplevel widget will be created as a child of the given container instead of the root window for the screen. If the container window is in a Tk application, it must be a frame or toplevel widget for | > > > > > > > > > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | Specifies the screen on which to place the new window. Any valid screen name may be used, even one associated with a different display. Defaults to the same screen as its parent. This option is special in that it may not be specified via the option database, and it may not be modified with the \fBconfigure\fR widget command. .OP \-tile tile Tile .VS "8.7, TIP262" This specifies how to draw the background image (see \fB\-backgroundimage\fR) on the toplevel. If true (according to \fBTcl_GetBoolean\fR), the image will be tiled to fill the whole toplevel, with the origin of the first copy of the image being the top left of the interior of the toplevel. If false (the default), the image will be centered within the toplevel. .VE "8.7, TIP262" .OP \-use use Use This option is used for embedding. If the value is not an empty string, it must be the window identifier of a container window, specified as a hexadecimal string like the ones returned by the \fBwinfo id\fR command. The toplevel widget will be created as a child of the given container instead of the root window for the screen. If the container window is in a Tk application, it must be a frame or toplevel widget for |
︙ | ︙ | |||
100 101 102 103 104 105 106 | by the \fIpathName\fR argument). Additional options, described above, may be specified on the command line or in the option database to configure aspects of the toplevel such as its background color and relief. The \fBtoplevel\fR command returns the path name of the new window. .PP | | | | > > > > > > | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | by the \fIpathName\fR argument). Additional options, described above, may be specified on the command line or in the option database to configure aspects of the toplevel such as its background color and relief. The \fBtoplevel\fR command returns the path name of the new window. .PP A toplevel is similar to a \fBframe\fR except that it is created as a top-level window: its X parent is the root window of a screen rather than the logical parent from its Tk path name. The primary purpose of a toplevel is to serve as a container for dialog boxes and other collections of widgets. The only visible features of a toplevel are its background and an optional 3-D border to make the toplevel appear raised or sunken. .SH "WIDGET COMMAND" .PP The \fBtoplevel\fR command creates a new Tcl command whose name is the same as the path name of the toplevel's window. This command may be used to invoke various operations on the widget. It has the following general form: .PP .CS \fIpathName option \fR?\fIarg arg ...\fR? .CE .PP \fIPathName\fR is the name of the command, which is the same as the toplevel widget's path name. \fIOption\fR and the \fIarg\fRs determine the exact behavior of the command. The following commands are possible for toplevel widgets: .TP \fIpathName \fBcget \fIoption\fR . Returns the current value of the configuration option given by \fIoption\fR. \fIOption\fR may have any of the values accepted by the \fBtoplevel\fR command. .TP \fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? . Query or modify the configuration options of the widget. If no \fIoption\fR is specified, returns a list describing all of the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for information on the format of this list). If \fIoption\fR is specified with no \fIvalue\fR, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no \fIoption\fR is specified). If one or more \fIoption\-value\fR pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. \fIOption\fR may have any of the values accepted by the \fBtoplevel\fR command. .SH BINDINGS .PP When a new toplevel is created, it has no default event bindings: toplevels are not intended to be interactive. .PP Be aware that bindings on toplevels may receive events from subwidgets. .SH "SEE ALSO" bind(n), bindtags(n), frame(n), wm(n) .SH KEYWORDS toplevel, widget '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_Theme.3.
1 2 3 4 5 | '\" '\" Copyright (c) 2003 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | '\" '\" Copyright (c) 2003 Joe English '\" '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" .TH Ttk_CreateTheme 3 8.5 Tk "Tk Themed Widget" .so man.macros .BS .SH NAME Ttk_CreateTheme, Ttk_GetTheme, Ttk_GetDefaultTheme, Ttk_GetCurrentTheme \- create and use Tk themes. .SH SYNOPSIS .nf |
︙ | ︙ |
Changes to doc/ttk_button.n.
︙ | ︙ | |||
13 14 15 16 17 18 19 | \fBttk::button\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBttk::button\fR widget displays a textual label and/or image, and evaluates a command when pressed. .SO ttk_widget \-class \-compound \-cursor | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | \fBttk::button\fR \fIpathName \fR?\fIoptions\fR? .BE .SH DESCRIPTION A \fBttk::button\fR widget displays a textual label and/or image, and evaluates a command when pressed. .SO ttk_widget \-class \-compound \-cursor \-image \-justify \-state \-style \-takefocus \-text \-textvariable \-underline \-width .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command A script to evaluate when the widget is invoked. .OP \-default default Default |
︙ | ︙ |
Changes to doc/ttk_combobox.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 | .SH DESCRIPTION .PP A \fBttk::combobox\fR combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list. .SO ttk_widget \-class \-cursor \-takefocus | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | .SH DESCRIPTION .PP A \fBttk::combobox\fR combines a text field with a pop-down list of values; the user may select the value of the text field from among the values in the list. .SO ttk_widget \-class \-cursor \-takefocus \-style \-placeholder .SE .\" ALSO: Other entry widget options .SH "WIDGET-SPECIFIC OPTIONS" .OP \-exportselection exportSelection ExportSelection Boolean value. If set, the widget selection is linked to the X selection. .OP \-justify justify Justify |
︙ | ︙ | |||
63 64 65 66 67 68 69 | '\".TP '\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? '\"Modify or query widget options. '\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBcurrent\fR ?\fInewIndex\fR? If \fInewIndex\fR is supplied, sets the combobox value | | > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | '\".TP '\"\fIpathName \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? '\"Modify or query widget options. '\"See \fIttk::widget(n)\fR. .TP \fIpathName \fBcurrent\fR ?\fInewIndex\fR? If \fInewIndex\fR is supplied, sets the combobox value to the element at position \fInewIndex\fR in the list of \fB\-values\fR (in addition to integers, the \fBend\fR index is supported and indicates the last element of the list). Otherwise, returns the index of the current value in the list of \fB\-values\fR or \fB\-1\fR if the current value does not appear in the list. .TP \fIpathName \fBget\fR Returns the current value of the combobox. '\".TP '\"\fIpathName \fBidentify \fIx y\fR |
︙ | ︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | .PP Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBpressed\fP, \fBreadonly\fP. .PP \fBTCombobox\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-arrowcolor\fP \fIcolor\fP .br \fB\-background\fP \fIcolor\fP .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br | > > | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | .PP Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBpressed\fP, \fBreadonly\fP. .PP \fBTCombobox\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-arrowcolor\fP \fIcolor\fP .br \fB\-arrowsize\fP \fIamount\fP .br \fB\-background\fP \fIcolor\fP .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br |
︙ | ︙ |
Changes to doc/ttk_entry.n.
︙ | ︙ | |||
19 20 21 22 23 24 25 | An \fBttk::entry\fR widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the \fB\-textvariable\fR option. Entry widgets support horizontal scrolling with the standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command. .SO ttk_widget | | > > | < < | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | An \fBttk::entry\fR widget displays a one-line text string and allows that string to be edited by the user. The value of the string may be linked to a Tcl variable with the \fB\-textvariable\fR option. Entry widgets support horizontal scrolling with the standard \fB\-xscrollcommand\fR option and \fBxview\fR widget command. .SO ttk_widget \-class \-cursor \-font \-foreground \-style \-takefocus \-xscrollcommand \-placeholder .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-exportselection exportSelection ExportSelection A boolean value specifying whether or not a selection in the widget should be linked to the X selection. If the selection is exported, then selecting in the widget deselects the current X selection, selecting outside the widget deselects any widget selection, and the widget will respond to selection retrieval requests when it has a selection. .\" MAYBE: .OP \-insertbackground insertBackground Foreground .\" MAYBE: .OP \-insertwidth insertWidth InsertWidth .OP \-invalidcommand invalidCommand InvalidCommand A script template to evaluate whenever the \fB\-validatecommand\fR returns 0. See \fBVALIDATION\fR below for more information. .OP \-justify justify Justify Specifies how the text is aligned within the entry widget. |
︙ | ︙ | |||
218 219 220 221 222 223 224 | .TP \fIpathName \fBvalidate\fR Force revalidation, independent of the conditions specified by the \fB\-validate\fR option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the \fBinvalid\fR state accordingly. See \fBVALIDATION\fR below for more details. | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | .TP \fIpathName \fBvalidate\fR Force revalidation, independent of the conditions specified by the \fB\-validate\fR option. Returns 0 if validation fails, 1 if it succeeds. Sets or clears the \fBinvalid\fR state accordingly. See \fBVALIDATION\fR below for more details. .PP The entry widget also supports the following generic \fBttk::widget\fR widget subcommands (see \fIttk::widget(n)\fR for details): .DS .ta 5.5c 11c \fBcget\fR \fBconfigure\fR \fBidentify\fR \fBinstate\fR \fBstate\fR \fBxview\fR .DE .SH VALIDATION .PP The \fB\-validate\fR, \fB\-validatecommand\fR, and \fB\-invalidcommand\fR options are used to enable entry widget validation. .SS "VALIDATION MODES" .PP |
︙ | ︙ | |||
468 469 470 471 472 473 474 | Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBreadonly\fP. .PP \fBTEntry\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .RS | | > > < < | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | Dynamic states: \fBdisabled\fP, \fBfocus\fP, \fBreadonly\fP. .PP \fBTEntry\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP .RS For backwards compatibility, when using the aqua theme (for macOS), this option behaves as an alias for the \fB\-fieldbackground\fP provided that no value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored. .RE \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .RS Some themes use a graphical background and their field background colors cannot be changed. .RE \fB\-foreground\fP \fIcolor\fP .br \fB\-insertwidth\fP \fIamount\fP .br \fB\-lightcolor\fP \fIcolor\fP |
︙ | ︙ |
Changes to doc/ttk_frame.n.
︙ | ︙ | |||
54 55 56 57 58 59 60 61 62 63 64 65 66 67 | .PP \fB\-background\fP \fIcolor\fP .PP Some options are only available for specific themes. .PP See the \fBttk::style\fP manual page for information on how to configure ttk styles. .SH "SEE ALSO" ttk::widget(n), ttk::labelframe(n), frame(n) .SH "KEYWORDS" widget, frame, container '\" Local Variables: '\" mode: nroff '\" End: | > > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | .PP \fB\-background\fP \fIcolor\fP .PP Some options are only available for specific themes. .PP See the \fBttk::style\fP manual page for information on how to configure ttk styles. .SH BINDINGS .PP When a new \fBttk::frame\fR is created, it has no default event bindings; \fBttk::frame\fRs are not intended to be interactive. .SH "SEE ALSO" ttk::widget(n), ttk::labelframe(n), frame(n) .SH "KEYWORDS" widget, frame, container '\" Local Variables: '\" mode: nroff '\" End: |
Changes to doc/ttk_label.n.
︙ | ︙ | |||
14 15 16 17 18 19 20 | .BE .SH DESCRIPTION .PP A \fBttk::label\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO ttk_widget | | > | | < < < < < < < < < < < < < < < < | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | .BE .SH DESCRIPTION .PP A \fBttk::label\fR widget displays a textual label and/or image. The label may be linked to a Tcl variable to automatically change the displayed text. .SO ttk_widget \-anchor \-class \-compound \-cursor \-font \-foreground \-image \-justify \-padding \-state \-style \-takefocus \-text \-textvariable \-underline \-width \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-background frameColor FrameColor The widget's background color. If unspecified, the theme default is used. .OP \-relief relief Relief .\" Rewrite this: Specifies the 3-D effect desired for the widget border. Valid values are \fBflat\fR, \fBgroove\fR, \fBraised\fR, \fBridge\fR, \fBsolid\fR, and \fBsunken\fR. .OP \-wraplength wrapLength WrapLength |
︙ | ︙ |
Changes to doc/ttk_progressbar.n.
︙ | ︙ | |||
15 16 17 18 19 20 21 22 | .SH DESCRIPTION .PP A \fBttk::progressbar\fR widget shows the status of a long-running operation. They can operate in two modes: \fIdeterminate\fR mode shows the amount completed relative to the total amount of work to be done, and \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .SO ttk_widget | > > > > > > | | > | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | .SH DESCRIPTION .PP A \fBttk::progressbar\fR widget shows the status of a long-running operation. They can operate in two modes: \fIdeterminate\fR mode shows the amount completed relative to the total amount of work to be done, and \fIindeterminate\fR mode provides an animated display to let the user know that something is happening. .PP If the value of \fB-orient\fR is \fBhorizontal\fR a text string can be displayed inside the progressbar. This string can be configured using the \fB-anchor\fR, \fB-font\fR, \fB-foreground\fR, \fB-justify\fR, \fB-text\fR and \fB-wraplength\fR options. If the value of \fB-orient\fR is \fBvertical\fR then these options are ignored. .SO ttk_widget \-anchor \-class \-cursor \-font \-foreground \-justify \-style \-takefocus \-text \-wraplength .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-length length Length Specifies the length of the long axis of the progress bar (width if horizontal, height if vertical). The value may have any of the forms acceptable to \fBTk_GetPixels\fR. .OP \-maximum maximum Maximum A floating point number specifying the maximum \fB\-value\fR. Defaults to 100. .OP \-mode mode Mode One of \fBdeterminate\fR or \fBindeterminate\fR. .OP \-orient orient Orient One of \fBhorizontal\fR or \fBvertical\fR. |
︙ | ︙ |
Changes to doc/ttk_scale.n.
︙ | ︙ | |||
89 90 91 92 93 94 95 | \fIpathName \fBcoords \fR?\fIvalue\fR? . Get the coordinates corresponding to \fIvalue\fR, or the coordinates corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR is omitted. .SH "STYLING OPTIONS" .PP | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | \fIpathName \fBcoords \fR?\fIvalue\fR? . Get the coordinates corresponding to \fIvalue\fR, or the coordinates corresponding to the current value of the \fB\-value\fR option if \fIvalue\fR is omitted. .SH "STYLING OPTIONS" .PP The class name for a \fBttk::scale\fP is \fBTScale\fP. .PP Dynamic states: \fBactive\fP. .PP \fBTProgressbar\fP styling options configurable with \fBttk::style\fP are: .PP \fB\-background\fP \fIcolor\fP |
︙ | ︙ |
Changes to doc/ttk_scrollbar.n.
︙ | ︙ | |||
72 73 74 75 76 77 78 | \fIfirst\fR and \fIlast\fR are real fractions between 0 and 1. .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state; see \fIttk::widget(n)\fR. .SH "INTERNAL COMMANDS" .PP The following widget commands are used internally | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | \fIfirst\fR and \fIlast\fR are real fractions between 0 and 1. .TP \fIpathName \fBstate\fR ?\fIstateSpec\fR? Modify or query the widget state; see \fIttk::widget(n)\fR. .SH "INTERNAL COMMANDS" .PP The following widget commands are used internally by the \fBTScrollbar\fP widget class bindings. .TP \fIpathName \fBdelta \fIdeltaX deltaY\fR Returns a real number indicating the fractional change in the scrollbar setting that corresponds to a given change in thumb position. For example, if the scrollbar is horizontal, the result indicates how much the scrollbar setting must change to move the thumb \fIdeltaX\fR pixels to the right (\fIdeltaY\fR is |
︙ | ︙ | |||
114 115 116 117 118 119 120 | The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP | < < < < < < < < > > > > > > > > > | > | > > | > > | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | The widget should adjust its view so that the point given by \fIfraction\fR appears at the beginning of the widget. If \fIfraction\fR is 0 it refers to the beginning of the document. 1.0 refers to the end of the document, 0.333 refers to a point one-third of the way through the document, and so on. .TP \fIprefix \fBscroll \fInumber \fBpages\fR The widget should adjust its view by \fInumber\fR pages. It is up to the widget to define the meaning of a page; typically it is slightly less than what fits in the window, so that there is a slight overlap between the old and new views. \fINumber\fR is either 1, which means the next page should become visible, or \-1, which means that the previous page should become visible. .TP \fIprefix \fBscroll \fInumber \fBunits\fR The widget should adjust its view by \fInumber\fR units. The units are defined in whatever way makes sense for the widget, such as characters or lines in a text widget. \fINumber\fR is either 1, which means one unit should scroll off the top or left of the window, or \-1, which means that one unit should scroll off the bottom or right of the window. .SH "WIDGET STATES" .PP The scrollbar automatically sets the \fBdisabled\fR state bit. when the entire range is visible (range is 0.0 to 1.0), and clears it otherwise. It also sets the \fBactive\fR and \fBpressed\fR state flags of individual elements, based on the position and state of the mouse pointer. .SH EXAMPLE .PP .CS set f [frame .f] ttk::scrollbar $f.hsb \-orient horizontal \-command [list $f.t xview] ttk::scrollbar $f.vsb \-orient vertical \-command [list $f.t yview] text $f.t \-xscrollcommand [list $f.hsb set] \-yscrollcommand [list $f.vsb set] grid $f.t \-row 0 \-column 0 \-sticky nsew grid $f.vsb \-row 0 \-column 1 \-sticky nsew grid $f.hsb \-row 1 \-column 0 \-sticky nsew grid columnconfigure $f 0 \-weight 1 grid rowconfigure $f 0 \-weight 1 pack $f .CE .SH "STYLING OPTIONS" .PP The class name for a \fBttk::scrollbar\fP is \fBTScrollbar\fP. .PP Dynamic states: \fBactive\fP, \fBdisabled\fP. .PP \fBTScrollbar\fP (or more specifically \fBVertical.TScrollbar\fP and \fBHorizontal.TScrollbar\fP) styling options that are configurable with \fBttk::style\fP are: .PP \fB\-arrowcolor\fP \fIcolor\fP .br \fB\-arrowsize\fP \fIamount\fP .br \fB\-background\fP \fIcolor\fP .br \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP (color of the dark part of the 3D relief) .br \fB\-foreground\fP \fIcolor\fP .br \fB\-gripcount\fP \fIcount\fP (number of lines on the thumb) .br \fB\-lightcolor\fP \fIcolor\fP (color of the light part of the 3D relief) .br \fB\-troughcolor\fP \fIcolor\fP .PP Some options are only available for specific themes. .PP See the \fBttk::style\fP manual page for information on how to configure ttk styles. |
︙ | ︙ |
Changes to doc/ttk_spinbox.n.
︙ | ︙ | |||
18 19 20 21 22 23 24 | up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the \fBttk::entry\fR widget including support of the \fB\-textvariable\fR option to link the value displayed by the widget to a Tcl variable. .SO ttk_widget \-class \-cursor \-state \-style | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | up and down buttons that are used to either modify a numeric value or to select among a set of values. The widget implements all the features of the \fBttk::entry\fR widget including support of the \fB\-textvariable\fR option to link the value displayed by the widget to a Tcl variable. .SO ttk_widget \-class \-cursor \-state \-style \-takefocus \-xscrollcommand \-placeholder .SE .SO ttk_entry \-validate \-validatecommand .SE .SH "WIDGET-SPECIFIC OPTIONS" .OP \-command command Command Specifies a Tcl command to be invoked whenever a spinbutton is invoked. |
︙ | ︙ | |||
91 92 93 94 95 96 97 | .PP \fB\-arrowcolor\fP \fIcolor\fP .br \fB\-arrowsize\fP \fIamount\fP .br \fB\-background\fP \fIcolor\fP .RS | | > > | < < | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | .PP \fB\-arrowcolor\fP \fIcolor\fP .br \fB\-arrowsize\fP \fIamount\fP .br \fB\-background\fP \fIcolor\fP .RS For backwards compatibility, when using the aqua theme (for macOS), this option behaves as an alias for the \fB\-fieldbackground\fP provided that no value is specified for \fB\-fieldbackground\fP. Otherwise it is ignored. .RE \fB\-bordercolor\fP \fIcolor\fP .br \fB\-darkcolor\fP \fIcolor\fP .br \fB\-fieldbackground\fP \fIcolor\fP .br \fB\-foreground\fP \fIcolor\fP .br \fB\-lightcolor\fP \fIcolor\fP .br \fB\-padding\fP \fIpadding\fP .br \fB\-selectbackground\fP \fIcolor\fP |
︙ | ︙ |
Changes to doc/ttk_treeview.n.
︙ | ︙ | |||
129 130 131 132 133 134 135 | .RS .TP \fB\-id \fIname\fR The column name. This is a read-only option. For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR] returns the data column associated with display column #\fIn\fR. .TP | | | | | | | | > > | | > > | | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | .RS .TP \fB\-id \fIname\fR The column name. This is a read-only option. For example, [\fI$pathname \fBcolumn #\fIn \fB\-id\fR] returns the data column associated with display column #\fIn\fR. .TP \fB\-anchor \fIanchor\fR Specifies how the text in this column should be aligned with respect to the cell. \fIAnchor\fR is one of \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. .TP \fB\-minwidth \fIminwidth\fR The minimum width of the column in pixels. The treeview widget will not make the column any smaller than \fB\-minwidth\fR when the widget is resized or the user drags a column separator. Default is 20 pixels. .TP \fB\-stretch \fIboolean\fR Specifies whether or not the column width should be adjusted when the widget is resized or the user drags a column separator. \fIBoolean\fR may have any of the forms accepted by \fBTcl_GetBoolean\fR. By default columns are stretchable. .TP \fB\-width \fIwidth\fR The width of the column in pixels. Default is 200 pixels. The specified column width may be changed by Tk in order to honor \fB\-stretch\fR and/or \fB\-minwidth\fR, or when the widget is resized or the user drags a column separator. .PP Use \fIpathname column #0\fR to configure the tree column. .RE .TP \fIpathname \fBconfigure\fR ?\fIoption\fR? ?\fIvalue option value ...\fR? Modify or query widget options; see \fIttk::widget(n)\fR. .TP |
︙ | ︙ | |||
384 385 386 387 388 389 390 | .TP \fIpathName \fBtag remove \fItag\fR ?\fIitems\fR? Removes the specified \fItag\fR from each of the listed \fIitems\fR. If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree. If \fItag\fR is not present for a particular item, then the \fB\-tags\fR for that item are unchanged. .RE | | | | | > | < > | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | .TP \fIpathName \fBtag remove \fItag\fR ?\fIitems\fR? Removes the specified \fItag\fR from each of the listed \fIitems\fR. If \fIitems\fR is omitted, removes \fItag\fR from each item in the tree. If \fItag\fR is not present for a particular item, then the \fB\-tags\fR for that item are unchanged. .RE .PP The treeview widget also supports the following generic \fBttk::widget\fR widget subcommands (see \fIttk::widget(n)\fR for details): .DS .ta 5.5c 11c \fBxview\fR \fByview\fR .DE .SH "ITEM OPTIONS" .PP The following item options may be specified for items in the \fBinsert\fR and \fBitem\fR widget commands. .OP \-text text Text The textual label to display for the item. .OP \-image image Image |
︙ | ︙ | |||
430 431 432 433 434 435 436 437 438 439 440 441 442 443 | .\" ??? Maybe: .IP \-anchor .\" ??? Maybe: .IP \-padding .\" ??? Maybe: .IP \-text .IP \fB\-image\fR Specifies the item image, in case the item's \fB\-image\fR option is empty. .\" .PP .\" \fI(@@@ TODO: sort out order of precedence for options)\fR .SH "COLUMN IDENTIFIERS" .PP Column identifiers take any of the following forms: .IP \(bu A symbolic name from the list of \fB\-columns\fR. .IP \(bu An integer \fIn\fR, specifying the \fIn\fRth data column. | > > > | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | .\" ??? Maybe: .IP \-anchor .\" ??? Maybe: .IP \-padding .\" ??? Maybe: .IP \-text .IP \fB\-image\fR Specifies the item image, in case the item's \fB\-image\fR option is empty. .\" .PP .\" \fI(@@@ TODO: sort out order of precedence for options)\fR .PP Tag priority is decided by the creation order: tags created first receive higher priority. .SH "COLUMN IDENTIFIERS" .PP Column identifiers take any of the following forms: .IP \(bu A symbolic name from the list of \fB\-columns\fR. .IP \(bu An integer \fIn\fR, specifying the \fIn\fRth data column. |
︙ | ︙ |
Changes to doc/ttk_widget.n.
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | .RE .OP \-yscrollcommand yScrollCommand ScrollCommand A command prefix, used to communicate with vertical scrollbars. See the description of \fB\-xscrollcommand\fR above for details. .SH "LABEL OPTIONS" The following options are supported by labels, buttons, and other button-like widgets: .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. Valid values are: .RS .IP text Display text only. .IP image Display image only. .IP center Display text centered on top of image. .IP top .IP bottom .IP left .IP right Display image above, below, left of, or right of the text, respectively. .IP none The default; display the image if present, otherwise the text. .RE .OP \-image image Image Specifies an image to display. This is a list of 1 or more elements. The first element is the default image name. The rest of the list is a sequence of \fIstatespec / value\fR pairs as per \fBstyle map\fR, specifying different images to use when the widget is in a particular state or combination of states. All images in the list should have the same size. .OP \-padding padding Padding Specifies the internal padding for the widget. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. .OP \-text text Text Specifies a text string to be displayed inside the widget | > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | .RE .OP \-yscrollcommand yScrollCommand ScrollCommand A command prefix, used to communicate with vertical scrollbars. See the description of \fB\-xscrollcommand\fR above for details. .SH "LABEL OPTIONS" The following options are supported by labels, buttons, and other button-like widgets: .OP \-anchor anchor Anchor Specifies how the information in the widget is positioned relative to the inner margins. Legal values are \fBn\fR, \fBne\fR, \fBe\fR, \fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, and \fBcenter\fR. See also \fB\-justify\fR (for widgets supporting this option). .OP \-compound compound Compound Specifies how to display the image relative to the text, in the case both \fB\-text\fR and \fB\-image\fR are present. Valid values are: .RS .IP text Display text only. .IP image Display image only. .IP center Display text centered on top of image. .IP top .IP bottom .IP left .IP right Display image above, below, left of, or right of the text, respectively. .IP none The default; display the image if present, otherwise the text. .RE .OP \-font font Font Font to use for the text displayed by the widget. .OP \-foreground textColor TextColor The widget's foreground color. If unspecified, the theme default is used. .OP \-image image Image Specifies an image to display. This is a list of 1 or more elements. The first element is the default image name. The rest of the list is a sequence of \fIstatespec / value\fR pairs as per \fBstyle map\fR, specifying different images to use when the widget is in a particular state or combination of states. All images in the list should have the same size. .OP \-justify justify Justify If there are multiple lines of text, specifies how the lines are laid out relative to one another. One of \fBleft\fR, \fBcenter\fR, or \fBright\fR. See also \fB\-anchor\fR (for widgets supporting this option). .OP \-padding padding Padding Specifies the internal padding for the widget. The padding is a list of up to four length specifications \fIleft top right bottom\fR. If fewer than four elements are specified, \fIbottom\fR defaults to \fItop\fR, \fIright\fR defaults to \fIleft\fR, and \fItop\fR defaults to \fIleft\fR. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. .OP \-text text Text Specifies a text string to be displayed inside the widget (unless overridden by \fB\-textvariable\fR for the widgets supporting this option). .OP \-textvariable textVariable Variable Specifies the name of a global variable whose value will be used in place of the \fB\-text\fR resource. .OP \-underline underline Underline If set, specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation. .OP \-width width Width If greater than zero, specifies how much space, in character widths, to allocate for the text label. If less than zero, specifies a minimum width. If zero or unspecified, the natural width of the text label is used. Note that some themes may specify a non-zero \fB\-width\fR in the style. .OP \-wraplength wrapLength WrapLength Specifies the maximum line length. The value may have any of the forms acceptable to \fBTk_GetPixels\fR. If this option is less than or equal to zero, then automatic wrapping is not performed; otherwise the text is split into lines such that no line is longer than the specified value. .SH "ENTRY OPTIONS" The following option is supported by entry, spinbox and combobox: .OP \-placeholder placeHolder PlaceHolder Specifies a help text string to display if no text is otherwise displayed, that is when the widget is empty. The placeholder text is displayed using the values of the \fB\-font\fR and \fB\-justify\fR options. The foreground color of the placeholder text can be changed using the \fB\-placeholderforeground\fR style option. .SH "COMPATIBILITY OPTIONS" This option is only available for themed widgets that have .QW corresponding traditional Tk widgets. .OP \-state state State May be set to \fBnormal\fR or \fBdisabled\fR to control the \fBdisabled\fR state bit. |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 | set changes [\fIpathName \fRstate \fIspec\fR] \fIpathName \fRstate $changes .CE will restore \fIpathName\fR to the original state. If \fIstateSpec\fR is not specified, returns a list of the currently-enabled state flags. .RE .SH "WIDGET STATES" The widget state is a bitmap of independent state flags. Widget state flags include: .TP \fBactive\fR . The mouse cursor is over the widget | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | set changes [\fIpathName \fRstate \fIspec\fR] \fIpathName \fRstate $changes .CE will restore \fIpathName\fR to the original state. If \fIstateSpec\fR is not specified, returns a list of the currently-enabled state flags. .RE .TP \fIpathName \fBxview \fIargs\fR This command is used to query and change the horizontal position of the content in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fBxview\fR Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the horizontal span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the widget's content is off-screen to the left, the middle 40% is visible in the window, and 40% of the content is off-screen to the right. These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR option. .TP \fIpathName \fBxview\fR \fIindex\fR Adjusts the view in the window so that the content given by \fIindex\fR is displayed at the left edge of the window. .TP \fIpathName \fBxview moveto\fI fraction\fR Adjusts the view in the window so that the character \fIfraction\fR of the way through the content appears at the left edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fBxview scroll \fInumber what\fR This command shifts the view in the window left or right according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. '\" or an abbreviation of one of these, but we don't document that. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then characters farther to the left become visible; if it is positive then characters farther to the right become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts left or right by \fInumber\fR average-width characters on the display. .RE .TP \fIpathName \fByview \fIargs\fR This command is used to query and change the vertical position of the content in the widget's window. It can take any of the following forms: .RS .TP \fIpathName \fByview\fR Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the vertical span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the widget's content is off-screen to the top, the middle 40% is visible in the window, and 40% of the content is off-screen to the bottom. These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR option. .TP \fIpathName \fByview\fR \fIindex\fR Adjusts the view in the window so that the content given by \fIindex\fR is displayed at the top edge of the window. .TP \fIpathName \fByview moveto\fI fraction\fR Adjusts the view in the window so that the item \fIfraction\fR of the way through the content appears at the top edge of the window. \fIFraction\fR must be a fraction between 0 and 1. .TP \fIpathName \fByview scroll \fInumber what\fR This command shifts the view in the window up or down according to \fInumber\fR and \fIwhat\fR. \fINumber\fR must be an integer. \fIWhat\fR must be either \fBpages\fR or \fBunits\fR. '\" or an abbreviation of one of these, but we don't document that. If \fIwhat\fR is \fBpages\fR then the view adjusts by \fInumber\fR screenfuls. If \fInumber\fR is negative then items farther to the top become visible; if it is positive then items farther to the bottom become visible. If \fIwhat\fR is \fBunits\fR, the view adjusts up or down by \fInumber\fR average-width characters on the display. .RE .SH "WIDGET STATES" The widget state is a bitmap of independent state flags. Widget state flags include: .TP \fBactive\fR . The mouse cursor is over the widget |
︙ | ︙ |
Changes to doc/winfo.n.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1990-1994 The Regents of the University of California. '\" 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. '\" .TH winfo n 4.3 Tk "Tk Built-In Commands" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME winfo \- Return window-related information .SH SYNOPSIS |
︙ | ︙ |
Changes to doc/wish.1.
1 2 3 4 5 6 | '\" '\" Copyright (c) 1991-1994 The Regents of the University of California. '\" 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. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | '\" '\" Copyright (c) 1991-1994 The Regents of the University of California. '\" 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. '\" .TH wish 1 8.0 Tk "Tk Applications" .so man.macros .BS '\" Note: do not modify the .SH NAME line immediately below! .SH NAME wish \- Simple windowing shell .SH SYNOPSIS |
︙ | ︙ | |||
73 74 75 76 77 78 79 | It will continue processing commands until all windows have been deleted or until end-of-file is reached on standard input. If there exists a file .QW \fB.wishrc\fR in the home directory of the user, \fBwish\fR evaluates the file as a Tcl script just before reading the first command from standard input. .PP | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | It will continue processing commands until all windows have been deleted or until end-of-file is reached on standard input. If there exists a file .QW \fB.wishrc\fR in the home directory of the user, \fBwish\fR evaluates the file as a Tcl script just before reading the first command from standard input. .PP If arguments to \fBwish\fR do specify a \fIfileName\fR, then \fIfileName\fR is treated as the name of a script file. \fBWish\fR will evaluate the script in \fIfileName\fR (which presumably creates a user interface), then it will respond to events until all windows have been deleted. Commands will not be read from standard input. There is no automatic evaluation of .QW \fB.wishrc\fR |
︙ | ︙ |
Changes to doc/wm.n.
︙ | ︙ | |||
490 491 492 493 494 495 496 | .PP On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | .PP On Macintosh, the first image called is loaded into an OSX-native icon format, and becomes the application icon in dialogs, the Dock, and other contexts. At the script level the command will accept only the first image passed in the parameters as support for multiple sizes/resolutions on macOS is outside Tk's scope. Developers should use the largest icon they can support (preferably 512 pixels) to ensure smooth rendering on the Mac. .RE .TP \fBwm iconposition \fIwindow\fR ?\fIx y\fR? . If \fIx\fR and \fIy\fR are specified, they are passed to the window manager as a hint about where to position the icon for \fIwindow\fR. In this case an empty string is returned. If \fIx\fR and \fIy\fR are |
︙ | ︙ | |||
706 707 708 709 710 711 712 | should display this string in \fIwindow\fR's title bar). In this case the command returns an empty string. If \fIstring\fR is not specified then the command returns the current title for the \fIwindow\fR. The title for a window defaults to its name. .TP \fBwm transient \fIwindow\fR ?\fImaster\fR? . | | | | | < | | | | | > | | > | | | 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 | should display this string in \fIwindow\fR's title bar). In this case the command returns an empty string. If \fIstring\fR is not specified then the command returns the current title for the \fIwindow\fR. The title for a window defaults to its name. .TP \fBwm transient \fIwindow\fR ?\fImaster\fR? . If \fImaster\fR is specified, then the window manager is informed that \fIwindow\fR is a transient window (e.g. pull-down menu) working on behalf of \fImaster\fR (where \fImaster\fR is the path name for a top-level window). If \fImaster\fR is specified as an empty string then \fIwindow\fR is marked as not being a transient window any more. Otherwise the command returns the path name of \fIwindow\fR's current master, or an empty string if \fIwindow\fR is not currently a transient window. A transient window will mirror state changes in the master and inherit the state of the master when initially mapped. The directed graph with an edge from each transient to its master must be acyclic. In particular, it is an error to attempt to make a window a transient of itself. The window manager may also decorate a transient window differently, removing some features normally present (e.g., minimize and maximize buttons) though this is entirely at the discretion of the window manager. .TP \fBwm withdraw \fIwindow\fR . Arranges for \fIwindow\fR to be withdrawn from the screen. This causes the window to be unmapped and forgotten about by the window manager. If the window has never been mapped, then this command |
︙ | ︙ |
Added generic/nanosvg.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 | /* * Copyright (c) 2013-14 Mikko Mononen [email protected] * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * The SVG parser is based on Anti-Grain Geometry 2.4 SVG example * Copyright (C) 2002-2004 Maxim Shemanarev (McSeem) (http://www.antigrain.com/) * * Arc calculation code based on canvg (https://code.google.com/p/canvg/) * * Bounding box calculation based on http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html * */ #ifndef NANOSVG_H #define NANOSVG_H #ifdef __cplusplus extern "C" { #endif // NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes. // // The library suits well for anything from rendering scalable icons in your editor application to prototyping a game. // // NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request! // // The shapes in the SVG images are transformed by the viewBox and converted to specified units. // That is, you should get the same looking data as your designed in your favorite app. // // NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose // to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. // // The units passed to NanoVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. // DPI (dots-per-inch) controls how the unit conversion is done. // // If you don't know or care about the units stuff, "px" and 96 should get you going. /* Example Usage: // Load NSVGImage* image; image = nsvgParseFromFile("test.svg", "px", 96); printf("size: %f x %f\n", image->width, image->height); // Use... for (NSVGshape *shape = image->shapes; shape != NULL; shape = shape->next) { for (NSVGpath *path = shape->paths; path != NULL; path = path->next) { for (int i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; drawCubicBez(p[0],p[1], p[2],p[3], p[4],p[5], p[6],p[7]); } } } // Delete nsvgDelete(image); */ #ifndef NANOSVG_SCOPE #define NANOSVG_SCOPE #endif #ifndef NANOSVG_malloc #define NANOSVG_malloc malloc #endif #ifndef NANOSVG_realloc #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif // float emulation for MS VC6++ compiler #if (_MSC_VER == 1200) #define tanf(a) (float)tan(a) #define cosf(a) (float)cos(a) #define sinf(a) (float)sin(a) #define sqrtf(a) (float)sqrt(a) #define fabsf(a) (float)abs(a) #define acosf(a) (float)acos(a) #define atan2f(a,b) (float)atan2(a,b) #define ceilf(a) (float)ceil(a) #define fmodf(a,b) (float)fmod(a,b) #define floorf(a) (float)floor(a) #endif enum NSVGpaintType { NSVG_PAINT_NONE = 0, NSVG_PAINT_COLOR = 1, NSVG_PAINT_LINEAR_GRADIENT = 2, NSVG_PAINT_RADIAL_GRADIENT = 3 }; enum NSVGspreadType { NSVG_SPREAD_PAD = 0, NSVG_SPREAD_REFLECT = 1, NSVG_SPREAD_REPEAT = 2 }; enum NSVGlineJoin { NSVG_JOIN_MITER = 0, NSVG_JOIN_ROUND = 1, NSVG_JOIN_BEVEL = 2 }; enum NSVGlineCap { NSVG_CAP_BUTT = 0, NSVG_CAP_ROUND = 1, NSVG_CAP_SQUARE = 2 }; enum NSVGfillRule { NSVG_FILLRULE_NONZERO = 0, NSVG_FILLRULE_EVENODD = 1 }; enum NSVGflags { NSVG_FLAGS_VISIBLE = 0x01 }; typedef struct NSVGgradientStop { unsigned int color; float offset; } NSVGgradientStop; typedef struct NSVGgradient { float xform[6]; char spread; float fx, fy; int nstops; NSVGgradientStop stops[1]; } NSVGgradient; typedef struct NSVGpaint { char type; union { unsigned int color; NSVGgradient* gradient; }; } NSVGpaint; typedef struct NSVGpath { float* pts; // Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... int npts; // Total number of bezier points. char closed; // Flag indicating if shapes should be treated as closed. float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy]. struct NSVGpath* next; // Pointer to next path, or NULL if last element. } NSVGpath; typedef struct NSVGshape { char id[64]; // Optional 'id' attr of the shape or its group NSVGpaint fill; // Fill paint NSVGpaint stroke; // Stroke paint float opacity; // Opacity of the shape. float strokeWidth; // Stroke width (scaled). float strokeDashOffset; // Stroke dash offset (scaled). float strokeDashArray[8]; // Stroke dash array (scaled). char strokeDashCount; // Number of dash values in dash array. char strokeLineJoin; // Stroke join type. char strokeLineCap; // Stroke cap type. float miterLimit; // Miter limit char fillRule; // Fill rule, see NSVGfillRule. unsigned char flags; // Logical or of NSVG_FLAGS_* flags float bounds[4]; // Tight bounding box of the shape [minx,miny,maxx,maxy]. NSVGpath* paths; // Linked list of paths in the image. struct NSVGshape* next; // Pointer to next shape, or NULL if last element. } NSVGshape; typedef struct NSVGimage { float width; // Width of the image. float height; // Height of the image. NSVGshape* shapes; // Linked list of shapes in the image. } NSVGimage; // Parses SVG file from a file, returns SVG image as paths. NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi); // Parses SVG file from a null terminated string, returns SVG image as paths. // Important note: changes the string. NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi); // Deletes list of paths. NANOSVG_SCOPE void nsvgDelete(NSVGimage* image); #ifdef __cplusplus } #endif #endif // NANOSVG_H #ifdef NANOSVG_IMPLEMENTATION #include <string.h> #include <stdlib.h> #include <math.h> #define NSVG_PI (3.14159265358979323846264338327f) #define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs. #define NSVG_ALIGN_MIN 0 #define NSVG_ALIGN_MID 1 #define NSVG_ALIGN_MAX 2 #define NSVG_ALIGN_NONE 0 #define NSVG_ALIGN_MEET 1 #define NSVG_ALIGN_SLICE 2 #define NSVG_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0) #define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16)) #ifdef _MSC_VER #pragma warning (disable: 4996) // Switch off security warnings #pragma warning (disable: 4100) // Switch off unreferenced formal parameter warnings #ifdef __cplusplus #define NSVG_INLINE inline #else #define NSVG_INLINE #endif #if !defined(strtoll) // old MSVC versions do not have strtoll() #define strtoll _strtoi64 #endif #else #define NSVG_INLINE inline #endif static int nsvg__isspace(char c) { return strchr(" \t\n\v\f\r", c) != 0; } static int nsvg__isdigit(char c) { return c >= '0' && c <= '9'; } static int nsvg__isnum(char c) { return strchr("0123456789+-.eE", c) != 0; } static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } // Simple XML parser #define NSVG_XML_TAG 1 #define NSVG_XML_CONTENT 2 #define NSVG_XML_MAX_ATTRIBS 256 static void nsvg__parseContent(char* s, void (*contentCb)(void* ud, const char* s), void* ud) { // Trim start white spaces while (*s && nsvg__isspace(*s)) s++; if (!*s) return; if (contentCb) (*contentCb)(ud, s); } static void nsvg__parseElement(char* s, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void* ud) { const char* attr[NSVG_XML_MAX_ATTRIBS]; int nattr = 0; char* name; int start = 0; int end = 0; char quote; // Skip white space after the '<' while (*s && nsvg__isspace(*s)) s++; // Check if the tag is end tag if (*s == '/') { s++; end = 1; } else { start = 1; } // Skip comments, data and preprocessor stuff. if (!*s || *s == '?' || *s == '!') return; // Get tag name name = s; while (*s && !nsvg__isspace(*s)) s++; if (*s) { *s++ = '\0'; } // Get attribs while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) { char* name = NULL; char* value = NULL; // Skip white space before the attrib name while (*s && nsvg__isspace(*s)) s++; if (!*s) break; if (*s == '/') { end = 1; break; } name = s; // Find end of the attrib name. while (*s && !nsvg__isspace(*s) && *s != '=') s++; if (*s) { *s++ = '\0'; } // Skip until the beginning of the value. while (*s && *s != '\"' && *s != '\'') s++; if (!*s) break; quote = *s; s++; // Store value and find the end of it. value = s; while (*s && *s != quote) s++; if (*s) { *s++ = '\0'; } // Store only well formed attributes if (name && value) { attr[nattr++] = name; attr[nattr++] = value; } } // List terminator attr[nattr++] = 0; attr[nattr++] = 0; // Call callbacks. if (start && startelCb) (*startelCb)(ud, name, attr); if (end && endelCb) (*endelCb)(ud, name); } NANOSVG_SCOPE int nsvg__parseXML(char* input, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void (*contentCb)(void* ud, const char* s), void* ud) { char* s = input; char* mark = s; int state = NSVG_XML_CONTENT; while (*s) { if (*s == '<' && state == NSVG_XML_CONTENT) { // Start of a tag *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); mark = s; state = NSVG_XML_TAG; } else if (*s == '>' && state == NSVG_XML_TAG) { // Start of a content or new tag. *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); nsvg__parseElement(mark, startelCb, endelCb, ud); mark = s; state = NSVG_XML_CONTENT; } else { s++; } } return 1; } /* Simple SVG parser. */ #define NSVG_MAX_ATTR 128 enum NSVGgradientUnits { NSVG_USER_SPACE = 0, NSVG_OBJECT_SPACE = 1 }; #define NSVG_MAX_DASHES 8 enum NSVGunits { NSVG_UNITS_USER, NSVG_UNITS_PX, NSVG_UNITS_PT, NSVG_UNITS_PC, NSVG_UNITS_MM, NSVG_UNITS_CM, NSVG_UNITS_IN, NSVG_UNITS_PERCENT, NSVG_UNITS_EM, NSVG_UNITS_EX }; enum NSVGvisible { NSVG_VIS_DISPLAY = 1, NSVG_VIS_VISIBLE = 2 }; typedef struct NSVGcoordinate { float value; int units; } NSVGcoordinate; typedef struct NSVGlinearData { NSVGcoordinate x1, y1, x2, y2; } NSVGlinearData; typedef struct NSVGradialData { NSVGcoordinate cx, cy, r, fx, fy; } NSVGradialData; typedef struct NSVGgradientData { char id[64]; char ref[64]; char type; union { NSVGlinearData linear; NSVGradialData radial; }; char spread; char units; float xform[6]; int nstops; NSVGgradientStop* stops; struct NSVGgradientData* next; } NSVGgradientData; typedef struct NSVGattrib { char id[64]; float xform[6]; unsigned int fillColor; unsigned int strokeColor; float opacity; float fillOpacity; float strokeOpacity; char fillGradient[64]; char strokeGradient[64]; float strokeWidth; float strokeDashOffset; float strokeDashArray[NSVG_MAX_DASHES]; int strokeDashCount; char strokeLineJoin; char strokeLineCap; float miterLimit; char fillRule; float fontSize; unsigned int stopColor; float stopOpacity; float stopOffset; char hasFill; char hasStroke; char visible; } NSVGattrib; typedef struct NSVGstyles { char* name; char* description; struct NSVGstyles* next; } NSVGstyles; typedef struct NSVGparser { NSVGattrib attr[NSVG_MAX_ATTR]; int attrHead; float* pts; int npts; int cpts; NSVGpath* plist; NSVGimage* image; NSVGstyles* styles; NSVGgradientData* gradients; NSVGshape* shapesTail; float viewMinx, viewMiny, viewWidth, viewHeight; int alignX, alignY, alignType; float dpi; char pathFlag; char defsFlag; char styleFlag; } NSVGparser; static void nsvg__xformIdentity(float* t) { t[0] = 1.0f; t[1] = 0.0f; t[2] = 0.0f; t[3] = 1.0f; t[4] = 0.0f; t[5] = 0.0f; } static void nsvg__xformSetTranslation(float* t, float tx, float ty) { t[0] = 1.0f; t[1] = 0.0f; t[2] = 0.0f; t[3] = 1.0f; t[4] = tx; t[5] = ty; } static void nsvg__xformSetScale(float* t, float sx, float sy) { t[0] = sx; t[1] = 0.0f; t[2] = 0.0f; t[3] = sy; t[4] = 0.0f; t[5] = 0.0f; } static void nsvg__xformSetSkewX(float* t, float a) { t[0] = 1.0f; t[1] = 0.0f; t[2] = tanf(a); t[3] = 1.0f; t[4] = 0.0f; t[5] = 0.0f; } static void nsvg__xformSetSkewY(float* t, float a) { t[0] = 1.0f; t[1] = tanf(a); t[2] = 0.0f; t[3] = 1.0f; t[4] = 0.0f; t[5] = 0.0f; } static void nsvg__xformSetRotation(float* t, float a) { float cs = cosf(a), sn = sinf(a); t[0] = cs; t[1] = sn; t[2] = -sn; t[3] = cs; t[4] = 0.0f; t[5] = 0.0f; } static void nsvg__xformMultiply(float* t, float* s) { float t0 = t[0] * s[0] + t[1] * s[2]; float t2 = t[2] * s[0] + t[3] * s[2]; float t4 = t[4] * s[0] + t[5] * s[2] + s[4]; t[1] = t[0] * s[1] + t[1] * s[3]; t[3] = t[2] * s[1] + t[3] * s[3]; t[5] = t[4] * s[1] + t[5] * s[3] + s[5]; t[0] = t0; t[2] = t2; t[4] = t4; } static void nsvg__xformInverse(float* inv, float* t) { double invdet, det = (double)t[0] * t[3] - (double)t[2] * t[1]; if (det > -1e-6 && det < 1e-6) { nsvg__xformIdentity(t); return; } invdet = 1.0 / det; inv[0] = (float)(t[3] * invdet); inv[2] = (float)(-t[2] * invdet); inv[4] = (float)(((double)t[2] * t[5] - (double)t[3] * t[4]) * invdet); inv[1] = (float)(-t[1] * invdet); inv[3] = (float)(t[0] * invdet); inv[5] = (float)(((double)t[1] * t[4] - (double)t[0] * t[5]) * invdet); } static void nsvg__xformPremultiply(float* t, float* s) { float s2[6]; memcpy(s2, s, sizeof(float)*6); nsvg__xformMultiply(s2, t); memcpy(t, s2, sizeof(float)*6); } static void nsvg__xformPoint(float* dx, float* dy, float x, float y, float* t) { *dx = x*t[0] + y*t[2] + t[4]; *dy = x*t[1] + y*t[3] + t[5]; } static void nsvg__xformVec(float* dx, float* dy, float x, float y, float* t) { *dx = x*t[0] + y*t[2]; *dy = x*t[1] + y*t[3]; } #define NSVG_EPSILON (1e-12) static int nsvg__ptInBounds(float* pt, float* bounds) { return pt[0] >= bounds[0] && pt[0] <= bounds[2] && pt[1] >= bounds[1] && pt[1] <= bounds[3]; } static double nsvg__evalBezier(double t, double p0, double p1, double p2, double p3) { double it = 1.0-t; return it*it*it*p0 + 3.0*it*it*t*p1 + 3.0*it*t*t*p2 + t*t*t*p3; } static void nsvg__curveBounds(float* bounds, float* curve) { int i, j, count; double roots[2], a, b, c, b2ac, t, v; float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; // Start the bounding box by end points bounds[0] = nsvg__minf(v0[0], v3[0]); bounds[1] = nsvg__minf(v0[1], v3[1]); bounds[2] = nsvg__maxf(v0[0], v3[0]); bounds[3] = nsvg__maxf(v0[1], v3[1]); // Bezier curve fits inside the convex hull of it's control points. // If control points are inside the bounds, we're done. if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds)) return; // Add bezier curve inflection points in X and Y. for (i = 0; i < 2; i++) { a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i]; b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i]; c = 3.0 * v1[i] - 3.0 * v0[i]; count = 0; if (fabs(a) < NSVG_EPSILON) { if (fabs(b) > NSVG_EPSILON) { t = -c / b; if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON) roots[count++] = t; } } else { b2ac = b*b - 4.0*c*a; if (b2ac > NSVG_EPSILON) { t = (-b + sqrt(b2ac)) / (2.0 * a); if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON) roots[count++] = t; t = (-b - sqrt(b2ac)) / (2.0 * a); if (t > NSVG_EPSILON && t < 1.0-NSVG_EPSILON) roots[count++] = t; } } for (j = 0; j < count; j++) { v = nsvg__evalBezier(roots[j], v0[i], v1[i], v2[i], v3[i]); bounds[0+i] = nsvg__minf(bounds[0+i], (float)v); bounds[2+i] = nsvg__maxf(bounds[2+i], (float)v); } } } static NSVGparser* nsvg__createParser() { NSVGparser* p; p = (NSVGparser*)NANOSVG_malloc(sizeof(NSVGparser)); if (p == NULL) goto error; memset(p, 0, sizeof(NSVGparser)); p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); // Init style nsvg__xformIdentity(p->attr[0].xform); memset(p->attr[0].id, 0, sizeof p->attr[0].id); p->attr[0].fillColor = NSVG_RGB(0,0,0); p->attr[0].strokeColor = NSVG_RGB(0,0,0); p->attr[0].opacity = 1; p->attr[0].fillOpacity = 1; p->attr[0].strokeOpacity = 1; p->attr[0].stopOpacity = 1; p->attr[0].strokeWidth = 1; p->attr[0].strokeLineJoin = NSVG_JOIN_MITER; p->attr[0].strokeLineCap = NSVG_CAP_BUTT; p->attr[0].miterLimit = 4; p->attr[0].fillRule = NSVG_FILLRULE_NONZERO; p->attr[0].hasFill = 1; p->attr[0].visible = NSVG_VIS_DISPLAY | NSVG_VIS_VISIBLE; return p; error: if (p) { if (p->image) NANOSVG_free(p->image); NANOSVG_free(p); } return NULL; } static void nsvg__deleteStyles(NSVGstyles* style) { while (style) { NSVGstyles *next = style->next; if (style->name!= NULL) free(style->name); if (style->description != NULL) free(style->description); free(style); style = next; } } static void nsvg__deletePaths(NSVGpath* path) { while (path) { NSVGpath *next = path->next; if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); path = next; } } static void nsvg__deletePaint(NSVGpaint* paint) { if (paint->type == NSVG_PAINT_LINEAR_GRADIENT || paint->type == NSVG_PAINT_RADIAL_GRADIENT) NANOSVG_free(paint->gradient); } static void nsvg__deleteGradientData(NSVGgradientData* grad) { NSVGgradientData* next; while (grad != NULL) { next = grad->next; NANOSVG_free(grad->stops); NANOSVG_free(grad); grad = next; } } static void nsvg__deleteParser(NSVGparser* p) { if (p != NULL) { nsvg__deleteStyles(p->styles); nsvg__deletePaths(p->plist); nsvg__deleteGradientData(p->gradients); nsvgDelete(p->image); NANOSVG_free(p->pts); NANOSVG_free(p); } } static void nsvg__resetPath(NSVGparser* p) { p->npts = 0; } static void nsvg__addPoint(NSVGparser* p, float x, float y) { if (p->npts+1 > p->cpts) { p->cpts = p->cpts ? p->cpts*2 : 8; p->pts = (float*)NANOSVG_realloc(p->pts, p->cpts*2*sizeof(float)); if (!p->pts) return; } p->pts[p->npts*2+0] = x; p->pts[p->npts*2+1] = y; p->npts++; } static void nsvg__moveTo(NSVGparser* p, float x, float y) { if (p->npts > 0) { p->pts[(p->npts-1)*2+0] = x; p->pts[(p->npts-1)*2+1] = y; } else { nsvg__addPoint(p, x, y); } } static void nsvg__lineTo(NSVGparser* p, float x, float y) { float px,py, dx,dy; if (p->npts > 0) { px = p->pts[(p->npts-1)*2+0]; py = p->pts[(p->npts-1)*2+1]; dx = x - px; dy = y - py; nsvg__addPoint(p, px + dx/3.0f, py + dy/3.0f); nsvg__addPoint(p, x - dx/3.0f, y - dy/3.0f); nsvg__addPoint(p, x, y); } } static void nsvg__cubicBezTo(NSVGparser* p, float cpx1, float cpy1, float cpx2, float cpy2, float x, float y) { nsvg__addPoint(p, cpx1, cpy1); nsvg__addPoint(p, cpx2, cpy2); nsvg__addPoint(p, x, y); } static NSVGattrib* nsvg__getAttr(NSVGparser* p) { return &p->attr[p->attrHead]; } static void nsvg__pushAttr(NSVGparser* p) { if (p->attrHead < NSVG_MAX_ATTR-1) { p->attrHead++; memcpy(&p->attr[p->attrHead], &p->attr[p->attrHead-1], sizeof(NSVGattrib)); } } static void nsvg__popAttr(NSVGparser* p) { if (p->attrHead > 0) p->attrHead--; } static float nsvg__actualOrigX(NSVGparser* p) { return p->viewMinx; } static float nsvg__actualOrigY(NSVGparser* p) { return p->viewMiny; } static float nsvg__actualWidth(NSVGparser* p) { return p->viewWidth; } static float nsvg__actualHeight(NSVGparser* p) { return p->viewHeight; } static float nsvg__actualLength(NSVGparser* p) { float w = nsvg__actualWidth(p), h = nsvg__actualHeight(p); return sqrtf(w*w + h*h) / sqrtf(2.0f); } static float nsvg__convertToPixels(NSVGparser* p, NSVGcoordinate c, float orig, float length) { NSVGattrib* attr = nsvg__getAttr(p); switch (c.units) { case NSVG_UNITS_USER: return c.value; case NSVG_UNITS_PX: return c.value; case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi; case NSVG_UNITS_PC: return c.value / 6.0f * p->dpi; case NSVG_UNITS_MM: return c.value / 25.4f * p->dpi; case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi; case NSVG_UNITS_IN: return c.value * p->dpi; case NSVG_UNITS_EM: return c.value * attr->fontSize; case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; // x-height of Helvetica. case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length; default: return c.value; } return c.value; } static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) { NSVGgradientData* grad = p->gradients; while (grad) { if (strcmp(grad->id, id) == 0) return grad; grad = grad->next; } return NULL; } static NSVGgradient* nsvg__createGradient(NSVGparser* p, const char* id, const float* localBounds, char* paintType) { NSVGattrib* attr = nsvg__getAttr(p); NSVGgradientData* data = NULL; NSVGgradientData* ref = NULL; NSVGgradientStop* stops = NULL; NSVGgradient* grad; float ox, oy, sw, sh, sl; int nstops = 0; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; // TODO: use ref to fill in all unset values too. ref = data; while (ref != NULL) { if (stops == NULL && ref->stops != NULL) { stops = ref->stops; nstops = ref->nstops; break; } ref = nsvg__findGradientData(p, ref->ref); } if (stops == NULL) return NULL; grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1)); if (grad == NULL) return NULL; // The shape width and height. if (data->units == NSVG_OBJECT_SPACE) { ox = localBounds[0]; oy = localBounds[1]; sw = localBounds[2] - localBounds[0]; sh = localBounds[3] - localBounds[1]; } else { ox = nsvg__actualOrigX(p); oy = nsvg__actualOrigY(p); sw = nsvg__actualWidth(p); sh = nsvg__actualHeight(p); } sl = sqrtf(sw*sw + sh*sh) / sqrtf(2.0f); if (data->type == NSVG_PAINT_LINEAR_GRADIENT) { float x1, y1, x2, y2, dx, dy; x1 = nsvg__convertToPixels(p, data->linear.x1, ox, sw); y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh); x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw); y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh); // Calculate transform aligned to the line dx = x2 - x1; dy = y2 - y1; grad->xform[0] = dy; grad->xform[1] = -dx; grad->xform[2] = dx; grad->xform[3] = dy; grad->xform[4] = x1; grad->xform[5] = y1; } else { float cx, cy, fx, fy, r; cx = nsvg__convertToPixels(p, data->radial.cx, ox, sw); cy = nsvg__convertToPixels(p, data->radial.cy, oy, sh); fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw); fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh); r = nsvg__convertToPixels(p, data->radial.r, 0, sl); // Calculate transform aligned to the circle grad->xform[0] = r; grad->xform[1] = 0; grad->xform[2] = 0; grad->xform[3] = r; grad->xform[4] = cx; grad->xform[5] = cy; grad->fx = fx / r; grad->fy = fy / r; } nsvg__xformMultiply(grad->xform, data->xform); nsvg__xformMultiply(grad->xform, attr->xform); grad->spread = data->spread; memcpy(grad->stops, stops, nstops*sizeof(NSVGgradientStop)); grad->nstops = nstops; *paintType = data->type; return grad; } static float nsvg__getAverageScale(float* t) { float sx = sqrtf(t[0]*t[0] + t[2]*t[2]); float sy = sqrtf(t[1]*t[1] + t[3]*t[3]); return (sx + sy) * 0.5f; } static void nsvg__getLocalBounds(float* bounds, NSVGshape *shape, float* xform) { NSVGpath* path; float curve[4*2], curveBounds[4]; int i, first = 1; for (path = shape->paths; path != NULL; path = path->next) { nsvg__xformPoint(&curve[0], &curve[1], path->pts[0], path->pts[1], xform); for (i = 0; i < path->npts-1; i += 3) { nsvg__xformPoint(&curve[2], &curve[3], path->pts[(i+1)*2], path->pts[(i+1)*2+1], xform); nsvg__xformPoint(&curve[4], &curve[5], path->pts[(i+2)*2], path->pts[(i+2)*2+1], xform); nsvg__xformPoint(&curve[6], &curve[7], path->pts[(i+3)*2], path->pts[(i+3)*2+1], xform); nsvg__curveBounds(curveBounds, curve); if (first) { bounds[0] = curveBounds[0]; bounds[1] = curveBounds[1]; bounds[2] = curveBounds[2]; bounds[3] = curveBounds[3]; first = 0; } else { bounds[0] = nsvg__minf(bounds[0], curveBounds[0]); bounds[1] = nsvg__minf(bounds[1], curveBounds[1]); bounds[2] = nsvg__maxf(bounds[2], curveBounds[2]); bounds[3] = nsvg__maxf(bounds[3], curveBounds[3]); } curve[0] = curve[6]; curve[1] = curve[7]; } } } static void nsvg__addShape(NSVGparser* p) { NSVGattrib* attr = nsvg__getAttr(p); float scale = 1.0f; NSVGshape* shape; NSVGpath* path; int i; if (p->plist == NULL) return; shape = (NSVGshape*)NANOSVG_malloc(sizeof(NSVGshape)); if (shape == NULL) goto error; memset(shape, 0, sizeof(NSVGshape)); memcpy(shape->id, attr->id, sizeof shape->id); scale = nsvg__getAverageScale(attr->xform); shape->strokeWidth = attr->strokeWidth * scale; shape->strokeDashOffset = attr->strokeDashOffset * scale; shape->strokeDashCount = (char)attr->strokeDashCount; for (i = 0; i < attr->strokeDashCount; i++) shape->strokeDashArray[i] = attr->strokeDashArray[i] * scale; shape->strokeLineJoin = attr->strokeLineJoin; shape->strokeLineCap = attr->strokeLineCap; shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; // Calculate shape bounds shape->bounds[0] = shape->paths->bounds[0]; shape->bounds[1] = shape->paths->bounds[1]; shape->bounds[2] = shape->paths->bounds[2]; shape->bounds[3] = shape->paths->bounds[3]; for (path = shape->paths->next; path != NULL; path = path->next) { shape->bounds[0] = nsvg__minf(shape->bounds[0], path->bounds[0]); shape->bounds[1] = nsvg__minf(shape->bounds[1], path->bounds[1]); shape->bounds[2] = nsvg__maxf(shape->bounds[2], path->bounds[2]); shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]); } // Set fill if (attr->hasFill == 0) { shape->fill.type = NSVG_PAINT_NONE; } else if (attr->hasFill == 1) { shape->fill.type = NSVG_PAINT_COLOR; shape->fill.color = attr->fillColor; shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24; } else if (attr->hasFill == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->fill.gradient = nsvg__createGradient(p, attr->fillGradient, localBounds, &shape->fill.type); if (shape->fill.gradient == NULL) { shape->fill.type = NSVG_PAINT_NONE; } } // Set stroke if (attr->hasStroke == 0) { shape->stroke.type = NSVG_PAINT_NONE; } else if (attr->hasStroke == 1) { shape->stroke.type = NSVG_PAINT_COLOR; shape->stroke.color = attr->strokeColor; shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24; } else if (attr->hasStroke == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->stroke.gradient = nsvg__createGradient(p, attr->strokeGradient, localBounds, &shape->stroke.type); if (shape->stroke.gradient == NULL) shape->stroke.type = NSVG_PAINT_NONE; } // Set flags shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00); // Add to tail if (p->image->shapes == NULL) p->image->shapes = shape; else p->shapesTail->next = shape; p->shapesTail = shape; return; error: if (shape) NANOSVG_free(shape); } static void nsvg__addPath(NSVGparser* p, char closed) { NSVGattrib* attr = nsvg__getAttr(p); NSVGpath* path = NULL; float bounds[4]; float* curve; int i; if (p->npts < 4) return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath)); if (path == NULL) goto error; memset(path, 0, sizeof(NSVGpath)); path->pts = (float*)NANOSVG_malloc(p->npts*2*sizeof(float)); if (path->pts == NULL) goto error; path->closed = closed; path->npts = p->npts; // Transform path. for (i = 0; i < p->npts; ++i) nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform); // Find bounds for (i = 0; i < path->npts-1; i += 3) { curve = &path->pts[i*2]; nsvg__curveBounds(bounds, curve); if (i == 0) { path->bounds[0] = bounds[0]; path->bounds[1] = bounds[1]; path->bounds[2] = bounds[2]; path->bounds[3] = bounds[3]; } else { path->bounds[0] = nsvg__minf(path->bounds[0], bounds[0]); path->bounds[1] = nsvg__minf(path->bounds[1], bounds[1]); path->bounds[2] = nsvg__maxf(path->bounds[2], bounds[2]); path->bounds[3] = nsvg__maxf(path->bounds[3], bounds[3]); } } path->next = p->plist; p->plist = path; return; error: if (path != NULL) { if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); } } // We roll our own string to float because the std library one uses locale and messes things up. static double nsvg__atof(const char* s) { char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; #if (_MSC_VER == 1200) __int64 intPart = 0, fracPart = 0; #else long long intPart = 0, fracPart = 0; #endif char hasIntPart = 0, hasFracPart = 0; // Parse optional sign if (*cur == '+') { cur++; } else if (*cur == '-') { sign = -1; cur++; } // Parse integer part if (nsvg__isdigit(*cur)) { // Parse digit sequence #if (_MSC_VER == 1200) intPart = strtol(cur, &end, 10); #else intPart = strtoll(cur, &end, 10); #endif if (cur != end) { res = (double)intPart; hasIntPart = 1; cur = end; } } // Parse fractional part. if (*cur == '.') { cur++; // Skip '.' if (nsvg__isdigit(*cur)) { // Parse digit sequence #if (_MSC_VER == 1200) fracPart = strtol(cur, &end, 10); #else fracPart = strtoll(cur, &end, 10); #endif if (cur != end) { res += (double)fracPart / pow(10.0, (double)(end - cur)); hasFracPart = 1; cur = end; } } } // A valid number should have integer or fractional part. if (!hasIntPart && !hasFracPart) return 0.0; // Parse optional exponent if (*cur == 'e' || *cur == 'E') { int expPart = 0; cur++; // skip 'E' expPart = strtol(cur, &end, 10); // Parse digit sequence with sign if (cur != end) { res *= pow(10.0, (double)expPart); } } return res * sign; } static const char* nsvg__parseNumber(const char* s, char* it, const int size) { const int last = size-1; int i = 0; // sign if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } // integer part while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } if (*s == '.') { // decimal point if (i < last) it[i++] = *s; s++; // fraction part while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } // exponent if (*s == 'e' || *s == 'E') { if (i < last) it[i++] = *s; s++; if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } it[i] = '\0'; return s; } static const char* nsvg__getNextPathItem(const char* s, char* it) { it[0] = '\0'; // Skip white spaces and commas while (*s && (nsvg__isspace(*s) || *s == ',')) s++; if (!*s) return s; if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) { s = nsvg__parseNumber(s, it, 64); } else { // Parse command it[0] = *s++; it[1] = '\0'; return s; } return s; } static unsigned int nsvg__parseColorHex(const char* str) { unsigned int c = 0, r = 0, g = 0, b = 0; int n = 0; str++; // skip # // Calculate number of characters. while(str[n] && !nsvg__isspace(str[n])) n++; if (n == 6) { sscanf(str, "%x", &c); } else if (n == 3) { sscanf(str, "%x", &c); c = (c&0xf) | ((c&0xf0) << 4) | ((c&0xf00) << 8); c |= c<<4; } r = (c >> 16) & 0xff; g = (c >> 8) & 0xff; b = c & 0xff; return NSVG_RGB(r,g,b); } static unsigned int nsvg__parseColorRGB(const char* str) { int r = -1, g = -1, b = -1; char s1[32]="", s2[32]=""; sscanf(str + 4, "%d%[%%, \t]%d%[%%, \t]%d", &r, s1, &g, s2, &b); if (strchr(s1, '%')) { return NSVG_RGB((r*255)/100,(g*255)/100,(b*255)/100); } else { return NSVG_RGB(r,g,b); } } typedef struct NSVGNamedColor { const char* name; unsigned int color; } NSVGNamedColor; NSVGNamedColor nsvg__colors[] = { { "red", NSVG_RGB(255, 0, 0) }, { "green", NSVG_RGB( 0, 128, 0) }, { "blue", NSVG_RGB( 0, 0, 255) }, { "yellow", NSVG_RGB(255, 255, 0) }, { "cyan", NSVG_RGB( 0, 255, 255) }, { "magenta", NSVG_RGB(255, 0, 255) }, { "black", NSVG_RGB( 0, 0, 0) }, { "grey", NSVG_RGB(128, 128, 128) }, { "gray", NSVG_RGB(128, 128, 128) }, { "white", NSVG_RGB(255, 255, 255) }, #ifdef NANOSVG_ALL_COLOR_KEYWORDS { "aliceblue", NSVG_RGB(240, 248, 255) }, { "antiquewhite", NSVG_RGB(250, 235, 215) }, { "aqua", NSVG_RGB( 0, 255, 255) }, { "aquamarine", NSVG_RGB(127, 255, 212) }, { "azure", NSVG_RGB(240, 255, 255) }, { "beige", NSVG_RGB(245, 245, 220) }, { "bisque", NSVG_RGB(255, 228, 196) }, { "blanchedalmond", NSVG_RGB(255, 235, 205) }, { "blueviolet", NSVG_RGB(138, 43, 226) }, { "brown", NSVG_RGB(165, 42, 42) }, { "burlywood", NSVG_RGB(222, 184, 135) }, { "cadetblue", NSVG_RGB( 95, 158, 160) }, { "chartreuse", NSVG_RGB(127, 255, 0) }, { "chocolate", NSVG_RGB(210, 105, 30) }, { "coral", NSVG_RGB(255, 127, 80) }, { "cornflowerblue", NSVG_RGB(100, 149, 237) }, { "cornsilk", NSVG_RGB(255, 248, 220) }, { "crimson", NSVG_RGB(220, 20, 60) }, { "darkblue", NSVG_RGB( 0, 0, 139) }, { "darkcyan", NSVG_RGB( 0, 139, 139) }, { "darkgoldenrod", NSVG_RGB(184, 134, 11) }, { "darkgray", NSVG_RGB(169, 169, 169) }, { "darkgreen", NSVG_RGB( 0, 100, 0) }, { "darkgrey", NSVG_RGB(169, 169, 169) }, { "darkkhaki", NSVG_RGB(189, 183, 107) }, { "darkmagenta", NSVG_RGB(139, 0, 139) }, { "darkolivegreen", NSVG_RGB( 85, 107, 47) }, { "darkorange", NSVG_RGB(255, 140, 0) }, { "darkorchid", NSVG_RGB(153, 50, 204) }, { "darkred", NSVG_RGB(139, 0, 0) }, { "darksalmon", NSVG_RGB(233, 150, 122) }, { "darkseagreen", NSVG_RGB(143, 188, 143) }, { "darkslateblue", NSVG_RGB( 72, 61, 139) }, { "darkslategray", NSVG_RGB( 47, 79, 79) }, { "darkslategrey", NSVG_RGB( 47, 79, 79) }, { "darkturquoise", NSVG_RGB( 0, 206, 209) }, { "darkviolet", NSVG_RGB(148, 0, 211) }, { "deeppink", NSVG_RGB(255, 20, 147) }, { "deepskyblue", NSVG_RGB( 0, 191, 255) }, { "dimgray", NSVG_RGB(105, 105, 105) }, { "dimgrey", NSVG_RGB(105, 105, 105) }, { "dodgerblue", NSVG_RGB( 30, 144, 255) }, { "firebrick", NSVG_RGB(178, 34, 34) }, { "floralwhite", NSVG_RGB(255, 250, 240) }, { "forestgreen", NSVG_RGB( 34, 139, 34) }, { "fuchsia", NSVG_RGB(255, 0, 255) }, { "gainsboro", NSVG_RGB(220, 220, 220) }, { "ghostwhite", NSVG_RGB(248, 248, 255) }, { "gold", NSVG_RGB(255, 215, 0) }, { "goldenrod", NSVG_RGB(218, 165, 32) }, { "greenyellow", NSVG_RGB(173, 255, 47) }, { "honeydew", NSVG_RGB(240, 255, 240) }, { "hotpink", NSVG_RGB(255, 105, 180) }, { "indianred", NSVG_RGB(205, 92, 92) }, { "indigo", NSVG_RGB( 75, 0, 130) }, { "ivory", NSVG_RGB(255, 255, 240) }, { "khaki", NSVG_RGB(240, 230, 140) }, { "lavender", NSVG_RGB(230, 230, 250) }, { "lavenderblush", NSVG_RGB(255, 240, 245) }, { "lawngreen", NSVG_RGB(124, 252, 0) }, { "lemonchiffon", NSVG_RGB(255, 250, 205) }, { "lightblue", NSVG_RGB(173, 216, 230) }, { "lightcoral", NSVG_RGB(240, 128, 128) }, { "lightcyan", NSVG_RGB(224, 255, 255) }, { "lightgoldenrodyellow", NSVG_RGB(250, 250, 210) }, { "lightgray", NSVG_RGB(211, 211, 211) }, { "lightgreen", NSVG_RGB(144, 238, 144) }, { "lightgrey", NSVG_RGB(211, 211, 211) }, { "lightpink", NSVG_RGB(255, 182, 193) }, { "lightsalmon", NSVG_RGB(255, 160, 122) }, { "lightseagreen", NSVG_RGB( 32, 178, 170) }, { "lightskyblue", NSVG_RGB(135, 206, 250) }, { "lightslategray", NSVG_RGB(119, 136, 153) }, { "lightslategrey", NSVG_RGB(119, 136, 153) }, { "lightsteelblue", NSVG_RGB(176, 196, 222) }, { "lightyellow", NSVG_RGB(255, 255, 224) }, { "lime", NSVG_RGB( 0, 255, 0) }, { "limegreen", NSVG_RGB( 50, 205, 50) }, { "linen", NSVG_RGB(250, 240, 230) }, { "maroon", NSVG_RGB(128, 0, 0) }, { "mediumaquamarine", NSVG_RGB(102, 205, 170) }, { "mediumblue", NSVG_RGB( 0, 0, 205) }, { "mediumorchid", NSVG_RGB(186, 85, 211) }, { "mediumpurple", NSVG_RGB(147, 112, 219) }, { "mediumseagreen", NSVG_RGB( 60, 179, 113) }, { "mediumslateblue", NSVG_RGB(123, 104, 238) }, { "mediumspringgreen", NSVG_RGB( 0, 250, 154) }, { "mediumturquoise", NSVG_RGB( 72, 209, 204) }, { "mediumvioletred", NSVG_RGB(199, 21, 133) }, { "midnightblue", NSVG_RGB( 25, 25, 112) }, { "mintcream", NSVG_RGB(245, 255, 250) }, { "mistyrose", NSVG_RGB(255, 228, 225) }, { "moccasin", NSVG_RGB(255, 228, 181) }, { "navajowhite", NSVG_RGB(255, 222, 173) }, { "navy", NSVG_RGB( 0, 0, 128) }, { "oldlace", NSVG_RGB(253, 245, 230) }, { "olive", NSVG_RGB(128, 128, 0) }, { "olivedrab", NSVG_RGB(107, 142, 35) }, { "orange", NSVG_RGB(255, 165, 0) }, { "orangered", NSVG_RGB(255, 69, 0) }, { "orchid", NSVG_RGB(218, 112, 214) }, { "palegoldenrod", NSVG_RGB(238, 232, 170) }, { "palegreen", NSVG_RGB(152, 251, 152) }, { "paleturquoise", NSVG_RGB(175, 238, 238) }, { "palevioletred", NSVG_RGB(219, 112, 147) }, { "papayawhip", NSVG_RGB(255, 239, 213) }, { "peachpuff", NSVG_RGB(255, 218, 185) }, { "peru", NSVG_RGB(205, 133, 63) }, { "pink", NSVG_RGB(255, 192, 203) }, { "plum", NSVG_RGB(221, 160, 221) }, { "powderblue", NSVG_RGB(176, 224, 230) }, { "purple", NSVG_RGB(128, 0, 128) }, { "rosybrown", NSVG_RGB(188, 143, 143) }, { "royalblue", NSVG_RGB( 65, 105, 225) }, { "saddlebrown", NSVG_RGB(139, 69, 19) }, { "salmon", NSVG_RGB(250, 128, 114) }, { "sandybrown", NSVG_RGB(244, 164, 96) }, { "seagreen", NSVG_RGB( 46, 139, 87) }, { "seashell", NSVG_RGB(255, 245, 238) }, { "sienna", NSVG_RGB(160, 82, 45) }, { "silver", NSVG_RGB(192, 192, 192) }, { "skyblue", NSVG_RGB(135, 206, 235) }, { "slateblue", NSVG_RGB(106, 90, 205) }, { "slategray", NSVG_RGB(112, 128, 144) }, { "slategrey", NSVG_RGB(112, 128, 144) }, { "snow", NSVG_RGB(255, 250, 250) }, { "springgreen", NSVG_RGB( 0, 255, 127) }, { "steelblue", NSVG_RGB( 70, 130, 180) }, { "tan", NSVG_RGB(210, 180, 140) }, { "teal", NSVG_RGB( 0, 128, 128) }, { "thistle", NSVG_RGB(216, 191, 216) }, { "tomato", NSVG_RGB(255, 99, 71) }, { "turquoise", NSVG_RGB( 64, 224, 208) }, { "violet", NSVG_RGB(238, 130, 238) }, { "wheat", NSVG_RGB(245, 222, 179) }, { "whitesmoke", NSVG_RGB(245, 245, 245) }, { "yellowgreen", NSVG_RGB(154, 205, 50) }, #endif }; static unsigned int nsvg__parseColorName(const char* str) { int i, ncolors = sizeof(nsvg__colors) / sizeof(NSVGNamedColor); for (i = 0; i < ncolors; i++) { if (strcmp(nsvg__colors[i].name, str) == 0) { return nsvg__colors[i].color; } } return NSVG_RGB(128, 128, 128); } static unsigned int nsvg__parseColor(const char* str) { size_t len = 0; while(*str == ' ') ++str; len = strlen(str); if (len >= 1 && *str == '#') return nsvg__parseColorHex(str); else if (len >= 4 && str[0] == 'r' && str[1] == 'g' && str[2] == 'b' && str[3] == '(') return nsvg__parseColorRGB(str); return nsvg__parseColorName(str); } static float nsvg__parseOpacity(const char* str) { float val = 0; sscanf(str, "%f", &val); if (val < 0.0f) val = 0.0f; if (val > 1.0f) val = 1.0f; return val; } static float nsvg__parseMiterLimit(const char* str) { float val = 0; sscanf(str, "%f", &val); if (val < 0.0f) val = 0.0f; return val; } static int nsvg__parseUnits(const char* units) { if (units[0] == 'p' && units[1] == 'x') return NSVG_UNITS_PX; else if (units[0] == 'p' && units[1] == 't') return NSVG_UNITS_PT; else if (units[0] == 'p' && units[1] == 'c') return NSVG_UNITS_PC; else if (units[0] == 'm' && units[1] == 'm') return NSVG_UNITS_MM; else if (units[0] == 'c' && units[1] == 'm') return NSVG_UNITS_CM; else if (units[0] == 'i' && units[1] == 'n') return NSVG_UNITS_IN; else if (units[0] == '%') return NSVG_UNITS_PERCENT; else if (units[0] == 'e' && units[1] == 'm') return NSVG_UNITS_EM; else if (units[0] == 'e' && units[1] == 'x') return NSVG_UNITS_EX; return NSVG_UNITS_USER; } static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; char units[32]=""; sscanf(str, "%f%s", &coord.value, units); coord.units = nsvg__parseUnits(units); return coord; } static NSVGcoordinate nsvg__coord(float v, int units) { NSVGcoordinate coord = {v, units}; return coord; } static float nsvg__parseCoordinate(NSVGparser* p, const char* str, float orig, float length) { NSVGcoordinate coord = nsvg__parseCoordinateRaw(str); return nsvg__convertToPixels(p, coord, orig, length); } static int nsvg__parseTransformArgs(const char* str, float* args, int maxNa, int* na) { const char* end; const char* ptr; char it[64]; *na = 0; ptr = str; while (*ptr && *ptr != '(') ++ptr; if (*ptr == 0) return 1; end = ptr; while (*end && *end != ')') ++end; if (*end == 0) return 1; while (ptr < end) { if (*ptr == '-' || *ptr == '+' || *ptr == '.' || nsvg__isdigit(*ptr)) { if (*na >= maxNa) return 0; ptr = nsvg__parseNumber(ptr, it, 64); args[(*na)++] = (float)nsvg__atof(it); } else { ++ptr; } } return (int)(end - str); } static int nsvg__parseMatrix(float* xform, const char* str) { float t[6]; int na = 0; int len = nsvg__parseTransformArgs(str, t, 6, &na); if (na != 6) return len; memcpy(xform, t, sizeof(float)*6); return len; } static int nsvg__parseTranslate(float* xform, const char* str) { float args[2]; float t[6]; int na = 0; int len = nsvg__parseTransformArgs(str, args, 2, &na); if (na == 1) args[1] = 0.0; nsvg__xformSetTranslation(t, args[0], args[1]); memcpy(xform, t, sizeof(float)*6); return len; } static int nsvg__parseScale(float* xform, const char* str) { float args[2]; int na = 0; float t[6]; int len = nsvg__parseTransformArgs(str, args, 2, &na); if (na == 1) args[1] = args[0]; nsvg__xformSetScale(t, args[0], args[1]); memcpy(xform, t, sizeof(float)*6); return len; } static int nsvg__parseSkewX(float* xform, const char* str) { float args[1]; int na = 0; float t[6]; int len = nsvg__parseTransformArgs(str, args, 1, &na); nsvg__xformSetSkewX(t, args[0]/180.0f*NSVG_PI); memcpy(xform, t, sizeof(float)*6); return len; } static int nsvg__parseSkewY(float* xform, const char* str) { float args[1]; int na = 0; float t[6]; int len = nsvg__parseTransformArgs(str, args, 1, &na); nsvg__xformSetSkewY(t, args[0]/180.0f*NSVG_PI); memcpy(xform, t, sizeof(float)*6); return len; } static int nsvg__parseRotate(float* xform, const char* str) { float args[3]; int na = 0; float m[6]; float t[6]; int len = nsvg__parseTransformArgs(str, args, 3, &na); if (na == 1) args[1] = args[2] = 0.0f; nsvg__xformIdentity(m); if (na > 1) { nsvg__xformSetTranslation(t, -args[1], -args[2]); nsvg__xformMultiply(m, t); } nsvg__xformSetRotation(t, args[0]/180.0f*NSVG_PI); nsvg__xformMultiply(m, t); if (na > 1) { nsvg__xformSetTranslation(t, args[1], args[2]); nsvg__xformMultiply(m, t); } memcpy(xform, m, sizeof(float)*6); return len; } static void nsvg__parseTransform(float* xform, const char* str) { float t[6]; nsvg__xformIdentity(xform); while (*str) { if (strncmp(str, "matrix", 6) == 0) str += nsvg__parseMatrix(t, str); else if (strncmp(str, "translate", 9) == 0) str += nsvg__parseTranslate(t, str); else if (strncmp(str, "scale", 5) == 0) str += nsvg__parseScale(t, str); else if (strncmp(str, "rotate", 6) == 0) str += nsvg__parseRotate(t, str); else if (strncmp(str, "skewX", 5) == 0) str += nsvg__parseSkewX(t, str); else if (strncmp(str, "skewY", 5) == 0) str += nsvg__parseSkewY(t, str); else{ ++str; continue; } nsvg__xformPremultiply(xform, t); } } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; str += 4; // "url("; if (*str == '#') str++; while (i < 63 && *str != ')') { id[i] = *str++; i++; } id[i] = '\0'; } static char nsvg__parseLineCap(const char* str) { if (strcmp(str, "butt") == 0) return NSVG_CAP_BUTT; else if (strcmp(str, "round") == 0) return NSVG_CAP_ROUND; else if (strcmp(str, "square") == 0) return NSVG_CAP_SQUARE; // TODO: handle inherit. return NSVG_CAP_BUTT; } static char nsvg__parseLineJoin(const char* str) { if (strcmp(str, "miter") == 0) return NSVG_JOIN_MITER; else if (strcmp(str, "round") == 0) return NSVG_JOIN_ROUND; else if (strcmp(str, "bevel") == 0) return NSVG_JOIN_BEVEL; // TODO: handle inherit. return NSVG_JOIN_MITER; } static char nsvg__parseFillRule(const char* str) { if (strcmp(str, "nonzero") == 0) return NSVG_FILLRULE_NONZERO; else if (strcmp(str, "evenodd") == 0) return NSVG_FILLRULE_EVENODD; // TODO: handle inherit. return NSVG_FILLRULE_NONZERO; } static const char* nsvg__getNextDashItem(const char* s, char* it) { int n = 0; it[0] = '\0'; // Skip white spaces and commas while (*s && (nsvg__isspace(*s) || *s == ',')) s++; // Advance until whitespace, comma or end. while (*s && (!nsvg__isspace(*s) && *s != ',')) { if (n < 63) it[n++] = *s; s++; } it[n++] = '\0'; return s; } static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* strokeDashArray) { char item[64]; int count = 0, i; float sum = 0.0f; // Handle "none" if (str[0] == 'n') return 0; // Parse dashes while (*str) { str = nsvg__getNextDashItem(str, item); if (!*item) break; if (count < NSVG_MAX_DASHES) strokeDashArray[count++] = fabsf(nsvg__parseCoordinate(p, item, 0.0f, nsvg__actualLength(p))); } for (i = 0; i < count; i++) sum += strokeDashArray[i]; if (sum <= 1e-6f) count = 0; return count; } static void nsvg__parseStyle(NSVGparser* p, const char* str); static int nsvg__parseAttr(NSVGparser* p, const char* name, const char* value) { float xform[6]; NSVGattrib* attr = nsvg__getAttr(p); if (!attr) return 0; if (strcmp(name, "style") == 0) { nsvg__parseStyle(p, value); } else if (strcmp(name, "display") == 0) { if (strcmp(value, "none") == 0) attr->visible &= ~NSVG_VIS_DISPLAY; // Don't reset ->visible on display:inline, one display:none hides the whole subtree } else if (strcmp(name, "visibility") == 0) { if (strcmp(value, "hidden") == 0) { attr->visible &= ~NSVG_VIS_VISIBLE; } else if (strcmp(value, "visible") == 0) { attr->visible |= NSVG_VIS_VISIBLE; } } else if (strcmp(name, "fill") == 0) { if (strcmp(value, "none") == 0) { attr->hasFill = 0; } else if (strncmp(value, "url(", 4) == 0) { attr->hasFill = 2; nsvg__parseUrl(attr->fillGradient, value); } else { attr->hasFill = 1; attr->fillColor = nsvg__parseColor(value); } } else if (strcmp(name, "opacity") == 0) { attr->opacity = nsvg__parseOpacity(value); } else if (strcmp(name, "fill-opacity") == 0) { attr->fillOpacity = nsvg__parseOpacity(value); } else if (strcmp(name, "stroke") == 0) { if (strcmp(value, "none") == 0) { attr->hasStroke = 0; } else if (strncmp(value, "url(", 4) == 0) { attr->hasStroke = 2; nsvg__parseUrl(attr->strokeGradient, value); } else { attr->hasStroke = 1; attr->strokeColor = nsvg__parseColor(value); } } else if (strcmp(name, "stroke-width") == 0) { attr->strokeWidth = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p)); } else if (strcmp(name, "stroke-dasharray") == 0) { attr->strokeDashCount = nsvg__parseStrokeDashArray(p, value, attr->strokeDashArray); } else if (strcmp(name, "stroke-dashoffset") == 0) { attr->strokeDashOffset = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p)); } else if (strcmp(name, "stroke-opacity") == 0) { attr->strokeOpacity = nsvg__parseOpacity(value); } else if (strcmp(name, "stroke-linecap") == 0) { attr->strokeLineCap = nsvg__parseLineCap(value); } else if (strcmp(name, "stroke-linejoin") == 0) { attr->strokeLineJoin = nsvg__parseLineJoin(value); } else if (strcmp(name, "stroke-miterlimit") == 0) { attr->miterLimit = nsvg__parseMiterLimit(value); } else if (strcmp(name, "fill-rule") == 0) { attr->fillRule = nsvg__parseFillRule(value); } else if (strcmp(name, "font-size") == 0) { attr->fontSize = nsvg__parseCoordinate(p, value, 0.0f, nsvg__actualLength(p)); } else if (strcmp(name, "transform") == 0) { nsvg__parseTransform(xform, value); nsvg__xformPremultiply(attr->xform, xform); } else if (strcmp(name, "stop-color") == 0) { attr->stopColor = nsvg__parseColor(value); } else if (strcmp(name, "stop-opacity") == 0) { attr->stopOpacity = nsvg__parseOpacity(value); } else if (strcmp(name, "offset") == 0) { attr->stopOffset = nsvg__parseCoordinate(p, value, 0.0f, 1.0f); } else if (strcmp(name, "id") == 0) { strncpy(attr->id, value, 63); attr->id[63] = '\0'; } else if (strcmp(name, "class") == 0) { NSVGstyles* style = p->styles; while (style) { if (strcmp(style->name + 1, value) == 0) { break; } style = style->next; } if (style) { nsvg__parseStyle(p, style->description); } } else { return 0; } return 1; } static int nsvg__parseNameValue(NSVGparser* p, const char* start, const char* end) { const char* str; const char* val; char name[512]; char value[512]; int n; str = start; while (str < end && *str != ':') ++str; val = str; // Right Trim while (str > start && (*str == ':' || nsvg__isspace(*str))) --str; ++str; n = (int)(str - start); if (n > 511) n = 511; if (n) memcpy(name, start, n); name[n] = 0; while (val < end && (*val == ':' || nsvg__isspace(*val))) ++val; n = (int)(end - val); if (n > 511) n = 511; if (n) memcpy(value, val, n); value[n] = 0; return nsvg__parseAttr(p, name, value); } static void nsvg__parseStyle(NSVGparser* p, const char* str) { const char* start; const char* end; while (*str) { // Left Trim while(*str && nsvg__isspace(*str)) ++str; start = str; while(*str && *str != ';') ++str; end = str; // Right Trim while (end > start && (*end == ';' || nsvg__isspace(*end))) --end; ++end; nsvg__parseNameValue(p, start, end); if (*str) ++str; } } static void nsvg__parseAttribs(NSVGparser* p, const char** attr) { int i; for (i = 0; attr[i]; i += 2) { if (strcmp(attr[i], "style") == 0) nsvg__parseStyle(p, attr[i + 1]); else nsvg__parseAttr(p, attr[i], attr[i + 1]); } } static int nsvg__getArgsPerElement(char cmd) { switch (cmd) { case 'v': case 'V': case 'h': case 'H': return 1; case 'm': case 'M': case 'l': case 'L': case 't': case 'T': return 2; case 'q': case 'Q': case 's': case 'S': return 4; case 'c': case 'C': return 6; case 'a': case 'A': return 7; } return 0; } static void nsvg__pathMoveTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { if (rel) { *cpx += args[0]; *cpy += args[1]; } else { *cpx = args[0]; *cpy = args[1]; } nsvg__moveTo(p, *cpx, *cpy); } static void nsvg__pathLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { if (rel) { *cpx += args[0]; *cpy += args[1]; } else { *cpx = args[0]; *cpy = args[1]; } nsvg__lineTo(p, *cpx, *cpy); } static void nsvg__pathHLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { if (rel) *cpx += args[0]; else *cpx = args[0]; nsvg__lineTo(p, *cpx, *cpy); } static void nsvg__pathVLineTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { if (rel) *cpy += args[0]; else *cpy = args[0]; nsvg__lineTo(p, *cpx, *cpy); } static void nsvg__pathCubicBezTo(NSVGparser* p, float* cpx, float* cpy, float* cpx2, float* cpy2, float* args, int rel) { float x2, y2, cx1, cy1, cx2, cy2; if (rel) { cx1 = *cpx + args[0]; cy1 = *cpy + args[1]; cx2 = *cpx + args[2]; cy2 = *cpy + args[3]; x2 = *cpx + args[4]; y2 = *cpy + args[5]; } else { cx1 = args[0]; cy1 = args[1]; cx2 = args[2]; cy2 = args[3]; x2 = args[4]; y2 = args[5]; } nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); *cpx2 = cx2; *cpy2 = cy2; *cpx = x2; *cpy = y2; } static void nsvg__pathCubicBezShortTo(NSVGparser* p, float* cpx, float* cpy, float* cpx2, float* cpy2, float* args, int rel) { float x1, y1, x2, y2, cx1, cy1, cx2, cy2; x1 = *cpx; y1 = *cpy; if (rel) { cx2 = *cpx + args[0]; cy2 = *cpy + args[1]; x2 = *cpx + args[2]; y2 = *cpy + args[3]; } else { cx2 = args[0]; cy2 = args[1]; x2 = args[2]; y2 = args[3]; } cx1 = 2*x1 - *cpx2; cy1 = 2*y1 - *cpy2; nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); *cpx2 = cx2; *cpy2 = cy2; *cpx = x2; *cpy = y2; } static void nsvg__pathQuadBezTo(NSVGparser* p, float* cpx, float* cpy, float* cpx2, float* cpy2, float* args, int rel) { float x1, y1, x2, y2, cx, cy; float cx1, cy1, cx2, cy2; x1 = *cpx; y1 = *cpy; if (rel) { cx = *cpx + args[0]; cy = *cpy + args[1]; x2 = *cpx + args[2]; y2 = *cpy + args[3]; } else { cx = args[0]; cy = args[1]; x2 = args[2]; y2 = args[3]; } // Convert to cubic bezier cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); *cpx2 = cx; *cpy2 = cy; *cpx = x2; *cpy = y2; } static void nsvg__pathQuadBezShortTo(NSVGparser* p, float* cpx, float* cpy, float* cpx2, float* cpy2, float* args, int rel) { float x1, y1, x2, y2, cx, cy; float cx1, cy1, cx2, cy2; x1 = *cpx; y1 = *cpy; if (rel) { x2 = *cpx + args[0]; y2 = *cpy + args[1]; } else { x2 = args[0]; y2 = args[1]; } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; // Convert to cubix bezier cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); *cpx2 = cx; *cpy2 = cy; *cpx = x2; *cpy = y2; } static float nsvg__sqr(float x) { return x*x; } static float nsvg__vmag(float x, float y) { return sqrtf(x*x + y*y); } static float nsvg__vecrat(float ux, float uy, float vx, float vy) { return (ux*vx + uy*vy) / (nsvg__vmag(ux,uy) * nsvg__vmag(vx,vy)); } static float nsvg__vecang(float ux, float uy, float vx, float vy) { float r = nsvg__vecrat(ux,uy, vx,vy); if (r < -1.0f) r = -1.0f; if (r > 1.0f) r = 1.0f; return ((ux*vy < uy*vx) ? -1.0f : 1.0f) * acosf(r); } static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { // Ported from canvg (https://code.google.com/p/canvg/) float rx, ry, rotx; float x1, y1, x2, y2, cx, cy, dx, dy, d; float x1p, y1p, cxp, cyp, s, sa, sb; float ux, uy, vx, vy, a1, da; float x, y, tanx, tany, a, px = 0, py = 0, ptanx = 0, ptany = 0, t[6]; float sinrx, cosrx; int fa, fs; int i, ndivs; float hda, kappa; rx = fabsf(args[0]); // y radius ry = fabsf(args[1]); // x radius rotx = args[2] / 180.0f * NSVG_PI; // x rotation angle fa = fabsf(args[3]) > 1e-6 ? 1 : 0; // Large arc fs = fabsf(args[4]) > 1e-6 ? 1 : 0; // Sweep direction x1 = *cpx; // start point y1 = *cpy; if (rel) { // end point x2 = *cpx + args[5]; y2 = *cpy + args[6]; } else { x2 = args[5]; y2 = args[6]; } dx = x1 - x2; dy = y1 - y2; d = sqrtf(dx*dx + dy*dy); if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) { // The arc degenerates to a line nsvg__lineTo(p, x2, y2); *cpx = x2; *cpy = y2; return; } sinrx = sinf(rotx); cosrx = cosf(rotx); // Convert to center point parameterization. // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes // 1) Compute x1', y1' x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f; y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f; d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry); if (d > 1) { d = sqrtf(d); rx *= d; ry *= d; } // 2) Compute cx', cy' s = 0.0f; sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p); sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p); if (sa < 0.0f) sa = 0.0f; if (sb > 0.0f) s = sqrtf(sa / sb); if (fa == fs) s = -s; cxp = s * rx * y1p / ry; cyp = s * -ry * x1p / rx; // 3) Compute cx,cy from cx',cy' cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp; cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp; // 4) Calculate theta1, and delta theta. ux = (x1p - cxp) / rx; uy = (y1p - cyp) / ry; vx = (-x1p - cxp) / rx; vy = (-y1p - cyp) / ry; a1 = nsvg__vecang(1.0f,0.0f, ux,uy); // Initial angle da = nsvg__vecang(ux,uy, vx,vy); // Delta angle // if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; // if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; if (fs == 0 && da > 0) da -= 2 * NSVG_PI; else if (fs == 1 && da < 0) da += 2 * NSVG_PI; // Approximate the arc using cubic spline segments. t[0] = cosrx; t[1] = sinrx; t[2] = -sinrx; t[3] = cosrx; t[4] = cx; t[5] = cy; // Split arc into max 90 degree segments. // The loop assumes an iteration per end point (including start and end), this +1. ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f); hda = (da / (float)ndivs) / 2.0f; kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda)); if (da < 0.0f) kappa = -kappa; for (i = 0; i <= ndivs; i++) { a = a1 + da * ((float)i/(float)ndivs); dx = cosf(a); dy = sinf(a); nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); // position nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); // tangent if (i > 0) nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y); px = x; py = y; ptanx = tanx; ptany = tany; } *cpx = x2; *cpy = y2; } static void nsvg__parsePath(NSVGparser* p, const char** attr) { const char* s = NULL; char cmd = '\0'; float args[10]; int nargs; int rargs = 0; float cpx, cpy, cpx2, cpy2; const char* tmp[4]; char closedFlag; int i; char item[64]; for (i = 0; attr[i]; i += 2) { if (strcmp(attr[i], "d") == 0) { s = attr[i + 1]; } else { tmp[0] = attr[i]; tmp[1] = attr[i + 1]; tmp[2] = 0; tmp[3] = 0; nsvg__parseAttribs(p, tmp); } } if (s) { nsvg__resetPath(p); cpx = 0; cpy = 0; cpx2 = 0; cpy2 = 0; closedFlag = 0; nargs = 0; while (*s) { s = nsvg__getNextPathItem(s, item); if (!*item) break; if (nsvg__isnum(item[0])) { if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { switch (cmd) { case 'm': case 'M': nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0); // Moveto can be followed by multiple coordinate pairs, // which should be treated as linetos. cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; break; case 'l': case 'L': nsvg__pathLineTo(p, &cpx, &cpy, args, cmd == 'l' ? 1 : 0); cpx2 = cpx; cpy2 = cpy; break; case 'H': case 'h': nsvg__pathHLineTo(p, &cpx, &cpy, args, cmd == 'h' ? 1 : 0); cpx2 = cpx; cpy2 = cpy; break; case 'V': case 'v': nsvg__pathVLineTo(p, &cpx, &cpy, args, cmd == 'v' ? 1 : 0); cpx2 = cpx; cpy2 = cpy; break; case 'C': case 'c': nsvg__pathCubicBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'c' ? 1 : 0); break; case 'S': case 's': nsvg__pathCubicBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 's' ? 1 : 0); break; case 'Q': case 'q': nsvg__pathQuadBezTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 'q' ? 1 : 0); break; case 'T': case 't': nsvg__pathQuadBezShortTo(p, &cpx, &cpy, &cpx2, &cpy2, args, cmd == 't' ? 1 : 0); break; case 'A': case 'a': nsvg__pathArcTo(p, &cpx, &cpy, args, cmd == 'a' ? 1 : 0); cpx2 = cpx; cpy2 = cpy; break; default: if (nargs >= 2) { cpx = args[nargs-2]; cpy = args[nargs-1]; cpx2 = cpx; cpy2 = cpy; } break; } nargs = 0; } } else { cmd = item[0]; rargs = nsvg__getArgsPerElement(cmd); if (cmd == 'M' || cmd == 'm') { // Commit path. if (p->npts > 0) nsvg__addPath(p, closedFlag); // Start new subpath. nsvg__resetPath(p); closedFlag = 0; nargs = 0; } else if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; // Commit path. if (p->npts > 0) { // Move current point to first point cpx = p->pts[0]; cpy = p->pts[1]; cpx2 = cpx; cpy2 = cpy; nsvg__addPath(p, closedFlag); } // Start new subpath. nsvg__resetPath(p); nsvg__moveTo(p, cpx, cpy); closedFlag = 0; nargs = 0; } } } // Commit path. if (p->npts) nsvg__addPath(p, closedFlag); } nsvg__addShape(p); } static void nsvg__parseRect(NSVGparser* p, const char** attr) { float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; float rx = -1.0f; // marks not set float ry = -1.0f; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "x") == 0) x = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "y") == 0) y = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); if (strcmp(attr[i], "width") == 0) w = nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p)); if (strcmp(attr[i], "height") == 0) h = nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p)); if (strcmp(attr[i], "rx") == 0) rx = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p))); if (strcmp(attr[i], "ry") == 0) ry = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p))); } } if (rx < 0.0f && ry > 0.0f) rx = ry; if (ry < 0.0f && rx > 0.0f) ry = rx; if (rx < 0.0f) rx = 0.0f; if (ry < 0.0f) ry = 0.0f; if (rx > w/2.0f) rx = w/2.0f; if (ry > h/2.0f) ry = h/2.0f; if (w != 0.0f && h != 0.0f) { nsvg__resetPath(p); if (rx < 0.00001f || ry < 0.0001f) { nsvg__moveTo(p, x, y); nsvg__lineTo(p, x+w, y); nsvg__lineTo(p, x+w, y+h); nsvg__lineTo(p, x, y+h); } else { // Rounded rectangle nsvg__moveTo(p, x+rx, y); nsvg__lineTo(p, x+w-rx, y); nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry); nsvg__lineTo(p, x+w, y+h-ry); nsvg__cubicBezTo(p, x+w, y+h-ry*(1-NSVG_KAPPA90), x+w-rx*(1-NSVG_KAPPA90), y+h, x+w-rx, y+h); nsvg__lineTo(p, x+rx, y+h); nsvg__cubicBezTo(p, x+rx*(1-NSVG_KAPPA90), y+h, x, y+h-ry*(1-NSVG_KAPPA90), x, y+h-ry); nsvg__lineTo(p, x, y+ry); nsvg__cubicBezTo(p, x, y+ry*(1-NSVG_KAPPA90), x+rx*(1-NSVG_KAPPA90), y, x+rx, y); } nsvg__addPath(p, 1); nsvg__addShape(p); } } static void nsvg__parseCircle(NSVGparser* p, const char** attr) { float cx = 0.0f; float cy = 0.0f; float r = 0.0f; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "cx") == 0) cx = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "cy") == 0) cy = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); if (strcmp(attr[i], "r") == 0) r = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualLength(p))); } } if (r > 0.0f) { nsvg__resetPath(p); nsvg__moveTo(p, cx+r, cy); nsvg__cubicBezTo(p, cx+r, cy+r*NSVG_KAPPA90, cx+r*NSVG_KAPPA90, cy+r, cx, cy+r); nsvg__cubicBezTo(p, cx-r*NSVG_KAPPA90, cy+r, cx-r, cy+r*NSVG_KAPPA90, cx-r, cy); nsvg__cubicBezTo(p, cx-r, cy-r*NSVG_KAPPA90, cx-r*NSVG_KAPPA90, cy-r, cx, cy-r); nsvg__cubicBezTo(p, cx+r*NSVG_KAPPA90, cy-r, cx+r, cy-r*NSVG_KAPPA90, cx+r, cy); nsvg__addPath(p, 1); nsvg__addShape(p); } } static void nsvg__parseEllipse(NSVGparser* p, const char** attr) { float cx = 0.0f; float cy = 0.0f; float rx = 0.0f; float ry = 0.0f; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "cx") == 0) cx = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "cy") == 0) cy = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); if (strcmp(attr[i], "rx") == 0) rx = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualWidth(p))); if (strcmp(attr[i], "ry") == 0) ry = fabsf(nsvg__parseCoordinate(p, attr[i+1], 0.0f, nsvg__actualHeight(p))); } } if (rx > 0.0f && ry > 0.0f) { nsvg__resetPath(p); nsvg__moveTo(p, cx+rx, cy); nsvg__cubicBezTo(p, cx+rx, cy+ry*NSVG_KAPPA90, cx+rx*NSVG_KAPPA90, cy+ry, cx, cy+ry); nsvg__cubicBezTo(p, cx-rx*NSVG_KAPPA90, cy+ry, cx-rx, cy+ry*NSVG_KAPPA90, cx-rx, cy); nsvg__cubicBezTo(p, cx-rx, cy-ry*NSVG_KAPPA90, cx-rx*NSVG_KAPPA90, cy-ry, cx, cy-ry); nsvg__cubicBezTo(p, cx+rx*NSVG_KAPPA90, cy-ry, cx+rx, cy-ry*NSVG_KAPPA90, cx+rx, cy); nsvg__addPath(p, 1); nsvg__addShape(p); } } static void nsvg__parseLine(NSVGparser* p, const char** attr) { float x1 = 0.0; float y1 = 0.0; float x2 = 0.0; float y2 = 0.0; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "x1") == 0) x1 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "y1") == 0) y1 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); if (strcmp(attr[i], "x2") == 0) x2 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "y2") == 0) y2 = nsvg__parseCoordinate(p, attr[i + 1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); } } nsvg__resetPath(p); nsvg__moveTo(p, x1, y1); nsvg__lineTo(p, x2, y2); nsvg__addPath(p, 0); nsvg__addShape(p); } static void nsvg__parsePoly(NSVGparser* p, const char** attr, int closeFlag) { int i; const char* s; float args[2]; int nargs, npts = 0; char item[64]; nsvg__resetPath(p); for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "points") == 0) { s = attr[i + 1]; nargs = 0; while (*s) { s = nsvg__getNextPathItem(s, item); args[nargs++] = (float)nsvg__atof(item); if (nargs >= 2) { if (npts == 0) nsvg__moveTo(p, args[0], args[1]); else nsvg__lineTo(p, args[0], args[1]); nargs = 0; npts++; } } } } } nsvg__addPath(p, (char)closeFlag); nsvg__addShape(p); } static void nsvg__parseSVG(NSVGparser* p, const char** attr) { int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "width") == 0) { p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "height") == 0) { p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "viewBox") == 0) { sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight); } else if (strcmp(attr[i], "preserveAspectRatio") == 0) { if (strstr(attr[i + 1], "none") != 0) { // No uniform scaling p->alignType = NSVG_ALIGN_NONE; } else { // Parse X align if (strstr(attr[i + 1], "xMin") != 0) p->alignX = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "xMid") != 0) p->alignX = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "xMax") != 0) p->alignX = NSVG_ALIGN_MAX; // Parse X align if (strstr(attr[i + 1], "yMin") != 0) p->alignY = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "yMid") != 0) p->alignY = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "yMax") != 0) p->alignY = NSVG_ALIGN_MAX; // Parse meet/slice p->alignType = NSVG_ALIGN_MEET; if (strstr(attr[i + 1], "slice") != 0) p->alignType = NSVG_ALIGN_SLICE; } } } } } static void nsvg__parseGradient(NSVGparser* p, const char** attr, char type) { int i; NSVGgradientData* grad = (NSVGgradientData*)NANOSVG_malloc(sizeof(NSVGgradientData)); if (grad == NULL) return; memset(grad, 0, sizeof(NSVGgradientData)); grad->units = NSVG_OBJECT_SPACE; grad->type = type; if (grad->type == NSVG_PAINT_LINEAR_GRADIENT) { grad->linear.x1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); grad->linear.y1 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); grad->linear.x2 = nsvg__coord(100.0f, NSVG_UNITS_PERCENT); grad->linear.y2 = nsvg__coord(0.0f, NSVG_UNITS_PERCENT); } else if (grad->type == NSVG_PAINT_RADIAL_GRADIENT) { grad->radial.cx = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); grad->radial.cy = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); grad->radial.r = nsvg__coord(50.0f, NSVG_UNITS_PERCENT); } nsvg__xformIdentity(grad->xform); for (i = 0; attr[i]; i += 2) { if (strcmp(attr[i], "id") == 0) { strncpy(grad->id, attr[i+1], 63); grad->id[63] = '\0'; } else if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "gradientUnits") == 0) { if (strcmp(attr[i+1], "objectBoundingBox") == 0) grad->units = NSVG_OBJECT_SPACE; else grad->units = NSVG_USER_SPACE; } else if (strcmp(attr[i], "gradientTransform") == 0) { nsvg__parseTransform(grad->xform, attr[i + 1]); } else if (strcmp(attr[i], "cx") == 0) { grad->radial.cx = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "cy") == 0) { grad->radial.cy = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "r") == 0) { grad->radial.r = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "fx") == 0) { grad->radial.fx = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "fy") == 0) { grad->radial.fy = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "x1") == 0) { grad->linear.x1 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "y1") == 0) { grad->linear.y1 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "x2") == 0) { grad->linear.x2 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "y2") == 0) { grad->linear.y2 = nsvg__parseCoordinateRaw(attr[i + 1]); } else if (strcmp(attr[i], "spreadMethod") == 0) { if (strcmp(attr[i+1], "pad") == 0) grad->spread = NSVG_SPREAD_PAD; else if (strcmp(attr[i+1], "reflect") == 0) grad->spread = NSVG_SPREAD_REFLECT; else if (strcmp(attr[i+1], "repeat") == 0) grad->spread = NSVG_SPREAD_REPEAT; } else if (strcmp(attr[i], "xlink:href") == 0) { const char *href = attr[i+1]; strncpy(grad->ref, href+1, 62); grad->ref[62] = '\0'; } } } grad->next = p->gradients; p->gradients = grad; } static void nsvg__parseGradientStop(NSVGparser* p, const char** attr) { NSVGattrib* curAttr = nsvg__getAttr(p); NSVGgradientData* grad; NSVGgradientStop* stop; int i, idx; curAttr->stopOffset = 0; curAttr->stopColor = 0; curAttr->stopOpacity = 1.0f; for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } // Add stop to the last gradient. grad = p->gradients; if (grad == NULL) return; grad->nstops++; grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops); if (grad->stops == NULL) return; // Insert idx = grad->nstops-1; for (i = 0; i < grad->nstops-1; i++) { if (curAttr->stopOffset < grad->stops[i].offset) { idx = i; break; } } if (idx != grad->nstops-1) { for (i = grad->nstops-1; i > idx; i--) grad->stops[i] = grad->stops[i-1]; } stop = &grad->stops[idx]; stop->color = curAttr->stopColor; stop->color |= (unsigned int)(curAttr->stopOpacity*255) << 24; stop->offset = curAttr->stopOffset; } static void nsvg__startElement(void* ud, const char* el, const char** attr) { NSVGparser* p = (NSVGparser*)ud; if (p->defsFlag) { // Skip everything but gradients in defs if (strcmp(el, "linearGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT); } else if (strcmp(el, "radialGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT); } else if (strcmp(el, "stop") == 0) { nsvg__parseGradientStop(p, attr); } return; } if (strcmp(el, "g") == 0) { nsvg__pushAttr(p); nsvg__parseAttribs(p, attr); } else if (strcmp(el, "path") == 0) { if (p->pathFlag) // Do not allow nested paths. return; nsvg__pushAttr(p); nsvg__parsePath(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "rect") == 0) { nsvg__pushAttr(p); nsvg__parseRect(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "circle") == 0) { nsvg__pushAttr(p); nsvg__parseCircle(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "ellipse") == 0) { nsvg__pushAttr(p); nsvg__parseEllipse(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "line") == 0) { nsvg__pushAttr(p); nsvg__parseLine(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "polyline") == 0) { nsvg__pushAttr(p); nsvg__parsePoly(p, attr, 0); nsvg__popAttr(p); } else if (strcmp(el, "polygon") == 0) { nsvg__pushAttr(p); nsvg__parsePoly(p, attr, 1); nsvg__popAttr(p); } else if (strcmp(el, "linearGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT); } else if (strcmp(el, "radialGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT); } else if (strcmp(el, "stop") == 0) { nsvg__parseGradientStop(p, attr); } else if (strcmp(el, "defs") == 0) { p->defsFlag = 1; } else if (strcmp(el, "svg") == 0) { nsvg__parseSVG(p, attr); } else if (strcmp(el, "style") == 0) { p->styleFlag = 1; } } static void nsvg__endElement(void* ud, const char* el) { NSVGparser* p = (NSVGparser*)ud; if (strcmp(el, "g") == 0) { nsvg__popAttr(p); } else if (strcmp(el, "path") == 0) { p->pathFlag = 0; } else if (strcmp(el, "defs") == 0) { p->defsFlag = 0; } else if (strcmp(el, "style") == 0) { p->styleFlag = 0; } } static char *nsvg__strndup(const char *s, size_t n) { char *result; size_t len = strlen(s); if (n < len) len = n; result = (char*)NANOSVG_malloc(len+1); if (!result) return 0; result[len] = '\0'; return (char *)memcpy(result, s, len); } static void nsvg__content(void* ud, const char* s) { NSVGparser* p = (NSVGparser*)ud; if (p->styleFlag) { int state = 0; const char* start = NULL; while (*s) { char c = *s; if (nsvg__isspace(c) || c == '{') { if (state == 1) { NSVGstyles* next = p->styles; p->styles = (NSVGstyles*)malloc(sizeof(NSVGstyles)); p->styles->next = next; p->styles->name = nsvg__strndup(start, (size_t)(s - start)); start = s + 1; state = 2; } } else if (state == 2 && c == '}') { p->styles->description = nsvg__strndup(start, (size_t)(s - start)); state = 0; } else if (state == 0) { start = s; state = 1; } s++; /* if (*s == '{' && state == NSVG_XML_CONTENT) { // Start of a tag *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); mark = s; state = NSVG_XML_TAG; } else if (*s == '>' && state == NSVG_XML_TAG) { // Start of a content or new tag. *s++ = '\0'; nsvg__parseElement(mark, startelCb, endelCb, ud); mark = s; state = NSVG_XML_CONTENT; } else { s++; } */ } } } static void nsvg__imageBounds(NSVGparser* p, float* bounds) { NSVGshape* shape; shape = p->image->shapes; if (shape == NULL) { bounds[0] = bounds[1] = bounds[2] = bounds[3] = 0.0; return; } bounds[0] = shape->bounds[0]; bounds[1] = shape->bounds[1]; bounds[2] = shape->bounds[2]; bounds[3] = shape->bounds[3]; for (shape = shape->next; shape != NULL; shape = shape->next) { bounds[0] = nsvg__minf(bounds[0], shape->bounds[0]); bounds[1] = nsvg__minf(bounds[1], shape->bounds[1]); bounds[2] = nsvg__maxf(bounds[2], shape->bounds[2]); bounds[3] = nsvg__maxf(bounds[3], shape->bounds[3]); } } static float nsvg__viewAlign(float content, float container, int type) { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; // mid return (container - content) * 0.5f; } static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy) { float t[6]; nsvg__xformSetTranslation(t, tx, ty); nsvg__xformMultiply (grad->xform, t); nsvg__xformSetScale(t, sx, sy); nsvg__xformMultiply (grad->xform, t); } static void nsvg__scaleToViewbox(NSVGparser* p, const char* units) { NSVGshape* shape; NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; // Guess image size if not set completely. nsvg__imageBounds(p, bounds); if (p->viewWidth == 0) { if (p->image->width > 0) { p->viewWidth = p->image->width; } else { p->viewMinx = bounds[0]; p->viewWidth = bounds[2] - bounds[0]; } } if (p->viewHeight == 0) { if (p->image->height > 0) { p->viewHeight = p->image->height; } else { p->viewMiny = bounds[1]; p->viewHeight = bounds[3] - bounds[1]; } } if (p->image->width == 0) p->image->width = p->viewWidth; if (p->image->height == 0) p->image->height = p->viewHeight; tx = -p->viewMinx; ty = -p->viewMiny; sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0; sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0; // Unit scaling us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f); // Fix aspect ratio if (p->alignType == NSVG_ALIGN_MEET) { // fit whole image into viewbox sx = sy = nsvg__minf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } else if (p->alignType == NSVG_ALIGN_SLICE) { // fill whole viewbox with image sx = sy = nsvg__maxf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } // Transform sx *= us; sy *= us; avgs = (sx+sy) / 2.0f; for (shape = p->image->shapes; shape != NULL; shape = shape->next) { shape->bounds[0] = (shape->bounds[0] + tx) * sx; shape->bounds[1] = (shape->bounds[1] + ty) * sy; shape->bounds[2] = (shape->bounds[2] + tx) * sx; shape->bounds[3] = (shape->bounds[3] + ty) * sy; for (path = shape->paths; path != NULL; path = path->next) { path->bounds[0] = (path->bounds[0] + tx) * sx; path->bounds[1] = (path->bounds[1] + ty) * sy; path->bounds[2] = (path->bounds[2] + tx) * sx; path->bounds[3] = (path->bounds[3] + ty) * sy; for (i =0; i < path->npts; i++) { pt = &path->pts[i*2]; pt[0] = (pt[0] + tx) * sx; pt[1] = (pt[1] + ty) * sy; } } if (shape->fill.type == NSVG_PAINT_LINEAR_GRADIENT || shape->fill.type == NSVG_PAINT_RADIAL_GRADIENT) { nsvg__scaleGradient(shape->fill.gradient, tx,ty, sx,sy); memcpy(t, shape->fill.gradient->xform, sizeof(float)*6); nsvg__xformInverse(shape->fill.gradient->xform, t); } if (shape->stroke.type == NSVG_PAINT_LINEAR_GRADIENT || shape->stroke.type == NSVG_PAINT_RADIAL_GRADIENT) { nsvg__scaleGradient(shape->stroke.gradient, tx,ty, sx,sy); memcpy(t, shape->stroke.gradient->xform, sizeof(float)*6); nsvg__xformInverse(shape->stroke.gradient->xform, t); } shape->strokeWidth *= avgs; shape->strokeDashOffset *= avgs; for (i = 0; i < shape->strokeDashCount; i++) shape->strokeDashArray[i] *= avgs; } } NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi) { NSVGparser* p; NSVGimage* ret = 0; p = nsvg__createParser(); if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); // Scale to viewBox nsvg__scaleToViewbox(p, units); ret = p->image; p->image = NULL; nsvg__deleteParser(p); return ret; } NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi) { FILE* fp = NULL; size_t size; char* data = NULL; NSVGimage* image = NULL; fp = fopen(filename, "rb"); if (!fp) goto error; fseek(fp, 0, SEEK_END); size = ftell(fp); fseek(fp, 0, SEEK_SET); data = (char*)NANOSVG_malloc(size+1); if (data == NULL) goto error; if (fread(data, 1, size, fp) != size) goto error; data[size] = '\0'; // Must be null terminated. fclose(fp); image = nsvgParse(data, units, dpi); NANOSVG_free(data); return image; error: if (fp) fclose(fp); if (data) NANOSVG_free(data); if (image) nsvgDelete(image); return NULL; } NANOSVG_SCOPE void nsvgDelete(NSVGimage* image) { NSVGshape *snext, *shape; if (image == NULL) return; shape = image->shapes; while (shape != NULL) { snext = shape->next; nsvg__deletePaths(shape->paths); nsvg__deletePaint(&shape->fill); nsvg__deletePaint(&shape->stroke); NANOSVG_free(shape); shape = snext; } NANOSVG_free(image); } #endif |
Added generic/nanosvgrast.h.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 | /* * Copyright (c) 2013-14 Mikko Mononen [email protected] * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * The polygon rasterization is heavily based on stb_truetype rasterizer * by Sean Barrett - http://nothings.org/ * */ #ifndef NANOSVGRAST_H #define NANOSVGRAST_H #ifdef __cplusplus extern "C" { #endif #ifndef NANOSVG_SCOPE #define NANOSVG_SCOPE #endif #ifndef NANOSVG_malloc #define NANOSVG_malloc malloc #endif #ifndef NANOSVG_realloc #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif typedef struct NSVGrasterizer NSVGrasterizer; /* Example Usage: // Load SVG struct SNVGImage* image = nsvgParseFromFile("test.svg."); // Create rasterizer (can be used to render multiple images). struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ // Allocated rasterizer context. NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(); // Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) // r - pointer to rasterizer context // image - pointer to image to rasterize // tx,ty - image offset (applied after scaling) // scale - image scale // dst - pointer to destination image data, 4 bytes per pixel (RGBA) // w - width of the image to render // h - height of the image to render // stride - number of bytes per scaleline in the destination buffer NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r, NSVGimage* image, float tx, float ty, float scale, unsigned char* dst, int w, int h, int stride); // Deletes rasterizer context. NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*); #ifdef __cplusplus } #endif #endif // NANOSVGRAST_H #ifdef NANOSVGRAST_IMPLEMENTATION #include <math.h> #define NSVG__SUBSAMPLES 5 #define NSVG__FIXSHIFT 10 #define NSVG__FIX (1 << NSVG__FIXSHIFT) #define NSVG__FIXMASK (NSVG__FIX-1) #define NSVG__MEMPAGE_SIZE 1024 typedef struct NSVGedge { float x0,y0, x1,y1; int dir; struct NSVGedge* next; } NSVGedge; typedef struct NSVGpoint { float x, y; float dx, dy; float len; float dmx, dmy; unsigned char flags; } NSVGpoint; typedef struct NSVGactiveEdge { int x,dx; float ey; int dir; struct NSVGactiveEdge *next; } NSVGactiveEdge; typedef struct NSVGmemPage { unsigned char mem[NSVG__MEMPAGE_SIZE]; int size; struct NSVGmemPage* next; } NSVGmemPage; typedef struct NSVGcachedPaint { char type; char spread; float xform[6]; unsigned int colors[256]; } NSVGcachedPaint; struct NSVGrasterizer { float px, py; float tessTol; float distTol; NSVGedge* edges; int nedges; int cedges; NSVGpoint* points; int npoints; int cpoints; NSVGpoint* points2; int npoints2; int cpoints2; NSVGactiveEdge* freelist; NSVGmemPage* pages; NSVGmemPage* curpage; unsigned char* scanline; int cscanline; unsigned char* bitmap; int width, height, stride; }; NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer() { NSVGrasterizer* r = (NSVGrasterizer*)NANOSVG_malloc(sizeof(NSVGrasterizer)); if (r == NULL) goto error; memset(r, 0, sizeof(NSVGrasterizer)); r->tessTol = 0.25f; r->distTol = 0.01f; return r; error: nsvgDeleteRasterizer(r); return NULL; } NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer* r) { NSVGmemPage* p; if (r == NULL) return; p = r->pages; while (p != NULL) { NSVGmemPage* next = p->next; NANOSVG_free(p); p = next; } if (r->edges) NANOSVG_free(r->edges); if (r->points) NANOSVG_free(r->points); if (r->points2) NANOSVG_free(r->points2); if (r->scanline) NANOSVG_free(r->scanline); NANOSVG_free(r); } static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; // If using existing chain, return the next page in chain if (cur != NULL && cur->next != NULL) { return cur->next; } // Alloc new page newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage)); if (newp == NULL) return NULL; memset(newp, 0, sizeof(NSVGmemPage)); // Add to linked list if (cur != NULL) cur->next = newp; else r->pages = newp; return newp; } static void nsvg__resetPool(NSVGrasterizer* r) { NSVGmemPage* p = r->pages; while (p != NULL) { p->size = 0; p = p->next; } r->curpage = r->pages; } static unsigned char* nsvg__alloc(NSVGrasterizer* r, int size) { unsigned char* buf; if (size > NSVG__MEMPAGE_SIZE) return NULL; if (r->curpage == NULL || r->curpage->size+size > NSVG__MEMPAGE_SIZE) { r->curpage = nsvg__nextPage(r, r->curpage); } buf = &r->curpage->mem[r->curpage->size]; r->curpage->size += size; return buf; } static int nsvg__ptEquals(float x1, float y1, float x2, float y2, float tol) { float dx = x2 - x1; float dy = y2 - y1; return dx*dx + dy*dy < tol*tol; } static void nsvg__addPathPoint(NSVGrasterizer* r, float x, float y, int flags) { NSVGpoint* pt; if (r->npoints > 0) { pt = &r->points[r->npoints-1]; if (nsvg__ptEquals(pt->x,pt->y, x,y, r->distTol)) { pt->flags = (unsigned char)(pt->flags | flags); return; } } if (r->npoints+1 > r->cpoints) { r->cpoints = r->cpoints > 0 ? r->cpoints * 2 : 64; r->points = (NSVGpoint*)NANOSVG_realloc(r->points, sizeof(NSVGpoint) * r->cpoints); if (r->points == NULL) return; } pt = &r->points[r->npoints]; pt->x = x; pt->y = y; pt->flags = (unsigned char)flags; r->npoints++; } static void nsvg__appendPathPoint(NSVGrasterizer* r, NSVGpoint pt) { if (r->npoints+1 > r->cpoints) { r->cpoints = r->cpoints > 0 ? r->cpoints * 2 : 64; r->points = (NSVGpoint*)NANOSVG_realloc(r->points, sizeof(NSVGpoint) * r->cpoints); if (r->points == NULL) return; } r->points[r->npoints] = pt; r->npoints++; } static void nsvg__duplicatePoints(NSVGrasterizer* r) { if (r->npoints > r->cpoints2) { r->cpoints2 = r->npoints; r->points2 = (NSVGpoint*)NANOSVG_realloc(r->points2, sizeof(NSVGpoint) * r->cpoints2); if (r->points2 == NULL) return; } memcpy(r->points2, r->points, sizeof(NSVGpoint) * r->npoints); r->npoints2 = r->npoints; } static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; // Skip horizontal edges if (y0 == y1) return; if (r->nedges+1 > r->cedges) { r->cedges = r->cedges > 0 ? r->cedges * 2 : 64; r->edges = (NSVGedge*)NANOSVG_realloc(r->edges, sizeof(NSVGedge) * r->cedges); if (r->edges == NULL) return; } e = &r->edges[r->nedges]; r->nedges++; if (y0 < y1) { e->x0 = x0; e->y0 = y0; e->x1 = x1; e->y1 = y1; e->dir = 1; } else { e->x0 = x1; e->y0 = y1; e->x1 = x0; e->y1 = y0; e->dir = -1; } } static float nsvg__normalize(float *x, float* y) { float d = sqrtf((*x)*(*x) + (*y)*(*y)); if (d > 1e-6f) { float id = 1.0f / d; *x *= id; *y *= id; } return d; } static float nsvg__absf(float x) { return x < 0 ? -x : x; } static void nsvg__flattenCubicBez(NSVGrasterizer* r, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, int level, int type) { float x12,y12,x23,y23,x34,y34,x123,y123,x234,y234,x1234,y1234; float dx,dy,d2,d3; if (level > 10) return; x12 = (x1+x2)*0.5f; y12 = (y1+y2)*0.5f; x23 = (x2+x3)*0.5f; y23 = (y2+y3)*0.5f; x34 = (x3+x4)*0.5f; y34 = (y3+y4)*0.5f; x123 = (x12+x23)*0.5f; y123 = (y12+y23)*0.5f; dx = x4 - x1; dy = y4 - y1; d2 = nsvg__absf(((x2 - x4) * dy - (y2 - y4) * dx)); d3 = nsvg__absf(((x3 - x4) * dy - (y3 - y4) * dx)); if ((d2 + d3)*(d2 + d3) < r->tessTol * (dx*dx + dy*dy)) { nsvg__addPathPoint(r, x4, y4, type); return; } x234 = (x23+x34)*0.5f; y234 = (y23+y34)*0.5f; x1234 = (x123+x234)*0.5f; y1234 = (y123+y234)*0.5f; nsvg__flattenCubicBez(r, x1,y1, x12,y12, x123,y123, x1234,y1234, level+1, 0); nsvg__flattenCubicBez(r, x1234,y1234, x234,y234, x34,y34, x4,y4, level+1, type); } static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; // Flatten path nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0); } // Close path nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); // Build edges for (i = 0, j = r->npoints-1; i < r->npoints; j = i++) nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y); } } enum NSVGpointFlags { NSVG_PT_CORNER = 0x01, NSVG_PT_BEVEL = 0x02, NSVG_PT_LEFT = 0x04 }; static void nsvg__initClosed(NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth) { float w = lineWidth * 0.5f; float dx = p1->x - p0->x; float dy = p1->y - p0->y; float len = nsvg__normalize(&dx, &dy); float px = p0->x + dx*len*0.5f, py = p0->y + dy*len*0.5f; float dlx = dy, dly = -dx; float lx = px - dlx*w, ly = py - dly*w; float rx = px + dlx*w, ry = py + dly*w; left->x = lx; left->y = ly; right->x = rx; right->y = ry; } static void nsvg__buttCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int connect) { float w = lineWidth * 0.5f; float px = p->x, py = p->y; float dlx = dy, dly = -dx; float lx = px - dlx*w, ly = py - dly*w; float rx = px + dlx*w, ry = py + dly*w; nsvg__addEdge(r, lx, ly, rx, ry); if (connect) { nsvg__addEdge(r, left->x, left->y, lx, ly); nsvg__addEdge(r, rx, ry, right->x, right->y); } left->x = lx; left->y = ly; right->x = rx; right->y = ry; } static void nsvg__squareCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int connect) { float w = lineWidth * 0.5f; float px = p->x - dx*w, py = p->y - dy*w; float dlx = dy, dly = -dx; float lx = px - dlx*w, ly = py - dly*w; float rx = px + dlx*w, ry = py + dly*w; nsvg__addEdge(r, lx, ly, rx, ry); if (connect) { nsvg__addEdge(r, left->x, left->y, lx, ly); nsvg__addEdge(r, rx, ry, right->x, right->y); } left->x = lx; left->y = ly; right->x = rx; right->y = ry; } #ifndef NSVG_PI #define NSVG_PI (3.14159265358979323846264338327f) #endif static void nsvg__roundCap(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p, float dx, float dy, float lineWidth, int ncap, int connect) { int i; float w = lineWidth * 0.5f; float px = p->x, py = p->y; float dlx = dy, dly = -dx; float lx = 0, ly = 0, rx = 0, ry = 0, prevx = 0, prevy = 0; for (i = 0; i < ncap; i++) { float a = (float)i/(float)(ncap-1)*NSVG_PI; float ax = cosf(a) * w, ay = sinf(a) * w; float x = px - dlx*ax - dx*ay; float y = py - dly*ax - dy*ay; if (i > 0) nsvg__addEdge(r, prevx, prevy, x, y); prevx = x; prevy = y; if (i == 0) { lx = x; ly = y; } else if (i == ncap-1) { rx = x; ry = y; } } if (connect) { nsvg__addEdge(r, left->x, left->y, lx, ly); nsvg__addEdge(r, rx, ry, right->x, right->y); } left->x = lx; left->y = ly; right->x = rx; right->y = ry; } static void nsvg__bevelJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth) { float w = lineWidth * 0.5f; float dlx0 = p0->dy, dly0 = -p0->dx; float dlx1 = p1->dy, dly1 = -p1->dx; float lx0 = p1->x - (dlx0 * w), ly0 = p1->y - (dly0 * w); float rx0 = p1->x + (dlx0 * w), ry0 = p1->y + (dly0 * w); float lx1 = p1->x - (dlx1 * w), ly1 = p1->y - (dly1 * w); float rx1 = p1->x + (dlx1 * w), ry1 = p1->y + (dly1 * w); nsvg__addEdge(r, lx0, ly0, left->x, left->y); nsvg__addEdge(r, lx1, ly1, lx0, ly0); nsvg__addEdge(r, right->x, right->y, rx0, ry0); nsvg__addEdge(r, rx0, ry0, rx1, ry1); left->x = lx1; left->y = ly1; right->x = rx1; right->y = ry1; } static void nsvg__miterJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth) { float w = lineWidth * 0.5f; float dlx0 = p0->dy, dly0 = -p0->dx; float dlx1 = p1->dy, dly1 = -p1->dx; float lx0, rx0, lx1, rx1; float ly0, ry0, ly1, ry1; if (p1->flags & NSVG_PT_LEFT) { lx0 = lx1 = p1->x - p1->dmx * w; ly0 = ly1 = p1->y - p1->dmy * w; nsvg__addEdge(r, lx1, ly1, left->x, left->y); rx0 = p1->x + (dlx0 * w); ry0 = p1->y + (dly0 * w); rx1 = p1->x + (dlx1 * w); ry1 = p1->y + (dly1 * w); nsvg__addEdge(r, right->x, right->y, rx0, ry0); nsvg__addEdge(r, rx0, ry0, rx1, ry1); } else { lx0 = p1->x - (dlx0 * w); ly0 = p1->y - (dly0 * w); lx1 = p1->x - (dlx1 * w); ly1 = p1->y - (dly1 * w); nsvg__addEdge(r, lx0, ly0, left->x, left->y); nsvg__addEdge(r, lx1, ly1, lx0, ly0); rx0 = rx1 = p1->x + p1->dmx * w; ry0 = ry1 = p1->y + p1->dmy * w; nsvg__addEdge(r, right->x, right->y, rx1, ry1); } left->x = lx1; left->y = ly1; right->x = rx1; right->y = ry1; } static void nsvg__roundJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p0, NSVGpoint* p1, float lineWidth, int ncap) { int i, n; float w = lineWidth * 0.5f; float dlx0 = p0->dy, dly0 = -p0->dx; float dlx1 = p1->dy, dly1 = -p1->dx; float a0 = atan2f(dly0, dlx0); float a1 = atan2f(dly1, dlx1); float da = a1 - a0; float lx, ly, rx, ry; if (da < NSVG_PI) da += NSVG_PI*2; if (da > NSVG_PI) da -= NSVG_PI*2; n = (int)ceilf((nsvg__absf(da) / NSVG_PI) * (float)ncap); if (n < 2) n = 2; if (n > ncap) n = ncap; lx = left->x; ly = left->y; rx = right->x; ry = right->y; for (i = 0; i < n; i++) { float u = (float)i/(float)(n-1); float a = a0 + u*da; float ax = cosf(a) * w, ay = sinf(a) * w; float lx1 = p1->x - ax, ly1 = p1->y - ay; float rx1 = p1->x + ax, ry1 = p1->y + ay; nsvg__addEdge(r, lx1, ly1, lx, ly); nsvg__addEdge(r, rx, ry, rx1, ry1); lx = lx1; ly = ly1; rx = rx1; ry = ry1; } left->x = lx; left->y = ly; right->x = rx; right->y = ry; } static void nsvg__straightJoin(NSVGrasterizer* r, NSVGpoint* left, NSVGpoint* right, NSVGpoint* p1, float lineWidth) { float w = lineWidth * 0.5f; float lx = p1->x - (p1->dmx * w), ly = p1->y - (p1->dmy * w); float rx = p1->x + (p1->dmx * w), ry = p1->y + (p1->dmy * w); nsvg__addEdge(r, lx, ly, left->x, left->y); nsvg__addEdge(r, right->x, right->y, rx, ry); left->x = lx; left->y = ly; right->x = rx; right->y = ry; } static int nsvg__curveDivs(float r, float arc, float tol) { float da = acosf(r / (r + tol)) * 2.0f; int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; return divs; } static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth) { int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); // Calculate divisions per half circle. NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0}; NSVGpoint* p0, *p1; int j, s, e; // Build stroke edges if (closed) { // Looping p0 = &points[npoints-1]; p1 = &points[0]; s = 0; e = npoints; } else { // Add cap p0 = &points[0]; p1 = &points[1]; s = 1; e = npoints-1; } if (closed) { nsvg__initClosed(&left, &right, p0, p1, lineWidth); firstLeft = left; firstRight = right; } else { // Add cap float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &left, &right, p0, dx, dy, lineWidth, 0); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &left, &right, p0, dx, dy, lineWidth, 0); else if (lineCap == NSVG_CAP_ROUND) nsvg__roundCap(r, &left, &right, p0, dx, dy, lineWidth, ncap, 0); } for (j = s; j < e; ++j) { if (p1->flags & NSVG_PT_CORNER) { if (lineJoin == NSVG_JOIN_ROUND) nsvg__roundJoin(r, &left, &right, p0, p1, lineWidth, ncap); else if (lineJoin == NSVG_JOIN_BEVEL || (p1->flags & NSVG_PT_BEVEL)) nsvg__bevelJoin(r, &left, &right, p0, p1, lineWidth); else nsvg__miterJoin(r, &left, &right, p0, p1, lineWidth); } else { nsvg__straightJoin(r, &left, &right, p1, lineWidth); } p0 = p1++; } if (closed) { // Loop it nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y); nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y); } else { // Add cap float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); else if (lineCap == NSVG_CAP_ROUND) nsvg__roundCap(r, &right, &left, p1, -dx, -dy, lineWidth, ncap, 1); } } static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoin) { int i, j; NSVGpoint* p0, *p1; p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (i = 0; i < r->npoints; i++) { // Calculate segment direction and length p0->dx = p1->x - p0->x; p0->dy = p1->y - p0->y; p0->len = nsvg__normalize(&p0->dx, &p0->dy); // Advance p0 = p1++; } // calculate joins p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (j = 0; j < r->npoints; j++) { float dlx0, dly0, dlx1, dly1, dmr2, cross; dlx0 = p0->dy; dly0 = -p0->dx; dlx1 = p1->dy; dly1 = -p1->dx; // Calculate extrusions p1->dmx = (dlx0 + dlx1) * 0.5f; p1->dmy = (dly0 + dly1) * 0.5f; dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy; if (dmr2 > 0.000001f) { float s2 = 1.0f / dmr2; if (s2 > 600.0f) { s2 = 600.0f; } p1->dmx *= s2; p1->dmy *= s2; } // Clear flags, but keep the corner. p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0; // Keep track of left turns. cross = p1->dx * p0->dy - p0->dx * p1->dy; if (cross > 0.0f) p1->flags |= NSVG_PT_LEFT; // Check to see if the corner needs to be beveled. if (p1->flags & NSVG_PT_CORNER) { if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) { p1->flags |= NSVG_PT_BEVEL; } } p0 = p1++; } } static void nsvg__flattenShapeStroke(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j, closed; NSVGpath* path; NSVGpoint* p0, *p1; float miterLimit = shape->miterLimit; int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { // Flatten path r->npoints = 0; nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER); } if (r->npoints < 2) continue; closed = path->closed; // If the first and last points are the same, remove the last, mark as closed path. p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) { r->npoints--; p0 = &r->points[r->npoints-1]; closed = 1; } if (shape->strokeDashCount > 0) { int idash = 0, dashState = 1; float totalDist = 0, dashLen, allDashLen, dashOffset; NSVGpoint cur; if (closed) nsvg__appendPathPoint(r, r->points[0]); // Duplicate points -> points2. nsvg__duplicatePoints(r); r->npoints = 0; cur = r->points2[0]; nsvg__appendPathPoint(r, cur); // Figure out dash offset. allDashLen = 0; for (j = 0; j < shape->strokeDashCount; j++) allDashLen += shape->strokeDashArray[j]; if (shape->strokeDashCount & 1) allDashLen *= 2.0f; // Find location inside pattern dashOffset = fmodf(shape->strokeDashOffset, allDashLen); if (dashOffset < 0.0f) dashOffset += allDashLen; while (dashOffset > shape->strokeDashArray[idash]) { dashOffset -= shape->strokeDashArray[idash]; idash = (idash + 1) % shape->strokeDashCount; } dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale; for (j = 1; j < r->npoints2; ) { float dx = r->points2[j].x - cur.x; float dy = r->points2[j].y - cur.y; float dist = sqrtf(dx*dx + dy*dy); if ((totalDist + dist) > dashLen) { // Calculate intermediate point float d = (dashLen - totalDist) / dist; float x = cur.x + dx * d; float y = cur.y + dy * d; nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER); // Stroke if (r->npoints > 1 && dashState) { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } // Advance dash pattern dashState = !dashState; idash = (idash+1) % shape->strokeDashCount; dashLen = shape->strokeDashArray[idash] * scale; // Restart cur.x = x; cur.y = y; cur.flags = NSVG_PT_CORNER; totalDist = 0.0f; r->npoints = 0; nsvg__appendPathPoint(r, cur); } else { totalDist += dist; cur = r->points2[j]; nsvg__appendPathPoint(r, cur); j++; } } // Stroke any leftover path if (r->npoints > 1 && dashState) nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } else { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, closed, lineJoin, lineCap, lineWidth); } } } static int nsvg__cmpEdge(const void *p, const void *q) { const NSVGedge* a = (const NSVGedge*)p; const NSVGedge* b = (const NSVGedge*)q; if (a->y0 < b->y0) return -1; if (a->y0 > b->y0) return 1; return 0; } static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { // Restore from freelist. z = r->freelist; r->freelist = z->next; } else { // Alloc new edge. z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge)); if (z == NULL) return NULL; } dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); // STBTT_assert(e->y0 <= start_point); // round dx down to avoid going too far if (dxdy < 0) z->dx = (int)(-floorf(NSVG__FIX * -dxdy)); else z->dx = (int)floorf(NSVG__FIX * dxdy); z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0))); // z->x -= off_x * FIX; z->ey = e->y1; z->next = 0; z->dir = e->dir; return z; } static void nsvg__freeActive(NSVGrasterizer* r, NSVGactiveEdge* z) { z->next = r->freelist; r->freelist = z; } static void nsvg__fillScanline(unsigned char* scanline, int len, int x0, int x1, int maxWeight, int* xmin, int* xmax) { int i = x0 >> NSVG__FIXSHIFT; int j = x1 >> NSVG__FIXSHIFT; if (i < *xmin) *xmin = i; if (j > *xmax) *xmax = j; if (i < len && j >= 0) { if (i == j) { // x0,x1 are the same pixel, so compute combined coverage scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT)); } else { if (i >= 0) // add antialiasing for x0 scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT)); else i = -1; // clip if (j < len) // add antialiasing for x1 scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT)); else j = len; // clip for (++i; i < j; ++i) // fill pixels between x0 and x1 scanline[i] = (unsigned char)(scanline[i] + maxWeight); } } } // note: this routine clips fills that extend off the edges... ideally this // wouldn't happen, but it could happen if the truetype glyph bounding boxes // are wrong, or if the user supplies a too-small bitmap static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule) { // non-zero winding fill int x0 = 0, w = 0; if (fillRule == NSVG_FILLRULE_NONZERO) { // Non-zero while (e != NULL) { if (w == 0) { // if we're currently at zero, we need to record the edge start point x0 = e->x; w += e->dir; } else { int x1 = e->x; w += e->dir; // if we went to zero, we need to draw if (w == 0) nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } } else if (fillRule == NSVG_FILLRULE_EVENODD) { // Even-odd while (e != NULL) { if (w == 0) { // if we're currently at zero, we need to record the edge start point x0 = e->x; w = 1; } else { int x1 = e->x; w = 0; nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } } } static float nsvg__clampf(float a, float mn, float mx) { return a < mn ? mn : (a > mx ? mx : a); } static unsigned int nsvg__RGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a) { return (r) | (g << 8) | (b << 16) | (a << 24); } static unsigned int nsvg__lerpRGBA(unsigned int c0, unsigned int c1, float u) { int iu = (int)(nsvg__clampf(u, 0.0f, 1.0f) * 256.0f); int r = (((c0) & 0xff)*(256-iu) + (((c1) & 0xff)*iu)) >> 8; int g = (((c0>>8) & 0xff)*(256-iu) + (((c1>>8) & 0xff)*iu)) >> 8; int b = (((c0>>16) & 0xff)*(256-iu) + (((c1>>16) & 0xff)*iu)) >> 8; int a = (((c0>>24) & 0xff)*(256-iu) + (((c1>>24) & 0xff)*iu)) >> 8; return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a); } static unsigned int nsvg__applyOpacity(unsigned int c, float u) { int iu = (int)(nsvg__clampf(u, 0.0f, 1.0f) * 256.0f); int r = (c) & 0xff; int g = (c>>8) & 0xff; int b = (c>>16) & 0xff; int a = (((c>>24) & 0xff)*iu) >> 8; return nsvg__RGBA((unsigned char)r, (unsigned char)g, (unsigned char)b, (unsigned char)a); } static inline int nsvg__div255(int x) { return ((x+1) * 257) >> 16; } static void nsvg__scanlineSolid(unsigned char* dst, int count, unsigned char* cover, int x, int y, float tx, float ty, float scale, NSVGcachedPaint* cache) { if (cache->type == NSVG_PAINT_COLOR) { int i, cr, cg, cb, ca; cr = cache->colors[0] & 0xff; cg = (cache->colors[0] >> 8) & 0xff; cb = (cache->colors[0] >> 16) & 0xff; ca = (cache->colors[0] >> 24) & 0xff; for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; // Premultiply r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); // Blend over r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; } } else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) { // TODO: spread modes. // TODO: plenty of opportunities to optimize. float fx, fy, dx, gy; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; dx = 1.0f / scale; for (i = 0; i < count; i++) { int r,g,b,a,ia; gy = fx*t[1] + fy*t[3] + t[5]; c = cache->colors[(int)nsvg__clampf(gy*255.0f, 0, 255.0f)]; cr = (c) & 0xff; cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; // Premultiply r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); // Blend over r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; fx += dx; } } else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) { // TODO: spread modes. // TODO: plenty of opportunities to optimize. // TODO: focus (fx,fy) float fx, fy, dx, gx, gy, gd; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; dx = 1.0f / scale; for (i = 0; i < count; i++) { int r,g,b,a,ia; gx = fx*t[0] + fy*t[2] + t[4]; gy = fx*t[1] + fy*t[3] + t[5]; gd = sqrtf(gx*gx + gy*gy); c = cache->colors[(int)nsvg__clampf(gd*255.0f, 0, 255.0f)]; cr = (c) & 0xff; cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; // Premultiply r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); // Blend over r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; fx += dx; } } } static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule) { NSVGactiveEdge *active = NULL; int y, s; int e = 0; int maxWeight = (255 / NSVG__SUBSAMPLES); // weight per vertical scanline int xmin, xmax; for (y = 0; y < r->height; y++) { memset(r->scanline, 0, r->width); xmin = r->width; xmax = 0; for (s = 0; s < NSVG__SUBSAMPLES; ++s) { // find center of pixel for this scanline float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f; NSVGactiveEdge **step = &active; // update all active edges; // remove all active edges that terminate before the center of this scanline while (*step) { NSVGactiveEdge *z = *step; if (z->ey <= scany) { *step = z->next; // delete from list // NSVG__assert(z->valid); nsvg__freeActive(r, z); } else { z->x += z->dx; // advance to position for current scanline step = &((*step)->next); // advance through list } } // resort the list if needed for (;;) { int changed = 0; step = &active; while (*step && (*step)->next) { if ((*step)->x > (*step)->next->x) { NSVGactiveEdge* t = *step; NSVGactiveEdge* q = t->next; t->next = q->next; q->next = t; *step = q; changed = 1; } step = &(*step)->next; } if (!changed) break; } // insert all edges that start before the center of this scanline -- omit ones that also end on this scanline while (e < r->nedges && r->edges[e].y0 <= scany) { if (r->edges[e].y1 > scany) { NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany); if (z == NULL) break; // find insertion point if (active == NULL) { active = z; } else if (z->x < active->x) { // insert at front z->next = active; active = z; } else { // find thing to insert AFTER NSVGactiveEdge* p = active; while (p->next && p->next->x < z->x) p = p->next; // at this point, p->next->x is NOT < z->x z->next = p->next; p->next = z; } } e++; } // now process all active edges in non-zero fashion if (active != NULL) nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule); } // Blit if (xmin < 0) xmin = 0; if (xmax > r->width-1) xmax = r->width-1; if (xmin <= xmax) { nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache); } } } static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int stride) { int x,y; // Unpremultiply for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = row[0], g = row[1], b = row[2], a = row[3]; if (a != 0) { row[0] = (unsigned char)(r*255/a); row[1] = (unsigned char)(g*255/a); row[2] = (unsigned char)(b*255/a); } row += 4; } } // Defringe for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = 0, g = 0, b = 0, a = row[3], n = 0; if (a == 0) { if (x-1 > 0 && row[-1] != 0) { r += row[-4]; g += row[-3]; b += row[-2]; n++; } if (x+1 < w && row[7] != 0) { r += row[4]; g += row[5]; b += row[6]; n++; } if (y-1 > 0 && row[-stride+3] != 0) { r += row[-stride]; g += row[-stride+1]; b += row[-stride+2]; n++; } if (y+1 < h && row[stride+3] != 0) { r += row[stride]; g += row[stride+1]; b += row[stride+2]; n++; } if (n > 0) { row[0] = (unsigned char)(r/n); row[1] = (unsigned char)(g/n); row[2] = (unsigned char)(b/n); } } row += 4; } } } static void nsvg__initPaint(NSVGcachedPaint* cache, NSVGpaint* paint, float opacity) { int i, j; NSVGgradient* grad; cache->type = paint->type; if (paint->type == NSVG_PAINT_COLOR) { cache->colors[0] = nsvg__applyOpacity(paint->color, opacity); return; } grad = paint->gradient; cache->spread = grad->spread; memcpy(cache->xform, grad->xform, sizeof(float)*6); if (grad->nstops == 0) { for (i = 0; i < 256; i++) cache->colors[i] = 0; } if (grad->nstops == 1) { for (i = 0; i < 256; i++) cache->colors[i] = nsvg__applyOpacity(grad->stops[i].color, opacity); } else { unsigned int ca, cb = 0; float ua, ub, du, u; int ia, ib, count; ca = nsvg__applyOpacity(grad->stops[0].color, opacity); ua = nsvg__clampf(grad->stops[0].offset, 0, 1); ub = nsvg__clampf(grad->stops[grad->nstops-1].offset, ua, 1); ia = (int)(ua * 255.0f); ib = (int)(ub * 255.0f); for (i = 0; i < ia; i++) { cache->colors[i] = ca; } for (i = 0; i < grad->nstops-1; i++) { ca = nsvg__applyOpacity(grad->stops[i].color, opacity); cb = nsvg__applyOpacity(grad->stops[i+1].color, opacity); ua = nsvg__clampf(grad->stops[i].offset, 0, 1); ub = nsvg__clampf(grad->stops[i+1].offset, 0, 1); ia = (int)(ua * 255.0f); ib = (int)(ub * 255.0f); count = ib - ia; if (count <= 0) continue; u = 0; du = 1.0f / (float)count; for (j = 0; j < count; j++) { cache->colors[ia+j] = nsvg__lerpRGBA(ca,cb,u); u += du; } } for (i = ib; i < 256; i++) cache->colors[i] = cb; } } /* static void dumpEdges(NSVGrasterizer* r, const char* name) { float xmin = 0, xmax = 0, ymin = 0, ymax = 0; NSVGedge *e = NULL; int i; if (r->nedges == 0) return; FILE* fp = fopen(name, "w"); if (fp == NULL) return; xmin = xmax = r->edges[0].x0; ymin = ymax = r->edges[0].y0; for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; xmin = nsvg__minf(xmin, e->x0); xmin = nsvg__minf(xmin, e->x1); xmax = nsvg__maxf(xmax, e->x0); xmax = nsvg__maxf(xmax, e->x1); ymin = nsvg__minf(ymin, e->y0); ymin = nsvg__minf(ymin, e->y1); ymax = nsvg__maxf(ymax, e->y0); ymax = nsvg__maxf(ymax, e->y1); } fprintf(fp, "<svg viewBox=\"%f %f %f %f\" xmlns=\"http://www.w3.org/2000/svg\">", xmin, ymin, (xmax - xmin), (ymax - ymin)); for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; fprintf(fp ,"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke:#000;\" />", e->x0,e->y0, e->x1,e->y1); } for (i = 0; i < r->npoints; i++) { if (i+1 < r->npoints) fprintf(fp ,"<line x1=\"%f\" y1=\"%f\" x2=\"%f\" y2=\"%f\" style=\"stroke:#f00;\" />", r->points[i].x, r->points[i].y, r->points[i+1].x, r->points[i+1].y); fprintf(fp ,"<circle cx=\"%f\" cy=\"%f\" r=\"1\" style=\"fill:%s;\" />", r->points[i].x, r->points[i].y, r->points[i].flags == 0 ? "#f00" : "#0f0"); } fprintf(fp, "</svg>"); fclose(fp); } */ NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r, NSVGimage* image, float tx, float ty, float scale, unsigned char* dst, int w, int h, int stride) { NSVGshape *shape = NULL; NSVGedge *e = NULL; NSVGcachedPaint cache; int i; r->bitmap = dst; r->width = w; r->height = h; r->stride = stride; if (w > r->cscanline) { r->cscanline = w; r->scanline = (unsigned char*)NANOSVG_realloc(r->scanline, w); if (r->scanline == NULL) return; } for (i = 0; i < h; i++) memset(&dst[i*stride], 0, w*4); for (shape = image->shapes; shape != NULL; shape = shape->next) { if (!(shape->flags & NSVG_FLAGS_VISIBLE)) continue; if (shape->fill.type != NSVG_PAINT_NONE) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); // Scale and translate edges for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } // Rasterize edges qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule nsvg__initPaint(&cache, &shape->fill, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule); } if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShapeStroke(r, shape, scale); // dumpEdges(r, "edge.svg"); // Scale and translate edges for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } // Rasterize edges qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); // now, traverse the scanlines and find the intersections on each scanline, use non-zero rule nsvg__initPaint(&cache, &shape->stroke, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO); } } nsvg__unpremultiplyAlpha(dst, w, h, stride); r->bitmap = NULL; r->width = 0; r->height = 0; r->stride = 0; } #endif |
Changes to generic/tk.decls.
︙ | ︙ | |||
101 102 103 104 105 106 107 | void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc) } declare 18 { int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 19 { | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc) } declare 18 { int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 19 { const char *Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 20 { Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas) } declare 21 { void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x, double y, |
︙ | ︙ | |||
142 143 144 145 146 147 148 | int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags) } declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags) } declare 29 { int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, const char **argv, char *widgRec, int flags) } declare 30 { void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr) } declare 31 { |
︙ | ︙ | |||
241 242 243 244 245 246 247 | declare 53 { void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target) } declare 54 { void Tk_DestroyWindow(Tk_Window tkwin) } declare 55 { | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | declare 53 { void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target) } declare 54 { void Tk_DestroyWindow(Tk_Window tkwin) } declare 55 { const char *Tk_DisplayName(Tk_Window tkwin) } declare 56 { int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y) } declare 57 { void Tk_Draw3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, |
︙ | ︙ | |||
322 323 324 325 326 327 328 | } declare 75 { void Tk_FreePixmap(Display *display, Pixmap pixmap) } declare 76 { void Tk_FreeTextLayout(Tk_TextLayout textLayout) } | | | 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | } declare 75 { void Tk_FreePixmap(Display *display, Pixmap pixmap) } declare 76 { void Tk_FreeTextLayout(Tk_TextLayout textLayout) } declare 77 {deprecated {function does nothing, call can be removed}} { void Tk_FreeXId(Display *display, XID xid) } declare 78 { GC Tk_GCForColor(XColor *colorPtr, Drawable drawable) } declare 79 { void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight) |
︙ | ︙ | |||
344 345 346 347 348 349 350 | Tk_BindingTable bindingTable, ClientData object) } declare 82 { int Tk_GetAnchor(Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr) } declare 83 { | | | | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | Tk_BindingTable bindingTable, ClientData object) } declare 82 { int Tk_GetAnchor(Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr) } declare 83 { const char *Tk_GetAtomName(Tk_Window tkwin, Atom atom) } declare 84 { const char *Tk_GetBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr) } declare 85 { Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, const char *str) } declare 86 { |
︙ | ︙ | |||
400 401 402 403 404 405 406 | } declare 97 { Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData) } declare 98 { ClientData Tk_GetImageMasterData(Tcl_Interp *interp, | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | } declare 97 { Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData) } declare 98 { ClientData Tk_GetImageMasterData(Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr) } declare 99 { Tk_ItemType *Tk_GetItemTypes(void) } declare 100 { int Tk_GetJoinStyle(Tcl_Interp *interp, const char *str, int *joinPtr) } |
︙ | ︙ | |||
435 436 437 438 439 440 441 | int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr) } declare 107 { void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr) } declare 108 { int Tk_GetScrollInfo(Tcl_Interp *interp, | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 | int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr) } declare 107 { void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr) } declare 108 { int Tk_GetScrollInfo(Tcl_Interp *interp, int argc, const char **argv, double *dblPtr, int *intPtr) } declare 109 { int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr) } declare 110 { int Tk_GetSelection(Tcl_Interp *interp, |
︙ | ︙ | |||
514 515 516 517 518 519 520 | declare 128 { void Tk_MoveWindow(Tk_Window tkwin, int x, int y) } declare 129 { void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y) } declare 130 { | | | | | | | | | | | | | | | | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | declare 128 { void Tk_MoveWindow(Tk_Window tkwin, int x, int y) } declare 129 { void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y) } declare 130 { const char *Tk_NameOf3DBorder(Tk_3DBorder border) } declare 131 { const char *Tk_NameOfAnchor(Tk_Anchor anchor) } declare 132 { const char *Tk_NameOfBitmap(Display *display, Pixmap bitmap) } declare 133 { const char *Tk_NameOfCapStyle(int cap) } declare 134 { const char *Tk_NameOfColor(XColor *colorPtr) } declare 135 { const char *Tk_NameOfCursor(Display *display, Tk_Cursor cursor) } declare 136 { const char *Tk_NameOfFont(Tk_Font font) } declare 137 { const char *Tk_NameOfImage(Tk_ImageMaster imageMaster) } declare 138 { const char *Tk_NameOfJoinStyle(int join) } declare 139 { const char *Tk_NameOfJustify(Tk_Justify justify) } declare 140 { const char *Tk_NameOfRelief(int relief) } declare 141 { Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin) } declare 142 { void Tk_OwnSelection(Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, ClientData clientData) } declare 143 { int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags) } declare 144 {deprecated {function signature changed}} { void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height) } declare 145 {deprecated {function signature changed}} { void Tk_PhotoPutZoomedBlock_NoComposite(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY) } declare 146 { int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr) } declare 147 { void Tk_PhotoBlank(Tk_PhotoHandle handle) } declare 148 {deprecated {function signature changed}} { void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height ) } declare 149 { void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr) } declare 150 {deprecated {function signature changed}} { void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height) } declare 151 { int Tk_PointToChar(Tk_TextLayout layout, int x, int y) } declare 152 { int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString *dsPtr) |
︙ | ︙ | |||
740 741 742 743 744 745 746 | declare 193 { void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 194 { void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 195 { | | | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | declare 193 { void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 194 { void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 195 { void Tk_FreeConfigOptions(void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } declare 196 { void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr) } declare 197 { void Tk_FreeCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) |
︙ | ︙ | |||
770 771 772 773 774 775 776 | XColor *Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 203 { Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 204 { Tcl_Obj *Tk_GetOptionInfo(Tcl_Interp *interp, | | | | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | XColor *Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 203 { Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr) } declare 204 { Tcl_Obj *Tk_GetOptionInfo(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin) } declare 205 { Tcl_Obj *Tk_GetOptionValue(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin) } declare 206 { int Tk_GetJustifyFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr) } declare 207 { |
︙ | ︙ | |||
798 799 800 801 802 803 804 | Tcl_Obj *objPtr, int *resultPtr) } declare 210 { int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) } declare 211 { | | | | | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 | Tcl_Obj *objPtr, int *resultPtr) } declare 210 { int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr) } declare 211 { int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin) } declare 212 {nostub {Don't use this function in a stub-enabled extension}} { void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp) } declare 213 { void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr) } declare 214 { int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr) } declare 215 { void Tk_InitConsoleChannels(Tcl_Interp *interp) } |
︙ | ︙ | |||
939 940 941 942 943 944 945 | } # New in 8.4a5 # declare 245 { void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) } | | | | 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 | } # New in 8.4a5 # declare 245 { void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height) } declare 246 {deprecated {function signature changed}} { void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule) } declare 247 {deprecated {function signature changed}} { void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule) } declare 248 { int Tk_CollapseMotionEvents(Display *display, int collapse) |
︙ | ︙ | |||
997 998 999 1000 1001 1002 1003 | } declare 260 { Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable) } declare 261 { void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, | | | | | | 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | } declare 260 { Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable) } declare 261 { void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr) } declare 262 { void Tk_GetElementBox(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr) } declare 263 { int Tk_GetElementBorderWidth(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin) } declare 264 { void Tk_DrawElement(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state) } # TIP#116 declare 265 { int Tk_PhotoExpand(Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height) |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 | # Public functions that are not accessible via the stubs table. export { const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact) } # Local Variables: # mode: tcl # End: | > > > > > > > > | 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | # Public functions that are not accessible via the stubs table. export { const char *Tk_PkgInitStubsCheck(Tcl_Interp *interp, const char *version, int exact) } export { void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp) } export { void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); } # Local Variables: # mode: tcl # End: |
Changes to generic/tk.h.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TK #define _TK #include <tcl.h> | | | < < < < < < < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #ifndef _TK #define _TK #include <tcl.h> #if (TCL_MAJOR_VERSION < 8) || (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 6) # error Tk 8.7 must be compiled with tcl.h from Tcl 8.6 or better #endif #ifndef EXTERN # define EXTERN extern TCL_STORAGE_CLASS #endif /* * Utility macros: STRINGIFY takes an argument and wraps it in "" (double * quotation marks), JOIN joins two arguments. |
︙ | ︙ | |||
55 56 57 58 59 60 61 | #endif /* * When version numbers change here, you must also go into the following files * and update the version numbers: * * library/tk.tcl (1 LOC patch) | | | | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #endif /* * When version numbers change here, you must also go into the following files * and update the version numbers: * * library/tk.tcl (1 LOC patch) * unix/configure.ac (2 LOC Major, 2 LOC minor, 1 LOC patch) * win/configure.ac (as above) * README (sections 0 and 1) * macosx/Tk-Common.xcconfig (not patchlevel) 1 LOC * win/README (not patchlevel) * unix/README (not patchlevel) * unix/tk.spec (1 LOC patch) * win/tcl.m4 (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 7 #define TK_RELEASE_LEVEL TCL_ALPHA_RELEASE #define TK_RELEASE_SERIAL 2 #define TK_VERSION "8.7" #define TK_PATCH_LEVEL "8.7a2" /* * A special definition used to allow this header file to be included from * windows or mac resource files so that they can obtain version information. * RC_INVOKED is defined by default by the windows RC tool and manually set * for macintosh. * |
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #ifdef __STDC__ # include <stddef.h> #endif #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #endif /* *---------------------------------------------------------------------- * * Decide whether or not to use input methods. */ | > > > > | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | #ifdef __STDC__ # include <stddef.h> #endif #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #else # ifndef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLIMPORT # endif #endif /* *---------------------------------------------------------------------- * * Decide whether or not to use input methods. */ |
︙ | ︙ | |||
186 187 188 189 190 191 192 | const char *optionName; /* Name used to specify option in Tcl * commands. */ const char *dbName; /* Name for option in option database. */ const char *dbClass; /* Class for option in database. */ const char *defValue; /* Default value for option if not specified * in command line, the option database, or * the system. */ | > | | | | > > > > | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | const char *optionName; /* Name used to specify option in Tcl * commands. */ const char *dbName; /* Name for option in option database. */ const char *dbClass; /* Class for option in database. */ const char *defValue; /* Default value for option if not specified * in command line, the option database, or * the system. */ #if TCL_MAJOR_VERSION > 8 size_t 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 offsetof macro to generate * values for this. -1 means don't store the * Tcl_Obj in the record. */ size_t 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 offsetof * macro to generate values for it. -1 means * don't store the internal representation in * the record. */ #else int objOffset; int internalOffset; #endif int flags; /* Any combination of the values defined * below. */ const void *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 |
︙ | ︙ | |||
262 263 264 265 266 267 268 | } Tk_ObjCustomOption; /* * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure. * Computes number of bytes from beginning of structure to a given field. */ | | | | > > | | | > | > > > | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | } Tk_ObjCustomOption; /* * Macro to use to fill in "offset" fields of the Tk_OptionSpec structure. * Computes number of bytes from beginning of structure to a given field. */ #ifndef TK_NO_DEPRECATED # define Tk_Offset(type, field) ((int) offsetof(type, field)) #endif /* Workaround for platforms missing offsetof(), e.g. VC++ 6.0 */ #ifndef offsetof # define offsetof(type, field) ((size_t) ((char *) &((type *) 0)->field)) #endif /* * The following two structures are used for error handling. When config * 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 was * not 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 the field * optionPtr->specPtr->objOffset is -1. The * space must be large enough to accommodate a * double, a long, or a pointer; right now it * looks like a double (i.e., 8 bytes) 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 { void *recordPtr; /* The data structure in which to restore * configuration options. */ Tk_Window tkwin; /* Window associated with recordPtr; needed to * restore certain options. */ #if TCL_MAJOR_VERSION > 8 size_t numItems; /* The number of valid items in items field. */ #else int numItems; #endif 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. */ |
︙ | ︙ | |||
331 332 333 334 335 336 337 | * This is a temporary flag used while tkObjConfig and new widgets are in * development. */ #ifndef __NO_OLD_CONFIG typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp, | | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | * This is a temporary flag used while tkObjConfig and new widgets are in * development. */ #ifndef __NO_OLD_CONFIG typedef int (Tk_OptionParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); typedef const char *(Tk_OptionPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); typedef struct Tk_CustomOption { Tk_OptionParseProc *parseProc; /* Procedure to call to parse an option and * store it in converted form. */ Tk_OptionPrintProc *printProc; |
︙ | ︙ | |||
358 359 360 361 362 363 364 | * database, etc. */ typedef struct Tk_ConfigSpec { int type; /* Type of option, such as TK_CONFIG_COLOR; * see definitions below. Last option in table * must have type TK_CONFIG_END. */ | | > | | > > > | | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | * database, etc. */ typedef struct Tk_ConfigSpec { int type; /* Type of option, such as TK_CONFIG_COLOR; * see definitions below. Last option in table * must have type TK_CONFIG_END. */ const char *argvName; /* Switch used to specify option in argv. NULL * means this spec is part of a group. */ Tk_Uid dbName; /* Name for option in option database. */ Tk_Uid dbClass; /* Class for option in database. */ Tk_Uid defValue; /* Default value for option if not specified * in command line or database. */ #if TCL_MAJOR_VERSION > 8 size_t offset; /* Where in widget record to store value; use * offsetof macro to generate values for * this. */ #else int offset; #endif int specFlags; /* Any combination of the values defined * below; other bits are used internally by * tkConfig.c. */ const Tk_CustomOption *customPtr; /* If type is TK_CONFIG_CUSTOM then this is a * pointer to info about how to parse and * print the option. Otherwise it is * irrelevant. */ } Tk_ConfigSpec; /* |
︙ | ︙ | |||
410 411 412 413 414 415 416 | * (internal-use-only flags are defined there). */ #define TK_CONFIG_NULL_OK (1 << 0) #define TK_CONFIG_COLOR_ONLY (1 << 1) #define TK_CONFIG_MONO_ONLY (1 << 2) #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) | > | > | | | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | * (internal-use-only flags are defined there). */ #define TK_CONFIG_NULL_OK (1 << 0) #define TK_CONFIG_COLOR_ONLY (1 << 1) #define TK_CONFIG_MONO_ONLY (1 << 2) #define TK_CONFIG_DONT_SET_DEFAULT (1 << 3) #ifndef TK_NO_DEPRECATED # define TK_CONFIG_OPTION_SPECIFIED (1 << 4) #endif /* !TK_NO_DEPRECATED */ #define TK_CONFIG_USER_BIT 0x100 #endif /* __NO_OLD_CONFIG */ /* * Structure used to specify how to handle argv options. */ typedef struct { const char *key; /* The key string that flags the option in the * argv array. */ int type; /* Indicates option type; see below. */ void *src; /* Value to be used in setting dst; usage * depends on type. */ void *dst; /* Address of value to be modified; usage * depends on type. */ const 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. */ |
︙ | ︙ | |||
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent, ClientData instanceData); typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData); typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr); typedef struct Tk_ClassProcs { unsigned int size; Tk_ClassWorldChangedProc *worldChangedProc; /* Procedure to invoke when the widget needs * to respond in some way to a change in the * world (font changes, etc.) */ Tk_ClassCreateProc *createProc; /* Procedure to invoke when the platform- * dependent window needs to be created. */ | > > > > | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | typedef Window (Tk_ClassCreateProc) (Tk_Window tkwin, Window parent, ClientData instanceData); typedef void (Tk_ClassWorldChangedProc) (ClientData instanceData); typedef void (Tk_ClassModalProc) (Tk_Window tkwin, XEvent *eventPtr); typedef struct Tk_ClassProcs { #if TCL_MAJOR_VERSION > 8 size_t size; #else unsigned int size; #endif Tk_ClassWorldChangedProc *worldChangedProc; /* Procedure to invoke when the widget needs * to respond in some way to a change in the * world (font changes, etc.) */ Tk_ClassCreateProc *createProc; /* Procedure to invoke when the platform- * dependent window needs to be created. */ |
︙ | ︙ | |||
596 597 598 599 600 601 602 | * (or NULL if the structure is NULL). * * A more general version of this function may be useful if other * size-versioned structure pop up in the future: * * #define Tk_GetField(name, who, which) \ * (((who) == NULL) ? NULL : | | | | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | * (or NULL if the structure is NULL). * * A more general version of this function may be useful if other * size-versioned structure pop up in the future: * * #define Tk_GetField(name, who, which) \ * (((who) == NULL) ? NULL : * (((who)->size <= offsetof(name, which)) ? NULL :(name)->which)) */ #define Tk_GetClassProc(procs, which) \ (((procs) == NULL) ? NULL : \ (((procs)->size <= offsetof(Tk_ClassProcs, which)) ? NULL:(procs)->which)) /* * Each geometry manager (the packer, the placer, etc.) is represented by a * structure of the following form, which indicates procedures to invoke in * the geometry manager to carry out certain functions. */ |
︙ | ︙ | |||
672 673 674 675 676 677 678 | typedef struct { int type; unsigned long serial; /* # of last request processed by server. */ Bool send_event; /* True if this came from a SendEvent * request. */ Display *display; /* Display the event was read from. */ Window event; /* Window on which event was requested. */ | | | 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | typedef struct { int type; unsigned long serial; /* # of last request processed by server. */ Bool send_event; /* True if this came from a SendEvent * request. */ Display *display; /* Display the event was read from. */ Window event; /* Window on which event was requested. */ Window root; /* Root window that the event occurred on. */ Window subwindow; /* Child window. */ Time time; /* Milliseconds. */ int x, y; /* Pointer x, y coordinates in event * window. */ int x_root, y_root; /* Coordinates relative to root. */ unsigned int state; /* Key or button mask */ Tk_Uid name; /* Name of virtual event. */ |
︙ | ︙ | |||
742 743 744 745 746 747 748 | (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED) #define Tk_TopWinHierarchy(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) #define Tk_IsManageable(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) | | > | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 | (((Tk_FakeWin *) (tkwin))->flags & TK_WIN_MANAGED) #define Tk_TopWinHierarchy(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_TOP_HIERARCHY) #define Tk_IsManageable(tkwin) \ (((Tk_FakeWin *) (tkwin))->flags & TK_WM_MANAGEABLE) #define Tk_ReqWidth(tkwin) (((Tk_FakeWin *) (tkwin))->reqWidth) #define Tk_ReqHeight(tkwin) (((Tk_FakeWin *) (tkwin))->reqHeight) #ifndef TK_NO_DEPRECATED #define Tk_InternalBorderWidth(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderLeft) #endif /* !TK_NO_DEPRECATED */ #define Tk_InternalBorderLeft(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderLeft) #define Tk_InternalBorderRight(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderRight) #define Tk_InternalBorderTop(tkwin) \ (((Tk_FakeWin *) (tkwin))->internalBorderTop) #define Tk_InternalBorderBottom(tkwin) \ |
︙ | ︙ | |||
809 810 811 812 813 814 815 | ClientData dummy18; /* instanceData */ char *dummy19; /* privatePtr */ int internalBorderRight; int internalBorderTop; int internalBorderBottom; int minReqWidth; int minReqHeight; | < | > > | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | ClientData dummy18; /* instanceData */ char *dummy19; /* privatePtr */ int internalBorderRight; int internalBorderTop; int internalBorderBottom; int minReqWidth; int minReqHeight; #ifdef TK_USE_INPUT_METHODS int dummy20; #endif /* TK_USE_INPUT_METHODS */ char *dummy21; /* geomMgrName */ Tk_Window dummy22; /* maintainerPtr */ } Tk_FakeWin; /* * Flag values for TkWindow (and Tk_FakeWin) structures are: * * TK_MAPPED: 1 means window is currently mapped, * 0 means unmapped. |
︙ | ︙ | |||
914 915 916 917 918 919 920 | typedef enum { TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED, TK_STATE_NORMAL, TK_STATE_HIDDEN } Tk_State; typedef struct Tk_SmoothMethod { | | | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | typedef enum { TK_STATE_NULL = -1, TK_STATE_ACTIVE, TK_STATE_DISABLED, TK_STATE_NORMAL, TK_STATE_HIDDEN } Tk_State; typedef struct Tk_SmoothMethod { const char *name; int (*coordProc) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); void (*postscriptProc) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, int numPoints, int numSteps); } Tk_SmoothMethod; /* |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | int height); typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); #ifdef USE_OLD_CANVAS typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, | > > | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | int height); typedef double (Tk_ItemPointProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); typedef int (Tk_ItemAreaProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); typedef int (Tk_ItemPostscriptProc)(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); typedef void (Tk_ItemRotateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRadians); typedef void (Tk_ItemScaleProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); typedef void (Tk_ItemTranslateProc)(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); #ifdef USE_OLD_CANVAS typedef int (Tk_ItemIndexProc)(Tcl_Interp *interp, Tk_Canvas canvas, |
︙ | ︙ | |||
1042 1043 1044 1045 1046 1047 1048 | #endif /* USE_OLD_CANVAS */ typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); #ifndef __NO_OLD_CONFIG typedef struct Tk_ItemType { | | > | > > > | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | #endif /* USE_OLD_CANVAS */ typedef void (Tk_ItemDCharsProc)(Tk_Canvas canvas, Tk_Item *itemPtr, int first, int last); #ifndef __NO_OLD_CONFIG typedef struct Tk_ItemType { const char *name; /* The name of this type of item, such as * "line". */ #if TCL_MAJOR_VERSION > 8 size_t itemSize; /* Total amount of space needed for item's * record. */ #else int itemSize; #endif Tk_ItemCreateProc *createProc; /* Procedure to create a new item of this * type. */ const Tk_ConfigSpec *configSpecs; /* Pointer to array of configuration specs for * this type. Used for returning configuration * info. */ Tk_ItemConfigureProc *configProc; /* Procedure to call to change configuration * options. */ Tk_ItemCoordProc *coordProc;/* Procedure to call to get and set the item's * coordinates. */ |
︙ | ︙ | |||
1092 1093 1094 1095 1096 1097 1098 | Tk_ItemInsertProc *insertProc; /* Procedure to insert something into an * item. */ Tk_ItemDCharsProc *dCharsProc; /* Procedure to delete characters from an * item. */ struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */ | > > | | 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | Tk_ItemInsertProc *insertProc; /* Procedure to insert something into an * item. */ Tk_ItemDCharsProc *dCharsProc; /* Procedure to delete characters from an * item. */ struct Tk_ItemType *nextPtr;/* Used to link types together into a list. */ Tk_ItemRotateProc *rotateProc; /* Procedure to rotate an item's coordinates * about a point. */ int reserved2; /* Carefully compatible with */ char *reserved3; /* Jan Nijtmans dash patch */ char *reserved4; } Tk_ItemType; /* * Flag (used in the alwaysRedraw field) to say whether an item supports |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 | typedef struct Tk_ImageType Tk_ImageType; #ifdef USE_OLD_IMAGE typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr); #else | | | | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | typedef struct Tk_ImageType Tk_ImageType; #ifdef USE_OLD_IMAGE typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, char *name, int argc, char **argv, Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr); #else typedef int (Tk_ImageCreateProc) (Tcl_Interp *interp, const char *name, int objc, Tcl_Obj *const objv[], const Tk_ImageType *typePtr, Tk_ImageMaster master, ClientData *masterDataPtr); #endif /* USE_OLD_IMAGE */ typedef ClientData (Tk_ImageGetProc) (Tk_Window tkwin, ClientData masterData); typedef void (Tk_ImageDisplayProc) (ClientData instanceData, Display *display, Drawable drawable, int imageX, int imageY, int width, int height, int drawableX, int drawableY); typedef void (Tk_ImageFreeProc) (ClientData instanceData, Display *display); |
︙ | ︙ | |||
1244 1245 1246 1247 1248 1249 1250 | * image, etc.). It provides information common to all images of that type, * such as the type name and a collection of procedures in the image manager * that respond to various events. Each image manager is represented by one of * these structures. */ struct Tk_ImageType { | | | 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 | * image, etc.). It provides information common to all images of that type, * such as the type name and a collection of procedures in the image manager * that respond to various events. Each image manager is represented by one of * these structures. */ struct Tk_ImageType { const char *name; /* Name of image type. */ Tk_ImageCreateProc *createProc; /* Procedure to call to create a new image of * this type. */ Tk_ImageGetProc *getProc; /* Procedure to call the first time * Tk_GetImage is called in a new way (new * visual or screen). */ Tk_ImageDisplayProc *displayProc; |
︙ | ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | /* * The following structure represents a particular file format for storing * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image * files of that format to be recognized and read into a photo image. */ struct Tk_PhotoImageFormat { | | | 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | /* * The following structure represents a particular file format for storing * images (e.g., PPM, GIF, JPEG, etc.). It provides information to allow image * files of that format to be recognized and read into a photo image. */ struct Tk_PhotoImageFormat { const char *name; /* Name of image file format */ Tk_ImageFileMatchProc *fileMatchProc; /* Procedure to call to determine whether an * image file matches this format. */ Tk_ImageStringMatchProc *stringMatchProc; /* Procedure to call to determine whether the * data in a string matches this format. */ Tk_ImageFileReadProc *fileReadProc; |
︙ | ︙ | |||
1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | * The definitions below provide backward compatibility for functions and * types related to event handling that used to be in Tk but have moved to * Tcl. * *---------------------------------------------------------------------- */ #define TK_READABLE TCL_READABLE #define TK_WRITABLE TCL_WRITABLE #define TK_EXCEPTION TCL_EXCEPTION #define TK_DONT_WAIT TCL_DONT_WAIT #define TK_X_EVENTS TCL_WINDOW_EVENTS #define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS | > | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | * The definitions below provide backward compatibility for functions and * types related to event handling that used to be in Tk but have moved to * Tcl. * *---------------------------------------------------------------------- */ #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 #define TK_READABLE TCL_READABLE #define TK_WRITABLE TCL_WRITABLE #define TK_EXCEPTION TCL_EXCEPTION #define TK_DONT_WAIT TCL_DONT_WAIT #define TK_X_EVENTS TCL_WINDOW_EVENTS #define TK_WINDOW_EVENTS TCL_WINDOW_EVENTS |
︙ | ︙ | |||
1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 | /* Additional stuff that has moved to Tcl: */ #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 */ #if defined(_WIN32) || defined(__CYGWIN__) #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) #else #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ | > | 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 | /* Additional stuff that has moved to Tcl: */ #define Tk_EventuallyFree Tcl_EventuallyFree #define Tk_FreeProc Tcl_FreeProc #define Tk_Preserve Tcl_Preserve #define Tk_Release Tcl_Release #endif /* Removed Tk_Main, use macro instead */ #if defined(_WIN32) || defined(__CYGWIN__) #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ (Tcl_FindExecutable(0), (Tcl_CreateInterp)())) #else #define Tk_Main(argc, argv, proc) Tk_MainEx(argc, argv, proc, \ |
︙ | ︙ | |||
1527 1528 1529 1530 1531 1532 1533 | */ typedef int (Tk_ErrorProc) (ClientData clientData, XErrorEvent *errEventPtr); typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp, | | | 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | */ typedef int (Tk_ErrorProc) (ClientData clientData, XErrorEvent *errEventPtr); typedef void (Tk_EventProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_GenericProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_ClientMessageProc) (Tk_Window tkwin, XEvent *eventPtr); typedef int (Tk_GetSelProc) (ClientData clientData, Tcl_Interp *interp, const char *portion); typedef void (Tk_LostSelProc) (ClientData clientData); typedef Tk_RestrictAction (Tk_RestrictProc) (ClientData clientData, XEvent *eventPtr); typedef int (Tk_SelectionProc) (ClientData clientData, int offset, char *buffer, int maxBytes); /* |
︙ | ︙ | |||
1555 1556 1557 1558 1559 1560 1561 | #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat #endif /* USE_OLD_IMAGE */ /* *---------------------------------------------------------------------- * * Allow users to say that they don't want to alter their source to add extra | | > | 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 | #define Tk_CreatePhotoImageFormat Tk_CreateOldPhotoImageFormat #endif /* USE_OLD_IMAGE */ /* *---------------------------------------------------------------------- * * Allow users to say that they don't want to alter their source to add extra * arguments to Tk_PhotoPutBlock() et al. * * This goes after the inclusion of the stubbed-decls so that the declarations * of what is actually there can be correct. */ #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 #ifdef USE_COMPOSITELESS_PHOTO_PUT_BLOCK # ifdef Tk_PhotoPutBlock # undef Tk_PhotoPutBlock # endif # define Tk_PhotoPutBlock Tk_PhotoPutBlock_NoComposite # ifdef Tk_PhotoPutZoomedBlock # undef Tk_PhotoPutZoomedBlock |
︙ | ︙ | |||
1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | # endif # define Tk_PhotoExpand Tk_PhotoExpand_Panic # ifdef Tk_PhotoSetSize # undef Tk_PhotoSetSize # endif # define Tk_PhotoSetSize Tk_PhotoSetSize_Panic #endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* RC_INVOKED */ /* | > | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 | # endif # define Tk_PhotoExpand Tk_PhotoExpand_Panic # ifdef Tk_PhotoSetSize # undef Tk_PhotoSetSize # endif # define Tk_PhotoSetSize Tk_PhotoSetSize_Panic #endif /* USE_PANIC_ON_PHOTO_ALLOC_FAILURE */ #endif /* !TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* RC_INVOKED */ /* |
︙ | ︙ |
Changes to generic/tk3d.c.
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | * 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 | | | 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | * 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 * initialized. The final form cannot be done without a Tk_Window. * *---------------------------------------------------------------------- */ static void InitBorderObj( Tcl_Obj *objPtr) /* The object to convert. */ |
︙ | ︙ | |||
1376 1377 1378 1379 1380 1381 1382 | if (borderPtr == NULL) { Tcl_Panic("TkDebugBorder found empty hash table entry"); } for ( ; (borderPtr != NULL); borderPtr = borderPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 | if (borderPtr == NULL) { Tcl_Panic("TkDebugBorder found empty hash table entry"); } for ( ; (borderPtr != NULL); borderPtr = borderPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(borderPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(borderPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tk3d.h.
︙ | ︙ | |||
24 25 26 27 28 29 30 | 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. */ | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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. */ TkSizeT 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 objRefCount and * resourceRefCount are both 0. */ TkSizeT 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 * haven't been allocated yet.*/ XColor *lightColorPtr; /* Color used for lighter areas of border |
︙ | ︙ |
Changes to generic/tkArgv.c.
︙ | ︙ | |||
224 225 226 227 228 229 230 | return TCL_ERROR; } srcIndex++; argc--; break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); | | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | return TCL_ERROR; } srcIndex++; argc--; break; case TK_ARGV_FUNC: { typedef int (ArgvFunc)(char *, const char *, const char *); ArgvFunc *handlerProc = infoPtr->src; if (handlerProc(infoPtr->dst, infoPtr->key, argv[srcIndex])) { srcIndex++; argc--; } break; } case TK_ARGV_GENFUNC: { typedef int (ArgvGenFunc)(char *, Tcl_Interp *, const char *, int, const char **); ArgvGenFunc *handlerProc = infoPtr->src; argc = handlerProc(infoPtr->dst, interp, infoPtr->key, argc, argv+srcIndex); if (argc < 0) { return TCL_ERROR; } break; |
︙ | ︙ |
Changes to generic/tkArray.h.
︙ | ︙ | |||
157 158 159 160 161 162 163 | * argument. If not found then -1 will be returned. */ /*************************************************************************/ #ifndef TK_ARRAY_DEFINED #define TK_ARRAY_DEFINED | | < < | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | * argument. If not found then -1 will be returned. */ /*************************************************************************/ #ifndef TK_ARRAY_DEFINED #define TK_ARRAY_DEFINED #include "tkInt.h" #if defined(__GNUC__) || defined(__clang__) # define __TK_ARRAY_UNUSED __attribute__((unused)) #else # define __TK_ARRAY_UNUSED #endif |
︙ | ︙ |
Changes to generic/tkAtom.c.
︙ | ︙ | |||
152 153 154 155 156 157 158 | hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); if (mustFree) { XFree(mustFree); } name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); if (mustFree) { XFree(mustFree); } name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } return Tcl_GetHashValue(hPtr); } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
198 199 200 201 202 203 204 | } name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); | | | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | } name = atomNameArray[atom - 1]; hPtr = Tcl_CreateHashEntry(&dispPtr->nameTable, name, &isNew); Tcl_SetHashValue(hPtr, INT2PTR(atom)); name = Tcl_GetHashKey(&dispPtr->nameTable, hPtr); hPtr = Tcl_CreateHashEntry(&dispPtr->atomTable, INT2PTR(atom), &isNew); Tcl_SetHashValue(hPtr, (char *)name); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkBind.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | #include "tkWinInt.h" #elif defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #else /* if defined(__unix__) */ #include "tkUnixInt.h" #endif | < < < < < < < < < < < < < < | | | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | #include "tkWinInt.h" #elif defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #else /* if defined(__unix__) */ #include "tkUnixInt.h" #endif #if NDEBUG # define DEBUG(expr) #else # define DEBUG(expr) expr #endif #ifdef _MSC_VER /* * Earlier versions of MSVC don't know snprintf, but _snprintf is compatible. * Note that sprintf is deprecated. */ # define snprintf _snprintf #endif #define SIZE_OF_ARRAY(arr) (sizeof(arr)/sizeof(arr[0])) /* * File structure: * * Structure definitions and static variables. * * Init/Free this package. * * Tcl "bind" command (actually located in tkCmds.c) core implementation, plus helpers. * * Tcl "event" command implementation, plus helpers. * * Package-specific common helpers. * * Non-package-specific helpers. */ /* * In old implementation (the one that used an event ring), <Double-1> and <1><1> were * equivalent sequences. However it is logical to give <Double-1> higher precedence. * This is achieved by setting PREFER_MOST_SPECIALIZED_EVENT to 1. */ #ifndef PREFER_MOST_SPECIALIZED_EVENT # define PREFER_MOST_SPECIALIZED_EVENT 1 #endif /* * Traditionally motion events can be combined with buttons in this way: <B1-B2-Motion>. * However it should be allowed to express this as <Motion-1-2> in addition. This is achieved * by setting SUPPORT_ADDITIONAL_MOTION_SYNTAX to 1. */ #ifndef SUPPORT_ADDITIONAL_MOTION_SYNTAX # define SUPPORT_ADDITIONAL_MOTION_SYNTAX 1 #endif /* * The output for motion events is of the type <B1-Motion>. This can be changed to become * <Motion-1> instead by setting PRINT_SHORT_MOTION_SYNTAX to 1, however this would be a * backwards incompatibility. */ |
︙ | ︙ | |||
166 167 168 169 170 171 172 | Window window; /* Window of last match. */ struct PatSeq* psPtr; /* Pointer to pattern sequence. */ PSModMaskArr *lastModMaskArr; /* Last matching modifier mask per pattern (except last pattern). * Only needed if pattern sequence is not single (more than one * pattern), and if one of these patterns contains a non-zero * modifier mask. */ | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | Window window; /* Window of last match. */ struct PatSeq* psPtr; /* Pointer to pattern sequence. */ PSModMaskArr *lastModMaskArr; /* Last matching modifier mask per pattern (except last pattern). * Only needed if pattern sequence is not single (more than one * pattern), and if one of these patterns contains a non-zero * modifier mask. */ unsigned count; /* Only promote to next level if this count has reached count of * pattern. */ unsigned expired:1; /* Whether this entry is expired, this means it has to be removed * from promotion list. */ unsigned keepIt:1; /* Whether to keep this entry, even if expired. */ } PSEntry; /* Defining the whole PSList_* stuff (list of PSEntry items). */ |
︙ | ︙ | |||
353 354 355 356 357 358 359 | * Constants that define how close together two events must be in milliseconds * or pixels to meet the PAT_NEARBY constraint: */ #define NEARBY_PIXELS 5 #define NEARBY_MS 500 | < < < < < < | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | * Constants that define how close together two events must be in milliseconds * or pixels to meet the PAT_NEARBY constraint: */ #define NEARBY_PIXELS 5 #define NEARBY_MS 500 /* * Needed as "no-number" constant for integers. The value of this constant is * outside of integer range (type "int"). (Unfortunatly current version of * Tcl/Tk does not provide C99 integer support.) */ #define NO_NUMBER (((Tcl_WideInt) (~ (unsigned) 0)) + 1) |
︙ | ︙ | |||
398 399 400 401 402 403 404 | */ typedef struct TkBindInfo_ { VirtualEventTable virtualEventTable; /* The virtual events that exist in this interpreter. */ ScreenInfo screenInfo; /* Keeps track of the current display and screen, so it can be * restored after a binding has executed. */ | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | */ typedef struct TkBindInfo_ { VirtualEventTable virtualEventTable; /* The virtual events that exist in this interpreter. */ ScreenInfo screenInfo; /* Keeps track of the current display and screen, so it can be * restored after a binding has executed. */ int deleted; /* 1 if the application has been deleted but the structure has been * preserved. */ Time lastEventTime; /* Needed for time measurement. */ Time lastCurrentTime; /* Needed for time measurement. */ } BindInfo; /* * In X11R4 and earlier versions, XStringToKeysym is ridiculously slow. The |
︙ | ︙ | |||
438 439 440 441 442 443 444 | * information about those modifiers. The structure for storing this * information, and the hash table built at initialization time, are defined * below. */ typedef struct { const char *name; /* Name of modifier. */ | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | * information about those modifiers. The structure for storing this * information, and the hash table built at initialization time, are defined * below. */ typedef struct { const char *name; /* Name of modifier. */ ModMask mask; /* Button/modifier mask value, such as Button1Mask. */ unsigned flags; /* Various flags; see below for definitions. */ } ModInfo; /* * Flags for ModInfo structures: * * DOUBLE - Non-zero means duplicate this event, e.g. for double-clicks. |
︙ | ︙ | |||
707 708 709 710 711 712 713 | DEBUG(static int countSeqItems = 0); /* * Prototypes for local functions defined in this file: */ static void ChangeScreen(Tcl_Interp *interp, char *dispName, int screenIndex); | | | | | | | | | | | | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | DEBUG(static int countSeqItems = 0); /* * Prototypes for local functions defined in this file: */ static void ChangeScreen(Tcl_Interp *interp, char *dispName, int screenIndex); static int CreateVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, char *virtString, const char *eventString); static int DeleteVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, char *virtString, const char *eventString); static void DeleteVirtualEventTable(VirtualEventTable *vetPtr); static void ExpandPercents(TkWindow *winPtr, const char *before, Event *eventPtr, unsigned scriptCount, Tcl_DString *dsPtr); static PatSeq * FindSequence(Tcl_Interp *interp, LookupTables *lookupTables, ClientData object, const char *eventString, int create, int allowVirtual, EventMask *maskPtr); static void GetAllVirtualEvents(Tcl_Interp *interp, VirtualEventTable *vetPtr); static const char * GetField(const char *p, char *copy, unsigned size); static Tcl_Obj * GetPatternObj(const PatSeq *psPtr); static int GetVirtualEvent(Tcl_Interp *interp, VirtualEventTable *vetPtr, Tcl_Obj *virtName); static Tk_Uid GetVirtualEventUid(Tcl_Interp *interp, char *virtString); static int HandleEventGenerate(Tcl_Interp *interp, Tk_Window main, int objc, Tcl_Obj *const objv[]); static void InitVirtualEventTable(VirtualEventTable *vetPtr); static PatSeq * MatchPatterns(TkDisplay *dispPtr, Tk_BindingTable bindPtr, PSList *psList, PSList *psSuccList, unsigned patIndex, const Event *eventPtr, ClientData object, PatSeq **physPtrPtr); static int NameToWindow(Tcl_Interp *interp, Tk_Window main, Tcl_Obj *objPtr, Tk_Window *tkwinPtr); static unsigned ParseEventDescription(Tcl_Interp *interp, const char **eventStringPtr, TkPattern *patPtr, EventMask *eventMaskPtr); static void DoWarp(ClientData clientData); static PSList * GetLookupForEvent(LookupTables* lookupPtr, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents); static void ClearLookupTable(LookupTables *lookupTables, ClientData object); static void ClearPromotionLists(Tk_BindingTable bindPtr, ClientData object); static PSEntry * MakeListEntry(PSList *pool, PatSeq *psPtr, int needModMasks); static void RemovePatSeqFromLookup(LookupTables *lookupTables, PatSeq *psPtr); static void RemovePatSeqFromPromotionLists(Tk_BindingTable bindPtr, PatSeq *psPtr); static PatSeq * DeletePatSeq(PatSeq *psPtr); static void InsertPatSeq(LookupTables *lookupTables, PatSeq *psPtr); #if SUPPORT_DEBUGGING void TkpDumpPS(const PatSeq *psPtr); void TkpDumpPSList(const PSList *psList); #endif /* * Some useful helper functions. */ #ifdef SUPPORT_DEBUGGING static int BindCount = 0; #endif static unsigned Max(unsigned a, unsigned b) { return a < b ? b : a; } static int Abs(int n) { return n < 0 ? -n : n; } static int IsOdd(int n) { return n & 1; } static int TestNearbyTime(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_MS; } static int TestNearbyCoords(int lhs, int rhs) { return Abs(lhs - rhs) <= NEARBY_PIXELS; } static int IsSubsetOf( ModMask lhsMask, /* this is a subset */ ModMask rhsMask) /* of this bit field? */ { return (lhsMask & rhsMask) == lhsMask; } |
︙ | ︙ | |||
851 852 853 854 855 856 857 | for (i = 0; i < sndMatchPtr->numPats; ++i) { if (GetInfo(sndMatchPtr, i)) { sndCount += GetCount(sndMatchPtr, i); } } return sndCount - fstCount; } | | | | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 | for (i = 0; i < sndMatchPtr->numPats; ++i) { if (GetInfo(sndMatchPtr, i)) { sndCount += GetCount(sndMatchPtr, i); } } return sndCount - fstCount; } static int MatchEventNearby( const XEvent *lhs, /* previous button event */ const XEvent *rhs) /* current button event */ { assert(lhs); assert(rhs); assert(lhs->type == ButtonPress || lhs->type == ButtonRelease); assert(lhs->type == rhs->type); /* assert: lhs->xbutton.time <= rhs->xbutton.time */ return TestNearbyTime(rhs->xbutton.time, lhs->xbutton.time) && TestNearbyCoords(rhs->xbutton.x_root, lhs->xbutton.x_root) && TestNearbyCoords(rhs->xbutton.y_root, lhs->xbutton.y_root); } static int MatchEventRepeat( const XEvent *lhs, /* previous key event */ const XEvent *rhs) /* current key event */ { assert(lhs); assert(rhs); assert(lhs->type == KeyPress || lhs->type == KeyRelease); |
︙ | ︙ | |||
956 957 958 959 960 961 962 | TkDisplay *dispPtr, unsigned modMask) { assert(dispPtr); if (dispPtr->metaModMask) { if (modMask & META_MASK) { | | | | | | | < | < < | | < < | < | 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | TkDisplay *dispPtr, unsigned modMask) { assert(dispPtr); if (dispPtr->metaModMask) { if (modMask & META_MASK) { modMask &= ~(ModMask)META_MASK; modMask |= dispPtr->metaModMask; } } if (dispPtr->altModMask) { if (modMask & ALT_MASK) { modMask &= ~(ModMask)ALT_MASK; modMask |= dispPtr->altModMask; } } return modMask; } static int ButtonNumberFromState( ModMask state) { if (!(state & ALL_BUTTONS)) { return 0; } if (state & Button1Mask) { return 1; } if (state & Button2Mask) { return 2; } if (state & Button3Mask) { return 3; } if (state & Button4Mask) { return 4; } if (state & Button5Mask) { return 5; } if (state & Button6Mask) { return 6; } if (state & Button7Mask) { return 7; } if (state & Button8Mask) { return 8; } return 9; } static void SetupPatternKey( PatternTableKey *key, const PatSeq *psPtr) { const TkPattern *patPtr; |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | *-------------------------------------------------------------- */ static PSEntry * MakeListEntry( PSList *pool, PatSeq *psPtr, | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | *-------------------------------------------------------------- */ static PSEntry * MakeListEntry( PSList *pool, PatSeq *psPtr, int needModMasks) { PSEntry *newEntry = NULL; assert(pool); assert(psPtr); assert(psPtr->numPats > 0); assert(TEST_PSENTRY(psPtr)); |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | PSModMaskArr_Resize(&newEntry->lastModMaskArr, psPtr->numPats - 1); } PSModMaskArr_SetSize(newEntry->lastModMaskArr, psPtr->numPats - 1); } newEntry->psPtr = psPtr; newEntry->window = None; | | | | | 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | PSModMaskArr_Resize(&newEntry->lastModMaskArr, psPtr->numPats - 1); } PSModMaskArr_SetSize(newEntry->lastModMaskArr, psPtr->numPats - 1); } newEntry->psPtr = psPtr; newEntry->window = None; newEntry->expired = 0; newEntry->keepIt = 1; newEntry->count = 1; DEBUG(psPtr->owned = 0); return newEntry; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
1097 1098 1099 1100 1101 1102 1103 | */ static PSList * GetLookupForEvent( LookupTables* lookupTables, const Event *eventPtr, Tcl_Obj *object, | | | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 | */ static PSList * GetLookupForEvent( LookupTables* lookupTables, const Event *eventPtr, Tcl_Obj *object, int onlyConsiderDetailedEvents) { PatternTableKey key; Tcl_HashEntry *hPtr; assert(lookupTables); assert(eventPtr); |
︙ | ︙ | |||
1240 1241 1242 1243 1244 1245 1246 | */ /* * Windoze compiler does not allow the definition of these static variables inside a function, * otherwise this should belong to function TkBindInit(). */ TCL_DECLARE_MUTEX(bindMutex); | | < < < | 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 | */ /* * Windoze compiler does not allow the definition of these static variables inside a function, * otherwise this should belong to function TkBindInit(). */ TCL_DECLARE_MUTEX(bindMutex); static int initialized = 0; void TkBindInit( TkMainInfo *mainPtr) /* The newly created application. */ { BindInfo *bindInfoPtr; assert(mainPtr); /* otherwise virtual events can't be supported */ assert(sizeof(XEvent) >= sizeof(XVirtualEvent)); /* type of TkPattern.info is well defined? */ assert(sizeof(Info) >= sizeof(KeySym)); assert(sizeof(Info) >= sizeof(unsigned)); /* ensure that our matching algorithm is working (when testing detail) */ assert(sizeof(Detail) == sizeof(Tk_Uid)); /* test that constant NO_NUMBER is indeed out of integer range */ assert(sizeof(NO_NUMBER) > sizeof(int)); assert(((int) NO_NUMBER) == 0 && NO_NUMBER != 0); /* test expected indices of Button1..Button5, otherwise our button handling is not working */ assert(Button1 == 1 && Button2 == 2 && Button3 == 3 && Button4 == 4 && Button5 == 5); assert(Button2Mask == (Button1Mask << 1)); |
︙ | ︙ | |||
1285 1286 1287 1288 1289 1290 1291 | assert(Button4MotionMask == Button4Mask); assert(Button5MotionMask == Button5Mask); /* because we expect zero if keySym is empty */ assert(NoSymbol == 0L); /* this must be a union, not a struct, otherwise comparison with NULL will not work */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 | assert(Button4MotionMask == Button4Mask); assert(Button5MotionMask == Button5Mask); /* because we expect zero if keySym is empty */ assert(NoSymbol == 0L); /* this must be a union, not a struct, otherwise comparison with NULL will not work */ assert(offsetof(Detail, name) == offsetof(Detail, info)); /* we use some constraints about X*Event */ assert(offsetof(XButtonEvent, time) == offsetof(XMotionEvent, time)); assert(offsetof(XButtonEvent, x_root) == offsetof(XMotionEvent, x_root)); assert(offsetof(XButtonEvent, y_root) == offsetof(XMotionEvent, y_root)); assert(offsetof(XCreateWindowEvent, border_width) == offsetof(XConfigureEvent, border_width)); assert(offsetof(XCreateWindowEvent, width) == offsetof(XConfigureEvent, width)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XCirculateRequestEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XConfigureEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XGravityEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XMapEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XReparentEvent, window)); assert(offsetof(XCreateWindowEvent, window) == offsetof(XUnmapEvent, window)); assert(offsetof(XCreateWindowEvent, x) == offsetof(XConfigureEvent, x)); assert(offsetof(XCreateWindowEvent, x) == offsetof(XGravityEvent, x)); assert(offsetof(XCreateWindowEvent, y) == offsetof(XConfigureEvent, y)); assert(offsetof(XCreateWindowEvent, y) == offsetof(XGravityEvent, y)); assert(offsetof(XCrossingEvent, time) == offsetof(XEnterWindowEvent, time)); assert(offsetof(XCrossingEvent, time) == offsetof(XLeaveWindowEvent, time)); assert(offsetof(XCrossingEvent, time) == offsetof(XKeyEvent, time)); assert(offsetof(XKeyEvent, root) == offsetof(XButtonEvent, root)); assert(offsetof(XKeyEvent, root) == offsetof(XCrossingEvent, root)); assert(offsetof(XKeyEvent, root) == offsetof(XMotionEvent, root)); assert(offsetof(XKeyEvent, state) == offsetof(XButtonEvent, state)); assert(offsetof(XKeyEvent, state) == offsetof(XMotionEvent, state)); assert(offsetof(XKeyEvent, subwindow) == offsetof(XButtonEvent, subwindow)); assert(offsetof(XKeyEvent, subwindow) == offsetof(XCrossingEvent, subwindow)); assert(offsetof(XKeyEvent, subwindow) == offsetof(XMotionEvent, subwindow)); assert(offsetof(XKeyEvent, time) == offsetof(XButtonEvent, time)); assert(offsetof(XKeyEvent, time) == offsetof(XMotionEvent, time)); assert(offsetof(XKeyEvent, x) == offsetof(XButtonEvent, x)); assert(offsetof(XKeyEvent, x) == offsetof(XCrossingEvent, x)); assert(offsetof(XKeyEvent, x) == offsetof(XMotionEvent, x)); assert(offsetof(XKeyEvent, x_root) == offsetof(XButtonEvent, x_root)); assert(offsetof(XKeyEvent, x_root) == offsetof(XCrossingEvent, x_root)); assert(offsetof(XKeyEvent, x_root) == offsetof(XMotionEvent, x_root)); assert(offsetof(XKeyEvent, y) == offsetof(XButtonEvent, y)); assert(offsetof(XKeyEvent, y) == offsetof(XCrossingEvent, y)); assert(offsetof(XKeyEvent, y) == offsetof(XMotionEvent, y)); assert(offsetof(XKeyEvent, y_root) == offsetof(XButtonEvent, y_root)); assert(offsetof(XKeyEvent, y_root) == offsetof(XCrossingEvent, y_root)); assert(offsetof(XKeyEvent, y_root) == offsetof(XMotionEvent, y_root)); /* * Initialize the static data structures used by the binding package. They * are only initialized once, no matter how many interps are created. */ if (!initialized) { Tcl_MutexLock(&bindMutex); if (!initialized) { Tcl_HashEntry *hPtr; const ModInfo *modPtr; const EventInfo *eiPtr; int newEntry; unsigned i; #ifdef REDO_KEYSYM_LOOKUP const KeySymInfo *kPtr; Tcl_InitHashTable(&keySymTable, TCL_STRING_KEYS); Tcl_InitHashTable(&nameTable, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->name; ++kPtr) { |
︙ | ︙ | |||
1381 1382 1383 1384 1385 1386 1387 | Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS); for (eiPtr = eventArray; eiPtr->name; ++eiPtr) { hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &newEntry); Tcl_SetHashValue(hPtr, eiPtr); } | | | | 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 | Tcl_InitHashTable(&eventTable, TCL_STRING_KEYS); for (eiPtr = eventArray; eiPtr->name; ++eiPtr) { hPtr = Tcl_CreateHashEntry(&eventTable, eiPtr->name, &newEntry); Tcl_SetHashValue(hPtr, eiPtr); } initialized = 1; } Tcl_MutexUnlock(&bindMutex); } mainPtr->bindingTable = Tk_CreateBindingTable(mainPtr->interp); bindInfoPtr = ckalloc(sizeof(BindInfo)); InitVirtualEventTable(&bindInfoPtr->virtualEventTable); bindInfoPtr->screenInfo.curDispPtr = NULL; bindInfoPtr->screenInfo.curScreenIndex = -1; bindInfoPtr->screenInfo.bindingDepth = 0; bindInfoPtr->deleted = 0; bindInfoPtr->lastCurrentTime = CurrentTimeInMilliSecs(); bindInfoPtr->lastEventTime = 0; mainPtr->bindInfo = bindInfoPtr; DEBUG(countBindItems += 1); TkpInitializeMenuBindings(mainPtr->interp, mainPtr->bindingTable); } |
︙ | ︙ | |||
1431 1432 1433 1434 1435 1436 1437 | assert(mainPtr); Tk_DeleteBindingTable(mainPtr->bindingTable); mainPtr->bindingTable = NULL; bindInfoPtr = mainPtr->bindInfo; DeleteVirtualEventTable(&bindInfoPtr->virtualEventTable); | | | 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 | assert(mainPtr); Tk_DeleteBindingTable(mainPtr->bindingTable); mainPtr->bindingTable = NULL; bindInfoPtr = mainPtr->bindInfo; DeleteVirtualEventTable(&bindInfoPtr->virtualEventTable); bindInfoPtr->deleted = 1; Tcl_EventuallyFree(bindInfoPtr, TCL_DYNAMIC); mainPtr->bindInfo = NULL; DEBUG(countBindItems -= 1); assert(countBindItems > 0 || countTableItems == 0); assert(countBindItems > 0 || countEntryItems == 0); assert(countBindItems > 0 || countListItems == 0); |
︙ | ︙ | |||
1582 1583 1584 1585 1586 1587 1588 | assert(psPtr); assert(TEST_PSENTRY(psPtr)); assert(psPtr->numPats >= 1u); if (!(psPtr->added)) { PatternTableKey key; Tcl_HashEntry *hPtr; | | | | | 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 | assert(psPtr); assert(TEST_PSENTRY(psPtr)); assert(psPtr->numPats >= 1u); if (!(psPtr->added)) { PatternTableKey key; Tcl_HashEntry *hPtr; int isNew; PSList *psList; PSEntry *psEntry; SetupPatternKey(&key, psPtr); hPtr = Tcl_CreateHashEntry(&lookupTables->listTable, (char *) &key, &isNew); if (isNew) { psList = ckalloc(sizeof(PSList)); PSList_Init(psList); Tcl_SetHashValue(hPtr, psList); DEBUG(countListItems += 1); } else { psList = Tcl_GetHashValue(hPtr); } psEntry = MakeListEntry(&lookupTables->entryPool, psPtr, 0); PSList_Append(psList, psEntry); psPtr->added = 1; } } /* *-------------------------------------------------------------- * * Tk_CreateBinding -- * |
︙ | ︙ | |||
1634 1635 1636 1637 1638 1639 1640 | unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ ClientData object, /* Token for object with which binding is associated. */ const char *eventString, /* String describing event sequence that triggers binding. */ const char *script, /* Contains Tcl script to execute when binding triggers. */ | | | | | 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 | unsigned long Tk_CreateBinding( Tcl_Interp *interp, /* Used for error reporting. */ Tk_BindingTable bindPtr, /* Table in which to create binding. */ ClientData object, /* Token for object with which binding is associated. */ const char *eventString, /* String describing event sequence that triggers binding. */ const char *script, /* Contains Tcl script to execute when binding triggers. */ int append) /* 0 means replace any existing binding for eventString; * 1 means append to that binding. If the existing binding is * for a callback function and not a Tcl command string, the * existing binding will always be replaced. */ { PatSeq *psPtr; EventMask eventMask; char *oldStr; char *newStr; assert(bindPtr); assert(object); assert(eventString); assert(script); psPtr = FindSequence(interp, &bindPtr->lookupTables, object, eventString, !!*script, 1, &eventMask); if (!*script) { assert(!psPtr || psPtr->added); /* Silently ignore empty scripts -- see SF#3006842 */ return eventMask; } if (!psPtr) { |
︙ | ︙ | |||
1674 1675 1676 1677 1678 1679 1680 | * maximal size. */ PromArr_ResizeAndClear(&bindPtr->promArr, psPtr->numPats); } if (!psPtr->script) { Tcl_HashEntry *hPtr; | | | 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 | * maximal size. */ PromArr_ResizeAndClear(&bindPtr->promArr, psPtr->numPats); } if (!psPtr->script) { Tcl_HashEntry *hPtr; int isNew; /* * This pattern sequence was just created. Link the pattern into the * list associated with the object, so that if the object goes away, * these bindings will all automatically be deleted. */ |
︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 | { PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); | | | 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 | { PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); psPtr = FindSequence(interp, &bindPtr->lookupTables, object, eventString, 0, 1, NULL); if (!psPtr) { Tcl_ResetResult(interp); } else { Tcl_HashEntry *hPtr; PatSeq *prevPtr; assert(TEST_PSENTRY(psPtr)); |
︙ | ︙ | |||
1812 1813 1814 1815 1816 1817 1818 | { const PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); | | | 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | { const PatSeq *psPtr; assert(bindPtr); assert(object); assert(eventString); psPtr = FindSequence(interp, &bindPtr->lookupTables, object, eventString, 0, 1, NULL); assert(!psPtr || TEST_PSENTRY(psPtr)); return psPtr ? psPtr->script : NULL; } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
1900 1901 1902 1903 1904 1905 1906 | if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) { PSList *psList = Tcl_GetHashValue(hPtr); PSEntry *psEntry; TK_DLIST_FOREACH(psEntry, psList) { if (psEntry->psPtr == psPtr) { | | | 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 | if ((hPtr = Tcl_FindHashEntry(&lookupTables->listTable, (char *) &key))) { PSList *psList = Tcl_GetHashValue(hPtr); PSEntry *psEntry; TK_DLIST_FOREACH(psEntry, psList) { if (psEntry->psPtr == psPtr) { psPtr->added = 0; RemoveListEntry(&lookupTables->entryPool, psEntry); return; } } } assert(!"couldn't find pattern sequence in lookup"); |
︙ | ︙ | |||
2052 2053 2054 2055 2056 2057 2058 | */ ClearLookupTable(&bindPtr->lookupTables, object); ClearPromotionLists(bindPtr, object); for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); | | | 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 | */ ClearLookupTable(&bindPtr->lookupTables, object); ClearPromotionLists(bindPtr, object); for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); DEBUG(psPtr->added = 0); nextPtr = DeletePatSeq(psPtr); } Tcl_DeleteHashEntry(hPtr); } /* |
︙ | ︙ | |||
2104 2105 2106 2107 2108 2109 2110 | curEvent->xev.xany.window = None; eventInfo[eventType].countAny = 0; eventInfo[eventType].countDetailed = 0; } } /* helper function */ | | | | | | | 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 | curEvent->xev.xany.window = None; eventInfo[eventType].countAny = 0; eventInfo[eventType].countDetailed = 0; } } /* helper function */ static int IsBetterMatch( const PatSeq *fstMatchPtr, const PatSeq *sndMatchPtr) /* this is a better match? */ { int diff; if (!sndMatchPtr) { return 0; } if (!fstMatchPtr) { return 1; } diff = CountSpecialized(fstMatchPtr, sndMatchPtr); if (diff > 0) { return 1; } if (diff < 0) { return 0; } #if PREFER_MOST_SPECIALIZED_EVENT { /* local scope */ #define M (Tcl_WideUInt)1000000 static const Tcl_WideUInt weight[5] = { 0, 1, M, M*M, M*M*M }; #undef M Tcl_WideUInt fstCount = 0; |
︙ | ︙ | |||
2143 2144 2145 2146 2147 2148 2149 | assert(GetCount(fstMatchPtr, i) < SIZE_OF_ARRAY(weight)); fstCount += weight[GetCount(fstMatchPtr, i)]; } for (i = 0; i < sndMatchPtr->numPats; ++i) { assert(GetCount(sndMatchPtr, i) < SIZE_OF_ARRAY(weight)); sndCount += weight[GetCount(sndMatchPtr, i)]; } | | | | 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 | assert(GetCount(fstMatchPtr, i) < SIZE_OF_ARRAY(weight)); fstCount += weight[GetCount(fstMatchPtr, i)]; } for (i = 0; i < sndMatchPtr->numPats; ++i) { assert(GetCount(sndMatchPtr, i) < SIZE_OF_ARRAY(weight)); sndCount += weight[GetCount(sndMatchPtr, i)]; } if (sndCount > fstCount) { return 1; } if (sndCount < fstCount) { return 0; } } #endif return sndMatchPtr->number > fstMatchPtr->number; } void |
︙ | ︙ | |||
2186 2187 2188 2189 2190 2191 2192 | unsigned arraySize; unsigned newArraySize; unsigned i, k; assert(bindPtr); assert(eventPtr); assert(tkwin); | | | 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 | unsigned arraySize; unsigned newArraySize; unsigned i, k; assert(bindPtr); assert(eventPtr); assert(tkwin); assert(numObjects >= 0); /* * Ignore events on windows that don't have names: these are windows like * wrapper windows that shouldn't be visible to the application. */ if (!winPtr->pathName) { |
︙ | ︙ | |||
2247 2248 2249 2250 2251 2252 2253 | case FocusOut: if (eventPtr->xfocus.detail == NotifyInferior) { return; } break; case KeyPress: case KeyRelease: { | | | | 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 | case FocusOut: if (eventPtr->xfocus.detail == NotifyInferior) { return; } break; case KeyPress: case KeyRelease: { int reset = 1; if (eventPtr->xkey.time) { bindInfoPtr->lastCurrentTime = CurrentTimeInMilliSecs(); bindInfoPtr->lastEventTime = eventPtr->xkey.time; } /* modifier keys should not influence button events */ for (i = 0; i < (unsigned) dispPtr->numModKeyCodes; ++i) { if (dispPtr->modKeyCodes[i] == eventPtr->xkey.keycode) { reset = 0; } } if (reset) { /* reset repetition count for button events */ bindPtr->eventInfo[ButtonPress].countAny = 0; bindPtr->eventInfo[ButtonPress].countDetailed = 0; bindPtr->eventInfo[ButtonRelease].countAny = 0; |
︙ | ︙ | |||
2416 2417 2418 2419 2420 2421 2422 | * 2. Look for bindings without detail. */ for (k = 0; k < (unsigned) numObjects; ++k) { PSList *psSuccList = PromArr_First(bindPtr->promArr); PatSeq *bestPtr; | | | | 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 | * 2. Look for bindings without detail. */ for (k = 0; k < (unsigned) numObjects; ++k) { PSList *psSuccList = PromArr_First(bindPtr->promArr); PatSeq *bestPtr; psl[0] = GetLookupForEvent(physTables, curEvent, objArr[k], 1); psl[1] = GetLookupForEvent(physTables, curEvent, objArr[k], 0); assert(psl[0] == NULL || psl[0] != psl[1]); psPtr[0] = MatchPatterns(dispPtr, bindPtr, psl[0], psSuccList, 0, curEvent, objArr[k], NULL); psPtr[1] = MatchPatterns(dispPtr, bindPtr, psl[1], psSuccList, 0, curEvent, objArr[k], NULL); if (!PSList_IsEmpty(psSuccList)) { |
︙ | ︙ | |||
2461 2462 2463 2464 2465 2466 2467 | PatSeq *mPtr; PSList *psl[2]; /* * Note that virtual events cannot promote. */ | | | | 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 | PatSeq *mPtr; PSList *psl[2]; /* * Note that virtual events cannot promote. */ psl[0] = GetLookupForEvent(virtTables, curEvent, NULL, 1); psl[1] = GetLookupForEvent(virtTables, curEvent, NULL, 0); assert(psl[0] == NULL || psl[0] != psl[1]); mPtr = MatchPatterns(dispPtr, bindPtr, psl[0], NULL, 0, curEvent, objArr[k], &matchPtr); if (mPtr) { matchPtrArr[k] = matchPtr; matchPtr = mPtr; |
︙ | ︙ | |||
2517 2518 2519 2520 2521 2522 2523 | * 4) If we have a detailed event, current entry it is also detailed, * we have matching event types, but the details are different. * 5) Current entry has been matched with a different window. */ if (psEntry->keepIt) { assert(!psEntry->expired); | | | 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 | * 4) If we have a detailed event, current entry it is also detailed, * we have matching event types, but the details are different. * 5) Current entry has been matched with a different window. */ if (psEntry->keepIt) { assert(!psEntry->expired); psEntry->keepIt = 0; } else if (psEntry->expired || psEntry->window != curEvent->xev.xany.window || (patPtr->info && curEvent->detail.info && patPtr->eventType == (unsigned) curEvent->xev.type && patPtr->info != curEvent->detail.info)) { RemoveListEntry(&bindPtr->lookupTables.entryPool, psEntry); |
︙ | ︙ | |||
2664 2665 2666 2667 2668 2669 2670 | * Side effects: * None. * *---------------------------------------------------------------------- */ /* helper function */ | | | 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 | * Side effects: * None. * *---------------------------------------------------------------------- */ /* helper function */ static int VirtPatIsBound( Tk_BindingTable bindPtr, /* Table in which to look for bindings. */ PatSeq *psPtr, /* Test this pattern. */ ClientData object, /* Check for this binding tag. */ PatSeq **physPtrPtr) /* Input: the best physical event. * Output: the physical event associated with matching virtual event. */ { |
︙ | ︙ | |||
2687 2688 2689 2690 2691 2692 2693 | if (*physPtrPtr) { const TkPattern *physPatPtr = (*physPtrPtr)->pats; const TkPattern *virtPatPtr = psPtr->pats; if (physPatPtr->info || !virtPatPtr->info) { if (IsSubsetOf(virtPatPtr->modMask, physPatPtr->modMask)) { | | | | | | 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 | if (*physPtrPtr) { const TkPattern *physPatPtr = (*physPtrPtr)->pats; const TkPattern *virtPatPtr = psPtr->pats; if (physPatPtr->info || !virtPatPtr->info) { if (IsSubsetOf(virtPatPtr->modMask, physPatPtr->modMask)) { return 0; /* we cannot surpass this match */ } } } /* otherwise on some systems the key contains uninitialized bytes */ memset(&key, 0, sizeof(key)); key.object = object; key.type = VirtualEvent; owners = psPtr->ptr.owners; for (i = 0; i < VirtOwners_Size(owners); ++i) { Tcl_HashEntry *hPtr = VirtOwners_Get(owners, i); key.detail.name = (Tk_Uid) Tcl_GetHashKey(hPtr->tablePtr, hPtr); if ((hPtr = Tcl_FindHashEntry(&bindPtr->lookupTables.patternTable, (char *) &key))) { /* The physical event matches this virtual event's definition. */ *physPtrPtr = (PatSeq *) Tcl_GetHashValue(hPtr); return 1; } } return 0; } /* helper function */ static int Compare( const PatSeq *fstMatchPtr, const PatSeq *sndMatchPtr) /* most recent match */ { int diff; if (!fstMatchPtr) { return +1; } assert(sndMatchPtr); diff = CountSpecialized(fstMatchPtr, sndMatchPtr); return diff ? diff : (int) sndMatchPtr->count - (int) fstMatchPtr->count; } /* helper function */ static int CompareModMasks( const PSModMaskArr *fstModMaskArr, const PSModMaskArr *sndModMaskArr, ModMask fstModMask, ModMask sndModMask) { int fstCount = 0; |
︙ | ︙ | |||
2793 2794 2795 2796 2797 2798 2799 | * event; NULL when we match physical events. */ { Window window; PSEntry *psEntry; PatSeq *bestPtr; PatSeq *bestPhysPtr; ModMask bestModMask; | | | 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 | * event; NULL when we match physical events. */ { Window window; PSEntry *psEntry; PatSeq *bestPtr; PatSeq *bestPhysPtr; ModMask bestModMask; const PSModMaskArr *bestModMaskArr = NULL; assert(dispPtr); assert(bindPtr); assert(curEvent); if (!psList) { return NULL; |
︙ | ︙ | |||
2818 2819 2820 2821 2822 2823 2824 | assert(TEST_PSENTRY(psPtr)); assert((psPtr->object == NULL) == (physPtrPtr != NULL)); assert(psPtr->object || patIndex == 0); assert(psPtr->numPats > patIndex); if (psPtr->object | | | | 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 | assert(TEST_PSENTRY(psPtr)); assert((psPtr->object == NULL) == (physPtrPtr != NULL)); assert(psPtr->object || patIndex == 0); assert(psPtr->numPats > patIndex); if (psPtr->object ? psPtr->object == object : VirtPatIsBound(bindPtr, psPtr, object, physPtrPtr)) { TkPattern *patPtr = psPtr->pats + patIndex; if (patPtr->eventType == (unsigned) curEvent->xev.type && (curEvent->xev.type != CreateNotify || curEvent->xev.xcreatewindow.parent == window) && (!patPtr->name || patPtr->name == curEvent->detail.name) && (!patPtr->info || patPtr->info == curEvent->detail.info)) { /* * Resolve the modifier mask for Alt and Mod keys. Unfortunately this * cannot be done in ParseEventDescription, otherwise this function would * be the better place. */ ModMask modMask = ResolveModifiers(dispPtr, patPtr->modMask); ModMask curModMask = ResolveModifiers(dispPtr, bindPtr->curModMask); psEntry->expired = 1; /* remove it from promotion list */ if ((modMask & ~curModMask) == 0) { unsigned count = patPtr->info ? curEvent->countDetailed : curEvent->countAny; if (patIndex < PSModMaskArr_Size(psEntry->lastModMaskArr)) { PSModMaskArr_Set(psEntry->lastModMaskArr, patIndex, &modMask); } |
︙ | ︙ | |||
2872 2873 2874 2875 2876 2877 2878 | bestModMask = modMask; bestModMaskArr = psEntry->lastModMaskArr; if (physPtrPtr) { bestPhysPtr = *physPtrPtr; } } } else { | | | | 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 | bestModMask = modMask; bestModMaskArr = psEntry->lastModMaskArr; if (physPtrPtr) { bestPhysPtr = *physPtrPtr; } } } else { DEBUG(psEntry->expired = 0); psEntry->keepIt = 1; /* don't remove it from promotion list */ } } else if (psSuccList) { /* * Not a final pattern, but matching, so promote it to next level. * But do not promote if count of current pattern is not yet reached. */ if (patPtr->count == psEntry->count) { |
︙ | ︙ | |||
2895 2896 2897 2898 2899 2900 2901 | } assert(psNewEntry->keepIt); assert(psNewEntry->count == 1u); PSList_Append(psSuccList, psNewEntry); psNewEntry->window = window; /* bind to current window */ } else { assert(psEntry->count < patPtr->count); | | | | 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 | } assert(psNewEntry->keepIt); assert(psNewEntry->count == 1u); PSList_Append(psSuccList, psNewEntry); psNewEntry->window = window; /* bind to current window */ } else { assert(psEntry->count < patPtr->count); DEBUG(psEntry->expired = 0); psEntry->count += 1; psEntry->keepIt = 1; /* don't remove it from promotion list */ } } } } } } } |
︙ | ︙ | |||
2953 2954 2955 2956 2957 2958 2959 | assert(eventPtr); assert(dsPtr); Tcl_DStringInit(&buf); evPtr = &eventPtr->xev; flags = (evPtr->type < TK_LASTEVENT) ? flagArray[evPtr->type] : 0; | | | 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 | assert(eventPtr); assert(dsPtr); Tcl_DStringInit(&buf); evPtr = &eventPtr->xev; flags = (evPtr->type < TK_LASTEVENT) ? flagArray[evPtr->type] : 0; while (1) { char numStorage[TCL_INTEGER_SPACE]; const char *string; Tcl_WideInt number; /* * Find everything up to the next % character and append it to the * result string. |
︙ | ︙ | |||
3462 3463 3464 3465 3466 3467 3468 | for ( ; hPtr; hPtr = Tcl_NextHashEntry(&search)) { PatSeq *nextPtr; PatSeq *psPtr; for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; | | | 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 | for ( ; hPtr; hPtr = Tcl_NextHashEntry(&search)) { PatSeq *nextPtr; PatSeq *psPtr; for (psPtr = Tcl_GetHashValue(hPtr); psPtr; psPtr = nextPtr) { assert(TEST_PSENTRY(psPtr)); nextPtr = psPtr->nextSeqPtr; DEBUG(psPtr->owned = 0); FreePatSeq(psPtr); } } Tcl_DeleteHashTable(&vetPtr->lookupTables.patternTable); hPtr = Tcl_FirstHashEntry(&vetPtr->nameTable, &search); for ( ; hPtr; hPtr = Tcl_NextHashEntry(&search)) { |
︙ | ︙ | |||
3500 3501 3502 3503 3504 3505 3506 | * Side effects: * The virtual event may cause future calls to Tk_BindEvent to behave * differently than they did previously. * *---------------------------------------------------------------------- */ | | | | | | | | 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 | * Side effects: * The virtual event may cause future calls to Tk_BindEvent to behave * differently than they did previously. * *---------------------------------------------------------------------- */ static int CreateVirtualEvent( Tcl_Interp *interp, /* Used for error reporting. */ VirtualEventTable *vetPtr, /* Table in which to augment virtual event. */ char *virtString, /* Name of new virtual event. */ const char *eventString) /* String describing physical event that triggers virtual event. */ { PatSeq *psPtr; int dummy; Tcl_HashEntry *vhPtr; PhysOwned *owned; Tk_Uid virtUid; assert(vetPtr); assert(virtString); assert(eventString); if (!(virtUid = GetVirtualEventUid(interp, virtString))) { return 0; } /* * Find/create physical event */ if (!(psPtr = FindSequence(interp, &vetPtr->lookupTables, NULL, eventString, 1, 0, NULL))) { return 0; } assert(TEST_PSENTRY(psPtr)); /* * Find/create virtual event. */ vhPtr = Tcl_CreateHashEntry(&vetPtr->nameTable, virtUid, &dummy); /* * Make virtual event own the physical event. */ owned = Tcl_GetHashValue(vhPtr); if (!PhysOwned_Contains(owned, psPtr)) { PhysOwned_Append(&owned, psPtr); Tcl_SetHashValue(vhPtr, owned); DEBUG(psPtr->owned = 1); InsertPatSeq(&vetPtr->lookupTables, psPtr); /* Make physical event so it can trigger the virtual event. */ VirtOwners_Append(&psPtr->ptr.owners, vhPtr); } return 1; } /* *-------------------------------------------------------------- * * DeleteVirtualEvent -- * |
︙ | ︙ | |||
3614 3615 3616 3617 3618 3619 3620 | /* * Delete only the specific physical event associated with the virtual * event. If the physical event doesn't already exist, or the virtual * event doesn't own that physical event, return w/o doing anything. */ | | | 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 | /* * Delete only the specific physical event associated with the virtual * event. If the physical event doesn't already exist, or the virtual * event doesn't own that physical event, return w/o doing anything. */ eventPSPtr = FindSequence(interp, lookupTables, NULL, eventString, 0, 0, NULL); if (!eventPSPtr) { const char *string = Tcl_GetString(Tcl_GetObjResult(interp)); return string[0] ? TCL_ERROR : TCL_OK; } } for (iPhys = PhysOwned_Size(owned); --iPhys >= 0; ) { |
︙ | ︙ | |||
3651 3652 3653 3654 3655 3656 3657 | VirtOwners_Set(owners, iVirt, VirtOwners_Back(owners)); VirtOwners_PopBack(owners); } else { /* * Removed last reference to this physical event, so remove it * from lookup table. */ | | | 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 | VirtOwners_Set(owners, iVirt, VirtOwners_Back(owners)); VirtOwners_PopBack(owners); } else { /* * Removed last reference to this physical event, so remove it * from lookup table. */ DEBUG(psPtr->owned = 0); RemovePatSeqFromLookup(&vetPtr->lookupTables, psPtr); DeletePatSeq(psPtr); } /* * Now delete the virtual event's reference to the physical event. */ |
︙ | ︙ | |||
3835 3836 3837 3838 3839 3840 3841 | Tcl_QueuePosition pos; TkPattern pat; Tk_Window tkwin; Tk_Window tkwin2; TkWindow *mainPtr; EventMask eventMask; Tcl_Obj *userDataObj; | | | | 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 | Tcl_QueuePosition pos; TkPattern pat; Tk_Window tkwin; Tk_Window tkwin2; TkWindow *mainPtr; EventMask eventMask; Tcl_Obj *userDataObj; int synch; int warp; unsigned count; unsigned flags; int number; unsigned i; static const char *const fieldStrings[] = { "-when", "-above", "-borderwidth", "-button", |
︙ | ︙ | |||
3903 3904 3905 3906 3907 3908 3909 | Tcl_SetErrorCode(interp, "TK", "EVENT", "MULTIPLE", NULL); return TCL_ERROR; } memset(&event, 0, sizeof(event)); event.general.xany.type = pat.eventType; event.general.xany.serial = NextRequest(Tk_Display(tkwin)); | | | 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 | Tcl_SetErrorCode(interp, "TK", "EVENT", "MULTIPLE", NULL); return TCL_ERROR; } memset(&event, 0, sizeof(event)); event.general.xany.type = pat.eventType; event.general.xany.serial = NextRequest(Tk_Display(tkwin)); event.general.xany.send_event = 0; if (windowName[0]) { event.general.xany.window = Tk_WindowId(tkwin); } else { event.general.xany.window = RootWindow(Tk_Display(tkwin), Tk_ScreenNumber(tkwin)); } event.general.xany.display = Tk_Display(tkwin); |
︙ | ︙ | |||
3946 3947 3948 3949 3950 3951 3952 | event.general.xany.send_event = GENERATED_FOCUS_EVENT_MAGIC; } /* * Process the remaining arguments to fill in additional fields of the event. */ | | | | 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 | event.general.xany.send_event = GENERATED_FOCUS_EVENT_MAGIC; } /* * Process the remaining arguments to fill in additional fields of the event. */ synch = 1; warp = 0; pos = TCL_QUEUE_TAIL; for (i = 2; i < (unsigned) objc; i += 2) { Tcl_Obj *optionPtr, *valuePtr; int badOpt = 0; int index; optionPtr = objv[i]; valuePtr = objv[i + 1]; if (Tcl_GetIndexFromObjStruct(interp, optionPtr, fieldStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { |
︙ | ︙ | |||
3982 3983 3984 3985 3986 3987 3988 | switch ((enum field) index) { case EVENT_WARP: if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) { return TCL_ERROR; } if (!(flags & KEY_BUTTON_MOTION_VIRTUAL)) { | | | | | | | | | | | | | 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 | switch ((enum field) index) { case EVENT_WARP: if (Tcl_GetBooleanFromObj(interp, valuePtr, &warp) != TCL_OK) { return TCL_ERROR; } if (!(flags & KEY_BUTTON_MOTION_VIRTUAL)) { badOpt = 1; } break; case EVENT_WHEN: pos = (Tcl_QueuePosition) TkFindStateNumObj(interp, optionPtr, queuePosition, valuePtr); if ((int) pos < -1) { return TCL_ERROR; } synch = ((int) pos == -1); break; case EVENT_ABOVE: if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) { return TCL_ERROR; } if (flags & CONFIG) { event.general.xconfigure.above = Tk_WindowId(tkwin2); } else { badOpt = 1; } break; case EVENT_BORDER: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & (CREATE|CONFIG)) { event.general.xcreatewindow.border_width = number; } else { badOpt = 1; } break; case EVENT_BUTTON: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & BUTTON) { event.general.xbutton.button = number; } else { badOpt = 1; } break; case EVENT_COUNT: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & EXPOSE) { event.general.xexpose.count = number; } else { badOpt = 1; } break; case EVENT_DATA: if (flags & VIRTUAL) { /* * Do not increment reference count until after parsing * completes and we know that the event generation is really * going to happen. */ userDataObj = valuePtr; } else { badOpt = 1; } break; case EVENT_DELTA: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if ((flags & KEY) && event.general.xkey.type == MouseWheelEvent) { event.general.xkey.keycode = number; } else { badOpt = 1; } break; case EVENT_DETAIL: number = TkFindStateNumObj(interp, optionPtr, notifyDetail, valuePtr); if (number < 0) { return TCL_ERROR; } if (flags & FOCUS) { event.general.xfocus.detail = number; } else if (flags & CROSSING) { event.general.xcrossing.detail = number; } else { badOpt = 1; } break; case EVENT_FOCUS: if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & CROSSING) { event.general.xcrossing.focus = number; } else { badOpt = 1; } break; case EVENT_HEIGHT: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & EXPOSE) { event.general.xexpose.height = number; } else if (flags & CONFIG) { event.general.xconfigure.height = number; } else { badOpt = 1; } break; case EVENT_KEYCODE: if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if ((flags & KEY) && event.general.xkey.type != MouseWheelEvent) { event.general.xkey.keycode = number; } else { badOpt = 1; } break; case EVENT_KEYSYM: { KeySym keysym; const char *value; value = Tcl_GetString(valuePtr); |
︙ | ︙ | |||
4118 4119 4120 4121 4122 4123 4124 | TkpSetKeycodeAndState(tkwin, keysym, &event.general); if (event.general.xkey.keycode == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("no keycode for keysym \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYCODE", value, NULL); return TCL_ERROR; } if (!(flags & KEY) || (event.general.xkey.type == MouseWheelEvent)) { | | | | | | | | | | | 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 | TkpSetKeycodeAndState(tkwin, keysym, &event.general); if (event.general.xkey.keycode == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("no keycode for keysym \"%s\"", value)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "KEYCODE", value, NULL); return TCL_ERROR; } if (!(flags & KEY) || (event.general.xkey.type == MouseWheelEvent)) { badOpt = 1; } break; } case EVENT_MODE: if ((number = TkFindStateNumObj(interp, optionPtr, notifyMode, valuePtr)) < 0) { return TCL_ERROR; } if (flags & CROSSING) { event.general.xcrossing.mode = number; } else if (flags & FOCUS) { event.general.xfocus.mode = number; } else { badOpt = 1; } break; case EVENT_OVERRIDE: if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & CREATE) { event.general.xcreatewindow.override_redirect = number; } else if (flags & MAP) { event.general.xmap.override_redirect = number; } else if (flags & REPARENT) { event.general.xreparent.override_redirect = number; } else if (flags & CONFIG) { event.general.xconfigure.override_redirect = number; } else { badOpt = 1; } break; case EVENT_PLACE: if ((number = TkFindStateNumObj(interp, optionPtr, circPlace, valuePtr)) < 0) { return TCL_ERROR; } if (flags & CIRC) { event.general.xcirculate.place = number; } else { badOpt = 1; } break; case EVENT_ROOT: if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.root = Tk_WindowId(tkwin2); } else { badOpt = 1; } break; case EVENT_ROOTX: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.x_root = number; } else { badOpt = 1; } break; case EVENT_ROOTY: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.y_root = number; } else { badOpt = 1; } break; case EVENT_SEND: { const char *value; value = Tcl_GetString(valuePtr); 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_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (number) { /* * send_event only expects 1 or 0. We cannot allow arbitrary non-zero * values, otherwise the thing with GENERATED_FOCUS_EVENT_MAGIC will not * work. */ number = 1; } } else if (Tcl_GetBooleanFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } event.general.xany.send_event |= number; break; } |
︙ | ︙ | |||
4238 4239 4240 4241 4242 4243 4244 | } } else if (flags & VISIBILITY) { if ((number = TkFindStateNumObj(interp, optionPtr, visNotify, valuePtr)) < 0) { return TCL_ERROR; } event.general.xvisibility.state = number; } else { | | | | | | | 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 | } } else if (flags & VISIBILITY) { if ((number = TkFindStateNumObj(interp, optionPtr, visNotify, valuePtr)) < 0) { return TCL_ERROR; } event.general.xvisibility.state = number; } else { badOpt = 1; } break; case EVENT_SUBWINDOW: if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.subwindow = Tk_WindowId(tkwin2); } else { badOpt = 1; } break; case EVENT_TIME: { if (strcmp(Tcl_GetString(valuePtr), "current") == 0) { TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; BindInfo *biPtr = mainPtr->mainPtr->bindInfo; number = dispPtr->lastEventTime + (CurrentTimeInMilliSecs() - biPtr->lastCurrentTime); } else if (Tcl_GetIntFromObj(interp, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { event.general.xkey.time = number; } else if (flags & PROP) { event.general.xproperty.time = number; } else { badOpt = 1; } break; } case EVENT_WIDTH: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & EXPOSE) { event.general.xexpose.width = number; } else if (flags & (CREATE|CONFIG)) { event.general.xcreatewindow.width = number; } else { badOpt = 1; } break; case EVENT_WINDOW: if (!NameToWindow(interp, tkwin, valuePtr, &tkwin2)) { return TCL_ERROR; } if (flags & (CREATE|UNMAP|MAP|REPARENT|CONFIG|GRAVITY|CIRC)) { event.general.xcreatewindow.window = Tk_WindowId(tkwin2); } else { badOpt = 1; } break; case EVENT_X: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { |
︙ | ︙ | |||
4314 4315 4316 4317 4318 4319 4320 | } else if (flags & EXPOSE) { event.general.xexpose.x = number; } else if (flags & (CREATE|CONFIG|GRAVITY)) { event.general.xcreatewindow.x = number; } else if (flags & REPARENT) { event.general.xreparent.x = number; } else { | | | 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 | } else if (flags & EXPOSE) { event.general.xexpose.x = number; } else if (flags & (CREATE|CONFIG|GRAVITY)) { event.general.xcreatewindow.x = number; } else if (flags & REPARENT) { event.general.xreparent.x = number; } else { badOpt = 1; } break; case EVENT_Y: if (Tk_GetPixelsFromObj(interp, tkwin, valuePtr, &number) != TCL_OK) { return TCL_ERROR; } if (flags & KEY_BUTTON_MOTION_CROSSING) { |
︙ | ︙ | |||
4341 4342 4343 4344 4345 4346 4347 | } else if (flags & EXPOSE) { event.general.xexpose.y = number; } else if (flags & (CREATE|CONFIG|GRAVITY)) { event.general.xcreatewindow.y = number; } else if (flags & REPARENT) { event.general.xreparent.y = number; } else { | | | 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 | } else if (flags & EXPOSE) { event.general.xexpose.y = number; } else if (flags & (CREATE|CONFIG|GRAVITY)) { event.general.xcreatewindow.y = number; } else if (flags & REPARENT) { event.general.xreparent.y = number; } else { badOpt = 1; } break; } if (badOpt) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s event doesn't accept \"%s\" option", name, Tcl_GetString(optionPtr))); |
︙ | ︙ | |||
4430 4431 4432 4433 4434 4435 4436 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ | | | | | | 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ static int NameToWindow( Tcl_Interp *interp, /* Interp for error return and name lookup. */ Tk_Window mainWin, /* Main window of application. */ Tcl_Obj *objPtr, /* Contains name or id string of window. */ Tk_Window *tkwinPtr) /* Filled with token for window. */ { const char *name; Tk_Window tkwin; assert(mainWin); assert(objPtr); assert(tkwinPtr); name = Tcl_GetString(objPtr); if (name[0] == '.') { if (!(tkwin = Tk_NameToWindow(interp, name, mainWin))) { return 0; } } else { Window id; tkwin = NULL; /* * Check for the winPtr being valid, even if it looks okay to * TkpScanWindowId. [Bug #411307] */ if (TkpScanWindowId(NULL, name, &id) == TCL_OK) { tkwin = Tk_IdToWindow(Tk_Display(mainWin), id); } if (!tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad window name/identifier \"%s\"", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "WINDOW_ID", name, NULL); return 0; } } assert(tkwin); *tkwinPtr = tkwin; return 1; } /* *------------------------------------------------------------------------- * * DoWarp -- * |
︙ | ︙ | |||
4601 4602 4603 4604 4605 4606 4607 | FindSequence( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ LookupTables *lookupTables, /* Tables used for lookup. */ ClientData object, /* For binding table, token for object with which binding is * associated. For virtual event table, NULL. */ const char *eventString, /* String description of pattern to match on. See user * documentation for details. */ | | | | | | | | 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 | FindSequence( Tcl_Interp *interp, /* Interpreter to use for error reporting. */ LookupTables *lookupTables, /* Tables used for lookup. */ ClientData object, /* For binding table, token for object with which binding is * associated. For virtual event table, NULL. */ const char *eventString, /* String description of pattern to match on. See user * documentation for details. */ int create, /* 0 means don't create the entry if it doesn't already exist. * 1 means create. */ int allowVirtual, /* 0 means that virtual events are not allowed in the sequence. * 1 otherwise. */ EventMask *maskPtr) /* *maskPtr is filled in with the event types on which this * pattern sequence depends. */ { unsigned patsBufSize = 1; unsigned numPats; unsigned totalCount = 0; int virtualFound = 0; const char *p = eventString; TkPattern *patPtr; PatSeq *psPtr; Tcl_HashEntry *hPtr; int isNew; unsigned count; unsigned maxCount = 0; EventMask eventMask = 0; ModMask modMask = 0; PatternTableKey key; assert(lookupTables); |
︙ | ︙ | |||
4656 4657 4658 4659 4660 4661 4662 | if (!allowVirtual) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "virtual event not allowed in definition of another virtual event", -1)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "INNER", NULL); ckfree(psPtr); return NULL; } | | | 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 | if (!allowVirtual) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "virtual event not allowed in definition of another virtual event", -1)); Tcl_SetErrorCode(interp, "TK", "EVENT", "VIRTUAL", "INNER", NULL); ckfree(psPtr); return NULL; } virtualFound = 1; } if (count > 1u) { maxCount = Max(count, maxCount); } totalCount += count; |
︙ | ︙ | |||
4731 4732 4733 4734 4735 4736 4737 | } DEBUG(countSeqItems += 1); psPtr->numPats = numPats; psPtr->count = totalCount; psPtr->number = lookupTables->number++; | | | | 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 | } DEBUG(countSeqItems += 1); psPtr->numPats = numPats; psPtr->count = totalCount; psPtr->number = lookupTables->number++; psPtr->added = 0; psPtr->modMaskUsed = (modMask != 0); psPtr->script = NULL; psPtr->nextSeqPtr = Tcl_GetHashValue(hPtr); psPtr->hPtr = hPtr; psPtr->ptr.nextObj = NULL; assert(psPtr->ptr.owners == NULL); DEBUG(psPtr->owned = 0); Tcl_SetHashValue(hPtr, psPtr); if (maskPtr) { *maskPtr = eventMask; } return psPtr; } |
︙ | ︙ | |||
4892 4893 4894 4895 4896 4897 4898 | } p += 2; } else { unsigned eventFlags; char field[512]; Tcl_HashEntry *hPtr; | | | 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 | } p += 2; } else { unsigned eventFlags; char field[512]; Tcl_HashEntry *hPtr; while (1) { ModInfo *modPtr; p = GetField(p, field, sizeof(field)); if (*p == '>') { /* * This solves the problem of, e.g., <Control-M> being * misinterpreted as Control + Meta + missing keysym instead of |
︙ | ︙ | |||
4970 4971 4972 4973 4974 4975 4976 | return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("specified button \"%s\" for non-button event", field), "NON_BUTTON"); } #if SUPPORT_ADDITIONAL_MOTION_SYNTAX | | | | 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 | return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("specified button \"%s\" for non-button event", field), "NON_BUTTON"); } #if SUPPORT_ADDITIONAL_MOTION_SYNTAX patPtr->modMask |= TkGetButtonMask(button); p = SkipFieldDelims(p); while (*p && *p != '>') { p = SkipFieldDelims(GetField(p, field, sizeof(field))); if ((button = GetButtonNumber(field)) == 0) { return FinalizeParseEventDescription( interp, patPtr, 0, Tcl_ObjPrintf("bad button number \"%s\"", field), "BUTTON"); } patPtr->modMask |= TkGetButtonMask(button); } patPtr->info = ButtonNumberFromState(patPtr->modMask); #endif } else { return FinalizeParseEventDescription( interp, patPtr, 0, |
︙ | ︙ | |||
5110 5111 5112 5113 5114 5115 5116 | && patPtr->info != ' ') { char c = (char) patPtr->info; Tcl_AppendToObj(patternObj, &c, 1); } else if (patPtr->eventType == VirtualEvent) { assert(patPtr->name); Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name); } else { | | | | 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 | && patPtr->info != ' ') { char c = (char) patPtr->info; Tcl_AppendToObj(patternObj, &c, 1); } else if (patPtr->eventType == VirtualEvent) { assert(patPtr->name); Tcl_AppendPrintfToObj(patternObj, "<<%s>>", patPtr->name); } else { ModMask modMask; const ModInfo *modPtr; /* * It's a more general event specification. First check for "Double", * "Triple", "Quadruple", then modifiers, then event type, then keysym * or button detail. */ Tcl_AppendToObj(patternObj, "<", 1); switch (patPtr->count) { case 2: Tcl_AppendToObj(patternObj, "Double-", 7); break; case 3: Tcl_AppendToObj(patternObj, "Triple-", 7); break; case 4: Tcl_AppendToObj(patternObj, "Quadruple-", 10); break; } modMask = patPtr->modMask; #if PRINT_SHORT_MOTION_SYNTAX if (patPtr->eventType == MotionNotify) { modMask &= ~(ModMask)ALL_BUTTONS; } #endif for (modPtr = modArray; modMask; ++modPtr) { if (modPtr->mask & modMask) { modMask &= ~modPtr->mask; Tcl_AppendPrintfToObj(patternObj, "%s-", modPtr->name); |
︙ | ︙ | |||
5158 5159 5160 5161 5162 5163 5164 | Tcl_AppendToObj(patternObj, "-", 1); Tcl_AppendToObj(patternObj, string, -1); } break; } case ButtonPress: case ButtonRelease: | | | | | | | | 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 | Tcl_AppendToObj(patternObj, "-", 1); Tcl_AppendToObj(patternObj, string, -1); } break; } case ButtonPress: case ButtonRelease: assert(patPtr->info <= Button9); Tcl_AppendPrintfToObj(patternObj, "-%d", (int) patPtr->info); break; #if PRINT_SHORT_MOTION_SYNTAX case MotionNotify: { ModMask mask = patPtr->modMask; while (mask & ALL_BUTTONS) { int button = ButtonNumberFromState(mask); Tcl_AppendPrintfToObj(patternObj, "-%d", button); mask &= ~TkGetButtonMask(button); } break; } #endif } } |
︙ | ︙ |
Changes to generic/tkBitmap.c.
︙ | ︙ | |||
84 85 86 87 88 89 90 | */ typedef struct { const char *source; /* Bitmap bits. */ int width, height; /* Dimensions of bitmap. */ } DataKey; | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | */ typedef struct { const char *source; /* Bitmap bits. */ int width, height; /* Dimensions of bitmap. */ } DataKey; typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable predefBitmapTable; /* Hash table created by Tk_DefineBitmap to * map from a name to a collection of in-core * data about a bitmap. The table is indexed * by the address of the data for the bitmap, * and the entries contain pointers to |
︙ | ︙ | |||
532 533 534 535 536 537 538 | TkDisplay *dispPtr = TkGetDisplay(display); if (dispPtr == NULL || !dispPtr->bitmapInit) { unknown: Tcl_Panic("Tk_NameOfBitmap received unknown bitmap argument"); } | | | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | TkDisplay *dispPtr = TkGetDisplay(display); if (dispPtr == NULL || !dispPtr->bitmapInit) { unknown: Tcl_Panic("Tk_NameOfBitmap received unknown bitmap argument"); } idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { goto unknown; } bitmapPtr = Tcl_GetHashValue(idHashPtr); return bitmapPtr->nameHashPtr->key.string; } |
︙ | ︙ | |||
574 575 576 577 578 579 580 | TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->bitmapInit) { unknownBitmap: Tcl_Panic("Tk_SizeOfBitmap received unknown bitmap argument"); } | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->bitmapInit) { unknownBitmap: Tcl_Panic("Tk_SizeOfBitmap received unknown bitmap argument"); } idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { goto unknownBitmap; } bitmapPtr = Tcl_GetHashValue(idHashPtr); *widthPtr = bitmapPtr->width; *heightPtr = bitmapPtr->height; } |
︙ | ︙ | |||
663 664 665 666 667 668 669 | Tcl_HashEntry *idHashPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->bitmapInit) { Tcl_Panic("Tk_FreeBitmap called before Tk_GetBitmap"); } | | | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | Tcl_HashEntry *idHashPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->bitmapInit) { Tcl_Panic("Tk_FreeBitmap called before Tk_GetBitmap"); } idHashPtr = Tcl_FindHashEntry(&dispPtr->bitmapIdTable, bitmap); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeBitmap received unknown bitmap argument"); } FreeBitmap(Tcl_GetHashValue(idHashPtr)); } /* |
︙ | ︙ | |||
1153 1154 1155 1156 1157 1158 1159 | bitmapPtr = Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } for ( ; (bitmapPtr != NULL); bitmapPtr = bitmapPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | bitmapPtr = Tcl_GetHashValue(hashPtr); if (bitmapPtr == NULL) { Tcl_Panic("TkDebugBitmap found empty hash table entry"); } for ( ; (bitmapPtr != NULL); bitmapPtr = bitmapPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(bitmapPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(bitmapPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* |
︙ | ︙ |
Changes to generic/tkBusy.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | /* * Things about the busy system that may be configured. Note that on some * platforms this may or may not have an effect. */ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * Things about the busy system that may be configured. Note that on some * platforms this may or may not have an effect. */ static const Tk_OptionSpec busyOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUSY_CURSOR, -1, offsetof(Busy, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations of functions defined in this file. */ |
︙ | ︙ | |||
568 569 570 571 572 573 574 | busyPtr->width = Tk_Width(tkRef); busyPtr->height = Tk_Height(tkRef); busyPtr->x = Tk_X(tkRef); busyPtr->y = Tk_Y(tkRef); busyPtr->cursor = NULL; Tk_SetClass(tkBusy, "Busy"); busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs); | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | busyPtr->width = Tk_Width(tkRef); busyPtr->height = Tk_Height(tkRef); busyPtr->x = Tk_X(tkRef); busyPtr->y = Tk_Y(tkRef); busyPtr->cursor = NULL; Tk_SetClass(tkBusy, "Busy"); busyPtr->optionTable = Tk_CreateOptionTable(interp, busyOptionSpecs); if (Tk_InitOptions(interp, busyPtr, busyPtr->optionTable, tkBusy) != TCL_OK) { Tk_DestroyWindow(tkBusy); return NULL; } SetWindowInstanceData(tkBusy, busyPtr); winPtr = (Tk_FakeWin *) tkRef; |
︙ | ︙ | |||
635 636 637 638 639 640 641 | Tcl_Interp *interp, Busy *busyPtr, int objc, Tcl_Obj *const objv[]) { Tk_Cursor oldCursor = busyPtr->cursor; | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | Tcl_Interp *interp, Busy *busyPtr, int objc, Tcl_Obj *const objv[]) { Tk_Cursor oldCursor = busyPtr->cursor; if (Tk_SetOptions(interp, busyPtr, busyPtr->optionTable, objc, objv, busyPtr->tkBusy, NULL, NULL) != TCL_OK) { return TCL_ERROR; } if (busyPtr->cursor != oldCursor) { if (busyPtr->cursor == NULL) { Tk_UndefineCursor(busyPtr->tkBusy); } else { |
︙ | ︙ | |||
684 685 686 687 688 689 690 | Tcl_HashEntry *hPtr; Tk_Window tkwin; if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), windowObj, &tkwin) != TCL_OK) { return NULL; } | | | 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | Tcl_HashEntry *hPtr; Tk_Window tkwin; if (TkGetWindowFromObj(interp, Tk_MainWindow(interp), windowObj, &tkwin) != TCL_OK) { return NULL; } hPtr = Tcl_FindHashEntry(busyTablePtr, tkwin); if (hPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't find busy window \"%s\"", Tcl_GetString(windowObj))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "BUSY", Tcl_GetString(windowObj), NULL); return NULL; } |
︙ | ︙ | |||
758 759 760 761 762 763 764 765 766 767 768 769 770 771 | */ if (Tk_IsMapped(busyPtr->tkRef)) { TkpShowBusyWindow(busyPtr); } else { TkpHideBusyWindow(busyPtr); } return result; } /* *---------------------------------------------------------------------- * * Tk_BusyObjCmd -- | > > > | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | */ if (Tk_IsMapped(busyPtr->tkRef)) { TkpShowBusyWindow(busyPtr); } else { TkpHideBusyWindow(busyPtr); } if (result == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1)); } return result; } /* *---------------------------------------------------------------------- * * Tk_BusyObjCmd -- |
︙ | ︙ | |||
791 792 793 794 795 796 797 | { Tk_Window tkwin = clientData; Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable; Busy *busyPtr; Tcl_Obj *objPtr; int index, result = TCL_OK; static const char *const optionStrings[] = { | | > | | | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 | { Tk_Window tkwin = clientData; Tcl_HashTable *busyTablePtr = &((TkWindow *) tkwin)->mainPtr->busyTable; Busy *busyPtr; Tcl_Obj *objPtr; int index, result = TCL_OK; static const char *const optionStrings[] = { "busywindow", "cget", "configure", "current", "forget", "hold", "status", NULL }; enum options { BUSY_BUSYWINDOW, BUSY_CGET, BUSY_CONFIGURE, BUSY_CURRENT, BUSY_FORGET, BUSY_HOLD, BUSY_STATUS }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "options ?arg arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { case BUSY_CGET: if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "window option"); return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { return TCL_ERROR; } Tcl_Preserve(busyPtr); | > > > > > > > > > > > > > | | | 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum options) index) { case BUSY_BUSYWINDOW: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { Tcl_ResetResult(interp); return TCL_OK; } Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(busyPtr->tkBusy), -1)); return TCL_OK; case BUSY_CGET: if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "window option"); return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { return TCL_ERROR; } Tcl_Preserve(busyPtr); objPtr = Tk_GetOptionValue(interp, busyPtr, busyPtr->optionTable, objv[3], busyPtr->tkBusy); if (objPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); } Tcl_Release(busyPtr); return result; case BUSY_CONFIGURE: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "window ?option? ?value ...?"); return TCL_ERROR; } busyPtr = GetBusy(interp, busyTablePtr, objv[2]); if (busyPtr == NULL) { return TCL_ERROR; } Tcl_Preserve(busyPtr); if (objc <= 4) { objPtr = Tk_GetOptionInfo(interp, busyPtr, busyPtr->optionTable, (objc == 4) ? objv[3] : NULL, busyPtr->tkBusy); if (objPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); } |
︙ | ︙ |
Changes to generic/tkButton.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkButton.h" #include "default.h" | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkButton.h" #include "default.h" typedef struct { int defaultsInitialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Class names for buttons, indexed by one of the type values defined in * tkButton.h. |
︙ | ︙ | |||
66 67 68 69 70 71 72 | /* * Information used for parsing configuration options. There is a * separate table for each of the four widget classes. */ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | /* * Information used for parsing configuration options. There is a * separate table for each of the four widget classes. */ static const Tk_OptionSpec labelOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_BUTTON_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_BUTTON_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefLabelHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", tkDefLabelPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_LABEL_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec buttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_BUTTON_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", DEF_BUTTON_DEFAULT, -1, offsetof(TkButton, defaultState), 0, defaultStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_BUTTON_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", tkDefButtonPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefButtonPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_BUTTON_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_BUTTON_REPEAT_DELAY, -1, offsetof(TkButton, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_BUTTON_REPEAT_INTERVAL, -1, offsetof(TkButton, repeatInterval), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; static const Tk_OptionSpec checkbuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_CHKRAD_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_BUTTON_INDICATOR, -1, offsetof(TkButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", DEF_BUTTON_RELIEF, -1, offsetof(TkButton, offRelief), 0, 0, 0}, {TK_OPTION_STRING, "-offvalue", "offValue", "Value", DEF_BUTTON_OFF_VALUE, offsetof(TkButton, offValuePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-onvalue", "onValue", "Value", DEF_BUTTON_ON_VALUE, offsetof(TkButton, onValuePtr), -1, 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", tkDefLabelPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background", DEF_BUTTON_SELECT_COLOR, -1, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), -1, 0, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_CHECKBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; static const Tk_OptionSpec radiobuttonOptionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkButton, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_CHKRAD_ACTIVE_FG_COLOR, -1, offsetof(TkButton, activeFg), TK_OPTION_NULL_OK, DEF_BUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_BUTTON_ANCHOR, -1, offsetof(TkButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(TkButton, normalBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_BUTTON_BITMAP, -1, offsetof(TkButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", tkDefButtonBorderWidth, offsetof(TkButton, borderWidthPtr), offsetof(TkButton, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_BUTTON_COMMAND, offsetof(TkButton, commandPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, -1, offsetof(TkButton, compound), 0, compoundStrings, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(TkButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_BUTTON_DISABLED_FG_COLOR, -1, offsetof(TkButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_BUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_BUTTON_FONT, -1, offsetof(TkButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_CHKRAD_FG, -1, offsetof(TkButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_BUTTON_HEIGHT, offsetof(TkButton, heightPtr), -1, 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_BUTTON_HIGHLIGHT_BG_COLOR, -1, offsetof(TkButton, highlightBorder), 0, (ClientData) DEF_BUTTON_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_BUTTON_HIGHLIGHT, -1, offsetof(TkButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", tkDefButtonHighlightWidth, offsetof(TkButton, highlightWidthPtr), offsetof(TkButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_BUTTON_IMAGE, offsetof(TkButton, imagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_BUTTON_INDICATOR, -1, offsetof(TkButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_BUTTON_JUSTIFY, -1, offsetof(TkButton, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-offrelief", "offRelief", "OffRelief", DEF_BUTTON_RELIEF, -1, offsetof(TkButton, offRelief), 0, 0, 0}, {TK_OPTION_RELIEF, "-overrelief", "overRelief", "OverRelief", DEF_BUTTON_OVER_RELIEF, -1, offsetof(TkButton, overRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", tkDefLabelPadx, offsetof(TkButton, padXPtr), offsetof(TkButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", tkDefLabelPady, offsetof(TkButton, padYPtr), offsetof(TkButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABCHKRAD_RELIEF, -1, offsetof(TkButton, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectcolor", "selectColor", "Background", DEF_BUTTON_SELECT_COLOR, -1, offsetof(TkButton, selectBorder), TK_OPTION_NULL_OK, DEF_BUTTON_SELECT_MONO, 0}, {TK_OPTION_STRING, "-selectimage", "selectImage", "SelectImage", DEF_BUTTON_SELECT_IMAGE, offsetof(TkButton, selectImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_BUTTON_STATE, -1, offsetof(TkButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_BUTTON_TAKE_FOCUS, offsetof(TkButton, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_BUTTON_TEXT, offsetof(TkButton, textPtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_BUTTON_TEXT_VARIABLE, offsetof(TkButton, textVarNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristateimage", "tristateImage", "TristateImage", DEF_BUTTON_IMAGE, offsetof(TkButton, tristateImagePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-tristatevalue", "tristateValue", "TristateValue", DEF_BUTTON_TRISTATE_VALUE, offsetof(TkButton, tristateValuePtr), -1, 0, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", DEF_BUTTON_UNDERLINE, -1, offsetof(TkButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-value", "value", "Value", DEF_BUTTON_VALUE, offsetof(TkButton, onValuePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_RADIOBUTTON_VARIABLE, offsetof(TkButton, selVarNamePtr), -1, 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_BUTTON_WIDTH, offsetof(TkButton, widthPtr), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_BUTTON_WRAP_LENGTH, offsetof(TkButton, wrapLengthPtr), offsetof(TkButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * The following table maps from one of the type values defined in tkButton.h, * such as TYPE_LABEL, to the option template for that class of widgets. */ |
︙ | ︙ | |||
745 746 747 748 749 750 751 | butPtr->commandPtr = NULL; butPtr->flags = 0; Tk_CreateEventHandler(butPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ButtonEventProc, butPtr); | | | 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 | butPtr->commandPtr = NULL; butPtr->flags = 0; Tk_CreateEventHandler(butPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ButtonEventProc, butPtr); if (Tk_InitOptions(interp, butPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(butPtr->tkwin); return TCL_ERROR; } if (ConfigureButton(interp, butPtr, objc - 2, objv + 2) != TCL_OK) { Tk_DestroyWindow(butPtr->tkwin); return TCL_ERROR; |
︙ | ︙ | |||
806 807 808 809 810 811 812 | switch (map[butPtr->type][index]) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } | | | | 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | switch (map[butPtr->type][index]) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } objPtr = Tk_GetOptionValue(interp, butPtr, butPtr->optionTable, objv[2], butPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case COMMAND_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, butPtr, butPtr->optionTable, (objc == 3) ? objv[2] : NULL, butPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); } else { |
︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ | | | 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ if (Tk_SetOptions(interp, butPtr, butPtr->optionTable, objc, objv, butPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; } } else { /* * Second pass: restore options to old values. |
︙ | ︙ | |||
1171 1172 1173 1174 1175 1176 1177 | /* * If a radiobutton has the empty string as value it should be * selected. */ if ((butPtr->type == TYPE_RADIO_BUTTON) && | | | 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | /* * If a radiobutton has the empty string as value it should be * selected. */ if ((butPtr->type == TYPE_RADIO_BUTTON) && (*Tcl_GetString(butPtr->onValuePtr) == '\0')) { butPtr->flags |= SELECTED; } } } /* * Get the images for the widget, if there are any. Allocate the new |
︙ | ︙ | |||
1612 1613 1614 1615 1616 1617 1618 | const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkButton *butPtr = clientData; const char *value; Tcl_Obj *valuePtr; | < < < < < < < < < < < < < > > | > > > > > > > > > > > > > > > > > > | 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 | const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkButton *butPtr = clientData; const char *value; Tcl_Obj *valuePtr; /* * If the variable is being unset, then just re-establish the trace unless * the whole interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { butPtr->flags &= ~(SELECTED | TRISTATED); if (!Tcl_InterpDeleted(interp)) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(butPtr->selVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, probe); if (probe == (ClientData)butPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * selVarNamePtr, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ goto redisplay; } Tcl_TraceVar2(interp, Tcl_GetString(butPtr->selVarNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonVarProc, clientData); } goto redisplay; } |
︙ | ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | */ /* ARGSUSED */ static char * ButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | < < < < < < < < < < < < < > | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 | */ /* ARGSUSED */ static char * ButtonTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Not used. */ const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { TkButton *butPtr = clientData; Tcl_Obj *valuePtr; if (butPtr->flags & BUTTON_DELETED) { return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && butPtr->textVarNamePtr != NULL) { /* * An unset trace on some variable brought us here, but is it * the variable we have stored in butPtr->textVarNamePtr ? */ ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(butPtr->textVarNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, probe); if (probe == (ClientData)butPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarNamePtr, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former textvariable must be, and we should ignore it. */ return NULL; } Tcl_ObjSetVar2(interp, butPtr->textVarNamePtr, NULL, butPtr->textPtr, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, Tcl_GetString(butPtr->textVarNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ButtonTextVarProc, clientData); } return NULL; |
︙ | ︙ |
Changes to generic/tkCanvArc.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" /* * The structure below defines the record for each arc item. */ typedef enum { PIESLICE_STYLE, CHORD_STYLE, ARC_STYLE } Style; | > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" #include "float.h" /* * The structure below defines the record for each arc item. */ typedef enum { PIESLICE_STYLE, CHORD_STYLE, ARC_STYLE } Style; |
︙ | ︙ | |||
58 59 60 61 62 63 64 65 66 67 68 69 70 71 | Style style; /* How to draw arc: arc, chord, or * pieslice. */ GC fillGC; /* Graphics context for filling item. */ double center1[2]; /* Coordinates of center of arc outline at * start (see ComputeArcOutline). */ double center2[2]; /* Coordinates of center of arc outline at * start+extent (see ComputeArcOutline). */ } ArcItem; /* * The definitions below define the sizes of the polygons used to display * outline information for various styles of arcs: */ | > > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | Style style; /* How to draw arc: arc, chord, or * pieslice. */ GC fillGC; /* Graphics context for filling item. */ double center1[2]; /* Coordinates of center of arc outline at * start (see ComputeArcOutline). */ double center2[2]; /* Coordinates of center of arc outline at * start+extent (see ComputeArcOutline). */ double height; /* Distance from the arc's chord to its * mid-point. */ double startPoint[2]; /* Start point of arc used when specifying * height. */ double endPoint[2]; /* End point of arc used when specifying * height. */ } ArcItem; /* * The definitions below define the sizes of the polygons used to display * outline information for various styles of arcs: */ |
︙ | ︙ | |||
100 101 102 103 104 105 106 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, | | | | | | | | | | | | | | | | | > > | | | | | | | | | > | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, offsetof(ArcItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(ArcItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, NULL, offsetof(ArcItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, NULL, offsetof(ArcItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(ArcItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, "0.0", offsetof(ArcItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, NULL, offsetof(ArcItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, "0", offsetof(ArcItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, offsetof(ArcItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, NULL, offsetof(ArcItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, NULL, offsetof(ArcItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, offsetof(ArcItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(ArcItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, "0.0", offsetof(ArcItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_DOUBLE, "-extent", NULL, NULL, "90", offsetof(ArcItem, extent), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, NULL, offsetof(ArcItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-height", NULL, NULL, 0, offsetof(ArcItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(ArcItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, "black", offsetof(ArcItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, "0,0", offsetof(ArcItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, NULL, offsetof(ArcItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-start", NULL, NULL, "0", offsetof(ArcItem, start), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(ArcItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-style", NULL, NULL, NULL, offsetof(ArcItem, style), TK_CONFIG_DONT_SET_DEFAULT, &styleOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, "1.0", offsetof(ArcItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ static void ComputeArcBbox(Tk_Canvas canvas, ArcItem *arcPtr); static int ConfigureArc(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], int flags); static void ComputeArcParametersFromHeight(ArcItem *arcPtr); static int CreateArc(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayArc(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, |
︙ | ︙ | |||
201 202 203 204 205 206 207 208 209 210 211 212 213 214 | static void ComputeArcOutline(Tk_Canvas canvas, ArcItem *arcPtr); static int HorizLineToArc(double x1, double x2, double y, double rx, double ry, double start, double extent); static int VertLineToArc(double x, double y1, double y2, double rx, double ry, double start, double extent); /* * The structures below defines the arc item types by means of functions that * can be invoked by generic item code. */ Tk_ItemType tkArcType = { | > > | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | static void ComputeArcOutline(Tk_Canvas canvas, ArcItem *arcPtr); static int HorizLineToArc(double x1, double x2, double y, double rx, double ry, double start, double extent); static int VertLineToArc(double x, double y1, double y2, double rx, double ry, double start, double extent); static void RotateArc(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); /* * The structures below defines the arc item types by means of functions that * can be invoked by generic item code. */ Tk_ItemType tkArcType = { |
︙ | ︙ | |||
228 229 230 231 232 233 234 | TranslateArc, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | TranslateArc, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateArc, /* rotateProc */ 0, NULL, NULL }; /* *-------------------------------------------------------------- * * CreateArc -- * |
︙ | ︙ | |||
287 288 289 290 291 292 293 294 295 296 297 298 299 300 | arcPtr->activeFillColor = NULL; arcPtr->disabledFillColor = NULL; arcPtr->fillStipple = None; arcPtr->activeFillStipple = None; arcPtr->disabledFillStipple = None; arcPtr->style = PIESLICE_STYLE; arcPtr->fillGC = NULL; /* * Process the arguments to fill in the item record. */ for (i = 1; i < objc; i++) { const char *arg = Tcl_GetString(objv[i]); | > | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | arcPtr->activeFillColor = NULL; arcPtr->disabledFillColor = NULL; arcPtr->fillStipple = None; arcPtr->activeFillStipple = None; arcPtr->disabledFillStipple = None; arcPtr->style = PIESLICE_STYLE; arcPtr->fillGC = NULL; arcPtr->height = 0; /* * Process the arguments to fill in the item record. */ for (i = 1; i < objc; i++) { const char *arg = Tcl_GetString(objv[i]); |
︙ | ︙ | |||
347 348 349 350 351 352 353 | Tcl_Obj *objs[4]; objs[0] = Tcl_NewDoubleObj(arcPtr->bbox[0]); objs[1] = Tcl_NewDoubleObj(arcPtr->bbox[1]); objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]); objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs)); | | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | Tcl_Obj *objs[4]; objs[0] = Tcl_NewDoubleObj(arcPtr->bbox[0]); objs[1] = Tcl_NewDoubleObj(arcPtr->bbox[1]); objs[2] = Tcl_NewDoubleObj(arcPtr->bbox[2]); objs[3] = Tcl_NewDoubleObj(arcPtr->bbox[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(4, objs)); } else if ((objc == 1) || (objc == 4)) { if (objc == 1) { if (Tcl_ListObjGetElements(interp, objv[0], &objc, (Tcl_Obj ***) &objv) != TCL_OK) { return TCL_ERROR; } else if (objc != 4) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 4, got %d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "ARC", |
︙ | ︙ | |||
370 371 372 373 374 375 376 377 378 379 380 381 382 383 | &arcPtr->bbox[1]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2], &arcPtr->bbox[2]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &arcPtr->bbox[3]) != TCL_OK)) { return TCL_ERROR; } ComputeArcBbox(canvas, arcPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 4, got %d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "ARC", NULL); return TCL_ERROR; } | > > > > > > > > > > > | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | &arcPtr->bbox[1]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[2], &arcPtr->bbox[2]) != TCL_OK) || (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &arcPtr->bbox[3]) != TCL_OK)) { return TCL_ERROR; } /* * Store bbox as start and end points so they can be used if either * radius or height is specified. */ arcPtr->startPoint[0] = arcPtr->bbox[0]; arcPtr->startPoint[1] = arcPtr->bbox[1]; arcPtr->endPoint[0] = arcPtr->bbox[2]; arcPtr->endPoint[1] = arcPtr->bbox[3]; ComputeArcBbox(canvas, arcPtr); } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # coordinates: expected 0 or 4, got %d", objc)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "COORDS", "ARC", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | arcPtr->activeFillColor != NULL || arcPtr->activeFillStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; } tsoffset = &arcPtr->outline.tsoffset; flags = tsoffset->flags; if (flags & TK_OFFSET_LEFT) { tsoffset->xoffset = (int) (arcPtr->bbox[0] + 0.5); } else if (flags & TK_OFFSET_CENTER) { tsoffset->xoffset = (int) ((arcPtr->bbox[0]+arcPtr->bbox[2]+1)/2); } else if (flags & TK_OFFSET_RIGHT) { tsoffset->xoffset = (int) (arcPtr->bbox[2] + 0.5); } if (flags & TK_OFFSET_TOP) { tsoffset->yoffset = (int) (arcPtr->bbox[1] + 0.5); } else if (flags & TK_OFFSET_MIDDLE) { tsoffset->yoffset = (int) ((arcPtr->bbox[1]+arcPtr->bbox[3]+1)/2); } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5); } | > > > > > > > > > > > > > > > > < < < < < < < < | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | arcPtr->activeFillColor != NULL || arcPtr->activeFillStipple != None) { itemPtr->redraw_flags |= TK_ITEM_STATE_DEPENDANT; } else { itemPtr->redraw_flags &= ~TK_ITEM_STATE_DEPENDANT; } /* * Override the start and extent if the height is given. */ ComputeArcParametersFromHeight(arcPtr); ComputeArcBbox(canvas, arcPtr); i = (int) (arcPtr->start/360.0); arcPtr->start -= i*360.0; if (arcPtr->start < 0) { arcPtr->start += 360.0; } i = (int) (arcPtr->extent/360.0); arcPtr->extent -= i*360.0; tsoffset = &arcPtr->outline.tsoffset; flags = tsoffset->flags; if (flags & TK_OFFSET_LEFT) { tsoffset->xoffset = (int) (arcPtr->bbox[0] + 0.5); } else if (flags & TK_OFFSET_CENTER) { tsoffset->xoffset = (int) ((arcPtr->bbox[0]+arcPtr->bbox[2]+1)/2); } else if (flags & TK_OFFSET_RIGHT) { tsoffset->xoffset = (int) (arcPtr->bbox[2] + 0.5); } if (flags & TK_OFFSET_TOP) { tsoffset->yoffset = (int) (arcPtr->bbox[1] + 0.5); } else if (flags & TK_OFFSET_MIDDLE) { tsoffset->yoffset = (int) ((arcPtr->bbox[1]+arcPtr->bbox[3]+1)/2); } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[2] + 0.5); } mask = Tk_ConfigOutlineGC(&gcValues, canvas, itemPtr, &(arcPtr->outline)); if (mask) { gcValues.cap_style = CapButt; mask |= GCCapStyle; newGC = Tk_GetGC(tkwin, mask, &gcValues); } else { newGC = NULL; |
︙ | ︙ | |||
505 506 507 508 509 510 511 | } else if (state==TK_STATE_DISABLED) { if (arcPtr->disabledFillColor!=NULL) { color = arcPtr->disabledFillColor; } if (arcPtr->disabledFillStipple!=None) { stipple = arcPtr->disabledFillStipple; } | | | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | } else if (state==TK_STATE_DISABLED) { if (arcPtr->disabledFillColor!=NULL) { color = arcPtr->disabledFillColor; } if (arcPtr->disabledFillStipple!=None) { stipple = arcPtr->disabledFillStipple; } } if (arcPtr->style == ARC_STYLE) { newGC = NULL; } else if (color == NULL) { newGC = NULL; } else { gcValues.foreground = color->pixel; |
︙ | ︙ | |||
551 552 553 554 555 556 557 558 559 560 561 562 563 564 | } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[3] + 0.5); } ComputeArcBbox(canvas, arcPtr); return TCL_OK; } /* *-------------------------------------------------------------- * * DeleteArc -- * * This function is called to clean up the data structure associated with | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | } else if (flags & TK_OFFSET_BOTTOM) { tsoffset->yoffset = (int) (arcPtr->bbox[3] + 0.5); } ComputeArcBbox(canvas, arcPtr); return TCL_OK; } /* *-------------------------------------------------------------- * * ComputeArcParametersFromHeight -- * * This function calculates the arc parameters given start-point, * end-point and height (!= 0). * * Results: * None. * * Side effects: * The height parameter is set to 0 on exit. * *-------------------------------------------------------------- */ static void ComputeArcParametersFromHeight( ArcItem* arcPtr) { double chordLen, chordDir[2], chordCen[2], arcCen[2], d, radToDeg, radius; /* * Do nothing if no height has been specified. */ if (arcPtr->height == 0) return; /* * Calculate the chord length, return early if it is too small. */ chordLen = hypot(arcPtr->endPoint[1] - arcPtr->startPoint[1], arcPtr->startPoint[0] - arcPtr->endPoint[0]); if (chordLen < DBL_EPSILON) { arcPtr->start = arcPtr->extent = arcPtr->height = 0; return; } chordDir[0] = (arcPtr->endPoint[0] - arcPtr->startPoint[0]) / chordLen; chordDir[1] = (arcPtr->endPoint[1] - arcPtr->startPoint[1]) / chordLen; chordCen[0] = (arcPtr->startPoint[0] + arcPtr->endPoint[0]) / 2; chordCen[1] = (arcPtr->startPoint[1] + arcPtr->endPoint[1]) / 2; /* * Calculate the radius (assumes height != 0). */ radius = (4*pow(arcPtr->height, 2) + pow(chordLen, 2)) / (8 * arcPtr->height); /* * The arc centre. */ d = radius - arcPtr->height; arcCen[0] = chordCen[0] - d * chordDir[1]; arcCen[1] = chordCen[1] + d * chordDir[0]; /* * The arc start and span. Angles are negated because the coordinate * system is left-handed. */ radToDeg = 45 / atan(1); arcPtr->start = atan2(arcCen[1] - arcPtr->startPoint[1], arcPtr->startPoint[0] - arcCen[0]) * radToDeg; arcPtr->extent = -2 * asin(chordLen / (2 * radius)) * radToDeg; /* * Handle spans > 180. */ if (fabs(2 * arcPtr->height) > chordLen) { arcPtr->extent = arcPtr->extent > 0 ? (360 - arcPtr->extent) : -(360 + arcPtr->extent); } /* * Create the bounding box. */ arcPtr->bbox[0] = arcCen[0] - radius; arcPtr->bbox[1] = arcCen[1] - radius; arcPtr->bbox[2] = arcCen[0] + radius; arcPtr->bbox[3] = arcCen[1] + radius; /* * Set the height to 0 so that itemcget -height returns 0. */ arcPtr->height = 0; } /* *-------------------------------------------------------------- * * DeleteArc -- * * This function is called to clean up the data structure associated with |
︙ | ︙ | |||
673 674 675 676 677 678 679 | arcPtr->bbox[2] = arcPtr->bbox[0]; arcPtr->bbox[0] = tmp; } ComputeArcOutline(canvas,arcPtr); /* | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | arcPtr->bbox[2] = arcPtr->bbox[0]; arcPtr->bbox[0] = tmp; } ComputeArcOutline(canvas,arcPtr); /* * To compute the bounding box, start with the bbox formed by the two * endpoints of the arc. Then add in the center of the arc's oval (if * relevant) and the 3-o'clock, 6-o'clock, 9-o'clock, and 12-o'clock * positions, if they are relevant. */ arcPtr->header.x1 = arcPtr->header.x2 = (int) arcPtr->center1[0]; arcPtr->header.y1 = arcPtr->header.y2 = (int) arcPtr->center1[1]; |
︙ | ︙ | |||
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 | { ArcItem *arcPtr = (ArcItem *) itemPtr; arcPtr->bbox[0] = originX + scaleX*(arcPtr->bbox[0] - originX); arcPtr->bbox[1] = originY + scaleY*(arcPtr->bbox[1] - originY); arcPtr->bbox[2] = originX + scaleX*(arcPtr->bbox[2] - originX); arcPtr->bbox[3] = originY + scaleY*(arcPtr->bbox[3] - originY); ComputeArcBbox(canvas, arcPtr); } /* *-------------------------------------------------------------- * * TranslateArc -- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 | { ArcItem *arcPtr = (ArcItem *) itemPtr; arcPtr->bbox[0] = originX + scaleX*(arcPtr->bbox[0] - originX); arcPtr->bbox[1] = originY + scaleY*(arcPtr->bbox[1] - originY); arcPtr->bbox[2] = originX + scaleX*(arcPtr->bbox[2] - originX); arcPtr->bbox[3] = originY + scaleY*(arcPtr->bbox[3] - originY); ComputeArcBbox(canvas, arcPtr); } /* *-------------------------------------------------------------- * * RotateArc -- * * This function is called to rotate an arc by a given amount. * * Results: * None. * * Side effects: * The position of the arc is rotated by angleRad radians about (originX, * originY), and the bounding box is updated in the generic part of the * item structure. * *-------------------------------------------------------------- */ static void RotateArc( Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad) { ArcItem *arcPtr = (ArcItem *) itemPtr; double newX, newY, oldX, oldY; /* * Compute the centre of the box, then rotate that about the origin. */ newX = oldX = (arcPtr->bbox[0] + arcPtr->bbox[2]) / 2.0; newY = oldY = (arcPtr->bbox[1] + arcPtr->bbox[3]) / 2.0; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &newX, &newY); /* * Apply the translation to the box. */ arcPtr->bbox[0] += newX - oldX; arcPtr->bbox[1] += newY - oldY; arcPtr->bbox[2] += newX - oldX; arcPtr->bbox[3] += newY - oldY; /* * TODO: update the arc endpoints? */ ComputeArcBbox(canvas, arcPtr); } /* *-------------------------------------------------------------- * * TranslateArc -- |
︙ | ︙ |
Changes to generic/tkCanvBmap.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activebackground", NULL, NULL, | | | | | | | | | | | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activebackground", NULL, NULL, NULL, offsetof(BitmapItem, activeBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activebitmap", NULL, NULL, NULL, offsetof(BitmapItem, activeBitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeforeground", NULL, NULL, NULL, offsetof(BitmapItem, activeFgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(BitmapItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-background", NULL, NULL, NULL, offsetof(BitmapItem, bgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-bitmap", NULL, NULL, NULL, offsetof(BitmapItem, bitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledbackground", NULL, NULL, NULL, offsetof(BitmapItem, disabledBgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledbitmap", NULL, NULL, NULL, offsetof(BitmapItem, disabledBitmap), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledforeground", NULL, NULL, NULL, offsetof(BitmapItem, disabledFgColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-foreground", NULL, NULL, "black", offsetof(BitmapItem, fgColor), 0, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* |
︙ | ︙ | |||
101 102 103 104 105 106 107 108 109 110 111 112 113 114 | Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void ScaleBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* | > > | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateBitmap(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* |
︙ | ︙ | |||
133 134 135 136 137 138 139 | TranslateBitmap, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | TranslateBitmap, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateBitmap, /* rotateProc */ 0, NULL, NULL }; /* *-------------------------------------------------------------- * * TkcCreateBitmap -- * |
︙ | ︙ | |||
782 783 784 785 786 787 788 789 790 791 792 793 794 795 | { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; bmapPtr->x = originX + scaleX*(bmapPtr->x - originX); bmapPtr->y = originY + scaleY*(bmapPtr->y - originY); ComputeBitmapBbox(canvas, bmapPtr); } /* *-------------------------------------------------------------- * * TranslateBitmap -- * * This function is called to move an item by a given amount. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 | { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; bmapPtr->x = originX + scaleX*(bmapPtr->x - originX); bmapPtr->y = originY + scaleY*(bmapPtr->y - originY); ComputeBitmapBbox(canvas, bmapPtr); } /* *-------------------------------------------------------------- * * RotateBitmap -- * * This function is called to rotate a bitmap's origin by a given amount. * * Results: * None. * * Side effects: * The position of the bitmap is rotated by angleRad radians about * (originX, originY), and the bounding box is updated in the generic * part of the item structure. * *-------------------------------------------------------------- */ static void RotateBitmap( Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad) { BitmapItem *bmapPtr = (BitmapItem *) itemPtr; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &bmapPtr->x, &bmapPtr->y); ComputeBitmapBbox(canvas, bmapPtr); } /* *-------------------------------------------------------------- * * TranslateBitmap -- * * This function is called to move an item by a given amount. |
︙ | ︙ |
Changes to generic/tkCanvImg.c.
︙ | ︙ | |||
48 49 50 51 52 53 54 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-activeimage", NULL, NULL, | | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-activeimage", NULL, NULL, NULL, offsetof(ImageItem, activeImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(ImageItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_STRING, "-disabledimage", NULL, NULL, NULL, offsetof(ImageItem, disabledImageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-image", NULL, NULL, NULL, offsetof(ImageItem, imageString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | Tk_Canvas canvas, struct Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]); static void DeleteImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void ScaleImage(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateImage(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* | > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | Tk_Canvas canvas, struct Tk_Item *itemPtr, int argc, Tcl_Obj *const argv[]); static void DeleteImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayImage(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateImage(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleImage(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateImage(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* |
︙ | ︙ | |||
122 123 124 125 126 127 128 | TranslateImage, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | TranslateImage, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateImage, /* rotateProc */ 0, NULL, NULL }; /* *-------------------------------------------------------------- * * CreateImage -- * |
︙ | ︙ | |||
753 754 755 756 757 758 759 760 761 762 763 764 765 766 | Tcl_AppendPrintfToObj(psObj, "%.15g %.15g translate\n", x, y); } return Tk_PostscriptImage(image, interp, canvasWin, ((TkCanvas *) canvas)->psInfo, 0, 0, width, height, prepass); } /* *-------------------------------------------------------------- * * ScaleImage -- * * This function is invoked to rescale an item. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 | Tcl_AppendPrintfToObj(psObj, "%.15g %.15g translate\n", x, y); } return Tk_PostscriptImage(image, interp, canvasWin, ((TkCanvas *) canvas)->psInfo, 0, 0, width, height, prepass); } /* *-------------------------------------------------------------- * * RotateImage -- * * This function is called to rotate an image's origin by a given amount. * This does *not* rotate the contents of the image. * * Results: * None. * * Side effects: * The position of the image anchor is rotated by angleRad radians about * (originX, originY), and the bounding box is updated in the generic * part of the item structure. * *-------------------------------------------------------------- */ static void RotateImage( Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad) { ImageItem *imgPtr = (ImageItem *) itemPtr; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &imgPtr->x, &imgPtr->y); ComputeImageBbox(canvas, imgPtr); } /* *-------------------------------------------------------------- * * ScaleImage -- * * This function is invoked to rescale an item. |
︙ | ︙ |
Changes to generic/tkCanvLine.c.
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 | Tcl_FreeProc **freeProcPtr); static int ParseArrowShape(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, int offset); static const char * PrintArrowShape(ClientData clientData, Tk_Window tkwin, char *recordPtr, int offset, Tcl_FreeProc **freeProcPtr); static void ScaleLine(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateLine(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* | > > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | Tcl_FreeProc **freeProcPtr); static int ParseArrowShape(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *recordPtr, int offset); static const char * PrintArrowShape(ClientData clientData, Tk_Window tkwin, char *recordPtr, int offset, Tcl_FreeProc **freeProcPtr); static void RotateLine(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleLine(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateLine(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* |
︙ | ︙ | |||
153 154 155 156 157 158 159 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, | | | | | | | | | | | | | | | | | | | | | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, offsetof(LineItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(LineItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(LineItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, "0.0", offsetof(LineItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-arrow", NULL, NULL, "none", offsetof(LineItem, arrow), TK_CONFIG_DONT_SET_DEFAULT, &arrowOption}, {TK_CONFIG_CUSTOM, "-arrowshape", NULL, NULL, "8 10 3", offsetof(LineItem, arrowShapeA), TK_CONFIG_DONT_SET_DEFAULT, &arrowShapeOption}, {TK_CONFIG_CAP_STYLE, "-capstyle", NULL, NULL, "butt", offsetof(LineItem, capStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, "black", offsetof(LineItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, NULL, offsetof(LineItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, "0", offsetof(LineItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, offsetof(LineItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, NULL, offsetof(LineItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(LineItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, "0.0", offsetof(LineItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL, "round", offsetof(LineItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(LineItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL, "0", offsetof(LineItem, smooth), TK_CONFIG_DONT_SET_DEFAULT, &smoothOption}, {TK_CONFIG_INT, "-splinesteps", NULL, NULL, "12", offsetof(LineItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(LineItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, "1.0", offsetof(LineItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * The structures below defines the line item type by means of functions that * can be invoked by generic item code. |
︙ | ︙ | |||
235 236 237 238 239 240 241 | TranslateLine, /* translateProc */ GetLineIndex, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ LineInsert, /* insertProc */ LineDeleteCoords, /* dTextProc */ NULL, /* nextPtr */ | > | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | TranslateLine, /* translateProc */ GetLineIndex, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ LineInsert, /* insertProc */ LineDeleteCoords, /* dTextProc */ NULL, /* nextPtr */ RotateLine, /* rotateProc */ 0, NULL, NULL }; /* * The definition below determines how large are static arrays used to hold * spline points (splines larger than this have to have their arrays * malloc-ed). */ |
︙ | ︙ | |||
1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 | } ComputeLineBbox(canvas, linePtr); } /* *-------------------------------------------------------------- * * ParseArrowShape -- * * This function is called back during option parsing to parse arrow * shape information. * * Results: * The return value is a standard Tcl result: TCL_OK means that the arrow | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 | } ComputeLineBbox(canvas, linePtr); } /* *-------------------------------------------------------------- * * RotateLine -- * * This function is called to rotate a line by a given amount about a * point. * * Results: * None. * * Side effects: * The position of the line is rotated by angleRad about (originX, * originY), and the bounding box is updated in the generic part of the * item structure. * *-------------------------------------------------------------- */ static void RotateLine( Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { LineItem *linePtr = (LineItem *) itemPtr; double *coordPtr; int i; double s = sin(angleRad), c = cos(angleRad); for (i = 0, coordPtr = linePtr->coordPtr; i < linePtr->numPoints; i++, coordPtr += 2) { TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]); } if (linePtr->firstArrowPtr != NULL) { for (i = 0, coordPtr = linePtr->firstArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]); } } if (linePtr->lastArrowPtr != NULL) { for (i = 0, coordPtr = linePtr->lastArrowPtr; i < PTS_IN_ARROW; i++, coordPtr += 2) { TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]); } } ComputeLineBbox(canvas, linePtr); } /* *-------------------------------------------------------------- * * ParseArrowShape -- * * This function is called back during option parsing to parse arrow * shape information. * * Results: * The return value is a standard Tcl result: TCL_OK means that the arrow |
︙ | ︙ | |||
1885 1886 1887 1888 1889 1890 1891 | * record. */ { LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; int argc; const char **argv = NULL; | | | 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 | * record. */ { LineItem *linePtr = (LineItem *) recordPtr; double a, b, c; int argc; const char **argv = NULL; if ((size_t)offset != offsetof(LineItem, arrowShapeA)) { Tcl_Panic("ParseArrowShape received bogus offset"); } if (Tcl_SplitList(interp, (char *) value, &argc, &argv) != TCL_OK) { goto syntaxError; } else if (argc != 3) { goto syntaxError; |
︙ | ︙ |
Changes to generic/tkCanvPoly.c.
︙ | ︙ | |||
72 73 74 75 76 77 78 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, | | | | | | | | | | | | | | | | | | | | | | | | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, offsetof(PolygonItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(PolygonItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, NULL, offsetof(PolygonItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, NULL, offsetof(PolygonItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(PolygonItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, "0.0", offsetof(PolygonItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, NULL, offsetof(PolygonItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, "0", offsetof(PolygonItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, offsetof(PolygonItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, NULL, offsetof(PolygonItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, NULL, offsetof(PolygonItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, offsetof(PolygonItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(PolygonItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-disabledwidth", NULL, NULL, "0.0", offsetof(PolygonItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, "black", offsetof(PolygonItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_JOIN_STYLE, "-joinstyle", NULL, NULL, "round", offsetof(PolygonItem, joinStyle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(PolygonItem, tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, NULL, offsetof(PolygonItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, "0,0", offsetof(PolygonItem, outline.tsoffset), TK_CONFIG_NULL_OK, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, NULL, offsetof(PolygonItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-smooth", NULL, NULL, "0", offsetof(PolygonItem, smooth), TK_CONFIG_DONT_SET_DEFAULT, &smoothOption}, {TK_CONFIG_INT, "-splinesteps", NULL, NULL, "12", offsetof(PolygonItem, splineSteps), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(PolygonItem, fillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, "1.0", offsetof(PolygonItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ |
︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 182 183 184 185 | Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj); static int PolygonToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double PolygonToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int PolygonToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void ScalePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslatePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* | > > | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj); static int PolygonToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double PolygonToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int PolygonToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void RotatePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScalePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslatePolygon(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* |
︙ | ︙ | |||
198 199 200 201 202 203 204 | DisplayPolygon, /* displayProc */ TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ ScalePolygon, /* scaleProc */ TranslatePolygon, /* translateProc */ | | | > | | 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | DisplayPolygon, /* displayProc */ TK_CONFIG_OBJS | TK_MOVABLE_POINTS, /* flags */ PolygonToPoint, /* pointProc */ PolygonToArea, /* areaProc */ PolygonToPostscript, /* postscriptProc */ ScalePolygon, /* scaleProc */ TranslatePolygon, /* translateProc */ GetPolygonIndex, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ PolygonInsert, /* insertProc */ PolygonDeleteCoords, /* dTextProc */ NULL, /* nextPtr */ RotatePolygon, /* rotateProc */ 0, NULL, NULL }; /* * The definition below determines how large are static arrays used to hold * spline points (splines larger than this have to have their arrays * malloc-ed). */ |
︙ | ︙ | |||
514 515 516 517 518 519 520 | mask |= GCStipple|GCFillStyle; } #ifdef MAC_OSX_TK /* * Mac OS X CG drawing needs access to the outline linewidth * even for fills (as linewidth controls antialiasing). */ | | | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | mask |= GCStipple|GCFillStyle; } #ifdef MAC_OSX_TK /* * Mac OS X CG drawing needs access to the outline linewidth * even for fills (as linewidth controls antialiasing). */ gcValues.line_width = polyPtr->outline.gc != NULL ? polyPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } if (polyPtr->fillGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), polyPtr->fillGC); |
︙ | ︙ | |||
1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 | */ badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "POLY", NULL); return TCL_ERROR; } /* *-------------------------------------------------------------- * * TranslatePolygon -- * * This function is called to move a polygon by a given amount. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | */ badIndex: Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad index \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "ITEM_INDEX", "POLY", NULL); return TCL_ERROR; } /* *-------------------------------------------------------------- * * RotatePolygon -- * * This function is called to rotate a polygon by a given amount about a * point. * * Results: * None. * * Side effects: * The position of the polygon is rotated by angleRad about (originX, * originY), and the bounding box is updated in the generic part of the * item structure. * *-------------------------------------------------------------- */ static void RotatePolygon( Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being moved. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { PolygonItem *polyPtr = (PolygonItem *) itemPtr; double *coordPtr; int i; double s = sin(angleRad), c = cos(angleRad); for (i = 0, coordPtr = polyPtr->coordPtr; i < polyPtr->numPoints; i++, coordPtr += 2) { TkRotatePoint(originX, originY, s, c, &coordPtr[0], &coordPtr[1]); } ComputePolygonBbox(canvas, polyPtr); } /* *-------------------------------------------------------------- * * TranslatePolygon -- * * This function is called to move a polygon by a given amount. |
︙ | ︙ |
Changes to generic/tkCanvPs.c.
︙ | ︙ | |||
90 91 92 93 94 95 96 | /* * The table below provides a template that's used to process arguments to the * canvas "postscript" command and fill in TkPostscriptInfo structures. */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-colormap", NULL, NULL, | | | | | | | | | | | | | | | | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | /* * The table below provides a template that's used to process arguments to the * canvas "postscript" command and fill in TkPostscriptInfo structures. */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-colormap", NULL, NULL, "", offsetof(TkPostscriptInfo, colorVar), 0, NULL}, {TK_CONFIG_STRING, "-colormode", NULL, NULL, "", offsetof(TkPostscriptInfo, colorMode), 0, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, "", offsetof(TkPostscriptInfo, fileName), 0, NULL}, {TK_CONFIG_STRING, "-channel", NULL, NULL, "", offsetof(TkPostscriptInfo, channelName), 0, NULL}, {TK_CONFIG_STRING, "-fontmap", NULL, NULL, "", offsetof(TkPostscriptInfo, fontVar), 0, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, "", offsetof(TkPostscriptInfo, height), 0, NULL}, {TK_CONFIG_ANCHOR, "-pageanchor", NULL, NULL, "", offsetof(TkPostscriptInfo, pageAnchor), 0, NULL}, {TK_CONFIG_STRING, "-pageheight", NULL, NULL, "", offsetof(TkPostscriptInfo, pageHeightString), 0, NULL}, {TK_CONFIG_STRING, "-pagewidth", NULL, NULL, "", offsetof(TkPostscriptInfo, pageWidthString), 0, NULL}, {TK_CONFIG_STRING, "-pagex", NULL, NULL, "", offsetof(TkPostscriptInfo, pageXString), 0, NULL}, {TK_CONFIG_STRING, "-pagey", NULL, NULL, "", offsetof(TkPostscriptInfo, pageYString), 0, NULL}, {TK_CONFIG_BOOLEAN, "-prolog", NULL, NULL, "", offsetof(TkPostscriptInfo, prolog), 0, NULL}, {TK_CONFIG_BOOLEAN, "-rotate", NULL, NULL, "", offsetof(TkPostscriptInfo, rotate), 0, NULL}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, "", offsetof(TkPostscriptInfo, width), 0, NULL}, {TK_CONFIG_PIXELS, "-x", NULL, NULL, "", offsetof(TkPostscriptInfo, x), 0, NULL}, {TK_CONFIG_PIXELS, "-y", NULL, NULL, "", offsetof(TkPostscriptInfo, y), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
377 378 379 380 381 382 383 | /* * Check that the channel is found in this interpreter and that it is * open for writing. */ psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode); | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | /* * Check that the channel is found in this interpreter and that it is * open for writing. */ psInfo.chan = Tcl_GetChannel(interp, psInfo.channelName, &mode); if (psInfo.chan == NULL) { result = TCL_ERROR; goto cleanup; } if (!(mode & TCL_WRITABLE)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "channel \"%s\" wasn't opened for writing", psInfo.channelName)); |
︙ | ︙ | |||
487 488 489 490 491 492 493 | /* * Insert the prolog */ Tcl_AppendObjToObj(psObj, preambleObj); if (psInfo.chan != NULL) { | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | /* * Insert the prolog */ Tcl_AppendObjToObj(psObj, preambleObj); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { channelWriteFailed: Tcl_SetObjResult(interp, Tcl_ObjPrintf( "problem writing postscript data to channel: %s", Tcl_PosixError(interp))); result = TCL_ERROR; goto cleanup; } |
︙ | ︙ | |||
541 542 543 544 545 546 547 | psInfo.x2, Tk_PostscriptY((double)psInfo.y, (Tk_PostscriptInfo)psInfoPtr), psInfo.x2, Tk_PostscriptY((double)psInfo.y2, (Tk_PostscriptInfo)psInfoPtr), psInfo.x, Tk_PostscriptY((double)psInfo.y2, (Tk_PostscriptInfo)psInfoPtr)); if (psInfo.chan != NULL) { | | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | psInfo.x2, Tk_PostscriptY((double)psInfo.y, (Tk_PostscriptInfo)psInfoPtr), psInfo.x2, Tk_PostscriptY((double)psInfo.y2, (Tk_PostscriptInfo)psInfoPtr), psInfo.x, Tk_PostscriptY((double)psInfo.y2, (Tk_PostscriptInfo)psInfoPtr)); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { goto channelWriteFailed; } Tcl_DecrRefCount(psObj); psObj = Tcl_NewObj(); } } |
︙ | ︙ | |||
583 584 585 586 587 588 589 | } Tcl_AppendToObj(psObj, "gsave\n", -1); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "grestore\n", -1); if (psInfo.chan != NULL) { | | | | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | } Tcl_AppendToObj(psObj, "gsave\n", -1); Tcl_AppendObjToObj(psObj, Tcl_GetObjResult(interp)); Tcl_AppendToObj(psObj, "grestore\n", -1); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { goto channelWriteFailed; } Tcl_DecrRefCount(psObj); psObj = Tcl_NewObj(); } } /* * Output page-end information, such as commands to print the page and * document trailer stuff. */ if (psInfo.prolog) { Tcl_AppendToObj(psObj, "restore showpage\n\n" "%%Trailer\n" "end\n" "%%EOF\n", -1); if (psInfo.chan != NULL) { if (Tcl_WriteObj(psInfo.chan, psObj) == TCL_IO_FAILURE) { goto channelWriteFailed; } } } if (psInfo.chan == NULL) { Tcl_SetObjResult(interp, psObj); |
︙ | ︙ |
Changes to generic/tkCanvText.c.
︙ | ︙ | |||
91 92 93 94 95 96 97 | }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, | | | | | | | | | | | | | | | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(TextItem, activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(TextItem, activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(TextItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_DOUBLE, "-angle", NULL, NULL, "0.0", offsetof(TextItem, angle), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, NULL, offsetof(TextItem, disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(TextItem, disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, "black", offsetof(TextItem, color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_FONT, "-font", NULL, NULL, DEF_CANVTEXT_FONT, offsetof(TextItem, tkfont), 0, NULL}, {TK_CONFIG_JUSTIFY, "-justify", NULL, NULL, "left", offsetof(TextItem, justify), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(TextItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(TextItem, stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_STRING, "-text", NULL, NULL, "", offsetof(TextItem, text), 0, NULL}, {TK_CONFIG_INT, "-underline", NULL, NULL, "-1", offsetof(TextItem, underline), 0, NULL}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, "0", offsetof(TextItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ |
︙ | ︙ | |||
166 167 168 169 170 171 172 173 174 175 176 177 178 179 | Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj); static int TextToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double TextToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int TextToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void TranslateText(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* * The structures below defines the rectangle and oval item types by means of * functions that can be invoked by generic item code. */ | > > | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | Tk_Item *itemPtr, int beforeThis, Tcl_Obj *obj); static int TextToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *rectPtr); static double TextToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static int TextToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static void RotateText(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void TranslateText(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* * The structures below defines the rectangle and oval item types by means of * functions that can be invoked by generic item code. */ |
︙ | ︙ | |||
195 196 197 198 199 200 201 | TranslateText, /* translateProc */ GetTextIndex, /* indexProc */ SetTextCursor, /* icursorProc */ GetSelText, /* selectionProc */ TextInsert, /* insertProc */ TextDeleteChars, /* dTextProc */ NULL, /* nextPtr */ | > | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | TranslateText, /* translateProc */ GetTextIndex, /* indexProc */ SetTextCursor, /* icursorProc */ GetSelText, /* selectionProc */ TextInsert, /* insertProc */ TextDeleteChars, /* dTextProc */ NULL, /* nextPtr */ RotateText, /* rotateProc */ 0, NULL, NULL }; #define ROUND(d) ((int) floor((d) + 0.5)) /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Text item to be modified. */ int index, /* Character index before which string is to * be inserted. */ Tcl_Obj *obj) /* New characters to be inserted. */ { TextItem *textPtr = (TextItem *) itemPtr; | | > | | | 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 | Tk_Canvas canvas, /* Canvas containing text item. */ Tk_Item *itemPtr, /* Text item to be modified. */ int index, /* Character index before which string is to * be inserted. */ Tcl_Obj *obj) /* New characters to be inserted. */ { TextItem *textPtr = (TextItem *) itemPtr; int byteIndex, charsAdded; TkSizeT byteCount; char *newStr, *text; const char *string; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; string = TkGetStringFromObj(obj, &byteCount); text = textPtr->text; if (index < 0) { index = 0; } if (index > textPtr->numChars) { index = textPtr->numChars; } byteIndex = Tcl_UtfAtIndex(text, index) - text; byteCount = strlen(string); if (byteCount == 0) { return; } newStr = ckalloc(textPtr->numBytes + byteCount + 1); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, string); strcpy(newStr + byteIndex + byteCount, text + byteIndex); ckfree(text); textPtr->text = newStr; charsAdded = Tcl_NumUtfChars(string, byteCount); textPtr->numChars += charsAdded; |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 | charsRemoved = last + 1 - first; byteIndex = Tcl_UtfAtIndex(text, first) - text; byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); newStr = ckalloc(textPtr->numBytes + 1 - byteCount); | | | 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 | charsRemoved = last + 1 - first; byteIndex = Tcl_UtfAtIndex(text, first) - text; byteCount = Tcl_UtfAtIndex(text + byteIndex, charsRemoved) - (text + byteIndex); newStr = ckalloc(textPtr->numBytes + 1 - byteCount); memcpy(newStr, text, byteIndex); strcpy(newStr + byteIndex, text + byteIndex + byteCount); ckfree(text); textPtr->text = newStr; textPtr->numChars -= charsRemoved; textPtr->numBytes -= byteCount; |
︙ | ︙ | |||
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 | (int) (rectPtr[3] - rectPtr[1] + 0.5), textPtr->angle); } /* *-------------------------------------------------------------- * * ScaleText -- * * This function is invoked to rescale a text item. * * Results: * None. * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 | (int) (rectPtr[3] - rectPtr[1] + 0.5), textPtr->angle); } /* *-------------------------------------------------------------- * * RotateText -- * * This function is called to rotate a text item by a given amount about a * point. Note that this does *not* rotate the text of the item. * * Results: * None. * * Side effects: * The position of the text anchor is rotated by angleRad about (originX, * originY), and the bounding box is updated in the generic part of the * item structure. * *-------------------------------------------------------------- */ static void RotateText( Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being rotated. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { TextItem *textPtr = (TextItem *) itemPtr; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &textPtr->x, &textPtr->y); ComputeTextBbox(canvas, textPtr); } /* *-------------------------------------------------------------- * * ScaleText -- * * This function is invoked to rescale a text item. * * Results: * None. * |
︙ | ︙ | |||
1339 1340 1341 1342 1343 1344 1345 | * specified. */ Tcl_Obj *obj, /* Specification of a particular character in * itemPtr's text. */ int *indexPtr) /* Where to store converted character * index. */ { TextItem *textPtr = (TextItem *) itemPtr; | | | | | | | | 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | * specified. */ Tcl_Obj *obj, /* Specification of a particular character in * itemPtr's text. */ int *indexPtr) /* Where to store converted character * index. */ { TextItem *textPtr = (TextItem *) itemPtr; TkSizeT length; int c; TkCanvas *canvasPtr = (TkCanvas *) canvas; Tk_CanvasTextInfo *textInfoPtr = textPtr->textInfoPtr; const char *string = TkGetStringFromObj(obj, &length); c = string[0]; if ((c == 'e') && (strncmp(string, "end", length) == 0)) { *indexPtr = textPtr->numChars; } else if ((c == 'i') && (strncmp(string, "insert", length) == 0)) { *indexPtr = textPtr->insertPos; } else if ((c == 's') && (length >= 5) && (strncmp(string, "sel.first", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", NULL); return TCL_ERROR; } *indexPtr = textInfoPtr->selectFirst; } else if ((c == 's') && (length >= 5) && (strncmp(string, "sel.last", length) == 0)) { if (textInfoPtr->selItemPtr != itemPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "selection isn't in item", -1)); Tcl_SetErrorCode(interp, "TK", "CANVAS", "UNSELECTED", NULL); return TCL_ERROR; } *indexPtr = textInfoPtr->selectLast; |
︙ | ︙ | |||
1500 1501 1502 1503 1504 1505 1506 | byteCount = selEnd - selStart - offset; if (byteCount > maxBytes) { byteCount = maxBytes; } if (byteCount <= 0) { return 0; } | | | 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 | byteCount = selEnd - selStart - offset; if (byteCount > maxBytes) { byteCount = maxBytes; } if (byteCount <= 0) { return 0; } memcpy(buffer, selStart + offset, byteCount); buffer[byteCount] = '\0'; return byteCount; } /* *-------------------------------------------------------------- * |
︙ | ︙ |
Changes to generic/tkCanvUtil.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" | < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkCanvas.h" /* * Structures defined only in this file. */ typedef struct SmoothAssocData { struct SmoothAssocData *nextPtr; |
︙ | ︙ | |||
1261 1262 1263 1264 1265 1266 1267 | Tk_CanvasSetOffset(canvas, outline->gc, tsoffset); tsoffset->xoffset += w; tsoffset->yoffset += h; return 1; } return 0; } | < | 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | Tk_CanvasSetOffset(canvas, outline->gc, tsoffset); tsoffset->xoffset += w; tsoffset->yoffset += h; return 1; } return 0; } /* *-------------------------------------------------------------- * * Tk_ResetOutlineGC * * Restores the GC to the situation before Tk_ChangeOutlineGC() was |
︙ | ︙ | |||
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 | TranslateAndAppendCoords(canvPtr, a[i*2], a[i*2+1], outArr, i); } if (tempArr != staticSpace) { ckfree(tempArr); } return numOutput; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 | TranslateAndAppendCoords(canvPtr, a[i*2], a[i*2+1], outArr, i); } if (tempArr != staticSpace) { ckfree(tempArr); } return numOutput; } /* *-------------------------------------------------------------- * * TkRotatePoint -- * * Rotate a point about another point. The angle should be converted into * its sine and cosine before calling this function. * * Results: * None * * Side effects: * The point in (*xPtr,*yPtr) is updated to be rotated about * (originX,originY) by the amount given by the sine and cosine of the * angle to rotate. * *-------------------------------------------------------------- */ void TkRotatePoint( double originX, double originY, /* The point about which to rotate. */ double sine, double cosine, /* How much to rotate? */ double *xPtr, double *yPtr) /* The point to be rotated. (INOUT) */ { double x = *xPtr - originX; double y = *yPtr - originY; /* * Beware! The canvas coordinate space is flipped vertically, so rotations * go the "wrong" way with respect to mathematics. */ *xPtr = originX + x * cosine + y * sine; *yPtr = originY - x * sine + y * cosine; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkCanvWind.c.
︙ | ︙ | |||
42 43 44 45 46 47 48 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, | | | | | | > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | }; static const Tk_CustomOption tagsOption = { Tk_CanvasTagsParseProc, Tk_CanvasTagsPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_ANCHOR, "-anchor", NULL, NULL, "center", offsetof(WindowItem, anchor), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_PIXELS, "-height", NULL, NULL, "0", offsetof(WindowItem, height), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state), TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_PIXELS, "-width", NULL, NULL, "0", offsetof(WindowItem, width), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_WINDOW, "-window", NULL, NULL, NULL, offsetof(WindowItem, tkwin), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ static void ComputeWindowBbox(Tk_Canvas canvas, WindowItem *winItemPtr); static int ConfigureWinItem(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[], int flags); static int CreateWinItem(Tcl_Interp *interp, Tk_Canvas canvas, struct Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static void DeleteWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display); static void DisplayWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, Display *display, Drawable dst, int x, int y, int width, int height); static void RotateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateWinItem(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); static int WinItemCoords(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int objc, |
︙ | ︙ | |||
126 127 128 129 130 131 132 | TranslateWinItem, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | TranslateWinItem, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateWinItem, /* rotateProc */ 0, NULL, NULL }; /* * The structure below defines the official type record for the canvas (as * geometry manager): */ |
︙ | ︙ | |||
907 908 909 910 911 912 913 914 915 916 917 918 919 920 | Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj); } else { Tcl_DiscardInterpState(interpState); } Tcl_DecrRefCount(psObj); return result; } /* *-------------------------------------------------------------- * * ScaleWinItem -- * * This function is invoked to rescale a window item. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | Tcl_AppendObjToObj(Tcl_GetObjResult(interp), psObj); } else { Tcl_DiscardInterpState(interpState); } Tcl_DecrRefCount(psObj); return result; } /* *-------------------------------------------------------------- * * RotateWinItem -- * * This function is called to rotate a window item by a given amount * about a point. Note that this does *not* rotate the window of the * item. * * Results: * None. * * Side effects: * The position of the window anchor is rotated by angleRad about (originX, * originY), and the bounding box is updated in the generic part of the * item structure. * *-------------------------------------------------------------- */ static void RotateWinItem( Tk_Canvas canvas, /* Canvas containing item. */ Tk_Item *itemPtr, /* Item that is being rotated. */ double originX, double originY, double angleRad) /* Amount by which item is to be rotated. */ { WindowItem *winItemPtr = (WindowItem *) itemPtr; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &winItemPtr->x, &winItemPtr->y); ComputeWindowBbox(canvas, winItemPtr); } /* *-------------------------------------------------------------- * * ScaleWinItem -- * * This function is invoked to rescale a window item. |
︙ | ︙ |
Changes to generic/tkCanvas.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * 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. */ | < < | | | < < < < < < < < < < < < < < < < < < < < | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * 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. */ #include "tkInt.h" #include "tkCanvas.h" #include "default.h" #ifdef TK_NO_DOUBLE_BUFFERING #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" #endif #endif /* TK_NO_DOUBLE_BUFFERING */ /* * See tkCanvas.h for key data structures used to implement canvases. */ /* * The structure defined below is used to keep track of a tag search in * progress. No field should be accessed by anyone other than TagSearchScan, * TagSearchFirst, TagSearchNext, TagSearchScanExpr, TagSearchEvalExpr, * TagSearchExprInit, TagSearchExprDestroy, TagSearchDestroy. * ( * Not quite accurate: the TagSearch structure is also accessed from: |
︙ | ︙ | |||
90 91 92 93 94 95 96 | #define SEARCH_TYPE_EMPTY 0 /* Looking for empty tag */ #define SEARCH_TYPE_ID 1 /* Looking for an item by id */ #define SEARCH_TYPE_ALL 2 /* Looking for all items */ #define SEARCH_TYPE_TAG 3 /* Looking for an item by simple tag */ #define SEARCH_TYPE_EXPR 4 /* Compound search */ | < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | #define SEARCH_TYPE_EMPTY 0 /* Looking for empty tag */ #define SEARCH_TYPE_ID 1 /* Looking for an item by id */ #define SEARCH_TYPE_ALL 2 /* Looking for all items */ #define SEARCH_TYPE_TAG 3 /* Looking for an item by simple tag */ #define SEARCH_TYPE_EXPR 4 /* Compound search */ /* * Custom option for handling "-state" and "-offset" */ static const Tk_CustomOption stateOption = { TkStateParseProc, TkStatePrintProc, NULL /* Only "normal" and "disabled". */ }; static const Tk_CustomOption offsetOption = { TkOffsetParseProc, TkOffsetPrintProc, INT2PTR(TK_OFFSET_RELATIVE) }; /* * Information used for argv parsing. */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-background", "background", "Background", DEF_CANVAS_BG_COLOR, offsetof(TkCanvas, bgBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", DEF_CANVAS_BG_MONO, offsetof(TkCanvas, bgBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_CANVAS_BORDER_WIDTH, offsetof(TkCanvas, borderWidth), 0, NULL}, {TK_CONFIG_DOUBLE, "-closeenough", "closeEnough", "CloseEnough", DEF_CANVAS_CLOSE_ENOUGH, offsetof(TkCanvas, closeEnough), 0, NULL}, {TK_CONFIG_BOOLEAN, "-confine", "confine", "Confine", DEF_CANVAS_CONFINE, offsetof(TkCanvas, confine), 0, NULL}, {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", DEF_CANVAS_CURSOR, offsetof(TkCanvas, cursor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-height", "height", "Height", DEF_CANVAS_HEIGHT, offsetof(TkCanvas, height), 0, NULL}, {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_CANVAS_HIGHLIGHT_BG, offsetof(TkCanvas, highlightBgColorPtr), 0, NULL}, {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_CANVAS_HIGHLIGHT, offsetof(TkCanvas, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_CANVAS_HIGHLIGHT_WIDTH, offsetof(TkCanvas, highlightWidth), 0, NULL}, {TK_CONFIG_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_CANVAS_INSERT_BG, offsetof(TkCanvas, textInfo.insertBorder), 0, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_COLOR, offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_CANVAS_INSERT_BD_MONO, offsetof(TkCanvas, textInfo.insertBorderWidth), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_CANVAS_INSERT_OFF_TIME, offsetof(TkCanvas, insertOffTime), 0, NULL}, {TK_CONFIG_INT, "-insertontime", "insertOnTime", "OnTime", DEF_CANVAS_INSERT_ON_TIME, offsetof(TkCanvas, insertOnTime), 0, NULL}, {TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_CANVAS_INSERT_WIDTH, offsetof(TkCanvas, textInfo.insertWidth), 0, NULL}, {TK_CONFIG_CUSTOM, "-offset", "offset", "Offset", "0,0", offsetof(TkCanvas, tsoffset),TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_CANVAS_RELIEF, offsetof(TkCanvas, relief), 0, NULL}, {TK_CONFIG_STRING, "-scrollregion", "scrollRegion", "ScrollRegion", DEF_CANVAS_SCROLL_REGION, offsetof(TkCanvas, regionString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_CANVAS_SELECT_COLOR, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_CANVAS_SELECT_MONO, offsetof(TkCanvas, textInfo.selBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_CANVAS_SELECT_BD_COLOR, offsetof(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_CANVAS_SELECT_BD_MONO, offsetof(TkCanvas, textInfo.selBorderWidth), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_COLOR, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_COLOR_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-selectforeground", "selectForeground", "Background", DEF_CANVAS_SELECT_FG_MONO, offsetof(TkCanvas, textInfo.selFgColorPtr), TK_CONFIG_MONO_ONLY|TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", "state", "State", "normal", offsetof(TkCanvas, canvas_state), TK_CONFIG_DONT_SET_DEFAULT, &stateOption}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_CANVAS_TAKE_FOCUS, offsetof(TkCanvas, takeFocus), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", DEF_CANVAS_WIDTH, offsetof(TkCanvas, width), 0, NULL}, {TK_CONFIG_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_CANVAS_X_SCROLL_CMD, offsetof(TkCanvas, xScrollCmd), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-xscrollincrement", "xScrollIncrement", "ScrollIncrement", DEF_CANVAS_X_SCROLL_INCREMENT, offsetof(TkCanvas, xScrollIncrement), 0, NULL}, {TK_CONFIG_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", DEF_CANVAS_Y_SCROLL_CMD, offsetof(TkCanvas, yScrollCmd), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-yscrollincrement", "yScrollIncrement", "ScrollIncrement", DEF_CANVAS_Y_SCROLL_INCREMENT, offsetof(TkCanvas, yScrollIncrement), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * List of all the item types known at present. This is *global* and is * protected by typeListMutex. */ static Tk_ItemType *typeList = NULL; /* NULL means initialization hasn't been done * yet. */ TCL_DECLARE_MUTEX(typeListMutex) /* * Uids for operands in compiled advanced tag search expressions. * Initialization is done by GetStaticUids() */ typedef struct { Tk_Uid allUid; Tk_Uid currentUid; Tk_Uid andUid; Tk_Uid orUid; Tk_Uid xorUid; Tk_Uid parenUid; Tk_Uid negparenUid; Tk_Uid endparenUid; Tk_Uid tagvalUid; Tk_Uid negtagvalUid; } SearchUids; static Tcl_ThreadDataKey dataKey; static SearchUids * GetStaticUids(void); /* * Prototypes for functions defined later in this file: */ static void CanvasBindProc(ClientData clientData, XEvent *eventPtr); |
︙ | ︙ | |||
263 264 265 266 267 268 269 | static int CanvasWidgetCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const *argv); static void CanvasWorldChanged(ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, int flags); | > > > | > < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | static int CanvasWidgetCmd(ClientData clientData, Tcl_Interp *interp, int argc, Tcl_Obj *const *argv); static void CanvasWorldChanged(ClientData instanceData); static int ConfigureCanvas(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, int flags); static void DefaultRotateImplementation(TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians); static void DestroyCanvas(void *memPtr); static int DrawCanvas(Tcl_Interp *interp, ClientData clientData, Tk_PhotoHandle photohandle, int subsample, int zoom); static void DisplayCanvas(ClientData clientData); static void DoItem(Tcl_Obj *accumObj, Tk_Item *itemPtr, Tk_Uid tag); static void EventuallyRedrawItem(TkCanvas *canvasPtr, Tk_Item *itemPtr); static int FindItems(Tcl_Interp *interp, TkCanvas *canvasPtr, int argc, Tcl_Obj *const *argv, Tcl_Obj *newTagObj, int first, TagSearch **searchPtrPtr); static int FindArea(Tcl_Interp *interp, TkCanvas *canvasPtr, Tcl_Obj *const *argv, Tk_Uid uid, int enclosed); static double GridAlign(double coord, double spacing); static const char** TkGetStringsFromObjs(int argc, Tcl_Obj *const *objv); static void InitCanvas(void); static void PickCurrentItem(TkCanvas *canvasPtr, XEvent *eventPtr); static Tcl_Obj * ScrollFractions(int screen1, int screen2, int object1, int object2); static int RelinkItems(TkCanvas *canvasPtr, Tcl_Obj *tag, Tk_Item *prevPtr, TagSearch **searchPtrPtr); static void TagSearchExprInit(TagSearchExpr **exprPtrPtr); static void TagSearchExprDestroy(TagSearchExpr *expr); static void TagSearchDestroy(TagSearch *searchPtr); static int TagSearchScan(TkCanvas *canvasPtr, Tcl_Obj *tag, TagSearch **searchPtrPtr); static int TagSearchScanExpr(Tcl_Interp *interp, TagSearch *searchPtr, TagSearchExpr *expr); static int TagSearchEvalExpr(TagSearchExpr *expr, Tk_Item *itemPtr); static Tk_Item * TagSearchFirst(TagSearch *searchPtr); static Tk_Item * TagSearchNext(TagSearch *searchPtr); /* * The structure below defines canvas class behavior by means of functions * that can be invoked from generic window code. */ static const Tk_ClassProcs canvasClass = { sizeof(Tk_ClassProcs), /* size */ CanvasWorldChanged, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* * Macros that significantly simplify all code that finds items. */ #define FIRST_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \ if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \ errorExitClause; \ } \ itemPtr = TagSearchFirst(*(searchPtrPtr)); #define FOR_EVERY_CANVAS_ITEM_MATCHING(objPtr,searchPtrPtr,errorExitClause) \ if ((result=TagSearchScan(canvasPtr,(objPtr),(searchPtrPtr))) != TCL_OK){ \ errorExitClause; \ } \ for (itemPtr = TagSearchFirst(*(searchPtrPtr)); \ itemPtr != NULL; itemPtr = TagSearchNext(*(searchPtrPtr))) #define FIND_ITEMS(objPtr, n) \ FindItems(interp, canvasPtr, objc, objv, (objPtr), (n), &searchPtr) #define RELINK_ITEMS(objPtr, itemPtr) \ result = RelinkItems(canvasPtr, (objPtr), (itemPtr), &searchPtr) /* * ---------------------------------------------------------------------- * * AlwaysRedraw, ItemConfigure, ItemCoords, etc. -- * * Helper functions that make access to canvas item functions simpler. |
︙ | ︙ | |||
609 610 611 612 613 614 615 616 617 618 619 620 621 622 | Tk_Item *itemPtr, double xDelta, double yDelta) { itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr, itemPtr, xDelta, yDelta); } /* *-------------------------------------------------------------- * * Tk_CanvasObjCmd -- * * This function is invoked to process the "canvas" Tcl command. See the | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | Tk_Item *itemPtr, double xDelta, double yDelta) { itemPtr->typePtr->translateProc((Tk_Canvas) canvasPtr, itemPtr, xDelta, yDelta); } static inline void ItemRotate( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { if (itemPtr->typePtr->rotateProc != NULL) { itemPtr->typePtr->rotateProc((Tk_Canvas) canvasPtr, itemPtr, x, y, angleRadians); } else { DefaultRotateImplementation(canvasPtr, itemPtr, x, y, angleRadians); } } /* *-------------------------------------------------------------- * * DefaultRotateImplementation -- * * The default implementation of the rotation operation, used when items * do not provide their own version. * *-------------------------------------------------------------- */ static void DefaultRotateImplementation( TkCanvas *canvasPtr, Tk_Item *itemPtr, double x, double y, double angleRadians) { int objc, i, ok = 1; Tcl_Obj **objv, **newObjv; double *coordv; double s = sin(angleRadians); double c = cos(angleRadians); Tcl_Interp *interp = canvasPtr->interp; /* * Get the coordinates out of the item. */ if (ItemCoords(canvasPtr, itemPtr, 0, NULL) == TCL_OK && Tcl_ListObjGetElements(NULL, Tcl_GetObjResult(interp), &objc, &objv) == TCL_OK) { coordv = (double *) ckalloc(sizeof(double) * objc); for (i=0 ; i<objc ; i++) { if (Tcl_GetDoubleFromObj(NULL, objv[i], &coordv[i]) != TCL_OK) { ok = 0; break; } } if (ok) { /* * Apply the rotation. */ for (i=0 ; i<objc ; i+=2) { double px = coordv[i+0] - x; double py = coordv[i+1] - y; double nx = px * c - py * s; double ny = px * s + py * c; coordv[i+0] = nx + x; coordv[i+1] = ny + y; } /* * Write the coordinates back into the item. */ newObjv = (Tcl_Obj **) ckalloc(sizeof(Tcl_Obj *) * objc); for (i=0 ; i<objc ; i++) { newObjv[i] = Tcl_NewDoubleObj(coordv[i]); Tcl_IncrRefCount(newObjv[i]); } ItemCoords(canvasPtr, itemPtr, objc, newObjv); for (i=0 ; i<objc ; i++) { Tcl_DecrRefCount(newObjv[i]); } ckfree((char *) newObjv); } ckfree((char *) coordv); } /* * The interpreter result was (probably) modified above; reset it. */ Tcl_ResetResult(interp); } /* *-------------------------------------------------------------- * * Tk_CanvasObjCmd -- * * This function is invoked to process the "canvas" Tcl command. See the |
︙ | ︙ | |||
694 695 696 697 698 699 700 | canvasPtr->textInfo.insertWidth = 0; canvasPtr->textInfo.insertBorderWidth = 0; canvasPtr->textInfo.focusItemPtr = NULL; canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertOnTime = 0; canvasPtr->insertOffTime = 0; | | | 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 | canvasPtr->textInfo.insertWidth = 0; canvasPtr->textInfo.insertBorderWidth = 0; canvasPtr->textInfo.focusItemPtr = NULL; canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertOnTime = 0; canvasPtr->insertOffTime = 0; canvasPtr->insertBlinkHandler = NULL; canvasPtr->xOrigin = canvasPtr->yOrigin = 0; canvasPtr->drawableXOrigin = canvasPtr->drawableYOrigin = 0; canvasPtr->bindingTable = NULL; canvasPtr->currentItemPtr = NULL; canvasPtr->newCurrentPtr = NULL; canvasPtr->closeEnough = 0.0; canvasPtr->pickEvent.type = LeaveNotify; |
︙ | ︙ | |||
731 732 733 734 735 736 737 | canvasPtr->flags = 0; canvasPtr->nextId = 1; canvasPtr->psInfo = NULL; canvasPtr->canvas_state = TK_STATE_NORMAL; canvasPtr->tsoffset.flags = 0; canvasPtr->tsoffset.xoffset = 0; canvasPtr->tsoffset.yoffset = 0; | < < | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | canvasPtr->flags = 0; canvasPtr->nextId = 1; canvasPtr->psInfo = NULL; canvasPtr->canvas_state = TK_STATE_NORMAL; canvasPtr->tsoffset.flags = 0; canvasPtr->tsoffset.xoffset = 0; canvasPtr->tsoffset.yoffset = 0; canvasPtr->bindTagExprs = NULL; Tcl_InitHashTable(&canvasPtr->idTable, TCL_ONE_WORD_KEYS); Tk_SetClass(canvasPtr->tkwin, "Canvas"); Tk_SetClassProcs(canvasPtr->tkwin, &canvasClass, canvasPtr); Tk_CreateEventHandler(canvasPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, CanvasEventProc, canvasPtr); |
︙ | ︙ | |||
788 789 790 791 792 793 794 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkCanvas *canvasPtr = clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ | < < < < | | | | | | | | | > | 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { TkCanvas *canvasPtr = clientData; int c, result; Tk_Item *itemPtr = NULL; /* Initialization needed only to prevent * compiler warning. */ TagSearch *searchPtr = NULL;/* Allocated by first TagSearchScan, freed by * TagSearchDestroy */ int index; static const char *const optionStrings[] = { "addtag", "bbox", "bind", "canvasx", "canvasy", "cget", "configure", "coords", "create", "dchars", "delete", "dtag", "find", "focus", "gettags", "icursor", "image", "imove", "index", "insert", "itemcget", "itemconfigure", "lower", "move", "moveto", "postscript", "raise", "rchars", "rotate", "scale", "scan", "select", "type", "xview", "yview", NULL }; enum options { CANV_ADDTAG, CANV_BBOX, CANV_BIND, CANV_CANVASX, CANV_CANVASY, CANV_CGET, CANV_CONFIGURE, CANV_COORDS, CANV_CREATE, CANV_DCHARS, CANV_DELETE, CANV_DTAG, CANV_FIND, CANV_FOCUS, CANV_GETTAGS, CANV_ICURSOR, CANV_IMAGE, CANV_IMOVE, CANV_INDEX, CANV_INSERT, CANV_ITEMCGET, CANV_ITEMCONFIGURE, CANV_LOWER, CANV_MOVE, CANV_MOVETO, CANV_POSTSCRIPT, CANV_RAISE, CANV_RCHARS, CANV_ROTATE, CANV_SCALE, CANV_SCAN, CANV_SELECT, CANV_TYPE, CANV_XVIEW, CANV_YVIEW }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, |
︙ | ︙ | |||
884 885 886 887 888 889 890 | } } } } if (gotAny) { Tcl_Obj *resultObjs[4]; | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 | } } } } if (gotAny) { Tcl_Obj *resultObjs[4]; resultObjs[0] = Tcl_NewWideIntObj(x1); resultObjs[1] = Tcl_NewWideIntObj(y1); resultObjs[2] = Tcl_NewWideIntObj(x2); resultObjs[3] = Tcl_NewWideIntObj(y2); Tcl_SetObjResult(interp, Tcl_NewListObj(4, resultObjs)); } break; } case CANV_BIND: { void *object; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId ?sequence? ?command?"); result = TCL_ERROR; goto done; } /* * Figure out what object to use for the binding (individual item vs. * tag). */ object = NULL; result = TagSearchScan(canvasPtr, objv[2], &searchPtr); if (result != TCL_OK) { goto done; } if (searchPtr->type == SEARCH_TYPE_ID) { Tcl_HashEntry *entryPtr; entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { itemPtr = Tcl_GetHashValue(entryPtr); object = itemPtr; } if (object == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "item \"%s\" doesn't exist", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "CANVAS_ITEM", Tcl_GetString(objv[2]), NULL); result = TCL_ERROR; goto done; } } else { object = (char *)searchPtr->expr->uid; } /* * Make a binding table if the canvas doesn't already have one. */ if (canvasPtr->bindingTable == NULL) { canvasPtr->bindingTable = Tk_CreateBindingTable(interp); } if (objc == 5) { int append = 0; unsigned long mask; const char *argv4 = Tcl_GetString(objv[4]); if (argv4[0] == 0) { result = Tk_DeleteBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3])); goto done; } if (searchPtr->type == SEARCH_TYPE_EXPR) { /* * If new tag expression, then insert in linked list. */ TagSearchExpr *expr, **lastPtr; |
︙ | ︙ | |||
1012 1013 1014 1015 1016 1017 1018 | * Flag in TagSearch that expr has changed ownership so * that TagSearchDestroy doesn't try to free it. */ searchPtr->expr = NULL; } } | < | | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | * Flag in TagSearch that expr has changed ownership so * that TagSearchDestroy doesn't try to free it. */ searchPtr->expr = NULL; } } if (argv4[0] == '+') { argv4++; append = 1; } mask = Tk_CreateBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3]), argv4, append); if (mask == 0) { result = TCL_ERROR; goto done; } if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) { Tk_DeleteBinding(interp, canvasPtr->bindingTable, object, Tcl_GetString(objv[3])); Tcl_SetObjResult(interp, Tcl_NewStringObj( |
︙ | ︙ | |||
1238 1239 1240 1241 1242 1243 1244 | case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; | | | < | 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 | case CANV_CREATE: { Tk_ItemType *typePtr; Tk_ItemType *matchPtr = NULL; Tk_Item *itemPtr; int isNew = 0; Tcl_HashEntry *entryPtr; const char *arg; TkSizeT length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "type coords ?arg ...?"); result = TCL_ERROR; goto done; } arg = TkGetStringFromObj(objv[2], &length); c = arg[0]; /* * Lock because the list of types is a global resource that could be * updated by another thread. That's fairly unlikely, but not * impossible. */ |
︙ | ︙ | |||
1311 1312 1313 1314 1315 1316 1317 | ckfree(itemPtr); result = TCL_ERROR; goto done; } itemPtr->nextPtr = NULL; entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable, | | | | 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 | ckfree(itemPtr); result = TCL_ERROR; goto done; } itemPtr->nextPtr = NULL; entryPtr = Tcl_CreateHashEntry(&canvasPtr->idTable, INT2PTR(itemPtr->id), &isNew); Tcl_SetHashValue(entryPtr, itemPtr); itemPtr->prevPtr = canvasPtr->lastItemPtr; canvasPtr->hotPtr = itemPtr; canvasPtr->hotPrevPtr = canvasPtr->lastItemPtr; if (canvasPtr->lastItemPtr == NULL) { canvasPtr->firstItemPtr = itemPtr; } else { canvasPtr->lastItemPtr->nextPtr = itemPtr; } canvasPtr->lastItemPtr = itemPtr; itemPtr->redraw_flags |= FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); break; } case CANV_DCHARS: { int first, last; int x1, x2, y1, y2; if ((objc != 4) && (objc != 5)) { |
︙ | ︙ | |||
1390 1391 1392 1393 1394 1395 1396 | Tk_DeleteAllBindings(canvasPtr->bindingTable, itemPtr); } ItemDelete(canvasPtr, itemPtr); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { ckfree(itemPtr->tagPtr); } entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, | | | 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 | Tk_DeleteAllBindings(canvasPtr->bindingTable, itemPtr); } ItemDelete(canvasPtr, itemPtr); if (itemPtr->tagPtr != itemPtr->staticTagSpace) { ckfree(itemPtr->tagPtr); } entryPtr = Tcl_FindHashEntry(&canvasPtr->idTable, INT2PTR(itemPtr->id)); Tcl_DeleteHashEntry(entryPtr); if (itemPtr->nextPtr != NULL) { itemPtr->nextPtr->prevPtr = itemPtr->prevPtr; } if (itemPtr->prevPtr != NULL) { itemPtr->prevPtr->nextPtr = itemPtr->nextPtr; } |
︙ | ︙ | |||
1471 1472 1473 1474 1475 1476 1477 | Tcl_WrongNumArgs(interp, 2, objv, "?tagOrId?"); result = TCL_ERROR; goto done; } itemPtr = canvasPtr->textInfo.focusItemPtr; if (objc == 2) { if (itemPtr != NULL) { | | | 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | Tcl_WrongNumArgs(interp, 2, objv, "?tagOrId?"); result = TCL_ERROR; goto done; } itemPtr = canvasPtr->textInfo.focusItemPtr; if (objc == 2) { if (itemPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(itemPtr->id)); } goto done; } if (canvasPtr->textInfo.gotFocus) { EventuallyRedrawItem(canvasPtr, itemPtr); } if (Tcl_GetString(objv[2])[0] == 0) { |
︙ | ︙ | |||
1563 1564 1565 1566 1567 1568 1569 | result = TCL_ERROR; goto done; } result = ItemIndex(canvasPtr, itemPtr, objv[3], &index); if (result != TCL_OK) { goto done; } | | | 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 | result = TCL_ERROR; goto done; } result = ItemIndex(canvasPtr, itemPtr, objv[3], &index); if (result != TCL_OK) { goto done; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } case CANV_INSERT: { int beforeThis; int x1, x2, y1, y2; if (objc != 5) { |
︙ | ︙ | |||
1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 | if (!(dontRedraw1 && dontRedraw2)) { Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, x1, y1, x2, y2); EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } break; } case CANV_SCALE: { double xOrigin, yOrigin, xScale, yScale; if (objc != 7) { Tcl_WrongNumArgs(interp, 2, objv, | > > > > > > > > > > > > > > > > > > > > > > > > | 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 | if (!(dontRedraw1 && dontRedraw2)) { Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, x1, y1, x2, y2); EventuallyRedrawItem(canvasPtr, itemPtr); } itemPtr->redraw_flags &= ~TK_ITEM_DONT_REDRAW; } break; } case CANV_ROTATE: { double x, y, angle; Tk_Canvas canvas = (Tk_Canvas) canvasPtr; if (objc != 6) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId x y angle"); result = TCL_ERROR; goto done; } if (Tk_CanvasGetCoordFromObj(interp, canvas, objv[3], &x) != TCL_OK || Tk_CanvasGetCoordFromObj(interp, canvas, objv[4], &y) != TCL_OK || Tcl_GetDoubleFromObj(interp, objv[5], &angle) != TCL_OK) { result = TCL_ERROR; goto done; } angle = angle * 3.1415927 / 180.0; FOR_EVERY_CANVAS_ITEM_MATCHING(objv[2], &searchPtr, goto done) { EventuallyRedrawItem(canvasPtr, itemPtr); ItemRotate(canvasPtr, itemPtr, x, y, angle); EventuallyRedrawItem(canvasPtr, itemPtr); canvasPtr->flags |= REPICK_NEEDED; } break; } case CANV_SCALE: { double xOrigin, yOrigin, xScale, yScale; if (objc != 7) { Tcl_WrongNumArgs(interp, 2, objv, |
︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); result = TCL_ERROR; goto done; } if (canvasPtr->textInfo.selItemPtr != NULL) { Tcl_SetObjResult(interp, | | | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); result = TCL_ERROR; goto done; } if (canvasPtr->textInfo.selItemPtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(canvasPtr->textInfo.selItemPtr->id)); } break; case CANV_TO: if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "tagOrId index"); result = TCL_ERROR; goto done; |
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; } CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY); break; } | > > > | > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 | * (Tk_Height(canvasPtr->tkwin) - 2*canvasPtr->inset)); } break; } CanvasSetOrigin(canvasPtr, canvasPtr->xOrigin, newY); break; } case CANV_IMAGE: { Tk_PhotoHandle photohandle; int subsample = 1, zoom = 1; if (objc < 3 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "imagename ?subsample? ?zoom?"); result = TCL_ERROR; goto done; } if ((photohandle = Tk_FindPhoto(interp, Tcl_GetString(objv[2]) )) == 0) { result = TCL_ERROR; goto done; } /* * If we are given a subsample or a zoom then grab them. */ if (objc >= 4 && Tcl_GetIntFromObj(interp, objv[3], &subsample) != TCL_OK) { result = TCL_ERROR; goto done; } if (objc >= 5 && Tcl_GetIntFromObj(interp, objv[4], &zoom) != TCL_OK) { result = TCL_ERROR; goto done; } /* * Set the image size to zero, which allows the DrawCanvas() function * to expand the image automatically when it copies the pixmap into it. */ if (Tk_PhotoSetSize(interp, photohandle, 0, 0) != TCL_OK) { result = TCL_ERROR; goto done; } result = DrawCanvas(interp, clientData, photohandle, subsample, zoom); } } done: TagSearchDestroy(searchPtr); Tcl_Release(canvasPtr); return result; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2157 2158 2159 2160 2161 2162 2163 | * Everything associated with the canvas is freed up. * *---------------------------------------------------------------------- */ static void DestroyCanvas( | | | < < | 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 | * Everything associated with the canvas is freed up. * *---------------------------------------------------------------------- */ static void DestroyCanvas( void *memPtr) /* Info about canvas widget. */ { TkCanvas *canvasPtr = memPtr; Tk_Item *itemPtr; TagSearchExpr *expr, *next; /* * Free up all of the items in the canvas. */ for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; itemPtr = canvasPtr->firstItemPtr) { |
︙ | ︙ | |||
2188 2189 2190 2191 2192 2193 2194 | * Tk_FreeOptions handle all the standard option-related stuff. */ Tcl_DeleteHashTable(&canvasPtr->idTable); if (canvasPtr->pixmapGC != NULL) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } | < < | 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 | * Tk_FreeOptions handle all the standard option-related stuff. */ Tcl_DeleteHashTable(&canvasPtr->idTable); if (canvasPtr->pixmapGC != NULL) { Tk_FreeGC(canvasPtr->display, canvasPtr->pixmapGC); } expr = canvasPtr->bindTagExprs; while (expr) { next = expr->next; TagSearchExprDestroy(expr); expr = next; } Tcl_DeleteTimerHandler(canvasPtr->insertBlinkHandler); if (canvasPtr->bindingTable != NULL) { Tk_DeleteBindingTable(canvasPtr->bindingTable); } Tk_FreeOptions(configSpecs, (char *) canvasPtr, canvasPtr->display, 0); canvasPtr->tkwin = NULL; ckfree(canvasPtr); |
︙ | ︙ | |||
2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 | canvasPtr->flags |= REPICK_NEEDED; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } /* *---------------------------------------------------------------------- * * DisplayCanvas -- * * This function redraws the contents of a canvas window. It is invoked * as a do-when-idle handler, so it only runs when there's nothing else | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 | canvasPtr->flags |= REPICK_NEEDED; Tk_CanvasEventuallyRedraw((Tk_Canvas) canvasPtr, canvasPtr->xOrigin, canvasPtr->yOrigin, canvasPtr->xOrigin + Tk_Width(canvasPtr->tkwin), canvasPtr->yOrigin + Tk_Height(canvasPtr->tkwin)); } /* *---------------------------------------------------------------------- * * DecomposeMaskToShiftAndBits -- * * Given a 32 bit pixel mask, we find the position of the lowest bit and the * width of the mask bits. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ static void DecomposeMaskToShiftAndBits( unsigned long mask, /* The pixel mask to examine */ int *shift, /* Where to put the shift count (position of lowest bit) */ int *bits) /* Where to put the bit count (width of the pixel mask) */ { int i; *shift = 0; *bits = 0; /* * Find the lowest '1' bit in the mask. */ for (i = 0; i < 32; ++i) { if (mask & 1 << i) break; } if (i < 32) { *shift = i; /* * Now find the next '0' bit and the width of the mask. */ for ( ; i < 32; ++i) { if ((mask & 1 << i) == 0) break; else ++*bits; } /* * Limit to the top 8 bits if the mask was wider than 8. */ if (*bits > 8) { *shift += *bits - 8; *bits = 8; } } } /* *---------------------------------------------------------------------- * * DrawCanvas -- * * This function draws the contents of a canvas into the given Photo image. * This function is called from the widget "image" subcommand. * The canvas does not need to be mapped (one of it's ancestors must be) * in order for this function to work. * * Results: * None. * * Side effects: * Canvas contents from within the -scrollregion or widget size are rendered * into the Photo. Any errors are left in the result. * *---------------------------------------------------------------------- */ #define OVERDRAW_PIXELS 32 /* How much larger we make the pixmap * that the canvas objects are drawn into */ /* From stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine */ #define IS_BIG_ENDIAN (*(unsigned short *)"\0\xff" < 0x100) #define BYTE_SWAP16(n) ((((unsigned short)n)>>8) | (((unsigned short)n)<<8)) #define BYTE_SWAP32(n) (((n>>24)&0x000000FF) | ((n<<8)&0x00FF0000) | ((n>>8)&0x0000FF00) | ((n<<24)&0xFF000000)) static int DrawCanvas( Tcl_Interp *interp, /* As passed to the widget command, and we will leave errors here */ ClientData clientData, Tk_PhotoHandle photohandle, /* The photo we are rendering into */ int subsample, /* If either subsample or zoom are not 1 then we call Tk_PhotoPutZoomedBlock() */ int zoom) { TkCanvas * canvasPtr = clientData; Tk_Window tkwin; Display *displayPtr; Tk_PhotoImageBlock blockPtr = {0}; Window wid; Tk_Item * itemPtr; Pixmap pixmap = 0; XImage *ximagePtr = NULL; Visual *visualPtr; GC xgc = 0; XGCValues xgcValues; int canvasX1, canvasY1, canvasX2, canvasY2, cWidth, cHeight, pixmapX1, pixmapY1, pixmapX2, pixmapY2, pmWidth, pmHeight, bitsPerPixel, bytesPerPixel, x, y, result = TCL_OK, rshift, gshift, bshift, rbits, gbits, bbits; #ifdef DEBUG_DRAWCANVAS char buffer[128]; #endif if ((tkwin = canvasPtr->tkwin) == NULL) { Tcl_AppendResult(interp, "canvas tkwin is NULL!", NULL); result = TCL_ERROR; goto done; } /* * If this canvas is unmapped, then we won't have a window id, so we will * try the ancestors of the canvas until we find a window that has a * valid window id. The Tk_GetPixmap() call requires a valid window id. */ do { if ((displayPtr = Tk_Display(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas (or parent) display is NULL!", NULL); result = TCL_ERROR; goto done; } if ((wid = Tk_WindowId(tkwin)) != 0) { continue; } if ((tkwin = Tk_Parent(tkwin)) == NULL) { Tcl_AppendResult(interp, "canvas has no parent with a valid window id! Is the toplevel window mapped?", NULL); result = TCL_ERROR; goto done; } } while (wid == 0); bitsPerPixel = Tk_Depth(tkwin); visualPtr = Tk_Visual(tkwin); if (subsample == 0) { Tcl_AppendResult(interp, "subsample cannot be zero", NULL); result = TCL_ERROR; goto done; } /* * Scan through the item list, registering the bounding box for all items * that didn't do that for the final coordinates yet. This can be * determined by the FORCE_REDRAW flag. */ for (itemPtr = canvasPtr -> firstItemPtr; itemPtr != NULL; itemPtr = itemPtr -> nextPtr) { if (itemPtr -> redraw_flags & FORCE_REDRAW) { itemPtr -> redraw_flags &= ~FORCE_REDRAW; EventuallyRedrawItem(canvasPtr, itemPtr); itemPtr -> redraw_flags &= ~FORCE_REDRAW; } } /* * The DisplayCanvas() function works out the region that needs redrawing, * but we don't do this. We grab the whole scrollregion or canvas window * area. If we have a defined -scrollregion we use that as the drawing * region, otherwise use the canvas window height and width with an origin * of 0,0. */ if (canvasPtr->scrollX1 != 0 || canvasPtr->scrollY1 != 0 || canvasPtr->scrollX2 != 0 || canvasPtr->scrollY2 != 0) { canvasX1 = canvasPtr->scrollX1; canvasY1 = canvasPtr->scrollY1; canvasX2 = canvasPtr->scrollX2; canvasY2 = canvasPtr->scrollY2; cWidth = canvasX2 - canvasX1 + 1; cHeight = canvasY2 - canvasY1 + 1; } else { cWidth = Tk_Width(tkwin); cHeight = Tk_Height(tkwin); canvasX1 = 0; canvasY1 = 0; canvasX2 = canvasX1 + cWidth - 1; canvasY2 = canvasY1 + cHeight - 1; } /* * Allocate a pixmap to draw into. We add OVERDRAW_PIXELS in the same way * that DisplayCanvas() does to avoid problems on some systems when objects * are being drawn too close to the edge. */ pixmapX1 = canvasX1 - OVERDRAW_PIXELS; pixmapY1 = canvasY1 - OVERDRAW_PIXELS; pixmapX2 = canvasX2 + OVERDRAW_PIXELS; pixmapY2 = canvasY2 + OVERDRAW_PIXELS; pmWidth = pixmapX2 - pixmapX1 + 1; pmHeight = pixmapY2 - pixmapY1 + 1; if ((pixmap = Tk_GetPixmap(displayPtr, Tk_WindowId(tkwin), pmWidth, pmHeight, bitsPerPixel)) == 0) { Tcl_AppendResult(interp, "failed to create drawing Pixmap", NULL); result = TCL_ERROR; goto done; } /* * Before we can draw the canvas objects into the pixmap it's background * should be filled with canvas background colour. */ xgcValues.function = GXcopy; xgcValues.foreground = Tk_3DBorderColor(canvasPtr->bgBorder)->pixel; xgc = XCreateGC(displayPtr, pixmap, GCFunction|GCForeground, &xgcValues); XFillRectangle(displayPtr,pixmap,xgc,0,0,pmWidth,pmHeight); /* * Draw all the cavas items into the pixmap */ canvasPtr->drawableXOrigin = pixmapX1; canvasPtr->drawableYOrigin = pixmapY1; for (itemPtr = canvasPtr->firstItemPtr; itemPtr != NULL; itemPtr = itemPtr->nextPtr) { if ((itemPtr->x1 >= pixmapX2) || (itemPtr->y1 >= pixmapY2) || (itemPtr->x2 < pixmapX1) || (itemPtr->y2 < pixmapY1)) { if (!AlwaysRedraw(itemPtr)) { continue; } } if (itemPtr->state == TK_STATE_HIDDEN || (itemPtr->state == TK_STATE_NULL && canvasPtr->canvas_state == TK_STATE_HIDDEN)) { continue; } ItemDisplay(canvasPtr, itemPtr, pixmap, pixmapX1, pixmapY1, pmWidth, pmHeight); } /* * Copy the Pixmap into an ZPixmap format XImage so we can copy it across * to the photo image. This seems to be the only way to get Pixmap image * data out of an image. Note we have to account for the OVERDRAW_PIXELS * border width. */ if ((ximagePtr = XGetImage(displayPtr, pixmap, -pixmapX1, -pixmapY1, cWidth, cHeight, AllPlanes, ZPixmap)) == NULL) { Tcl_AppendResult(interp, "failed to copy Pixmap to XImage", NULL); result = TCL_ERROR; goto done; } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, "ximagePtr {", NULL); sprintf(buffer,"%d",ximagePtr->width); Tcl_AppendResult(interp, " width ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->height); Tcl_AppendResult(interp, " height ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->xoffset); Tcl_AppendResult(interp, " xoffset ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->format); Tcl_AppendResult(interp, " format ", buffer, NULL); Tcl_AppendResult(interp, " ximagePtr->data", NULL); if (ximagePtr->data != NULL) { int ix, iy; Tcl_AppendResult(interp, " {", NULL); for (iy = 0; iy < ximagePtr->height; ++ iy) { Tcl_AppendResult(interp, " {", NULL); for (ix = 0; ix < ximagePtr->bytes_per_line; ++ ix) { if (ix > 0) { if (ix % 4 == 0) Tcl_AppendResult(interp, "-", NULL); else Tcl_AppendResult(interp, " ", NULL); } sprintf(buffer,"%2.2x",ximagePtr->data[ximagePtr->bytes_per_line * iy + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); } Tcl_AppendResult(interp, " }", NULL); } Tcl_AppendResult(interp, " }", NULL); } else sprintf(buffer," NULL"); sprintf(buffer,"%d",ximagePtr->byte_order); Tcl_AppendResult(interp, " byte_order ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_unit); Tcl_AppendResult(interp, " bitmap_unit ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_bit_order); Tcl_AppendResult(interp, " bitmap_bit_order ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bitmap_pad); Tcl_AppendResult(interp, " bitmap_pad ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->depth); Tcl_AppendResult(interp, " depth ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bytes_per_line); Tcl_AppendResult(interp, " bytes_per_line ", buffer, NULL); sprintf(buffer,"%d",ximagePtr->bits_per_pixel); Tcl_AppendResult(interp, " bits_per_pixel ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",ximagePtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL); Tcl_AppendResult(interp, " }", NULL); Tcl_AppendResult(interp, "\nvisualPtr {", NULL); sprintf(buffer,"0x%8.8lx",visualPtr->red_mask); Tcl_AppendResult(interp, " red_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",visualPtr->green_mask); Tcl_AppendResult(interp, " green_mask ", buffer, NULL); sprintf(buffer,"0x%8.8lx",visualPtr->blue_mask); Tcl_AppendResult(interp, " blue_mask ", buffer, NULL); Tcl_AppendResult(interp, " }", NULL); #endif /* * Fill in the PhotoImageBlock structure abd allocate a block of memory * for the converted image data. Note we allocate an alpha channel even * though we don't use one, because this layout helps Tk_PhotoPutBlock() * use memcpy() instead of the slow pixel or line copy. */ blockPtr.width = cWidth; blockPtr.height = cHeight; blockPtr.pixelSize = 4; blockPtr.pitch = blockPtr.pixelSize * blockPtr.width; blockPtr.offset[0] = 0; blockPtr.offset[1] = 1; blockPtr.offset[2] = 2; blockPtr.offset[3] = 3; blockPtr.pixelPtr = ckalloc(blockPtr.pixelSize * blockPtr.height * blockPtr.width); /* * Now convert the image data pixel by pixel from XImage to 32bit RGBA * format suitable for Tk_PhotoPutBlock(). */ DecomposeMaskToShiftAndBits(visualPtr->red_mask,&rshift,&rbits); DecomposeMaskToShiftAndBits(visualPtr->green_mask,&gshift,&gbits); DecomposeMaskToShiftAndBits(visualPtr->blue_mask,&bshift,&bbits); #ifdef DEBUG_DRAWCANVAS sprintf(buffer,"%d",rshift); Tcl_AppendResult(interp, "\nbits { rshift ", buffer, NULL); sprintf(buffer,"%d",gshift); Tcl_AppendResult(interp, " gshift ", buffer, NULL); sprintf(buffer,"%d",bshift); Tcl_AppendResult(interp, " bshift ", buffer, NULL); sprintf(buffer,"%d",rbits); Tcl_AppendResult(interp, " rbits ", buffer, NULL); sprintf(buffer,"%d",gbits); Tcl_AppendResult(interp, " gbits ", buffer, NULL); sprintf(buffer,"%d",bbits); Tcl_AppendResult(interp, " bbits ", buffer, " }", NULL); Tcl_AppendResult(interp, "\nConverted_image {", NULL); #endif /* Ok, had to use ximagePtr->bits_per_pixel here and in the switch (...) * below to get this to work on Windows. X11 correctly sets the bitmap *_pad and bitmap_unit fields to 32, but on Windows they are 0 and 8 * respectively! */ bytesPerPixel = ximagePtr->bits_per_pixel/8; for (y = 0; y < blockPtr.height; ++y) { #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " {", NULL); #endif for(x = 0; x < blockPtr.width; ++x) { unsigned long pixel = 0; switch (ximagePtr->bits_per_pixel) { /* * Get an 8 bit pixel from the XImage. */ case 8 : pixel = *((unsigned char *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); break; /* * Get a 16 bit pixel from the XImage, and correct the * byte order as necessary. */ case 16 : pixel = *((unsigned short *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) pixel = BYTE_SWAP16(pixel); break; /* * Grab a 32 bit pixel from the XImage, and correct the * byte order as necessary. */ case 32 : pixel = *((unsigned long *)(ximagePtr->data + bytesPerPixel * x + ximagePtr->bytes_per_line * y)); if ((IS_BIG_ENDIAN && ximagePtr->byte_order == LSBFirst) || (!IS_BIG_ENDIAN && ximagePtr->byte_order == MSBFirst)) pixel = BYTE_SWAP32(pixel); break; } /* * We have a pixel with the correct byte order, so pull out the * colours and place them in the photo block. Perhaps we could * just not bother with the alpha byte because we are using * TK_PHOTO_COMPOSITE_SET later? * ***Windows: We have to swap the red and blue values. The * XImage storage is B - G - R - A which becomes a 32bit ARGB * quad. However the visual mask is a 32bit ABGR quad. And * Tk_PhotoPutBlock() wants R-G-B-A which is a 32bit ABGR quad. * If the visual mask was correct there would be no need to * swap anything here. */ #ifdef _WIN32 #define R_OFFSET 2 #define B_OFFSET 0 #else #define R_OFFSET 0 #define B_OFFSET 2 #endif blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + R_OFFSET] = (unsigned char)((pixel & visualPtr->red_mask) >> rshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +1] = (unsigned char)((pixel & visualPtr->green_mask) >> gshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + B_OFFSET] = (unsigned char)((pixel & visualPtr->blue_mask) >> bshift); blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x +3] = 0xFF; #ifdef DEBUG_DRAWCANVAS { int ix; if (x > 0) Tcl_AppendResult(interp, "-", NULL); for (ix = 0; ix < 4; ++ix) { if (ix > 0) Tcl_AppendResult(interp, " ", NULL); sprintf(buffer,"%2.2x",blockPtr.pixelPtr[blockPtr.pitch * y + blockPtr.pixelSize * x + ix]&0xFF); Tcl_AppendResult(interp, buffer, NULL); } } #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", NULL); #endif } #ifdef DEBUG_DRAWCANVAS Tcl_AppendResult(interp, " }", NULL); #endif /* * Now put the copied pixmap into the photo. * If either zoom or subsample are not 1, we use the zoom function. */ if (subsample != 1 || zoom != 1) { if ((result = Tk_PhotoPutZoomedBlock(interp, photohandle, &blockPtr, 0, 0, cWidth * zoom / subsample, cHeight * zoom / subsample, zoom, zoom, subsample, subsample, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { goto done; } } else { if ((result = Tk_PhotoPutBlock(interp, photohandle, &blockPtr, 0, 0, cWidth, cHeight, TK_PHOTO_COMPOSITE_SET)) != TCL_OK) { goto done; } } /* * Clean up anything we have allocated and exit. */ done: if (blockPtr.pixelPtr) ckfree(blockPtr.pixelPtr); if (pixmap) Tk_FreePixmap(Tk_Display(tkwin), pixmap); if (ximagePtr) XDestroyImage(ximagePtr); if (xgc) XFreeGC(displayPtr,xgc); return result; } /* *---------------------------------------------------------------------- * * DisplayCanvas -- * * This function redraws the contents of a canvas window. It is invoked * as a do-when-idle handler, so it only runs when there's nothing else |
︙ | ︙ | |||
3046 3047 3048 3049 3050 3051 3052 | tkOvalType.nextPtr = &tkBitmapType; tkBitmapType.nextPtr = &tkArcType; tkArcType.nextPtr = &tkWindowType; tkWindowType.nextPtr = NULL; Tcl_MutexUnlock(&typeListMutex); } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 | tkOvalType.nextPtr = &tkBitmapType; tkBitmapType.nextPtr = &tkArcType; tkArcType.nextPtr = &tkWindowType; tkWindowType.nextPtr = NULL; Tcl_MutexUnlock(&typeListMutex); } /* *---------------------------------------------------------------------- * * GetStaticUids -- * * This function is invoked to return a structure filled with the Uids * used when doing tag searching. If it was never before called in the |
︙ | ︙ | |||
4011 4012 4013 4014 4015 4016 4017 | Tcl_HashEntry *entryPtr; itemPtr = searchPtr->canvasPtr->hotPtr; lastPtr = searchPtr->canvasPtr->hotPrevPtr; if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id) || (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) { entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, | | | 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 | Tcl_HashEntry *entryPtr; itemPtr = searchPtr->canvasPtr->hotPtr; lastPtr = searchPtr->canvasPtr->hotPrevPtr; if ((itemPtr == NULL) || (itemPtr->id != searchPtr->id) || (lastPtr == NULL) || (lastPtr->nextPtr != itemPtr)) { entryPtr = Tcl_FindHashEntry(&searchPtr->canvasPtr->idTable, INT2PTR(searchPtr->id)); if (entryPtr != NULL) { itemPtr = Tcl_GetHashValue(entryPtr); lastPtr = itemPtr->prevPtr; } else { lastPtr = itemPtr = NULL; } } |
︙ | ︙ | |||
4176 4177 4178 4179 4180 4181 4182 | return itemPtr; } } searchPtr->lastPtr = lastPtr; searchPtr->searchOver = 1; return NULL; } | < | 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 | return itemPtr; } } searchPtr->lastPtr = lastPtr; searchPtr->searchOver = 1; return NULL; } /* *-------------------------------------------------------------- * * DoItem -- * * This is a utility function called by FindItems. It either adds |
︙ | ︙ | |||
4213 4214 4215 4216 4217 4218 4219 | int count; /* * Handle the "add-to-result" case and return, if appropriate. */ if (tag == NULL) { | | | 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 | int count; /* * Handle the "add-to-result" case and return, if appropriate. */ if (tag == NULL) { Tcl_ListObjAppendElement(NULL, accumObj, Tcl_NewWideIntObj(itemPtr->id)); return; } for (tagPtr = itemPtr->tagPtr, count = itemPtr->numTags; count > 0; tagPtr++, count--) { if (tag == *tagPtr) { return; |
︙ | ︙ | |||
4289 4290 4291 4292 4293 4294 4295 | Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all * found items; if NULL, then ids of found * items are returned in the interp's * result. */ int first /* For error messages: gives number of * elements of objv which are already * handled. */ | < < < < < | 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 | Tcl_Obj *newTag, /* If non-NULL, gives new tag to set on all * found items; if NULL, then ids of found * items are returned in the interp's * result. */ int first /* For error messages: gives number of * elements of objv which are already * handled. */ ,TagSearch **searchPtrPtr /* From CanvasWidgetCmd local vars*/ ) { Tk_Item *itemPtr; Tk_Uid uid; int index, result; Tcl_Obj *resultObj; static const char *const optionStrings[] = { "above", "all", "below", "closest", "enclosed", "overlapping", "withtag", NULL |
︙ | ︙ | |||
4613 4614 4615 4616 4617 4618 4619 | * The items identified by "tag" are moved so that they are all together * in the display list and immediately after prevPtr. The order of the * moved items relative to each other is not changed. * *-------------------------------------------------------------- */ | < < < < < < < < < < < < < < | 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 | * The items identified by "tag" are moved so that they are all together * in the display list and immediately after prevPtr. The order of the * moved items relative to each other is not changed. * *-------------------------------------------------------------- */ static int RelinkItems( TkCanvas *canvasPtr, /* Canvas to be modified. */ Tcl_Obj *tag, /* Tag identifying items to be moved in the * redisplay list. */ Tk_Item *prevPtr, /* Reposition the items so that they go just * after this item (NULL means put at * beginning of list). */ TagSearch **searchPtrPtr) /* From CanvasWidgetCmd local vars */ { Tk_Item *itemPtr; Tk_Item *firstMovePtr, *lastMovePtr; int result; /* * Find all of the items to be moved and remove them from the list, making * an auxiliary list running from firstMovePtr to lastMovePtr. Record * their areas for redisplay. |
︙ | ︙ | |||
4689 4690 4691 4692 4693 4694 4695 | /* * Insert the list of to-be-moved items back into the canvas's at the * desired position. */ if (firstMovePtr == NULL) { | < < < < < < | 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 | /* * Insert the list of to-be-moved items back into the canvas's at the * desired position. */ if (firstMovePtr == NULL) { return TCL_OK; } if (prevPtr == NULL) { if (canvasPtr->firstItemPtr != NULL) { canvasPtr->firstItemPtr->prevPtr = lastMovePtr; } lastMovePtr->nextPtr = canvasPtr->firstItemPtr; canvasPtr->firstItemPtr = firstMovePtr; } else { if (prevPtr->nextPtr != NULL) { prevPtr->nextPtr->prevPtr = lastMovePtr; } lastMovePtr->nextPtr = prevPtr->nextPtr; if (firstMovePtr != NULL) { firstMovePtr->prevPtr = prevPtr; } prevPtr->nextPtr = firstMovePtr; } if (canvasPtr->lastItemPtr == prevPtr) { canvasPtr->lastItemPtr = lastMovePtr; } return TCL_OK; } /* *-------------------------------------------------------------- * * CanvasBindProc -- * |
︙ | ︙ | |||
4756 4757 4758 4759 4760 4761 4762 | * canvasPtr>state. This information is used to defer repicks of the * current item while buttons are down. */ switch (eventPtr->type) { case ButtonPress: case ButtonRelease: | | < < < < < < < < < < < < < < < < < < < | 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 | * canvasPtr>state. This information is used to defer repicks of the * current item while buttons are down. */ switch (eventPtr->type) { case ButtonPress: case ButtonRelease: mask = TkGetButtonMask(eventPtr->xbutton.button); /* * For button press events, repick the current item using the button * state before the event, then process the event. For button release * events, first process the event, then repick the current item using * the button state *after* the event (the button has logically gone * up before we change the current item). |
︙ | ︙ | |||
4858 4859 4860 4861 4862 4863 4864 | TkCanvas *canvasPtr, /* Canvas widget in which to select current * item. */ XEvent *eventPtr) /* Event describing location of mouse cursor. * Must be EnterWindow, LeaveWindow, * ButtonRelease, or MotionNotify. */ { double coords[2]; | | < < | < | 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 | TkCanvas *canvasPtr, /* Canvas widget in which to select current * item. */ XEvent *eventPtr) /* Event describing location of mouse cursor. * Must be EnterWindow, LeaveWindow, * ButtonRelease, or MotionNotify. */ { double coords[2]; unsigned long buttonDown; Tk_Item *prevItemPtr; SearchUids *searchUids = GetStaticUids(); /* * Check whether or not a button is down. If so, we'll log entry and exit * into and out of the current item, but not entry into any other item. * This implements a form of grabbing equivalent to what the X server does * for windows. */ buttonDown = canvasPtr->state & ALL_BUTTONS; /* * Save information about this event in the canvas. The event in the * canvas is used for two purposes: * * 1. Event bindings: if the current item changes, fake events are * generated to allow item-enter and item-leave bindings to trigger. |
︙ | ︙ | |||
4985 4986 4987 4988 4989 4990 4991 | /* * The check below is needed because there could be an event handler * for <LeaveNotify> that deletes the current item. */ if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) { for (i = itemPtr->numTags-1; i >= 0; i--) { | < < < < | 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 | /* * The check below is needed because there could be an event handler * for <LeaveNotify> that deletes the current item. */ if ((itemPtr == canvasPtr->currentItemPtr) && !buttonDown) { for (i = itemPtr->numTags-1; i >= 0; i--) { if (itemPtr->tagPtr[i] == searchUids->currentUid) /* then */ { itemPtr->tagPtr[i] = itemPtr->tagPtr[itemPtr->numTags-1]; itemPtr->numTags--; break; } } } |
︙ | ︙ | |||
5026 5027 5028 5029 5030 5031 5032 | (prevItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT)) { EventuallyRedrawItem(canvasPtr, prevItemPtr); ItemConfigure(canvasPtr, prevItemPtr, 0, NULL); } if (canvasPtr->currentItemPtr != NULL) { XEvent event; | < < < < | 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 | (prevItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT)) { EventuallyRedrawItem(canvasPtr, prevItemPtr); ItemConfigure(canvasPtr, prevItemPtr, 0, NULL); } if (canvasPtr->currentItemPtr != NULL) { XEvent event; DoItem(NULL, canvasPtr->currentItemPtr, searchUids->currentUid); if ((canvasPtr->currentItemPtr->redraw_flags & TK_ITEM_STATE_DEPENDANT && prevItemPtr != canvasPtr->currentItemPtr)) { ItemConfigure(canvasPtr, canvasPtr->currentItemPtr, 0, NULL); EventuallyRedrawItem(canvasPtr, canvasPtr->currentItemPtr); } event = canvasPtr->pickEvent; event.type = EnterNotify; |
︙ | ︙ | |||
5124 5125 5126 5127 5128 5129 5130 | static void CanvasDoEvent( TkCanvas *canvasPtr, /* Canvas widget in which event occurred. */ XEvent *eventPtr) /* Real or simulated X event that is to be * processed. */ { #define NUM_STATIC 3 | | | < < < < < < < < < < < < | 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 | static void CanvasDoEvent( TkCanvas *canvasPtr, /* Canvas widget in which event occurred. */ XEvent *eventPtr) /* Real or simulated X event that is to be * processed. */ { #define NUM_STATIC 3 void *staticObjects[NUM_STATIC]; void **objectPtr; int numObjects, i; Tk_Item *itemPtr; TagSearchExpr *expr; int numExprs; SearchUids *searchUids = GetStaticUids(); if (canvasPtr->bindingTable == NULL) { return; } itemPtr = canvasPtr->currentItemPtr; if ((eventPtr->type == KeyPress) || (eventPtr->type == KeyRelease)) { itemPtr = canvasPtr->textInfo.focusItemPtr; } if (itemPtr == NULL) { return; } /* * Set up an array with all the relevant objects for processing this * event. The relevant objects are: * (a) the event's item, * (b) the tags associated with the event's item, * (c) the expressions that are true for the event's item's tags, and * (d) the tag "all". |
︙ | ︙ | |||
5184 5185 5186 5187 5188 5189 5190 | if (expr->match) { numExprs++; } expr = expr->next; } numObjects = itemPtr->numTags + numExprs + 2; | < | < < < | < | < < | 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 | if (expr->match) { numExprs++; } expr = expr->next; } numObjects = itemPtr->numTags + numExprs + 2; if (numObjects <= NUM_STATIC) { objectPtr = staticObjects; } else { objectPtr = ckalloc(numObjects * sizeof(void *)); } objectPtr[0] = (char *)searchUids->allUid; for (i = itemPtr->numTags-1; i >= 0; i--) { objectPtr[i+1] = (char *)itemPtr->tagPtr[i]; } objectPtr[itemPtr->numTags+1] = itemPtr; /* * Copy uids of matching expressions into object array */ i = itemPtr->numTags+2; expr = canvasPtr->bindTagExprs; while (expr) { if (expr->match) { objectPtr[i++] = (int *) expr->uid; } expr = expr->next; } /* * Invoke the binding system, then free up the object array if it was * malloc-ed. */ if (canvasPtr->tkwin != NULL) { |
︙ | ︙ | |||
5303 5304 5305 5306 5307 5308 5309 | if (canvasPtr->insertOffTime != 0) { canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler( canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr); } } else { canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; | | | 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 | if (canvasPtr->insertOffTime != 0) { canvasPtr->insertBlinkHandler = Tcl_CreateTimerHandler( canvasPtr->insertOffTime, CanvasBlinkProc, canvasPtr); } } else { canvasPtr->textInfo.gotFocus = 0; canvasPtr->textInfo.cursorOn = 0; canvasPtr->insertBlinkHandler = NULL; } EventuallyRedrawItem(canvasPtr, canvasPtr->textInfo.focusItemPtr); if (canvasPtr->highlightWidth > 0) { canvasPtr->flags |= REDRAW_BORDERS; if (!(canvasPtr->flags & REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayCanvas, canvasPtr); canvasPtr->flags |= REDRAW_PENDING; |
︙ | ︙ |
Changes to generic/tkCanvas.h.
︙ | ︙ | |||
143 144 145 146 147 148 149 | * of the previous current item. */ double closeEnough; /* The mouse is assumed to be inside an item * if it is this close to it. */ XEvent pickEvent; /* The event upon which the current choice of * currentItem is based. Must be saved so that * if the currentItem is deleted, can pick * another. */ | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | * of the previous current item. */ double closeEnough; /* The mouse is assumed to be inside an item * if it is this close to it. */ XEvent pickEvent; /* The event upon which the current choice of * currentItem is based. Must be saved so that * if the currentItem is deleted, can pick * another. */ unsigned int state; /* Last known modifier state. Used to defer * picking a new current object while buttons * are down. */ /* * Information used for managing scrollbars: */ |
︙ | ︙ |
Changes to generic/tkClipboard.c.
︙ | ︙ | |||
418 419 420 421 422 423 424 | int Tk_ClipboardObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | int Tk_ClipboardObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window tkwin = clientData; const char *path = NULL; Atom selection; static const char *const optionStrings[] = { "append", "clear", "get", NULL }; enum options { CLIPBOARD_APPEND, CLIPBOARD_CLEAR, CLIPBOARD_GET }; int index, i; if (objc < 2) { |
︙ | ︙ | |||
445 446 447 448 449 450 451 | const char *targetName = NULL; const char *formatName = NULL; const char *string; static const char *const appendOptionStrings[] = { "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; | | > | | 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | const char *targetName = NULL; const char *formatName = NULL; const char *string; static const char *const appendOptionStrings[] = { "-displayof", "-format", "-type", NULL }; enum appendOptions { APPEND_DISPLAYOF, APPEND_FORMAT, APPEND_TYPE }; int subIndex; TkSizeT length; for (i = 2; i < objc - 1; i++) { string = TkGetStringFromObj(objv[i], &length); if (string[0] != '-') { break; } /* * If the argument is "--", it signifies the end of arguments. */ |
︙ | ︙ | |||
704 705 706 707 708 709 710 | ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ Tcl_Interp *interp, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { | | | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | ClipboardGetProc( ClientData clientData, /* Dynamic string holding partially assembled * selection. */ Tcl_Interp *interp, /* Interpreter used for error reporting (not * used). */ const char *portion) /* New information to be appended. */ { Tcl_DStringAppend(clientData, portion, -1); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkCmds.c.
︙ | ︙ | |||
742 743 744 745 746 747 748 | * Return all the current values */ objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-height", 7)); Tcl_ListObjAppendElement(interp, objPtr, | | | | | | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | * Return all the current values */ objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-height", 7)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewWideIntObj(caretPtr->height)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-x", 2)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewWideIntObj(caretPtr->x)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("-y", 2)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewWideIntObj(caretPtr->y)); Tcl_SetObjResult(interp, objPtr); } else if (objc == 3) { int value; /* * Return the current value of the selected option */ if (Tcl_GetIndexFromObj(interp, objv[2], caretStrings, "caret option", 0, &index) != TCL_OK) { return TCL_ERROR; } if (index == TK_CARET_X) { value = caretPtr->x; } else if (index == TK_CARET_Y) { value = caretPtr->y; } else /* if (index == TK_CARET_HEIGHT) -- last case */ { value = caretPtr->height; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { int i, value, x = 0, y = 0, height = -1; for (i = 2; i < objc; i += 2) { if ((Tcl_GetIndexFromObj(interp, objv[i], caretStrings, "caret option", 0, &index) != TCL_OK) || Tcl_GetIntFromObj(interp,objv[i+1],&value) != TCL_OK) { |
︙ | ︙ | |||
938 939 940 941 942 943 944 | Tk_Window tkwin = clientData; int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc - skip == 1) { | | | | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | Tk_Window tkwin = clientData; int skip = TkGetDisplayOf(interp, objc - 1, objv + 1, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc - skip == 1) { Tcl_WideInt inactive; inactive = (Tcl_IsSafe(interp) ? -1 : Tk_GetUserInactiveTime(Tk_Display(tkwin))); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(inactive)); } else if (objc - skip == 2) { const char *string; string = Tcl_GetString(objv[objc-1]); if (strcmp(string, "reset") != 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad option \"%s\": must be reset", string)); |
︙ | ︙ | |||
1359 1360 1361 1362 1363 1364 1365 | } } winPtr = (TkWindow *) tkwin; switch ((enum options) index) { case WIN_CELLS: Tcl_SetObjResult(interp, | | | 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | } } winPtr = (TkWindow *) tkwin; switch ((enum options) index) { case WIN_CELLS: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Visual(tkwin)->map_entries)); break; case WIN_CHILDREN: { Tcl_Obj *strPtr, *resultPtr = Tcl_NewObj(); winPtr = winPtr->childList; for ( ; winPtr != NULL; winPtr = winPtr->nextPtr) { if (!(winPtr->flags & TK_ANONYMOUS_WINDOW)) { |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Class(tkwin), -1)); break; case WIN_COLORMAPFULL: Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TkpCmapStressed(tkwin,Tk_Colormap(tkwin)))); break; case WIN_DEPTH: | | | | 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 | Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_Class(tkwin), -1)); break; case WIN_COLORMAPFULL: Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TkpCmapStressed(tkwin,Tk_Colormap(tkwin)))); break; case WIN_DEPTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Depth(tkwin))); break; case WIN_GEOMETRY: Tcl_SetObjResult(interp, Tcl_ObjPrintf("%dx%d+%d+%d", Tk_Width(tkwin), Tk_Height(tkwin), Tk_X(tkwin), Tk_Y(tkwin))); break; case WIN_HEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Height(tkwin))); break; case WIN_ID: { char buf[TCL_INTEGER_SPACE]; Tk_MakeWindowExist(tkwin); TkpPrintWindowId(buf, Tk_WindowId(tkwin)); Tcl_SetObjResult(interp, Tcl_NewStringObj(buf, -1)); |
︙ | ︙ | |||
1440 1441 1442 1443 1444 1445 1446 | y = -1; } else { TkGetPointerCoords((Tk_Window) winPtr, &x, &y); } if (useX & useY) { Tcl_Obj *xyObj[2]; | | | | | | | | | | | | | | | | 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | y = -1; } else { TkGetPointerCoords((Tk_Window) winPtr, &x, &y); } if (useX & useY) { Tcl_Obj *xyObj[2]; xyObj[0] = Tcl_NewWideIntObj(x); xyObj[1] = Tcl_NewWideIntObj(y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, xyObj)); } else if (useX) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); } break; case WIN_REQHEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqHeight(tkwin))); break; case WIN_REQWIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_ReqWidth(tkwin))); break; case WIN_ROOTX: Tk_GetRootCoords(tkwin, &x, &y); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); break; case WIN_ROOTY: Tk_GetRootCoords(tkwin, &x, &y); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); break; case WIN_SCREEN: Tcl_SetObjResult(interp, Tcl_ObjPrintf("%s.%d", Tk_DisplayName(tkwin), Tk_ScreenNumber(tkwin))); break; case WIN_SCREENCELLS: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(CellsOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENDEPTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(DefaultDepthOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENHEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(HeightOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENWIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(WidthOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENMMHEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(HeightMMOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENMMWIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(WidthMMOfScreen(Tk_Screen(tkwin)))); break; case WIN_SCREENVISUAL: class = DefaultVisualOfScreen(Tk_Screen(tkwin))->class; goto visual; case WIN_SERVER: TkGetServerInfo(interp, tkwin); break; |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | break; case WIN_VISUALID: Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) XVisualIDFromVisual(Tk_Visual(tkwin)))); break; case WIN_VROOTHEIGHT: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); | | | | | | | | | | | | 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | break; case WIN_VISUALID: Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%x", (unsigned) XVisualIDFromVisual(Tk_Visual(tkwin)))); break; case WIN_VROOTHEIGHT: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(height)); break; case WIN_VROOTWIDTH: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(width)); break; case WIN_VROOTX: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(x)); break; case WIN_VROOTY: Tk_GetVRootGeometry(tkwin, &x, &y, &width, &height); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(y)); break; case WIN_WIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Width(tkwin))); break; case WIN_X: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_X(tkwin))); break; case WIN_Y: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_Y(tkwin))); break; /* * Uses -displayof. */ case WIN_ATOM: skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc - skip != 3) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? name"); return TCL_ERROR; } objv += skip; string = Tcl_GetString(objv[2]); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Tk_InternAtom(tkwin, string))); break; case WIN_ATOMNAME: { const char *name; Tcl_WideInt id; skip = TkGetDisplayOf(interp, objc - 2, objv + 2, &tkwin); if (skip < 0) { return TCL_ERROR; } if (objc - skip != 3) { Tcl_WrongNumArgs(interp, 2, objv, "?-displayof window? id"); return TCL_ERROR; } objv += skip; if (Tcl_GetWideIntFromObj(interp, objv[2], &id) != TCL_OK) { return TCL_ERROR; } name = Tk_GetAtomName(tkwin, (Atom) id); if (strcmp(name, "?bad atom?") == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no atom exists with id \"%s\"", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "ATOM", |
︙ | ︙ | |||
1731 1732 1733 1734 1735 1736 1737 | if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) { return TCL_ERROR; } string = Tcl_GetString(objv[3]); if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) { return TCL_ERROR; } | | | 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 | if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin) != TCL_OK) { return TCL_ERROR; } string = Tcl_GetString(objv[3]); if (Tk_GetPixels(interp, tkwin, string, &pixels) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixels)); break; } case WIN_RGB: { XColor *colorPtr; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "window colorName"); |
︙ | ︙ | |||
1856 1857 1858 1859 1860 1861 1862 | TKWM_GROUP, TKWM_ICONBMP, TKWM_ICONIFY, TKWM_ICONMASK, TKWM_ICONNAME, TKWM_ICONPOS, TKWM_ICONWIN, TKWM_MAXSIZE, TKWM_MINSIZE, TKWM_OVERRIDE, TKWM_POSFROM, TKWM_PROTOCOL, TKWM_RESIZABLE, TKWM_SIZEFROM, TKWM_STATE, TKWM_TITLE, TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW }; | | | 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 | TKWM_GROUP, TKWM_ICONBMP, TKWM_ICONIFY, TKWM_ICONMASK, TKWM_ICONNAME, TKWM_ICONPOS, TKWM_ICONWIN, TKWM_MAXSIZE, TKWM_MINSIZE, TKWM_OVERRIDE, TKWM_POSFROM, TKWM_PROTOCOL, TKWM_RESIZABLE, TKWM_SIZEFROM, TKWM_STATE, TKWM_TITLE, TKWM_TRACING, TKWM_TRANSIENT, TKWM_WITHDRAW }; tkwin = clientData; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg?"); return TCL_ERROR; } if (Tcl_GetIndexFromObj(interp, objv[1], optionStrings, "option", 0, &index) != TCL_OK) { |
︙ | ︙ | |||
2067 2068 2069 2070 2071 2072 2073 | * application associated with interp. On * output, filled with window specified as * option to "-displayof" argument, or * unmodified if "-displayof" argument was not * present. */ { const char *string; | | | | | 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 | * application associated with interp. On * output, filled with window specified as * option to "-displayof" argument, or * unmodified if "-displayof" argument was not * present. */ { const char *string; TkSizeT length; if (objc < 1) { return 0; } string = TkGetStringFromObj(objv[0], &length); if ((length >= 2) && (strncmp(string, "-displayof", length) == 0)) { if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "value for \"-displayof\" missing", -1)); Tcl_SetErrorCode(interp, "TK", "NO_VALUE", "DISPLAYOF", NULL); return -1; } *tkwinPtr = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), *tkwinPtr); |
︙ | ︙ |
Changes to generic/tkColor.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 | Display *display; /* Display for colormap. */ } ValueKey; /* * The structure below is used to allocate thread-local data. */ | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | Display *display; /* Display for colormap. */ } ValueKey; /* * The structure below is used to allocate thread-local data. */ typedef struct { char rgbString[20]; /* */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations for functions defined in this file: */ |
︙ | ︙ | |||
476 477 478 479 480 481 482 | * Tk_GetColor. */ if (tkColPtr->magic != COLOR_MAGIC) { Tcl_Panic("Tk_FreeColor called with bogus color"); } | < | | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | * Tk_GetColor. */ if (tkColPtr->magic != COLOR_MAGIC) { Tcl_Panic("Tk_FreeColor called with bogus color"); } if (tkColPtr->resourceRefCount-- > 1) { return; } /* * This color is no longer being actively used, so free the color * resources associated with it and remove it from the hash table. No * longer any objects referencing it. |
︙ | ︙ | |||
583 584 585 586 587 588 589 | static void FreeColorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { | < | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | static void FreeColorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkColor *tkColPtr = objPtr->internalRep.twoPtrValue.ptr1; if (tkColPtr != NULL) { if ((tkColPtr->objRefCount-- <= 1) && (tkColPtr->resourceRefCount == 0)) { ckfree(tkColPtr); } objPtr->internalRep.twoPtrValue.ptr1 = NULL; } } |
︙ | ︙ | |||
816 817 818 819 820 821 822 | if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); } for ( ; (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 | if (tkColPtr == NULL) { Tcl_Panic("TkDebugColor found empty hash table entry"); } for ( ; (tkColPtr != NULL); tkColPtr = tkColPtr->nextPtr) { Tcl_Obj *objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(tkColPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(tkColPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } #ifndef _WIN32 |
︙ | ︙ |
Changes to generic/tkColor.h.
︙ | ︙ | |||
34 35 36 37 38 39 40 | * color and all other fields defaulted. May * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was * allocated. */ Visual *visual; /* Visual associated with colormap. */ | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | * color and all other fields defaulted. May * be NULL. */ Screen *screen; /* Screen where this color is valid. Used to * delete it, and to find its display. */ Colormap colormap; /* Colormap from which this entry was * allocated. */ Visual *visual; /* Visual associated with colormap. */ TkSizeT resourceRefCount; /* Number of active uses of this color (each * active use corresponds to a call to * Tk_AllocColorFromObj or Tk_GetColor). If * this count is 0, then this TkColor * structure is no longer valid and it isn't * present in a hash table: it is being kept * around only because there are objects * referring to it. The structure is freed * when resourceRefCount and objRefCount are * both 0. */ TkSizeT objRefCount; /* The number of Tcl objects that reference * this structure. */ int type; /* TK_COLOR_BY_NAME or TK_COLOR_BY_VALUE. */ Tcl_HashEntry *hashPtr; /* Pointer to hash table entry for this * structure. (for use in deleting entry). */ struct TkColor *nextPtr; /* Points to the next TkColor structure with * the same color name. Colors with the same * name but different screens or colormaps are |
︙ | ︙ |
Changes to generic/tkConfig.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 | #include "tkFont.h" /* * The following definition keeps track of all of * the option tables that have been created for a thread. */ | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #include "tkFont.h" /* * The following definition keeps track of all of * the option tables that have been created for a thread. */ typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable hashTable; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* |
︙ | ︙ | |||
87 88 89 90 91 92 93 | /* * One of the following exists for each Tk_OptionSpec array that has been * passed to Tk_CreateOptionTable. */ typedef struct OptionTable { | | | | | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | /* * One of the following exists for each Tk_OptionSpec array that has been * passed to Tk_CreateOptionTable. */ typedef struct OptionTable { size_t refCount; /* Counts the number of uses of this table * (the number of times Tk_CreateOptionTable * has returned it). This can be greater than * 1 if it is shared along several option * table chains, or if the same table is used * for multiple purposes. */ Tcl_HashEntry *hashEntryPtr;/* Hash table entry that refers to this table; * used to delete the entry. */ struct OptionTable *nextPtr;/* If templatePtr was part of a chain of * templates, this points to the table * corresponding to the next template in the * chain. */ size_t numOptions; /* The number of items in the options array * below. */ Option options[1]; /* Information about the individual options in * the table. This must be the last field in * the structure: the actual size of the array * will be numOptions, not 1. */ } OptionTable; /* * Forward declarations for functions defined later in this file: */ static int DoObjConfig(Tcl_Interp *interp, void *recordPtr, Option *optionPtr, Tcl_Obj *valuePtr, Tk_Window tkwin, Tk_SavedOption *savePtr); static void FreeResources(Option *optionPtr, Tcl_Obj *objPtr, void *internalPtr, Tk_Window tkwin); static Tcl_Obj * GetConfigList(void *recordPtr, Option *optionPtr, Tk_Window tkwin); static Tcl_Obj * GetObjectForOption(void *recordPtr, Option *optionPtr, Tk_Window tkwin); static Option * GetOption(const char *name, OptionTable *tablePtr); static Option * GetOptionFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, OptionTable *tablePtr); static int ObjectIsEmpty(Tcl_Obj *objPtr); static void FreeOptionInternalRep(Tcl_Obj *objPtr); static void DupOptionInternalRep(Tcl_Obj *, Tcl_Obj *); |
︙ | ︙ | |||
173 174 175 176 177 178 179 | * options. */ { Tcl_HashEntry *hashEntryPtr; int newEntry; OptionTable *tablePtr; const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | * options. */ { Tcl_HashEntry *hashEntryPtr; int newEntry; OptionTable *tablePtr; const Tk_OptionSpec *specPtr, *specPtr2; Option *optionPtr; size_t numOptions, i; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * We use an TSD in the thread to keep a hash table of * all the option tables we've created for this application. This is * used for allowing us to share the tables (e.g. in several chains). |
︙ | ︙ | |||
275 276 277 278 279 280 281 | * Get the custom parsing, etc., functions. */ optionPtr->extra.custom = specPtr->clientData; } } if (((specPtr->type == TK_OPTION_STRING) | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | * Get the custom parsing, etc., functions. */ optionPtr->extra.custom = specPtr->clientData; } } if (((specPtr->type == TK_OPTION_STRING) && (specPtr->internalOffset != TCL_AUTO_LENGTH)) || (specPtr->type == TK_OPTION_COLOR) || (specPtr->type == TK_OPTION_FONT) || (specPtr->type == TK_OPTION_BITMAP) || (specPtr->type == TK_OPTION_BORDER) || (specPtr->type == TK_OPTION_CURSOR) || (specPtr->type == TK_OPTION_CUSTOM)) { optionPtr->flags |= OPTION_NEEDS_FREEING; |
︙ | ︙ | |||
326 327 328 329 330 331 332 | void Tk_DeleteOptionTable( Tk_OptionTable optionTable) /* The option table to delete. */ { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; | | < | | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | void Tk_DeleteOptionTable( Tk_OptionTable optionTable) /* The option table to delete. */ { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; size_t count; if (tablePtr->refCount-- > 1) { return; } if (tablePtr->nextPtr != NULL) { Tk_DeleteOptionTable((Tk_OptionTable) tablePtr->nextPtr); } |
︙ | ︙ | |||
378 379 380 381 382 383 384 | *-------------------------------------------------------------- */ int Tk_InitOptions( Tcl_Interp *interp, /* Interpreter for error reporting. NULL means * don't leave an error message. */ | | | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | *-------------------------------------------------------------- */ int Tk_InitOptions( Tcl_Interp *interp, /* Interpreter for error reporting. NULL means * don't leave an error message. */ void *recordPtr, /* Pointer to the record to configure. Note: * the caller should have properly initialized * the record with NULL pointers for each * option value. */ Tk_OptionTable optionTable, /* The token which matches the config specs * for the widget in question. */ Tk_Window tkwin) /* Certain options types (such as * TK_OPTION_COLOR) need fields out of the |
︙ | ︙ | |||
549 550 551 552 553 554 555 | */ static int DoObjConfig( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no message is left if an error * occurs. */ | | | | | | | | | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | */ static int DoObjConfig( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no message is left if an error * occurs. */ void *recordPtr, /* The record to modify to hold the new option * value. */ Option *optionPtr, /* Pointer to information about the option. */ Tcl_Obj *valuePtr, /* New value for option. */ Tk_Window tkwin, /* Window in which option will be used (needed * to allocate resources for some options). * May be NULL if the option doesn't require * window-related resources. */ Tk_SavedOption *savedOptionPtr) /* If NULL, the old value for the option will * be freed. If non-NULL, the old value will * be stored here, and it becomes the property * of the caller (the caller must eventually * free the old value). */ { Tcl_Obj **slotPtrPtr, *oldPtr; void *internalPtr; /* Points to location in record where internal * representation of value should be stored, * or NULL. */ void *oldInternalPtr; /* Points to location in which to save old * internal representation of value. */ Tk_SavedOption internal; /* Used to save the old internal * representation of the value if * savedOptionPtr is NULL. */ const Tk_OptionSpec *specPtr; int nullOK; /* * Save the old object form for the value, if there is one. */ specPtr = optionPtr->specPtr; if (specPtr->objOffset != TCL_AUTO_LENGTH) { slotPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset); oldPtr = *slotPtrPtr; } else { slotPtrPtr = NULL; oldPtr = NULL; } /* * Apply the new value in a type-specific way. Also remember the old * object and internal forms, if they exist. */ if (specPtr->internalOffset != TCL_AUTO_LENGTH) { internalPtr = (char *)recordPtr + specPtr->internalOffset; } else { internalPtr = NULL; } if (savedOptionPtr != NULL) { savedOptionPtr->optionPtr = optionPtr; savedOptionPtr->valuePtr = oldPtr; oldInternalPtr = (char *) &savedOptionPtr->internalForm; |
︙ | ︙ | |||
653 654 655 656 657 658 659 | *((double *) internalPtr) = newDbl; } break; } case TK_OPTION_STRING: { char *newStr; const char *value; | | | | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 | *((double *) internalPtr) = newDbl; } break; } case TK_OPTION_STRING: { char *newStr; const char *value; TkSizeT length; if (nullOK && ObjectIsEmpty(valuePtr)) { valuePtr = NULL; } if (internalPtr != NULL) { if (valuePtr != NULL) { value = TkGetStringFromObj(valuePtr, &length); newStr = ckalloc(length + 1); strcpy(newStr, value); } else { newStr = NULL; } *((char **) oldInternalPtr) = *((char **) internalPtr); *((char **) internalPtr) = newStr; |
︙ | ︙ | |||
971 972 973 974 975 976 977 | const char *name, /* String balue to be looked up in the option * table. */ OptionTable *tablePtr) /* Table in which to look up name. */ { Option *bestPtr, *optionPtr; OptionTable *tablePtr2; const char *p1, *p2; | | | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | const char *name, /* String balue to be looked up in the option * table. */ OptionTable *tablePtr) /* Table in which to look up name. */ { Option *bestPtr, *optionPtr; OptionTable *tablePtr2; const char *p1, *p2; size_t count; /* * Search through all of the option tables in the chain to find the best * match. Some tricky aspects: * * 1. We have to accept unique abbreviations. * 2. The same name could appear in different tables in the chain. If this |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 | *-------------------------------------------------------------- */ int Tk_SetOptions( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is returned.*/ | | | 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | *-------------------------------------------------------------- */ int Tk_SetOptions( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is returned.*/ void *recordPtr, /* The record to configure. */ Tk_OptionTable optionTable, /* Describes valid options. */ int objc, /* The number of elements in objv. */ Tcl_Obj *const objv[], /* Contains one or more name-value pairs. */ Tk_Window tkwin, /* Window associated with the thing being * configured; needed for some options (such * as colors). */ Tk_SavedOptions *savePtr, /* If non-NULL, the old values of modified |
︙ | ︙ | |||
1337 1338 1339 1340 1341 1342 1343 | */ void Tk_RestoreSavedOptions( Tk_SavedOptions *savePtr) /* Holds saved option information; must have * been passed to Tk_SetOptions. */ { | | | | | | | | | | | | 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | */ void Tk_RestoreSavedOptions( Tk_SavedOptions *savePtr) /* Holds saved option information; must have * been passed to Tk_SetOptions. */ { size_t i; Option *optionPtr; Tcl_Obj *newPtr; /* New object value of option, which we * replace with old value and free. Taken from * record. */ void *internalPtr; /* Points to internal value of option in * record. */ const Tk_OptionSpec *specPtr; /* * Be sure to restore the options in the opposite order they were set. * This is important because it's possible that the same option name was * used twice in a single call to Tk_SetOptions. */ if (savePtr->nextPtr != NULL) { Tk_RestoreSavedOptions(savePtr->nextPtr); ckfree(savePtr->nextPtr); savePtr->nextPtr = NULL; } for (i = savePtr->numItems - 1; i != (size_t)-1; i--) { optionPtr = savePtr->items[i].optionPtr; specPtr = optionPtr->specPtr; /* * First free the new value of the option, which is currently in the * record. */ if (specPtr->objOffset != TCL_AUTO_LENGTH) { newPtr = *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset)); } else { newPtr = NULL; } if (specPtr->internalOffset != TCL_AUTO_LENGTH) { internalPtr = (char *)savePtr->recordPtr + specPtr->internalOffset; } else { internalPtr = NULL; } if (optionPtr->flags & OPTION_NEEDS_FREEING) { FreeResources(optionPtr, newPtr, internalPtr, savePtr->tkwin); } if (newPtr != NULL) { Tcl_DecrRefCount(newPtr); } /* * Now restore the old value of the option. */ if (specPtr->objOffset != TCL_AUTO_LENGTH) { *((Tcl_Obj **) ((char *)savePtr->recordPtr + specPtr->objOffset)) = savePtr->items[i].valuePtr; } if (specPtr->internalOffset != TCL_AUTO_LENGTH) { register char *ptr = (char *) &savePtr->items[i].internalForm; CLANG_ASSERT(internalPtr); switch (specPtr->type) { case TK_OPTION_BOOLEAN: *((int *) internalPtr) = *((int *) ptr); break; |
︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 | */ void Tk_FreeSavedOptions( Tk_SavedOptions *savePtr) /* Contains options saved in a previous call * to Tk_SetOptions. */ { | | | 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | */ void Tk_FreeSavedOptions( Tk_SavedOptions *savePtr) /* Contains options saved in a previous call * to Tk_SetOptions. */ { size_t count; Tk_SavedOption *savedOptionPtr; if (savePtr->nextPtr != NULL) { Tk_FreeSavedOptions(savePtr->nextPtr); ckfree(savePtr->nextPtr); } for (count = savePtr->numItems, |
︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | * *---------------------------------------------------------------------- */ /* ARGSUSED */ void Tk_FreeConfigOptions( | | | | | | | | | 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 | * *---------------------------------------------------------------------- */ /* ARGSUSED */ void Tk_FreeConfigOptions( void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes legal options. */ Tk_Window tkwin) /* Window associated with recordPtr; needed * for freeing some options. */ { OptionTable *tablePtr; Option *optionPtr; size_t count; Tcl_Obj **oldPtrPtr, *oldPtr; void *oldInternalPtr; const Tk_OptionSpec *specPtr; for (tablePtr = (OptionTable *) optionTable; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { for (optionPtr = tablePtr->options, count = tablePtr->numOptions; count > 0; optionPtr++, count--) { specPtr = optionPtr->specPtr; if (specPtr->type == TK_OPTION_SYNONYM) { continue; } if (specPtr->objOffset != TCL_AUTO_LENGTH) { oldPtrPtr = (Tcl_Obj **) ((char *)recordPtr + specPtr->objOffset); oldPtr = *oldPtrPtr; *oldPtrPtr = NULL; } else { oldPtr = NULL; } if (specPtr->internalOffset != TCL_AUTO_LENGTH) { oldInternalPtr = (char *)recordPtr + specPtr->internalOffset; } else { oldInternalPtr = NULL; } if (optionPtr->flags & OPTION_NEEDS_FREEING) { FreeResources(optionPtr, oldPtr, oldInternalPtr, tkwin); } if (oldPtr != NULL) { |
︙ | ︙ | |||
1590 1591 1592 1593 1594 1595 1596 | */ static void FreeResources( Option *optionPtr, /* Description of the configuration option. */ Tcl_Obj *objPtr, /* The current value of the option, specified * as an object. */ | | | | | 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 | */ static void FreeResources( Option *optionPtr, /* Description of the configuration option. */ Tcl_Obj *objPtr, /* The current value of the option, specified * as an object. */ void *internalPtr, /* A pointer to an internal representation for * the option's value, such as an int or * (XColor *). Only valid if * optionPtr->specPtr->internalOffset != -1. */ Tk_Window tkwin) /* The window in which this option is used. */ { int internalFormExists; /* * If there exists an internal form for the value, use it to free * resources (also zero out the internal form). If there is no internal * form, then use the object form. */ internalFormExists = optionPtr->specPtr->internalOffset != TCL_AUTO_LENGTH; switch (optionPtr->specPtr->type) { case TK_OPTION_STRING: if (internalFormExists) { if (*((char **) internalPtr) != NULL) { ckfree(*((char **) internalPtr)); *((char **) internalPtr) = NULL; } |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | Tk_FreeFontFromObj(tkwin, objPtr); } break; case TK_OPTION_STYLE: if (internalFormExists) { Tk_FreeStyle(*((Tk_Style *) internalPtr)); *((Tk_Style *) internalPtr) = NULL; | < < | 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | Tk_FreeFontFromObj(tkwin, objPtr); } break; case TK_OPTION_STYLE: if (internalFormExists) { Tk_FreeStyle(*((Tk_Style *) internalPtr)); *((Tk_Style *) internalPtr) = NULL; } break; case TK_OPTION_BITMAP: if (internalFormExists) { if (*((Pixmap *) internalPtr) != None) { Tk_FreeBitmap(Tk_Display(tkwin), *((Pixmap *) internalPtr)); *((Pixmap *) internalPtr) = None; |
︙ | ︙ | |||
1712 1713 1714 1715 1716 1717 1718 | *-------------------------------------------------------------- */ Tcl_Obj * Tk_GetOptionInfo( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is created. */ | | | | 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 | *-------------------------------------------------------------- */ Tcl_Obj * Tk_GetOptionInfo( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL, * then no error message is created. */ void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes all the legal options. */ Tcl_Obj *namePtr, /* If non-NULL, the string value selects a * single option whose info is to be returned. * Otherwise info is returned for all options * in optionTable. */ Tk_Window tkwin) /* Window associated with recordPtr; needed to * compute correct default value for some * options. */ { Tcl_Obj *resultPtr; OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; size_t count; /* * If information is only wanted for a single configuration spec, then * handle that one spec specially. */ if (namePtr != NULL) { |
︙ | ︙ | |||
1780 1781 1782 1783 1784 1785 1786 | * Memory is allocated. * *-------------------------------------------------------------- */ static Tcl_Obj * GetConfigList( | | | 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 | * Memory is allocated. * *-------------------------------------------------------------- */ static Tcl_Obj * GetConfigList( void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing a * particular option. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *listPtr, *elementPtr; |
︙ | ︙ | |||
1823 1824 1825 1826 1827 1828 1829 | } else if (optionPtr->defaultPtr != NULL) { elementPtr = optionPtr->defaultPtr; } else { elementPtr = Tcl_NewObj(); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); | | | | 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 | } else if (optionPtr->defaultPtr != NULL) { elementPtr = optionPtr->defaultPtr; } else { elementPtr = Tcl_NewObj(); } Tcl_ListObjAppendElement(NULL, listPtr, elementPtr); if (optionPtr->specPtr->objOffset != TCL_AUTO_LENGTH) { elementPtr = *((Tcl_Obj **) ((char *)recordPtr + optionPtr->specPtr->objOffset)); if (elementPtr == NULL) { elementPtr = Tcl_NewObj(); } } else { elementPtr = GetObjectForOption(recordPtr, optionPtr, tkwin); } |
︙ | ︙ | |||
1858 1859 1860 1861 1862 1863 1864 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * GetObjectForOption( | | | | | | | 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * GetObjectForOption( void *recordPtr, /* Pointer to record holding current values of * configuration options. */ Option *optionPtr, /* Pointer to information describing an option * whose internal value is stored in * *recordPtr. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { Tcl_Obj *objPtr; void *internalPtr; /* Points to internal value of option in * record. */ internalPtr = (char *)recordPtr + optionPtr->specPtr->internalOffset; objPtr = NULL; switch (optionPtr->specPtr->type) { case TK_OPTION_BOOLEAN: objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_INT: objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_DOUBLE: objPtr = Tcl_NewDoubleObj(*((double *) internalPtr)); break; case TK_OPTION_STRING: objPtr = Tcl_NewStringObj(*((char **) internalPtr), -1); break; |
︙ | ︙ | |||
1950 1951 1952 1953 1954 1955 1956 | *((Tk_Justify *) internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( *((Tk_Anchor *) internalPtr)), -1); break; case TK_OPTION_PIXELS: | | | 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 | *((Tk_Justify *) internalPtr)), -1); break; case TK_OPTION_ANCHOR: objPtr = Tcl_NewStringObj(Tk_NameOfAnchor( *((Tk_Anchor *) internalPtr)), -1); break; case TK_OPTION_PIXELS: objPtr = Tcl_NewWideIntObj(*((int *) internalPtr)); break; case TK_OPTION_WINDOW: { Tk_Window tkwin = *((Tk_Window *) internalPtr); if (tkwin != NULL) { objPtr = Tcl_NewStringObj(Tk_PathName(tkwin), -1); } |
︙ | ︙ | |||
2000 2001 2002 2003 2004 2005 2006 | */ Tcl_Obj * Tk_GetOptionValue( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL * then no messages are provided for * errors. */ | | | | | 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 | */ Tcl_Obj * Tk_GetOptionValue( Tcl_Interp *interp, /* Interpreter for error reporting. If NULL * then no messages are provided for * errors. */ void *recordPtr, /* Record whose fields contain current values * for options. */ Tk_OptionTable optionTable, /* Describes legal options. */ Tcl_Obj *namePtr, /* Gives the command-line name for the option * whose value is to be returned. */ Tk_Window tkwin) /* Window corresponding to recordPtr. */ { OptionTable *tablePtr = (OptionTable *) optionTable; Option *optionPtr; Tcl_Obj *resultPtr; optionPtr = GetOptionFromObj(interp, namePtr, tablePtr); if (optionPtr == NULL) { return NULL; } if (optionPtr->specPtr->type == TK_OPTION_SYNONYM) { optionPtr = optionPtr->extra.synonymPtr; } if (optionPtr->specPtr->objOffset != TCL_AUTO_LENGTH) { resultPtr = *((Tcl_Obj **) ((char *)recordPtr+optionPtr->specPtr->objOffset)); if (resultPtr == NULL) { /* * This option has a null value and is represented by a null * object pointer. We can't return the null pointer, since that * would indicate an error. Instead, return a new empty object. */ |
︙ | ︙ | |||
2089 2090 2091 2092 2093 2094 2095 | for (hashEntryPtr = Tcl_FirstHashEntry(&tsdPtr->hashTable, &search); hashEntryPtr != NULL; hashEntryPtr = Tcl_NextHashEntry(&search)) { if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, | | | | 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 | for (hashEntryPtr = Tcl_FirstHashEntry(&tsdPtr->hashTable, &search); hashEntryPtr != NULL; hashEntryPtr = Tcl_NextHashEntry(&search)) { if (tablePtr == (OptionTable *) Tcl_GetHashValue(hashEntryPtr)) { for ( ; tablePtr != NULL; tablePtr = tablePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(tablePtr->refCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(tablePtr->numOptions)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj( tablePtr->options[0].specPtr->optionName, -1)); } break; } } return objPtr; |
︙ | ︙ |
Changes to generic/tkConsole.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | * console. A refCount permits the struct to be shared as instance data * by commands and by channels. */ typedef struct ConsoleInfo { Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */ Tcl_Interp *interp; /* Interpreter controlled by console. */ | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * console. A refCount permits the struct to be shared as instance data * by commands and by channels. */ typedef struct ConsoleInfo { Tcl_Interp *consoleInterp; /* Interpreter displaying the console. */ Tcl_Interp *interp; /* Interpreter controlled by console. */ size_t refCount; } ConsoleInfo; /* * Each console channel holds an instance of the ChannelData struct as * its instance data. It contains ConsoleInfo, so the channel can work * with the appropriate console window, and a type value to distinguish * the stdout channel from the stderr channel. |
︙ | ︙ | |||
219 220 221 222 223 224 225 | ConsoleInfo *info; Tcl_Channel consoleChannel; /* * Ensure that we are getting a compatible version of Tcl. */ | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | ConsoleInfo *info; Tcl_Channel consoleChannel; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { return; } consoleInitPtr = Tcl_GetThreadData(&consoleInitKey, (int) sizeof(int)); if (*consoleInitPtr) { /* * We've already initialized console channels in this thread. |
︙ | ︙ | |||
452 453 454 455 456 457 458 | Tcl_Release(consoleInterp); if (result == TCL_ERROR) { Tcl_DeleteCommandFromToken(interp, token); mainWindow = Tk_MainWindow(interp); if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | Tcl_Release(consoleInterp); if (result == TCL_ERROR) { Tcl_DeleteCommandFromToken(interp, token); mainWindow = Tk_MainWindow(interp); if (mainWindow) { Tk_DeleteEventHandler(mainWindow, StructureNotifyMask, ConsoleEventProc, info); if (info->refCount-- <= 1) { ckfree(info); } } goto error; } return TCL_OK; |
︙ | ︙ | |||
592 593 594 595 596 597 598 | ClientData instanceData, /* Unused. */ Tcl_Interp *interp) /* Unused. */ { ChannelData *data = instanceData; ConsoleInfo *info = data->info; if (info) { | | | 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 | ClientData instanceData, /* Unused. */ Tcl_Interp *interp) /* Unused. */ { ChannelData *data = instanceData; ConsoleInfo *info = data->info; if (info) { if (info->refCount-- <= 1) { /* * Assuming the Tcl_Interp * fields must already be NULL. */ ckfree(info); } } |
︙ | ︙ | |||
881 882 883 884 885 886 887 | { ConsoleInfo *info = clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; } | | | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | { ConsoleInfo *info = clientData; if (info->consoleInterp == interp) { Tcl_DeleteThreadExitHandler(DeleteConsoleInterp, info->consoleInterp); info->consoleInterp = NULL; } if (info->refCount-- <= 1) { ckfree(info); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
912 913 914 915 916 917 918 | ClientData clientData) { ConsoleInfo *info = clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); } | | | 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | ClientData clientData) { ConsoleInfo *info = clientData; if (info->consoleInterp) { Tcl_DeleteInterp(info->consoleInterp); } if (info->refCount-- <= 1) { ckfree(info); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
949 950 951 952 953 954 955 | ConsoleInfo *info = clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } | | | 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | ConsoleInfo *info = clientData; Tcl_Interp *consoleInterp = info->consoleInterp; if (consoleInterp && !Tcl_InterpDeleted(consoleInterp)) { Tcl_EvalEx(consoleInterp, "tk::ConsoleExit", -1, TCL_EVAL_GLOBAL); } if (info->refCount-- <= 1) { ckfree(info); } } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkCursor.c.
︙ | ︙ | |||
424 425 426 427 428 429 430 | dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { printid: sprintf(dispPtr->cursorString, "cursor id %p", cursor); return dispPtr->cursorString; } | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { printid: sprintf(dispPtr->cursorString, "cursor id %p", cursor); return dispPtr->cursorString; } idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor); if (idHashPtr == NULL) { goto printid; } cursorPtr = Tcl_GetHashValue(idHashPtr); if (cursorPtr->otherTable != &dispPtr->cursorNameTable) { goto printid; } |
︙ | ︙ | |||
459 460 461 462 463 464 465 | static void FreeCursor( TkCursor *cursorPtr) /* Cursor to be released. */ { TkCursor *prevPtr; | < | | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | static void FreeCursor( TkCursor *cursorPtr) /* Cursor to be released. */ { TkCursor *prevPtr; if (cursorPtr->resourceRefCount-- > 1) { return; } Tcl_DeleteHashEntry(cursorPtr->idHashPtr); prevPtr = Tcl_GetHashValue(cursorPtr->hashPtr); if (prevPtr == cursorPtr) { if (cursorPtr->nextPtr == NULL) { |
︙ | ︙ | |||
514 515 516 517 518 519 520 | Tcl_HashEntry *idHashPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { Tcl_Panic("Tk_FreeCursor called before Tk_GetCursor"); } | | | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | Tcl_HashEntry *idHashPtr; TkDisplay *dispPtr = TkGetDisplay(display); if (!dispPtr->cursorInit) { Tcl_Panic("Tk_FreeCursor called before Tk_GetCursor"); } idHashPtr = Tcl_FindHashEntry(&dispPtr->cursorIdTable, cursor); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeCursor received unknown cursor argument"); } FreeCursor(Tcl_GetHashValue(idHashPtr)); } /* |
︙ | ︙ | |||
586 587 588 589 590 591 592 | static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { | < | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | static void FreeCursorObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkCursor *cursorPtr = objPtr->internalRep.twoPtrValue.ptr1; if (cursorPtr != NULL) { if ((cursorPtr->objRefCount-- <= 1) && (cursorPtr->resourceRefCount == 0)) { ckfree(cursorPtr); } objPtr->internalRep.twoPtrValue.ptr1 = NULL; } } |
︙ | ︙ | |||
860 861 862 863 864 865 866 | cursorPtr = Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | cursorPtr = Tcl_GetHashValue(hashPtr); if (cursorPtr == NULL) { Tcl_Panic("TkDebugCursor found empty hash table entry"); } for ( ; (cursorPtr != NULL); cursorPtr = cursorPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(cursorPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(cursorPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkDList.h.
︙ | ︙ | |||
38 39 40 41 42 43 44 | * ------------------------------------------------------------------------------- * IMPORTANT NOTE: TK_DLIST_LINKS must be used at start of struct! */ #ifndef TK_DLIST_DEFINED #define TK_DLIST_DEFINED | | < | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * ------------------------------------------------------------------------------- * IMPORTANT NOTE: TK_DLIST_LINKS must be used at start of struct! */ #ifndef TK_DLIST_DEFINED #define TK_DLIST_DEFINED #include "tkInt.h" /* * List definitions. */ #define TK_DLIST_LINKS(ElemType) \ struct { \ |
︙ | ︙ |
Changes to generic/tkDecls.h.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #define _TKDECLS #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #endif /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made * in the generic/tk.decls script. */ /* !BEGIN!: Do not edit below this line. */ | > > > > > > > > | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #define _TKDECLS #ifdef BUILD_tk #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLEXPORT #endif #if !defined(BUILD_tk) # define TK_DEPRECATED(msg) EXTERN TCL_DEPRECATED_API(msg) #elif defined(TK_NO_DEPRECATED) # define TK_DEPRECATED(msg) MODULE_SCOPE #else # define TK_DEPRECATED(msg) EXTERN #endif /* * WARNING: This file is automatically generated by the tools/genStubs.tcl * script. Any modifications to the function declarations below should be made * in the generic/tk.decls script. */ /* !BEGIN!: Do not edit below this line. */ |
︙ | ︙ | |||
91 92 93 94 95 96 97 | /* 17 */ EXTERN void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc); /* 18 */ EXTERN int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 19 */ | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /* 17 */ EXTERN void Tk_CanvasSetStippleOrigin(Tk_Canvas canvas, GC gc); /* 18 */ EXTERN int Tk_CanvasTagsParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 19 */ EXTERN const char * Tk_CanvasTagsPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 20 */ EXTERN Tk_Window Tk_CanvasTkwin(Tk_Canvas canvas); /* 21 */ EXTERN void Tk_CanvasWindowCoords(Tk_Canvas canvas, double x, double y, short *screenXPtr, |
︙ | ︙ | |||
129 130 131 132 133 134 135 | EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | EXTERN int Tk_ConfigureValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 29 */ EXTERN int Tk_ConfigureWidget(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, const char **argv, char *widgRec, int flags); /* 30 */ EXTERN void Tk_ConfigureWindow(Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 31 */ EXTERN Tk_TextLayout Tk_ComputeTextLayout(Tk_Font font, const char *str, |
︙ | ︙ | |||
211 212 213 214 215 216 217 | EXTERN void Tk_DeleteImage(Tcl_Interp *interp, const char *name); /* 53 */ EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target); /* 54 */ EXTERN void Tk_DestroyWindow(Tk_Window tkwin); /* 55 */ | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | EXTERN void Tk_DeleteImage(Tcl_Interp *interp, const char *name); /* 53 */ EXTERN void Tk_DeleteSelHandler(Tk_Window tkwin, Atom selection, Atom target); /* 54 */ EXTERN void Tk_DestroyWindow(Tk_Window tkwin); /* 55 */ EXTERN const char * Tk_DisplayName(Tk_Window tkwin); /* 56 */ EXTERN int Tk_DistanceToTextLayout(Tk_TextLayout layout, int x, int y); /* 57 */ EXTERN void Tk_Draw3DPolygon(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, |
︙ | ︙ | |||
277 278 279 280 281 282 283 | char *widgRec, Display *display, int needFlags); /* 75 */ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap); /* 76 */ EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout); /* 77 */ | > | | | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | char *widgRec, Display *display, int needFlags); /* 75 */ EXTERN void Tk_FreePixmap(Display *display, Pixmap pixmap); /* 76 */ EXTERN void Tk_FreeTextLayout(Tk_TextLayout textLayout); /* 77 */ TK_DEPRECATED("function does nothing, call can be removed") void Tk_FreeXId(Display *display, XID xid); /* 78 */ EXTERN GC Tk_GCForColor(XColor *colorPtr, Drawable drawable); /* 79 */ EXTERN void Tk_GeometryRequest(Tk_Window tkwin, int reqWidth, int reqHeight); /* 80 */ EXTERN Tk_3DBorder Tk_Get3DBorder(Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 81 */ EXTERN void Tk_GetAllBindings(Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object); /* 82 */ EXTERN int Tk_GetAnchor(Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr); /* 83 */ EXTERN const char * Tk_GetAtomName(Tk_Window tkwin, Atom atom); /* 84 */ EXTERN const char * Tk_GetBinding(Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr); /* 85 */ EXTERN Pixmap Tk_GetBitmap(Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 86 */ EXTERN Pixmap Tk_GetBitmapFromData(Tcl_Interp *interp, |
︙ | ︙ | |||
344 345 346 347 348 349 350 | EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 98 */ EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp, const char *name, | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | EXTERN Tk_Image Tk_GetImage(Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 98 */ EXTERN ClientData Tk_GetImageMasterData(Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 99 */ EXTERN Tk_ItemType * Tk_GetItemTypes(void); /* 100 */ EXTERN int Tk_GetJoinStyle(Tcl_Interp *interp, const char *str, int *joinPtr); /* 101 */ EXTERN int Tk_GetJustify(Tcl_Interp *interp, const char *str, |
︙ | ︙ | |||
372 373 374 375 376 377 378 | EXTERN int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr); /* 107 */ EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr); /* 108 */ EXTERN int Tk_GetScrollInfo(Tcl_Interp *interp, int argc, | | | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | EXTERN int Tk_GetRelief(Tcl_Interp *interp, const char *name, int *reliefPtr); /* 107 */ EXTERN void Tk_GetRootCoords(Tk_Window tkwin, int *xPtr, int *yPtr); /* 108 */ EXTERN int Tk_GetScrollInfo(Tcl_Interp *interp, int argc, const char **argv, double *dblPtr, int *intPtr); /* 109 */ EXTERN int Tk_GetScreenMM(Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr); /* 110 */ EXTERN int Tk_GetSelection(Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, |
︙ | ︙ | |||
434 435 436 437 438 439 440 | EXTERN void Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y, int width, int height); /* 128 */ EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y); /* 129 */ EXTERN void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y); /* 130 */ | | | | | | | < | | | | | | > | > | > | > | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | EXTERN void Tk_MoveResizeWindow(Tk_Window tkwin, int x, int y, int width, int height); /* 128 */ EXTERN void Tk_MoveWindow(Tk_Window tkwin, int x, int y); /* 129 */ EXTERN void Tk_MoveToplevelWindow(Tk_Window tkwin, int x, int y); /* 130 */ EXTERN const char * Tk_NameOf3DBorder(Tk_3DBorder border); /* 131 */ EXTERN const char * Tk_NameOfAnchor(Tk_Anchor anchor); /* 132 */ EXTERN const char * Tk_NameOfBitmap(Display *display, Pixmap bitmap); /* 133 */ EXTERN const char * Tk_NameOfCapStyle(int cap); /* 134 */ EXTERN const char * Tk_NameOfColor(XColor *colorPtr); /* 135 */ EXTERN const char * Tk_NameOfCursor(Display *display, Tk_Cursor cursor); /* 136 */ EXTERN const char * Tk_NameOfFont(Tk_Font font); /* 137 */ EXTERN const char * Tk_NameOfImage(Tk_ImageMaster imageMaster); /* 138 */ EXTERN const char * Tk_NameOfJoinStyle(int join); /* 139 */ EXTERN const char * Tk_NameOfJustify(Tk_Justify justify); /* 140 */ EXTERN const char * Tk_NameOfRelief(int relief); /* 141 */ EXTERN Tk_Window Tk_NameToWindow(Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 142 */ EXTERN void Tk_OwnSelection(Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, ClientData clientData); /* 143 */ EXTERN int Tk_ParseArgv(Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* 144 */ TK_DEPRECATED("function signature changed") void Tk_PhotoPutBlock_NoComposite(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 145 */ TK_DEPRECATED("function signature changed") void Tk_PhotoPutZoomedBlock_NoComposite( Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 146 */ EXTERN int Tk_PhotoGetImage(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 147 */ EXTERN void Tk_PhotoBlank(Tk_PhotoHandle handle); /* 148 */ TK_DEPRECATED("function signature changed") void Tk_PhotoExpand_Panic(Tk_PhotoHandle handle, int width, int height); /* 149 */ EXTERN void Tk_PhotoGetSize(Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 150 */ TK_DEPRECATED("function signature changed") void Tk_PhotoSetSize_Panic(Tk_PhotoHandle handle, int width, int height); /* 151 */ EXTERN int Tk_PointToChar(Tk_TextLayout layout, int x, int y); /* 152 */ EXTERN int Tk_PostscriptFontName(Tk_Font tkfont, Tcl_DString *dsPtr); /* 153 */ |
︙ | ︙ | |||
616 617 618 619 620 621 622 | Tcl_Obj *objPtr); /* 193 */ EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */ EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 195 */ | | | 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | Tcl_Obj *objPtr); /* 193 */ EXTERN void Tk_FreeBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */ EXTERN void Tk_FreeColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 195 */ EXTERN void Tk_FreeConfigOptions(void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 196 */ EXTERN void Tk_FreeSavedOptions(Tk_SavedOptions *savePtr); /* 197 */ EXTERN void Tk_FreeCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 198 */ |
︙ | ︙ | |||
638 639 640 641 642 643 644 | /* 201 */ EXTERN Pixmap Tk_GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */ EXTERN XColor * Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 204 */ | | | | | | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | /* 201 */ EXTERN Pixmap Tk_GetBitmapFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */ EXTERN XColor * Tk_GetColorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ EXTERN Tk_Cursor Tk_GetCursorFromObj(Tk_Window tkwin, Tcl_Obj *objPtr); /* 204 */ EXTERN Tcl_Obj * Tk_GetOptionInfo(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ EXTERN Tcl_Obj * Tk_GetOptionValue(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 206 */ EXTERN int Tk_GetJustifyFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 207 */ EXTERN int Tk_GetMMFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 208 */ EXTERN int Tk_GetPixelsFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 209 */ EXTERN int Tk_GetReliefFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 210 */ EXTERN int Tk_GetScrollInfoObj(Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 211 */ EXTERN int Tk_InitOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 212 */ EXTERN void Tk_MainEx(int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 213 */ EXTERN void Tk_RestoreSavedOptions(Tk_SavedOptions *savePtr); /* 214 */ EXTERN int Tk_SetOptions(Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 215 */ EXTERN void Tk_InitConsoleChannels(Tcl_Interp *interp); /* 216 */ EXTERN int Tk_CreateConsoleWindow(Tcl_Interp *interp); |
︙ | ︙ | |||
772 773 774 775 776 777 778 | /* 244 */ EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin, int minWidth, int minHeight); /* 245 */ EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height); /* 246 */ | > | > | | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | /* 244 */ EXTERN void Tk_SetMinimumRequestSize(Tk_Window tkwin, int minWidth, int minHeight); /* 245 */ EXTERN void Tk_SetCaretPos(Tk_Window tkwin, int x, int y, int height); /* 246 */ TK_DEPRECATED("function signature changed") void Tk_PhotoPutBlock_Panic(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 247 */ TK_DEPRECATED("function signature changed") void Tk_PhotoPutZoomedBlock_Panic(Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 248 */ EXTERN int Tk_CollapseMotionEvents(Display *display, int collapse); /* 249 */ |
︙ | ︙ | |||
814 815 816 817 818 819 820 | /* 259 */ EXTERN void Tk_FreeStyleFromObj(Tcl_Obj *objPtr); /* 260 */ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 261 */ EXTERN void Tk_GetElementSize(Tk_Style style, | | | | | | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | /* 259 */ EXTERN void Tk_FreeStyleFromObj(Tcl_Obj *objPtr); /* 260 */ EXTERN Tk_StyledElement Tk_GetStyledElement(Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 261 */ EXTERN void Tk_GetElementSize(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 262 */ EXTERN void Tk_GetElementBox(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 263 */ EXTERN int Tk_GetElementBorderWidth(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 264 */ EXTERN void Tk_DrawElement(Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 265 */ EXTERN int Tk_PhotoExpand(Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 266 */ EXTERN int Tk_PhotoPutBlock(Tcl_Interp *interp, |
︙ | ︙ | |||
891 892 893 894 895 896 897 | int (*tk_CanvasPsColor) (Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 12 */ int (*tk_CanvasPsFont) (Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 13 */ void (*tk_CanvasPsPath) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, int numPoints); /* 14 */ int (*tk_CanvasPsStipple) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap); /* 15 */ double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */ void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */ int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 18 */ | | | | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | int (*tk_CanvasPsColor) (Tcl_Interp *interp, Tk_Canvas canvas, XColor *colorPtr); /* 12 */ int (*tk_CanvasPsFont) (Tcl_Interp *interp, Tk_Canvas canvas, Tk_Font font); /* 13 */ void (*tk_CanvasPsPath) (Tcl_Interp *interp, Tk_Canvas canvas, double *coordPtr, int numPoints); /* 14 */ int (*tk_CanvasPsStipple) (Tcl_Interp *interp, Tk_Canvas canvas, Pixmap bitmap); /* 15 */ double (*tk_CanvasPsY) (Tk_Canvas canvas, double y); /* 16 */ void (*tk_CanvasSetStippleOrigin) (Tk_Canvas canvas, GC gc); /* 17 */ int (*tk_CanvasTagsParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 18 */ const char * (*tk_CanvasTagsPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 19 */ Tk_Window (*tk_CanvasTkwin) (Tk_Canvas canvas); /* 20 */ void (*tk_CanvasWindowCoords) (Tk_Canvas canvas, double x, double y, short *screenXPtr, short *screenYPtr); /* 21 */ void (*tk_ChangeWindowAttributes) (Tk_Window tkwin, unsigned long valueMask, XSetWindowAttributes *attsPtr); /* 22 */ int (*tk_CharBbox) (Tk_TextLayout layout, int index, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 23 */ void (*tk_ClearSelection) (Tk_Window tkwin, Atom selection); /* 24 */ int (*tk_ClipboardAppend) (Tcl_Interp *interp, Tk_Window tkwin, Atom target, Atom format, const char *buffer); /* 25 */ int (*tk_ClipboardClear) (Tcl_Interp *interp, Tk_Window tkwin); /* 26 */ int (*tk_ConfigureInfo) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 27 */ int (*tk_ConfigureValue) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, char *widgRec, const char *argvName, int flags); /* 28 */ int (*tk_ConfigureWidget) (Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specs, int argc, const char **argv, char *widgRec, int flags); /* 29 */ void (*tk_ConfigureWindow) (Tk_Window tkwin, unsigned int valueMask, XWindowChanges *valuePtr); /* 30 */ Tk_TextLayout (*tk_ComputeTextLayout) (Tk_Font font, const char *str, int numChars, int wrapLength, Tk_Justify justify, int flags, int *widthPtr, int *heightPtr); /* 31 */ Tk_Window (*tk_CoordsToWindow) (int rootX, int rootY, Tk_Window tkwin); /* 32 */ unsigned long (*tk_CreateBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr, const char *script, int append); /* 33 */ Tk_BindingTable (*tk_CreateBindingTable) (Tcl_Interp *interp); /* 34 */ Tk_ErrorHandler (*tk_CreateErrorHandler) (Display *display, int errNum, int request, int minorCode, Tk_ErrorProc *errorProc, ClientData clientData); /* 35 */ void (*tk_CreateEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 36 */ |
︙ | ︙ | |||
927 928 929 930 931 932 933 | void (*tk_DeleteBindingTable) (Tk_BindingTable bindingTable); /* 48 */ void (*tk_DeleteErrorHandler) (Tk_ErrorHandler handler); /* 49 */ void (*tk_DeleteEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 50 */ void (*tk_DeleteGenericHandler) (Tk_GenericProc *proc, ClientData clientData); /* 51 */ void (*tk_DeleteImage) (Tcl_Interp *interp, const char *name); /* 52 */ void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */ void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */ | | | 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | void (*tk_DeleteBindingTable) (Tk_BindingTable bindingTable); /* 48 */ void (*tk_DeleteErrorHandler) (Tk_ErrorHandler handler); /* 49 */ void (*tk_DeleteEventHandler) (Tk_Window token, unsigned long mask, Tk_EventProc *proc, ClientData clientData); /* 50 */ void (*tk_DeleteGenericHandler) (Tk_GenericProc *proc, ClientData clientData); /* 51 */ void (*tk_DeleteImage) (Tcl_Interp *interp, const char *name); /* 52 */ void (*tk_DeleteSelHandler) (Tk_Window tkwin, Atom selection, Atom target); /* 53 */ void (*tk_DestroyWindow) (Tk_Window tkwin); /* 54 */ const char * (*tk_DisplayName) (Tk_Window tkwin); /* 55 */ int (*tk_DistanceToTextLayout) (Tk_TextLayout layout, int x, int y); /* 56 */ void (*tk_Draw3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, int leftRelief); /* 57 */ void (*tk_Draw3DRectangle) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int x, int y, int width, int height, int borderWidth, int relief); /* 58 */ void (*tk_DrawChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int x, int y); /* 59 */ void (*tk_DrawFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable); /* 60 */ void (*tk_DrawTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, int firstChar, int lastChar); /* 61 */ void (*tk_Fill3DPolygon) (Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, XPoint *pointPtr, int numPoints, int borderWidth, int leftRelief); /* 62 */ |
︙ | ︙ | |||
949 950 951 952 953 954 955 | void (*tk_FreeCursor) (Display *display, Tk_Cursor cursor); /* 70 */ void (*tk_FreeFont) (Tk_Font f); /* 71 */ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */ void (*tk_FreeImage) (Tk_Image image); /* 73 */ void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ | | | | | | | 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | void (*tk_FreeCursor) (Display *display, Tk_Cursor cursor); /* 70 */ void (*tk_FreeFont) (Tk_Font f); /* 71 */ void (*tk_FreeGC) (Display *display, GC gc); /* 72 */ void (*tk_FreeImage) (Tk_Image image); /* 73 */ void (*tk_FreeOptions) (const Tk_ConfigSpec *specs, char *widgRec, Display *display, int needFlags); /* 74 */ void (*tk_FreePixmap) (Display *display, Pixmap pixmap); /* 75 */ void (*tk_FreeTextLayout) (Tk_TextLayout textLayout); /* 76 */ TCL_DEPRECATED_API("function does nothing, call can be removed") void (*tk_FreeXId) (Display *display, XID xid); /* 77 */ GC (*tk_GCForColor) (XColor *colorPtr, Drawable drawable); /* 78 */ void (*tk_GeometryRequest) (Tk_Window tkwin, int reqWidth, int reqHeight); /* 79 */ Tk_3DBorder (*tk_Get3DBorder) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid colorName); /* 80 */ void (*tk_GetAllBindings) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object); /* 81 */ int (*tk_GetAnchor) (Tcl_Interp *interp, const char *str, Tk_Anchor *anchorPtr); /* 82 */ const char * (*tk_GetAtomName) (Tk_Window tkwin, Atom atom); /* 83 */ const char * (*tk_GetBinding) (Tcl_Interp *interp, Tk_BindingTable bindingTable, ClientData object, const char *eventStr); /* 84 */ Pixmap (*tk_GetBitmap) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 85 */ Pixmap (*tk_GetBitmapFromData) (Tcl_Interp *interp, Tk_Window tkwin, const void *source, int width, int height); /* 86 */ int (*tk_GetCapStyle) (Tcl_Interp *interp, const char *str, int *capPtr); /* 87 */ XColor * (*tk_GetColor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid name); /* 88 */ XColor * (*tk_GetColorByValue) (Tk_Window tkwin, XColor *colorPtr); /* 89 */ Colormap (*tk_GetColormap) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 90 */ Tk_Cursor (*tk_GetCursor) (Tcl_Interp *interp, Tk_Window tkwin, Tk_Uid str); /* 91 */ Tk_Cursor (*tk_GetCursorFromData) (Tcl_Interp *interp, Tk_Window tkwin, const char *source, const char *mask, int width, int height, int xHot, int yHot, Tk_Uid fg, Tk_Uid bg); /* 92 */ Tk_Font (*tk_GetFont) (Tcl_Interp *interp, Tk_Window tkwin, const char *str); /* 93 */ Tk_Font (*tk_GetFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 94 */ void (*tk_GetFontMetrics) (Tk_Font font, Tk_FontMetrics *fmPtr); /* 95 */ GC (*tk_GetGC) (Tk_Window tkwin, unsigned long valueMask, XGCValues *valuePtr); /* 96 */ Tk_Image (*tk_GetImage) (Tcl_Interp *interp, Tk_Window tkwin, const char *name, Tk_ImageChangedProc *changeProc, ClientData clientData); /* 97 */ ClientData (*tk_GetImageMasterData) (Tcl_Interp *interp, const char *name, const Tk_ImageType **typePtrPtr); /* 98 */ Tk_ItemType * (*tk_GetItemTypes) (void); /* 99 */ int (*tk_GetJoinStyle) (Tcl_Interp *interp, const char *str, int *joinPtr); /* 100 */ int (*tk_GetJustify) (Tcl_Interp *interp, const char *str, Tk_Justify *justifyPtr); /* 101 */ int (*tk_GetNumMainWindows) (void); /* 102 */ Tk_Uid (*tk_GetOption) (Tk_Window tkwin, const char *name, const char *className); /* 103 */ int (*tk_GetPixels) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *intPtr); /* 104 */ Pixmap (*tk_GetPixmap) (Display *display, Drawable d, int width, int height, int depth); /* 105 */ int (*tk_GetRelief) (Tcl_Interp *interp, const char *name, int *reliefPtr); /* 106 */ void (*tk_GetRootCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 107 */ int (*tk_GetScrollInfo) (Tcl_Interp *interp, int argc, const char **argv, double *dblPtr, int *intPtr); /* 108 */ int (*tk_GetScreenMM) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, double *doublePtr); /* 109 */ int (*tk_GetSelection) (Tcl_Interp *interp, Tk_Window tkwin, Atom selection, Atom target, Tk_GetSelProc *proc, ClientData clientData); /* 110 */ Tk_Uid (*tk_GetUid) (const char *str); /* 111 */ Visual * (*tk_GetVisual) (Tcl_Interp *interp, Tk_Window tkwin, const char *str, int *depthPtr, Colormap *colormapPtr); /* 112 */ void (*tk_GetVRootGeometry) (Tk_Window tkwin, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 113 */ int (*tk_Grab) (Tcl_Interp *interp, Tk_Window tkwin, int grabGlobal); /* 114 */ void (*tk_HandleEvent) (XEvent *eventPtr); /* 115 */ |
︙ | ︙ | |||
1002 1003 1004 1005 1006 1007 1008 | void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */ void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */ void (*tk_MapWindow) (Tk_Window tkwin); /* 125 */ int (*tk_MeasureChars) (Tk_Font tkfont, const char *source, int numBytes, int maxPixels, int flags, int *lengthPtr); /* 126 */ void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */ void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */ void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */ | | | | | | | | | | | | | | | | | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | void (*tk_MakeWindowExist) (Tk_Window tkwin); /* 123 */ void (*tk_ManageGeometry) (Tk_Window tkwin, const Tk_GeomMgr *mgrPtr, ClientData clientData); /* 124 */ void (*tk_MapWindow) (Tk_Window tkwin); /* 125 */ int (*tk_MeasureChars) (Tk_Font tkfont, const char *source, int numBytes, int maxPixels, int flags, int *lengthPtr); /* 126 */ void (*tk_MoveResizeWindow) (Tk_Window tkwin, int x, int y, int width, int height); /* 127 */ void (*tk_MoveWindow) (Tk_Window tkwin, int x, int y); /* 128 */ void (*tk_MoveToplevelWindow) (Tk_Window tkwin, int x, int y); /* 129 */ const char * (*tk_NameOf3DBorder) (Tk_3DBorder border); /* 130 */ const char * (*tk_NameOfAnchor) (Tk_Anchor anchor); /* 131 */ const char * (*tk_NameOfBitmap) (Display *display, Pixmap bitmap); /* 132 */ const char * (*tk_NameOfCapStyle) (int cap); /* 133 */ const char * (*tk_NameOfColor) (XColor *colorPtr); /* 134 */ const char * (*tk_NameOfCursor) (Display *display, Tk_Cursor cursor); /* 135 */ const char * (*tk_NameOfFont) (Tk_Font font); /* 136 */ const char * (*tk_NameOfImage) (Tk_ImageMaster imageMaster); /* 137 */ const char * (*tk_NameOfJoinStyle) (int join); /* 138 */ const char * (*tk_NameOfJustify) (Tk_Justify justify); /* 139 */ const char * (*tk_NameOfRelief) (int relief); /* 140 */ Tk_Window (*tk_NameToWindow) (Tcl_Interp *interp, const char *pathName, Tk_Window tkwin); /* 141 */ void (*tk_OwnSelection) (Tk_Window tkwin, Atom selection, Tk_LostSelProc *proc, ClientData clientData); /* 142 */ int (*tk_ParseArgv) (Tcl_Interp *interp, Tk_Window tkwin, int *argcPtr, const char **argv, const Tk_ArgvInfo *argTable, int flags); /* 143 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height); /* 144 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_NoComposite) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY); /* 145 */ int (*tk_PhotoGetImage) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr); /* 146 */ void (*tk_PhotoBlank) (Tk_PhotoHandle handle); /* 147 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoExpand_Panic) (Tk_PhotoHandle handle, int width, int height); /* 148 */ void (*tk_PhotoGetSize) (Tk_PhotoHandle handle, int *widthPtr, int *heightPtr); /* 149 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoSetSize_Panic) (Tk_PhotoHandle handle, int width, int height); /* 150 */ int (*tk_PointToChar) (Tk_TextLayout layout, int x, int y); /* 151 */ int (*tk_PostscriptFontName) (Tk_Font tkfont, Tcl_DString *dsPtr); /* 152 */ void (*tk_PreserveColormap) (Display *display, Colormap colormap); /* 153 */ void (*tk_QueueWindowEvent) (XEvent *eventPtr, Tcl_QueuePosition position); /* 154 */ void (*tk_RedrawImage) (Tk_Image image, int imageX, int imageY, int width, int height, Drawable drawable, int drawableX, int drawableY); /* 155 */ void (*tk_ResizeWindow) (Tk_Window tkwin, int width, int height); /* 156 */ int (*tk_RestackWindow) (Tk_Window tkwin, int aboveBelow, Tk_Window other); /* 157 */ |
︙ | ︙ | |||
1067 1068 1069 1070 1071 1072 1073 | Tk_Cursor (*tk_AllocCursorFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 188 */ Tk_Font (*tk_AllocFontFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 189 */ Tk_OptionTable (*tk_CreateOptionTable) (Tcl_Interp *interp, const Tk_OptionSpec *templatePtr); /* 190 */ void (*tk_DeleteOptionTable) (Tk_OptionTable optionTable); /* 191 */ void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 192 */ void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 193 */ void (*tk_FreeColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */ | | | | | | | | 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | Tk_Cursor (*tk_AllocCursorFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 188 */ Tk_Font (*tk_AllocFontFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr); /* 189 */ Tk_OptionTable (*tk_CreateOptionTable) (Tcl_Interp *interp, const Tk_OptionSpec *templatePtr); /* 190 */ void (*tk_DeleteOptionTable) (Tk_OptionTable optionTable); /* 191 */ void (*tk_Free3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 192 */ void (*tk_FreeBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 193 */ void (*tk_FreeColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 194 */ void (*tk_FreeConfigOptions) (void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 195 */ void (*tk_FreeSavedOptions) (Tk_SavedOptions *savePtr); /* 196 */ void (*tk_FreeCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 197 */ void (*tk_FreeFontFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 198 */ Tk_3DBorder (*tk_Get3DBorderFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 199 */ int (*tk_GetAnchorFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Anchor *anchorPtr); /* 200 */ Pixmap (*tk_GetBitmapFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 201 */ XColor * (*tk_GetColorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 202 */ Tk_Cursor (*tk_GetCursorFromObj) (Tk_Window tkwin, Tcl_Obj *objPtr); /* 203 */ Tcl_Obj * (*tk_GetOptionInfo) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 204 */ Tcl_Obj * (*tk_GetOptionValue) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, Tcl_Obj *namePtr, Tk_Window tkwin); /* 205 */ int (*tk_GetJustifyFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, Tk_Justify *justifyPtr); /* 206 */ int (*tk_GetMMFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, double *doublePtr); /* 207 */ int (*tk_GetPixelsFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, int *intPtr); /* 208 */ int (*tk_GetReliefFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr); /* 209 */ int (*tk_GetScrollInfoObj) (Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); /* 210 */ int (*tk_InitOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionToken, Tk_Window tkwin); /* 211 */ TCL_DEPRECATED_API("Don't use this function in a stub-enabled extension") void (*tk_MainEx) (int argc, char **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); /* 212 */ void (*tk_RestoreSavedOptions) (Tk_SavedOptions *savePtr); /* 213 */ int (*tk_SetOptions) (Tcl_Interp *interp, void *recordPtr, Tk_OptionTable optionTable, int objc, Tcl_Obj *const objv[], Tk_Window tkwin, Tk_SavedOptions *savePtr, int *maskPtr); /* 214 */ void (*tk_InitConsoleChannels) (Tcl_Interp *interp); /* 215 */ int (*tk_CreateConsoleWindow) (Tcl_Interp *interp); /* 216 */ void (*tk_CreateSmoothMethod) (Tcl_Interp *interp, const Tk_SmoothMethod *method); /* 217 */ void (*reserved218)(void); void (*reserved219)(void); int (*tk_GetDash) (Tcl_Interp *interp, const char *value, Tk_Dash *dash); /* 220 */ void (*tk_CreateOutline) (Tk_Outline *outline); /* 221 */ |
︙ | ︙ | |||
1118 1119 1120 1121 1122 1123 1124 | void (*tk_CreateClientMessageHandler) (Tk_ClientMessageProc *proc); /* 239 */ void (*tk_DeleteClientMessageHandler) (Tk_ClientMessageProc *proc); /* 240 */ Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp *interp, Tk_Window parent, const char *screenName); /* 241 */ void (*tk_SetClassProcs) (Tk_Window tkwin, const Tk_ClassProcs *procs, ClientData instanceData); /* 242 */ void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */ void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */ void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */ | | | | | | | | 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 | void (*tk_CreateClientMessageHandler) (Tk_ClientMessageProc *proc); /* 239 */ void (*tk_DeleteClientMessageHandler) (Tk_ClientMessageProc *proc); /* 240 */ Tk_Window (*tk_CreateAnonymousWindow) (Tcl_Interp *interp, Tk_Window parent, const char *screenName); /* 241 */ void (*tk_SetClassProcs) (Tk_Window tkwin, const Tk_ClassProcs *procs, ClientData instanceData); /* 242 */ void (*tk_SetInternalBorderEx) (Tk_Window tkwin, int left, int right, int top, int bottom); /* 243 */ void (*tk_SetMinimumRequestSize) (Tk_Window tkwin, int minWidth, int minHeight); /* 244 */ void (*tk_SetCaretPos) (Tk_Window tkwin, int x, int y, int height); /* 245 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 246 */ TCL_DEPRECATED_API("function signature changed") void (*tk_PhotoPutZoomedBlock_Panic) (Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 247 */ int (*tk_CollapseMotionEvents) (Display *display, int collapse); /* 248 */ Tk_StyleEngine (*tk_RegisterStyleEngine) (const char *name, Tk_StyleEngine parent); /* 249 */ Tk_StyleEngine (*tk_GetStyleEngine) (const char *name); /* 250 */ int (*tk_RegisterStyledElement) (Tk_StyleEngine engine, Tk_ElementSpec *templatePtr); /* 251 */ int (*tk_GetElementId) (const char *name); /* 252 */ Tk_Style (*tk_CreateStyle) (const char *name, Tk_StyleEngine engine, ClientData clientData); /* 253 */ Tk_Style (*tk_GetStyle) (Tcl_Interp *interp, const char *name); /* 254 */ void (*tk_FreeStyle) (Tk_Style style); /* 255 */ const char * (*tk_NameOfStyle) (Tk_Style style); /* 256 */ Tk_Style (*tk_AllocStyleFromObj) (Tcl_Interp *interp, Tcl_Obj *objPtr); /* 257 */ Tk_Style (*tk_GetStyleFromObj) (Tcl_Obj *objPtr); /* 258 */ void (*tk_FreeStyleFromObj) (Tcl_Obj *objPtr); /* 259 */ Tk_StyledElement (*tk_GetStyledElement) (Tk_Style style, int elementId, Tk_OptionTable optionTable); /* 260 */ void (*tk_GetElementSize) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int width, int height, int inner, int *widthPtr, int *heightPtr); /* 261 */ void (*tk_GetElementBox) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, int x, int y, int width, int height, int inner, int *xPtr, int *yPtr, int *widthPtr, int *heightPtr); /* 262 */ int (*tk_GetElementBorderWidth) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin); /* 263 */ void (*tk_DrawElement) (Tk_Style style, Tk_StyledElement element, void *recordPtr, Tk_Window tkwin, Drawable d, int x, int y, int width, int height, int state); /* 264 */ int (*tk_PhotoExpand) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 265 */ int (*tk_PhotoPutBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int compRule); /* 266 */ int (*tk_PhotoPutZoomedBlock) (Tcl_Interp *interp, Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height, int zoomX, int zoomY, int subsampleX, int subsampleY, int compRule); /* 267 */ int (*tk_PhotoSetSize) (Tcl_Interp *interp, Tk_PhotoHandle handle, int width, int height); /* 268 */ long (*tk_GetUserInactiveTime) (Display *dpy); /* 269 */ void (*tk_ResetUserInactiveTime) (Display *dpy); /* 270 */ Tcl_Interp * (*tk_Interp) (Tk_Window tkwin); /* 271 */ |
︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 | /* !END!: Do not edit above this line. */ /* Functions that don't belong in the stub table */ #undef Tk_MainEx #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKDECLS */ | > > > > > > > > > > > > > > > > > > | 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 | /* !END!: Do not edit above this line. */ /* Functions that don't belong in the stub table */ #undef Tk_MainEx #undef Tk_Init #undef Tk_SafeInit #undef Tk_CreateConsoleWindow #undef Tk_FreeXId #define Tk_FreeXId(display,xid) #undef Tk_GetStyleFromObj #undef Tk_FreeStyleFromObj #define Tk_GetStyleFromObj(obj) Tk_AllocStyleFromObj(NULL, obj) #define Tk_FreeStyleFromObj(obj) /* no-op */ #if defined(_WIN32) && defined(UNICODE) # define Tk_MainEx Tk_MainExW EXTERN void Tk_MainExW(int argc, wchar_t **argv, Tcl_AppInitProc *appInitProc, Tcl_Interp *interp); #endif #if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 #undef Tk_PhotoPutBlock_NoComposite #undef Tk_PhotoPutZoomedBlock_NoComposite #undef Tk_PhotoExpand_Panic #undef Tk_PhotoPutBlock_Panic #undef Tk_PhotoPutZoomedBlock_Panic #undef Tk_PhotoSetSize_Panic #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKDECLS */ |
Changes to generic/tkEntry.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | * Copyright (c) 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" | < > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | * Copyright (c) 2002 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkEntry.h" #include "default.h" /* * The following macro defines how many extra pixels to leave on each side of * the text in the entry. */ #define XPAD 1 |
︙ | ︙ | |||
59 60 61 62 63 64 65 | /* * Information used for Entry objv parsing. */ static const Tk_OptionSpec entryOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | | | | | | | | | | > > > > > > | | | | | | | | | | | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | /* * Information used for Entry objv parsing. */ static const Tk_OptionSpec entryOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_ENTRY_BG_COLOR, -1, offsetof(Entry, normalBorder), 0, DEF_ENTRY_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_ENTRY_BORDER_WIDTH, -1, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, -1, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1, offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1, offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_ENTRY_FONT, -1, offsetof(Entry, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_ENTRY_FG, -1, offsetof(Entry, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG, -1, offsetof(Entry, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_ENTRY_HIGHLIGHT, -1, offsetof(Entry, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1, offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, -1, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1, offsetof(Entry, insertBorderWidth), 0, (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_ENTRY_INSERT_OFF_TIME, -1, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_ENTRY_INSERT_ON_TIME, -1, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_ENTRY_INSERT_WIDTH, -1, offsetof(Entry, insertWidth), 0, 0, 0}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", DEF_ENTRY_INVALIDCMD, -1, offsetof(Entry, invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL, NULL, 0, -1, 0, "-invalidcommand", 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_ENTRY_JUSTIFY, -1, offsetof(Entry, justify), 0, 0, 0}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", DEF_ENTRY_PLACEHOLDER, -1, offsetof(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, -1, offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1, offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_ENTRY_RELIEF, -1, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_ENTRY_SELECT_COLOR, -1, offsetof(Entry, selBorder), 0, DEF_ENTRY_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1, offsetof(Entry, selBorderWidth), 0, DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_ENTRY_SELECT_FG_COLOR, -1, offsetof(Entry, selFgColorPtr), TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-show", "show", "Show", DEF_ENTRY_SHOW, -1, offsetof(Entry, showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_ENTRY_STATE, -1, offsetof(Entry, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_ENTRY_TAKE_FOCUS, -1, offsetof(Entry, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_ENTRY_TEXT_VARIABLE, -1, offsetof(Entry, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", DEF_ENTRY_VALIDATE, -1, offsetof(Entry, validate), 0, validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand", NULL, -1, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL, NULL, 0, -1, 0, "-validatecommand", 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_ENTRY_WIDTH, -1, offsetof(Entry, prefWidth), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_ENTRY_SCROLL_COMMAND, -1, offsetof(Entry, scrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * Information used for Spinbox objv parsing. */ |
︙ | ︙ | |||
176 177 178 179 180 181 182 | #define DEF_SPINBOX_FORMAT "" #define DEF_SPINBOX_VALUES "" #define DEF_SPINBOX_WRAP "0" static const Tk_OptionSpec sbOptSpec[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background", | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > | | | | | | | | | | | | | | | | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | #define DEF_SPINBOX_FORMAT "" #define DEF_SPINBOX_VALUES "" #define DEF_SPINBOX_WRAP "0" static const Tk_OptionSpec sbOptSpec[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Background", DEF_BUTTON_ACTIVE_BG_COLOR, -1, offsetof(Spinbox, activeBorder), 0, DEF_BUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_ENTRY_BG_COLOR, -1, offsetof(Entry, normalBorder), 0, DEF_ENTRY_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_ENTRY_BORDER_WIDTH, -1, offsetof(Entry, borderWidth), 0, 0, 0}, {TK_OPTION_BORDER, "-buttonbackground", "Button.background", "Background", DEF_BUTTON_BG_COLOR, -1, offsetof(Spinbox, buttonBorder), 0, DEF_BUTTON_BG_MONO, 0}, {TK_OPTION_CURSOR, "-buttoncursor", "Button.cursor", "Cursor", DEF_BUTTON_CURSOR, -1, offsetof(Spinbox, bCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-buttondownrelief", "Button.relief", "Relief", DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, bdRelief), 0, 0, 0}, {TK_OPTION_RELIEF, "-buttonuprelief", "Button.relief", "Relief", DEF_BUTTON_RELIEF, -1, offsetof(Spinbox, buRelief), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_SPINBOX_CMD, -1, offsetof(Spinbox, command), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_ENTRY_CURSOR, -1, offsetof(Entry, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-disabledbackground", "disabledBackground", "DisabledBackground", DEF_ENTRY_DISABLED_BG_COLOR, -1, offsetof(Entry, disabledBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_DISABLED_BG_MONO, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_ENTRY_DISABLED_FG, -1, offsetof(Entry, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_ENTRY_EXPORT_SELECTION, -1, offsetof(Entry, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_ENTRY_FONT, -1, offsetof(Entry, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_ENTRY_FG, -1, offsetof(Entry, fgColorPtr), 0, 0, 0}, {TK_OPTION_STRING, "-format", "format", "Format", DEF_SPINBOX_FORMAT, -1, offsetof(Spinbox, reqFormat), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SPINBOX_FROM, -1, offsetof(Spinbox, fromValue), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_ENTRY_HIGHLIGHT_BG, -1, offsetof(Entry, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_ENTRY_HIGHLIGHT, -1, offsetof(Entry, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_ENTRY_HIGHLIGHT_WIDTH, -1, offsetof(Entry, highlightWidth), 0, 0, 0}, {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", DEF_SPINBOX_INCREMENT, -1, offsetof(Spinbox, increment), 0, 0, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_ENTRY_INSERT_BG, -1, offsetof(Entry, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_ENTRY_INSERT_BD_COLOR, -1, offsetof(Entry, insertBorderWidth), 0, (ClientData) DEF_ENTRY_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_ENTRY_INSERT_OFF_TIME, -1, offsetof(Entry, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_ENTRY_INSERT_ON_TIME, -1, offsetof(Entry, insertOnTime), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_ENTRY_INSERT_WIDTH, -1, offsetof(Entry, insertWidth), 0, 0, 0}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", DEF_ENTRY_INVALIDCMD, -1, offsetof(Entry, invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-invcmd", NULL, NULL, NULL, 0, -1, 0, "-invalidcommand", 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_ENTRY_JUSTIFY, -1, offsetof(Entry, justify), 0, 0, 0}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", DEF_ENTRY_PLACEHOLDER, -1, offsetof(Entry, placeholderString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", DEF_ENTRY_PLACEHOLDERFG, -1, offsetof(Entry, placeholderColorPtr), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_ENTRY_RELIEF, -1, offsetof(Entry, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-readonlybackground", "readonlyBackground", "ReadonlyBackground", DEF_ENTRY_READONLY_BG_COLOR, -1, offsetof(Entry, readonlyBorder), TK_OPTION_NULL_OK, (ClientData) DEF_ENTRY_READONLY_BG_MONO, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_SPINBOX_REPEAT_DELAY, -1, offsetof(Spinbox, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_SPINBOX_REPEAT_INTERVAL, -1, offsetof(Spinbox, repeatInterval), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_ENTRY_SELECT_COLOR, -1, offsetof(Entry, selBorder), 0, DEF_ENTRY_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_ENTRY_SELECT_BD_COLOR, -1, offsetof(Entry, selBorderWidth), 0, DEF_ENTRY_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_ENTRY_SELECT_FG_COLOR, -1, offsetof(Entry, selFgColorPtr), TK_OPTION_NULL_OK, DEF_ENTRY_SELECT_FG_MONO, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_ENTRY_STATE, -1, offsetof(Entry, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_ENTRY_TAKE_FOCUS, -1, offsetof(Entry, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_ENTRY_TEXT_VARIABLE, -1, offsetof(Entry, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", DEF_SPINBOX_TO, -1, offsetof(Spinbox, toValue), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", DEF_ENTRY_VALIDATE, -1, offsetof(Entry, validate), 0, validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand","ValidateCommand", NULL, -1, offsetof(Entry, validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-values", "values", "Values", DEF_SPINBOX_VALUES, -1, offsetof(Spinbox, valueStr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-vcmd", NULL, NULL, NULL, 0, -1, 0, "-validatecommand", 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_ENTRY_WIDTH, -1, offsetof(Entry, prefWidth), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap", DEF_SPINBOX_WRAP, -1, offsetof(Spinbox, wrap), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_ENTRY_SCROLL_COMMAND, -1, offsetof(Entry, scrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * The following tables define the entry widget commands (and sub-commands) * and map the indexes into the string tables into enumerated types used to |
︙ | ︙ | |||
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | entryPtr->inset = XPAD; entryPtr->textGC = NULL; entryPtr->selTextGC = NULL; entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; /* * Keep a hold of the associated tkwin until we destroy the entry, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Entry"); Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); | > > | | 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | entryPtr->inset = XPAD; entryPtr->textGC = NULL; entryPtr->selTextGC = NULL; entryPtr->highlightGC = NULL; entryPtr->avgWidth = 1; entryPtr->validate = VALIDATE_NONE; entryPtr->placeholderGC = NULL; /* * Keep a hold of the associated tkwin until we destroy the entry, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Entry"); Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); if ((Tk_InitOptions(interp, entryPtr, optionTable, tkwin) != TCL_OK) || (ConfigureEntry(interp, entryPtr, objc-2, objv+2) != TCL_OK)) { Tk_DestroyWindow(entryPtr->tkwin); return TCL_ERROR; } Tcl_SetObjResult(interp, TkNewWindowObj(entryPtr->tkwin)); |
︙ | ︙ | |||
622 623 624 625 626 627 628 | &index) != TCL_OK) { goto error; } if ((index == entryPtr->numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); | | | | | | | | 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | &index) != TCL_OK) { goto error; } if ((index == entryPtr->numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX); bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY); bbox[2] = Tcl_NewWideIntObj(width); bbox[3] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox)); break; } case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } objPtr = Tk_GetOptionValue(interp, entryPtr, entryPtr->optionTable, objv[2], entryPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case COMMAND_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, entryPtr, entryPtr->optionTable, (objc == 3) ? objv[2] : NULL, entryPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); |
︙ | ︙ | |||
716 717 718 719 720 721 722 | Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]), &index) != TCL_OK) { goto error; } | | | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]), &index) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } case COMMAND_INSERT: { int index, code; if (objc != 4) { |
︙ | ︙ | |||
1133 1134 1135 1136 1137 1138 1139 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ | | | 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ if (Tk_SetOptions(interp, entryPtr, entryPtr->optionTable, objc, objv, entryPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; } } else { /* * Second pass: restore options to old values. |
︙ | ︙ | |||
1173 1174 1175 1176 1177 1178 1179 | } if (entryPtr->insertBorderWidth > entryPtr->insertWidth/2) { entryPtr->insertBorderWidth = entryPtr->insertWidth/2; } if (entryPtr->type == TK_SPINBOX) { if (sbPtr->fromValue > sbPtr->toValue) { | < > | > | > | < > | | | 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 | } if (entryPtr->insertBorderWidth > entryPtr->insertWidth/2) { entryPtr->insertBorderWidth = entryPtr->insertWidth/2; } if (entryPtr->type == TK_SPINBOX) { if (sbPtr->fromValue > sbPtr->toValue) { /* * Swap -from and -to values. */ double tmpFromTo = sbPtr->fromValue; sbPtr->fromValue = sbPtr->toValue; sbPtr->toValue = tmpFromTo; } if (sbPtr->reqFormat && (oldFormat != sbPtr->reqFormat)) { /* * Make sure that the given format is somewhat correct, and * calculate the minimum space we'll need for the values as * strings. */ |
︙ | ︙ | |||
1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 | gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); if (entryPtr->textGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } entryPtr->textGC = gc; if (entryPtr->selFgColorPtr != NULL) { gcValues.foreground = entryPtr->selFgColorPtr->pixel; } gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); if (entryPtr->selTextGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } | > > > > > > > > > > > > | 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 | gcValues.graphics_exposures = False; mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); if (entryPtr->textGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->textGC); } entryPtr->textGC = gc; if (entryPtr->placeholderColorPtr != NULL) { gcValues.foreground = entryPtr->placeholderColorPtr->pixel; } mask = GCForeground | GCFont | GCGraphicsExposures; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); if (entryPtr->placeholderGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->placeholderGC); } entryPtr->placeholderGC = gc; if (entryPtr->selFgColorPtr != NULL) { gcValues.foreground = entryPtr->selFgColorPtr->pixel; } else { gcValues.foreground = colorPtr->pixel; } gcValues.font = Tk_FontId(entryPtr->tkfont); mask = GCForeground | GCFont; gc = Tk_GetGC(entryPtr->tkwin, mask, &gcValues); if (entryPtr->selTextGC != NULL) { Tk_FreeGC(entryPtr->display, entryPtr->selTextGC); } |
︙ | ︙ | |||
1509 1510 1511 1512 1513 1514 1515 | #ifndef MAC_OSX_TK /* *-------------------------------------------------------------- * * TkpDrawEntryBorderAndFocus -- * | | | | < < < > < > | | | < < < > < > | 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 | #ifndef MAC_OSX_TK /* *-------------------------------------------------------------- * * TkpDrawEntryBorderAndFocus -- * * Stub function for Tk on platforms other than Aqua * (Windows and X11), which do not draw native entry borders. * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua. * * Results: * Returns 0. * * Side effects: * None. * *-------------------------------------------------------------- */ int TkpDrawEntryBorderAndFocus( Entry *entryPtr, Drawable pixmap, int isSpinbox) { return 0; } /* *-------------------------------------------------------------- * * TkpDrawSpinboxButtons -- * * Stub function for Tk on platforms other than Aqua * (Windows and X11), which do not draw native spinbox buttons. * See macosx/tkMacOSXEntry.c for function definition in Tk Aqua. * * Results: * Returns 0. * * Side effects: * None. * *-------------------------------------------------------------- */ int TkpDrawSpinboxButtons( Spinbox *sbPtr, |
︙ | ︙ | |||
1732 1733 1734 1735 1736 1737 1738 | } /* * Draw the text in two pieces: first the unselected portion, then the * selected portion on top of it. */ | > | > > > > > | 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 | } /* * Draw the text in two pieces: first the unselected portion, then the * selected portion on top of it. */ if ((entryPtr->numChars != 0) || (entryPtr->placeholderChars == 0)) { Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->textGC, entryPtr->textLayout, entryPtr->layoutX, entryPtr->layoutY, entryPtr->leftIndex, entryPtr->numChars); } else { Tk_DrawTextLayout(entryPtr->display, pixmap, entryPtr->placeholderGC, entryPtr->placeholderLayout, entryPtr->placeholderX, entryPtr->layoutY, entryPtr->placeholderLeftIndex, entryPtr->placeholderChars); } if (showSelection && (entryPtr->state != STATE_DISABLED) && (entryPtr->selTextGC != entryPtr->textGC) && (entryPtr->selectFirst < entryPtr->selectLast)) { int selFirst; if (entryPtr->selectFirst < entryPtr->leftIndex) { |
︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | for (i = entryPtr->numChars; --i >= 0; ) { memcpy(p, buf, size); p += size; } *p = '\0'; } Tk_FreeTextLayout(entryPtr->textLayout); entryPtr->textLayout = Tk_ComputeTextLayout(entryPtr->tkfont, entryPtr->displayString, entryPtr->numChars, 0, entryPtr->justify, TK_IGNORE_NEWLINES, &totalLength, &height); entryPtr->layoutY = (Tk_Height(entryPtr->tkwin) - height) / 2; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 | for (i = entryPtr->numChars; --i >= 0; ) { memcpy(p, buf, size); p += size; } *p = '\0'; } /* Recompute layout of placeholder text. * Only the placeholderX and placeholderLeftIndex value is needed. * We use the same font so we can use the layoutY value from below. */ Tk_FreeTextLayout(entryPtr->placeholderLayout); if (entryPtr->placeholderString) { entryPtr->placeholderChars = strlen(entryPtr->placeholderString); entryPtr->placeholderLayout = Tk_ComputeTextLayout(entryPtr->tkfont, entryPtr->placeholderString, entryPtr->placeholderChars, 0, entryPtr->justify, TK_IGNORE_NEWLINES, &totalLength, NULL); overflow = totalLength - (Tk_Width(entryPtr->tkwin) - 2*entryPtr->inset - entryPtr->xWidth); if (overflow <= 0) { entryPtr->placeholderLeftIndex = 0; if (entryPtr->justify == TK_JUSTIFY_LEFT) { entryPtr->placeholderX = entryPtr->inset; } else if (entryPtr->justify == TK_JUSTIFY_RIGHT) { entryPtr->placeholderX = Tk_Width(entryPtr->tkwin) - entryPtr->inset - entryPtr->xWidth - totalLength; } else { entryPtr->placeholderX = (Tk_Width(entryPtr->tkwin) - entryPtr->xWidth - totalLength)/2; } } else { /* * The whole string can't fit in the window. Compute the maximum * number of characters that may be off-screen to the left without * leaving empty space on the right of the window, then don't let * placeholderLeftIndex be any greater than that. */ maxOffScreen = Tk_PointToChar(entryPtr->placeholderLayout, overflow, 0); Tk_CharBbox(entryPtr->placeholderLayout, maxOffScreen, &rightX, NULL, NULL, NULL); if (rightX < overflow) { maxOffScreen++; } entryPtr->placeholderLeftIndex = maxOffScreen; Tk_CharBbox(entryPtr->placeholderLayout, entryPtr->placeholderLeftIndex, &rightX, NULL, NULL, NULL); entryPtr->placeholderX = entryPtr->inset -rightX; } } else { entryPtr->placeholderChars = 0; entryPtr->placeholderLayout = Tk_ComputeTextLayout(entryPtr->tkfont, entryPtr->placeholderString, 0, 0, entryPtr->justify, TK_IGNORE_NEWLINES, NULL, NULL); entryPtr->placeholderX = entryPtr->inset; } Tk_FreeTextLayout(entryPtr->textLayout); entryPtr->textLayout = Tk_ComputeTextLayout(entryPtr->tkfont, entryPtr->displayString, entryPtr->numChars, 0, entryPtr->justify, TK_IGNORE_NEWLINES, &totalLength, &height); entryPtr->layoutY = (Tk_Height(entryPtr->tkwin) - height) / 2; |
︙ | ︙ | |||
2042 2043 2044 2045 2046 2047 2048 | InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ int index, /* Add the new elements before this character * index. */ const char *value) /* New characters to add (NULL-terminated * string). */ { | < < | | 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 | InsertChars( Entry *entryPtr, /* Entry that is to get the new elements. */ int index, /* Add the new elements before this character * index. */ const char *value) /* New characters to add (NULL-terminated * string). */ { size_t byteIndex, byteCount, newByteCount, oldChars, charsAdded; const char *string; char *newStr; string = entryPtr->string; byteIndex = Tcl_UtfAtIndex(string, index) - string; byteCount = strlen(value); if (byteCount == 0) { |
︙ | ︙ | |||
3131 3132 3133 3134 3135 3136 3137 | */ /* ARGSUSED */ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | < < < < < < < < < < < < < > > | > > > > > > > > > > > > > > > > > > | | 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 | */ /* ARGSUSED */ static char * EntryTextVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Not used. */ const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { Entry *entryPtr = clientData; const char *value; if (entryPtr->flags & ENTRY_DELETED) { /* * Just abort early if we entered here while being deleted. */ return NULL; } /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && entryPtr->textVarName) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, entryPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, probe); if (probe == (ClientData)entryPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_SetVar2(interp, entryPtr->textVarName, NULL, entryPtr->string, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, entryPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, EntryTextVarProc, clientData); entryPtr->flags |= ENTRY_VAR_TRACED; } return NULL; } /* * Update the entry's text with the value of the variable, unless the * entry already has that value (this happens when the variable changes * value because we changed it because someone typed in the entry). |
︙ | ︙ | |||
3260 3261 3262 3263 3264 3265 3266 | * EntryValidateChange -- * * This function is invoked when any character is added or removed from * the entry widget, or a focus has trigerred validation. * * Results: * TCL_OK if the validatecommand accepts the new string, TCL_ERROR if any | | | 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 | * EntryValidateChange -- * * This function is invoked when any character is added or removed from * the entry widget, or a focus has trigerred validation. * * Results: * TCL_OK if the validatecommand accepts the new string, TCL_ERROR if any * problems occurred with validatecommand. * * Side effects: * The insertion/deletion may be aborted, and the validatecommand might * turn itself off (if an error or loop condition arises). * *-------------------------------------------------------------- */ |
︙ | ︙ | |||
3317 3318 3319 3320 3321 3322 3323 | p = Tcl_DStringValue(&script); code = EntryValidate(entryPtr, p); Tcl_DStringFree(&script); /* * If e->validate has become VALIDATE_NONE during the validation, or we * now have VALIDATE_VAR set (from EntrySetValue) and didn't before, it | | | 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 | p = Tcl_DStringValue(&script); code = EntryValidate(entryPtr, p); Tcl_DStringFree(&script); /* * If e->validate has become VALIDATE_NONE during the validation, or we * now have VALIDATE_VAR set (from EntrySetValue) and didn't before, it * means that a loop condition almost occurred. Do not allow this * validation result to finish. */ if (entryPtr->validate == VALIDATE_NONE || (!varValidate && (entryPtr->flags & VALIDATE_VAR))) { code = TCL_ERROR; } |
︙ | ︙ | |||
3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 | sbPtr->fromValue = 0.0; sbPtr->toValue = 100.0; sbPtr->increment = 1.0; sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE); sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; /* * Keep a hold of the associated tkwin until we destroy the spinbox, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Spinbox"); Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, PointerMotionMask|ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); | > > | | 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 | sbPtr->fromValue = 0.0; sbPtr->toValue = 100.0; sbPtr->increment = 1.0; sbPtr->formatBuf = ckalloc(TCL_DOUBLE_SPACE); sbPtr->bdRelief = TK_RELIEF_FLAT; sbPtr->buRelief = TK_RELIEF_FLAT; entryPtr->placeholderGC = NULL; /* * Keep a hold of the associated tkwin until we destroy the spinbox, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(entryPtr->tkwin); Tk_SetClass(entryPtr->tkwin, "Spinbox"); Tk_SetClassProcs(entryPtr->tkwin, &entryClass, entryPtr); Tk_CreateEventHandler(entryPtr->tkwin, PointerMotionMask|ExposureMask|StructureNotifyMask|FocusChangeMask, EntryEventProc, entryPtr); Tk_CreateSelHandler(entryPtr->tkwin, XA_PRIMARY, XA_STRING, EntryFetchSelection, entryPtr, XA_STRING); if (Tk_InitOptions(interp, sbPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(entryPtr->tkwin); return TCL_ERROR; } if (ConfigureEntry(interp, entryPtr, objc-2, objv+2) != TCL_OK) { goto error; } |
︙ | ︙ | |||
3750 3751 3752 3753 3754 3755 3756 | &index) != TCL_OK) { goto error; } if ((index == entryPtr->numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); | | | | | | | | 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 | &index) != TCL_OK) { goto error; } if ((index == entryPtr->numChars) && (index > 0)) { index--; } Tk_CharBbox(entryPtr->textLayout, index, &x, &y, &width, &height); bbox[0] = Tcl_NewWideIntObj(x + entryPtr->layoutX); bbox[1] = Tcl_NewWideIntObj(y + entryPtr->layoutY); bbox[2] = Tcl_NewWideIntObj(width); bbox[3] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(4, bbox)); break; } case SB_CMD_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } objPtr = Tk_GetOptionValue(interp, entryPtr, entryPtr->optionTable, objv[2], entryPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case SB_CMD_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, entryPtr, entryPtr->optionTable, (objc == 3) ? objv[2] : NULL, entryPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); } else { |
︙ | ︙ | |||
3864 3865 3866 3867 3868 3869 3870 | Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]), &index) != TCL_OK) { goto error; } | | | 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 | Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (GetEntryIndex(interp, entryPtr, Tcl_GetString(objv[2]), &index) != TCL_OK) { goto error; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); break; } case SB_CMD_INSERT: { int index, code; if (objc != 4) { |
︙ | ︙ | |||
4294 4295 4296 4297 4298 4299 4300 | if (strcmp(Tcl_GetString(objPtr), entryPtr->string)) { /* * Somehow the string changed from what we expected, so let's * do a search on the list to see if the current value is * there. If not, move to the first element of the list. */ | > | | | | 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 | if (strcmp(Tcl_GetString(objPtr), entryPtr->string)) { /* * Somehow the string changed from what we expected, so let's * do a search on the list to see if the current value is * there. If not, move to the first element of the list. */ int i, listc; TkSizeT elemLen, length = entryPtr->numChars; const char *bytes; Tcl_Obj **listv; Tcl_ListObjGetElements(interp, sbPtr->listObj, &listc, &listv); for (i = 0; i < listc; i++) { bytes = TkGetStringFromObj(listv[i], &elemLen); if ((length == elemLen) && (memcmp(bytes, entryPtr->string, length) == 0)) { sbPtr->eIndex = i; break; } } } if (up) { if (++sbPtr->eIndex >= sbPtr->nElements) { |
︙ | ︙ |
Changes to generic/tkEntry.h.
︙ | ︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | * scrollbar(s). Malloc'ed. NULL means no * command to issue. */ char *showChar; /* Value of -show option. If non-NULL, first * character is used for displaying all * characters in entry. Malloc'ed. This is * only used by the Entry widget. */ /* * Fields whose values are derived from the current values of the * configuration settings above. */ const char *displayString; /* String to use when displaying. This may be * a pointer to string, or a pointer to | > > > > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | * scrollbar(s). Malloc'ed. NULL means no * command to issue. */ char *showChar; /* Value of -show option. If non-NULL, first * character is used for displaying all * characters in entry. Malloc'ed. This is * only used by the Entry widget. */ /* * Fields used in displaying help text if entry value is empty */ Tk_TextLayout placeholderLayout;/* Cached placeholder text layout information. */ char *placeholderString; /* String value of placeholder. */ int placeholderChars; /* Number of chars in placeholder. */ XColor *placeholderColorPtr;/* Color value of placeholder foreground. */ GC placeholderGC; /* For drawing placeholder text. */ int placeholderX; /* Origin for layout. */ int placeholderLeftIndex; /* Character index of left-most character * visible in window. */ /* * Fields whose values are derived from the current values of the * configuration settings above. */ const char *displayString; /* String to use when displaying. This may be * a pointer to string, or a pointer to |
︙ | ︙ |
Changes to generic/tkError.c.
︙ | ︙ | |||
160 161 162 163 164 165 166 | * collection. To reduce the cost of the cleanup, let a few dead handlers * pile up, then clean them all at once. This adds a bit of overhead to * errors that might occur while the dead handlers are hanging around, but * reduces the overhead of scanning the list to clean up (particularly if * there are many handlers that stay around forever). */ | < | | | | | 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | * collection. To reduce the cost of the cleanup, let a few dead handlers * pile up, then clean them all at once. This adds a bit of overhead to * errors that might occur while the dead handlers are hanging around, but * reduces the overhead of scanning the list to clean up (particularly if * there are many handlers that stay around forever). */ if (dispPtr->deleteCount++ >= 9) { TkErrorHandler *prevPtr; TkErrorHandler *nextPtr; unsigned long lastSerial = LastKnownRequestProcessed(dispPtr->display); /* * Last chance to catch errors for this handler: if no event/error * processing took place to follow up the end of this error handler * we need a round trip with the X server now. */ if (errorPtr->lastRequest > lastSerial) { XSync(dispPtr->display, False); } dispPtr->deleteCount = 0; errorPtr = dispPtr->errorPtr; for (prevPtr = NULL; errorPtr != NULL; errorPtr = nextPtr) { nextPtr = errorPtr->nextPtr; if ((errorPtr->lastRequest != (unsigned long) -1) && (errorPtr->lastRequest <= lastSerial)) { if (prevPtr == NULL) { dispPtr->errorPtr = nextPtr; } else { prevPtr->nextPtr = nextPtr; } ckfree(errorPtr); continue; |
︙ | ︙ |
Changes to generic/tkEvent.c.
︙ | ︙ | |||
135 136 137 138 139 140 141 | /* * The structure below is used to store Data for the Event module that must be * kept thread-local. The "dataKey" is used to fetch the thread-specific * storage for the current thread. */ | | | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /* * The structure below is used to store Data for the Event module that must be * kept thread-local. The "dataKey" is used to fetch the thread-specific * storage for the current thread. */ typedef struct { int handlersActive; /* The following variable has a non-zero value * when a handler is active. */ InProgress *pendingPtr; /* Topmost search in progress, or NULL if * none. */ /* * List of generic handler records. |
︙ | ︙ | |||
189 190 191 192 193 194 195 | /* * Prototypes for functions that are only referenced locally within this file. */ static void CleanUpTkEvent(XEvent *eventPtr); static void DelayedMotionProc(ClientData clientData); | < < | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | /* * Prototypes for functions that are only referenced locally within this file. */ static void CleanUpTkEvent(XEvent *eventPtr); static void DelayedMotionProc(ClientData clientData); static unsigned long GetEventMaskFromXEvent(XEvent *eventPtr); static TkWindow * GetTkWindowFromXEvent(XEvent *eventPtr); static void InvokeClientMessageHandlers(ThreadSpecificData *tsdPtr, Tk_Window tkwin, XEvent *eventPtr); static int InvokeFocusHandlers(TkWindow **winPtrPtr, unsigned long mask, XEvent *eventPtr); static int InvokeGenericHandlers(ThreadSpecificData *tsdPtr, XEvent *eventPtr); static int InvokeMouseHandlers(TkWindow *winPtr, unsigned long mask, XEvent *eventPtr); static Window ParentXId(Display *display, Window w); static int RefreshKeyboardMappingIfNeeded(XEvent *eventPtr); static int TkXErrorHandler(ClientData clientData, XErrorEvent *errEventPtr); static int WindowEventProc(Tcl_Event *evPtr, int flags); #ifdef TK_USE_INPUT_METHODS static void CreateXIC(TkWindow *winPtr); #endif /* TK_USE_INPUT_METHODS */ /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
520 521 522 523 524 525 526 | } return 0; } /* *---------------------------------------------------------------------- * | | | < < < < < | < | < < < < < < | < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | < < | < < < < < < | < < < < < < < < < < < < < < < < < < | 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | } return 0; } /* *---------------------------------------------------------------------- * * TkGetButtonMask -- * * Return the proper Button${n}Mask for the button. * * Results: * A button mask. * * Side effects: * None. * *---------------------------------------------------------------------- */ static const unsigned long buttonMasks[] = { 0, Button1Mask, Button2Mask, Button3Mask, Button4Mask, Button5Mask, Button6Mask, Button7Mask, Button8Mask, Button9Mask }; unsigned long TkGetButtonMask( unsigned int button) { return (button > Button9) ? 0 : buttonMasks[button]; } /* *---------------------------------------------------------------------- * * InvokeClientMessageHandlers -- * |
︙ | ︙ | |||
1216 1217 1218 1219 1220 1221 1222 | TkWindow *winPtr; unsigned long mask; InProgress ip; Tcl_Interp *interp = NULL; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | < < | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | TkWindow *winPtr; unsigned long mask; InProgress ip; Tcl_Interp *interp = NULL; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * If the generic handler processed this event we are done and can return. */ if (InvokeGenericHandlers(tsdPtr, eventPtr)) { goto releaseEventResources; } |
︙ | ︙ |
Changes to generic/tkFileFilter.c.
︙ | ︙ | |||
258 259 260 261 262 263 264 | /* * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually * static to the MacOS X/Darwin version of Tcl, and would therefore * require further code refactoring. */ for (i=0; i<ostypeCount; i++) { | | | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | /* * Might be cleaner to use 'Tcl_GetOSTypeFromObj' but that is actually * static to the MacOS X/Darwin version of Tcl, and would therefore * require further code refactoring. */ for (i=0; i<ostypeCount; i++) { TkSizeT len; const char *strType = TkGetStringFromObj(ostypeList[i], &len); /* * If len is < 4, it is definitely an error. If equal or longer, * we need to use the macRoman encoding to determine the correct * length (assuming there may be non-ascii characters, e.g., * embedded nulls or accented characters in the string, the * macRoman length will be different). |
︙ | ︙ | |||
318 319 320 321 322 323 324 | filterPtr->clausesTail = clausePtr; } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = ckalloc(sizeof(GlobPattern)); | | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | filterPtr->clausesTail = clausePtr; } clausePtr->next = NULL; if (globCount > 0 && globList != NULL) { for (i=0; i<globCount; i++) { GlobPattern *globPtr = ckalloc(sizeof(GlobPattern)); TkSizeT len; const char *str = TkGetStringFromObj(globList[i], &len); len = (len + 1) * sizeof(char); if (str[0] && str[0] != '*') { /* * Prepend a "*" to patterns that do not have a leading "*" */ |
︙ | ︙ | |||
371 372 373 374 375 376 377 | } if (ostypeList != NULL && ostypeCount > 0) { if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; | | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | } if (ostypeList != NULL && ostypeCount > 0) { if (macRoman == NULL) { macRoman = Tcl_GetEncoding(NULL, "macRoman"); } for (i=0; i<ostypeCount; i++) { Tcl_DString osTypeDS; TkSizeT len; MacFileType *mfPtr = ckalloc(sizeof(MacFileType)); const char *strType = TkGetStringFromObj(ostypeList[i], &len); char *string; /* * Convert utf to macRoman, since MacOS types are defined to be 4 * macRoman characters long */ |
︙ | ︙ |
Changes to generic/tkFocus.c.
︙ | ︙ | |||
547 548 549 550 551 552 553 554 555 556 | * Don't set focus if window is already dead. [Bug 3574708] */ if (winPtr->flags & TK_ALREADY_DEAD) { return; } displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr); /* | > > > > > > | < | | | > | | | | | | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | * Don't set focus if window is already dead. [Bug 3574708] */ if (winPtr->flags & TK_ALREADY_DEAD) { return; } /* * Get the current focus window with the same display and application * as winPtr. */ displayFocusPtr = FindDisplayFocusInfo(winPtr->mainPtr, winPtr->dispPtr); /* * Do nothing if the window already has focus and force is not set. If * force is set, we need to grab the focus, since under Windows or macOS * this may involve taking control away from another application. */ if (winPtr == displayFocusPtr->focusWinPtr && !force) { return; } /* * Find the toplevel window for winPtr, then find (or create) a record * for the toplevel. Also see whether winPtr and all its ancestors are * mapped. */ allMapped = 1; for (topLevelPtr = winPtr; ; topLevelPtr = topLevelPtr->parentPtr) { if (topLevelPtr == NULL) { /* * The window is being deleted. No point in worrying about giving * it the focus. */ return; } if (!(topLevelPtr->flags & TK_MAPPED)) { allMapped = 0; } if (topLevelPtr->flags & TK_TOP_HIERARCHY) { break; } } /* * If any ancestor of the new focus window isn't mapped, then we can't set * focus for it (X will generate an error, for example). Instead, create * an event handler that will set the focus to this window once it gets * mapped. At the same time, delete any old handler that might be around; * it's no longer relevant. */ if (displayFocusPtr->focusOnMapPtr != NULL) { Tk_DeleteEventHandler((Tk_Window) displayFocusPtr->focusOnMapPtr, StructureNotifyMask, FocusMapProc, displayFocusPtr->focusOnMapPtr); displayFocusPtr->focusOnMapPtr = NULL; |
︙ | ︙ | |||
619 620 621 622 623 624 625 | tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; } tlFocusPtr->focusWinPtr = winPtr; | > > | < > | > > | | > > | > | | < | | | > > | > | > > | < | | < < | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | tlFocusPtr = ckalloc(sizeof(ToplevelFocusInfo)); tlFocusPtr->topLevelPtr = topLevelPtr; tlFocusPtr->nextPtr = winPtr->mainPtr->tlFocusPtr; winPtr->mainPtr->tlFocusPtr = tlFocusPtr; } tlFocusPtr->focusWinPtr = winPtr; if (topLevelPtr->flags & TK_EMBEDDED) { /* * We are assigning focus to an embedded toplevel. The platform * specific function TkpClaimFocus needs to handle the job of * assigning focus to the container, since we have no way to find the * contaiuner. */ TkpClaimFocus(topLevelPtr, force); } else if ((displayFocusPtr->focusWinPtr != NULL) || force) { /* * If we are forcing removal of focus from a container hosting a * toplevel from a different application, clear the focus in that * application. */ if (force) { TkWindow *focusPtr = winPtr->dispPtr->focusPtr; if (focusPtr && focusPtr->mainPtr != winPtr->mainPtr) { DisplayFocusInfo *displayFocusPtr2 = FindDisplayFocusInfo( focusPtr->mainPtr, focusPtr->dispPtr); displayFocusPtr2->focusWinPtr = NULL; } } /* * Call the platform specific function TkpChangeFocus to move the * window manager's focus to a new toplevel. */ serial = TkpChangeFocus(TkpGetWrapperWindow(topLevelPtr), force); if (serial != 0) { displayFocusPtr->focusSerial = serial; } GenerateFocusEvents(displayFocusPtr->focusWinPtr, winPtr); |
︙ | ︙ |
Changes to generic/tkFont.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 | /* * The following data structure is used to keep track of the font attributes * for each named font that has been defined. The named font is only deleted * when the last reference to it goes away. */ typedef struct NamedFont { | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | /* * The following data structure is used to keep track of the font attributes * for each named font that has been defined. The named font is only deleted * when the last reference to it goes away. */ typedef struct NamedFont { size_t refCount; /* Number of users of named font. */ int deletePending; /* Non-zero if font should be deleted when * last reference goes away. */ TkFontAttributes fa; /* Desired attributes for named font. */ } NamedFont; /* * The following two structures are used to keep track of string measurement |
︙ | ︙ | |||
347 348 349 350 351 352 353 | */ const Tcl_ObjType tkFontObjType = { "font", /* name */ FreeFontObjProc, /* freeIntRepProc */ DupFontObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ | | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | */ const Tcl_ObjType tkFontObjType = { "font", /* name */ FreeFontObjProc, /* freeIntRepProc */ DupFontObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; /* *--------------------------------------------------------------------------- * * TkFontPkgInit -- * |
︙ | ︙ | |||
559 560 561 562 563 564 565 | /* * The 'charPtr' arg must be a single Unicode. */ if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); | | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 | /* * The 'charPtr' arg must be a single Unicode. */ if (charPtr != NULL) { const char *string = Tcl_GetString(charPtr); size_t len = TkUtfToUniChar(string, &uniChar); if (len != (size_t)charPtr->length) { resultPtr = Tcl_NewStringObj( "expected a single character but got \"", -1); Tcl_AppendLimitedToObj(resultPtr, string, -1, 40, "..."); Tcl_AppendToObj(resultPtr, "\"", -1); Tcl_SetObjResult(interp, resultPtr); Tcl_SetErrorCode(interp, "TK", "VALUE", "FONT_SAMPLE", NULL); |
︙ | ︙ | |||
708 709 710 711 712 713 714 | } TkpGetFontFamilies(interp, tkwin); break; } case FONT_MEASURE: { const char *string; Tk_Font tkfont; | > | | | | 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | } TkpGetFontFamilies(interp, tkwin); break; } case FONT_MEASURE: { const char *string; Tk_Font tkfont; TkSizeT length = 0; int skip = 0; if (objc > 4) { skip = TkGetDisplayOf(interp, objc - 3, objv + 3, &tkwin); if (skip < 0) { return TCL_ERROR; } } if (objc - skip != 4) { Tcl_WrongNumArgs(interp, 2, objv, "font ?-displayof window? text"); return TCL_ERROR; } tkfont = Tk_AllocFontFromObj(interp, tkwin, objv[2]); if (tkfont == NULL) { return TCL_ERROR; } string = TkGetStringFromObj(objv[3 + skip], &length); Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tk_TextWidth(tkfont, string, length))); Tk_FreeFont(tkfont); break; } case FONT_METRICS: { Tk_Font tkfont; int skip, index, i; |
︙ | ︙ | |||
773 774 775 776 777 778 779 | i = 0; /* Needed only to prevent compiler warning. */ switch (index) { case 0: i = fmPtr->ascent; break; case 1: i = fmPtr->descent; break; case 2: i = fmPtr->ascent + fmPtr->descent; break; case 3: i = fmPtr->fixed; break; } | | | 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | i = 0; /* Needed only to prevent compiler warning. */ switch (index) { case 0: i = fmPtr->ascent; break; case 1: i = fmPtr->descent; break; case 2: i = fmPtr->ascent + fmPtr->descent; break; case 3: i = fmPtr->fixed; break; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(i)); } Tk_FreeFont(tkfont); break; } case FONT_NAMES: { Tcl_HashSearch search; Tcl_HashEntry *namedHashPtr; |
︙ | ︙ | |||
1419 1420 1421 1422 1423 1424 1425 | { TkFont *fontPtr = (TkFont *) tkfont, *prevPtr; NamedFont *nfPtr; if (fontPtr == NULL) { return; } | < | < | | 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 | { TkFont *fontPtr = (TkFont *) tkfont, *prevPtr; NamedFont *nfPtr; if (fontPtr == NULL) { return; } if (fontPtr->resourceRefCount-- > 1) { return; } if (fontPtr->namedHashPtr != NULL) { /* * This font derived from a named font. Reduce the reference count on * the named font and free it if no-one else is using it. */ nfPtr = Tcl_GetHashValue(fontPtr->namedHashPtr); if ((nfPtr->refCount-- <= 1) && nfPtr->deletePending) { Tcl_DeleteHashEntry(fontPtr->namedHashPtr); ckfree(nfPtr); } } prevPtr = Tcl_GetHashValue(fontPtr->cacheHashPtr); if (prevPtr == fontPtr) { |
︙ | ︙ | |||
1518 1519 1520 1521 1522 1523 1524 | static void FreeFontObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { | | < | 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | static void FreeFontObj( Tcl_Obj *objPtr) /* The object we are releasing. */ { TkFont *fontPtr = objPtr->internalRep.twoPtrValue.ptr1; if (fontPtr != NULL) { if ((fontPtr->objRefCount-- <= 1) && (fontPtr->resourceRefCount == 0)) { ckfree(fontPtr); } objPtr->internalRep.twoPtrValue.ptr1 = NULL; objPtr->internalRep.twoPtrValue.ptr2 = NULL; } } |
︙ | ︙ | |||
1711 1712 1713 1714 1715 1716 1717 | upper = 1; for (; *src != '\0'; ) { while (isspace(UCHAR(*src))) { /* INTL: ISO space */ src++; upper = 1; } src += TkUtfToUniChar(src, &ch); | < | | | | | < < < | 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 | upper = 1; for (; *src != '\0'; ) { while (isspace(UCHAR(*src))) { /* INTL: ISO space */ src++; upper = 1; } src += TkUtfToUniChar(src, &ch); if (upper) { ch = Tcl_UniCharToUpper(ch); upper = 0; } else { ch = Tcl_UniCharToLower(ch); } dest += TkUniCharToUtf(ch, dest); } *dest = '\0'; Tcl_DStringSetLength(dsPtr, dest - Tcl_DStringValue(dsPtr)); family = Tcl_DStringValue(dsPtr) + len; } |
︙ | ︙ | |||
3246 3247 3248 3249 3250 3251 3252 | Tcl_Interp *interp, /* Filled with Postscript code. */ Tk_TextLayout layout) /* The layout to be rendered. */ { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); | | > | 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 | Tcl_Interp *interp, /* Filled with Postscript code. */ Tk_TextLayout layout) /* The layout to be rendered. */ { TextLayout *layoutPtr = (TextLayout *) layout; LayoutChunk *chunkPtr = layoutPtr->chunks; int baseline = chunkPtr->y; Tcl_Obj *psObj = Tcl_NewObj(); int i, j; TkSizeT len; const char *p, *glyphname; char uindex[5], c, *ps; int ch; Tcl_AppendToObj(psObj, "[(", -1); for (i = 0; i < layoutPtr->numChunks; i++, chunkPtr++) { if (baseline != chunkPtr->y) { |
︙ | ︙ | |||
3304 3305 3306 3307 3308 3309 3310 | if (ch > 0xffff) { goto noMapping; } sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { | | | 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 | if (ch > 0xffff) { goto noMapping; } sprintf(uindex, "%04X", ch); /* endianness? */ glyphname = Tcl_GetVar2(interp, "::tk::psglyphs", uindex, 0); if (glyphname) { ps = TkGetStringFromObj(psObj, &len); if (ps[len-1] == '(') { /* * In-place edit. Ewww! */ ps[len-1] = '/'; } else { |
︙ | ︙ | |||
3495 3496 3497 3498 3499 3500 3501 | case FONT_FAMILY: str = faPtr->family; valuePtr = Tcl_NewStringObj(str, ((str == NULL) ? 0 : -1)); break; case FONT_SIZE: if (faPtr->size >= 0.0) { | | | | 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 | case FONT_FAMILY: str = faPtr->family; valuePtr = Tcl_NewStringObj(str, ((str == NULL) ? 0 : -1)); break; case FONT_SIZE: if (faPtr->size >= 0.0) { valuePtr = Tcl_NewWideIntObj((Tcl_WideInt)(faPtr->size + 0.5)); } else { valuePtr = Tcl_NewWideIntObj(-(Tcl_WideInt)(-faPtr->size + 0.5)); } break; case FONT_WEIGHT: str = TkFindStateString(weightMap, faPtr->weight); valuePtr = Tcl_NewStringObj(str, -1); break; |
︙ | ︙ | |||
4205 4206 4207 4208 4209 4210 4211 | fontPtr = Tcl_GetHashValue(hashPtr); if (fontPtr == NULL) { Tcl_Panic("TkDebugFont found empty hash table entry"); } for ( ; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, | | | | 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 | fontPtr = Tcl_GetHashValue(hashPtr); if (fontPtr == NULL) { Tcl_Panic("TkDebugFont found empty hash table entry"); } for ( ; (fontPtr != NULL); fontPtr = fontPtr->nextPtr) { objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(fontPtr->resourceRefCount)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(fontPtr->objRefCount)); Tcl_ListObjAppendElement(NULL, resultPtr, objPtr); } } return resultPtr; } /* |
︙ | ︙ | |||
4251 4252 4253 4254 4255 4256 4257 | if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { dst[0] = '\0'; return 0; } chunkPtr = layoutPtr->chunks; numBytesInChunk = chunkPtr->numBytes; | | | 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 | if ((layoutPtr == NULL) || (layoutPtr->numChunks == 0) || (layoutPtr->chunks->numDisplayChars <= 0)) { dst[0] = '\0'; return 0; } chunkPtr = layoutPtr->chunks; numBytesInChunk = chunkPtr->numBytes; strncpy(dst, chunkPtr->start, numBytesInChunk); *font = layoutPtr->tkfont; return numBytesInChunk; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkFont.h.
︙ | ︙ | |||
81 82 83 84 85 86 87 | */ typedef struct TkFont { /* * Fields used and maintained exclusively by generic code. */ | | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | */ typedef struct TkFont { /* * Fields used and maintained exclusively by generic code. */ TkSizeT resourceRefCount; /* Number of active uses of this font (each * active use corresponds to a call to * Tk_AllocFontFromTable or Tk_GetFont). If * this count is 0, then this TkFont structure * is no longer valid and it isn't present in * a hash table: it is being kept around only * because there are objects referring to it. * The structure is freed when * resourceRefCount and objRefCount are both * 0. */ TkSizeT objRefCount; /* The number of Tcl objects that reference * this structure. */ Tcl_HashEntry *cacheHashPtr;/* Entry in font cache for this structure, * used when deleting it. */ Tcl_HashEntry *namedHashPtr;/* Pointer to hash table entry that * corresponds to the named font that the * tkfont was based on, or NULL if the tkfont * was not based on a named font. */ |
︙ | ︙ |
Changes to generic/tkFrame.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1990-1994 The Regents of the University of California. * 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. */ | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1990-1994 The Regents of the University of California. * 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. */ #include "tkInt.h" #include "default.h" /* * The following enum is used to define the type of the frame. */ enum FrameType { TYPE_FRAME, TYPE_TOPLEVEL, TYPE_LABELFRAME |
︙ | ︙ | |||
90 91 92 93 94 95 96 97 98 99 100 101 102 103 | * pixels of extra space to leave on left and * right of child area. */ int padX; /* Integer value corresponding to padXPtr. */ Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many * pixels of extra space to leave above and * below child area. */ int padY; /* Integer value corresponding to padYPtr. */ } Frame; /* * A data structure of the following type is kept for each labelframe widget * managed by this file: */ | > > > > > > > > > > | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | * pixels of extra space to leave on left and * right of child area. */ int padX; /* Integer value corresponding to padXPtr. */ Tcl_Obj *padYPtr; /* Value of -padx option: specifies how many * pixels of extra space to leave above and * below child area. */ int padY; /* Integer value corresponding to padYPtr. */ Tcl_Obj *bgimgPtr; /* Value of -backgroundimage option: specifies * image to display on window's background, or * NULL if none. */ Tk_Image bgimg; /* Derived from bgimgPtr by calling * Tk_GetImage, or NULL if bgimgPtr is * NULL. */ int tile; /* Whether to tile the bgimg. */ #ifndef TK_NO_DOUBLE_BUFFERING GC copyGC; /* GC for copying when double-buffering. */ #endif /* TK_NO_DOUBLE_BUFFERING */ } Frame; /* * A data structure of the following type is kept for each labelframe widget * managed by this file: */ |
︙ | ︙ | |||
170 171 172 173 174 175 176 | /* * Information used for parsing configuration options. There are one common * table used by all and one table for each widget class. */ static const Tk_OptionSpec commonOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | | | | | | | > > > > > | | | > > > > > > > | | | | | > > | | | | | | | | | | 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | /* * Information used for parsing configuration options. There are one common * table used by all and one table for each widget class. */ static const Tk_OptionSpec commonOptSpec[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_FRAME_BG_COLOR, -1, offsetof(Frame, border), TK_OPTION_NULL_OK, DEF_FRAME_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_STRING, "-colormap", "colormap", "Colormap", DEF_FRAME_COLORMAP, -1, offsetof(Frame, colormapName), TK_OPTION_NULL_OK, 0, 0}, /* * Having -container is useless in a labelframe since a container has * no border. It should be deprecated. */ {TK_OPTION_BOOLEAN, "-container", "container", "Container", DEF_FRAME_CONTAINER, -1, offsetof(Frame, isContainer), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_FRAME_CURSOR, -1, offsetof(Frame, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_FRAME_HEIGHT, -1, offsetof(Frame, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_FRAME_HIGHLIGHT_BG, -1, offsetof(Frame, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_FRAME_HIGHLIGHT, -1, offsetof(Frame, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_FRAME_HIGHLIGHT_WIDTH, -1, offsetof(Frame, highlightWidth), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_FRAME_PADX, offsetof(Frame, padXPtr), offsetof(Frame, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_FRAME_PADY, offsetof(Frame, padYPtr), offsetof(Frame, padY), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_FRAME_TAKE_FOCUS, -1, offsetof(Frame, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-visual", "visual", "Visual", DEF_FRAME_VISUAL, -1, offsetof(Frame, visualName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_FRAME_WIDTH, -1, offsetof(Frame, width), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec frameOptSpec[] = { {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage", DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, -1, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_FRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_FRAME_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_FRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile", DEF_FRAME_BG_TILE, -1, offsetof(Frame, tile), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} }; static const Tk_OptionSpec toplevelOptSpec[] = { {TK_OPTION_STRING, "-backgroundimage", "backgroundImage", "BackgroundImage", DEF_FRAME_BG_IMAGE, offsetof(Frame, bgimgPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bgimg", NULL, NULL, NULL, 0, -1, 0, "-backgroundimage", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_FRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_TOPLEVEL_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", DEF_TOPLEVEL_MENU, -1, offsetof(Frame, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_FRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-screen", "screen", "Screen", DEF_TOPLEVEL_SCREEN, -1, offsetof(Frame, screenName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-tile", "tile", "Tile", DEF_FRAME_BG_TILE, -1, offsetof(Frame, tile), 0, 0, 0}, {TK_OPTION_STRING, "-use", "use", "Use", DEF_TOPLEVEL_USE, -1, offsetof(Frame, useThis), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} }; static const Tk_OptionSpec labelframeOptSpec[] = { {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_LABELFRAME_BORDER_WIDTH, -1, offsetof(Frame, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-class", "class", "Class", DEF_LABELFRAME_CLASS, -1, offsetof(Frame, className), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_LABELFRAME_FONT, -1, offsetof(Labelframe, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_LABELFRAME_FG, -1, offsetof(Labelframe, textColorPtr), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-labelanchor", "labelAnchor", "LabelAnchor", DEF_LABELFRAME_LABELANCHOR, -1, offsetof(Labelframe, labelAnchor), 0, labelAnchorStrings, 0}, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, -1, offsetof(Labelframe, labelWin), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LABELFRAME_RELIEF, -1, offsetof(Frame, relief), 0, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_LABELFRAME_TEXT, offsetof(Labelframe, textPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, commonOptSpec, 0} }; /* * Class names for widgets, indexed by FrameType. |
︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 | int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const argv[], enum FrameType type, const char *appName); static void DestroyFrame(void *memPtr); static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(ClientData clientData); static void FrameCmdDeletedProc(ClientData clientData); static void FrameEventProc(ClientData clientData, XEvent *eventPtr); static void FrameLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void FrameRequestProc(ClientData clientData, Tk_Window tkwin); | > > > > > > | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | int objc, Tcl_Obj *const objv[]); static int CreateFrame(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const argv[], enum FrameType type, const char *appName); static void DestroyFrame(void *memPtr); static void DestroyFramePartly(Frame *framePtr); static void DisplayFrame(ClientData clientData); static void DrawFrameBackground(Tk_Window tkwin, Pixmap pixmap, int highlightWidth, int borderWidth, Tk_Image bgimg, int bgtile); static void FrameBgImageProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); static void FrameCmdDeletedProc(ClientData clientData); static void FrameEventProc(ClientData clientData, XEvent *eventPtr); static void FrameLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void FrameRequestProc(ClientData clientData, Tk_Window tkwin); |
︙ | ︙ | |||
484 485 486 487 488 489 490 | { Tk_Window tkwin; Frame *framePtr; Tk_OptionTable optionTable; Tk_Window newWin; const char *className, *screenName, *visualName, *colormapName; const char *arg, *useOption; | | > | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | { Tk_Window tkwin; Frame *framePtr; Tk_OptionTable optionTable; Tk_Window newWin; const char *className, *screenName, *visualName, *colormapName; const char *arg, *useOption; int i, depth; TkSizeT length; unsigned int mask; Colormap colormap; Visual *visual; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "pathName ?-option value ...?"); return TCL_ERROR; |
︙ | ︙ | |||
511 512 513 514 515 516 517 | * be processed specially, before the window is configured using the usual * Tk mechanisms. */ className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { | | | | | | | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | * be processed specially, before the window is configured using the usual * Tk mechanisms. */ className = colormapName = screenName = visualName = useOption = NULL; colormap = None; for (i = 2; i < objc; i += 2) { arg = TkGetStringFromObj(objv[i], &length); if (length < 2) { continue; } if ((arg[1] == 'c') && (length >= 3) && (strncmp(arg, "-class", length) == 0)) { className = Tcl_GetString(objv[i+1]); } else if ((arg[1] == 'c') && (length >= 3) && (strncmp(arg, "-colormap", length) == 0)) { colormapName = Tcl_GetString(objv[i+1]); } else if ((arg[1] == 's') && (type == TYPE_TOPLEVEL) && (strncmp(arg, "-screen", length) == 0)) { screenName = Tcl_GetString(objv[i+1]); } else if ((arg[1] == 'u') && (type == TYPE_TOPLEVEL) && (strncmp(arg, "-use", length) == 0)) { useOption = Tcl_GetString(objv[i+1]); } else if ((arg[1] == 'v') && (strncmp(arg, "-visual", length) == 0)) { visualName = Tcl_GetString(objv[i+1]); } } /* * Create the window, and deal with the special options -use, -classname, * -colormap, -screenname, and -visual. These options must be handle |
︙ | ︙ | |||
678 679 680 681 682 683 684 | Tk_SetClassProcs(newWin, &frameClass, framePtr); mask = ExposureMask | StructureNotifyMask | FocusChangeMask; if (type == TYPE_TOPLEVEL) { mask |= ActivateMask; } Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr); | | | 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | Tk_SetClassProcs(newWin, &frameClass, framePtr); mask = ExposureMask | StructureNotifyMask | FocusChangeMask; if (type == TYPE_TOPLEVEL) { mask |= ActivateMask; } Tk_CreateEventHandler(newWin, mask, FrameEventProc, framePtr); if ((Tk_InitOptions(interp, framePtr, optionTable, newWin) != TCL_OK) || (ConfigureFrame(interp, framePtr, objc-2, objv+2) != TCL_OK)) { goto error; } if (framePtr->isContainer) { if (framePtr->useThis != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( |
︙ | ︙ | |||
739 740 741 742 743 744 745 | "cget", "configure", NULL }; enum options { FRAME_CGET, FRAME_CONFIGURE }; register Frame *framePtr = clientData; int result = TCL_OK, index; | | > | | | | | | | | | | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 | "cget", "configure", NULL }; enum options { FRAME_CGET, FRAME_CONFIGURE }; register Frame *framePtr = clientData; int result = TCL_OK, index; int c, i; TkSizeT length; Tcl_Obj *objPtr; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], frameOptions, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(framePtr); switch ((enum options) index) { case FRAME_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } objPtr = Tk_GetOptionValue(interp, framePtr, framePtr->optionTable, objv[2], framePtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; } Tcl_SetObjResult(interp, objPtr); break; case FRAME_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, framePtr, framePtr->optionTable, (objc == 3) ? objv[2] : NULL, framePtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; } Tcl_SetObjResult(interp, objPtr); } else { /* * Don't allow the options -class, -colormap, -container, -screen, * -use, or -visual to be changed. */ for (i = 2; i < objc; i++) { const char *arg = TkGetStringFromObj(objv[i], &length); if (length < 2) { continue; } c = arg[1]; if (((c == 'c') && (length >= 2) && (strncmp(arg, "-class", length) == 0)) || ((c == 'c') && (length >= 3) && (strncmp(arg, "-colormap", length) == 0)) || ((c == 'c') && (length >= 3) && (strncmp(arg, "-container", length) == 0)) || ((c == 's') && (framePtr->type == TYPE_TOPLEVEL) && (strncmp(arg, "-screen", length) == 0)) || ((c == 'u') && (framePtr->type == TYPE_TOPLEVEL) && (strncmp(arg, "-use", length) == 0)) || ((c == 'v') && (strncmp(arg, "-visual", length) == 0))) { #ifdef SUPPORT_CONFIG_EMBEDDED if (c == 'u') { const char *string = Tcl_GetString(objv[i+1]); if (TkpUseWindow(interp, framePtr->tkwin, string) != TCL_OK) { |
︙ | ︙ | |||
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); if (labelframePtr->textGC != NULL) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } } if (framePtr->colormap != None) { Tk_FreeColormap(framePtr->display, framePtr->colormap); } ckfree(framePtr); } /* *---------------------------------------------------------------------- * * DestroyFramePartly -- | > > > > > > > > | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 | if (framePtr->type == TYPE_LABELFRAME) { Tk_FreeTextLayout(labelframePtr->textLayout); if (labelframePtr->textGC != NULL) { Tk_FreeGC(framePtr->display, labelframePtr->textGC); } } #ifndef TK_NO_DOUBLE_BUFFERING if (framePtr->copyGC != NULL) { Tk_FreeGC(framePtr->display, framePtr->copyGC); } #endif /* TK_NO_DOUBLE_BUFFERING */ if (framePtr->colormap != None) { Tk_FreeColormap(framePtr->display, framePtr->colormap); } if (framePtr->bgimg) { Tk_FreeImage(framePtr->bgimg); } ckfree(framePtr); } /* *---------------------------------------------------------------------- * * DestroyFramePartly -- |
︙ | ︙ | |||
941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; char *oldMenuName; Tk_Window oldWindow = NULL; Labelframe *labelframePtr = (Labelframe *) framePtr; /* * Need the old menubar name for the menu code to delete it. */ if (framePtr->menuName == NULL) { oldMenuName = NULL; } else { oldMenuName = ckalloc(strlen(framePtr->menuName) + 1); strcpy(oldMenuName, framePtr->menuName); } if (framePtr->type == TYPE_LABELFRAME) { oldWindow = labelframePtr->labelWin; } | > | > > > > > > > > > > > > > > | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | int objc, /* Number of valid entries in objv. */ Tcl_Obj *const objv[]) /* Arguments. */ { Tk_SavedOptions savedOptions; char *oldMenuName; Tk_Window oldWindow = NULL; Labelframe *labelframePtr = (Labelframe *) framePtr; Tk_Image image = NULL; /* * Need the old menubar name for the menu code to delete it. */ if (framePtr->menuName == NULL) { oldMenuName = NULL; } else { oldMenuName = ckalloc(strlen(framePtr->menuName) + 1); strcpy(oldMenuName, framePtr->menuName); } if (framePtr->type == TYPE_LABELFRAME) { oldWindow = labelframePtr->labelWin; } if (Tk_SetOptions(interp, framePtr, framePtr->optionTable, objc, objv, framePtr->tkwin, &savedOptions, NULL) != TCL_OK) { if (oldMenuName != NULL) { ckfree(oldMenuName); } return TCL_ERROR; } if (framePtr->bgimgPtr) { image = Tk_GetImage(interp, framePtr->tkwin, Tcl_GetString(framePtr->bgimgPtr), FrameBgImageProc, framePtr); if (image == NULL) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } } if (framePtr->bgimg) { Tk_FreeImage(framePtr->bgimg); } framePtr->bgimg = image; Tk_FreeSavedOptions(&savedOptions); /* * A few of the options require additional processing. */ if ((((oldMenuName == NULL) && (framePtr->menuName != NULL)) |
︙ | ︙ | |||
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 | anyTextLabel = (framePtr->type == TYPE_LABELFRAME) && (labelframePtr->textPtr != NULL) && (labelframePtr->labelWin == NULL); anyWindowLabel = (framePtr->type == TYPE_LABELFRAME) && (labelframePtr->labelWin != NULL); if (framePtr->type == TYPE_LABELFRAME) { /* * The textGC is needed even in the labelWin case, so it's always * created for a labelframe. */ gcValues.font = Tk_FontId(labelframePtr->tkfont); | > > > > > > > > > | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | anyTextLabel = (framePtr->type == TYPE_LABELFRAME) && (labelframePtr->textPtr != NULL) && (labelframePtr->labelWin == NULL); anyWindowLabel = (framePtr->type == TYPE_LABELFRAME) && (labelframePtr->labelWin != NULL); #ifndef TK_NO_DOUBLE_BUFFERING gcValues.graphics_exposures = False; gc = Tk_GetGC(tkwin, GCGraphicsExposures, &gcValues); if (framePtr->copyGC != NULL) { Tk_FreeGC(framePtr->display, framePtr->copyGC); } framePtr->copyGC = gc; #endif /* TK_NO_DOUBLE_BUFFERING */ if (framePtr->type == TYPE_LABELFRAME) { /* * The textGC is needed even in the labelWin case, so it's always * created for a labelframe. */ gcValues.font = Tk_FontId(labelframePtr->tkfont); |
︙ | ︙ | |||
1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | * If -background is set to "", no interior is drawn. */ if (framePtr->border == NULL) { return; } if (framePtr->type != TYPE_LABELFRAME) { /* * Pass to platform specific draw function. In general, it just draws * a simple rectangle, but it may "theme" the background. */ noLabel: | > > > > > > > > > > > > > > | > > > > < < < < < < < < < < < < < < | 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 | * If -background is set to "", no interior is drawn. */ if (framePtr->border == NULL) { return; } #ifndef TK_NO_DOUBLE_BUFFERING /* * In order to avoid screen flashes, this function redraws the frame into * off-screen memory, then copies it back on-screen in a single operation. * This means there's no point in time where the on-screen image has been * cleared. */ pixmap = Tk_GetPixmap(framePtr->display, Tk_WindowId(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), Tk_Depth(tkwin)); #else pixmap = Tk_WindowId(tkwin); #endif /* TK_NO_DOUBLE_BUFFERING */ if (framePtr->type != TYPE_LABELFRAME) { /* * Pass to platform specific draw function. In general, it just draws * a simple rectangle, but it may "theme" the background. */ noLabel: TkpDrawFrameEx(tkwin, pixmap, framePtr->border, hlWidth, framePtr->borderWidth, framePtr->relief); if (framePtr->bgimg) { DrawFrameBackground(tkwin, pixmap, hlWidth, framePtr->borderWidth, framePtr->bgimg, framePtr->tile); } } else { Labelframe *labelframePtr = (Labelframe *) framePtr; if ((labelframePtr->textPtr == NULL) && (labelframePtr->labelWin == NULL)) { goto noLabel; } /* * Clear the pixmap. */ Tk_Fill3DRectangle(tkwin, pixmap, framePtr->border, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); |
︙ | ︙ | |||
1591 1592 1593 1594 1595 1596 1597 | } else { Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin, labelframePtr->labelBox.x, labelframePtr->labelBox.y, labelframePtr->labelBox.width, labelframePtr->labelBox.height); } } | | > | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | } else { Tk_MaintainGeometry(labelframePtr->labelWin, framePtr->tkwin, labelframePtr->labelBox.x, labelframePtr->labelBox.y, labelframePtr->labelBox.width, labelframePtr->labelBox.height); } } } #ifndef TK_NO_DOUBLE_BUFFERING /* * Everything's been redisplayed; now copy the pixmap onto the screen and * free up the pixmap. */ XCopyArea(framePtr->display, pixmap, Tk_WindowId(tkwin), framePtr->copyGC, hlWidth, hlWidth, (unsigned) (Tk_Width(tkwin) - 2 * hlWidth), (unsigned) (Tk_Height(tkwin) - 2 * hlWidth), hlWidth, hlWidth); Tk_FreePixmap(framePtr->display, pixmap); #endif /* TK_NO_DOUBLE_BUFFERING */ } /* *---------------------------------------------------------------------- * * TkpDrawFrame -- * * This procedure draws the rectangular frame area. * * Results: * None. * * Side effects: * Draws inside the tkwin area. * *---------------------------------------------------------------------- */ void TkpDrawFrame( Tk_Window tkwin, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) { /* * Legacy shim to allow for external callers. Internal ones use * non-exposed TkpDrawFrameEx directly so they can use double-buffering. */ TkpDrawFrameEx(tkwin, Tk_WindowId(tkwin), border, highlightWidth, borderWidth, relief); } /* *-------------------------------------------------------------- * * FrameEventProc -- * |
︙ | ︙ | |||
2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 | } framePtr = cmdInfo.objClientData; if (framePtr->type != TYPE_TOPLEVEL) { return NULL; } return framePtr->tkwin; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 | } framePtr = cmdInfo.objClientData; if (framePtr->type != TYPE_TOPLEVEL) { return NULL; } return framePtr->tkwin; } /* *---------------------------------------------------------------------- * * FrameBgImageProc -- * * This function is invoked by the image code whenever the manager for an * image does something that affects the size or contents of an image * displayed on a frame's background. * * Results: * None. * * Side effects: * Arranges for the button to get redisplayed. * *---------------------------------------------------------------------- */ static void FrameBgImageProc( ClientData clientData, /* Pointer to widget record. */ int x, int y, /* Upper left pixel (within image) that must * be redisplayed. */ int width, int height, /* Dimensions of area to redisplay (might be * <= 0). */ int imgWidth, int imgHeight)/* New dimensions of image. */ { register Frame *framePtr = clientData; /* * Changing the background image never alters the dimensions of the frame. */ if (framePtr->tkwin && Tk_IsMapped(framePtr->tkwin) && !(framePtr->flags & REDRAW_PENDING)) { Tcl_DoWhenIdle(DisplayFrame, framePtr); framePtr->flags |= REDRAW_PENDING; } } /* *---------------------------------------------------------------------- * * DrawFrameBackground -- * * This function draws the background image of a rectangular frame area. * * Results: * None. * * Side effects: * Draws inside the tkwin area. * *---------------------------------------------------------------------- */ static void DrawFrameBackground( Tk_Window tkwin, Pixmap pixmap, int highlightWidth, int borderWidth, Tk_Image bgimg, int bgtile) { int width, height; /* Area to paint on. */ int imageWidth, imageHeight; /* Dimensions of image. */ const int bw = highlightWidth + borderWidth; Tk_SizeOfImage(bgimg, &imageWidth, &imageHeight); width = Tk_Width(tkwin) - 2*bw; height = Tk_Height(tkwin) - 2*bw; if (bgtile) { /* * Draw the image tiled in the widget (inside the border). */ int x, y; for (x = bw; x - bw < width; x += imageWidth) { int w = imageWidth; if (x - bw + imageWidth > width) { w = (width + bw) - x; } for (y = bw; y < height + bw; y += imageHeight) { int h = imageHeight; if (y - bw + imageHeight > height) { h = (height + bw) - y; } Tk_RedrawImage(bgimg, 0, 0, w, h, pixmap, x, y); } } } else { /* * Draw the image centred in the widget (inside the border). */ int x, y, xOff, yOff, w, h; if (width > imageWidth) { x = 0; xOff = (Tk_Width(tkwin) - imageWidth) / 2; w = imageWidth; } else { x = (imageWidth - width) / 2; xOff = bw; w = width; } if (height > imageHeight) { y = 0; yOff = (Tk_Height(tkwin) - imageHeight) / 2; h = imageHeight; } else { y = (imageHeight - height) / 2; yOff = bw; h = height; } Tk_RedrawImage(bgimg, x, y, w, h, pixmap, xOff, yOff); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkGC.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | * values in the graphics context and the other based on the display and GC * identifier. */ typedef struct { GC gc; /* Graphics context. */ Display *display; /* Display to which gc belongs. */ | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | * values in the graphics context and the other based on the display and GC * identifier. */ typedef struct { GC gc; /* Graphics context. */ Display *display; /* Display to which gc belongs. */ size_t refCount; /* Number of active uses of gc. */ Tcl_HashEntry *valueHashPtr;/* Entry in valueTable (needed when deleting * this structure). */ } TkGC; typedef struct { XGCValues values; /* Desired values for GC. */ Display *display; /* Display for which GC is valid. */ |
︙ | ︙ | |||
303 304 305 306 307 308 309 | * This may still get called by other things shutting down, but the * GCs should no longer be in use. */ return; } | | < | | 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | * This may still get called by other things shutting down, but the * GCs should no longer be in use. */ return; } idHashPtr = Tcl_FindHashEntry(&dispPtr->gcIdTable, gc); if (idHashPtr == NULL) { Tcl_Panic("Tk_FreeGC received unknown gc argument"); } gcPtr = Tcl_GetHashValue(idHashPtr); if (gcPtr->refCount-- <= 1) { XFreeGC(gcPtr->display, gcPtr->gc); Tcl_DeleteHashEntry(gcPtr->valueHashPtr); Tcl_DeleteHashEntry(idHashPtr); ckfree(gcPtr); } } |
︙ | ︙ |
Changes to generic/tkGeometry.c.
︙ | ︙ | |||
323 324 325 326 327 328 329 | Tcl_Interp *interp, /* Current interpreter, for error. */ Tk_Window tkwin, /* Window that will have geometry master * set. */ const char *master) /* The master identity. */ { register TkWindow *winPtr = (TkWindow *) tkwin; | | | | | | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | Tcl_Interp *interp, /* Current interpreter, for error. */ Tk_Window tkwin, /* Window that will have geometry master * set. */ const char *master) /* The master identity. */ { register TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) == 0) { return TCL_OK; } if (winPtr->geomMgrName != NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "cannot use geometry manager %s inside %s which already" " has slaves managed by %s", master, Tk_PathName(tkwin), winPtr->geomMgrName)); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "FIGHT", NULL); } return TCL_ERROR; } winPtr->geomMgrName = ckalloc(strlen(master) + 1); strcpy(winPtr->geomMgrName, master); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkFreeGeometryMaster -- |
︙ | ︙ | |||
368 369 370 371 372 373 374 | TkFreeGeometryMaster( Tk_Window tkwin, /* Window that will have geometry master * cleared. */ const char *master) /* The master identity. */ { register TkWindow *winPtr = (TkWindow *) tkwin; | | | | | | | | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | TkFreeGeometryMaster( Tk_Window tkwin, /* Window that will have geometry master * cleared. */ const char *master) /* The master identity. */ { register TkWindow *winPtr = (TkWindow *) tkwin; if (winPtr->geomMgrName != NULL && strcmp(winPtr->geomMgrName, master) != 0) { Tcl_Panic("Trying to free %s from geometry manager %s", winPtr->geomMgrName, master); } if (winPtr->geomMgrName != NULL) { ckfree(winPtr->geomMgrName); winPtr->geomMgrName = NULL; } } /* *---------------------------------------------------------------------- * * Tk_MaintainGeometry -- |
︙ | ︙ | |||
421 422 423 424 425 426 427 428 429 430 431 432 433 434 | Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; register MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; if (master == Tk_Parent(slave)) { /* * If the slave is a direct descendant of the master, don't bother * setting up the extra infrastructure for management, just make a * call to Tk_MoveResizeWindow; the parent/child relationship will * take care of the rest. */ | > > > | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; register MaintainSlave *slavePtr; int isNew, map; Tk_Window ancestor, parent; TkDisplay *dispPtr = ((TkWindow *) master)->dispPtr; ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; ((TkWindow *)slave)->maintainerPtr = (TkWindow *)master; if (master == Tk_Parent(slave)) { /* * If the slave is a direct descendant of the master, don't bother * setting up the extra infrastructure for management, just make a * call to Tk_MoveResizeWindow; the parent/child relationship will * take care of the rest. */ |
︙ | ︙ | |||
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; register MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; if (master == Tk_Parent(slave)) { /* * If the slave is a direct descendant of the master, * Tk_MaintainGeometry will not have set up any of the extra * infrastructure. Don't even bother to look for it, just return. */ return; } if (!dispPtr->geomInit) { dispPtr->geomInit = 1; Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); } if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) { Tk_UnmapWindow(slave); } | > > > | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | { Tcl_HashEntry *hPtr; MaintainMaster *masterPtr; register MaintainSlave *slavePtr, *prevPtr; Tk_Window ancestor; TkDisplay *dispPtr = ((TkWindow *) slave)->dispPtr; ((TkWindow *)slave)->maintainerPtr = NULL; ((TkWindow *)slave)->maintainerPtr = NULL; if (master == Tk_Parent(slave)) { /* * If the slave is a direct descendant of the master, * Tk_MaintainGeometry will not have set up any of the extra * infrastructure. Don't even bother to look for it, just return. */ return; } if (!dispPtr->geomInit) { dispPtr->geomInit = 1; Tcl_InitHashTable(&dispPtr->maintainHashTable, TCL_ONE_WORD_KEYS); } if (!(((TkWindow *) slave)->flags & TK_ALREADY_DEAD)) { Tk_UnmapWindow(slave); } hPtr = Tcl_FindHashEntry(&dispPtr->maintainHashTable, master); if (hPtr == NULL) { return; } masterPtr = Tcl_GetHashValue(hPtr); slavePtr = masterPtr->slavePtr; if (slavePtr->slave == slave) { masterPtr->slavePtr = slavePtr->nextPtr; |
︙ | ︙ |
Changes to generic/tkGet.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | /* * One of these structures is created per thread to store thread-specific * data. In this case, it is used to house the Tk_Uid structs used by each * thread. The "dataKey" below is used to locate the ThreadSpecificData for * the current thread. */ | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * One of these structures is created per thread to store thread-specific * data. In this case, it is used to house the Tk_Uid structs used by each * thread. The "dataKey" below is used to locate the ThreadSpecificData for * the current thread. */ typedef struct { int initialized; Tcl_HashTable uidTable; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; static void FreeUidThreadExitProc(ClientData clientData); |
︙ | ︙ |
Changes to generic/tkGrab.c.
︙ | ︙ | |||
130 131 132 133 134 135 136 | * EnterNotify and LeaveNotify events that are generated in this file. This * allows us to separate "real" events coming from the server from those that * we generated. */ #define GENERATED_GRAB_EVENT_MAGIC ((Bool) 0x147321ac) | < < < < < < < < < < < | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | * EnterNotify and LeaveNotify events that are generated in this file. This * allows us to separate "real" events coming from the server from those that * we generated. */ #define GENERATED_GRAB_EVENT_MAGIC ((Bool) 0x147321ac) /* * Forward declarations for functions declared later in this file: */ static void EatGrabEvents(TkDisplay *dispPtr, unsigned int serial); static TkWindow * FindCommonAncestor(TkWindow *winPtr1, TkWindow *winPtr2, int *countPtr1, int *countPtr2); |
︙ | ︙ | |||
186 187 188 189 190 191 192 | Tcl_Obj *const objv[]) /* Argument objects. */ { int globalGrab; Tk_Window tkwin; TkDisplay *dispPtr; const char *arg; int index; | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | Tcl_Obj *const objv[]) /* Argument objects. */ { int globalGrab; Tk_Window tkwin; TkDisplay *dispPtr; const char *arg; int index; TkSizeT len; static const char *const optionStrings[] = { "current", "release", "set", "status", NULL }; static const char *const flagStrings[] = { "-global", NULL }; enum options { |
︙ | ︙ | |||
223 224 225 226 227 228 229 | return TCL_ERROR; } /* * First check for a window name or "-global" as the first argument. */ | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | return TCL_ERROR; } /* * First check for a window name or "-global" as the first argument. */ arg = TkGetStringFromObj(objv[1], &len); if (arg[0] == '.') { /* [grab window] */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "?-global? window"); return TCL_ERROR; } tkwin = Tk_NameToWindow(interp, arg, clientData); |
︙ | ︙ | |||
877 878 879 880 881 882 883 | } } } dispPtr->buttonWinPtr = winPtr; return 1; } } else { | > | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 | } } } dispPtr->buttonWinPtr = winPtr; return 1; } } else { if (eventPtr->xbutton.button != AnyButton && ((eventPtr->xbutton.state & ALL_BUTTONS) == TkGetButtonMask(eventPtr->xbutton.button))) { ReleaseButtonGrab(dispPtr); /* Note 4. */ } } if (winPtr2 != winPtr) { TkChangeEventWindow(eventPtr, winPtr2); Tk_QueueWindowEvent(eventPtr, TCL_QUEUE_HEAD); return 0; /* Note 3. */ |
︙ | ︙ | |||
1377 1378 1379 1380 1381 1382 1383 | * *---------------------------------------------------------------------- */ static int GrabWinEventProc( Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */ | | | 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 | * *---------------------------------------------------------------------- */ static int GrabWinEventProc( Tcl_Event *evPtr, /* Event of type NewGrabWinEvent. */ int flags) /* Flags argument to Tcl_DoOneEvent: indicates * what kinds of events are being processed * right now. */ { NewGrabWinEvent *grabEvPtr = (NewGrabWinEvent *) evPtr; grabEvPtr->dispPtr->grabWinPtr = (TkWindow *) Tk_IdToWindow( grabEvPtr->dispPtr->display, grabEvPtr->grabWindow); |
︙ | ︙ |
Changes to generic/tkGrid.c.
︙ | ︙ | |||
288 289 290 291 292 293 294 | int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); static void GridLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); static void InitMasterData(Gridder *masterPtr); | | | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | int objc, Tcl_Obj *const objv[]); static void GridStructureProc(ClientData clientData, XEvent *eventPtr); static void GridLostSlaveProc(ClientData clientData, Tk_Window tkwin); static void GridReqProc(ClientData clientData, Tk_Window tkwin); static void InitMasterData(Gridder *masterPtr); static Tcl_Obj * NewPairObj(Tcl_WideInt, Tcl_WideInt); static Tcl_Obj * NewQuadObj(Tcl_WideInt, Tcl_WideInt, Tcl_WideInt, Tcl_WideInt); static int ResolveConstraints(Gridder *gridPtr, int rowOrColumn, int maxOffset); static void SetGridSize(Gridder *gridPtr); static int SetSlaveColumn(Tcl_Interp *interp, Gridder *slavePtr, int column, int numCols); static int SetSlaveRow(Tcl_Interp *interp, Gridder *slavePtr, int row, int numRows); |
︙ | ︙ | |||
737 738 739 740 741 742 743 | return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), TkNewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), | | | | | | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 | return TCL_OK; } infoObj = Tcl_NewObj(); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-in", -1), TkNewWindowObj(slavePtr->masterPtr->tkwin)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-column", -1), Tcl_NewWideIntObj(slavePtr->column)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-row", -1), Tcl_NewWideIntObj(slavePtr->row)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-columnspan", -1), Tcl_NewWideIntObj(slavePtr->numCols)); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-rowspan", -1), Tcl_NewWideIntObj(slavePtr->numRows)); TkAppendPadAmount(infoObj, "-ipadx", slavePtr->iPadX/2, slavePtr->iPadX); TkAppendPadAmount(infoObj, "-ipady", slavePtr->iPadY/2, slavePtr->iPadY); TkAppendPadAmount(infoObj, "-padx", slavePtr->padLeft, slavePtr->padX); TkAppendPadAmount(infoObj, "-pady", slavePtr->padTop, slavePtr->padY); Tcl_DictObjPut(NULL, infoObj, Tcl_NewStringObj("-sticky", -1), StickyToObj(slavePtr->sticky)); Tcl_SetObjResult(interp, infoObj); |
︙ | ︙ | |||
1051 1052 1053 1054 1055 1056 1057 | pad = slotPtr[slot].pad; weight = slotPtr[slot].weight; uniform = slotPtr[slot].uniform; } Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-minsize", -1)); | | | | | | | | 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | pad = slotPtr[slot].pad; weight = slotPtr[slot].weight; uniform = slotPtr[slot].uniform; } Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-minsize", -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(minsize)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-pad", -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(pad)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-uniform", -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj(uniform == NULL ? "" : uniform, -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewStringObj("-weight", -1)); Tcl_ListObjAppendElement(interp, res, Tcl_NewWideIntObj(weight)); Tcl_SetObjResult(interp, res); Tcl_DecrRefCount(listCopy); return TCL_OK; } /* * If only one option is given, with no value, the current value is * returned. */ if (Tcl_GetIndexFromObjStruct(interp, objv[4], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { Tcl_DecrRefCount(listCopy); return TCL_ERROR; } if (index == ROWCOL_MINSIZE) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].minSize : 0)); } else if (index == ROWCOL_WEIGHT) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].weight : 0)); } else if (index == ROWCOL_UNIFORM) { Tk_Uid value = (ok == TCL_OK) ? slotPtr[slot].uniform : ""; Tcl_SetObjResult(interp, Tcl_NewStringObj( (value == NULL) ? "" : value, -1)); } else if (index == ROWCOL_PAD) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (ok == TCL_OK) ? slotPtr[slot].pad : 0)); } Tcl_DecrRefCount(listCopy); return TCL_OK; } for (j = 0; j < lObjc; j++) { |
︙ | ︙ | |||
1728 1729 1730 1731 1732 1733 1734 | int width, height; /* Requested size of layout, in pixels. */ int realWidth, realHeight; /* Actual size layout should take-up. */ int usedX, usedY; masterPtr->flags &= ~REQUESTED_RELAYOUT; /* | | | | < | 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 | int width, height; /* Requested size of layout, in pixels. */ int realWidth, realHeight; /* Actual size layout should take-up. */ int usedX, usedY; masterPtr->flags &= ~REQUESTED_RELAYOUT; /* * If the master has no slaves anymore, then don't change the master size. * Otherwise there is no way to "relinquish" control over the master * so another geometry manager can take over. */ if (masterPtr->slavePtr == NULL) { return; } if (masterPtr->masterDataPtr == NULL) { |
︙ | ︙ | |||
1909 1910 1911 1912 1913 1914 1915 | * constraints. */ int slotCount; /* Last occupied row or column. */ int gridCount; /* The larger of slotCount and * constraintCount. */ GridLayout *layoutPtr; /* Temporary layout structure. */ int requiredSize; /* The natural size of the grid (pixels). * This is the minimum size needed to | | | 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 | * constraints. */ int slotCount; /* Last occupied row or column. */ int gridCount; /* The larger of slotCount and * constraintCount. */ GridLayout *layoutPtr; /* Temporary layout structure. */ int requiredSize; /* The natural size of the grid (pixels). * This is the minimum size needed to * accommodate all of the slaves at their * requested sizes. */ int offset; /* The pixel offset of the right edge of the * current slot from the beginning of the * layout. */ int slot; /* The current slot. */ int start; /* The first slot of a contiguous set whose * constraints are not yet fully resolved. */ |
︙ | ︙ | |||
2482 2483 2484 2485 2486 2487 2488 | * * Results: * None * * Side effects: * The width and height arguments are filled in the master data * structure. Additional space is allocated for the constraints to | | | 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 | * * Results: * None * * Side effects: * The width and height arguments are filled in the master data * structure. Additional space is allocated for the constraints to * accommodate the offsets. * *---------------------------------------------------------------------- */ static void SetGridSize( Gridder *masterPtr) /* The geometry master for this grid. */ |
︙ | ︙ | |||
2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 | SetGridSize(slavePtr->masterPtr); slavePtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; } } /* *---------------------------------------------------------------------- * * DestroyGrid -- | > > > > | 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 | SetGridSize(slavePtr->masterPtr); slavePtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. * * Send the event "NoManagedChild" to the master to inform it about there * being no managed children inside it. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } } /* *---------------------------------------------------------------------- * * DestroyGrid -- |
︙ | ︙ | |||
2878 2879 2880 2881 2882 2883 2884 | Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); Tk_UnmapWindow(slavePtr->tkwin); slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, | | | 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 | Tk_ManageGeometry(slavePtr->tkwin, NULL, NULL); Tk_UnmapWindow(slavePtr->tkwin); slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->gridHashTable, gridPtr->tkwin)); if (gridPtr->flags & REQUESTED_RELAYOUT) { Tcl_CancelIdleCall(ArrangeGrid, gridPtr); } gridPtr->tkwin = NULL; Tcl_EventuallyFree(gridPtr, (Tcl_FreeProc *)DestroyGrid); } else if (eventPtr->type == MapNotify) { if ((gridPtr->slavePtr != NULL) |
︙ | ︙ | |||
2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 | * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { Gridder *masterPtr = NULL; Gridder *slavePtr; Tk_Window other, slave, parent, ancestor; int i, j, tmp; int numWindows; int width; int defaultRow = -1; int defaultColumn = 0; /* Default column number */ int defaultColumnSpan = 1; /* Default number of columns */ const char *lastWindow; /* Use this window to base current row/col | > | 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 | * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { Gridder *masterPtr = NULL; Gridder *slavePtr; Tk_Window other, slave, parent, ancestor; TkWindow *master; int i, j, tmp; int numWindows; int width; int defaultRow = -1; int defaultColumn = 0; /* Default column number */ int defaultColumnSpan = 1; /* Default number of columns */ const char *lastWindow; /* Use this window to base current row/col |
︙ | ︙ | |||
2961 2962 2963 2964 2965 2966 2967 | /* * Count the number of windows, or window short-cuts. */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { | | | | 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 | /* * Count the number of windows, or window short-cuts. */ firstChar = 0; for (numWindows=0, i=0; i < objc; i++) { TkSizeT length; char prevChar = firstChar; string = TkGetStringFromObj(objv[i], &length); firstChar = string[0]; if (firstChar == '.') { /* * Check that windows are valid, and locate the first slave's * parent window (default for -in). */ |
︙ | ︙ | |||
3348 3349 3350 3351 3352 3353 3354 | Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); Unlink(slavePtr); return TCL_ERROR; } } /* | | > > | | | | | | | > > > > | 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 | Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "HIERARCHY", NULL); Unlink(slavePtr); return TCL_ERROR; } } /* * Check for management loops. */ for (master = (TkWindow *)masterPtr->tkwin; master != NULL; master = (TkWindow *)TkGetGeomMaster(master)) { if (master == (TkWindow *)slave) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); Unlink(slavePtr); return TCL_ERROR; } } if (masterPtr->tkwin != Tk_Parent(slave)) { ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; } Tk_ManageGeometry(slave, &gridMgrType, slavePtr); if (!(masterPtr->flags & DONT_PROPAGATE)) { if (TkSetGeometryMaster(interp, masterPtr->tkwin, "grid") != TCL_OK) { Tk_ManageGeometry(slave, NULL, NULL); |
︙ | ︙ | |||
3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 | return TCL_ERROR; } SetGridSize(masterPtr); /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; } return TCL_OK; } /* *---------------------------------------------------------------------- | > > > > | 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 | return TCL_ERROR; } SetGridSize(masterPtr); /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. * * Send the event "NoManagedChild" to the master to inform it about there * being no managed children inside it. */ if (masterPtr->slavePtr == NULL && masterPtr->flags & ALLOCED_MASTER) { TkFreeGeometryMaster(masterPtr->tkwin, "grid"); masterPtr->flags &= ~ALLOCED_MASTER; TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3620 3621 3622 3623 3624 3625 3626 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * NewPairObj( | | | | | 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * NewPairObj( Tcl_WideInt val1, Tcl_WideInt val2) { Tcl_Obj *ary[2]; ary[0] = Tcl_NewWideIntObj(val1); ary[1] = Tcl_NewWideIntObj(val2); return Tcl_NewListObj(2, ary); } /* *---------------------------------------------------------------------- * * NewQuadObj -- |
︙ | ︙ | |||
3647 3648 3649 3650 3651 3652 3653 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * NewQuadObj( | | | | | | | 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 | * None. * *---------------------------------------------------------------------- */ static Tcl_Obj * NewQuadObj( Tcl_WideInt val1, Tcl_WideInt val2, Tcl_WideInt val3, Tcl_WideInt val4) { Tcl_Obj *ary[4]; ary[0] = Tcl_NewWideIntObj(val1); ary[1] = Tcl_NewWideIntObj(val2); ary[2] = Tcl_NewWideIntObj(val3); ary[3] = Tcl_NewWideIntObj(val4); return Tcl_NewListObj(4, ary); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkImage.c.
︙ | ︙ | |||
62 63 64 65 66 67 68 | Image *instancePtr; /* Pointer to first in list of instances * derived from this name. */ int deleted; /* Flag set when image is being deleted. */ TkWindow *winPtr; /* Main window of interpreter (used to detect * when the world is falling apart.) */ } ImageMaster; | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | Image *instancePtr; /* Pointer to first in list of instances * derived from this name. */ int deleted; /* Flag set when image is being deleted. */ TkWindow *winPtr; /* Main window of interpreter (used to detect * when the world is falling apart.) */ } ImageMaster; typedef struct { Tk_ImageType *imageTypeList;/* First in a list of all known image * types. */ Tk_ImageType *oldImageTypeList; /* First in a list of all known old-style * image types. */ int initialized; /* Set to 1 if we've initialized the * structure. */ |
︙ | ︙ | |||
470 471 472 473 474 475 476 | /* * Now we read off the specific piece of data we were asked for. */ switch ((enum options) index) { case IMAGE_HEIGHT: | | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | /* * Now we read off the specific piece of data we were asked for. */ switch ((enum options) index) { case IMAGE_HEIGHT: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->height)); break; case IMAGE_INUSE: Tcl_SetObjResult(interp, Tcl_NewBooleanObj( masterPtr->typePtr && masterPtr->instancePtr)); break; case IMAGE_TYPE: if (masterPtr->typePtr != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(masterPtr->typePtr->name, -1)); } break; case IMAGE_WIDTH: Tcl_SetObjResult(interp, Tcl_NewWideIntObj(masterPtr->width)); break; default: Tcl_Panic("can't happen"); } break; } return TCL_OK; |
︙ | ︙ |
Changes to generic/tkImgBmap.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 | /* * The following data structure represents all of the instances of an image * that lie within a particular window: */ typedef struct BitmapInstance { | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /* * The following data structure represents all of the instances of an image * that lie within a particular window: */ typedef struct BitmapInstance { size_t refCount; /* Number of instances that share this data * structure. */ BitmapMaster *masterPtr; /* Pointer to master for image. */ Tk_Window tkwin; /* Window in which the instances will be * displayed. */ XColor *fg; /* Foreground color for displaying image. */ XColor *bg; /* Background color for displaying image. */ Pixmap bitmap; /* The bitmap to display. */ |
︙ | ︙ | |||
104 105 106 107 108 109 110 | /* * Information used for parsing configuration specs: */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, | | | | | | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | /* * Information used for parsing configuration specs: */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_UID, "-background", NULL, NULL, "", offsetof(BitmapMaster, bgUid), 0, NULL}, {TK_CONFIG_STRING, "-data", NULL, NULL, NULL, offsetof(BitmapMaster, dataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-file", NULL, NULL, NULL, offsetof(BitmapMaster, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_UID, "-foreground", NULL, NULL, "#000000", offsetof(BitmapMaster, fgUid), 0, NULL}, {TK_CONFIG_STRING, "-maskdata", NULL, NULL, NULL, offsetof(BitmapMaster, maskDataString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_STRING, "-maskfile", NULL, NULL, NULL, offsetof(BitmapMaster, maskFileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * The following data structure is used to describe the state of parsing a * bitmap file or string. It is used for communication between TkGetBitmapData * and NextBitmapWord. |
︙ | ︙ | |||
947 948 949 950 951 952 953 | ClientData clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { BitmapInstance *instancePtr = clientData; BitmapInstance *prevPtr; | < | | 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 | ClientData clientData, /* Pointer to BitmapInstance structure for * instance to be displayed. */ Display *display) /* Display containing window that used image. */ { BitmapInstance *instancePtr = clientData; BitmapInstance *prevPtr; if (instancePtr->refCount-- > 1) { return; } /* * There are no more uses of the image within this widget. Free the * instance structure. */ |
︙ | ︙ | |||
1076 1077 1078 1079 1080 1081 1082 | */ static int GetByte( Tcl_Channel chan) /* The channel we read from. */ { char buffer; | | | | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | */ static int GetByte( Tcl_Channel chan) /* The channel we read from. */ { char buffer; size_t size; size = Tcl_Read(chan, &buffer, 1); if ((size + 1) < 2) { return EOF; } else { return buffer; } } /* |
︙ | ︙ |
Changes to generic/tkImgGIF.c.
︙ | ︙ | |||
51 52 53 54 55 56 57 | * state keeps track of which byte we are about to read, or EOF. */ typedef struct mFile { unsigned char *data; /* mmencoded source string */ int c; /* bits left over from previous character */ int state; /* decoder state (0-4 or GIF_DONE) */ | | | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | * state keeps track of which byte we are about to read, or EOF. */ typedef struct mFile { unsigned char *data; /* mmencoded source string */ int c; /* bits left over from previous character */ int state; /* decoder state (0-4 or GIF_DONE) */ size_t length; /* Total amount of bytes in data */ } MFile; /* * Non-ASCII encoding support: * Most data in a GIF image is binary and is treated as such. However, a few * key bits are stashed in ASCII. If we try to compare those pieces to the * char they represent, it will fail on any non-ASCII (eg, EBCDIC) system. To * accommodate these systems, we test against the numeric value of the ASCII * characters instead of the characters themselves. This is encoding * independent. */ static const char GIF87a[] = { /* ASCII GIF87a */ 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x00 }; static const char GIF89a[] = { /* ASCII GIF89a */ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x00 |
︙ | ︙ | |||
107 108 109 110 111 112 113 | } GIFImageConfig; /* * Type of a function used to do the writing to a file or buffer when * serializing in the GIF format. */ | | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | } GIFImageConfig; /* * Type of a function used to do the writing to a file or buffer when * serializing in the GIF format. */ typedef size_t (WriteBytesFunc) (ClientData clientData, const char *bytes, size_t byteCount); /* * The format record for the GIF file format: */ static int FileMatchGIF(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, |
︙ | ︙ | |||
183 184 185 186 187 188 189 | unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, int srcY, int interlace, int transparent); /* * these are for the BASE64 image reader code only */ | | | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, int srcY, int interlace, int transparent); /* * these are for the BASE64 image reader code only */ static size_t Fread(GIFImageConfig *gifConfPtr, unsigned char *dst, size_t size, size_t count, Tcl_Channel chan); static size_t Mread(unsigned char *dst, size_t size, size_t count, MFile *handle); static int Mgetc(MFile *handle); static int char64(int c); static void mInit(unsigned char *string, MFile *handle, size_t length); /* * Types, defines and variables needed to write and compress a GIF. */ #define LSB(a) ((unsigned char) (((short)(a)) & 0x00FF)) #define MSB(a) ((unsigned char) (((short)(a)) >> 8)) |
︙ | ︙ | |||
753 754 755 756 757 758 759 | Tcl_Obj *dataObj, /* the object containing the image data */ Tcl_Obj *format, /* the image format object, or NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ Tcl_Interp *interp) /* not used */ { unsigned char *data, header[10]; | | | | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | Tcl_Obj *dataObj, /* the object containing the image data */ Tcl_Obj *format, /* the image format object, or NULL */ int *widthPtr, /* where to put the string width */ int *heightPtr, /* where to put the string height */ Tcl_Interp *interp) /* not used */ { unsigned char *data, header[10]; TkSizeT got, length; MFile handle; data = TkGetByteArrayFromObj(dataObj, &length); /* * Header is a minimum of 10 bytes. */ if (length < 10) { return 0; |
︙ | ︙ | |||
822 823 824 825 826 827 828 | Tcl_Obj *format, /* format object, or NULL */ Tk_PhotoHandle imageHandle, /* the image to write this data into */ int destX, int destY, /* The rectangular region of the */ int width, int height, /* image to copy */ int srcX, int srcY) { MFile handle, *hdlPtr = &handle; | | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 | Tcl_Obj *format, /* format object, or NULL */ Tk_PhotoHandle imageHandle, /* the image to write this data into */ int destX, int destY, /* The rectangular region of the */ int width, int height, /* image to copy */ int srcX, int srcY) { MFile handle, *hdlPtr = &handle; TkSizeT length; const char *xferFormat; unsigned char *data = TkGetByteArrayFromObj(dataObj, &length); mInit(data, hdlPtr, length); /* * Check whether the data is Base64 encoded by doing a character-by- * charcter comparison with the binary-format headers; BASE64-encoded * never matches (matching the other way is harder because of potential |
︙ | ︙ | |||
913 914 915 916 917 918 919 | int number, unsigned char buffer[MAXCOLORMAPSIZE][4]) { int i; unsigned char rgb[3]; for (i = 0; i < number; ++i) { | | | 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | int number, unsigned char buffer[MAXCOLORMAPSIZE][4]) { int i; unsigned char rgb[3]; for (i = 0; i < number; ++i) { if (((size_t)Fread(gifConfPtr, rgb, sizeof(rgb), 1, chan) + 1) < 2) { return 0; } if (buffer) { buffer[i][CM_RED] = rgb[0]; buffer[i][CM_GREEN] = rgb[1]; buffer[i][CM_BLUE] = rgb[2]; |
︙ | ︙ | |||
979 980 981 982 983 984 985 | GetDataBlock( GIFImageConfig *gifConfPtr, Tcl_Channel chan, unsigned char *buf) { unsigned char count; | | | | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | GetDataBlock( GIFImageConfig *gifConfPtr, Tcl_Channel chan, unsigned char *buf) { unsigned char count; if (((size_t)Fread(gifConfPtr, &count, 1, 1, chan) + 1) < 2) { return -1; } if ((count != 0) && (((size_t)Fread(gifConfPtr, buf, count, 1, chan) + 1) < 2)) { return -1; } return count; } /* |
︙ | ︙ | |||
1030 1031 1032 1033 1034 1035 1036 | int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, int srcY, int interlace, int transparent) { unsigned char initialCodeSize; | | | | 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | int len, int rows, unsigned char cmap[MAXCOLORMAPSIZE][4], int srcX, int srcY, int interlace, int transparent) { unsigned char initialCodeSize; int xpos = 0, ypos = 0, pass = 0, i, count; register unsigned char *pixelPtr; static const int interlaceStep[] = { 8, 8, 4, 2 }; static const int interlaceStart[] = { 0, 4, 2, 1 }; unsigned short prefix[(1 << MAX_LWZ_BITS)]; unsigned char append[(1 << MAX_LWZ_BITS)]; unsigned char stack[(1 << MAX_LWZ_BITS)*2]; register unsigned char *top; int codeSize, clearCode, inCode, endCode, oldCode, maxCode; int code, firstCode, v; /* * Initialize the decoder */ if (((size_t)Fread(gifConfPtr, &initialCodeSize, 1, 1, chan) + 1) < 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading GIF image: %s", Tcl_PosixError(interp))); return TCL_ERROR; } if (initialCodeSize > MAX_LWZ_BITS) { Tcl_SetObjResult(interp, Tcl_NewStringObj("malformed image", -1)); |
︙ | ︙ | |||
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 | ypos = interlaceStart[pass]; } } else { ypos++; } pixelPtr = imagePtr + (ypos) * len * ((transparent>=0)?4:3); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GetCode -- | > > > > > > > > > > > > > > > > > > > | 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 | ypos = interlaceStart[pass]; } } else { ypos++; } pixelPtr = imagePtr + (ypos) * len * ((transparent>=0)?4:3); } /* * Now read until the final zero byte. * It was observed that there might be 1 length blocks * (test imgPhoto-14.1) which are not read. * * The field "stack" is abused for temporary buffer. it has 4096 bytes * and we need 256. * * Loop until we hit a 0 length block which is the end sign. */ while ( 0 < (count = GetDataBlock(gifConfPtr, chan, stack))) { if (-1 == count ) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading GIF image: %s", Tcl_PosixError(interp))); return TCL_ERROR; } } return TCL_OK; } /* *---------------------------------------------------------------------- * * GetCode -- |
︙ | ︙ | |||
1369 1370 1371 1372 1373 1374 1375 | *---------------------------------------------------------------------- */ static void mInit( unsigned char *string, /* string containing initial mmencoded data */ MFile *handle, /* mmdecode "file" handle */ | | | 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 | *---------------------------------------------------------------------- */ static void mInit( unsigned char *string, /* string containing initial mmencoded data */ MFile *handle, /* mmdecode "file" handle */ size_t length) /* Number of bytes in string */ { handle->data = string; handle->state = 0; handle->c = 0; handle->length = length; } |
︙ | ︙ | |||
1395 1396 1397 1398 1399 1400 1401 | * * Side effects: * The base64 handle will change state. * *---------------------------------------------------------------------- */ | | | | | 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 | * * Side effects: * The base64 handle will change state. * *---------------------------------------------------------------------- */ static size_t Mread( unsigned char *dst, /* where to put the result */ size_t chunkSize, /* size of each transfer */ size_t numChunks, /* number of chunks */ MFile *handle) /* mmdecode "file" handle */ { int c; size_t i, count = chunkSize * numChunks; for (i=0; i<count && (c=Mgetc(handle)) != GIF_DONE; i++) { *dst++ = c; } return i; } |
︙ | ︙ | |||
1544 1545 1546 1547 1548 1549 1550 | * a base64 encoded string. * * Results: - same as POSIX fread() or Tcl Tcl_Read() * *---------------------------------------------------------------------- */ | | | | | | | | 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 | * a base64 encoded string. * * Results: - same as POSIX fread() or Tcl Tcl_Read() * *---------------------------------------------------------------------- */ static size_t Fread( GIFImageConfig *gifConfPtr, unsigned char *dst, /* where to put the result */ size_t hunk, size_t count, /* how many */ Tcl_Channel chan) { if (gifConfPtr->fromData == INLINE_DATA_BASE64) { return Mread(dst, hunk, count, (MFile *) chan); } if (gifConfPtr->fromData == INLINE_DATA_BINARY) { MFile *handle = (MFile *) chan; if ((handle->length + 1 < 2) || (handle->length < hunk*count)) { return (size_t)-1; } memcpy(dst, handle->data, hunk * count); handle->data += hunk * count; handle->length -= hunk * count; return hunk * count; } /* * Otherwise we've got a real file to read. */ return Tcl_Read(chan, (char *) dst, hunk * count); } /* * ChanWriteGIF - writes a image in GIF format. *------------------------------------------------------------------------- * Author: Lolo * Engeneering Projects Area |
︙ | ︙ | |||
1650 1651 1652 1653 1654 1655 1656 | if (result == TCL_OK) { Tcl_SetObjResult(interp, objPtr); } Tcl_DecrRefCount(objPtr); return result; } | | | | | | 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 | if (result == TCL_OK) { Tcl_SetObjResult(interp, objPtr); } Tcl_DecrRefCount(objPtr); return result; } static size_t WriteToChannel( ClientData clientData, const char *bytes, size_t byteCount) { Tcl_Channel handle = clientData; return Tcl_Write(handle, bytes, byteCount); } static size_t WriteToByteArray( ClientData clientData, const char *bytes, size_t byteCount) { Tcl_Obj *objPtr = clientData; Tcl_Obj *tmpObj = Tcl_NewByteArrayObj((unsigned char *) bytes, byteCount); Tcl_IncrRefCount(tmpObj); Tcl_AppendObjToObj(objPtr, tmpObj); Tcl_DecrRefCount(tmpObj); |
︙ | ︙ |
Added generic/tkImgListFormat.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | /* * tkImgListFormat.c -- * * Implements the default image data format. I.e. the format used for * [imageName data] and [imageName put] if no other format is specified. * * The default format consits of a list of scan lines (rows) with each * list element being itself a list of pixels (or columns). For details, * see the manpage photo.n * * This image format cannot read/write files, it is meant for string * data only. * * * Copyright (c) 1994 The Australian National University. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 2002-2003 Donal K. Fellows * Copyright (c) 2003 ActiveState Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * Authors: * Paul Mackerras ([email protected]), * Department of Computer Science, * Australian National University. * * Simon Bachmann ([email protected]) */ #include "tkImgPhoto.h" /* * Message to generate when an attempt to allocate memory for an image fails. */ #define TK_PHOTO_ALLOC_FAILURE_MESSAGE \ "not enough free memory for image buffer" /* * Color name length limit: do not attempt to parse as color strings that are * longer than this limit */ #define TK_PHOTO_MAX_COLOR_CHARS 99 /* * Symbols for the different formats of a color string. */ enum ColorFormatType { COLORFORMAT_TKCOLOR, COLORFORMAT_EMPTYSTRING, COLORFORMAT_LIST, COLORFORMAT_RGB1, COLORFORMAT_RGB2, COLORFORMAT_RGBA1, COLORFORMAT_RGBA2 }; /* * Names for the color format types above. * Order must match the one in enum ColorFormatType */ static const char *const colorFormatNames[] = { "tkcolor", "emptystring", "list", "rgb-short", "rgb", "rgba-short", "rgba", NULL }; /* * The following data structure is used to return information from * ParseFormatOptions: */ struct FormatOptions { int options; /* Individual bits indicate which options were * specified - see below. */ Tcl_Obj *formatName; /* Name specified without an option. */ enum ColorFormatType colorFormat; /* The color format type given with the * -colorformat option */ }; /* * Bit definitions for use with ParseFormatOptions: each bit is set in the * allowedOptions parameter on a call to ParseFormatOptions if that option * is allowed for the current photo image subcommand. On return, the bit is * set in the options field of the FormatOptions structure if that option * was specified. * * OPT_COLORFORMAT: Set if -alpha option allowed/specified. */ #define OPT_COLORFORMAT 1 /* * List of format option names. The order here must match the order of * declarations of the FMT_OPT_* constants above. */ static const char *const formatOptionNames[] = { "-colorformat", NULL }; /* * Forward declarations */ static int ParseFormatOptions(Tcl_Interp *interp, int allowedOptions, int objc, Tcl_Obj *const objv[], int *indexPtr, struct FormatOptions *optPtr); static Tcl_Obj *GetBadOptMsg(const char *badValue, int allowedOpts); static int StringMatchDef(Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadDef(Tcl_Interp *interp, Tcl_Obj *data, Tcl_Obj *formatString, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static int StringWriteDef(Tcl_Interp *interp, Tcl_Obj *formatString, Tk_PhotoImageBlock *blockPtr); static int ParseColor(Tcl_Interp *interp, Tcl_Obj *specObj, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsList(Tcl_Interp *interp, const char *colorString, int colorStrLen, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsHex(Tcl_Interp *interp, const char *colorString, int colorStrLen, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); static int ParseColorAsStandard(Tcl_Interp *interp, const char *colorString, int colorStrLen, Display *display, Colormap colormap, unsigned char *redPtr, unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr); /* * The format record for the default image handler */ Tk_PhotoImageFormat tkImgFmtDefault = { "default", /* name */ NULL, /* fileMatchProc: format doesn't support file ops */ StringMatchDef, /* stringMatchProc */ NULL, /* fileReadProc: format doesn't support file read */ StringReadDef, /* stringReadProc */ NULL, /* fileWriteProc: format doesn't support file write */ StringWriteDef /* stringWriteProc */ }; /* *---------------------------------------------------------------------- * * ParseFormatOptions -- * * Parse the options passed to the image format handler. * * Results: * On success, the structure pointed to by optPtr is filled with the * values passed or with the defaults and TCL_OK returned. * If an error occurs, leaves an error message in interp and returns * TCL_ERROR. * * Side effects: * The value in *indexPtr is updated to the index of the fist * element in argv[] that does not look like an option/value, or to * argc if parsing reached the end of argv[]. * *---------------------------------------------------------------------- */ static int ParseFormatOptions( Tcl_Interp *interp, /* For error messages */ int allowedOptions, /* Bitfield specifying which options are * to be considered allowed */ int objc, /* Number of elements in argv[] */ Tcl_Obj *const objv[], /* The arguments to parse */ int *indexPtr, /* Index giving the first element to * parse. The value is updated to the * index where parsing ended */ struct FormatOptions *optPtr) /* Parsed option values are written to * this struct */ { int index, optIndex, typeIndex, first; const char *option; first = 1; /* * Fill in default values */ optPtr->options = 0; optPtr->formatName = NULL; optPtr->colorFormat = COLORFORMAT_RGB2; for (index = *indexPtr; index < objc; *indexPtr = ++index) { int optionExists; /* * The first value can be the format handler's name. It goes to * optPtr->name. */ option = Tcl_GetString(objv[index]); if (option[0] != '-') { if (first) { optPtr->formatName = objv[index]; first = 0; continue; } else { break; } } first = 0; /* * Check if option is known and allowed */ optionExists = 1; if (Tcl_GetIndexFromObj(NULL, objv[index], formatOptionNames, "format option", 0, &optIndex) != TCL_OK) { optionExists = 0; } if (!optionExists || !((1 << optIndex) & allowedOptions)) { Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[index]), allowedOptions)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); return TCL_ERROR; } /* * Option-specific checks */ switch (1 << optIndex) { case OPT_COLORFORMAT: *indexPtr = ++index; if (index >= objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("the \"%s\" option " "requires a value", Tcl_GetString(objv[index - 1]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "MISSING_VALUE", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObj(NULL, objv[index], colorFormatNames, "", TCL_EXACT, &typeIndex) != TCL_OK || (typeIndex != COLORFORMAT_LIST && typeIndex != COLORFORMAT_RGB2 && typeIndex != COLORFORMAT_RGBA2) ) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("bad color format " "\"%s\": must be rgb, rgba, or list", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_COLOR_FORMAT", NULL); return TCL_ERROR; } optPtr->colorFormat = typeIndex; break; default: Tcl_Panic("ParseFormatOptions: unexpected switch fallthrough"); } /* * Add option to bitfield in optPtr */ optPtr->options |= (1 << optIndex); } return TCL_OK; } /* *---------------------------------------------------------------------- * * GetBadOptMsg -- * * Build a Tcl_Obj containing an error message in the form "bad option * "xx": must be y, or z", based on the bits set in allowedOpts. * * Results: * A Tcl Object containig the error message. * * Side effects: * None *---------------------------------------------------------------------- */ static Tcl_Obj * GetBadOptMsg( const char *badValue, /* the erroneous option */ int allowedOpts) /* bitfield specifying the allowed options */ { int i, bit; Tcl_Obj *resObj = Tcl_ObjPrintf("bad format option \"%s\": ", badValue); if (allowedOpts == 0) { Tcl_AppendToObj(resObj, "no options allowed", -1); } else { Tcl_AppendToObj(resObj, "must be ", -1); bit = 1; for (i = 0; formatOptionNames[i] != NULL; i++) { if (allowedOpts & bit) { if (allowedOpts & (bit -1)) { /* * not the first option */ if (allowedOpts & ~((bit << 1) - 1)) { /* * not the last option */ Tcl_AppendToObj(resObj, ", ", -1); } else { Tcl_AppendToObj(resObj, ", or ", -1); } } Tcl_AppendToObj(resObj, formatOptionNames[i], -1); } bit <<=1; } } return resObj; } /* *---------------------------------------------------------------------- * * StringMatchDef -- * * Default string match function. Test if image data in string form * appears to be in the default list-of-list-of-pixel-data format * accepted by the "<img> put" command. * * Results: * If thte data is in the default format, writes the size of the image * to widthPtr and heightPtr and returns 1. Otherwise, leaves an error * message in interp (if not NULL) and returns 0. * Note that this function does not parse all data points. A return * value of 1 does not guarantee that the data can be read without * errors. * * Side effects: * None *---------------------------------------------------------------------- */ static int StringMatchDef( Tcl_Obj *data, /* The data to check */ Tcl_Obj *formatString, /* Value of the -format option, not used here */ int *widthPtr, /* Width of image is written to this location */ int *heightPtr, /* Height of image is written to this location */ Tcl_Interp *interp) /* Error messages are left in this interpreter */ { int y, rowCount, colCount, curColCount; unsigned char dummy; Tcl_Obj **rowListPtr, *pixelData; /* * See if data can be parsed as a list, if every element is itself a valid * list and all sublists have the same length. */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) != TCL_OK) { return 0; } if (rowCount == 0) { /* * empty list is valid data */ *widthPtr = 0; *heightPtr = 0; return 1; } colCount = -1; for (y = 0; y < rowCount; y++) { if (Tcl_ListObjLength(interp, rowListPtr[y], &curColCount) != TCL_OK) { return 0; } if (colCount < 0) { colCount = curColCount; } else if (curColCount != colCount) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid row # %d: " "all rows must have the same number of elements", y)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_DATA", NULL); } return 0; } } /* * Data in base64 encoding (or even binary data), might actually pass * these tests. To avoid parsing it as list of lists format, check one * pixel for validity. */ if (Tcl_ListObjIndex(interp, rowListPtr[0], 0, &pixelData) != TCL_OK) { return 0; } if (Tcl_GetCharLength(pixelData) > TK_PHOTO_MAX_COLOR_CHARS) { return 0; } if (ParseColor(interp, pixelData, Tk_Display(Tk_MainWindow(interp)), Tk_Colormap(Tk_MainWindow(interp)), &dummy, &dummy, &dummy, &dummy) != TCL_OK) { return 0; } /* * Looks like we have valid data for this format. * We do not check any pixel values - that's the job of ImgStringRead() */ *widthPtr = colCount; *heightPtr = rowCount; return 1; } /* *---------------------------------------------------------------------- * * StringReadDef -- * * String read function for default format. (see manpage for details on * the format). * * Results: * A standard Tcl result. * * Side effects: * If the data has valid format, write it to the image identified by * imageHandle. * If the image data cannot be parsed, an error message is left in * interp. * *---------------------------------------------------------------------- */ static int StringReadDef( Tcl_Interp *interp, /* leave error messages here */ Tcl_Obj *data, /* the data to parse */ Tcl_Obj *formatString, /* value of the -format option */ Tk_PhotoHandle imageHandle, /* write data to this image */ int destX, int destY, /* start writing data at this point * in destination image*/ int width, int height, /* dimensions of area to write to */ int srcX, int srcY) /* start reading source data at these * coordinates */ { Tcl_Obj **rowListPtr, **colListPtr; Tcl_Obj **objv; int objc; unsigned char *curPixelPtr; int x, y, rowCount, colCount, curColCount; Tk_PhotoImageBlock srcBlock; Display *display; Colormap colormap; struct FormatOptions opts; int optIndex; /* * Parse format suboptions * We don't use any format suboptions, but we still need to provide useful * error messages if suboptions were specified. */ memset(&opts, 0, sizeof(opts)); if (formatString != NULL) { if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) != TCL_OK) { return TCL_ERROR; } optIndex = 0; if (ParseFormatOptions(interp, 0, objc, objv, &optIndex, &opts) != TCL_OK) { return TCL_ERROR; } if (optIndex < objc) { Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[optIndex]), 0)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); return TCL_ERROR; } } /* * Check input data */ if (Tcl_ListObjGetElements(interp, data, &rowCount, &rowListPtr) != TCL_OK ) { return TCL_ERROR; } if ( rowCount > 0 && Tcl_ListObjLength(interp, rowListPtr[0], &colCount) != TCL_OK) { return TCL_ERROR; } if (width <= 0 || height <= 0 || rowCount == 0 || colCount == 0) { /* * No changes with zero sized input or zero sized output region */ return TCL_OK; } if (srcX < 0 || srcY < 0 || srcX >= rowCount || srcY >= colCount) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("source coordinates out of range")); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); return TCL_ERROR; } /* * Memory allocation overflow protection. * May not be able to trigger/ demo / test this. */ if (colCount > (int)(UINT_MAX / 4 / rowCount)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "photo image dimensions exceed Tcl memory limits")); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "OVERFLOW", NULL); return TCL_OK; } /* * Read data and put it to imageHandle */ srcBlock.width = colCount - srcX; srcBlock.height = rowCount - srcY; srcBlock.pixelSize = 4; srcBlock.pitch = srcBlock.width * 4; srcBlock.offset[0] = 0; srcBlock.offset[1] = 1; srcBlock.offset[2] = 2; srcBlock.offset[3] = 3; srcBlock.pixelPtr = attemptckalloc(srcBlock.pitch * srcBlock.height); if (srcBlock.pixelPtr == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf(TK_PHOTO_ALLOC_FAILURE_MESSAGE)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } curPixelPtr = srcBlock.pixelPtr; display = Tk_Display(Tk_MainWindow(interp)); colormap = Tk_Colormap(Tk_MainWindow(interp)); for (y = srcY; y < rowCount; y++) { /* * We don't test the length of row, as that's been done in * ImgStringMatch() */ if (Tcl_ListObjGetElements(interp, rowListPtr[y], &curColCount, &colListPtr) != TCL_OK) { goto errorExit; } for (x = srcX; x < colCount; x++) { if (ParseColor(interp, colListPtr[x], display, colormap, curPixelPtr, curPixelPtr + 1, curPixelPtr + 2, curPixelPtr + 3) != TCL_OK) { goto errorExit; } curPixelPtr += 4; } } /* * Write image data to destHandle */ if (Tk_PhotoPutBlock(interp, imageHandle, &srcBlock, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { goto errorExit; } ckfree(srcBlock.pixelPtr); return TCL_OK; errorExit: ckfree(srcBlock.pixelPtr); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * StringWriteDef -- * * String write function for default image data format. See the user * documentation for details. * * Results: * The converted data is set as the result of interp. Returns a standard * Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int StringWriteDef( Tcl_Interp *interp, /* For the result and errors */ Tcl_Obj *formatString, /* The value of the -format option */ Tk_PhotoImageBlock *blockPtr) /* The image data to convert */ { int greenOffset, blueOffset, alphaOffset, hasAlpha; Tcl_Obj *result, **objv = NULL; int objc, allowedOpts, optIndex; struct FormatOptions opts; /* * Parse format suboptions */ if (Tcl_ListObjGetElements(interp, formatString, &objc, &objv) != TCL_OK) { return TCL_ERROR; } allowedOpts = OPT_COLORFORMAT; optIndex = 0; if (ParseFormatOptions(interp, allowedOpts, objc, objv, &optIndex, &opts) != TCL_OK) { return TCL_ERROR; } if (optIndex < objc) { Tcl_SetObjResult(interp, GetBadOptMsg(Tcl_GetString(objv[optIndex]), allowedOpts)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); return TCL_ERROR; } greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; /* * A negative alpha offset signals that the image is fully opaque. * That's not really documented anywhere, but it's the way it is! */ if (blockPtr->offset[3] < 0) { hasAlpha = 0; alphaOffset = 0; } else { hasAlpha = 1; alphaOffset = blockPtr->offset[3] - blockPtr->offset[0]; } if ((blockPtr->width > 0) && (blockPtr->height > 0)) { int row, col; Tcl_DString data, line; char colorBuf[11]; unsigned char *pixelPtr; unsigned char alphaVal = 255; Tcl_DStringInit(&data); for (row=0; row<blockPtr->height; row++) { pixelPtr = blockPtr->pixelPtr + blockPtr->offset[0] + row * blockPtr->pitch; Tcl_DStringInit(&line); for (col=0; col<blockPtr->width; col++) { if (hasAlpha) { alphaVal = pixelPtr[alphaOffset]; } /* * We don't build lines as a list for #RGBA and #RGB. Since * these color formats look like comments, the first element * of the list would get quoted with an additional {} . * While this is not a problem if the data is used as * a list, it would cause problems if someone decides to parse * it as a string (and it looks kinda strange) */ switch (opts.colorFormat) { case COLORFORMAT_RGB2: sprintf(colorBuf, "#%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset]); Tcl_DStringAppend(&line, colorBuf, -1); break; case COLORFORMAT_RGBA2: sprintf(colorBuf, "#%02x%02x%02x%02x ", pixelPtr[0], pixelPtr[greenOffset], pixelPtr[blueOffset], alphaVal); Tcl_DStringAppend(&line, colorBuf, -1); break; case COLORFORMAT_LIST: Tcl_DStringStartSublist(&line); sprintf(colorBuf, "%d", pixelPtr[0]); Tcl_DStringAppendElement(&line, colorBuf); sprintf(colorBuf, "%d", pixelPtr[greenOffset]); Tcl_DStringAppendElement(&line, colorBuf); sprintf(colorBuf, "%d", pixelPtr[blueOffset]); Tcl_DStringAppendElement(&line, colorBuf); sprintf(colorBuf, "%d", alphaVal); Tcl_DStringAppendElement(&line, colorBuf); Tcl_DStringEndSublist(&line); break; default: Tcl_Panic("unexpected switch fallthrough"); } pixelPtr += blockPtr->pixelSize; } if (opts.colorFormat != COLORFORMAT_LIST) { /* * For the #XXX formats, we need to remove the last * whitespace. */ *(Tcl_DStringValue(&line) + Tcl_DStringLength(&line) - 1) = '\0'; } Tcl_DStringAppendElement(&data, Tcl_DStringValue(&line)); Tcl_DStringFree(&line); } result = Tcl_NewStringObj(Tcl_DStringValue(&data), -1); Tcl_DStringFree(&data); } else { result = Tcl_NewObj(); } Tcl_SetObjResult(interp, result); return TCL_OK; } /* *---------------------------------------------------------------------- * * ParseColor -- * * This function extracts color and alpha values from a string. It * understands standard Tk color formats, alpha suffixes and the color * formats specific to photo images, which include alpha data. * * Results: * On success, writes red, green, blue and alpha values to the * corresponding pointers. If the color spec contains no alpha * information, 255 is taken as transparency value. * If the input cannot be parsed, leaves an error message in * interp. Returns a standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int ParseColor( Tcl_Interp *interp, /* error messages go there */ Tcl_Obj *specObj, /* the color data to parse */ Display *display, /* display of main window, needed to parse * standard Tk colors */ Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { const char *specString; TkSizeT charCount; /* * Find out which color format we have */ specString = TkGetStringFromObj(specObj, &charCount); if (charCount == 0) { /* Empty string */ *redPtr = *greenPtr = *bluePtr = *alphaPtr = 0; return TCL_OK; } if (charCount > TK_PHOTO_MAX_COLOR_CHARS) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid color")); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } if (specString[0] == '#') { return ParseColorAsHex(interp, specString, charCount, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } if (ParseColorAsList(interp, specString, charCount, redPtr, greenPtr, bluePtr, alphaPtr) == TCL_OK) { return TCL_OK; } /* * Parsing the color as standard Tk color always is the last option tried * because TkParseColor() is very slow with values it cannot parse. */ Tcl_ResetResult(interp); return ParseColorAsStandard(interp, specString, charCount, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } /* *---------------------------------------------------------------------- * * ParseColorAsList -- * * This function extracts color and alpha values from a list of 3 or 4 * integers (the list color format). * * Results: * On success, writes red, green, blue and alpha values to the * corresponding pointers. If the color spec contains no alpha * information, 255 is taken as transparency value. * Returns a standard Tcl result. * * Side effects: * Does *not* leave error messages in interp. The reason is that * it is not always possible to tell if the list format was even * intended and thus it is hard to return meaningful messages. * A general error message from the caller is probably the best * alternative. * *---------------------------------------------------------------------- */ static int ParseColorAsList( Tcl_Interp *interp, /* not used */ const char *colorString, /* the color data to parse */ int colorStrLen, /* length of the color string */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { /* * This is kinda ugly. The code would be certainly nicer if it * used Tcl_ListObjGetElements() and Tcl_GetIntFromObj(). But with * strtol() it's *much* faster. */ const char *curPos; int values[4]; int i; curPos = colorString; i = 0; /* * strtol can give false positives with a sequence of space chars. * To avoid that, avance the pointer to the next non-blank char. */ while(isspace(*curPos)) { ++curPos; } while (i < 4 && *curPos != '\0') { values[i] = strtol(curPos, (char **)&curPos, 0); if (values[i] < 0 || values[i] > 255) { return TCL_ERROR; } while(isspace(*curPos)) { ++curPos; } ++i; } if (i < 3 || *curPos != '\0') { return TCL_ERROR; } if (i < 4) { values[3] = 255; } *redPtr = (unsigned char) values[0]; *greenPtr = (unsigned char) values[1]; *bluePtr = (unsigned char) values[2]; *alphaPtr = (unsigned char) values[3]; return TCL_OK; } /* *---------------------------------------------------------------------- * * ParseColorAsHex -- * * This function extracts color and alpha values from a string * starting with '#', followed by hex digits. It undestands both * the #RGBA form and the #RBG (with optional suffix) * * Results: * On success, writes red, green, blue and alpha values to the * corresponding pointers. If the color spec contains no alpha * information, 255 is taken as transparency value. * Returns a standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int ParseColorAsHex( Tcl_Interp *interp, /* error messages are left here */ const char *colorString, /* the color data to parse */ int colorStrLen, /* length of the color string */ Display *display, /* display of main window */ Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { int i; unsigned long int colorValue = 0; if (colorStrLen - 1 != 4 && colorStrLen - 1 != 8) { return ParseColorAsStandard(interp, colorString, colorStrLen, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } for (i = 1; i < colorStrLen; i++) { if (!isxdigit(UCHAR(colorString[i]))) { /* * There still is a chance that this is a Tk color with * an alpha suffix */ return ParseColorAsStandard(interp, colorString, colorStrLen, display, colormap, redPtr, greenPtr, bluePtr, alphaPtr); } } colorValue = strtoul(colorString + 1, NULL, 16); switch (colorStrLen - 1) { case 4: /* #RGBA format */ *redPtr = (unsigned char) ((colorValue >> 12) * 0x11); *greenPtr = (unsigned char) (((colorValue >> 8) & 0xf) * 0x11); *bluePtr = (unsigned char) (((colorValue >> 4) & 0xf) * 0x11); *alphaPtr = (unsigned char) ((colorValue & 0xf) * 0x11); return TCL_OK; case 8: /* #RRGGBBAA format */ *redPtr = (unsigned char) (colorValue >> 24); *greenPtr = (unsigned char) ((colorValue >> 16) & 0xff); *bluePtr = (unsigned char) ((colorValue >> 8) & 0xff); *alphaPtr = (unsigned char) (colorValue & 0xff); return TCL_OK; default: Tcl_Panic("unexpected switch fallthrough"); } /* Shouldn't get here */ return TCL_ERROR; } /* *---------------------------------------------------------------------- * * ParseColorAsStandard -- * * This function tries to split a color stirng in a color and a * suffix part and to extract color and alpha values from them. The * color part is treated as regular Tk color. * * Results: * On success, writes red, green, blue and alpha values to the * corresponding pointers. If the color spec contains no alpha * information, 255 is taken as transparency value. * Returns a standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int ParseColorAsStandard( Tcl_Interp *interp, /* error messages are left here */ const char *specString, /* the color data to parse */ int specStrLen, /* length of the color string */ Display *display, /* display of main window */ Colormap colormap, /* colormap of current display */ unsigned char *redPtr, /* the result is written to these pointers */ unsigned char *greenPtr, unsigned char *bluePtr, unsigned char *alphaPtr) { XColor parsedColor; const char *suffixString, *colorString; char colorBuffer[TK_PHOTO_MAX_COLOR_CHARS + 1]; char *tmpString; double fracAlpha; unsigned int suffixAlpha; int i; /* * Split color data string in color and suffix parts */ if ((suffixString = strrchr(specString, '@')) == NULL && ((suffixString = strrchr(specString, '#')) == NULL || suffixString == specString)) { suffixString = specString + specStrLen; colorString = specString; } else { strncpy(colorBuffer, specString, suffixString - specString); colorBuffer[suffixString - specString] = '\0'; colorString = (const char*)colorBuffer; } /* * Try to parse as standard Tk color. * * We don't use Tk_GetColor() et al. here, as those functions * migth return a color that does not exaxtly match the given name * if the colormap is full. Also, we don't really want the color to be * added to the colormap. */ if ( ! TkParseColor(display, colormap, colorString, &parsedColor)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid color name \"%s\"", specString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } /* * parse the Suffix */ switch (suffixString[0]) { case '\0': suffixAlpha = 255; break; case '@': fracAlpha = strtod(suffixString + 1, &tmpString); if (*tmpString != '\0') { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha " "suffix \"%s\": expected floating-point value", suffixString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID COLOR", NULL); return TCL_ERROR; } if (fracAlpha < 0 || fracAlpha > 1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf("invalid alpha suffix" " \"%s\": value must be in the range from 0 to 1", suffixString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } suffixAlpha = (unsigned int) floor(fracAlpha * 255 + 0.5); break; case '#': if (strlen(suffixString + 1) < 1 || strlen(suffixString + 1)> 2) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid alpha suffix \"%s\"", suffixString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } for (i = 1; i <= (int)strlen(suffixString + 1); i++) { if ( ! isxdigit(UCHAR(suffixString[i]))) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid alpha suffix \"%s\": expected hex digit", suffixString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "INVALID_COLOR", NULL); return TCL_ERROR; } } if (strlen(suffixString + 1) == 1) { sscanf(suffixString, "#%1x", &suffixAlpha); suffixAlpha *= 0x11; } else { sscanf(suffixString, "#%2x", &suffixAlpha); } break; default: Tcl_Panic("unexpected switch fallthrough"); } *redPtr = (unsigned char) (parsedColor.red >> 8); *greenPtr = (unsigned char) (parsedColor.green >> 8); *bluePtr = (unsigned char) (parsedColor.blue >> 8); *alphaPtr = (unsigned char) suffixAlpha; return TCL_OK; } /* *---------------------------------------------------------------------- * * TkDebugStringMatchDef -- * * Debugging function for StringMatchDef. Basically just an alias for * that function, intended to expose it directly to tests, as * StirngMatchDef cannot be sufficiently tested otherwise. * * Results: * See StringMatchDef. * * Side effects: * None *---------------------------------------------------------------------- */ int TkDebugPhotoStringMatchDef( Tcl_Interp *interp, /* Error messages are left in this interpreter */ Tcl_Obj *data, /* The data to check */ Tcl_Obj *formatString, /* Value of the -format option, not used here */ int *widthPtr, /* Width of image is written to this location */ int *heightPtr) /* Height of image is written to this location */ { return StringMatchDef(data, formatString, widthPtr, heightPtr, interp); } /* Local Variables: */ /* mode: c */ /* fill-column: 78 */ /* c-basic-offset: 4 */ /* tab-width: 8 */ /* indent-tabs-mode: nil */ /* End: */ |
Changes to generic/tkImgPNG.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkImgPNG.c -- * * A Tk photo image file handler for PNG files. * * Copyright (c) 2006-2008 Muonics, Inc. * Copyright (c) 2008 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkImgPNG.c -- * * A Tk photo image file handler for PNG files. * * Copyright (c) 2006-2008 Muonics, Inc. * Copyright (c) 2008 Donal K. Fellows * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #define PNG_INT32(a,b,c,d) \ (((long)(a) << 24) | ((long)(b) << 16) | ((long)(c) << 8) | (long)(d)) #define PNG_BLOCK_SZ 1024 /* Process up to 1k at a time. */ #define PNG_MIN(a, b) (((a) < (b)) ? (a) : (b)) |
︙ | ︙ | |||
123 124 125 126 127 128 129 | /* * PNG data source/destination channel/object/byte array. */ Tcl_Channel channel; /* Channel for from-file reads. */ Tcl_Obj *objDataPtr; unsigned char *strDataBuf; /* Raw source data for from-string reads. */ | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | /* * PNG data source/destination channel/object/byte array. */ Tcl_Channel channel; /* Channel for from-file reads. */ Tcl_Obj *objDataPtr; unsigned char *strDataBuf; /* Raw source data for from-string reads. */ TkSizeT strDataLen; /* Length of source data. */ unsigned char *base64Data; /* base64 encoded string data. */ unsigned char base64Bits; /* Remaining bits from last base64 read. */ unsigned char base64State; /* Current state of base64 decoder. */ double alpha; /* Alpha from -format option. */ /* * Image header information. |
︙ | ︙ | |||
211 212 213 214 215 216 217 | Tcl_Obj *fmtObj, Tk_PhotoImageBlock *blockPtr); static int InitPNGImage(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Channel chan, Tcl_Obj *objPtr, int dir); static inline unsigned char Paeth(int a, int b, int c); static int ParseFormat(Tcl_Interp *interp, Tcl_Obj *fmtObj, PNGImage *pngPtr); static int ReadBase64(Tcl_Interp *interp, PNGImage *pngPtr, | | | | | | 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | Tcl_Obj *fmtObj, Tk_PhotoImageBlock *blockPtr); static int InitPNGImage(Tcl_Interp *interp, PNGImage *pngPtr, Tcl_Channel chan, Tcl_Obj *objPtr, int dir); static inline unsigned char Paeth(int a, int b, int c); static int ParseFormat(Tcl_Interp *interp, Tcl_Obj *fmtObj, PNGImage *pngPtr); static int ReadBase64(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr); static int ReadByteArray(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr); static int ReadData(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr); static int ReadChunkHeader(Tcl_Interp *interp, PNGImage *pngPtr, size_t *sizePtr, unsigned long *typePtr, unsigned long *crcPtr); static int ReadIDAT(Tcl_Interp *interp, PNGImage *pngPtr, int chunkSz, unsigned long crc); static int ReadIHDR(Tcl_Interp *interp, PNGImage *pngPtr); static inline int ReadInt32(Tcl_Interp *interp, PNGImage *pngPtr, unsigned long *resultPtr, unsigned long *crcPtr); static int ReadPLTE(Tcl_Interp *interp, PNGImage *pngPtr, |
︙ | ︙ | |||
247 248 249 250 251 252 253 | static int StringWritePNG(Tcl_Interp *interp, Tcl_Obj *fmtObj, Tk_PhotoImageBlock *blockPtr); static int UnfilterLine(Tcl_Interp *interp, PNGImage *pngPtr); static inline int WriteByte(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char c, unsigned long *crcPtr); static inline int WriteChunk(Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, | | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | static int StringWritePNG(Tcl_Interp *interp, Tcl_Obj *fmtObj, Tk_PhotoImageBlock *blockPtr); static int UnfilterLine(Tcl_Interp *interp, PNGImage *pngPtr); static inline int WriteByte(Tcl_Interp *interp, PNGImage *pngPtr, unsigned char c, unsigned long *crcPtr); static inline int WriteChunk(Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, size_t dataSize); static int WriteData(Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, size_t srcSz, unsigned long *crcPtr); static int WriteExtraChunks(Tcl_Interp *interp, PNGImage *pngPtr); static int WriteIHDR(Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr); static int WriteIDAT(Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr); |
︙ | ︙ | |||
316 317 318 319 320 321 322 | * reading with ReadData(). */ if (objPtr) { Tcl_IncrRefCount(objPtr); pngPtr->objDataPtr = objPtr; pngPtr->strDataBuf = | | | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | * reading with ReadData(). */ if (objPtr) { Tcl_IncrRefCount(objPtr); pngPtr->objDataPtr = objPtr; pngPtr->strDataBuf = TkGetByteArrayFromObj(objPtr, &pngPtr->strDataLen); } /* * Initialize the palette transparency table to fully opaque. */ memset(pngPtr->palette, 255, sizeof(pngPtr->palette)); |
︙ | ︙ | |||
427 428 429 430 431 432 433 | */ static int ReadBase64( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | */ static int ReadBase64( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr) { static const unsigned char from64[] = { 0x82, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x80, 0x83, 0x80, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x80, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x83, 0x3e, |
︙ | ︙ | |||
552 553 554 555 556 557 558 | */ static int ReadByteArray( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | | | 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | */ static int ReadByteArray( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr) { /* * Check to make sure the number of requested bytes are available. */ if ((size_t)pngPtr->strDataLen < destSz) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "unexpected end of image data", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EARLY_END", NULL); return TCL_ERROR; } while (destSz) { size_t blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ); memcpy(destPtr, pngPtr->strDataBuf, blockSz); pngPtr->strDataBuf += blockSz; pngPtr->strDataLen -= blockSz; if (crcPtr) { |
︙ | ︙ | |||
610 611 612 613 614 615 616 | */ static int ReadData( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, | | | | | | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | */ static int ReadData( Tcl_Interp *interp, PNGImage *pngPtr, unsigned char *destPtr, size_t destSz, unsigned long *crcPtr) { if (pngPtr->base64Data) { return ReadBase64(interp, pngPtr, destPtr, destSz, crcPtr); } else if (pngPtr->strDataBuf) { return ReadByteArray(interp, pngPtr, destPtr, destSz, crcPtr); } while (destSz) { size_t blockSz = PNG_MIN(destSz, PNG_BLOCK_SZ); blockSz = (size_t)Tcl_Read(pngPtr->channel, (char *)destPtr, blockSz); if (blockSz == (size_t)-1) { /* TODO: failure info... */ Tcl_SetObjResult(interp, Tcl_ObjPrintf( "channel read failed: %s", Tcl_PosixError(interp))); return TCL_ERROR; } /* |
︙ | ︙ | |||
855 856 857 858 859 860 861 | *---------------------------------------------------------------------- */ static int ReadChunkHeader( Tcl_Interp *interp, PNGImage *pngPtr, | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | *---------------------------------------------------------------------- */ static int ReadChunkHeader( Tcl_Interp *interp, PNGImage *pngPtr, size_t *sizePtr, unsigned long *typePtr, unsigned long *crcPtr) { unsigned long chunkType = 0; int chunkSz = 0; unsigned long crc = 0; |
︙ | ︙ | |||
1236 1237 1238 1239 1240 1241 1242 | static int ReadIHDR( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char sigBuf[PNG_SIG_SZ]; unsigned long chunkType; | | | 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 | static int ReadIHDR( Tcl_Interp *interp, PNGImage *pngPtr) { unsigned char sigBuf[PNG_SIG_SZ]; unsigned long chunkType; size_t chunkSz; unsigned long crc; unsigned long width, height; int mismatch; /* * Read the appropriate number of bytes for the PNG signature. */ |
︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 | mismatch = memcmp(sigBuf, pngSignature, PNG_SIG_SZ); /* * If reading from string, reset position and try base64 decode. */ if (mismatch && pngPtr->strDataBuf) { | | | 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 | mismatch = memcmp(sigBuf, pngSignature, PNG_SIG_SZ); /* * If reading from string, reset position and try base64 decode. */ if (mismatch && pngPtr->strDataBuf) { pngPtr->strDataBuf = TkGetByteArrayFromObj(pngPtr->objDataPtr, &pngPtr->strDataLen); pngPtr->base64Data = pngPtr->strDataBuf; if (ReadData(interp, pngPtr, sigBuf, PNG_SIG_SZ, NULL) == TCL_ERROR) { return TCL_ERROR; } |
︙ | ︙ | |||
2094 2095 2096 2097 2098 2099 2100 | unsigned long crc) { /* * Process IDAT contents until there is no more in this chunk. */ while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) { | | | 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 | unsigned long crc) { /* * Process IDAT contents until there is no more in this chunk. */ while (chunkSz && !Tcl_ZlibStreamEof(pngPtr->stream)) { TkSizeT len1, len2; /* * Read another block of input into the zlib stream if data remains. */ if (chunkSz) { Tcl_Obj *inputObj = NULL; |
︙ | ︙ | |||
2143 2144 2145 2146 2147 2148 2149 | /* * Inflate, processing each output buffer's worth as a line of pixels, * until we cannot fill the buffer any more. */ getNextLine: | | | | | 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 | /* * Inflate, processing each output buffer's worth as a line of pixels, * until we cannot fill the buffer any more. */ getNextLine: TkGetByteArrayFromObj(pngPtr->thisLineObj, &len1); if (Tcl_ZlibStreamGet(pngPtr->stream, pngPtr->thisLineObj, pngPtr->phaseSize - len1) == TCL_ERROR) { return TCL_ERROR; } TkGetByteArrayFromObj(pngPtr->thisLineObj, &len2); if (len2 == (TkSizeT)pngPtr->phaseSize) { if (pngPtr->phase > 7) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "extra data after final scan line of final phase", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "EXTRA_DATA", NULL); return TCL_ERROR; |
︙ | ︙ | |||
2379 2380 2381 2382 2383 2384 2385 | PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY) { unsigned long chunkType; | | | 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 | PNGImage *pngPtr, Tcl_Obj *fmtObj, Tk_PhotoHandle imageHandle, int destX, int destY) { unsigned long chunkType; size_t chunkSz; unsigned long crc; /* * Parse the PNG signature and IHDR (header) chunk. */ if (ReadIHDR(interp, pngPtr) == TCL_ERROR) { |
︙ | ︙ | |||
2764 2765 2766 2767 2768 2769 2770 | Tcl_Interp *interp) { PNGImage png; int match = 0; InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); | | | 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 | Tcl_Interp *interp) { PNGImage png; int match = 0; InitPNGImage(NULL, &png, NULL, pObjData, TCL_ZLIB_STREAM_INFLATE); png.strDataBuf = TkGetByteArrayFromObj(pObjData, &png.strDataLen); if (ReadIHDR(interp, &png) == TCL_OK) { *widthPtr = png.block.width; *heightPtr = png.block.height; match = 1; } |
︙ | ︙ | |||
2842 2843 2844 2845 2846 2847 2848 | */ static int WriteData( Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, | | | | | | | 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 | */ static int WriteData( Tcl_Interp *interp, PNGImage *pngPtr, const unsigned char *srcPtr, size_t srcSz, unsigned long *crcPtr) { if (!srcPtr || !srcSz) { return TCL_OK; } if (crcPtr) { *crcPtr = Tcl_ZlibCRC32(*crcPtr, srcPtr, srcSz); } /* * TODO: is Tcl_AppendObjToObj faster here? i.e., does Tcl join the * objects immediately or store them in a multi-object rep? */ if (pngPtr->objDataPtr) { TkSizeT objSz; unsigned char *destPtr; TkGetByteArrayFromObj(pngPtr->objDataPtr, &objSz); if (objSz + srcSz > INT_MAX) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "image too large to store completely in byte array", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PNG", "TOO_LARGE", NULL); return TCL_ERROR; } destPtr = Tcl_SetByteArrayLength(pngPtr->objDataPtr, objSz + srcSz); if (!destPtr) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "memory allocation failed", -1)); Tcl_SetErrorCode(interp, "TK", "MALLOC", NULL); return TCL_ERROR; } memcpy(destPtr+objSz, srcPtr, srcSz); } else if (Tcl_Write(pngPtr->channel, (const char *) srcPtr, srcSz) == TCL_IO_FAILURE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "write to channel failed: %s", Tcl_PosixError(interp))); return TCL_ERROR; } return TCL_OK; } |
︙ | ︙ | |||
2957 2958 2959 2960 2961 2962 2963 | static inline int WriteChunk( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, | | | 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 | static inline int WriteChunk( Tcl_Interp *interp, PNGImage *pngPtr, unsigned long chunkType, const unsigned char *dataPtr, size_t dataSize) { unsigned long crc = Tcl_ZlibCRC32(0, NULL, 0); int result = TCL_OK; /* * Write the length field for the chunk. */ |
︙ | ︙ | |||
3128 3129 3130 3131 3132 3133 3134 | static int WriteIDAT( Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr) { | | > | 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 | static int WriteIDAT( Tcl_Interp *interp, PNGImage *pngPtr, Tk_PhotoImageBlock *blockPtr) { int rowNum, flush = TCL_ZLIB_NO_FLUSH, result; Tcl_Obj *outputObj; unsigned char *outputBytes; TkSizeT outputSize; /* * Filter and compress each row one at a time. */ for (rowNum=0 ; rowNum < blockPtr->height ; rowNum++) { int colNum; |
︙ | ︙ | |||
3222 3223 3224 3225 3226 3227 3228 | /* * Now get the compressed data and write it as one big IDAT chunk. */ outputObj = Tcl_NewObj(); (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); | | | 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 | /* * Now get the compressed data and write it as one big IDAT chunk. */ outputObj = Tcl_NewObj(); (void) Tcl_ZlibStreamGet(pngPtr->stream, outputObj, -1); outputBytes = TkGetByteArrayFromObj(outputObj, &outputSize); result = WriteChunk(interp, pngPtr, CHUNK_IDAT, outputBytes, outputSize); Tcl_DecrRefCount(outputObj); return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ |
Changes to generic/tkImgPPM.c.
︙ | ︙ | |||
137 138 139 140 141 142 143 | * image to be written to. */ int width, int height, /* Dimensions of block of photo image to be * written to. */ int srcX, int srcY) /* Coordinates of top-left pixel to be used in * image being read. */ { int fileWidth, fileHeight, maxIntensity; | | > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | * image to be written to. */ int width, int height, /* Dimensions of block of photo image to be * written to. */ int srcX, int srcY) /* Coordinates of top-left pixel to be used in * image being read. */ { int fileWidth, fileHeight, maxIntensity; int nLines, h, type, bytesPerChannel = 1; size_t nBytes, count; unsigned char *pixelPtr; Tk_PhotoImageBlock block; type = ReadPPMFileHeader(chan, &fileWidth, &fileHeight, &maxIntensity); if (type == 0) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't read raw PPM header from file \"%s\"", fileName)); |
︙ | ︙ | |||
281 282 283 284 285 286 287 | FileWritePPM( Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan; | | > | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | FileWritePPM( Tcl_Interp *interp, const char *fileName, Tcl_Obj *format, Tk_PhotoImageBlock *blockPtr) { Tcl_Channel chan; int w, h, greenOffset, blueOffset; size_t nBytes; unsigned char *pixelPtr, *pixLinePtr; char header[16 + TCL_INTEGER_SPACE * 2]; chan = Tcl_OpenFileChannel(interp, fileName, "w", 0666); if (chan == NULL) { return TCL_ERROR; } |
︙ | ︙ | |||
311 312 313 314 315 316 317 | pixLinePtr = blockPtr->pixelPtr + blockPtr->offset[0]; greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if ((greenOffset == 1) && (blueOffset == 2) && (blockPtr->pixelSize == 3) && (blockPtr->pitch == (blockPtr->width * 3))) { nBytes = blockPtr->height * blockPtr->pitch; | | | | | | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | pixLinePtr = blockPtr->pixelPtr + blockPtr->offset[0]; greenOffset = blockPtr->offset[1] - blockPtr->offset[0]; blueOffset = blockPtr->offset[2] - blockPtr->offset[0]; if ((greenOffset == 1) && (blueOffset == 2) && (blockPtr->pixelSize == 3) && (blockPtr->pitch == (blockPtr->width * 3))) { nBytes = blockPtr->height * blockPtr->pitch; if ((size_t)Tcl_Write(chan, (char *) pixLinePtr, nBytes) != nBytes) { goto writeerror; } } else { for (h = blockPtr->height; h > 0; h--) { pixelPtr = pixLinePtr; for (w = blockPtr->width; w > 0; w--) { if (Tcl_Write(chan,(char *)&pixelPtr[0], 1) == TCL_IO_FAILURE || Tcl_Write(chan,(char *)&pixelPtr[greenOffset],1) == TCL_IO_FAILURE || Tcl_Write(chan,(char *)&pixelPtr[blueOffset],1) == TCL_IO_FAILURE) { goto writeerror; } pixelPtr += blockPtr->pixelSize; } pixLinePtr += blockPtr->pitch; } } |
︙ | ︙ | |||
758 759 760 761 762 763 764 | int *maxIntensityPtr, /* The maximum intensity value for the image * is stored here. */ unsigned char **dataBufferPtr, int *dataSizePtr) { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; | | > | | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 | int *maxIntensityPtr, /* The maximum intensity value for the image * is stored here. */ unsigned char **dataBufferPtr, int *dataSizePtr) { #define BUFFER_SIZE 1000 char buffer[BUFFER_SIZE], c; int i, numFields, type = 0; TkSizeT dataSize; unsigned char *dataBuffer; dataBuffer = TkGetByteArrayFromObj(dataPtr, &dataSize); /* * Read 4 space-separated fields from the string, ignoring comments (any * line that starts with "#"). */ if (dataSize-- < 1) { |
︙ | ︙ |
Changes to generic/tkImgPhInstance.c.
︙ | ︙ | |||
111 112 113 114 115 116 117 | || (instancePtr->palette != colorTablePtr->id.palette) || (instancePtr->gamma != colorTablePtr->id.gamma)) { /* * Free up our old color table, and get a new one. */ if (colorTablePtr != NULL) { | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | || (instancePtr->palette != colorTablePtr->id.palette) || (instancePtr->gamma != colorTablePtr->id.gamma)) { /* * Free up our old color table, and get a new one. */ if (colorTablePtr != NULL) { colorTablePtr->liveRefCount--; FreeColorTable(colorTablePtr, 0); } GetColorTable(instancePtr); /* * Create a new XImage structure for sending data to the X server, if * necessary. |
︙ | ︙ | |||
741 742 743 744 745 746 747 | * count of live uses of its color table, so that its colors can be * reclaimed if necessary, and set up an idle call to free the instance * structure. */ colorPtr = instancePtr->colorTablePtr; if (colorPtr != NULL) { | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | * count of live uses of its color table, so that its colors can be * reclaimed if necessary, and set up an idle call to free the instance * structure. */ colorPtr = instancePtr->colorTablePtr; if (colorPtr != NULL) { colorPtr->liveRefCount--; } Tcl_DoWhenIdle(TkImgDisposeInstance, instancePtr); } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
863 864 865 866 867 868 869 | * Copy the common area over to the new array and free the old * array. */ if (masterPtr->width == instancePtr->width) { offset = validBox.y * masterPtr->width * 3; memcpy(newError + offset, instancePtr->error + offset, | | | | 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | * Copy the common area over to the new array and free the old * array. */ if (masterPtr->width == instancePtr->width) { offset = validBox.y * masterPtr->width * 3; memcpy(newError + offset, instancePtr->error + offset, (size_t) validBox.height * masterPtr->width * 3 * sizeof(schar)); } else if (validBox.width > 0 && validBox.height > 0) { errDestPtr = newError + (validBox.y * masterPtr->width + validBox.x) * 3; errSrcPtr = instancePtr->error + (validBox.y * instancePtr->width + validBox.x) * 3; |
︙ | ︙ | |||
1124 1125 1126 1127 1128 1129 1130 | static void FreeColorTable( ColorTable *colorPtr, /* Pointer to the color table which is no * longer required by an instance. */ int force) /* Force free to happen immediately. */ { | < | | 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 | static void FreeColorTable( ColorTable *colorPtr, /* Pointer to the color table which is no * longer required by an instance. */ int force) /* Force free to happen immediately. */ { if (colorPtr->refCount-- > 1) { return; } if (force) { if (colorPtr->flags & DISPOSE_PENDING) { Tcl_CancelIdleCall(DisposeColorTable, colorPtr); colorPtr->flags &= ~DISPOSE_PENDING; |
︙ | ︙ | |||
1458 1459 1460 1461 1462 1463 1464 | XFreeColors(colorPtr->id.display, colorPtr->id.colormap, colorPtr->pixelMap, colorPtr->numColors, 0); Tk_FreeColormap(colorPtr->id.display, colorPtr->id.colormap); } ckfree(colorPtr->pixelMap); } | | | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | XFreeColors(colorPtr->id.display, colorPtr->id.colormap, colorPtr->pixelMap, colorPtr->numColors, 0); Tk_FreeColormap(colorPtr->id.display, colorPtr->id.colormap); } ckfree(colorPtr->pixelMap); } entry = Tcl_FindHashEntry(&imgPhotoColorHash, &colorPtr->id); if (entry == NULL) { Tcl_Panic("DisposeColorTable couldn't find hash entry"); } Tcl_DeleteHashEntry(entry); ckfree(colorPtr); } |
︙ | ︙ | |||
1979 1980 1981 1982 1983 1984 1985 | void TkImgResetDither( PhotoInstance *instancePtr) { if (instancePtr->error) { memset(instancePtr->error, 0, | | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 | void TkImgResetDither( PhotoInstance *instancePtr) { if (instancePtr->error) { memset(instancePtr->error, 0, (size_t) instancePtr->masterPtr->width * instancePtr->masterPtr->height * 3 * sizeof(schar)); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkImgPhoto.c.
︙ | ︙ | |||
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | /* * Bit definitions for use with ParseSubcommandOptions: each bit is set in the * allowedOptions parameter on a call to ParseSubcommandOptions if that option * is allowed for the current photo image subcommand. On return, the bit is * set in the options field of the SubcommandOptions structure if that option * was specified. * * OPT_BACKGROUND: Set if -format option allowed/specified. * OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd. * OPT_FORMAT: Set if -format option allowed/specified. * OPT_FROM: Set if -from option allowed/specified. * OPT_GRAYSCALE: Set if -grayscale option allowed/specified. * OPT_SHRINK: Set if -shrink option allowed/specified. * OPT_SUBSAMPLE: Set if -subsample option allowed/spec'd. * OPT_TO: Set if -to option allowed/specified. * OPT_ZOOM: Set if -zoom option allowed/specified. */ | > > > | | | | | | | | > | > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /* * Bit definitions for use with ParseSubcommandOptions: each bit is set in the * allowedOptions parameter on a call to ParseSubcommandOptions if that option * is allowed for the current photo image subcommand. On return, the bit is * set in the options field of the SubcommandOptions structure if that option * was specified. * * OPT_ALPHA: Set if -alpha option allowed/specified. * OPT_BACKGROUND: Set if -format option allowed/specified. * OPT_COMPOSITE: Set if -compositingrule option allowed/spec'd. * OPT_FORMAT: Set if -format option allowed/specified. * OPT_FROM: Set if -from option allowed/specified. * OPT_GRAYSCALE: Set if -grayscale option allowed/specified. * OPT_SHRINK: Set if -shrink option allowed/specified. * OPT_SUBSAMPLE: Set if -subsample option allowed/spec'd. * OPT_TO: Set if -to option allowed/specified. * OPT_WITHALPHA: Set if -withalpha option allowed/specified. * OPT_ZOOM: Set if -zoom option allowed/specified. */ #define OPT_ALPHA 1 #define OPT_BACKGROUND 2 #define OPT_COMPOSITE 4 #define OPT_FORMAT 8 #define OPT_FROM 0x10 #define OPT_GRAYSCALE 0x20 #define OPT_SHRINK 0x40 #define OPT_SUBSAMPLE 0x80 #define OPT_TO 0x100 #define OPT_WITHALPHA 0x200 #define OPT_ZOOM 0x400 /* * List of option names. The order here must match the order of declarations * of the OPT_* constants above. */ static const char *const optionNames[] = { "-alpha", "-background", "-compositingrule", "-format", "-from", "-grayscale", "-shrink", "-subsample", "-to", "-withalpha", "-zoom", NULL }; /* * Message to generate when an attempt to resize an image fails due to memory * problems. |
︙ | ︙ | |||
121 122 123 124 125 126 127 | TkImgPhotoFree, /* freeProc */ ImgPhotoDelete, /* deleteProc */ ImgPhotoPostscript, /* postscriptProc */ NULL, /* nextPtr */ NULL }; | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | TkImgPhotoFree, /* freeProc */ ImgPhotoDelete, /* deleteProc */ ImgPhotoPostscript, /* postscriptProc */ NULL, /* nextPtr */ NULL }; typedef struct { Tk_PhotoImageFormat *formatList; /* Pointer to the first in the list of known * photo image formats.*/ Tk_PhotoImageFormat *oldFormatList; /* Pointer to the first in the list of known * photo image formats.*/ int initialized; /* Set to 1 if we've initialized the |
︙ | ︙ | |||
148 149 150 151 152 153 154 | /* * Information used for parsing configuration specifications: */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, | | | | | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | /* * Information used for parsing configuration specifications: */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_STRING, "-file", NULL, NULL, NULL, offsetof(PhotoMaster, fileString), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_DOUBLE, "-gamma", NULL, NULL, DEF_PHOTO_GAMMA, offsetof(PhotoMaster, gamma), 0, NULL}, {TK_CONFIG_INT, "-height", NULL, NULL, DEF_PHOTO_HEIGHT, offsetof(PhotoMaster, userHeight), 0, NULL}, {TK_CONFIG_UID, "-palette", NULL, NULL, DEF_PHOTO_PALETTE, offsetof(PhotoMaster, palette), 0, NULL}, {TK_CONFIG_INT, "-width", NULL, NULL, DEF_PHOTO_WIDTH, offsetof(PhotoMaster, userWidth), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Forward declarations */ |
︙ | ︙ | |||
178 179 180 181 182 183 184 | static void ImgPhotoCmdDeletedProc(ClientData clientData); static int ImgPhotoConfigureMaster(Tcl_Interp *interp, PhotoMaster *masterPtr, int objc, Tcl_Obj *const objv[], int flags); static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width, int height); | < < < | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | static void ImgPhotoCmdDeletedProc(ClientData clientData); static int ImgPhotoConfigureMaster(Tcl_Interp *interp, PhotoMaster *masterPtr, int objc, Tcl_Obj *const objv[], int flags); static int ToggleComplexAlphaIfNeeded(PhotoMaster *mPtr); static int ImgPhotoSetSize(PhotoMaster *masterPtr, int width, int height); static char * ImgGetPhoto(PhotoMaster *masterPtr, Tk_PhotoImageBlock *blockPtr, struct SubcommandOptions *optPtr); static int MatchFileFormat(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *formatString, Tk_PhotoImageFormat **imageFormatPtr, int *widthPtr, int *heightPtr, int *oldformat); |
︙ | ︙ | |||
398 399 400 401 402 403 404 | enum PhotoOptions { PHOTO_BLANK, PHOTO_CGET, PHOTO_CONFIGURE, PHOTO_COPY, PHOTO_DATA, PHOTO_GET, PHOTO_PUT, PHOTO_READ, PHOTO_REDITHER, PHOTO_TRANS, PHOTO_WRITE }; PhotoMaster *masterPtr = clientData; | | < < | | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 | enum PhotoOptions { PHOTO_BLANK, PHOTO_CGET, PHOTO_CONFIGURE, PHOTO_COPY, PHOTO_DATA, PHOTO_GET, PHOTO_PUT, PHOTO_READ, PHOTO_REDITHER, PHOTO_TRANS, PHOTO_WRITE }; PhotoMaster *masterPtr = clientData; int result, index, x, y, width, height; struct SubcommandOptions options; unsigned char *pixelPtr; Tk_PhotoImageBlock block; Tk_PhotoImageFormat *imageFormat; TkSizeT length; int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (objc < 2) { |
︙ | ︙ | |||
443 444 445 446 447 448 449 | case PHOTO_CGET: { const char *arg; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } | | < | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | case PHOTO_CGET: { const char *arg; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } arg = TkGetStringFromObj(objv[2], &length); if (strncmp(arg,"-data", length) == 0) { if (masterPtr->dataString) { Tcl_SetObjResult(interp, masterPtr->dataString); } } else if (strncmp(arg,"-format", length) == 0) { if (masterPtr->format) { Tcl_SetObjResult(interp, masterPtr->format); |
︙ | ︙ | |||
493 494 495 496 497 498 499 | } Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp)); Tcl_SetObjResult(interp, obj); return TCL_OK; } else if (objc == 3) { | | < | 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | } Tcl_ListObjAppendElement(interp, obj, subobj); Tcl_ListObjAppendList(interp, obj, Tcl_GetObjResult(interp)); Tcl_SetObjResult(interp, obj); return TCL_OK; } else if (objc == 3) { const char *arg = TkGetStringFromObj(objv[2], &length); if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); if (masterPtr->dataString) { /* * TODO: Modifying result is bad! */ |
︙ | ︙ | |||
664 665 666 667 668 669 670 | masterPtr->width, masterPtr->height); if (options.background) { Tk_FreeColor(options.background); } return result; case PHOTO_DATA: { | | > | | | 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | masterPtr->width, masterPtr->height); if (options.background) { Tk_FreeColor(options.background); } return result; case PHOTO_DATA: { char *data = NULL; Tcl_Obj *freeObj = NULL; /* * photo data command - first parse and check any options given. */ Tk_ImageStringWriteProc *stringWriteProc = NULL; index = 1; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; options.fromX = 0; options.fromY = 0; if (ParseSubcommandOptions(&options, interp, OPT_FORMAT | OPT_FROM | OPT_GRAYSCALE | OPT_BACKGROUND, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "?-option value ...?"); return TCL_ERROR; } if ((options.fromX > masterPtr->width) || (options.fromY > masterPtr->height) || (options.fromX2 > masterPtr->width) || (options.fromY2 > masterPtr->height)) { |
︙ | ︙ | |||
705 706 707 708 709 710 711 712 713 714 715 716 | * Fill in default values for unspecified parameters. */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { options.fromX2 = masterPtr->width; options.fromY2 = masterPtr->height; } /* * Search for an appropriate image string format handler. */ | > > > > < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | * Fill in default values for unspecified parameters. */ if (!(options.options & OPT_FROM) || (options.fromX2 < 0)) { options.fromX2 = masterPtr->width; options.fromY2 = masterPtr->height; } if (!(options.options & OPT_FORMAT)) { options.format = Tcl_NewStringObj("default", -1); freeObj = options.format; } /* * Search for an appropriate image string format handler. */ matched = 0; for (imageFormat = tsdPtr->formatList; imageFormat != NULL; imageFormat = imageFormat->nextPtr) { if ((strncasecmp(Tcl_GetString(options.format), imageFormat->name, strlen(imageFormat->name)) == 0)) { matched = 1; if (imageFormat->stringWriteProc != NULL) { stringWriteProc = imageFormat->stringWriteProc; break; } } } if (stringWriteProc == NULL) { oldformat = 1; for (imageFormat = tsdPtr->oldFormatList; imageFormat != NULL; imageFormat = imageFormat->nextPtr) { if ((strncasecmp(Tcl_GetString(options.format), imageFormat->name, strlen(imageFormat->name)) == 0)) { matched = 1; if (imageFormat->stringWriteProc != NULL) { stringWriteProc = imageFormat->stringWriteProc; break; } } } } if (stringWriteProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image string format \"%s\" is %s", Tcl_GetString(options.format), (matched ? "not supported" : "unknown"))); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", Tcl_GetString(options.format), NULL); goto dataErrorExit; } /* * Call the handler's string write function to write out the image. */ data = ImgGetPhoto(masterPtr, &block, &options); |
︙ | ︙ | |||
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | } if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } return result; } case PHOTO_GET: { /* * photo get command - first parse and check parameters. */ | > > > > > > > > > > > > > > > | > > > > > > > > | | > > > > | | | | > | | > > | > > > > | | | < > > | | | | | | | | | | | | | | | | | | > | | < < < < < < | < < < < | < < < < < < < < < < < < | < < | < < < < < < < | < < < < < < < | < < < < < < < < < < | < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < < | 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 | } if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } if (freeObj != NULL) { Tcl_DecrRefCount(freeObj); } return result; dataErrorExit: if (options.background) { Tk_FreeColor(options.background); } if (data) { ckfree(data); } if (freeObj != NULL) { Tcl_DecrRefCount(freeObj); } return TCL_ERROR; } case PHOTO_GET: { /* * photo get command - first parse and check parameters. */ Tcl_Obj *channels[4]; int channelCount = 3; index = 3; memset(&options, 0, sizeof(options)); options.name = NULL; if (ParseSubcommandOptions(&options, interp, OPT_WITHALPHA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if (options.name == NULL || index < objc) { Tcl_WrongNumArgs(interp, 2, objv, "x y ?-withalpha?"); return TCL_ERROR; } if (options.options & OPT_WITHALPHA) { channelCount = 4; } if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { return TCL_ERROR; } if ((x < 0) || (x >= masterPtr->width) || (y < 0) || (y >= masterPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); return TCL_ERROR; } /* * Extract the value of the desired pixel and format it as a list. */ pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; channels[0] = Tcl_NewWideIntObj(pixelPtr[0]); channels[1] = Tcl_NewWideIntObj(pixelPtr[1]); channels[2] = Tcl_NewWideIntObj(pixelPtr[2]); channels[3] = Tcl_NewWideIntObj(pixelPtr[3]); Tcl_SetObjResult(interp, Tcl_NewListObj(channelCount, channels)); return TCL_OK; } case PHOTO_PUT: { Tcl_Obj *format, *data; /* * photo put command - first parse the options. */ index = 2; memset(&options, 0, sizeof(options)); options.name = NULL; options.format = NULL; if (ParseSubcommandOptions(&options, interp, OPT_TO|OPT_FORMAT, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if ((options.name == NULL) || (index < objc)) { Tcl_WrongNumArgs(interp, 2, objv, "data ?-option value ...?"); return TCL_ERROR; } /* * See if there's a format that can read the data */ if (MatchStringFormat(interp, objv[2], options.format, &imageFormat, &imageWidth, &imageHeight, &oldformat) != TCL_OK) { return TCL_ERROR; } if (!(options.options & OPT_TO) || (options.toX2 < 0)) { options.toX2 = options.toX + imageWidth; options.toY2 = options.toY + imageHeight; } if (imageWidth > options.toX2 - options.toX) { imageWidth = options.toX2 - options.toX; } if (imageHeight > options.toY2 - options.toY) { imageHeight = options.toY2 - options.toY; } format = options.format; data = objv[2]; if (oldformat) { if (format) { format = (Tcl_Obj *) Tcl_GetString(format); } data = (Tcl_Obj *) Tcl_GetString(data); } if (imageFormat->stringReadProc(interp, data, format, (Tk_PhotoHandle) masterPtr, options.toX, options.toY, options.toX2 - options.toX, options.toY2 - options.toY, 0, 0) != TCL_OK) { return TCL_ERROR; } /* * SB: is the next line really needed? The stringReadProc * writes image data with Tk_PhotoPutBlock(), which in turn * takes care to notify the changed image and to set/unset the * IMAGE_CHANGED bit. */ masterPtr->flags |= IMAGE_CHANGED; return TCL_OK; } case PHOTO_READ: { Tcl_Obj *format; /* * photo read command - first parse the options specified. */ |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | if (Tcl_GetIndexFromObj(interp, objv[2], photoTransOptions, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum transOptions) index) { case PHOTO_TRANS_GET: { | > | > | > | | > > > > > > > > > > > > > > > > > > > > < > | > | < | | < < < < | | < > | > > > > > | | | > > | > > > | > > > > > > > > > > > > > > | | > | > | < | | < > > > > > | < | < | < < < < | | | > > | > > > | < > | > > > > > > > | > > > | 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 | if (Tcl_GetIndexFromObj(interp, objv[2], photoTransOptions, "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum transOptions) index) { case PHOTO_TRANS_GET: { int boolMode; /* * parse fixed args and option */ if (objc > 6 || objc < 5) { Tcl_WrongNumArgs(interp, 3, objv, "x y ?-option?"); return TCL_ERROR; } if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) { return TCL_ERROR; } index = 4; memset(&options, 0, sizeof(options)); if (ParseSubcommandOptions(&options, interp, OPT_ALPHA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); return TCL_ERROR; } boolMode = 1; if (options.options & OPT_ALPHA) { boolMode = 0; } if ((x < 0) || (x >= masterPtr->width) || (y < 0) || (y >= masterPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency get: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); return TCL_ERROR; } /* * Extract and return the desired value */ pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; if (boolMode) { Tcl_SetObjResult(interp, Tcl_NewBooleanObj( ! pixelPtr[3])); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(pixelPtr[3])); } return TCL_OK; } case PHOTO_TRANS_SET: { int newVal, boolMode; XRectangle setBox; TkRegion modRegion; /* * Parse args and option, check for valid values */ if (objc < 6 || objc > 7) { Tcl_WrongNumArgs(interp, 3, objv, "x y newVal ?-option?"); return TCL_ERROR; } if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) { return TCL_ERROR; } index = 5; memset(&options, 0, sizeof(options)); if (ParseSubcommandOptions(&options, interp, OPT_ALPHA, &index, objc, objv) != TCL_OK) { return TCL_ERROR; } if (index < objc) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be -alpha", Tcl_GetString(objv[index]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_OPTION", NULL); return TCL_ERROR; } boolMode = 1; if (options.options & OPT_ALPHA) { boolMode = 0; } if ((x < 0) || (x >= masterPtr->width) || (y < 0) || (y >= masterPtr->height)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "%s transparency set: coordinates out of range", Tcl_GetString(objv[0]))); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "COORDINATES", NULL); return TCL_ERROR; } if (boolMode) { if (Tcl_GetBooleanFromObj(interp, objv[5], &newVal) != TCL_OK) { return TCL_ERROR; } } else { if (Tcl_GetIntFromObj(interp, objv[5], &newVal) != TCL_OK) { return TCL_ERROR; } if (newVal < 0 || newVal > 255) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "invalid alpha value \"%d\": " "must be integer between 0 and 255", newVal)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "BAD_VALUE", NULL); return TCL_ERROR; } } /* * Set new alpha value for the pixel */ pixelPtr = masterPtr->pix32 + (y * masterPtr->width + x) * 4; if (boolMode) { pixelPtr[3] = newVal ? 0 : 255; } else { pixelPtr[3] = newVal; } /* * Update the validRegion of the image */ setBox.x = x; setBox.y = y; setBox.width = 1; setBox.height = 1; modRegion = TkCreateRegion(); TkUnionRectWithRegion(&setBox, modRegion, modRegion); if (pixelPtr[3]) { TkUnionRectWithRegion(&setBox, masterPtr->validRegion, masterPtr->validRegion); } else { TkSubtractRegion(masterPtr->validRegion, modRegion, masterPtr->validRegion); } TkDestroyRegion(modRegion); /* * Inform the generic image code that the image * has (potentially) changed. */ Tk_ImageChanged(masterPtr->tkMaster, x, y, 1, 1, |
︙ | ︙ | |||
1473 1474 1475 1476 1477 1478 1479 | /* *---------------------------------------------------------------------- * * ParseSubcommandOptions -- * * This function is invoked to process one of the options which may be * specified for the photo image subcommands, namely, -from, -to, -zoom, | | > > > | > > | 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | /* *---------------------------------------------------------------------- * * ParseSubcommandOptions -- * * This function is invoked to process one of the options which may be * specified for the photo image subcommands, namely, -from, -to, -zoom, * -subsample, -format, -shrink, -compositingrule, -alpha, -boolean and * -withalpha. * Parsing starts at the index in *optIndexPtr and stops at the end of * objv[] or at the first value that does not belong to an option. * * Results: * A standard Tcl result. * * Side effects: * Fields in *optPtr get filled in. The value of optIndexPtr is updated * to contain the index of the first element in argv[] that was not * parsed, or argc if the end of objv[] was reached. * *---------------------------------------------------------------------- */ static int ParseSubcommandOptions( struct SubcommandOptions *optPtr, |
︙ | ︙ | |||
1503 1504 1505 1506 1507 1508 1509 | Tcl_Obj *const objv[]) /* Arguments to be parsed. */ { static const char *const compositingRules[] = { "overlay", "set", /* Note that these must match the * TK_PHOTO_COMPOSITE_* constants. */ NULL }; | | | < | 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 | Tcl_Obj *const objv[]) /* Arguments to be parsed. */ { static const char *const compositingRules[] = { "overlay", "set", /* Note that these must match the * TK_PHOTO_COMPOSITE_* constants. */ NULL }; TkSizeT length; int index, c, bit, currentBit; int values[4], numValues, maxValues, argIndex; const char *option, *expandedOption, *needed; const char *const *listPtr; Tcl_Obj *msgObj; for (index = *optIndexPtr; index < objc; *optIndexPtr = ++index) { /* * We can have one value specified without an option; it goes into * optPtr->name. */ expandedOption = option = TkGetStringFromObj(objv[index], &length); if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; continue; } break; } |
︙ | ︙ | |||
1604 1605 1606 1607 1608 1609 1610 | index++; if (Tcl_GetIndexFromObj(interp, objv[index], compositingRules, "compositing rule", 0, &optPtr->compositingRule) != TCL_OK) { return TCL_ERROR; } *optIndexPtr = index; | | > | 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 | index++; if (Tcl_GetIndexFromObj(interp, objv[index], compositingRules, "compositing rule", 0, &optPtr->compositingRule) != TCL_OK) { return TCL_ERROR; } *optIndexPtr = index; } else if (bit == OPT_TO || bit == OPT_FROM || bit == OPT_SUBSAMPLE || bit == OPT_ZOOM) { const char *val; maxValues = ((bit == OPT_FROM) || (bit == OPT_TO)) ? 4 : 2; argIndex = index + 1; for (numValues = 0; numValues < maxValues; ++numValues) { if (argIndex >= objc) { break; |
︙ | ︙ | |||
1785 1786 1787 1788 1789 1790 1791 | int flags) /* Flags to pass to Tk_ConfigureWidget, such * as TK_CONFIG_ARGV_ONLY. */ { PhotoInstance *instancePtr; const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL; Tcl_Obj *tempdata, *tempformat; | | | < | 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | int flags) /* Flags to pass to Tk_ConfigureWidget, such * as TK_CONFIG_ARGV_ONLY. */ { PhotoInstance *instancePtr; const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL; Tcl_Obj *tempdata, *tempformat; TkSizeT length; int i, j, result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; const char **args; args = ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { args[j] = TkGetStringFromObj(objv[i], &length); if ((length > 1) && (args[j][0] == '-')) { if ((args[j][1] == 'd') && !strncmp(args[j], "-data", length)) { if (++i < objc) { data = objv[i]; j--; } else { |
︙ | ︙ | |||
1874 1875 1876 1877 1878 1879 1880 | masterPtr->fileString = NULL; } if (data) { /* * Force into ByteArray format, which most (all) image handlers will * use anyway. Empty length means ignore the -data option. */ | | | | 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | masterPtr->fileString = NULL; } if (data) { /* * Force into ByteArray format, which most (all) image handlers will * use anyway. Empty length means ignore the -data option. */ TkSizeT bytesize; (void) TkGetByteArrayFromObj(data, &bytesize); if (bytesize) { Tcl_IncrRefCount(data); } else { data = NULL; } if (masterPtr->dataString) { Tcl_DecrRefCount(masterPtr->dataString); |
︙ | ︙ | |||
2560 2561 2562 2563 2564 2565 2566 | * is returned here. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here. */ int *oldformat) /* Returns 1 if the old image API is used. */ { int matched = 0, useoldformat = 0; | | > > > > > > > > > > > > > > > > > > > > | 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 | * is returned here. */ int *widthPtr, int *heightPtr, /* The dimensions of the image are returned * here. */ int *oldformat) /* Returns 1 if the old image API is used. */ { int matched = 0, useoldformat = 0; Tk_PhotoImageFormat *formatPtr, *defaultFormatPtr = NULL; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); const char *formatString = NULL; if (formatObj) { formatString = Tcl_GetString(formatObj); } /* * Scan through the table of file format handlers to find one which can * handle the image. */ for (formatPtr = tsdPtr->formatList; formatPtr != NULL; formatPtr = formatPtr->nextPtr) { /* * To keep the behaviour of older versions (Tk <= 8.6), the default * list-of-lists string format is checked last. Remember its position. */ if (strncasecmp("default", formatPtr->name, strlen(formatPtr->name)) == 0) { defaultFormatPtr = formatPtr; } if (formatObj != NULL) { if (strncasecmp(formatString, formatPtr->name, strlen(formatPtr->name)) != 0) { continue; } matched = 1; if (formatPtr->stringMatchProc == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "-data option isn't supported for %s images", formatString)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "NOT_DATA_FORMAT", NULL); return TCL_ERROR; } } /* * If this is the default format, and it was not passed as -format * option, skip the stringMatchProc test. It'll be done later */ if (formatObj == NULL && formatPtr == defaultFormatPtr) { continue; } if ((formatPtr->stringMatchProc != NULL) && (formatPtr->stringReadProc != NULL) && formatPtr->stringMatchProc(data, formatObj, widthPtr, heightPtr, interp)) { break; } } |
︙ | ︙ | |||
2628 2629 2630 2631 2632 2633 2634 2635 | (Tcl_Obj *) Tcl_GetString(data), (Tcl_Obj *) formatString, widthPtr, heightPtr, interp)) { break; } } } if (formatPtr == NULL) { | > > > > > > > > > > > > > > > > | > > > > > > > > > | | | | | | > > > > > > > | 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 | (Tcl_Obj *) Tcl_GetString(data), (Tcl_Obj *) formatString, widthPtr, heightPtr, interp)) { break; } } } if (formatPtr == NULL) { /* * Try the default format as last resort (only if no -format option * was passed). */ if ( formatObj == NULL && defaultFormatPtr == NULL) { Tcl_Panic("default image format handler not registered"); } if ( formatObj == NULL && defaultFormatPtr->stringMatchProc != NULL && defaultFormatPtr->stringReadProc != NULL && defaultFormatPtr->stringMatchProc(data, formatObj, widthPtr, heightPtr, interp) != 0) { useoldformat = 0; formatPtr = defaultFormatPtr; } else if ((formatObj != NULL) && !matched) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "image format \"%s\" is not supported", formatString)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "PHOTO_FORMAT", formatString, NULL); return TCL_ERROR; } else { /* * Some lower level routine (stringMatchProc) may have already set * a specific error message, so just return this. Otherwise return * a generic image data error. */ if (Tcl_GetString(Tcl_GetObjResult(interp))[0] == '\0') { Tcl_SetObjResult(interp, Tcl_NewStringObj( "couldn't recognize image data", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "PHOTO", "UNRECOGNIZED_DATA", NULL); } return TCL_ERROR; } } *imageFormatPtr = formatPtr; *oldformat = useoldformat; /* * Some stringMatchProc might have left error messages and error codes in * interp. Clear them before return. */ Tcl_ResetResult(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * * Tk_FindPhoto -- |
︙ | ︙ | |||
3936 3937 3938 3939 3940 3941 3942 | } return NULL; } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 | } return NULL; } /* *---------------------------------------------------------------------- * * Tk_PhotoGetImage -- * * This function is called to obtain image data from a photo image. This * function fills in the Tk_PhotoImageBlock structure pointed to by * `blockPtr' with details of the address and layout of the image data in * memory. * |
︙ | ︙ | |||
4029 4030 4031 4032 4033 4034 4035 | blockPtr->offset[3] = 3; return 1; } /* *-------------------------------------------------------------- * | | | 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 | blockPtr->offset[3] = 3; return 1; } /* *-------------------------------------------------------------- * * ImgPostscriptPhoto -- * * This function is called to output the contents of a photo image in * Postscript by calling the Tk_PostscriptPhoto function. * * Results: * Returns a standard Tcl return value. * |
︙ | ︙ | |||
4074 4075 4076 4077 4078 4079 4080 | * table. For the behaviour of *_NoComposite, refer to the corresponding * function without the extra suffix, except that the compositing rule is * always "overlay" and the function always panics on memory-allocation * failure. * *---------------------------------------------------------------------- */ | | | 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 | * table. For the behaviour of *_NoComposite, refer to the corresponding * function without the extra suffix, except that the compositing rule is * always "overlay" and the function always panics on memory-allocation * failure. * *---------------------------------------------------------------------- */ #if !defined(TK_NO_DEPRECATED) && TCL_MAJOR_VERSION < 9 void Tk_PhotoPutBlock_NoComposite( Tk_PhotoHandle handle, Tk_PhotoImageBlock *blockPtr, int x, int y, int width, int height) { if (Tk_PhotoPutBlock(NULL, handle, blockPtr, x, y, width, height, |
︙ | ︙ | |||
4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 | Tk_PhotoHandle handle, int width, int height) { if (Tk_PhotoSetSize(NULL, handle, width, height) != TCL_OK) { Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > | 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 | Tk_PhotoHandle handle, int width, int height) { if (Tk_PhotoSetSize(NULL, handle, width, height) != TCL_OK) { Tcl_Panic(TK_PHOTO_ALLOC_FAILURE_MESSAGE); } } #endif /* TK_NO_DEPRECATED */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * tab-width: 8 * End: */ |
Changes to generic/tkImgPhoto.h.
︙ | ︙ | |||
89 90 91 92 93 94 95 96 | * structure of the following type is used to store the allocated pixel values * and other information: */ struct ColorTable { ColorTableId id; /* Information used in selecting this color * table. */ int flags; /* See below. */ | > > > > > > | | > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | * structure of the following type is used to store the allocated pixel values * and other information: */ struct ColorTable { ColorTableId id; /* Information used in selecting this color * table. */ #if TCL_MAJOR_VERSION > 8 size_t refCount; /* Number of instances using this map. */ size_t liveRefCount; /* Number of instances which are actually in * use, using this map. */ int flags; /* See below. */ #else int flags; /* See below. */ unsigned int refCount; /* Number of instances using this map. */ unsigned int liveRefCount; /* Number of instances which are actually in * use, using this map. */ #endif int numColors; /* Number of colors allocated for this map. */ XVisualInfo visualInfo; /* Information about the visual for windows * using this color table. */ pixel redValues[256]; /* Maps 8-bit values of red intensity to a * pixel value or index in pixelMap. */ |
︙ | ︙ | |||
197 198 199 200 201 202 203 | struct PhotoInstance { PhotoMaster *masterPtr; /* Pointer to master for image. */ Display *display; /* Display for windows using this instance. */ Colormap colormap; /* The image may only be used in windows with * this particular colormap. */ PhotoInstance *nextPtr; /* Pointer to the next instance in the list of * instances associated with this master. */ | > | > > > | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | struct PhotoInstance { PhotoMaster *masterPtr; /* Pointer to master for image. */ Display *display; /* Display for windows using this instance. */ Colormap colormap; /* The image may only be used in windows with * this particular colormap. */ PhotoInstance *nextPtr; /* Pointer to the next instance in the list of * instances associated with this master. */ #if TCL_MAJOR_VERSION > 8 size_t refCount; /* Number of instances using this structure. */ #else unsigned int refCount; /* Number of instances using this structure. */ #endif Tk_Uid palette; /* Palette for these particular instances. */ double gamma; /* Gamma value for these instances. */ Tk_Uid defaultPalette; /* Default palette to use if a palette is not * specified for the master. */ ColorTable *colorTablePtr; /* Pointer to information about colors * allocated for image display in windows like * this one. */ |
︙ | ︙ |
Added generic/tkImgSVGnano.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | /* * tkImgSVGnano.c * * A photo file handler for SVG files. * * Copyright (c) 2013-14 Mikko Mononen [email protected] * Copyright (c) 2018 Christian Gollwitzer [email protected] * Copyright (c) 2018 Rene Zaumseil [email protected] * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * * This handler is build using the original nanosvg library files from * https://github.com/memononen/nanosvg and the tcl extension files from * https://github.com/auriocus/tksvg * */ #include "tkInt.h" #define NANOSVG_malloc ckalloc #define NANOSVG_realloc ckrealloc #define NANOSVG_free ckfree #define NANOSVG_SCOPE MODULE_SCOPE #define NANOSVG_ALL_COLOR_KEYWORDS #define NANOSVG_IMPLEMENTATION #include "nanosvg.h" #define NANOSVGRAST_IMPLEMENTATION #include "nanosvgrast.h" /* Additional parameters to nsvgRasterize() */ typedef struct { double x; double y; double scale; } RastOpts; /* * Per interp cache of last NSVGimage which was matched to * be immediately rasterized after the match. This helps to * eliminate double parsing of the SVG file/string. */ typedef struct { ClientData dataOrChan; Tcl_DString formatString; NSVGimage *nsvgImage; RastOpts ropts; } NSVGcache; static int FileMatchSVG(Tcl_Channel chan, const char *fileName, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int FileReadSVG(Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static int StringMatchSVG(Tcl_Obj *dataObj, Tcl_Obj *format, int *widthPtr, int *heightPtr, Tcl_Interp *interp); static int StringReadSVG(Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *format, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY); static NSVGimage * ParseSVGWithOptions(Tcl_Interp *interp, const char *input, TkSizeT length, Tcl_Obj *format, RastOpts *ropts); static int RasterizeSVG(Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, int srcX, int srcY, RastOpts *ropts); static NSVGcache * GetCachePtr(Tcl_Interp *interp); static int CacheSVG(Tcl_Interp *interp, ClientData dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts); static NSVGimage * GetCachedSVG(Tcl_Interp *interp, ClientData dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts); static void CleanCache(Tcl_Interp *interp); static void FreeCache(ClientData clientData, Tcl_Interp *interp); /* * The format record for the SVG nano file format: */ Tk_PhotoImageFormat tkImgFmtSVGnano = { "svg", /* name */ FileMatchSVG, /* fileMatchProc */ StringMatchSVG, /* stringMatchProc */ FileReadSVG, /* fileReadProc */ StringReadSVG, /* stringReadProc */ NULL, /* fileWriteProc */ NULL, /* stringWriteProc */ NULL }; /* *---------------------------------------------------------------------- * * FileMatchSVG -- * * This function is invoked by the photo image type to see if a file * contains image data in SVG format. * * Results: * The return value is >0 if the file can be successfully parsed, * and 0 otherwise. * * Side effects: * The file is saved in the internal cache for further use. * *---------------------------------------------------------------------- */ static int FileMatchSVG( Tcl_Channel chan, const char *fileName, Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { TkSizeT length; Tcl_Obj *dataObj = Tcl_NewObj(); const char *data; RastOpts ropts; NSVGimage *nsvgImage; CleanCache(interp); if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); return 0; } data = TkGetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage != NULL) { *widthPtr = (int) ceil(nsvgImage->width * ropts.scale); *heightPtr = (int) ceil(nsvgImage->height * ropts.scale); if ((*widthPtr <= 0) || (*heightPtr <= 0)) { nsvgDelete(nsvgImage); return 0; } if (!CacheSVG(interp, chan, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); } return 1; } return 0; } /* *---------------------------------------------------------------------- * * FileReadSVG -- * * This function is called by the photo image type to read SVG format * data from a file and write it into a given photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned then an error * message is left in the interp's result. * * Side effects: * The access position in file f is changed, and new data is added to the * image given by imageHandle. * *---------------------------------------------------------------------- */ static int FileReadSVG( Tcl_Interp *interp, Tcl_Channel chan, const char *fileName, Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY) { TkSizeT length; const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, chan, formatObj, &ropts); if (nsvgImage == NULL) { Tcl_Obj *dataObj = Tcl_NewObj(); if (Tcl_ReadChars(chan, dataObj, -1, 0) == TCL_IO_FAILURE) { /* in case of an error reading the file */ Tcl_DecrRefCount(dataObj); Tcl_SetObjResult(interp, Tcl_NewStringObj("read error", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "READ_ERROR", NULL); return TCL_ERROR; } data = TkGetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); Tcl_DecrRefCount(dataObj); if (nsvgImage == NULL) { return TCL_ERROR; } } return RasterizeSVG(interp, imageHandle, nsvgImage, destX, destY, width, height, srcX, srcY, &ropts); } /* *---------------------------------------------------------------------- * * StringMatchSVG -- * * This function is invoked by the photo image type to see if a string * contains image data in SVG format. * * Results: * The return value is >0 if the file can be successfully parsed, * and 0 otherwise. * * Side effects: * The file is saved in the internal cache for further use. * *---------------------------------------------------------------------- */ static int StringMatchSVG( Tcl_Obj *dataObj, Tcl_Obj *formatObj, int *widthPtr, int *heightPtr, Tcl_Interp *interp) { TkSizeT length; const char *data; RastOpts ropts; NSVGimage *nsvgImage; CleanCache(interp); data = TkGetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); if (nsvgImage != NULL) { *widthPtr = (int) ceil(nsvgImage->width * ropts.scale); *heightPtr = (int) ceil(nsvgImage->height * ropts.scale); if ((*widthPtr <= 0) || (*heightPtr <= 0)) { nsvgDelete(nsvgImage); return 0; } if (!CacheSVG(interp, dataObj, formatObj, nsvgImage, &ropts)) { nsvgDelete(nsvgImage); } return 1; } return 0; } /* *---------------------------------------------------------------------- * * StringReadSVG -- * * This function is called by the photo image type to read SVG format * data from a string and write it into a given photo image. * * Results: * A standard TCL completion code. If TCL_ERROR is returned then an error * message is left in the interp's result. * * Side effects: * New data is added to the image given by imageHandle. * *---------------------------------------------------------------------- */ static int StringReadSVG( Tcl_Interp *interp, Tcl_Obj *dataObj, Tcl_Obj *formatObj, Tk_PhotoHandle imageHandle, int destX, int destY, int width, int height, int srcX, int srcY) { TkSizeT length; const char *data; RastOpts ropts; NSVGimage *nsvgImage = GetCachedSVG(interp, dataObj, formatObj, &ropts); if (nsvgImage == NULL) { data = TkGetStringFromObj(dataObj, &length); nsvgImage = ParseSVGWithOptions(interp, data, length, formatObj, &ropts); } if (nsvgImage == NULL) { return TCL_ERROR; } return RasterizeSVG(interp, imageHandle, nsvgImage, destX, destY, width, height, srcX, srcY, &ropts); } /* *---------------------------------------------------------------------- * * ParseSVGWithOptions -- * * This function is called to parse the given input string as SVG. * * Results: * Return a newly create NSVGimage on success, and NULL otherwise. * * Side effects: * *---------------------------------------------------------------------- */ static NSVGimage * ParseSVGWithOptions( Tcl_Interp *interp, const char *input, TkSizeT length, Tcl_Obj *formatObj, RastOpts *ropts) { Tcl_Obj **objv = NULL; int objc = 0; double dpi = 96.0; char unit[3], *p; char *inputCopy = NULL; NSVGimage *nsvgImage; static const char *const fmtOptions[] = { "-dpi", "-scale", "-unit", NULL }; enum fmtOptions { OPT_DPI, OPT_SCALE, OPT_UNIT }; /* * The parser destroys the original input string, * therefore first duplicate. */ inputCopy = attemptckalloc(length+1); if (inputCopy == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc data buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto error; } memcpy(inputCopy, input, length); inputCopy[length] = '\0'; /* * Process elements of format specification as a list. */ strcpy(unit, "px"); ropts->x = ropts->y = 0.0; ropts->scale = 1.0; if ((formatObj != NULL) && Tcl_ListObjGetElements(interp, formatObj, &objc, &objv) != TCL_OK) { goto error; } for (; objc > 0 ; objc--, objv++) { int optIndex; /* * Ignore the "svg" part of the format specification. */ if (!strcasecmp(Tcl_GetString(objv[0]), "svg")) { continue; } if (Tcl_GetIndexFromObjStruct(interp, objv[0], fmtOptions, sizeof(char *), "option", 0, &optIndex) == TCL_ERROR) { goto error; } if (objc < 2) { ckfree(inputCopy); inputCopy = NULL; Tcl_WrongNumArgs(interp, 1, objv, "value"); goto error; } objc--; objv++; switch ((enum fmtOptions) optIndex) { case OPT_DPI: if (Tcl_GetDoubleFromObj(interp, objv[0], &dpi) == TCL_ERROR) { goto error; } if (dpi < 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-dpi value must be positive", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_DPI", NULL); goto error; } break; case OPT_SCALE: if (Tcl_GetDoubleFromObj(interp, objv[0], &ropts->scale) == TCL_ERROR) { goto error; } if (ropts->scale <= 0.0) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "-scale value must be positive", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "BAD_SCALE", NULL); goto error; } break; case OPT_UNIT: p = Tcl_GetString(objv[0]); if ((p != NULL) && (p[0])) { strncpy(unit, p, 3); unit[2] = '\0'; } break; } } nsvgImage = nsvgParse(inputCopy, unit, (float) dpi); if (nsvgImage == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot parse SVG image", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "PARSE_ERROR", NULL); goto error; } ckfree(inputCopy); return nsvgImage; error: if (inputCopy != NULL) { ckfree(inputCopy); } return NULL; } /* *---------------------------------------------------------------------- * * RasterizeSVG -- * * This function is called to rasterize the given nsvgImage and * fill the imageHandle with data. * * Results: * A standard TCL completion code. If TCL_ERROR is returned then an error * message is left in the interp's result. * * * Side effects: * On error the given nsvgImage will be deleted. * *---------------------------------------------------------------------- */ static int RasterizeSVG( Tcl_Interp *interp, Tk_PhotoHandle imageHandle, NSVGimage *nsvgImage, int destX, int destY, int width, int height, int srcX, int srcY, RastOpts *ropts) { int w, h, c; NSVGrasterizer *rast; unsigned char *imgData; Tk_PhotoImageBlock svgblock; w = (int) ceil(nsvgImage->width * ropts->scale); h = (int) ceil(nsvgImage->height * ropts->scale); rast = nsvgCreateRasterizer(); if (rast == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot initialize rasterizer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "RASTERIZER_ERROR", NULL); goto cleanAST; } imgData = attemptckalloc(w * h *4); if (imgData == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("cannot alloc image buffer", -1)); Tcl_SetErrorCode(interp, "TK", "IMAGE", "SVG", "OUT_OF_MEMORY", NULL); goto cleanRAST; } nsvgRasterize(rast, nsvgImage, (float) ropts->x, (float) ropts->y, (float) ropts->scale, imgData, w, h, w * 4); /* transfer the data to a photo block */ svgblock.pixelPtr = imgData; svgblock.width = w; svgblock.height = h; svgblock.pitch = w * 4; svgblock.pixelSize = 4; for (c = 0; c <= 3; c++) { svgblock.offset[c] = c; } if (Tk_PhotoExpand(interp, imageHandle, destX + width, destY + height) != TCL_OK) { goto cleanRAST; } if (Tk_PhotoPutBlock(interp, imageHandle, &svgblock, destX, destY, width, height, TK_PHOTO_COMPOSITE_SET) != TCL_OK) { goto cleanimg; } ckfree(imgData); nsvgDeleteRasterizer(rast); nsvgDelete(nsvgImage); return TCL_OK; cleanimg: ckfree(imgData); cleanRAST: nsvgDeleteRasterizer(rast); cleanAST: nsvgDelete(nsvgImage); return TCL_ERROR; } /* *---------------------------------------------------------------------- * * GetCachePtr -- * * This function is called to get the per interpreter used * svg image cache. * * Results: * Return a pointer to the used cache. * * Side effects: * Initialize the cache on the first call. * *---------------------------------------------------------------------- */ static NSVGcache * GetCachePtr( Tcl_Interp *interp ) { NSVGcache *cachePtr = Tcl_GetAssocData(interp, "tksvgnano", NULL); if (cachePtr == NULL) { cachePtr = ckalloc(sizeof(NSVGcache)); cachePtr->dataOrChan = NULL; Tcl_DStringInit(&cachePtr->formatString); cachePtr->nsvgImage = NULL; Tcl_SetAssocData(interp, "tksvgnano", FreeCache, cachePtr); } return cachePtr; } /* *---------------------------------------------------------------------- * * CacheSVG -- * * Add the given svg image informations to the cache for further usage. * * Results: * Return 1 on success, and 0 otherwise. * * Side effects: * *---------------------------------------------------------------------- */ static int CacheSVG( Tcl_Interp *interp, ClientData dataOrChan, Tcl_Obj *formatObj, NSVGimage *nsvgImage, RastOpts *ropts) { TkSizeT length; const char *data; NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { cachePtr->dataOrChan = dataOrChan; if (formatObj != NULL) { data = TkGetStringFromObj(formatObj, &length); Tcl_DStringAppend(&cachePtr->formatString, data, length); } cachePtr->nsvgImage = nsvgImage; cachePtr->ropts = *ropts; return 1; } return 0; } /* *---------------------------------------------------------------------- * * GetCachedSVG -- * * Try to get the NSVGimage from the internal cache. * * Results: * Return the found NSVGimage on success, and NULL otherwise. * * Side effects: * Calls the CleanCache() function. * *---------------------------------------------------------------------- */ static NSVGimage * GetCachedSVG( Tcl_Interp *interp, ClientData dataOrChan, Tcl_Obj *formatObj, RastOpts *ropts) { TkSizeT length; const char *data; NSVGcache *cachePtr = GetCachePtr(interp); NSVGimage *nsvgImage = NULL; if ((cachePtr != NULL) && (cachePtr->nsvgImage != NULL) && (cachePtr->dataOrChan == dataOrChan)) { if (formatObj != NULL) { data = TkGetStringFromObj(formatObj, &length); if (strcmp(data, Tcl_DStringValue(&cachePtr->formatString)) == 0) { nsvgImage = cachePtr->nsvgImage; *ropts = cachePtr->ropts; cachePtr->nsvgImage = NULL; } } else if (Tcl_DStringLength(&cachePtr->formatString) == 0) { nsvgImage = cachePtr->nsvgImage; *ropts = cachePtr->ropts; cachePtr->nsvgImage = NULL; } } CleanCache(interp); return nsvgImage; } /* *---------------------------------------------------------------------- * * CleanCache -- * * Reset the cache and delete the saved image in it. * * Results: * * Side effects: * *---------------------------------------------------------------------- */ static void CleanCache(Tcl_Interp *interp) { NSVGcache *cachePtr = GetCachePtr(interp); if (cachePtr != NULL) { cachePtr->dataOrChan = NULL; Tcl_DStringSetLength(&cachePtr->formatString, 0); if (cachePtr->nsvgImage != NULL) { nsvgDelete(cachePtr->nsvgImage); cachePtr->nsvgImage = NULL; } } } /* *---------------------------------------------------------------------- * * FreeCache -- * * This function is called to clean up the internal cache data. * * Results: * * Side effects: * Existing image data in the cache and the cache will be deleted. * *---------------------------------------------------------------------- */ static void FreeCache(ClientData clientData, Tcl_Interp *interp) { NSVGcache *cachePtr = clientData; Tcl_DStringFree(&cachePtr->formatString); if (cachePtr->nsvgImage != NULL) { nsvgDelete(cachePtr->nsvgImage); } ckfree(cachePtr); } |
Changes to generic/tkInt.decls.
︙ | ︙ | |||
95 96 97 98 99 100 101 | Display *display, Drawable drawable, GC gc, GC outlineGC) } declare 21 { int TkFindStateNum(Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey) } declare 22 { | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | Display *display, Drawable drawable, GC gc, GC outlineGC) } declare 21 { int TkFindStateNum(Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey) } declare 22 { const char *TkFindStateString(const TkStateMap *mapPtr, int numKey) } declare 23 { void TkFocusDeadWindow(TkWindow *winPtr) } declare 24 { int TkFocusFilterEvent(TkWindow *winPtr, XEvent *eventPtr) } |
︙ | ︙ | |||
178 179 180 181 182 183 184 | TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position) } declare 45 { void TkInstallFrameMenu(Tk_Window tkwin) } declare 46 { | | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position) } declare 45 { void TkInstallFrameMenu(Tk_Window tkwin) } declare 46 { const char *TkKeysymToString(KeySym keysym) } declare 47 { int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[]) } declare 48 { double TkLineToPoint(double end1Ptr[], double end2Ptr[], double pointPtr[]) } |
︙ | ︙ | |||
385 386 387 388 389 390 391 | TkMainInfo *TkGetMainInfoList(void) } declare 108 { int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr) } declare 109 { | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | TkMainInfo *TkGetMainInfoList(void) } declare 108 { int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr) } declare 109 { const char *TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr) } declare 110 { void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont) } declare 111 { Tcl_Obj *TkpGetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className) |
︙ | ︙ | |||
566 567 568 569 570 571 572 | } # Next group of functions exposed due to [Bug 2768945]. declare 169 { int TkStateParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 170 { | | | | | | | | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | } # Next group of functions exposed due to [Bug 2768945]. declare 169 { int TkStateParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 170 { const char *TkStatePrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 171 { int TkCanvasDashParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 172 { const char *TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 173 { int TkOffsetParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 174 { const char *TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 175 { int TkPixelParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 176 { const char *TkPixelPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 177 { int TkOrientParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 178 { const char *TkOrientPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } declare 179 { int TkSmoothParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset) } declare 180 { const char *TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr) } # Angled text API, exposed for Emiliano Gavilán's RBC work. declare 181 { void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, |
︙ | ︙ | |||
630 631 632 633 634 635 636 637 638 639 640 641 642 643 | int width, int height, double angle) } declare 184 { void TkDrawAngledChars(Display *display,Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle) } ############################################################################## # Define the platform specific internal Tcl interface. These functions are # only available on the designated platform. interface tkIntPlat | > > > > > > > | 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | int width, int height, double angle) } declare 184 { void TkDrawAngledChars(Display *display,Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle) } # Debugging / testing functions for photo images declare 185 { int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr) } ############################################################################## # Define the platform specific internal Tcl interface. These functions are # only available on the designated platform. interface tkIntPlat |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | declare 46 aqua { int TkpIsWindowFloating(void *window) } declare 47 aqua { Tk_Window TkMacOSXGetCapture(void) } declare 49 aqua { | | | 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 | declare 46 aqua { int TkpIsWindowFloating(void *window) } declare 47 aqua { Tk_Window TkMacOSXGetCapture(void) } declare 49 aqua { Tk_Window TkGetTransientMaster(TkWindow *winPtr) } declare 50 aqua { int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state) } declare 51 aqua { void TkGenWMDestroyEvent(Tk_Window tkwin) } |
︙ | ︙ | |||
1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | int XReparentWindow(Display *d, Window w, Window p, int x, int y) } declare 137 win { int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h) } ################################ # X functions for Aqua declare 0 aqua { int XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n) | > > > > > > | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | int XReparentWindow(Display *d, Window w, Window p, int x, int y) } declare 137 win { int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h) } declare 138 win { Region XPolygonRegion(XPoint *pts, int n, int rule) } declare 139 win { int XPointInRegion(Region rgn, int x, int y) } ################################ # X functions for Aqua declare 0 aqua { int XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n) |
︙ | ︙ |
Changes to generic/tkInt.h.
︙ | ︙ | |||
21 22 23 24 25 26 27 | /* * Ensure WORDS_BIGENDIAN is defined correctly: * Needs to happen here in addition to configure to work with fat compiles on * Darwin (where configure runs only once for multiple architectures). */ | < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | /* * Ensure WORDS_BIGENDIAN is defined correctly: * Needs to happen here in addition to configure to work with fat compiles on * Darwin (where configure runs only once for multiple architectures). */ #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_PARAM_H # include <sys/param.h> #endif #ifdef BYTE_ORDER |
︙ | ︙ | |||
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # ifdef __cplusplus # define MODULE_SCOPE extern "C" # else # define MODULE_SCOPE extern # endif #endif /* * Macros used to cast between pointers and integers (e.g. when storing an int * in ClientData), on 64-bit architectures they avoid gcc warning about "cast * to/from pointer from/to integer of different size". */ #if !defined(INT2PTR) && !defined(PTR2INT) # if defined(HAVE_INTPTR_T) || defined(intptr_t) # define INT2PTR(p) ((void*)(intptr_t)(p)) | > > > > > > > > | | | | > > > > > > > > > > > > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | # ifdef __cplusplus # define MODULE_SCOPE extern "C" # else # define MODULE_SCOPE extern # endif #endif #ifndef TkSizeT # if TCL_MAJOR_VERSION > 8 # define TkSizeT size_t # else # define TkSizeT int # endif #endif /* * Macros used to cast between pointers and integers (e.g. when storing an int * in ClientData), on 64-bit architectures they avoid gcc warning about "cast * to/from pointer from/to integer of different size". */ #if !defined(INT2PTR) && !defined(PTR2INT) # if defined(HAVE_INTPTR_T) || defined(intptr_t) # define INT2PTR(p) ((void*)(intptr_t)(p)) # define PTR2INT(p) ((intptr_t)(p)) # else # define INT2PTR(p) ((void*)(p)) # define PTR2INT(p) ((long)(p)) # endif #endif #if !defined(UINT2PTR) && !defined(PTR2UINT) # if defined(HAVE_UINTPTR_T) || defined(uintptr_t) # define UINT2PTR(p) ((void*)(uintptr_t)(p)) # define PTR2UINT(p) ((uintptr_t)(p)) # else # define UINT2PTR(p) ((void*)(p)) # define PTR2UINT(p) ((unsigned long)(p)) # endif #endif #ifndef TCL_AUTO_LENGTH # define TCL_AUTO_LENGTH (-1) #endif #ifndef TCL_Z_MODIFIER # if defined(_WIN64) # define TCL_Z_MODIFIER "I" # elif defined(__GNUC__) && !defined(_WIN32) # define TCL_Z_MODIFIER "z" # else # define TCL_Z_MODIFIER "" # endif #endif /* !TCL_Z_MODIFIER */ /* * Opaque type declarations: */ typedef struct TkColormap TkColormap; typedef struct TkFontAttributes TkFontAttributes; |
︙ | ︙ | |||
103 104 105 106 107 108 109 | * specific cursor files. */ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ | | | | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | * specific cursor files. */ typedef struct TkCursor { Tk_Cursor cursor; /* System specific identifier for cursor. */ Display *display; /* Display containing cursor. Needed for * disposal and retrieval of cursors. */ TkSizeT resourceRefCount; /* Number of active uses of this cursor (each * active use corresponds to a call to * Tk_AllocPreserveFromObj or Tk_Preserve). If * this count is 0, then this structure is no * longer valid and it isn't present in a hash * table: it is being kept around only because * there are objects referring to it. The * structure is freed when resourceRefCount * and objRefCount are both 0. */ TkSizeT objRefCount; /* Number of Tcl objects that reference this * structure.. */ Tcl_HashTable *otherTable; /* Second table (other than idTable) used to * index this entry. */ Tcl_HashEntry *hashPtr; /* Entry in otherTable for this structure * (needed when deleting). */ Tcl_HashEntry *idHashPtr; /* Entry in idTable for this structure (needed * when deleting). */ |
︙ | ︙ | |||
262 263 264 265 266 267 268 | * Information used by tkError.c only: */ struct TkErrorHandler *errorPtr; /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | * Information used by tkError.c only: */ struct TkErrorHandler *errorPtr; /* First in list of error handlers for this * display. NULL means no handlers exist at * present. */ TkSizeT deleteCount; /* Counts # of handlers deleted since last * time inactive handlers were garbage- * collected. When this number gets big, * handlers get cleaned up. */ /* * Used by tkEvent.c only: */ |
︙ | ︙ | |||
318 319 320 321 322 323 324 325 326 327 328 329 330 331 | */ Tcl_HashTable maintainHashTable; /* Hash table that maps from a master's * Tk_Window token to a list of slaves managed * by that master. */ int geomInit; /* * Information used by tkGet.c only: */ Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */ int uidInit; /* 0 means uidTable needs initializing. */ | > > > | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | */ Tcl_HashTable maintainHashTable; /* Hash table that maps from a master's * Tk_Window token to a list of slaves managed * by that master. */ int geomInit; #define TkGetGeomMaster(tkwin) (((TkWindow *)tkwin)->maintainerPtr != NULL ? \ ((TkWindow *)tkwin)->maintainerPtr : ((TkWindow *)tkwin)->parentPtr) /* * Information used by tkGet.c only: */ Tcl_HashTable uidTable; /* Stores all Tk_Uid used in a thread. */ int uidInit; /* 0 means uidTable needs initializing. */ |
︙ | ︙ | |||
475 476 477 478 479 480 481 | #ifdef TK_USE_INPUT_METHODS XIM inputMethod; /* Input method for this display. */ XIMStyle inputStyle; /* Input style selected for this display. */ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ | | > > | > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | #ifdef TK_USE_INPUT_METHODS XIM inputMethod; /* Input method for this display. */ XIMStyle inputStyle; /* Input style selected for this display. */ XFontSet inputXfs; /* XFontSet cached for over-the-spot XIM. */ #endif /* TK_USE_INPUT_METHODS */ Tcl_HashTable winTable; /* Maps from X window ids to TkWindow ptrs. */ TkSizeT refCount; /* Reference count of how many Tk applications * are using this display. Used to clean up * the display when we no longer have any Tk * applications using it. */ /* * The following field were all added for Tk8.3 */ #if TCL_MAJOR_VERSION < 9 #if !defined(TK_NO_DEPRECATED) int mouseButtonState; /* Current mouse button state for this * display. NOT USED as of 8.6.10 */ Window mouseButtonWindow; /* Window the button state was set in, added * in Tk 8.4. */ #else int notused1; XID notused2; #endif /* !TK_NO_DEPRECATED */ #endif Tk_Window warpWindow; Tk_Window warpMainwin; /* For finding the root window for warping * purposes. */ int warpX; int warpY; /* |
︙ | ︙ | |||
579 580 581 582 583 584 585 | /* * Tk keeps one of the following data structures for each main window (created * by a call to TkCreateMainWindow). It stores information that is shared by * all of the windows associated with a particular main window. */ typedef struct TkMainInfo { | | > | > > > | 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | /* * Tk keeps one of the following data structures for each main window (created * by a call to TkCreateMainWindow). It stores information that is shared by * all of the windows associated with a particular main window. */ typedef struct TkMainInfo { TkSizeT refCount; /* Number of windows whose "mainPtr" fields * point here. When this becomes zero, can * free up the structure (the reference count * is zero because windows can get deleted in * almost any order; the main window isn't * necessarily the last one deleted). */ struct TkWindow *winPtr; /* Pointer to main window. */ Tcl_Interp *interp; /* Interpreter associated with application. */ Tcl_HashTable nameTable; /* Hash table mapping path names to TkWindow * structs for all windows related to this * main window. Managed by tkWindow.c. */ #if TCL_MAJOR_VERSION > 8 size_t deletionEpoch; /* Incremented by window deletions. */ #else long deletionEpoch; #endif Tk_BindingTable bindingTable; /* Used in conjunction with "bind" command to * bind events to Tcl commands. */ TkBindInfo bindInfo; /* Information used by tkBind.c on a per * application basis. */ struct TkFontInfo *fontInfoPtr; /* Information used by tkFont.c on a per |
︙ | ︙ | |||
808 809 810 811 812 813 814 | /* The remaining fields of internal border. */ int internalBorderRight; int internalBorderTop; int internalBorderBottom; int minReqWidth; /* Minimum requested width. */ int minReqHeight; /* Minimum requested height. */ | < > > > > > | | | > > > > > > > > > | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | /* The remaining fields of internal border. */ int internalBorderRight; int internalBorderTop; int internalBorderBottom; int minReqWidth; /* Minimum requested width. */ int minReqHeight; /* Minimum requested height. */ #ifdef TK_USE_INPUT_METHODS int ximGeneration; /* Used to invalidate XIC */ #endif /* TK_USE_INPUT_METHODS */ char *geomMgrName; /* Records the name of the geometry manager. */ struct TkWindow *maintainerPtr; /* The geometry master for this window. The * value is NULL if the window has no master or * if its master is its parent. */ } TkWindow; /* * Real definition of some events. Note that these events come from outside * but have internally generated pieces added to them. */ typedef struct { XKeyEvent keyEvent; /* The real event from X11. */ char *charValuePtr; /* A pointer to a string that holds the key's * %A substitution text (before backslash * adding), or NULL if that has not been * computed yet. If non-NULL, this string was * allocated with ckalloc(). */ TkSizeT charValueLen; /* Length of string in charValuePtr when that * is non-NULL. */ KeySym keysym; /* Key symbol computed after input methods * have been invoked */ } TkKeyEvent; /* * Flags passed to TkpMakeMenuWindow's 'transient' argument. */ #define TK_MAKE_MENU_TEAROFF 0 /* Only non-transient case. */ #define TK_MAKE_MENU_POPUP 1 #define TK_MAKE_MENU_DROPDOWN 2 /* See TIP #494 */ #ifndef TCL_IO_FAILURE # define TCL_IO_FAILURE (-1) #endif /* See TIP #537 */ #ifndef TCL_INDEX_NONE # define TCL_INDEX_NONE (-1) #endif /* * The following structure is used with TkMakeEnsemble to create ensemble * commands and optionally to create sub-ensembles. */ typedef struct TkEnsemble { |
︙ | ︙ | |||
920 921 922 923 924 925 926 927 928 929 930 931 932 933 | * bits. */ #define META_MASK (AnyModifier<<1) #define ALT_MASK (AnyModifier<<2) #define EXTENDED_MASK (AnyModifier<<3) /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: */ MODULE_SCOPE const Tcl_ObjType tkBorderObjType; MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 | * bits. */ #define META_MASK (AnyModifier<<1) #define ALT_MASK (AnyModifier<<2) #define EXTENDED_MASK (AnyModifier<<3) #ifndef Button8 # define Button8 8 #endif #ifndef Button9 # define Button9 9 #endif #ifndef Button6Mask # define Button6Mask (1<<13) #endif #ifndef Button7Mask # define Button7Mask (1<<14) #endif #ifndef Button8Mask # define Button8Mask (AnyModifier<<4) #endif #ifndef Button9Mask # define Button9Mask (AnyModifier<<5) #endif /* * Mask that selects any of the state bits corresponding to buttons, plus * masks that select individual buttons' bits: */ #define ALL_BUTTONS \ (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask \ |Button6Mask|Button7Mask|Button8Mask|Button9Mask) MODULE_SCOPE unsigned long TkGetButtonMask(unsigned int); /* * Object types not declared in tkObj.c need to be mentioned here so they can * be properly registered with Tcl: */ MODULE_SCOPE const Tcl_ObjType tkBorderObjType; MODULE_SCOPE const Tcl_ObjType tkBitmapObjType; |
︙ | ︙ | |||
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | * outside world: */ MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; MODULE_SCOPE Tk_ImageType tkBitmapImageType; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF; MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr); MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; MODULE_SCOPE const char *const tkWebColors[20]; /* | > > | 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | * outside world: */ MODULE_SCOPE const Tk_SmoothMethod tkBezierSmoothMethod; MODULE_SCOPE Tk_ImageType tkBitmapImageType; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtGIF; MODULE_SCOPE void (*tkHandleEventProc) (XEvent* eventPtr); MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtDefault; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPNG; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtPPM; MODULE_SCOPE Tk_PhotoImageFormat tkImgFmtSVGnano; MODULE_SCOPE TkMainInfo *tkMainWindowList; MODULE_SCOPE Tk_ImageType tkPhotoImageType; MODULE_SCOPE Tcl_HashTable tkPredefBitmapTable; MODULE_SCOPE const char *const tkWebColors[20]; /* |
︙ | ︙ | |||
973 974 975 976 977 978 979 | #if defined(PURIFY) && defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) && \ !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); #endif #if !defined(CLANG_ASSERT) | < | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | #if defined(PURIFY) && defined(__clang__) #if __has_feature(attribute_analyzer_noreturn) && \ !defined(Tcl_Panic) && defined(Tcl_Panic_TCL_DECLARED) void Tcl_Panic(const char *, ...) __attribute__((analyzer_noreturn)); #endif #if !defined(CLANG_ASSERT) #define CLANG_ASSERT(x) assert(x) #endif #elif !defined(CLANG_ASSERT) #define CLANG_ASSERT(x) #endif /* PURIFY && __clang__ */ /* |
︙ | ︙ | |||
1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 | int *lengthPtr); MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *string, int numBytes, int x, int y, int firstByte, int lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, int c, struct TkFontAttributes *faPtr); MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, Window parent); MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, Window *parentPtr, Tk_Window tkParent, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int flags); MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, const char *eventName, Tcl_Obj *detail); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, ClientData clientData, const TkEnsemble *map); MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr); MODULE_SCOPE int TkListCreateFrame(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *listObj, int toplevel, Tcl_Obj *nameObj); #ifdef _WIN32 #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, Colormap map, const char* spec, XColor * colorPtr); #endif #ifdef HAVE_XFT MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); #endif #if TCL_UTF_MAX > 4 | > > > > > > > > | | | | > > > > > > > > > > > > | 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 | int *lengthPtr); MODULE_SCOPE void TkUnderlineCharsInContext(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *string, int numBytes, int x, int y, int firstByte, int lastByte); MODULE_SCOPE void TkpGetFontAttrsForChar(Tk_Window tkwin, Tk_Font tkfont, int c, struct TkFontAttributes *faPtr); MODULE_SCOPE void TkpDrawFrameEx(Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief); MODULE_SCOPE Tcl_Obj * TkNewWindowObj(Tk_Window tkwin); MODULE_SCOPE void TkpShowBusyWindow(TkBusy busy); MODULE_SCOPE void TkpHideBusyWindow(TkBusy busy); MODULE_SCOPE void TkpMakeTransparentWindowExist(Tk_Window tkwin, Window parent); MODULE_SCOPE void TkpCreateBusy(Tk_FakeWin *winPtr, Tk_Window tkRef, Window *parentPtr, Tk_Window tkParent, TkBusy busy); MODULE_SCOPE int TkBackgroundEvalObjv(Tcl_Interp *interp, int objc, Tcl_Obj *const *objv, int flags); MODULE_SCOPE void TkSendVirtualEvent(Tk_Window tgtWin, const char *eventName, Tcl_Obj *detail); MODULE_SCOPE Tcl_Command TkMakeEnsemble(Tcl_Interp *interp, const char *nsname, const char *name, ClientData clientData, const TkEnsemble *map); MODULE_SCOPE int TkInitTkCmd(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE int TkInitFontchooser(Tcl_Interp *interp, ClientData clientData); MODULE_SCOPE void TkInitEmbeddedConfigurationInformation( Tcl_Interp *interp); MODULE_SCOPE void TkpWarpPointer(TkDisplay *dispPtr); MODULE_SCOPE void TkpCancelWarp(TkDisplay *dispPtr); MODULE_SCOPE int TkListCreateFrame(ClientData clientData, Tcl_Interp *interp, Tcl_Obj *listObj, int toplevel, Tcl_Obj *nameObj); MODULE_SCOPE void TkRotatePoint(double originX, double originY, double sine, double cosine, double *xPtr, double *yPtr); #ifdef _WIN32 #define TkParseColor XParseColor #else MODULE_SCOPE Status TkParseColor (Display * display, Colormap map, const char* spec, XColor * colorPtr); #endif #ifdef HAVE_XFT MODULE_SCOPE void TkUnixSetXftClipRegion(TkRegion clipRegion); #endif #if TCL_UTF_MAX > 4 # define TkUtfToUniChar (size_t)Tcl_UtfToUniChar # define TkUniCharToUtf (size_t)Tcl_UniCharToUtf #else MODULE_SCOPE size_t TkUtfToUniChar(const char *, int *); MODULE_SCOPE size_t TkUniCharToUtf(int, char *); #endif #if TCL_MAJOR_VERSION > 8 #define TkGetStringFromObj(objPtr, lenPtr) \ (((objPtr)->bytes ? 0 : Tcl_GetString(objPtr)), \ *(lenPtr) = (objPtr)->length, (objPtr)->bytes) MODULE_SCOPE unsigned char *TkGetByteArrayFromObj(Tcl_Obj *objPtr, size_t *lengthPtr); #else #define TkGetStringFromObj Tcl_GetStringFromObj #define TkGetByteArrayFromObj Tcl_GetByteArrayFromObj #endif /* * Unsupported commands. */ MODULE_SCOPE int TkUnsupported1ObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, |
︙ | ︙ |
Changes to generic/tkIntDecls.h.
︙ | ︙ | |||
100 101 102 103 104 105 106 | int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 21 */ EXTERN int TkFindStateNum(Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 22 */ | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 21 */ EXTERN int TkFindStateNum(Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 22 */ EXTERN const char * TkFindStateString(const TkStateMap *mapPtr, int numKey); /* 23 */ EXTERN void TkFocusDeadWindow(TkWindow *winPtr); /* 24 */ EXTERN int TkFocusFilterEvent(TkWindow *winPtr, XEvent *eventPtr); /* 25 */ |
︙ | ︙ | |||
163 164 165 166 167 168 169 | /* 44 */ EXTERN void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 45 */ EXTERN void TkInstallFrameMenu(Tk_Window tkwin); /* 46 */ | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /* 44 */ EXTERN void TkInOutEvents(XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 45 */ EXTERN void TkInstallFrameMenu(Tk_Window tkwin); /* 46 */ EXTERN const char * TkKeysymToString(KeySym keysym); /* 47 */ EXTERN int TkLineToArea(double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 48 */ EXTERN double TkLineToPoint(double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 49 */ |
︙ | ︙ | |||
320 321 322 323 324 325 326 | /* 107 */ EXTERN TkMainInfo * TkGetMainInfoList(void); /* 108 */ EXTERN int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 109 */ | | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | /* 107 */ EXTERN TkMainInfo * TkGetMainInfoList(void); /* 108 */ EXTERN int TkGetWindowFromObj(Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 109 */ EXTERN const char * TkpGetString(TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 110 */ EXTERN void TkpGetSubFonts(Tcl_Interp *interp, Tk_Font tkfont); /* 111 */ EXTERN Tcl_Obj * TkpGetSystemDefault(Tk_Window tkwin, const char *dbName, const char *className); /* 112 */ |
︙ | ︙ | |||
484 485 486 487 488 489 490 | int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 169 */ EXTERN int TkStateParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 170 */ | | | | | | | | 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 169 */ EXTERN int TkStateParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 170 */ EXTERN const char * TkStatePrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 171 */ EXTERN int TkCanvasDashParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 172 */ EXTERN const char * TkCanvasDashPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 173 */ EXTERN int TkOffsetParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 174 */ EXTERN const char * TkOffsetPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 175 */ EXTERN int TkPixelParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 176 */ EXTERN const char * TkPixelPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 177 */ EXTERN int TkOrientParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 178 */ EXTERN const char * TkOrientPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 179 */ EXTERN int TkSmoothParseProc(ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 180 */ EXTERN const char * TkSmoothPrintProc(ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 181 */ EXTERN void TkDrawAngledTextLayout(Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); |
︙ | ︙ | |||
546 547 548 549 550 551 552 553 554 555 556 557 558 559 | int x, int y, int width, int height, double angle); /* 184 */ EXTERN void TkDrawAngledChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); typedef struct TkIntStubs { int magic; void *hooks; TkWindow * (*tkAllocWindow) (TkDisplay *dispPtr, int screenNum, TkWindow *parentPtr); /* 0 */ void (*tkBezierPoints) (double control[], int numSteps, double *coordPtr); /* 1 */ | > > > > | 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | int x, int y, int width, int height, double angle); /* 184 */ EXTERN void TkDrawAngledChars(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 185 */ EXTERN int TkDebugPhotoStringMatchDef(Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); typedef struct TkIntStubs { int magic; void *hooks; TkWindow * (*tkAllocWindow) (TkDisplay *dispPtr, int screenNum, TkWindow *parentPtr); /* 0 */ void (*tkBezierPoints) (double control[], int numSteps, double *coordPtr); /* 1 */ |
︙ | ︙ | |||
573 574 575 576 577 578 579 | Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */ void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */ void (*tkDoConfigureNotify) (TkWindow *winPtr); /* 17 */ void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */ void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */ void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */ int (*tkFindStateNum) (Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 21 */ | | | 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 | Time (*tkCurrentTime) (TkDisplay *dispPtr); /* 15 */ void (*tkDeleteAllImages) (TkMainInfo *mainPtr); /* 16 */ void (*tkDoConfigureNotify) (TkWindow *winPtr); /* 17 */ void (*tkDrawInsetFocusHighlight) (Tk_Window tkwin, GC gc, int width, Drawable drawable, int padding); /* 18 */ void (*tkEventDeadWindow) (TkWindow *winPtr); /* 19 */ void (*tkFillPolygon) (Tk_Canvas canvas, double *coordPtr, int numPoints, Display *display, Drawable drawable, GC gc, GC outlineGC); /* 20 */ int (*tkFindStateNum) (Tcl_Interp *interp, const char *option, const TkStateMap *mapPtr, const char *strKey); /* 21 */ const char * (*tkFindStateString) (const TkStateMap *mapPtr, int numKey); /* 22 */ void (*tkFocusDeadWindow) (TkWindow *winPtr); /* 23 */ int (*tkFocusFilterEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 24 */ TkWindow * (*tkFocusKeyEvent) (TkWindow *winPtr, XEvent *eventPtr); /* 25 */ void (*tkFontPkgInit) (TkMainInfo *mainPtr); /* 26 */ void (*tkFontPkgFree) (TkMainInfo *mainPtr); /* 27 */ void (*tkFreeBindingTags) (TkWindow *winPtr); /* 28 */ void (*tkpFreeCursor) (TkCursor *cursorPtr); /* 29 */ |
︙ | ︙ | |||
597 598 599 600 601 602 603 | void (*tkGetPointerCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 39 */ void (*tkGetServerInfo) (Tcl_Interp *interp, Tk_Window tkwin); /* 40 */ void (*tkGrabDeadWindow) (TkWindow *winPtr); /* 41 */ int (*tkGrabState) (TkWindow *winPtr); /* 42 */ void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */ void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */ void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */ | | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 | void (*tkGetPointerCoords) (Tk_Window tkwin, int *xPtr, int *yPtr); /* 39 */ void (*tkGetServerInfo) (Tcl_Interp *interp, Tk_Window tkwin); /* 40 */ void (*tkGrabDeadWindow) (TkWindow *winPtr); /* 41 */ int (*tkGrabState) (TkWindow *winPtr); /* 42 */ void (*tkIncludePoint) (Tk_Item *itemPtr, double *pointPtr); /* 43 */ void (*tkInOutEvents) (XEvent *eventPtr, TkWindow *sourcePtr, TkWindow *destPtr, int leaveType, int enterType, Tcl_QueuePosition position); /* 44 */ void (*tkInstallFrameMenu) (Tk_Window tkwin); /* 45 */ const char * (*tkKeysymToString) (KeySym keysym); /* 46 */ int (*tkLineToArea) (double end1Ptr[], double end2Ptr[], double rectPtr[]); /* 47 */ double (*tkLineToPoint) (double end1Ptr[], double end2Ptr[], double pointPtr[]); /* 48 */ int (*tkMakeBezierCurve) (Tk_Canvas canvas, double *pointPtr, int numPoints, int numSteps, XPoint xPoints[], double dblPoints[]); /* 49 */ void (*tkMakeBezierPostscript) (Tcl_Interp *interp, Tk_Canvas canvas, double *pointPtr, int numPoints); /* 50 */ void (*tkOptionClassChanged) (TkWindow *winPtr); /* 51 */ void (*tkOptionDeadWindow) (TkWindow *winPtr); /* 52 */ int (*tkOvalToArea) (double *ovalPtr, double *rectPtr); /* 53 */ |
︙ | ︙ | |||
660 661 662 663 664 665 666 | Tcl_Obj * (*tkDebugConfig) (Tcl_Interp *interp, Tk_OptionTable table); /* 102 */ Tcl_Obj * (*tkDebugFont) (Tk_Window tkwin, const char *name); /* 103 */ int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, const TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */ Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */ TkDisplay * (*tkGetDisplayList) (void); /* 106 */ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | Tcl_Obj * (*tkDebugConfig) (Tcl_Interp *interp, Tk_OptionTable table); /* 102 */ Tcl_Obj * (*tkDebugFont) (Tk_Window tkwin, const char *name); /* 103 */ int (*tkFindStateNumObj) (Tcl_Interp *interp, Tcl_Obj *optionPtr, const TkStateMap *mapPtr, Tcl_Obj *keyPtr); /* 104 */ Tcl_HashTable * (*tkGetBitmapPredefTable) (void); /* 105 */ TkDisplay * (*tkGetDisplayList) (void); /* 106 */ TkMainInfo * (*tkGetMainInfoList) (void); /* 107 */ int (*tkGetWindowFromObj) (Tcl_Interp *interp, Tk_Window tkwin, Tcl_Obj *objPtr, Tk_Window *windowPtr); /* 108 */ const char * (*tkpGetString) (TkWindow *winPtr, XEvent *eventPtr, Tcl_DString *dsPtr); /* 109 */ void (*tkpGetSubFonts) (Tcl_Interp *interp, Tk_Font tkfont); /* 110 */ Tcl_Obj * (*tkpGetSystemDefault) (Tk_Window tkwin, const char *dbName, const char *className); /* 111 */ void (*tkpMenuThreadInit) (void); /* 112 */ void (*tkClipBox) (TkRegion rgn, XRectangle *rect_return); /* 113 */ TkRegion (*tkCreateRegion) (void); /* 114 */ void (*tkDestroyRegion) (TkRegion rgn); /* 115 */ void (*tkIntersectRegion) (TkRegion sra, TkRegion srcb, TkRegion dr_return); /* 116 */ |
︙ | ︙ | |||
748 749 750 751 752 753 754 | int (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */ struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */ int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 165 */ void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */ int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */ void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */ int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 169 */ | | | | | | | > | 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | int (*tkTextPrintIndex) (const struct TkText *textPtr, const struct TkTextIndex *indexPtr, char *string); /* 163 */ struct TkTextSegment * (*tkTextSetMark) (struct TkText *textPtr, const char *name, struct TkTextIndex *indexPtr); /* 164 */ int (*tkTextXviewCmd) (struct TkText *textPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); /* 165 */ void (*tkTextChanged) (struct TkSharedText *sharedTextPtr, struct TkText *textPtr, const struct TkTextIndex *index1Ptr, const struct TkTextIndex *index2Ptr); /* 166 */ int (*tkBTreeNumLines) (TkTextBTree tree, const struct TkText *textPtr); /* 167 */ void (*tkTextInsertDisplayProc) (struct TkText *textPtr, struct TkTextDispChunk *chunkPtr, int x, int y, int height, int baseline, Display *display, Drawable dst, int screenY); /* 168 */ int (*tkStateParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 169 */ const char * (*tkStatePrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 170 */ int (*tkCanvasDashParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 171 */ const char * (*tkCanvasDashPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 172 */ int (*tkOffsetParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 173 */ const char * (*tkOffsetPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 174 */ int (*tkPixelParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 175 */ const char * (*tkPixelPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 176 */ int (*tkOrientParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 177 */ const char * (*tkOrientPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 178 */ int (*tkSmoothParseProc) (ClientData clientData, Tcl_Interp *interp, Tk_Window tkwin, const char *value, char *widgRec, int offset); /* 179 */ const char * (*tkSmoothPrintProc) (ClientData clientData, Tk_Window tkwin, char *widgRec, int offset, Tcl_FreeProc **freeProcPtr); /* 180 */ void (*tkDrawAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int firstChar, int lastChar); /* 181 */ void (*tkUnderlineAngledTextLayout) (Display *display, Drawable drawable, GC gc, Tk_TextLayout layout, int x, int y, double angle, int underline); /* 182 */ int (*tkIntersectAngledTextLayout) (Tk_TextLayout layout, int x, int y, int width, int height, double angle); /* 183 */ void (*tkDrawAngledChars) (Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, double x, double y, double angle); /* 184 */ int (*tkDebugPhotoStringMatchDef) (Tcl_Interp *inter, Tcl_Obj *data, Tcl_Obj *formatString, int *widthPtr, int *heightPtr); /* 185 */ } TkIntStubs; extern const TkIntStubs *tkIntStubsPtr; #ifdef __cplusplus } #endif |
︙ | ︙ | |||
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 | (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 */ #define TkUnderlineAngledTextLayout \ (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */ #define TkIntersectAngledTextLayout \ (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT | > > | 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 | (tkIntStubsPtr->tkDrawAngledTextLayout) /* 181 */ #define TkUnderlineAngledTextLayout \ (tkIntStubsPtr->tkUnderlineAngledTextLayout) /* 182 */ #define TkIntersectAngledTextLayout \ (tkIntStubsPtr->tkIntersectAngledTextLayout) /* 183 */ #define TkDrawAngledChars \ (tkIntStubsPtr->tkDrawAngledChars) /* 184 */ #define TkDebugPhotoStringMatchDef \ (tkIntStubsPtr->tkDebugPhotoStringMatchDef) /* 185 */ #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT |
︙ | ︙ |
Changes to generic/tkIntPlatDecls.h.
︙ | ︙ | |||
239 240 241 242 243 244 245 | EXTERN void TkMacOSXPreprocessMenu(void); /* 46 */ EXTERN int TkpIsWindowFloating(void *window); /* 47 */ EXTERN Tk_Window TkMacOSXGetCapture(void); /* Slot 48 is reserved */ /* 49 */ | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | EXTERN void TkMacOSXPreprocessMenu(void); /* 46 */ EXTERN int TkpIsWindowFloating(void *window); /* 47 */ EXTERN Tk_Window TkMacOSXGetCapture(void); /* Slot 48 is reserved */ /* 49 */ EXTERN Tk_Window TkGetTransientMaster(TkWindow *winPtr); /* 50 */ EXTERN int TkGenerateButtonEvent(int x, int y, Window window, unsigned int state); /* 51 */ EXTERN void TkGenWMDestroyEvent(Tk_Window tkwin); /* 52 */ EXTERN void TkMacOSXSetDrawingEnabled(TkWindow *winPtr, int flag); |
︙ | ︙ | |||
388 389 390 391 392 393 394 | Tk_Window (*tk_TopCoordsToWindow) (Tk_Window tkwin, int rootX, int rootY, int *newX, int *newY); /* 42 */ MacDrawable * (*tkMacOSXContainerId) (TkWindow *winPtr); /* 43 */ MacDrawable * (*tkMacOSXGetHostToplevel) (TkWindow *winPtr); /* 44 */ void (*tkMacOSXPreprocessMenu) (void); /* 45 */ int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkMacOSXGetCapture) (void); /* 47 */ void (*reserved48)(void); | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | Tk_Window (*tk_TopCoordsToWindow) (Tk_Window tkwin, int rootX, int rootY, int *newX, int *newY); /* 42 */ MacDrawable * (*tkMacOSXContainerId) (TkWindow *winPtr); /* 43 */ MacDrawable * (*tkMacOSXGetHostToplevel) (TkWindow *winPtr); /* 44 */ void (*tkMacOSXPreprocessMenu) (void); /* 45 */ int (*tkpIsWindowFloating) (void *window); /* 46 */ Tk_Window (*tkMacOSXGetCapture) (void); /* 47 */ void (*reserved48)(void); Tk_Window (*tkGetTransientMaster) (TkWindow *winPtr); /* 49 */ int (*tkGenerateButtonEvent) (int x, int y, Window window, unsigned int state); /* 50 */ void (*tkGenWMDestroyEvent) (Tk_Window tkwin); /* 51 */ void (*tkMacOSXSetDrawingEnabled) (TkWindow *winPtr, int flag); /* 52 */ unsigned long (*tkpGetMS) (void); /* 53 */ void * (*tkMacOSXDrawable) (Drawable drawable); /* 54 */ int (*tkpScanWindowId) (Tcl_Interp *interp, const char *string, Window *idPtr); /* 55 */ #endif /* AQUA */ |
︙ | ︙ | |||
660 661 662 663 664 665 666 667 | #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKINTPLATDECLS */ | > > > | 660 661 662 663 664 665 666 667 668 669 670 | #endif /* defined(USE_TK_STUBS) */ /* !END!: Do not edit above this line. */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #undef TkWinGetPlatformId #define TkWinGetPlatformId() (2) /* VER_PLATFORM_WIN32_NT */ #endif /* _TKINTPLATDECLS */ |
Changes to generic/tkIntXlibDecls.h.
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | * script. Any modifications to the function declarations below should be made * in the generic/tkInt.decls script. */ #ifndef _TCL # include <tcl.h> #endif /* Some (older) versions of X11/Xutil.h have a wrong signature of those two functions, so move them out of the way temporarly. */ #define XOffsetRegion _XOffsetRegion #define XUnionRegion _XUnionRegion #include "X11/Xutil.h" #undef XOffsetRegion #undef XUnionRegion #ifdef BUILD_tk | > > > > | | > > > > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * script. Any modifications to the function declarations below should be made * in the generic/tkInt.decls script. */ #ifndef _TCL # include <tcl.h> #endif #ifndef EXTERN # define EXTERN extern TCL_STORAGE_CLASS #endif /* Some (older) versions of X11/Xutil.h have a wrong signature of those two functions, so move them out of the way temporarly. */ #define XOffsetRegion _XOffsetRegion #define XUnionRegion _XUnionRegion #include "X11/Xutil.h" #undef XOffsetRegion #undef XUnionRegion #ifdef BUILD_tk # undef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLEXPORT #else # ifndef TCL_STORAGE_CLASS # define TCL_STORAGE_CLASS DLLIMPORT # endif #endif typedef int (*XAfterFunction) ( /* WARNING, this type not in Xlib spec */ Display* /* display */ ); /* !BEGIN!: Do not edit below this line. */ |
︙ | ︙ | |||
409 410 411 412 413 414 415 416 417 418 419 420 421 422 | /* 136 */ EXTERN int XReparentWindow(Display *d, Window w, Window p, int x, int y); /* 137 */ EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ EXTERN int XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 1 */ EXTERN XModifierKeymap * XGetModifierMapping(Display *d); | > > > > | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | /* 136 */ EXTERN int XReparentWindow(Display *d, Window w, Window p, int x, int y); /* 137 */ EXTERN int XPutImage(Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 138 */ EXTERN Region XPolygonRegion(XPoint *pts, int n, int rule); /* 139 */ EXTERN int XPointInRegion(Region rgn, int x, int y); #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ /* 0 */ EXTERN int XSetDashes(Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 1 */ EXTERN XModifierKeymap * XGetModifierMapping(Display *d); |
︙ | ︙ | |||
818 819 820 821 822 823 824 825 826 827 828 829 830 831 | int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */ | > > | 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | int (*xDrawArcs) (Display *d, Drawable dr, GC gc, XArc *a, int n); /* 131 */ int (*xDrawRectangles) (Display *d, Drawable dr, GC gc, XRectangle *r, int n); /* 132 */ int (*xDrawSegments) (Display *d, Drawable dr, GC gc, XSegment *s, int n); /* 133 */ int (*xDrawPoint) (Display *d, Drawable dr, GC gc, int x, int y); /* 134 */ int (*xDrawPoints) (Display *d, Drawable dr, GC gc, XPoint *p, int n, int m); /* 135 */ int (*xReparentWindow) (Display *d, Window w, Window p, int x, int y); /* 136 */ int (*xPutImage) (Display *d, Drawable dr, GC gc, XImage *im, int sx, int sy, int dx, int dy, unsigned int w, unsigned int h); /* 137 */ Region (*xPolygonRegion) (XPoint *pts, int n, int rule); /* 138 */ int (*xPointInRegion) (Region rgn, int x, int y); /* 139 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ int (*xSetDashes) (Display *display, GC gc, int dash_offset, _Xconst char *dash_list, int n); /* 0 */ XModifierKeymap * (*xGetModifierMapping) (Display *d); /* 1 */ XImage * (*xCreateImage) (Display *d, Visual *v, unsigned int ui1, int i1, int i2, char *cp, unsigned int ui2, unsigned int ui3, int i3, int i4); /* 2 */ XImage * (*xGetImage) (Display *d, Drawable dr, int i1, int i2, unsigned int ui1, unsigned int ui2, unsigned long ul, int i3); /* 3 */ char * (*xGetAtomName) (Display *d, Atom a); /* 4 */ |
︙ | ︙ | |||
1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 | (tkIntXlibStubsPtr->xDrawPoint) /* 134 */ #define XDrawPoints \ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */ #define XReparentWindow \ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */ #define XPutImage \ (tkIntXlibStubsPtr->xPutImage) /* 137 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define XSetDashes \ (tkIntXlibStubsPtr->xSetDashes) /* 0 */ #define XGetModifierMapping \ (tkIntXlibStubsPtr->xGetModifierMapping) /* 1 */ #define XCreateImage \ | > > > > | 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 | (tkIntXlibStubsPtr->xDrawPoint) /* 134 */ #define XDrawPoints \ (tkIntXlibStubsPtr->xDrawPoints) /* 135 */ #define XReparentWindow \ (tkIntXlibStubsPtr->xReparentWindow) /* 136 */ #define XPutImage \ (tkIntXlibStubsPtr->xPutImage) /* 137 */ #define XPolygonRegion \ (tkIntXlibStubsPtr->xPolygonRegion) /* 138 */ #define XPointInRegion \ (tkIntXlibStubsPtr->xPointInRegion) /* 139 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ #define XSetDashes \ (tkIntXlibStubsPtr->xSetDashes) /* 0 */ #define XGetModifierMapping \ (tkIntXlibStubsPtr->xGetModifierMapping) /* 1 */ #define XCreateImage \ |
︙ | ︙ |
Changes to generic/tkListbox.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1990-1994 The Regents of the University of California. * 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. */ | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Copyright (c) 1990-1994 The Regents of the University of California. * 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. */ #include "tkInt.h" #include "default.h" #ifdef _WIN32 #include "tkWinInt.h" #endif typedef struct { Tk_OptionTable listboxOptionTable; |
︙ | ︙ | |||
235 236 237 238 239 240 241 | /* * The optionSpecs table defines the valid configuration options for the * listbox widget. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | /* * The optionSpecs table defines the valid configuration options for the * listbox widget. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-activestyle", "activeStyle", "ActiveStyle", DEF_LISTBOX_ACTIVE_STYLE, -1, offsetof(Listbox, activeStyle), 0, activeStyleStrings, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_LISTBOX_BG_COLOR, -1, offsetof(Listbox, normalBorder), 0, DEF_LISTBOX_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_LISTBOX_BORDER_WIDTH, -1, offsetof(Listbox, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_LISTBOX_CURSOR, -1, offsetof(Listbox, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_LISTBOX_DISABLED_FG, -1, offsetof(Listbox, dfgColorPtr), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_LISTBOX_EXPORT_SELECTION, -1, offsetof(Listbox, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_LISTBOX_FONT, -1, offsetof(Listbox, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_LISTBOX_FG, -1, offsetof(Listbox, fgColorPtr), 0, 0, 0}, {TK_OPTION_INT, "-height", "height", "Height", DEF_LISTBOX_HEIGHT, -1, offsetof(Listbox, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_LISTBOX_HIGHLIGHT_BG, -1, offsetof(Listbox, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_LISTBOX_HIGHLIGHT, -1, offsetof(Listbox, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_LISTBOX_HIGHLIGHT_WIDTH, -1, offsetof(Listbox, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_LISTBOX_JUSTIFY, -1, offsetof(Listbox, justify), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_LISTBOX_RELIEF, -1, offsetof(Listbox, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_LISTBOX_SELECT_COLOR, -1, offsetof(Listbox, selBorder), 0, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_LISTBOX_SELECT_BD, -1, offsetof(Listbox, selBorderWidth), 0, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_LISTBOX_SELECT_FG_COLOR, -1, offsetof(Listbox, selFgColorPtr), TK_OPTION_NULL_OK, DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_STRING, "-selectmode", "selectMode", "SelectMode", DEF_LISTBOX_SELECT_MODE, -1, offsetof(Listbox, selectMode), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_LISTBOX_SET_GRID, -1, offsetof(Listbox, setGrid), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_LISTBOX_STATE, -1, offsetof(Listbox, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_LISTBOX_TAKE_FOCUS, -1, offsetof(Listbox, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_LISTBOX_WIDTH, -1, offsetof(Listbox, width), 0, 0, 0}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_LISTBOX_SCROLL_COMMAND, -1, offsetof(Listbox, xScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", DEF_LISTBOX_SCROLL_COMMAND, -1, offsetof(Listbox, yScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-listvariable", "listVariable", "Variable", DEF_LISTBOX_LIST_VARIABLE, -1, offsetof(Listbox, listVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * The itemAttrOptionSpecs table defines the valid configuration options for * listbox items. */ static const Tk_OptionSpec itemAttrOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", NULL, -1, offsetof(ItemAttr, border), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", NULL, -1, offsetof(ItemAttr, fgColor), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", NULL, -1, offsetof(ItemAttr, selBorder), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_SELECT_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", NULL, -1, offsetof(ItemAttr, selFgColor), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, DEF_LISTBOX_SELECT_FG_MONO, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * The following tables define the listbox widget commands (and sub-commands) |
︙ | ︙ | |||
563 564 565 566 567 568 569 | Tk_SetClass(listPtr->tkwin, "Listbox"); Tk_SetClassProcs(listPtr->tkwin, &listboxClass, listPtr); Tk_CreateEventHandler(listPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ListboxEventProc, listPtr); Tk_CreateSelHandler(listPtr->tkwin, XA_PRIMARY, XA_STRING, ListboxFetchSelection, listPtr, XA_STRING); | | | 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | Tk_SetClass(listPtr->tkwin, "Listbox"); Tk_SetClassProcs(listPtr->tkwin, &listboxClass, listPtr); Tk_CreateEventHandler(listPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ListboxEventProc, listPtr); Tk_CreateSelHandler(listPtr->tkwin, XA_PRIMARY, XA_STRING, ListboxFetchSelection, listPtr, XA_STRING); if (Tk_InitOptions(interp, listPtr, optionTables->listboxOptionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(listPtr->tkwin); return TCL_ERROR; } if (ConfigureListbox(interp, listPtr, objc-2, objv+2) != TCL_OK) { Tk_DestroyWindow(listPtr->tkwin); |
︙ | ︙ | |||
678 679 680 681 682 683 684 | case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; break; } | | | | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; break; } objPtr = Tk_GetOptionValue(interp, listPtr, listPtr->optionTable, objv[2], listPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; break; } Tcl_SetObjResult(interp, objPtr); result = TCL_OK; break; case COMMAND_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, listPtr, listPtr->optionTable, (objc == 3) ? objv[2] : NULL, listPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; break; } Tcl_SetObjResult(interp, objPtr); |
︙ | ︙ | |||
724 725 726 727 728 729 730 | * the indices in order, adding them to the result if they are * selected. */ objPtr = Tcl_NewObj(); for (i = 0; i < listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) { | | | 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 | * the indices in order, adding them to the result if they are * selected. */ objPtr = Tcl_NewObj(); for (i = 0; i < listPtr->nElements; i++) { if (Tcl_FindHashEntry(listPtr->selection, KEY(i))) { Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(i)); } } Tcl_SetObjResult(interp, objPtr); result = TCL_OK; break; } |
︙ | ︙ | |||
837 838 839 840 841 842 843 | result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 1, &index); if (result != TCL_OK) { break; } | | | 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | result = TCL_ERROR; break; } result = GetListboxIndex(interp, listPtr, objv[2], 1, &index); if (result != TCL_OK) { break; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); result = TCL_OK; break; case COMMAND_INSERT: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index ?element ...?"); result = TCL_ERROR; |
︙ | ︙ | |||
922 923 924 925 926 927 928 | Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL); result = TCL_ERROR; break; } attrPtr = ListboxGetItemAttributes(interp, listPtr, index); if (objc <= 4) { | | | 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 | Tcl_SetErrorCode(interp, "TK", "LISTBOX", "ITEM_INDEX", NULL); result = TCL_ERROR; break; } attrPtr = ListboxGetItemAttributes(interp, listPtr, index); if (objc <= 4) { objPtr = Tk_GetOptionInfo(interp, attrPtr, listPtr->itemAttrOptionTable, (objc == 4) ? objv[3] : NULL, listPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; break; } Tcl_SetObjResult(interp, objPtr); |
︙ | ︙ | |||
952 953 954 955 956 957 958 | } result = Tcl_GetIntFromObj(interp, objv[2], &y); if (result != TCL_OK) { break; } index = NearestListboxElement(listPtr, y); | | | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 | } result = Tcl_GetIntFromObj(interp, objv[2], &y); if (result != TCL_OK) { break; } index = NearestListboxElement(listPtr, y); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); result = TCL_OK; break; } case COMMAND_SCAN: { int x, y, scanCmdIndex; |
︙ | ︙ | |||
1040 1041 1042 1043 1044 1045 1046 | break; case COMMAND_SIZE: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); result = TCL_ERROR; break; } | | | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 | break; case COMMAND_SIZE: if (objc != 2) { Tcl_WrongNumArgs(interp, 2, objv, NULL); result = TCL_ERROR; break; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(listPtr->nElements)); result = TCL_OK; break; case COMMAND_XVIEW: result = ListboxXviewSubCmd(interp, listPtr, objc, objv); break; case COMMAND_YVIEW: result = ListboxYviewSubCmd(interp, listPtr, objc, objv); |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 | /* * Only allow bbox requests for indices that are visible. */ if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) { Tcl_Obj *el, *results[4]; const char *stringRep; | | > | | | | | | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | /* * Only allow bbox requests for indices that are visible. */ if ((listPtr->topIndex <= index) && (index < lastVisibleIndex)) { Tcl_Obj *el, *results[4]; const char *stringRep; int pixelWidth, x, y, result; TkSizeT stringLen; Tk_FontMetrics fm; /* * Compute the pixel width of the requested element. */ result = Tcl_ListObjIndex(interp, listPtr->listObj, index, &el); if (result != TCL_OK) { return result; } stringRep = TkGetStringFromObj(el, &stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); if (listPtr->justify == TK_JUSTIFY_LEFT) { x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset; } else if (listPtr->justify == TK_JUSTIFY_RIGHT) { x = Tk_Width(tkwin) - (listPtr->inset + listPtr->selBorderWidth) - pixelWidth - listPtr->xOffset + GetMaxOffset(listPtr); } else { x = (Tk_Width(tkwin) - pixelWidth)/2 - listPtr->xOffset + GetMaxOffset(listPtr)/2; } y = ((index - listPtr->topIndex)*listPtr->lineHeight) + listPtr->inset + listPtr->selBorderWidth; results[0] = Tcl_NewWideIntObj(x); results[1] = Tcl_NewWideIntObj(y); results[2] = Tcl_NewWideIntObj(pixelWidth); results[3] = Tcl_NewWideIntObj(fm.linespace); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1411 1412 1413 1414 1415 1416 1417 | entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, KEY(index), &isNew); if (isNew) { attrs = ckalloc(sizeof(ItemAttr)); attrs->border = NULL; attrs->selBorder = NULL; attrs->fgColor = NULL; attrs->selFgColor = NULL; | | | 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 | entry = Tcl_CreateHashEntry(listPtr->itemAttrTable, KEY(index), &isNew); if (isNew) { attrs = ckalloc(sizeof(ItemAttr)); attrs->border = NULL; attrs->selBorder = NULL; attrs->fgColor = NULL; attrs->selFgColor = NULL; Tk_InitOptions(interp, attrs, listPtr->itemAttrOptionTable, listPtr->tkwin); Tcl_SetHashValue(entry, attrs); } else { attrs = Tcl_GetHashValue(entry); } return attrs; } |
︙ | ︙ | |||
1574 1575 1576 1577 1578 1579 1580 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ | | | 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ if (Tk_SetOptions(interp, listPtr, listPtr->optionTable, objc, objv, listPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; } } else { /* * Second pass: restore options to old values. |
︙ | ︙ | |||
1720 1721 1722 1723 1724 1725 1726 | ItemAttr *attrs, /* Information about the item to configure */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int index) /* Index of the listbox item being configure */ { Tk_SavedOptions savedOptions; | | | 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | ItemAttr *attrs, /* Information about the item to configure */ int objc, /* Number of valid entries in argv. */ Tcl_Obj *const objv[], /* Arguments. */ int index) /* Index of the listbox item being configure */ { Tk_SavedOptions savedOptions; if (Tk_SetOptions(interp, attrs, listPtr->itemAttrOptionTable, objc, objv, listPtr->tkwin, &savedOptions, NULL) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } Tk_FreeSavedOptions(&savedOptions); |
︙ | ︙ | |||
1836 1837 1838 1839 1840 1841 1842 | static void DisplayListbox( ClientData clientData) /* Information about window. */ { register Listbox *listPtr = clientData; register Tk_Window tkwin = listPtr->tkwin; GC gc; | | > | 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 | static void DisplayListbox( ClientData clientData) /* Information about window. */ { register Listbox *listPtr = clientData; register Tk_Window tkwin = listPtr->tkwin; GC gc; int i, limit, x, y, prevSelected, freeGC; TkSizeT stringLen; Tk_FontMetrics fm; Tcl_Obj *curElement; Tcl_HashEntry *entry; const char *stringRep; ItemAttr *attrs; Tk_3DBorder selectedBg; XGCValues gcValues; |
︙ | ︙ | |||
2070 2071 2072 2073 2074 2075 2076 | } /* * Draw the actual text of this item. */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); | | | 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 | } /* * Draw the actual text of this item. */ Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); stringRep = TkGetStringFromObj(curElement, &stringLen); textWidth = Tk_TextWidth(listPtr->tkfont, stringRep, stringLen); Tk_GetFontMetrics(listPtr->tkfont, &fm); y += fm.ascent + listPtr->selBorderWidth; if (listPtr->justify == TK_JUSTIFY_LEFT) { x = (listPtr->inset + listPtr->selBorderWidth) - listPtr->xOffset; |
︙ | ︙ | |||
2232 2233 2234 2235 2236 2237 2238 | * longer be up-to-date and must be * recomputed. If fontChanged is 1 then this * must be 1. */ int updateGrid) /* Non-zero means call Tk_SetGrid or * Tk_UnsetGrid to update gridding for the * window. */ { | | > | | 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 | * longer be up-to-date and must be * recomputed. If fontChanged is 1 then this * must be 1. */ int updateGrid) /* Non-zero means call Tk_SetGrid or * Tk_UnsetGrid to update gridding for the * window. */ { int width, height, pixelWidth, pixelHeight, i, result; TkSizeT textLength; Tk_FontMetrics fm; Tcl_Obj *element; const char *text; if (fontChanged || maxIsStale) { listPtr->xScrollUnit = Tk_TextWidth(listPtr->tkfont, "0", 1); if (listPtr->xScrollUnit == 0) { listPtr->xScrollUnit = 1; } listPtr->maxWidth = 0; for (i = 0; i < listPtr->nElements; i++) { /* * Compute the pixel width of the current element. */ result = Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); if (result != TCL_OK) { continue; } text = TkGetStringFromObj(element, &textLength); Tk_GetFontMetrics(listPtr->tkfont, &fm); pixelWidth = Tk_TextWidth(listPtr->tkfont, text, textLength); if (pixelWidth > listPtr->maxWidth) { listPtr->maxWidth = pixelWidth; } } } |
︙ | ︙ | |||
2319 2320 2321 2322 2323 2324 2325 | ListboxInsertSubCmd( register Listbox *listPtr, /* Listbox that is to get the new elements. */ int index, /* Add the new elements before this * element. */ int objc, /* Number of new elements to add. */ Tcl_Obj *const objv[]) /* New elements (one per entry). */ { | | > | | 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 | ListboxInsertSubCmd( register Listbox *listPtr, /* Listbox that is to get the new elements. */ int index, /* Add the new elements before this * element. */ int objc, /* Number of new elements to add. */ Tcl_Obj *const objv[]) /* New elements (one per entry). */ { int i, oldMaxWidth, pixelWidth, result; TkSizeT length; Tcl_Obj *newListObj; const char *stringRep; oldMaxWidth = listPtr->maxWidth; for (i = 0; i < objc; i++) { /* * Check if any of the new elements are wider than the current widest; * if so, update our notion of "widest." */ stringRep = TkGetStringFromObj(objv[i], &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth > listPtr->maxWidth) { listPtr->maxWidth = pixelWidth; } } /* |
︙ | ︙ | |||
2433 2434 2435 2436 2437 2438 2439 | static int ListboxDeleteSubCmd( register Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { | | > | 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 | static int ListboxDeleteSubCmd( register Listbox *listPtr, /* Listbox widget to modify. */ int first, /* Index of first element to delete. */ int last) /* Index of last element to delete. */ { int count, i, widthChanged, result, pixelWidth; TkSizeT length; Tcl_Obj *newListObj, *element; const char *stringRep; Tcl_HashEntry *entry; /* * Adjust the range to fit within the existing elements of the listbox, * and make sure there's something to delete. |
︙ | ︙ | |||
2488 2489 2490 2491 2492 2493 2494 | * Check width of the element. We only have to check if widthChanged * has not already been set to 1, because we only need one maxWidth * element to disappear for us to have to recompute the width. */ if (widthChanged == 0) { Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); | | | 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 | * Check width of the element. We only have to check if widthChanged * has not already been set to 1, because we only need one maxWidth * element to disappear for us to have to recompute the width. */ if (widthChanged == 0) { Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &element); stringRep = TkGetStringFromObj(element, &length); pixelWidth = Tk_TextWidth(listPtr->tkfont, stringRep, length); if (pixelWidth == listPtr->maxWidth) { widthChanged = 1; } } } |
︙ | ︙ | |||
3118 3119 3120 3121 3122 3123 3124 | char *buffer, /* Location in which to place selection. */ int maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { register Listbox *listPtr = clientData; Tcl_DString selection; | | > | 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 | char *buffer, /* Location in which to place selection. */ int maxBytes) /* Maximum number of bytes to place at buffer, * not including terminating NULL * character. */ { register Listbox *listPtr = clientData; Tcl_DString selection; int count, needNewline, i; TkSizeT length, stringLen; Tcl_Obj *curElement; const char *stringRep; Tcl_HashEntry *entry; if ((!listPtr->exportSelection) || Tcl_IsSafe(listPtr->interp)) { return -1; } |
︙ | ︙ | |||
3141 3142 3143 3144 3145 3146 3147 | entry = Tcl_FindHashEntry(listPtr->selection, KEY(i)); if (entry != NULL) { if (needNewline) { Tcl_DStringAppend(&selection, "\n", 1); } Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); | | | < > | | 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 | entry = Tcl_FindHashEntry(listPtr->selection, KEY(i)); if (entry != NULL) { if (needNewline) { Tcl_DStringAppend(&selection, "\n", 1); } Tcl_ListObjIndex(listPtr->interp, listPtr->listObj, i, &curElement); stringRep = TkGetStringFromObj(curElement, &stringLen); Tcl_DStringAppend(&selection, stringRep, stringLen); needNewline = 1; } } length = Tcl_DStringLength(&selection); if (length == 0) { return -1; } /* * Copy the requested portion of the selection to the buffer. */ if (length <= (TkSizeT)offset) { count = 0; } else { count = length - offset; if (count > maxBytes) { count = maxBytes; } memcpy(buffer, Tcl_DStringValue(&selection) + offset, count); } buffer[count] = '\0'; Tcl_DStringFree(&selection); return count; } /* |
︙ | ︙ | |||
3427 3428 3429 3430 3431 3432 3433 | *---------------------------------------------------------------------- */ static char * ListboxListVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ | | | < < < < < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > | 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 | *---------------------------------------------------------------------- */ static char * ListboxListVarProc( ClientData clientData, /* Information about button. */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* Not used. */ const char *name2, /* Not used. */ int flags) /* Information about what happened. */ { Listbox *listPtr = clientData; Tcl_Obj *oldListObj, *varListObj; int oldLength, i; Tcl_HashEntry *entry; /* * Bwah hahahaha! Puny mortal, you can't unset a -listvar'd variable! */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && listPtr->listVarName) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, listPtr->listVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ListboxListVarProc, probe); if (probe == (ClientData)listPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * listVarName, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_SetVar2Ex(interp, listPtr->listVarName, NULL, listPtr->listObj, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, listPtr->listVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ListboxListVarProc, clientData); return NULL; } |
︙ | ︙ |
Changes to generic/tkMacWinMenu.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenu.h" | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkMenu.h" typedef struct { int postCommandGeneration; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; static int PreprocessMenu(TkMenu *menuPtr); /* |
︙ | ︙ | |||
62 63 64 65 66 67 68 | * Now, we go through structure and process all of the commands. Since the * structure is changing, we stop after we do one command, and start over. * When we get through without doing any, we are done. */ do { finished = 1; | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | * Now, we go through structure and process all of the commands. Since the * structure is changing, we stop after we do one command, and start over. * When we get through without doing any, we are done. */ do { finished = 1; for (index = 0; index < (int)menuPtr->numEntries; index++) { register TkMenuEntry *entryPtr = menuPtr->entries[index]; if ((entryPtr->type == CASCADE_ENTRY) && (entryPtr->namePtr != NULL) && (entryPtr->childMenuRefPtr != NULL) && (entryPtr->childMenuRefPtr->menuPtr != NULL)) { TkMenu *cascadeMenuPtr = entryPtr->childMenuRefPtr->menuPtr; |
︙ | ︙ |
Changes to generic/tkMain.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | # else # define UNICODE # define _UNICODE # endif #endif #include "tkInt.h" | < < < < < < < < | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | # else # define UNICODE # define _UNICODE # endif #endif #include "tkInt.h" extern int TkCygwinMainEx(int, char **, Tcl_AppInitProc *, Tcl_Interp *); /* * The default prompt used when the user has not overridden it. */ |
︙ | ︙ | |||
75 76 77 78 79 80 81 | #endif #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" #endif /* | | | | | > | | | > | | > > > > > > > | > | | | < | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #endif #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" #endif /* * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise * NewNativeObj is needed (which provides proper conversion from native * encoding to UTF-8). */ static inline Tcl_Obj * NewNativeObj( TCHAR *string, int length) { Tcl_Obj *obj; Tcl_DString ds; #ifdef UNICODE if (length > 0) { length *= sizeof(WCHAR); } Tcl_WinTCharToUtf(string, length, &ds); #else Tcl_ExternalToUtfDString(NULL, (char *) string, length, &ds); #endif obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); return obj; } /* * Declarations for various library functions and variables (don't want to * include tkInt.h or tkPort.h here, because people might copy this file out * of the Tk source directory to make their own modified versions). Note: do * not declare "exit" here even though a declaration is really needed, because * it will conflict with a declaration elsewhere on some systems. |
︙ | ︙ | |||
192 193 194 195 196 197 198 | Tcl_Channel chan; InteractiveState is; /* * Ensure that we are getting a compatible version of Tcl. */ | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | Tcl_Channel chan; InteractiveState is; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { if (Tcl_InitStubs(interp, "8.1", 0) == NULL) { abort(); } else { Tcl_Panic("%s", Tcl_GetString(Tcl_GetObjResult(interp))); } } |
︙ | ︙ | |||
231 232 233 234 235 236 237 | Tcl_InitMemory(interp); is.interp = interp; is.gotPartial = 0; Tcl_Preserve(interp); | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | Tcl_InitMemory(interp); is.interp = interp; is.gotPartial = 0; Tcl_Preserve(interp); #if defined(_WIN32) #if !defined(STATIC_BUILD) /* If compiled for Win32 but running on Cygwin, don't use console */ if (!tclStubsPtr->reserved9) #endif Tk_InitConsoleChannels(interp); #endif |
︙ | ︙ | |||
293 294 295 296 297 298 299 | } else { appName = path; } Tcl_SetVar2Ex(interp, "argv0", NULL, appName, TCL_GLOBAL_ONLY); argc--; argv++; | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | } else { appName = path; } Tcl_SetVar2Ex(interp, "argv0", NULL, appName, TCL_GLOBAL_ONLY); argc--; argv++; Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(argc), TCL_GLOBAL_ONLY); argvPtr = Tcl_NewListObj(0, NULL); while (argc--) { Tcl_ListObjAppendElement(NULL, argvPtr, NewNativeObj(*argv++, -1)); } Tcl_SetVar2Ex(interp, "argv", NULL, argvPtr, TCL_GLOBAL_ONLY); |
︙ | ︙ | |||
320 321 322 323 324 325 326 | if (!is.tty) { struct stat st; nullStdin = fstat(0, &st) || (S_ISCHR(st.st_mode) && !st.st_blocks); } #endif Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | if (!is.tty) { struct stat st; nullStdin = fstat(0, &st) || (S_ISCHR(st.st_mode) && !st.st_blocks); } #endif Tcl_SetVar2Ex(interp, "tcl_interactive", NULL, Tcl_NewWideIntObj(!path && (is.tty || nullStdin)), TCL_GLOBAL_ONLY); /* * Invoke application-specific initialization. */ if (appInitProc(interp) != TCL_OK) { TkpDisplayWarning(Tcl_GetString(Tcl_GetObjResult(interp)), |
︙ | ︙ | |||
420 421 422 423 424 425 426 | /* ARGSUSED */ static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ int mask) /* Not used. */ { char *cmd; | | > | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | /* ARGSUSED */ static void StdinProc( ClientData clientData, /* The state of interactive cmd line */ int mask) /* Not used. */ { char *cmd; int code; size_t count; InteractiveState *isPtr = clientData; Tcl_Channel chan = isPtr->input; Tcl_Interp *interp = isPtr->interp; count = Tcl_Gets(chan, &isPtr->line); if (count == (size_t)-1 && !isPtr->gotPartial) { if (isPtr->tty) { Tcl_Exit(0); } else { Tcl_DeleteChannelHandler(chan, StdinProc, isPtr); } return; } |
︙ | ︙ |
Changes to generic/tkMenu.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 | * the Macintosh, the platform specific menu handle for cascades attached to a * menu bar must have a title that matches the label for the cascade menu. * * To handle all of the constraints, Tk menubars and tearoff menus are * implemented using menu clones. Menu clones are full menus in their own * right; they have a Tk window and pathname associated with them; they have a * TkMenu structure and array of entries. However, they are linked with the | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | * the Macintosh, the platform specific menu handle for cascades attached to a * menu bar must have a title that matches the label for the cascade menu. * * To handle all of the constraints, Tk menubars and tearoff menus are * implemented using menu clones. Menu clones are full menus in their own * right; they have a Tk window and pathname associated with them; they have a * TkMenu structure and array of entries. However, they are linked with the * original menu that they were cloned from. They reflect the attributes of the * original, or "master", menu. So if an item is added to a menu, and that * menu has clones, then the item must be added to all of its clones also. * Menus are cloned when a menu is torn-off or when a menu is assigned as a * menubar using the "-menu" option of the toplevel's pathname configure * subcommand. When a clone is destroyed, only the clone is destroyed, but * when the master menu is destroyed, all clones are also destroyed. This * allows the developer to just deal with one set of menus when creating and |
︙ | ︙ | |||
73 74 75 76 77 78 79 | #endif #include "tkInt.h" #include "tkMenu.h" #define MENU_HASH_KEY "tkMenus" | | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #endif #include "tkInt.h" #include "tkMenu.h" #define MENU_HASH_KEY "tkMenus" typedef struct { int menusInitialized; /* Flag indicates whether thread-specific * elements of the Windows Menu module have * been initialized. */ Tk_OptionTable menuOptionTable; /* The option table for menus. */ Tk_OptionTable entryOptionTables[6]; /* The tables for menu entries. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * The following flag indicates whether the process-wide state for the Menu * module has been initialized. The Mutex protects access to that flag. */ static int menusInitialized; TCL_DECLARE_MUTEX(menuMutex) /* * Configuration specs for individual menu entries. If this changes, be sure |
︙ | ︙ | |||
114 115 116 117 118 119 120 | static const char *const compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", NULL }; static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", NULL, NULL, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | static const char *const compoundStrings[] = { "bottom", "center", "left", "none", "right", "top", NULL }; static const Tk_OptionSpec tkBasicMenuEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", NULL, NULL, DEF_MENU_ENTRY_ACTIVE_BG, offsetof(TkMenuEntry, activeBorderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", NULL, NULL, DEF_MENU_ENTRY_ACTIVE_FG, offsetof(TkMenuEntry, activeFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-accelerator", NULL, NULL, DEF_MENU_ENTRY_ACCELERATOR, offsetof(TkMenuEntry, accelPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BITMAP, "-bitmap", NULL, NULL, DEF_MENU_ENTRY_BITMAP, offsetof(TkMenuEntry, bitmapPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-columnbreak", NULL, NULL, DEF_MENU_ENTRY_COLUMN_BREAK, -1, offsetof(TkMenuEntry, columnBreak), 0, NULL, 0}, {TK_OPTION_STRING, "-command", NULL, NULL, DEF_MENU_ENTRY_COMMAND, offsetof(TkMenuEntry, commandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_MENU_ENTRY_COMPOUND, -1, offsetof(TkMenuEntry, compound), 0, (ClientData) compoundStrings, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, DEF_MENU_ENTRY_FONT, offsetof(TkMenuEntry, fontPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, DEF_MENU_ENTRY_FG, offsetof(TkMenuEntry, fgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-hidemargin", NULL, NULL, DEF_MENU_ENTRY_HIDE_MARGIN, -1, offsetof(TkMenuEntry, hideMargin), 0, NULL, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, DEF_MENU_ENTRY_IMAGE, offsetof(TkMenuEntry, imagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-label", NULL, NULL, DEF_MENU_ENTRY_LABEL, offsetof(TkMenuEntry, labelPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, DEF_MENU_ENTRY_STATE, -1, offsetof(TkMenuEntry, state), 0, (ClientData) menuStateStrings, 0}, {TK_OPTION_INT, "-underline", NULL, NULL, DEF_MENU_ENTRY_UNDERLINE, -1, offsetof(TkMenuEntry, underline), 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec tkSeparatorEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec tkCheckButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL, DEF_MENU_ENTRY_INDICATOR, -1, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0}, {TK_OPTION_STRING, "-offvalue", NULL, NULL, DEF_MENU_ENTRY_OFF_VALUE, offsetof(TkMenuEntry, offValuePtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-onvalue", NULL, NULL, DEF_MENU_ENTRY_ON_VALUE, offsetof(TkMenuEntry, onValuePtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", NULL, NULL, DEF_MENU_ENTRY_SELECT, offsetof(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-selectimage", NULL, NULL, DEF_MENU_ENTRY_SELECT_IMAGE, offsetof(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-variable", NULL, NULL, DEF_MENU_ENTRY_CHECK_VARIABLE, offsetof(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; static const Tk_OptionSpec tkRadioButtonEntryConfigSpecs[] = { {TK_OPTION_BOOLEAN, "-indicatoron", NULL, NULL, DEF_MENU_ENTRY_INDICATOR, -1, offsetof(TkMenuEntry, indicatorOn), 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", NULL, NULL, DEF_MENU_ENTRY_SELECT, offsetof(TkMenuEntry, indicatorFgPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-selectimage", NULL, NULL, DEF_MENU_ENTRY_SELECT_IMAGE, offsetof(TkMenuEntry, selectImagePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-value", NULL, NULL, DEF_MENU_ENTRY_VALUE, offsetof(TkMenuEntry, onValuePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-variable", NULL, NULL, DEF_MENU_ENTRY_RADIO_VARIABLE, offsetof(TkMenuEntry, namePtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; static const Tk_OptionSpec tkCascadeEntryConfigSpecs[] = { {TK_OPTION_STRING, "-menu", NULL, NULL, DEF_MENU_ENTRY_MENU, offsetof(TkMenuEntry, namePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, tkBasicMenuEntryConfigSpecs, 0} }; static const Tk_OptionSpec tkTearoffEntryConfigSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, DEF_MENU_ENTRY_BG, offsetof(TkMenuEntry, borderPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-state", NULL, NULL, DEF_MENU_ENTRY_STATE, -1, offsetof(TkMenuEntry, state), 0, (ClientData) menuStateStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; static const Tk_OptionSpec *specsArray[] = { tkCascadeEntryConfigSpecs, tkCheckButtonEntryConfigSpecs, tkBasicMenuEntryConfigSpecs, tkRadioButtonEntryConfigSpecs, |
︙ | ︙ | |||
246 247 248 249 250 251 252 | static const char *const menuTypeStrings[] = { "normal", "tearoff", "menubar", NULL }; static const Tk_OptionSpec tkMenuConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENU_ACTIVE_BG_COLOR, | | | | > > > | | | | | | | | | | | | | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | static const char *const menuTypeStrings[] = { "normal", "tearoff", "menubar", NULL }; static const Tk_OptionSpec tkMenuConfigSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENU_ACTIVE_BG_COLOR, offsetof(TkMenu, activeBorderPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_BG_MONO, 0}, {TK_OPTION_PIXELS, "-activeborderwidth", "activeBorderWidth", "BorderWidth", DEF_MENU_ACTIVE_BORDER_WIDTH, offsetof(TkMenu, activeBorderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENU_ACTIVE_FG_COLOR, offsetof(TkMenu, activeFgPtr), -1, 0, (ClientData) DEF_MENU_ACTIVE_FG_MONO, 0}, {TK_OPTION_RELIEF, "-activerelief", "activeRelief", "Relief", DEF_MENU_ACTIVE_RELIEF, offsetof(TkMenu, activeReliefPtr), -1, 0, NULL, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENU_BG_COLOR, offsetof(TkMenu, borderPtr), -1, 0, (ClientData) DEF_MENU_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENU_BORDER_WIDTH, offsetof(TkMenu, borderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENU_CURSOR, offsetof(TkMenu, cursorPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENU_DISABLED_FG_COLOR, offsetof(TkMenu, disabledFgPtr), -1, TK_OPTION_NULL_OK, (ClientData) DEF_MENU_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MENU_FONT, offsetof(TkMenu, fontPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MENU_FG, offsetof(TkMenu, fgPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-postcommand", "postCommand", "Command", DEF_MENU_POST_COMMAND, offsetof(TkMenu, postCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENU_RELIEF, offsetof(TkMenu, reliefPtr), -1, 0, NULL, 0}, {TK_OPTION_COLOR, "-selectcolor", "selectColor", "Background", DEF_MENU_SELECT_COLOR, offsetof(TkMenu, indicatorFgPtr), -1, 0, (ClientData) DEF_MENU_SELECT_MONO, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENU_TAKE_FOCUS, offsetof(TkMenu, takeFocusPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_BOOLEAN, "-tearoff", "tearOff", "TearOff", DEF_MENU_TEAROFF, -1, offsetof(TkMenu, tearoff), 0, NULL, 0}, {TK_OPTION_STRING, "-tearoffcommand", "tearOffCommand", "TearOffCommand", DEF_MENU_TEAROFF_CMD, offsetof(TkMenu, tearoffCommandPtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING, "-title", "title", "Title", DEF_MENU_TITLE, offsetof(TkMenu, titlePtr), -1, TK_OPTION_NULL_OK, NULL, 0}, {TK_OPTION_STRING_TABLE, "-type", "type", "Type", DEF_MENU_TYPE, offsetof(TkMenu, menuTypePtr), -1, TK_OPTION_NULL_OK, (ClientData) menuTypeStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0} }; /* * Command line options. Put here because MenuCmd has to look at them along * with MenuWidgetObjCmd. |
︙ | ︙ | |||
339 340 341 342 343 344 345 | int objc, Tcl_Obj *const objv[]); static void DeleteMenuCloneEntries(TkMenu *menuPtr, int first, int last); static void DestroyMenuHashTable(ClientData clientData, Tcl_Interp *interp); static void DestroyMenuInstance(TkMenu *menuPtr); static void DestroyMenuEntry(void *memPtr); | | | | | 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | int objc, Tcl_Obj *const objv[]); static void DeleteMenuCloneEntries(TkMenu *menuPtr, int first, int last); static void DestroyMenuHashTable(ClientData clientData, Tcl_Interp *interp); static void DestroyMenuInstance(TkMenu *menuPtr); static void DestroyMenuEntry(void *memPtr); static TkSizeT GetIndexFromCoords(Tcl_Interp *interp, TkMenu *menuPtr, const char *string, TkSizeT *indexPtr); static int MenuDoYPosition(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr); static int MenuDoXPosition(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr); static int MenuAddOrInsert(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *indexPtr, int objc, Tcl_Obj *const objv[]); static void MenuCmdDeletedProc(ClientData clientData); static TkMenuEntry * MenuNewEntry(TkMenu *menuPtr, TkSizeT index, int type); static char * MenuVarProc(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static int MenuWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void MenuWorldChanged(ClientData instanceData); |
︙ | ︙ | |||
450 451 452 453 454 455 456 | memset(menuPtr, 0, sizeof(TkMenu)); menuPtr->tkwin = newWin; menuPtr->display = Tk_Display(newWin); menuPtr->interp = interp; menuPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); | | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | memset(menuPtr, 0, sizeof(TkMenu)); menuPtr->tkwin = newWin; menuPtr->display = Tk_Display(newWin); menuPtr->interp = interp; menuPtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(menuPtr->tkwin), MenuWidgetObjCmd, menuPtr, MenuCmdDeletedProc); menuPtr->active = TCL_INDEX_NONE; menuPtr->cursorPtr = NULL; menuPtr->masterMenuPtr = menuPtr; menuPtr->menuType = UNKNOWN_TYPE; TkMenuInitializeDrawingFields(menuPtr); Tk_SetClass(menuPtr->tkwin, "Menu"); Tk_SetClassProcs(menuPtr->tkwin, &menuClass, menuPtr); Tk_CreateEventHandler(newWin, ExposureMask|StructureNotifyMask|ActivateMask, TkMenuEventProc, menuPtr); if (Tk_InitOptions(interp, menuPtr, tsdPtr->menuOptionTable, menuPtr->tkwin) != TCL_OK) { Tk_DestroyWindow(menuPtr->tkwin); return TCL_ERROR; } |
︙ | ︙ | |||
632 633 634 635 636 637 638 | sizeof(char *), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(menuPtr); switch ((enum options) option) { case MENU_ACTIVATE: { | | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | sizeof(char *), "option", 0, &option) != TCL_OK) { return TCL_ERROR; } Tcl_Preserve(menuPtr); switch ((enum options) option) { case MENU_ACTIVATE: { TkSizeT index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (menuPtr->active == index) { goto done; } if ((index != TCL_INDEX_NONE) && ((menuPtr->entries[index]->type==SEPARATOR_ENTRY) || (menuPtr->entries[index]->state == ENTRY_DISABLED))) { index = TCL_INDEX_NONE; } result = TkActivateMenuEntry(menuPtr, index); break; } case MENU_ADD: if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "type ?-option value ...?"); |
︙ | ︙ | |||
668 669 670 671 672 673 674 | case MENU_CGET: { Tcl_Obj *resultPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } | | | | | > | > | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 | case MENU_CGET: { Tcl_Obj *resultPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } resultPtr = Tk_GetOptionValue(interp, menuPtr, tsdPtr->menuOptionTable, objv[2], menuPtr->tkwin); if (resultPtr == NULL) { goto error; } Tcl_SetObjResult(interp, resultPtr); break; } case MENU_CLONE: if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "newMenuName ?menuType?"); goto error; } result = CloneMenu(menuPtr, objv[2], (objc == 3) ? NULL : objv[3]); break; case MENU_CONFIGURE: { Tcl_Obj *resultPtr; if (objc == 2) { resultPtr = Tk_GetOptionInfo(interp, menuPtr, tsdPtr->menuOptionTable, NULL, menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else if (objc == 3) { resultPtr = Tk_GetOptionInfo(interp, menuPtr, tsdPtr->menuOptionTable, objv[2], menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else { result = ConfigureMenu(interp, menuPtr, objc - 2, objv + 2); } if (result != TCL_OK) { goto error; } break; } case MENU_DELETE: { TkSizeT first, last; Tcl_WideInt w; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "first ?last?"); goto error; } /* * If 'first' explicitly refers to past the end of the menu, we don't * do anything. [Bug 220950] */ if (isdigit(UCHAR(Tcl_GetString(objv[2])[0])) && Tcl_GetWideIntFromObj(NULL, objv[2], &w) == TCL_OK) { first = w; if (first >= menuPtr->numEntries) { goto done; } } else if (TkGetMenuIndex(interp,menuPtr,objv[2],0,&first) != TCL_OK){ goto error; } if (objc == 3) { |
︙ | ︙ | |||
757 758 759 760 761 762 763 | if ((first < 0) || (last < first)) { goto done; } DeleteMenuCloneEntries(menuPtr, first, last); break; } case MENU_ENTRYCGET: { | | | | | | | | | | | | | > | | > > > | > > > | | | | < | | | | | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | if ((first < 0) || (last < first)) { goto done; } DeleteMenuCloneEntries(menuPtr, first, last); break; } case MENU_ENTRYCGET: { TkSizeT index; Tcl_Obj *resultPtr; if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "index option"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { goto done; } mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); resultPtr = Tk_GetOptionValue(interp, mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); Tcl_Release(mePtr); if (resultPtr == NULL) { goto error; } Tcl_SetObjResult(interp, resultPtr); break; } case MENU_ENTRYCONFIGURE: { TkSizeT index; Tcl_Obj *resultPtr; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "index ?-option value ...?"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { goto done; } mePtr = menuPtr->entries[index]; Tcl_Preserve(mePtr); if (objc == 3) { resultPtr = Tk_GetOptionInfo(interp, mePtr, mePtr->optionTable, NULL, menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else if (objc == 4) { resultPtr = Tk_GetOptionInfo(interp, mePtr, mePtr->optionTable, objv[3], menuPtr->tkwin); if (resultPtr == NULL) { result = TCL_ERROR; } else { result = TCL_OK; Tcl_SetObjResult(interp, resultPtr); } } else { result = ConfigureMenuCloneEntries(interp, menuPtr, index, objc-3, objv+3); } Tcl_Release(mePtr); break; } case MENU_INDEX: { TkSizeT index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "string"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_NewStringObj("none", -1)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(index)); } break; } case MENU_INSERT: if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "index type ?-option value ...?"); goto error; } if (MenuAddOrInsert(interp,menuPtr,objv[2],objc-3,objv+3) != TCL_OK) { goto error; } break; case MENU_INVOKE: { TkSizeT index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { goto done; } result = TkInvokeMenu(interp, menuPtr, index); break; } case MENU_POST: { int x, y; TkSizeT index = TCL_INDEX_NONE; if (objc != 4 && objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "x y ?index?"); goto error; } if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { goto error; } if (objc == 5) { if (TkGetMenuIndex(interp, menuPtr, objv[4], 0, &index) != TCL_OK) { goto error; } } /* * Tearoff menus are the same as ordinary menus on the Mac and are * posted differently on Windows than non-tearoffs. TkpPostMenu * does not actually map the menu's window on those platforms, and * popup menus have to be handled specially. Also, menubar menus are * not intended to be posted (bug 1567681, 2160206). */ if (menuPtr->menuType == MENUBAR) { Tcl_AppendResult(interp, "a menubar menu cannot be posted", NULL); return TCL_ERROR; } else if (menuPtr->menuType != TEAROFF_MENU) { result = TkpPostMenu(interp, menuPtr, x, y, index); } else { result = TkpPostTearoffMenu(interp, menuPtr, x, y, index); } break; } case MENU_POSTCASCADE: { TkSizeT index; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if ((index == TCL_INDEX_NONE) || (menuPtr->entries[index]->type != CASCADE_ENTRY)) { result = TkPostSubmenu(interp, menuPtr, NULL); } else { result = TkPostSubmenu(interp, menuPtr, menuPtr->entries[index]); } break; } case MENU_TYPE: { TkSizeT index; const char *typeStr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "index"); goto error; } if (TkGetMenuIndex(interp, menuPtr, objv[2], 0, &index) != TCL_OK) { goto error; } if (index == TCL_INDEX_NONE) { goto done; } if (menuPtr->entries[index]->type == TEAROFF_ENTRY) { typeStr = "tearoff"; } else { typeStr = menuEntryTypeStrings[menuPtr->entries[index]->type]; } |
︙ | ︙ | |||
989 990 991 992 993 994 995 | *---------------------------------------------------------------------- */ int TkInvokeMenu( Tcl_Interp *interp, /* The interp that the menu lives in. */ TkMenu *menuPtr, /* The menu we are invoking. */ | | | | 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | *---------------------------------------------------------------------- */ int TkInvokeMenu( Tcl_Interp *interp, /* The interp that the menu lives in. */ TkMenu *menuPtr, /* The menu we are invoking. */ TkSizeT index) /* The zero based index of the item we are * invoking. */ { int result = TCL_OK; TkMenuEntry *mePtr; if (index == TCL_INDEX_NONE) { goto done; } mePtr = menuPtr->entries[index]; if (mePtr->state == ENTRY_DISABLED) { goto done; } |
︙ | ︙ | |||
1477 1478 1479 1480 1481 1482 1483 | */ static void MenuWorldChanged( ClientData instanceData) /* Information about widget. */ { TkMenu *menuPtr = instanceData; | | | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 | */ static void MenuWorldChanged( ClientData instanceData) /* Information about widget. */ { TkMenu *menuPtr = instanceData; TkSizeT i; TkMenuConfigureDrawOptions(menuPtr); for (i = 0; i < menuPtr->numEntries; i++) { TkMenuConfigureEntryDrawOptions(menuPtr->entries[i], menuPtr->entries[i]->index); TkpConfigureMenuEntry(menuPtr->entries[i]); } |
︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | int result; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions)); | | | 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 | int result; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { menuListPtr->errorStructPtr = ckalloc(sizeof(Tk_SavedOptions)); result = Tk_SetOptions(interp, menuListPtr, tsdPtr->menuOptionTable, objc, objv, menuListPtr->tkwin, menuListPtr->errorStructPtr, NULL); if (result != TCL_OK) { for (cleanupPtr = menuPtr->masterMenuPtr; cleanupPtr != menuListPtr; cleanupPtr = cleanupPtr->nextInstancePtr) { Tk_RestoreSavedOptions(cleanupPtr->errorStructPtr); |
︙ | ︙ | |||
1618 1619 1620 1621 1622 1623 1624 | } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { int i; Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry); | | < | | | 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 | } } else if ((menuListPtr->numEntries > 0) && (menuListPtr->entries[0]->type == TEAROFF_ENTRY)) { int i; Tcl_EventuallyFree(menuListPtr->entries[0], (Tcl_FreeProc *) DestroyMenuEntry); for (i = 0; i < (int)menuListPtr->numEntries - 1; i++) { menuListPtr->entries[i] = menuListPtr->entries[i + 1]; menuListPtr->entries[i]->index = i; } if (--menuListPtr->numEntries == 0) { ckfree(menuListPtr->entries); menuListPtr->entries = NULL; } } TkMenuConfigureDrawOptions(menuListPtr); /* * After reconfiguring a menu, we need to reconfigure all of the * entries in the menu, since some of the things in the children (such * as graphics contexts) may have to change to reflect changes in the * parent. */ for (i = 0; i < (int)menuListPtr->numEntries; i++) { TkMenuEntry *mePtr; mePtr = menuListPtr->entries[i]; ConfigureMenuEntry(mePtr, 0, NULL); } TkEventuallyRecomputeMenu(menuListPtr); |
︙ | ︙ | |||
1696 1697 1698 1699 1700 1701 1702 | * Tk_ConfigureWidget, such as special processing for defaults, sizing * strings, graphics contexts, etc. */ if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { | | | | 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 | * Tk_ConfigureWidget, such as special processing for defaults, sizing * strings, graphics contexts, etc. */ if (mePtr->labelPtr == NULL) { mePtr->labelLength = 0; } else { (void)TkGetStringFromObj(mePtr->labelPtr, &mePtr->labelLength); } if (mePtr->accelPtr == NULL) { mePtr->accelLength = 0; } else { (void)TkGetStringFromObj(mePtr->accelPtr, &mePtr->accelLength); } /* * If this is a cascade entry, the platform-specific data of the child * menu has to be updated. Also, the links that point to parents and * cascades have to be updated. */ |
︙ | ︙ | |||
1920 1921 1922 1923 1924 1925 1926 | Tcl_UntraceVar2(menuPtr->interp, name, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, mePtr); } result = TCL_OK; if (menuPtr->tkwin != NULL) { | | | 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 | Tcl_UntraceVar2(menuPtr->interp, name, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, mePtr); } result = TCL_OK; if (menuPtr->tkwin != NULL) { if (Tk_SetOptions(menuPtr->interp, mePtr, mePtr->optionTable, objc, objv, menuPtr->tkwin, &errorStruct, NULL) != TCL_OK) { return TCL_ERROR; } result = PostProcessEntry(mePtr); if (result != TCL_OK) { Tk_RestoreSavedOptions(&errorStruct); |
︙ | ︙ | |||
2106 2107 2108 2109 2110 2111 2112 | Tcl_Interp *interp, /* For error messages. */ TkMenu *menuPtr, /* Menu for which the index is being * specified. */ Tcl_Obj *objPtr, /* Specification of an entry in menu. See * manual entry for valid .*/ int lastOK, /* Non-zero means its OK to return index just * *after* last entry. */ | | | | | | 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 | Tcl_Interp *interp, /* For error messages. */ TkMenu *menuPtr, /* Menu for which the index is being * specified. */ Tcl_Obj *objPtr, /* Specification of an entry in menu. See * manual entry for valid .*/ int lastOK, /* Non-zero means its OK to return index just * *after* last entry. */ TkSizeT *indexPtr) /* Where to store converted index. */ { int i; const char *string = Tcl_GetString(objPtr); if ((string[0] == 'a') && (strcmp(string, "active") == 0)) { *indexPtr = menuPtr->active; goto success; } if (((string[0] == 'l') && (strcmp(string, "last") == 0)) || ((string[0] == 'e') && (strcmp(string, "end") == 0))) { *indexPtr = menuPtr->numEntries - ((lastOK) ? 0 : 1); goto success; } if ((string[0] == 'n') && (strcmp(string, "none") == 0)) { *indexPtr = TCL_INDEX_NONE; goto success; } if (string[0] == '@') { if (GetIndexFromCoords(interp, menuPtr, string, indexPtr) == TCL_OK) { goto success; } } if (isdigit(UCHAR(string[0]))) { if (Tcl_GetInt(interp, string, &i) == TCL_OK) { if (i >= (int)menuPtr->numEntries) { if (lastOK) { i = menuPtr->numEntries; } else { i = menuPtr->numEntries-1; } } else if (i < 0) { i = -1; } *indexPtr = i; goto success; } Tcl_ResetResult(interp); } for (i = 0; i < (int)menuPtr->numEntries; i++) { Tcl_Obj *labelPtr = menuPtr->entries[i]->labelPtr; const char *label = (labelPtr == NULL) ? NULL : Tcl_GetString(labelPtr); if ((label != NULL) && (Tcl_StringMatch(label, string))) { *indexPtr = i; goto success; } |
︙ | ︙ | |||
2234 2235 2236 2237 2238 2239 2240 | * *---------------------------------------------------------------------- */ static TkMenuEntry * MenuNewEntry( TkMenu *menuPtr, /* Menu that will hold the new entry. */ | | | | 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 | * *---------------------------------------------------------------------- */ static TkMenuEntry * MenuNewEntry( TkMenu *menuPtr, /* Menu that will hold the new entry. */ TkSizeT index, /* Where in the menu the new entry is to * go. */ int type) /* The type of the new entry. */ { TkMenuEntry *mePtr; TkMenuEntry **newEntries; TkSizeT i; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); /* * Create a new array of entries with an empty slot for the new entry. */ |
︙ | ︙ | |||
2294 2295 2296 2297 2298 2299 2300 | mePtr->namePtr = NULL; mePtr->childMenuRefPtr = NULL; mePtr->onValuePtr = NULL; mePtr->offValuePtr = NULL; mePtr->entryFlags = 0; mePtr->index = index; mePtr->nextCascadePtr = NULL; | | | 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 | mePtr->namePtr = NULL; mePtr->childMenuRefPtr = NULL; mePtr->onValuePtr = NULL; mePtr->offValuePtr = NULL; mePtr->entryFlags = 0; mePtr->index = index; mePtr->nextCascadePtr = NULL; if (Tk_InitOptions(menuPtr->interp, mePtr, mePtr->optionTable, menuPtr->tkwin) != TCL_OK) { ckfree(mePtr); return NULL; } TkMenuInitializeEntryDrawingFields(mePtr); if (TkpMenuNewEntry(mePtr) != TCL_OK) { Tk_FreeConfigOptions((char *) mePtr, mePtr->optionTable, |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | TkMenu *menuPtr, /* Widget in which to create new entry. */ Tcl_Obj *indexPtr, /* Object describing index at which to insert. * NULL means insert at end. */ int objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of * entry, others are config options. */ { | | > | | 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 | TkMenu *menuPtr, /* Widget in which to create new entry. */ Tcl_Obj *indexPtr, /* Object describing index at which to insert. * NULL means insert at end. */ int objc, /* Number of elements in objv. */ Tcl_Obj *const objv[]) /* Arguments to command: first arg is type of * entry, others are config options. */ { int type; TkSizeT index; TkMenuEntry *mePtr; TkMenu *menuListPtr; if (indexPtr != NULL) { if (TkGetMenuIndex(interp, menuPtr, indexPtr, 1, &index) != TCL_OK) { return TCL_ERROR; } } else { index = menuPtr->numEntries; } if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad index \"%s\"", Tcl_GetString(indexPtr))); Tcl_SetErrorCode(interp, "TK", "MENU", "INDEX", NULL); return TCL_ERROR; } if (menuPtr->tearoff && (index == 0)) { index = 1; |
︙ | ︙ | |||
2380 2381 2382 2383 2384 2385 2386 | mePtr = MenuNewEntry(menuListPtr, index, type); if (mePtr == NULL) { return TCL_ERROR; } if (ConfigureMenuEntry(mePtr, objc - 1, objv + 1) != TCL_OK) { TkMenu *errorMenuPtr; | | < | | 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 | mePtr = MenuNewEntry(menuListPtr, index, type); if (mePtr == NULL) { return TCL_ERROR; } if (ConfigureMenuEntry(mePtr, objc - 1, objv + 1) != TCL_OK) { TkMenu *errorMenuPtr; TkSizeT i; for (errorMenuPtr = menuPtr->masterMenuPtr; errorMenuPtr != NULL; errorMenuPtr = errorMenuPtr->nextInstancePtr) { Tcl_EventuallyFree(errorMenuPtr->entries[index], (Tcl_FreeProc *) DestroyMenuEntry); for (i = index; i < errorMenuPtr->numEntries - 1; i++) { errorMenuPtr->entries[i] = errorMenuPtr->entries[i + 1]; errorMenuPtr->entries[i]->index = i; } if (--errorMenuPtr->numEntries == 0) { ckfree(errorMenuPtr->entries); errorMenuPtr->entries = NULL; } if (errorMenuPtr == menuListPtr) { break; } } |
︙ | ︙ | |||
2482 2483 2484 2485 2486 2487 2488 | int flags) /* Describes what just happened. */ { TkMenuEntry *mePtr = clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; | | | > < < < < < < < < < < < > | > | | | > > | > > > > > > > > > > > > > | 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 | int flags) /* Describes what just happened. */ { TkMenuEntry *mePtr = clientData; TkMenu *menuPtr; const char *value; const char *name, *onValue; if (Tcl_InterpDeleted(interp) || (mePtr->namePtr == NULL)) { /* * Do nothing if the interpreter is going away or we have * no variable name. */ return NULL; } menuPtr = mePtr->menuPtr; if (menuPtr->menuFlags & MENU_DELETION_PENDING) { return NULL; } name = Tcl_GetString(mePtr->namePtr); /* * If the variable is being unset, then re-establish the trace. */ if (flags & TCL_TRACE_UNSETS) { ClientData probe = NULL; mePtr->entryFlags &= ~ENTRY_SELECTED; do { probe = Tcl_VarTraceInfo(interp, name, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, probe); if (probe == (ClientData)mePtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * namePtr, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_TraceVar2(interp, name, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuVarProc, clientData); TkpConfigureMenuEntry(mePtr); TkEventuallyRedrawMenu(menuPtr, NULL); return NULL; } /* * Use the value of the variable to update the selected status of the menu |
︙ | ︙ | |||
2576 2577 2578 2579 2580 2581 2582 | * *---------------------------------------------------------------------- */ int TkActivateMenuEntry( register TkMenu *menuPtr, /* Menu in which to activate. */ | | | | | | 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 | * *---------------------------------------------------------------------- */ int TkActivateMenuEntry( register TkMenu *menuPtr, /* Menu in which to activate. */ TkSizeT index) /* Index of entry to activate, or * TCL_INDEX_NONE to deactivate all entries. */ { register TkMenuEntry *mePtr; int result = TCL_OK; if (menuPtr->active != TCL_INDEX_NONE) { mePtr = menuPtr->entries[menuPtr->active]; /* * Don't change the state unless it's currently active (state might * already have been changed to disabled). */ if (mePtr->state == ENTRY_ACTIVE) { mePtr->state = ENTRY_NORMAL; } TkEventuallyRedrawMenu(menuPtr, menuPtr->entries[menuPtr->active]); } menuPtr->active = index; if (index != TCL_INDEX_NONE) { mePtr = menuPtr->entries[index]; mePtr->state = ENTRY_ACTIVE; TkEventuallyRedrawMenu(menuPtr, mePtr); } return result; } |
︙ | ︙ | |||
2787 2788 2789 2790 2791 2792 2793 | Tcl_DecrRefCount(newObjv[1]); Tcl_ResetResult(menuPtr->interp); /* * Clone all of the cascade menus that this menu points to. */ | | | 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 | Tcl_DecrRefCount(newObjv[1]); Tcl_ResetResult(menuPtr->interp); /* * Clone all of the cascade menus that this menu points to. */ for (i = 0; i < (int)menuPtr->numEntries; i++) { TkMenuReferences *cascadeRefPtr; TkMenu *oldCascadePtr; if ((menuPtr->entries[i]->type == CASCADE_ENTRY) && (menuPtr->entries[i]->namePtr != NULL)) { cascadeRefPtr = TkFindMenuReferencesObj(menuPtr->interp, |
︙ | ︙ | |||
2851 2852 2853 2854 2855 2856 2857 | static int MenuDoXPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { | | | | | | 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 | static int MenuDoXPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { TkSizeT index; TkRecomputeMenu(menuPtr); if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) { return TCL_ERROR; } Tcl_ResetResult(interp); if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->x)); } return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2888 2889 2890 2891 2892 2893 2894 | static int MenuDoYPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { | | | | | | 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 | static int MenuDoYPosition( Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr) { TkSizeT index; TkRecomputeMenu(menuPtr); if (TkGetMenuIndex(interp, menuPtr, objPtr, 0, &index) != TCL_OK) { goto error; } Tcl_ResetResult(interp); if (index == TCL_INDEX_NONE) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(0)); } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(menuPtr->entries[index]->y)); } return TCL_OK; error: return TCL_ERROR; } |
︙ | ︙ | |||
2926 2927 2928 2929 2930 2931 2932 | * * Side effects: * If int is invalid, interp's result will be set to NULL. * *---------------------------------------------------------------------- */ | | | | 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 | * * Side effects: * If int is invalid, interp's result will be set to NULL. * *---------------------------------------------------------------------- */ static TkSizeT GetIndexFromCoords( Tcl_Interp *interp, /* Interpreter of menu. */ TkMenu *menuPtr, /* The menu we are searching. */ const char *string, /* The @string we are parsing. */ TkSizeT *indexPtr) /* The index of the item that matches. */ { int x, y, i; const char *p; char *end; int x2, borderwidth, max; TkRecomputeMenu(menuPtr); |
︙ | ︙ | |||
2966 2967 2968 2969 2970 2971 2972 | /* set the width of the final column to the remainder of the window * being aware of windows that may not be mapped yet. */ max = Tk_IsMapped(menuPtr->tkwin) ? Tk_Width(menuPtr->tkwin) : Tk_ReqWidth(menuPtr->tkwin); max -= borderwidth; | | | 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 | /* set the width of the final column to the remainder of the window * being aware of windows that may not be mapped yet. */ max = Tk_IsMapped(menuPtr->tkwin) ? Tk_Width(menuPtr->tkwin) : Tk_ReqWidth(menuPtr->tkwin); max -= borderwidth; for (i = 0; i < (int)menuPtr->numEntries; i++) { if (menuPtr->entries[i]->entryFlags & ENTRY_LAST_COLUMN) { x2 = max; } else { x2 = menuPtr->entries[i]->x + menuPtr->entries[i]->width; } if ((x >= menuPtr->entries[i]->x) && (y >= menuPtr->entries[i]->y) && (x < x2) |
︙ | ︙ | |||
3009 3010 3011 3012 3013 3014 3015 | *---------------------------------------------------------------------- */ static void RecursivelyDeleteMenu( TkMenu *menuPtr) /* The menubar instance we are deleting. */ { | | | 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 | *---------------------------------------------------------------------- */ static void RecursivelyDeleteMenu( TkMenu *menuPtr) /* The menubar instance we are deleting. */ { TkSizeT i; TkMenuEntry *mePtr; /* * It is not 100% clear that this preserve/release pair is required, but * we have added them for safety in this very complex code. */ |
︙ | ︙ | |||
3096 3097 3098 3099 3100 3101 3102 | Tcl_DecrRefCount(resultPtr); resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { Tcl_AppendToObj(resultPtr, ".", -1); } Tcl_AppendObjToObj(resultPtr, childPtr); | | | 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 | Tcl_DecrRefCount(resultPtr); resultPtr = Tcl_DuplicateObj(parentPtr); if (doDot) { Tcl_AppendToObj(resultPtr, ".", -1); } Tcl_AppendObjToObj(resultPtr, childPtr); intPtr = Tcl_NewWideIntObj(i); Tcl_AppendObjToObj(resultPtr, intPtr); Tcl_DecrRefCount(intPtr); } destString = Tcl_GetString(resultPtr); if ((Tcl_FindCommand(interp, destString, NULL, 0) == NULL) && ((nameTablePtr == NULL) || (Tcl_FindHashEntry(nameTablePtr, destString) == NULL))) { |
︙ | ︙ | |||
3513 3514 3515 3516 3517 3518 3519 | numDeleted = last + 1 - first; for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { for (i = last; i >= first; i--) { Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry); } | | | | | | 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 | numDeleted = last + 1 - first; for (menuListPtr = menuPtr->masterMenuPtr; menuListPtr != NULL; menuListPtr = menuListPtr->nextInstancePtr) { for (i = last; i >= first; i--) { Tcl_EventuallyFree(menuListPtr->entries[i], (Tcl_FreeProc *) DestroyMenuEntry); } for (i = last + 1; i < (int)menuListPtr->numEntries; i++) { j = i - numDeleted; menuListPtr->entries[j] = menuListPtr->entries[i]; menuListPtr->entries[j]->index = j; } menuListPtr->numEntries -= numDeleted; if (menuListPtr->numEntries == 0) { ckfree(menuListPtr->entries); menuListPtr->entries = NULL; } if (((int)menuListPtr->active >= first) && ((int)menuListPtr->active <= last)) { menuListPtr->active = -1; } else if ((int)menuListPtr->active > last) { menuListPtr->active -= numDeleted; } TkEventuallyRecomputeMenu(menuListPtr); } } /* |
︙ | ︙ |
Changes to generic/tkMenu.h.
︙ | ︙ | |||
64 65 66 67 68 69 70 | int type; /* Type of menu entry; see below for valid * types. */ struct TkMenu *menuPtr; /* Menu with which this entry is * associated. */ Tk_OptionTable optionTable; /* Option table for this menu entry. */ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if * no label). */ | | | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | int type; /* Type of menu entry; see below for valid * types. */ struct TkMenu *menuPtr; /* Menu with which this entry is * associated. */ Tk_OptionTable optionTable; /* Option table for this menu entry. */ Tcl_Obj *labelPtr; /* Main text label displayed in entry (NULL if * no label). */ TkSizeT labelLength; /* Number of non-NULL characters in label. */ int state; /* State of button for display purposes: * normal, active, or disabled. */ int underline; /* Value of -underline option: specifies index * of character to underline (-1 means don't * underline anything). */ Tcl_Obj *underlinePtr; /* Index of character to underline. */ Tcl_Obj *bitmapPtr; /* Bitmap to display in menu entry, or NULL. * If not NULL then label is ignored. */ Tcl_Obj *imagePtr; /* Name of image to display, or NULL. If not * NULL, bitmap, text, and textVarName are * ignored. */ Tk_Image image; /* Image to display in menu entry, or NULL if * none. */ Tcl_Obj *selectImagePtr; /* Name of image to display when selected, or * NULL. */ Tk_Image selectImage; /* Image to display in entry when selected, or * NULL if none. Ignored if image is NULL. */ Tcl_Obj *accelPtr; /* Accelerator string displayed at right of * menu entry. NULL means no such accelerator. * Malloc'ed. */ TkSizeT accelLength; /* Number of non-NULL characters in * accelerator. */ int indicatorOn; /* True means draw indicator, false means * don't draw it. This field is ignored unless * the entry is a radio or check button. */ /* * Display attributes */ |
︙ | ︙ | |||
116 117 118 119 120 121 122 | * overall font for menu. */ int columnBreak; /* If this is 0, this item appears below the * item in front of it. If this is 1, this * item starts a new column. This field is * always 0 for tearoff and separator * entries. */ int hideMargin; /* If this is 0, then the item has enough | | | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | * overall font for menu. */ int columnBreak; /* If this is 0, this item appears below the * item in front of it. If this is 1, this * item starts a new column. This field is * always 0 for tearoff and separator * entries. */ int hideMargin; /* If this is 0, then the item has enough * margin to accommodate a standard check mark * and a default right margin. If this is 1, * then the item has no such margins, and * checkbuttons and radiobuttons with this set * will have a rectangle drawn in the * indicator around the item if the item is * checked. This is useful for palette menus. * This field is ignored for separators and |
︙ | ︙ | |||
263 264 265 266 267 268 269 | Display *display; /* Display containing widget. Needed, among * other things, so that resources can be * freed up even after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with menu. */ Tcl_Command widgetCmd; /* Token for menu's widget command. */ TkMenuEntry **entries; /* Array of pointers to all the entries in the * menu. NULL means no entries. */ | | | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | Display *display; /* Display containing widget. Needed, among * other things, so that resources can be * freed up even after tkwin has gone away. */ Tcl_Interp *interp; /* Interpreter associated with menu. */ Tcl_Command widgetCmd; /* Token for menu's widget command. */ TkMenuEntry **entries; /* Array of pointers to all the entries in the * menu. NULL means no entries. */ TkSizeT numEntries; /* Number of elements in entries. */ TkSizeT active; /* Index of active entry. TCL_INDEX_NONE means * nothing active. */ int menuType; /* MASTER_MENU, TEAROFF_MENU, or MENUBAR. See * below for definitions. */ Tcl_Obj *menuTypePtr; /* Used to control whether created tkwin is a * toplevel or not. "normal", "menubar", or * "toplevel" */ /* |
︙ | ︙ | |||
378 379 380 381 382 383 384 385 386 387 388 389 390 391 | * of options are in this structure. */ Tk_OptionSpec *extensionPtr;/* Needed by the configuration package for * this widget to be extended. */ Tk_SavedOptions *errorStructPtr; /* We actually have to allocate these because * multiple menus get changed during one * ConfigureMenu call. */ } TkMenu; /* * When the toplevel configure -menu command is executed, the menu may not * exist yet. We need to keep a linked list of windows that reference a * particular menu. */ | > | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | * of options are in this structure. */ Tk_OptionSpec *extensionPtr;/* Needed by the configuration package for * this widget to be extended. */ Tk_SavedOptions *errorStructPtr; /* We actually have to allocate these because * multiple menus get changed during one * ConfigureMenu call. */ Tcl_Obj *activeReliefPtr; /* 3-d effect for active element. */ } TkMenu; /* * When the toplevel configure -menu command is executed, the menu may not * exist yet. We need to keep a linked list of windows that reference a * particular menu. */ |
︙ | ︙ | |||
477 478 479 480 481 482 483 | #define DECORATION_BORDER_WIDTH 2 /* * Menu-related functions that are shared among Tk modules but not exported to * the outside world: */ | | | | | | | 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | #define DECORATION_BORDER_WIDTH 2 /* * Menu-related functions that are shared among Tk modules but not exported to * the outside world: */ MODULE_SCOPE int TkActivateMenuEntry(TkMenu *menuPtr, TkSizeT index); MODULE_SCOPE void TkBindMenu(Tk_Window tkwin, TkMenu *menuPtr); MODULE_SCOPE TkMenuReferences*TkCreateMenuReferences(Tcl_Interp *interp, const char *name); MODULE_SCOPE void TkDestroyMenu(TkMenu *menuPtr); MODULE_SCOPE void TkEventuallyRecomputeMenu(TkMenu *menuPtr); MODULE_SCOPE void TkEventuallyRedrawMenu(TkMenu *menuPtr, TkMenuEntry *mePtr); MODULE_SCOPE TkMenuReferences*TkFindMenuReferences(Tcl_Interp *interp, const char *name); MODULE_SCOPE TkMenuReferences*TkFindMenuReferencesObj(Tcl_Interp *interp, Tcl_Obj *namePtr); MODULE_SCOPE int TkFreeMenuReferences(TkMenuReferences *menuRefPtr); MODULE_SCOPE Tcl_HashTable *TkGetMenuHashTable(Tcl_Interp *interp); MODULE_SCOPE int TkGetMenuIndex(Tcl_Interp *interp, TkMenu *menuPtr, Tcl_Obj *objPtr, int lastOK, TkSizeT *indexPtr); MODULE_SCOPE void TkMenuInitializeDrawingFields(TkMenu *menuPtr); MODULE_SCOPE void TkMenuInitializeEntryDrawingFields(TkMenuEntry *mePtr); MODULE_SCOPE int TkInvokeMenu(Tcl_Interp *interp, TkMenu *menuPtr, TkSizeT index); MODULE_SCOPE void TkMenuConfigureDrawOptions(TkMenu *menuPtr); MODULE_SCOPE int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, TkSizeT index); MODULE_SCOPE void TkMenuFreeDrawOptions(TkMenu *menuPtr); MODULE_SCOPE void TkMenuEntryFreeDrawOptions(TkMenuEntry *mePtr); MODULE_SCOPE void TkMenuEventProc(ClientData clientData, XEvent *eventPtr); MODULE_SCOPE void TkMenuImageProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); MODULE_SCOPE void TkMenuInit(void); MODULE_SCOPE void TkMenuSelectImageProc(ClientData clientData, int x, int y, int width, int height, int imgWidth, int imgHeight); MODULE_SCOPE Tcl_Obj * TkNewMenuName(Tcl_Interp *interp, Tcl_Obj *parentNamePtr, TkMenu *menuPtr); MODULE_SCOPE int TkPostCommand(TkMenu *menuPtr); MODULE_SCOPE int TkPostSubmenu(Tcl_Interp *interp, TkMenu *menuPtr, TkMenuEntry *mePtr); MODULE_SCOPE int TkPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y); MODULE_SCOPE int TkPreprocessMenu(TkMenu *menuPtr); MODULE_SCOPE void TkRecomputeMenu(TkMenu *menuPtr); /* * These routines are the platform-dependent routines called by the common * code. */ |
︙ | ︙ | |||
539 540 541 542 543 544 545 | const Tk_FontMetrics *menuMetricsPtr, int x, int y, int width, int height, int strictMotif, int drawingParameters); MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, | | > > | 540 541 542 543 544 545 546 547 548 549 550 551 552 | const Tk_FontMetrics *menuMetricsPtr, int x, int y, int width, int height, int strictMotif, int drawingParameters); MODULE_SCOPE void TkpMenuInit(void); MODULE_SCOPE int TkpMenuNewEntry(TkMenuEntry *mePtr); MODULE_SCOPE int TkpNewMenu(TkMenu *menuPtr); MODULE_SCOPE int TkpPostMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index); MODULE_SCOPE int TkpPostTearoffMenu(Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index); MODULE_SCOPE void TkpSetWindowMenuBar(Tk_Window tkwin, TkMenu *menuPtr); #endif /* _TKMENU */ |
Changes to generic/tkMenuDraw.c.
︙ | ︙ | |||
294 295 296 297 298 299 300 | * *---------------------------------------------------------------------- */ int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | * *---------------------------------------------------------------------- */ int TkMenuConfigureEntryDrawOptions( TkMenuEntry *mePtr, TkSizeT index) { XGCValues gcValues; GC newGC, newActiveGC, newDisabledGC, newIndicatorGC; unsigned long mask; Tk_Font tkfont; TkMenu *menuPtr = mePtr->menuPtr; |
︙ | ︙ | |||
471 472 473 474 475 476 477 | * Arrange for an entry of a menu, or the whole menu, to be redisplayed * at some point in the future. * * Results: * None. * * Side effects: | | | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | * Arrange for an entry of a menu, or the whole menu, to be redisplayed * at some point in the future. * * Results: * None. * * Side effects: * A when-idle handler is scheduled to do the redisplay, if there isn't * one already scheduled. * *---------------------------------------------------------------------- */ void TkEventuallyRedrawMenu( register TkMenu *menuPtr, /* Information about menu to redraw. */ register TkMenuEntry *mePtr)/* Entry to redraw. NULL means redraw all the * entries in the menu. */ { TkSizeT i; if (menuPtr->tkwin == NULL) { return; } if (mePtr != NULL) { mePtr->entryFlags |= ENTRY_NEEDS_REDISPLAY; } else { |
︙ | ︙ | |||
614 615 616 617 618 619 620 | static void DisplayMenu( ClientData clientData) /* Information about widget. */ { register TkMenu *menuPtr = clientData; register TkMenuEntry *mePtr; register Tk_Window tkwin = menuPtr->tkwin; | > | | 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | static void DisplayMenu( ClientData clientData) /* Information about widget. */ { register TkMenu *menuPtr = clientData; register TkMenuEntry *mePtr; register Tk_Window tkwin = menuPtr->tkwin; TkSizeT index; int strictMotif; Tk_Font tkfont; Tk_FontMetrics menuMetrics; int width; int borderWidth; Tk_3DBorder border; int relief; |
︙ | ︙ | |||
803 804 805 806 807 808 809 | } /* *---------------------------------------------------------------------- * * TkPostTearoffMenu -- * | < | | < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 | } /* *---------------------------------------------------------------------- * * TkPostTearoffMenu -- * * Posts a tearoff menu on the screen. Adjusts the menu's position so * that it fits on the screen, and maps and raises the menu. * * Results: * Returns a standard Tcl Error. * * Side effects: * The menu is posted. * *---------------------------------------------------------------------- */ int TkPostTearoffMenu( Tcl_Interp *interp, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y) /* The root X,Y coordinates where we are * posting */ { return TkpPostTearoffMenu(interp, menuPtr, x, y, -1); } /* *-------------------------------------------------------------- * * TkPostSubmenu -- * |
︙ | ︙ | |||
965 966 967 968 969 970 971 | Tk_GetRootCoords(menuPtr->tkwin, &x, &y); AdjustMenuCoords(menuPtr, mePtr, &x, &y); menuPtr->postedCascade = mePtr; subary[0] = mePtr->namePtr; subary[1] = Tcl_NewStringObj("post", -1); | | | | 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | Tk_GetRootCoords(menuPtr->tkwin, &x, &y); AdjustMenuCoords(menuPtr, mePtr, &x, &y); menuPtr->postedCascade = mePtr; subary[0] = mePtr->namePtr; subary[1] = Tcl_NewStringObj("post", -1); subary[2] = Tcl_NewWideIntObj(x); subary[3] = Tcl_NewWideIntObj(y); Tcl_IncrRefCount(subary[1]); Tcl_IncrRefCount(subary[2]); Tcl_IncrRefCount(subary[3]); result = Tcl_EvalObjv(interp, 4, subary, 0); Tcl_DecrRefCount(subary[1]); Tcl_DecrRefCount(subary[2]); Tcl_DecrRefCount(subary[3]); |
︙ | ︙ |
Changes to generic/tkMenubutton.c.
︙ | ︙ | |||
57 58 59 60 61 62 63 | /* * Information used for parsing configuration specs: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | /* * Information used for parsing configuration specs: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_MENUBUTTON_ACTIVE_BG_COLOR, -1, offsetof(TkMenuButton, activeBorder), 0, (ClientData) DEF_MENUBUTTON_ACTIVE_BG_MONO, 0}, {TK_OPTION_COLOR, "-activeforeground", "activeForeground", "Background", DEF_MENUBUTTON_ACTIVE_FG_COLOR, -1, offsetof(TkMenuButton, activeFg), 0, DEF_MENUBUTTON_ACTIVE_FG_MONO, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MENUBUTTON_ANCHOR, -1, offsetof(TkMenuButton, anchor), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MENUBUTTON_BG_COLOR, -1, offsetof(TkMenuButton, normalBorder), 0, DEF_MENUBUTTON_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, (ClientData) "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, (ClientData) "-background", 0}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", DEF_MENUBUTTON_BITMAP, -1, offsetof(TkMenuButton, bitmap), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MENUBUTTON_BORDER_WIDTH, -1, offsetof(TkMenuButton, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MENUBUTTON_CURSOR, -1, offsetof(TkMenuButton, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", DEF_MENUBUTTON_DIRECTION, -1, offsetof(TkMenuButton, direction), 0, directionStrings, 0}, {TK_OPTION_COLOR, "-disabledforeground", "disabledForeground", "DisabledForeground", DEF_MENUBUTTON_DISABLED_FG_COLOR, -1, offsetof(TkMenuButton, disabledFg), TK_OPTION_NULL_OK, (ClientData) DEF_MENUBUTTON_DISABLED_FG_MONO, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, (ClientData) "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MENUBUTTON_FONT, -1, offsetof(TkMenuButton, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MENUBUTTON_FG, -1, offsetof(TkMenuButton, normalFg), 0, 0, 0}, {TK_OPTION_STRING, "-height", "height", "Height", DEF_MENUBUTTON_HEIGHT, -1, offsetof(TkMenuButton, heightString), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR, -1, offsetof(TkMenuButton, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_MENUBUTTON_HIGHLIGHT, -1, offsetof(TkMenuButton, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MENUBUTTON_HIGHLIGHT_WIDTH, -1, offsetof(TkMenuButton, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-image", "image", "Image", DEF_MENUBUTTON_IMAGE, -1, offsetof(TkMenuButton, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-indicatoron", "indicatorOn", "IndicatorOn", DEF_MENUBUTTON_INDICATOR, -1, offsetof(TkMenuButton, indicatorOn), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_MENUBUTTON_JUSTIFY, -1, offsetof(TkMenuButton, justify), 0, 0, 0}, {TK_OPTION_STRING, "-menu", "menu", "Menu", DEF_MENUBUTTON_MENU, -1, offsetof(TkMenuButton, menuName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_MENUBUTTON_PADX, -1, offsetof(TkMenuButton, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_MENUBUTTON_PADY, -1, offsetof(TkMenuButton, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MENUBUTTON_RELIEF, -1, offsetof(TkMenuButton, relief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", DEF_BUTTON_COMPOUND, -1, offsetof(TkMenuButton, compound), 0, compoundStrings, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_MENUBUTTON_STATE, -1, offsetof(TkMenuButton, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MENUBUTTON_TAKE_FOCUS, -1, offsetof(TkMenuButton, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_MENUBUTTON_TEXT, -1, offsetof(TkMenuButton, text), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MENUBUTTON_TEXT_VARIABLE, -1, offsetof(TkMenuButton, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-underline", "underline", "Underline", DEF_MENUBUTTON_UNDERLINE, -1, offsetof(TkMenuButton, underline), 0, 0, 0}, {TK_OPTION_STRING, "-width", "width", "Width", DEF_MENUBUTTON_WIDTH, -1, offsetof(TkMenuButton, widthString), 0, 0, 0}, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", DEF_MENUBUTTON_WRAP_LENGTH, -1, offsetof(TkMenuButton, wrapLength), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; /* * The following tables define the menubutton widget commands and map the * indexes into the string tables into a single enumerated type used to |
︙ | ︙ | |||
304 305 306 307 308 309 310 | mbPtr->takeFocus = NULL; mbPtr->flags = 0; Tk_CreateEventHandler(mbPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MenuButtonEventProc, mbPtr); | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | mbPtr->takeFocus = NULL; mbPtr->flags = 0; Tk_CreateEventHandler(mbPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MenuButtonEventProc, mbPtr); if (Tk_InitOptions(interp, mbPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(mbPtr->tkwin); return TCL_ERROR; } if (ConfigureMenuButton(interp, mbPtr, objc-2, objv+2) != TCL_OK) { Tk_DestroyWindow(mbPtr->tkwin); return TCL_ERROR; |
︙ | ︙ | |||
365 366 367 368 369 370 371 | switch (index) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } | | | | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | switch (index) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } objPtr = Tk_GetOptionValue(interp, mbPtr, mbPtr->optionTable, objv[2], mbPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case COMMAND_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, mbPtr, mbPtr->optionTable, (objc == 3) ? objv[2] : NULL, mbPtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); } else { |
︙ | ︙ | |||
520 521 522 523 524 525 526 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ | | | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ if (Tk_SetOptions(interp, mbPtr, mbPtr->optionTable, objc, objv, mbPtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; } } else { /* * Second pass: restore options to old values. |
︙ | ︙ | |||
877 878 879 880 881 882 883 | const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkMenuButton *mbPtr = clientData; const char *value; unsigned len; | < < < < < < < < < < < < < > > | > > > > > > > > > > > > > > > > > > | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 | const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register TkMenuButton *mbPtr = clientData; const char *value; unsigned len; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && mbPtr->textVarName) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, mbPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuButtonTextVarProc, probe); if (probe == (ClientData)mbPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_SetVar2(interp, mbPtr->textVarName, NULL, mbPtr->text, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, mbPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MenuButtonTextVarProc, clientData); } return NULL; |
︙ | ︙ |
Changes to generic/tkMessage.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" /* * A data structure of the following type is kept for each message widget * managed by this file: */ typedef struct { |
︙ | ︙ | |||
105 106 107 108 109 110 111 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, | | | | | | | | | | | | | | | | | | | | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", DEF_MESSAGE_ANCHOR, -1, offsetof(Message, anchor), 0, 0, 0}, {TK_OPTION_INT, "-aspect", "aspect", "Aspect", DEF_MESSAGE_ASPECT, -1, offsetof(Message, aspect), 0, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_MESSAGE_BG_COLOR, -1, offsetof(Message, border), 0, DEF_MESSAGE_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_MESSAGE_BORDER_WIDTH, -1, offsetof(Message, borderWidth), 0, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_MESSAGE_CURSOR, -1, offsetof(Message, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_MESSAGE_FONT, -1, offsetof(Message, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_MESSAGE_FG, -1, offsetof(Message, fgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_MESSAGE_HIGHLIGHT_BG, -1, offsetof(Message, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_MESSAGE_HIGHLIGHT, -1, offsetof(Message, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_MESSAGE_HIGHLIGHT_WIDTH, -1, offsetof(Message, highlightWidth), 0, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", DEF_MESSAGE_JUSTIFY, -1, offsetof(Message, justify), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_MESSAGE_PADX, offsetof(Message, padXPtr), offsetof(Message, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_MESSAGE_PADY, offsetof(Message, padYPtr), offsetof(Message, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_MESSAGE_RELIEF, -1, offsetof(Message, relief), 0, 0, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_MESSAGE_TAKE_FOCUS, -1, offsetof(Message, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-text", "text", "Text", DEF_MESSAGE_TEXT, -1, offsetof(Message, string), 0, 0, 0}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", DEF_MESSAGE_TEXT_VARIABLE, -1, offsetof(Message, textVarName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_MESSAGE_WIDTH, -1, offsetof(Message, width), 0, 0 ,0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
238 239 240 241 242 243 244 | * Create the option table for this widget class. If it has already been * created, the cached pointer will be returned. */ optionTable = Tk_CreateOptionTable(interp, optionSpecs); msgPtr = ckalloc(sizeof(Message)); | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | * Create the option table for this widget class. If it has already been * created, the cached pointer will be returned. */ optionTable = Tk_CreateOptionTable(interp, optionSpecs); msgPtr = ckalloc(sizeof(Message)); memset(msgPtr, 0, sizeof(Message)); /* * Set values for those fields that don't take a 0 or NULL value. */ msgPtr->tkwin = tkwin; msgPtr->display = Tk_Display(tkwin); |
︙ | ︙ | |||
263 264 265 266 267 268 269 | msgPtr->cursor = NULL; Tk_SetClass(msgPtr->tkwin, "Message"); Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MessageEventProc, msgPtr); | | | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | msgPtr->cursor = NULL; Tk_SetClass(msgPtr->tkwin, "Message"); Tk_SetClassProcs(msgPtr->tkwin, &messageClass, msgPtr); Tk_CreateEventHandler(msgPtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, MessageEventProc, msgPtr); if (Tk_InitOptions(interp, msgPtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(msgPtr->tkwin); return TCL_ERROR; } if (ConfigureMessage(interp, msgPtr, objc-2, objv+2, 0) != TCL_OK) { Tk_DestroyWindow(msgPtr->tkwin); return TCL_ERROR; |
︙ | ︙ | |||
327 328 329 330 331 332 333 | switch ((enum options) index) { case MESSAGE_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; } else { | | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | switch ((enum options) index) { case MESSAGE_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; } else { objPtr = Tk_GetOptionValue(interp, msgPtr, msgPtr->optionTable, objv[2], msgPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); result = TCL_OK; } } break; case MESSAGE_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, msgPtr, msgPtr->optionTable, (objc == 3) ? objv[2] : NULL, msgPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); result = TCL_OK; |
︙ | ︙ | |||
451 452 453 454 455 456 457 | if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, msgPtr); } | | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | if (msgPtr->textVarName != NULL) { Tcl_UntraceVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, msgPtr); } if (Tk_SetOptions(interp, msgPtr, msgPtr->optionTable, objc, objv, msgPtr->tkwin, &savedOptions, NULL) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /* * If the message is to display the value of a variable, then set up a |
︙ | ︙ | |||
834 835 836 837 838 839 840 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register Message *msgPtr = clientData; const char *value; | < < < < < < < < < < < < < > > | > > > > > > > > > > > > > > > > > > | 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | const char *name1, /* Name of variable. */ const char *name2, /* Second part of variable name. */ int flags) /* Information about what happened. */ { register Message *msgPtr = clientData; const char *value; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && msgPtr->textVarName) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, msgPtr->textVarName, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, probe); if (probe == (ClientData)msgPtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * textVarName, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_SetVar2(interp, msgPtr->textVarName, NULL, msgPtr->string, TCL_GLOBAL_ONLY); Tcl_TraceVar2(interp, msgPtr->textVarName, NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, MessageTextVarProc, clientData); } return NULL; |
︙ | ︙ |
Changes to generic/tkObj.c.
︙ | ︙ | |||
43 44 45 46 47 48 49 | * One of these structures is created per thread to store thread-specific * data. In this case, it is used to contain references to selected * Tcl_ObjTypes that we can use as screen distances without conversion. The * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | * One of these structures is created per thread to store thread-specific * data. In this case, it is used to contain references to selected * Tcl_ObjTypes that we can use as screen distances without conversion. The * "dataKey" below is used to locate the ThreadSpecificData for the current * thread. */ typedef struct { const Tcl_ObjType *doubleTypePtr; const Tcl_ObjType *intTypePtr; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * The following structure is the internal representation for mm objects. |
︙ | ︙ | |||
69 70 71 72 73 74 75 | * A WindowRep caches name-to-window lookups. The cache is invalid if tkwin is * NULL or if mainPtr->deletionEpoch does not match epoch. */ typedef struct WindowRep { Tk_Window tkwin; /* Cached window; NULL if not found. */ TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */ | > | > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | * A WindowRep caches name-to-window lookups. The cache is invalid if tkwin is * NULL or if mainPtr->deletionEpoch does not match epoch. */ typedef struct WindowRep { Tk_Window tkwin; /* Cached window; NULL if not found. */ TkMainInfo *mainPtr; /* MainWindow associated with tkwin. */ #if TCL_MAJOR_VERSION > 8 size_t epoch; /* Value of mainPtr->deletionEpoch at last * successful lookup. */ #else long epoch; #endif } WindowRep; /* * Prototypes for functions defined later in this file: */ static void DupMMInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); |
︙ | ︙ | |||
92 93 94 95 96 97 98 | static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its | | | | | | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | static int SetMMFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetPixelFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); static int SetWindowFromAny(Tcl_Interp *interp, Tcl_Obj *objPtr); /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its * initial display-independent settings. */ static const Tcl_ObjType pixelObjType = { "pixel", /* name */ FreePixelInternalRep, /* freeIntRepProc */ DupPixelInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; /* * The following structure defines the implementation of the "pixel" Tcl * object, used for measuring distances. The pixel object remembers its * initial display-independent settings. */ static const Tcl_ObjType mmObjType = { "mm", /* name */ FreeMMInternalRep, /* freeIntRepProc */ DupMMInternalRep, /* dupIntRepProc */ UpdateStringOfMM, /* updateStringProc */ NULL /* setFromAnyProc */ }; /* * The following structure defines the implementation of the "window" * Tcl object. */ static const Tcl_ObjType windowObjType = { "window", /* name */ FreeWindowInternalRep, /* freeIntRepProc */ DupWindowInternalRep, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; /* *---------------------------------------------------------------------- * * GetTypeCache -- * |
︙ | ︙ | |||
664 665 666 667 668 669 670 | static void UpdateStringOfMM( register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | static void UpdateStringOfMM( register Tcl_Obj *objPtr) /* pixel obj with string rep to update. */ { MMRep *mmPtr; char buffer[TCL_DOUBLE_SPACE]; TkSizeT len; mmPtr = objPtr->internalRep.twoPtrValue.ptr1; /* assert( mmPtr->units == -1 && objPtr->bytes == NULL ); */ if ((mmPtr->units != -1) || (objPtr->bytes != NULL)) { Tcl_Panic("UpdateStringOfMM: false precondition"); } |
︙ | ︙ |
Changes to generic/tkOldConfig.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 28 29 30 31 32 33 | * * INIT - Non-zero means (char *) things have been converted to * Tk_Uid's. */ #define INIT 0x20 /* * Forward declarations for functions defined later in this file: */ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, Tk_Uid value, | > > > > | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * * INIT - Non-zero means (char *) things have been converted to * Tk_Uid's. */ #define INIT 0x20 #ifndef TK_CONFIG_OPTION_SPECIFIED # define TK_CONFIG_OPTION_SPECIFIED (1 << 4) #endif /* * Forward declarations for functions defined later in this file: */ static int DoConfig(Tcl_Interp *interp, Tk_Window tkwin, Tk_ConfigSpec *specPtr, Tk_Uid value, int valueIsUid, void *widgRec); static Tk_ConfigSpec * FindConfigSpec(Tcl_Interp *interp, Tk_ConfigSpec *specs, const char *argvName, int needFlags, int hateFlags); static char * FormatConfigInfo(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specPtr, void *widgRec); static const char * FormatConfigValue(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *specPtr, void *widgRec, char *buffer, Tcl_FreeProc **freeProcPtr); static Tk_ConfigSpec * GetCachedSpecs(Tcl_Interp *interp, const Tk_ConfigSpec *staticSpecs); static void DeleteSpecCacheTable(ClientData clientData, Tcl_Interp *interp); /* |
︙ | ︙ | |||
336 337 338 339 340 341 342 | Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ Tk_ConfigSpec *specPtr, /* Specifier to apply. */ Tk_Uid value, /* Value to use to fill in widgRec. */ int valueIsUid, /* Non-zero means value is a Tk_Uid; zero * means it's an ordinary string. */ | | | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | Tcl_Interp *interp, /* Interpreter for error reporting. */ Tk_Window tkwin, /* Window containing widget (needed to set up * X resources). */ Tk_ConfigSpec *specPtr, /* Specifier to apply. */ Tk_Uid value, /* Value to use to fill in widgRec. */ int valueIsUid, /* Non-zero means value is a Tk_Uid; zero * means it's an ordinary string. */ void *widgRec) /* Record whose fields are to be modified. * Values must be properly initialized. */ { void *ptr; Tk_Uid uid; int nullValue; nullValue = 0; if ((*value == 0) && (specPtr->specFlags & TK_CONFIG_NULL_OK)) { nullValue = 1; } do { ptr = (char *)widgRec + specPtr->offset; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (Tcl_GetBoolean(interp, value, (int *) ptr) != TCL_OK) { return TCL_ERROR; } break; case TK_CONFIG_INT: |
︙ | ︙ | |||
685 686 687 688 689 690 691 | FormatConfigInfo( Tcl_Interp *interp, /* Interpreter to use for things like * floating-point precision. */ Tk_Window tkwin, /* Window corresponding to widget. */ register const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ | | | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | FormatConfigInfo( Tcl_Interp *interp, /* Interpreter to use for things like * floating-point precision. */ Tk_Window tkwin, /* Window corresponding to widget. */ register const Tk_ConfigSpec *specPtr, /* Pointer to information describing * option. */ void *widgRec) /* Pointer to record holding current values of * info for widget. */ { const char *argv[6]; char *result; char buffer[200]; Tcl_FreeProc *freeProc = NULL; |
︙ | ︙ | |||
751 752 753 754 755 756 757 | static const char * FormatConfigValue( Tcl_Interp *interp, /* Interpreter for use in real conversions. */ Tk_Window tkwin, /* Window corresponding to widget. */ const Tk_ConfigSpec *specPtr, /* Pointer to information describing option. * Must not point to a synonym option. */ | | > | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | static const char * FormatConfigValue( Tcl_Interp *interp, /* Interpreter for use in real conversions. */ Tk_Window tkwin, /* Window corresponding to widget. */ const Tk_ConfigSpec *specPtr, /* Pointer to information describing option. * Must not point to a synonym option. */ void *widgRec, /* Pointer to record holding current values of * info for widget. */ char *buffer, /* Static buffer to use for small values. * Must have at least 200 bytes of storage. */ Tcl_FreeProc **freeProcPtr) /* Pointer to word to fill in with address of * function to free the result, or NULL if * result is static. */ { void *ptr; const char *result; *freeProcPtr = NULL; ptr = (char *)widgRec + specPtr->offset; result = ""; switch (specPtr->type) { case TK_CONFIG_BOOLEAN: if (*((int *) ptr) == 0) { result = "0"; } else { result = "1"; |
︙ | ︙ |
Changes to generic/tkOldTest.c.
︙ | ︙ | |||
87 88 89 90 91 92 93 | /* *---------------------------------------------------------------------- * * TkOldTestInit -- * | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | /* *---------------------------------------------------------------------- * * TkOldTestInit -- * * This function performs initialization for the Tk test suite * extensions for testing support for legacy interfaces. * * Results: * Returns a standard Tcl completion code, and leaves an error message in * the interp's result if an error occurs. * * Side effects: |
︙ | ︙ |
Changes to generic/tkOption.c.
︙ | ︙ | |||
172 173 174 175 176 177 178 | * level. */ int bases[NUM_STACKS]; /* For each stack, index of first element on * stack corresponding to this level (used to * restore "numUsed" fields when popping out * of a level. */ } StackLevel; | | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | * level. */ int bases[NUM_STACKS]; /* For each stack, index of first element on * stack corresponding to this level (used to * restore "numUsed" fields when popping out * of a level. */ } StackLevel; typedef struct { int initialized; /* 0 means the ThreadSpecific Data structure * for the current thread needs to be * initialized. */ ElArray *stacks[NUM_STACKS]; TkWindow *cachedWindow; /* Lowest-level window currently loaded in * stacks at present. NULL means stacks have * never been used, or have been invalidated |
︙ | ︙ | |||
256 257 258 259 260 261 262 | TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr; register ElArray **arrayPtrPtr; register Element *elPtr; Element newEl; register const char *p; const char *field; int count, firstField; | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | TkWindow *winPtr = ((TkWindow *) tkwin)->mainPtr->winPtr; register ElArray **arrayPtrPtr; register Element *elPtr; Element newEl; register const char *p; const char *field; int count, firstField; size_t length; #define TMP_SIZE 100 char tmp[TMP_SIZE+1]; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (winPtr->mainPtr->optionRootPtr == NULL) { OptionInit(winPtr->mainPtr); |
︙ | ︙ | |||
307 308 309 310 311 312 313 | while ((*p != 0) && (*p != '.') && (*p != '*')) { p++; } length = p - field; if (length > TMP_SIZE) { length = TMP_SIZE; } | | | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | while ((*p != 0) && (*p != '.') && (*p != '*')) { p++; } length = p - field; if (length > TMP_SIZE) { length = TMP_SIZE; } strncpy(tmp, field, length); tmp[length] = 0; newEl.nameUid = Tk_GetUid(tmp); if (isupper(UCHAR(*field))) { newEl.flags |= CLASS; } if (*p != 0) { |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 | int priority) /* Priority level to use for options in this * file, such as TK_USER_DEFAULT_PRIO or * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { const char *realName; Tcl_Obj *buffer; | | > | 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | int priority) /* Priority level to use for options in this * file, such as TK_USER_DEFAULT_PRIO or * TK_INTERACTIVE_PRIO. Must be between 0 and * TK_MAX_PRIO. */ { const char *realName; Tcl_Obj *buffer; int result; size_t bufferSize; Tcl_Channel chan; Tcl_DString newName; /* * Prevent file system access in a safe interpreter. */ |
︙ | ︙ | |||
1111 1112 1113 1114 1115 1116 1117 | return TCL_ERROR; } buffer = Tcl_NewObj(); Tcl_IncrRefCount(buffer); Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8"); bufferSize = Tcl_ReadChars(chan, buffer, -1, 0); | | | 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | return TCL_ERROR; } buffer = Tcl_NewObj(); Tcl_IncrRefCount(buffer); Tcl_SetChannelOption(NULL, chan, "-encoding", "utf-8"); bufferSize = Tcl_ReadChars(chan, buffer, -1, 0); if (bufferSize == (size_t)-1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "error reading file \"%s\": %s", fileName, Tcl_PosixError(interp))); Tcl_Close(NULL, chan); return TCL_ERROR; } Tcl_Close(NULL, chan); |
︙ | ︙ |
Changes to generic/tkPack.c.
︙ | ︙ | |||
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | */ static void ArrangePacking(ClientData clientData); static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyPacker(void *memPtr); static Packer * GetPacker(Tk_Window tkwin); static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, Packer *masterPtr, int objc,Tcl_Obj *const objv[]); static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); static int XExpansion(Packer *slavePtr, int cavityWidth); static int YExpansion(Packer *slavePtr, int cavityHeight); /* | > > | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | */ static void ArrangePacking(ClientData clientData); static int ConfigureSlaves(Tcl_Interp *interp, Tk_Window tkwin, int objc, Tcl_Obj *const objv[]); static void DestroyPacker(void *memPtr); static Packer * GetPacker(Tk_Window tkwin); #ifndef TK_NO_DEPRECATED static int PackAfter(Tcl_Interp *interp, Packer *prevPtr, Packer *masterPtr, int objc,Tcl_Obj *const objv[]); #endif /* !TK_NO_DEPRECATED */ static void PackStructureProc(ClientData clientData, XEvent *eventPtr); static void Unlink(Packer *packPtr); static int XExpansion(Packer *slavePtr, int cavityWidth); static int YExpansion(Packer *slavePtr, int cavityHeight); /* |
︙ | ︙ | |||
157 158 159 160 161 162 163 | int halfSpace, /* The left or top padding amount */ int allSpace) /* The total amount of padding */ { Tcl_Obj *padding[2]; if (halfSpace*2 == allSpace) { Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), | | | | | 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | int halfSpace, /* The left or top padding amount */ int allSpace) /* The total amount of padding */ { Tcl_Obj *padding[2]; if (halfSpace*2 == allSpace) { Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), Tcl_NewWideIntObj(halfSpace)); } else { padding[0] = Tcl_NewWideIntObj(halfSpace); padding[1] = Tcl_NewWideIntObj(allSpace - halfSpace); Tcl_DictObjPut(NULL, bufferObj, Tcl_NewStringObj(switchName, -1), Tcl_NewListObj(2, padding)); } } /* *------------------------------------------------------------------------ |
︙ | ︙ | |||
193 194 195 196 197 198 199 | Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = clientData; const char *argv2; static const char *const optionStrings[] = { | | > > > > > > | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { Tk_Window tkwin = clientData; const char *argv2; static const char *const optionStrings[] = { #ifndef TK_NO_DEPRECATED "after", "append", "before", "unpack", #endif /* !TK_NO_DEPRECATED */ "configure", "forget", "info", "propagate", "slaves", NULL }; enum options { #ifndef TK_NO_DEPRECATED PACK_AFTER, PACK_APPEND, PACK_BEFORE, PACK_UNPACK, #endif /* !TK_NO_DEPRECATED */ PACK_CONFIGURE, PACK_FORGET, PACK_INFO, PACK_PROPAGATE, PACK_SLAVES }; int index; if (objc >= 2) { const char *string = Tcl_GetString(objv[1]); if (string[0] == '.') { return ConfigureSlaves(interp, tkwin, objc-1, objv+1); } } if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option arg ?arg ...?"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { #ifndef TK_NO_DEPRECATED /* * Call it again without the deprecated ones to get a proper error * message. This works well since there can't be any ambiguity between * deprecated and new options. */ Tcl_ResetResult(interp); Tcl_GetIndexFromObjStruct(interp, objv[1], &optionStrings[4], sizeof(char *), "option", 0, &index); #endif /* TK_NO_DEPRECATED */ return TCL_ERROR; } argv2 = Tcl_GetString(objv[2]); switch ((enum options) index) { #ifndef TK_NO_DEPRECATED case PACK_AFTER: { Packer *prevPtr; Tk_Window tkwin2; if (TkGetWindowFromObj(interp, tkwin, objv[2], &tkwin2) != TCL_OK) { return TCL_ERROR; } |
︙ | ︙ | |||
293 294 295 296 297 298 299 300 301 302 303 304 305 306 | if (prevPtr->nextPtr == packPtr) { break; } } } return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); } case PACK_CONFIGURE: if (argv2[0] != '.') { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be name of window", argv2)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } | > | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | if (prevPtr->nextPtr == packPtr) { break; } } } return PackAfter(interp, prevPtr, masterPtr, objc-3, objv+3); } #endif /* !TK_NO_DEPRECATED */ case PACK_CONFIGURE: if (argv2[0] != '.') { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be name of window", argv2)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return TCL_ERROR; } |
︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 | slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj(slavePtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; } case PACK_UNPACK: { Tk_Window tkwin2; Packer *packPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; | > | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | slavePtr = slavePtr->nextPtr) { Tcl_ListObjAppendElement(NULL, resultObj, TkNewWindowObj(slavePtr->tkwin)); } Tcl_SetObjResult(interp, resultObj); break; } #ifndef TK_NO_DEPRECATED case PACK_UNPACK: { Tk_Window tkwin2; Packer *packPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "window"); return TCL_ERROR; |
︙ | ︙ | |||
477 478 479 480 481 482 483 484 485 486 487 488 489 490 | packPtr->masterPtr->tkwin); } Unlink(packPtr); Tk_UnmapWindow(packPtr->tkwin); } break; } } return TCL_OK; } /* *------------------------------------------------------------------------ | > | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | packPtr->masterPtr->tkwin); } Unlink(packPtr); Tk_UnmapWindow(packPtr->tkwin); } break; } #endif /* !TK_NO_DEPRECATED */ } return TCL_OK; } /* *------------------------------------------------------------------------ |
︙ | ︙ | |||
595 596 597 598 599 600 601 | int borderTop, borderBtm; int borderLeft, borderRight; int maxWidth, maxHeight, tmp; masterPtr->flags &= ~REQUESTED_REPACK; /* | | | > | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | int borderTop, borderBtm; int borderLeft, borderRight; int maxWidth, maxHeight, tmp; masterPtr->flags &= ~REQUESTED_REPACK; /* * If the master has no slaves anymore, then leave the master's size as-is. * Otherwise there is no way to "relinquish" control over the master * so another geometry manager can take over. */ if (masterPtr->slavePtr == NULL) { return; } /* |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | * Side effects: * The geometry of the specified windows may change, both now and again * in the future. * *------------------------------------------------------------------------ */ static int PackAfter( Tcl_Interp *interp, /* Interpreter for error reporting. */ Packer *prevPtr, /* Pack windows in argv just after this * window; NULL means pack as first child of * masterPtr. */ Packer *masterPtr, /* Master in which to pack windows. */ | > | 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 | * Side effects: * The geometry of the specified windows may change, both now and again * in the future. * *------------------------------------------------------------------------ */ #ifndef TK_NO_DEPRECATED static int PackAfter( Tcl_Interp *interp, /* Interpreter for error reporting. */ Packer *prevPtr, /* Pack windows in argv just after this * window; NULL means pack as first child of * masterPtr. */ Packer *masterPtr, /* Master in which to pack windows. */ |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 | packPtr->padX = packPtr->padY = 0; packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; | > | < | 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 | packPtr->padX = packPtr->padY = 0; packPtr->padLeft = packPtr->padTop = 0; packPtr->iPadX = packPtr->iPadY = 0; packPtr->flags &= ~(FILLX|FILLY|EXPAND); packPtr->flags |= OLD_STYLE; for (index = 0 ; index < optionCount; index++) { Tcl_Obj *curOptPtr = options[index]; TkSizeT length; const char *curOpt = TkGetStringFromObj(curOptPtr, &length); c = curOpt[0]; if ((c == 't') && (strncmp(curOpt, "top", length)) == 0) { packPtr->side = TOP; } else if ((c == 'b') |
︙ | ︙ | |||
1223 1224 1225 1226 1227 1228 1229 | return TCL_ERROR; } packPtr->padY /= 2; packPtr->padTop /= 2; packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) | | | 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 | return TCL_ERROR; } packPtr->padY /= 2; packPtr->padTop /= 2; packPtr->iPadY = 0; index++; } else if ((c == 'f') && (length > 1) && (strncmp(curOpt, "frame", length) == 0)) { if (optionCount < (index+2)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "wrong # args: \"frame\"" " option must be followed by anchor point", -1)); Tcl_SetErrorCode(interp, "TK", "OLDPACK", "BAD_PARAMETER", NULL); return TCL_ERROR; |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 | } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, masterPtr); } return TCL_OK; } /* *---------------------------------------------------------------------- * * Unlink -- * * Remove a packer from its master's list of slaves. | > | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 | } if (!(masterPtr->flags & REQUESTED_REPACK)) { masterPtr->flags |= REQUESTED_REPACK; Tcl_DoWhenIdle(ArrangePacking, masterPtr); } return TCL_OK; } #endif /* !TK_NO_DEPRECATED */ /* *---------------------------------------------------------------------- * * Unlink -- * * Remove a packer from its master's list of slaves. |
︙ | ︙ | |||
1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 | } packPtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "pack"); masterPtr->flags &= ~ALLOCED_MASTER; } } /* *---------------------------------------------------------------------- * | > > > > | 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | } packPtr->masterPtr = NULL; /* * If we have emptied this master from slaves it means we are no longer * handling it and should mark it as free. * * Send the event "NoManagedChild" to the master to inform it about there * being no managed children inside it. */ if ((masterPtr->slavePtr == NULL) && (masterPtr->flags & ALLOCED_MASTER)) { TkFreeGeometryMaster(masterPtr->tkwin, "pack"); masterPtr->flags &= ~ALLOCED_MASTER; TkSendVirtualEvent(masterPtr->tkwin, "NoManagedChild", NULL); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1452 1453 1454 1455 1456 1457 1458 | nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } if (packPtr->tkwin != NULL) { TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr; Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable, | | | 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 | nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } if (packPtr->tkwin != NULL) { TkDisplay *dispPtr = ((TkWindow *) packPtr->tkwin)->dispPtr; Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->packerHashTable, packPtr->tkwin)); } if (packPtr->flags & REQUESTED_REPACK) { Tcl_CancelIdleCall(ArrangePacking, packPtr); } packPtr->tkwin = NULL; Tcl_EventuallyFree(packPtr, (Tcl_FreeProc *) DestroyPacker); |
︙ | ︙ | |||
1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; Tk_Window other, slave, parent, ancestor; int i, j, numWindows, tmp, positionGiven; const char *string; static const char *const optionStrings[] = { "-after", "-anchor", "-before", "-expand", "-fill", "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL }; enum options { CONF_AFTER, CONF_ANCHOR, CONF_BEFORE, CONF_EXPAND, CONF_FILL, | > | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | Tcl_Obj *const objv[]) /* Argument objects: contains one or more * window names followed by any number of * "option value" pairs. Caller must make sure * that there is at least one window name. */ { Packer *masterPtr, *slavePtr, *prevPtr, *otherPtr; Tk_Window other, slave, parent, ancestor; TkWindow *master; int i, j, numWindows, tmp, positionGiven; const char *string; static const char *const optionStrings[] = { "-after", "-anchor", "-before", "-expand", "-fill", "-in", "-ipadx", "-ipady", "-padx", "-pady", "-side", NULL }; enum options { CONF_AFTER, CONF_ANCHOR, CONF_BEFORE, CONF_EXPAND, CONF_FILL, |
︙ | ︙ | |||
1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | } if (slave == masterPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside itself", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } /* * Unpack the slave if it's currently packed, then position it after * prevPtr. */ if (slavePtr->masterPtr != NULL) { | > > > > > > > > > > > > > > > > > > | 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | } if (slave == masterPtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't pack %s inside itself", Tcl_GetString(objv[j]))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "SELF", NULL); return TCL_ERROR; } /* * Check for management loops. */ for (master = (TkWindow *)masterPtr->tkwin; master != NULL; master = (TkWindow *)TkGetGeomMaster(master)) { if (master == (TkWindow *)slave) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", Tcl_GetString(objv[j]), Tk_PathName(masterPtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); return TCL_ERROR; } } if (masterPtr->tkwin != Tk_Parent(slave)) { ((TkWindow *)slave)->maintainerPtr = (TkWindow *)masterPtr->tkwin; } /* * Unpack the slave if it's currently packed, then position it after * prevPtr. */ if (slavePtr->masterPtr != NULL) { |
︙ | ︙ |
Changes to generic/tkPanedWindow.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1997 Sun Microsystems, Inc. * Copyright (c) 2000 Ajuba Solutions. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "default.h" /* * Flag values for "sticky"ness. The 16 combinations subsume the packer's * notion of anchor and fill. * * STICK_NORTH This window sticks to the top of its cavity. * STICK_EAST This window sticks to the right edge of its cavity. |
︙ | ︙ | |||
232 233 234 235 236 237 238 | static void RestoreSticky(ClientData clientData, Tk_Window tkwin, char *internalPtr, char *oldInternalPtr); static void AdjustForSticky(int sticky, int cavityWidth, int cavityHeight, int *xPtr, int *yPtr, int *slaveWidthPtr, int *slaveHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | static void RestoreSticky(ClientData clientData, Tk_Window tkwin, char *internalPtr, char *oldInternalPtr); static void AdjustForSticky(int sticky, int cavityWidth, int cavityHeight, int *xPtr, int *yPtr, int *slaveWidthPtr, int *slaveHeightPtr); static void MoveSash(PanedWindow *pwPtr, int sash, int diff); static int ObjectIsEmpty(Tcl_Obj *objPtr); static void * ComputeSlotAddress(void *recordPtr, size_t offset); static int PanedWindowIdentifyCoords(PanedWindow *pwPtr, Tcl_Interp *interp, int x, int y); /* * Sashes are between panes only, so there is one less sash than slaves */ |
︙ | ︙ | |||
271 272 273 274 275 276 277 | RestoreSticky, /* restoreProc */ NULL, /* freeProc */ 0 }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | RestoreSticky, /* restoreProc */ NULL, /* freeProc */ 0 }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", DEF_PANEDWINDOW_BG_COLOR, -1, offsetof(PanedWindow, background), 0, DEF_PANEDWINDOW_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_PANEDWINDOW_BORDERWIDTH, -1, offsetof(PanedWindow, borderWidth), 0, 0, GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_PANEDWINDOW_CURSOR, -1, offsetof(PanedWindow, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-handlepad", "handlePad", "HandlePad", DEF_PANEDWINDOW_HANDLEPAD, -1, offsetof(PanedWindow, handlePad), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-handlesize", "handleSize", "HandleSize", DEF_PANEDWINDOW_HANDLESIZE, offsetof(PanedWindow, handleSizePtr), offsetof(PanedWindow, handleSize), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_PANEDWINDOW_HEIGHT, offsetof(PanedWindow, heightPtr), offsetof(PanedWindow, height), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-opaqueresize", "opaqueResize", "OpaqueResize", DEF_PANEDWINDOW_OPAQUERESIZE, -1, offsetof(PanedWindow, resizeOpaque), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", DEF_PANEDWINDOW_ORIENT, -1, offsetof(PanedWindow, orient), 0, orientStrings, GEOMETRY}, {TK_OPTION_BORDER, "-proxybackground", "proxyBackground", "ProxyBackground", 0, -1, offsetof(PanedWindow, proxyBackground), TK_OPTION_NULL_OK, (ClientData) DEF_PANEDWINDOW_BG_MONO}, {TK_OPTION_PIXELS, "-proxyborderwidth", "proxyBorderWidth", "ProxyBorderWidth", DEF_PANEDWINDOW_PROXYBORDER, offsetof(PanedWindow, proxyBorderWidthPtr), offsetof(PanedWindow, proxyBorderWidth), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-proxyrelief", "proxyRelief", "Relief", 0, -1, offsetof(PanedWindow, proxyRelief), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_PANEDWINDOW_RELIEF, -1, offsetof(PanedWindow, relief), 0, 0, 0}, {TK_OPTION_CURSOR, "-sashcursor", "sashCursor", "Cursor", DEF_PANEDWINDOW_SASHCURSOR, -1, offsetof(PanedWindow, sashCursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-sashpad", "sashPad", "SashPad", DEF_PANEDWINDOW_SASHPAD, -1, offsetof(PanedWindow, sashPad), 0, 0, GEOMETRY}, {TK_OPTION_RELIEF, "-sashrelief", "sashRelief", "Relief", DEF_PANEDWINDOW_SASHRELIEF, -1, offsetof(PanedWindow, sashRelief), 0, 0, 0}, {TK_OPTION_PIXELS, "-sashwidth", "sashWidth", "Width", DEF_PANEDWINDOW_SASHWIDTH, offsetof(PanedWindow, sashWidthPtr), offsetof(PanedWindow, sashWidth), 0, 0, GEOMETRY}, {TK_OPTION_BOOLEAN, "-showhandle", "showHandle", "ShowHandle", DEF_PANEDWINDOW_SHOWHANDLE, -1, offsetof(PanedWindow, showHandle), 0, 0, GEOMETRY}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_PANEDWINDOW_WIDTH, offsetof(PanedWindow, widthPtr), offsetof(PanedWindow, width), TK_OPTION_NULL_OK, 0, GEOMETRY}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; static const Tk_OptionSpec slaveOptionSpecs[] = { {TK_OPTION_WINDOW, "-after", NULL, NULL, DEF_PANEDWINDOW_PANE_AFTER, -1, offsetof(Slave, after), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-before", NULL, NULL, DEF_PANEDWINDOW_PANE_BEFORE, -1, offsetof(Slave, before), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, DEF_PANEDWINDOW_PANE_HEIGHT, offsetof(Slave, heightPtr), offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-hide", "hide", "Hide", DEF_PANEDWINDOW_PANE_HIDE, -1, offsetof(Slave, hide), 0,0,GEOMETRY}, {TK_OPTION_PIXELS, "-minsize", NULL, NULL, DEF_PANEDWINDOW_PANE_MINSIZE, -1, offsetof(Slave, minSize), 0, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, DEF_PANEDWINDOW_PANE_PADX, -1, offsetof(Slave, padx), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, DEF_PANEDWINDOW_PANE_PADY, -1, offsetof(Slave, pady), 0, 0, 0}, {TK_OPTION_CUSTOM, "-sticky", NULL, NULL, DEF_PANEDWINDOW_PANE_STICKY, -1, offsetof(Slave, sticky), 0, &stickyOption, 0}, {TK_OPTION_STRING_TABLE, "-stretch", "stretch", "Stretch", DEF_PANEDWINDOW_PANE_STRETCH, -1, offsetof(Slave, stretch), 0, (ClientData) stretchStrings, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, DEF_PANEDWINDOW_PANE_WIDTH, offsetof(Slave, widthPtr), offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* *-------------------------------------------------------------- * * Tk_PanedWindowObjCmd -- |
︙ | ︙ | |||
455 456 457 458 459 460 461 | /* * Keep a hold of the associated tkwin until we destroy the widget, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(pwPtr->tkwin); | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | /* * Keep a hold of the associated tkwin until we destroy the widget, * otherwise Tk might free it while we still need it. */ Tcl_Preserve(pwPtr->tkwin); if (Tk_InitOptions(interp, pwPtr, pwOpts->pwOptions, tkwin) != TCL_OK) { Tk_DestroyWindow(pwPtr->tkwin); return TCL_ERROR; } Tk_CreateEventHandler(pwPtr->tkwin, ExposureMask|StructureNotifyMask, PanedWindowEventProc, pwPtr); |
︙ | ︙ | |||
574 575 576 577 578 579 580 | case PW_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; break; } | | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | case PW_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; break; } resultObj = Tk_GetOptionValue(interp, pwPtr, pwPtr->optionTable, objv[2], pwPtr->tkwin); if (resultObj == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObj); } break; case PW_CONFIGURE: resultObj = NULL; if (objc <= 3) { resultObj = Tk_GetOptionInfo(interp, pwPtr, pwPtr->optionTable, (objc == 3) ? objv[2] : NULL, pwPtr->tkwin); if (resultObj == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObj); } |
︙ | ︙ | |||
665 666 667 668 669 670 671 | result = TCL_ERROR; break; } resultObj = NULL; for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionValue(interp, | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | result = TCL_ERROR; break; } resultObj = NULL; for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionValue(interp, pwPtr->slaves[i], pwPtr->slaveOpts, objv[3], tkwin); } } if (resultObj == NULL) { if (i == pwPtr->numSlaves) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "not managed by this window", -1)); |
︙ | ︙ | |||
705 706 707 708 709 710 711 | result = TCL_ERROR; break; } for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionInfo(interp, | | | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | result = TCL_ERROR; break; } for (i = 0; i < pwPtr->numSlaves; i++) { if (pwPtr->slaves[i]->tkwin == tkwin) { resultObj = Tk_GetOptionInfo(interp, pwPtr->slaves[i], pwPtr->slaveOpts, (objc == 4) ? objv[3] : NULL, pwPtr->tkwin); if (resultObj == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObj); } |
︙ | ︙ | |||
844 845 846 847 848 849 850 | * Pre-parse the configuration options, to get the before/after specifiers * into an easy-to-find location (a local variable). Also, check the * return from Tk_SetOptions once, here, so we can save a little bit of * extra testing in the for loop below. */ memset((void *)&options, 0, sizeof(Slave)); | | | 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | * Pre-parse the configuration options, to get the before/after specifiers * into an easy-to-find location (a local variable). Also, check the * return from Tk_SetOptions once, here, so we can save a little bit of * extra testing in the for loop below. */ memset((void *)&options, 0, sizeof(Slave)); if (Tk_SetOptions(interp, &options, pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } /* * If either -after or -before was given, find the numerical index that |
︙ | ︙ | |||
921 922 923 924 925 926 927 | tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i + 2]), pwPtr->tkwin); found = 0; for (j = 0; j < pwPtr->numSlaves; j++) { if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) { | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i + 2]), pwPtr->tkwin); found = 0; for (j = 0; j < pwPtr->numSlaves; j++) { if (pwPtr->slaves[j] != NULL && pwPtr->slaves[j]->tkwin == tkwin) { Tk_SetOptions(interp, pwPtr->slaves[j], pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); if (pwPtr->slaves[j]->minSize < 0) { pwPtr->slaves[j]->minSize = 0; } found = 1; |
︙ | ︙ | |||
968 969 970 971 972 973 974 | /* * Create a new slave structure and initialize it. All slaves start * out with their "natural" dimensions. */ slavePtr = ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); | | | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 | /* * Create a new slave structure and initialize it. All slaves start * out with their "natural" dimensions. */ slavePtr = ckalloc(sizeof(Slave)); memset(slavePtr, 0, sizeof(Slave)); Tk_InitOptions(interp, slavePtr, pwPtr->slaveOpts, pwPtr->tkwin); Tk_SetOptions(interp, slavePtr, pwPtr->slaveOpts, objc - firstOptionArg, objv + firstOptionArg, pwPtr->tkwin, NULL, NULL); slavePtr->tkwin = tkwin; slavePtr->masterPtr = pwPtr; doubleBw = 2 * Tk_Changes(slavePtr->tkwin)->border_width; if (slavePtr->width > 0) { slavePtr->paneWidth = slavePtr->width; |
︙ | ︙ | |||
1007 1008 1009 1010 1011 1012 1013 | /* * Allocate the new slaves array, then copy the slaves into it, in order. */ i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves); newSlaves = ckalloc(i); | | | 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 | /* * Allocate the new slaves array, then copy the slaves into it, in order. */ i = sizeof(Slave *) * (pwPtr->numSlaves + numNewSlaves); newSlaves = ckalloc(i); memset(newSlaves, 0, i); if (index == -1) { /* * If none of the existing slaves have to be moved, just copy the old * and append the new. */ memcpy((void *)&(newSlaves[0]), pwPtr->slaves, sizeof(Slave *) * pwPtr->numSlaves); |
︙ | ︙ | |||
1128 1129 1130 1131 1132 1133 1134 | Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid sash index", -1)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } slavePtr = pwPtr->slaves[sash]; | | | | 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 | Tcl_SetObjResult(interp, Tcl_NewStringObj( "invalid sash index", -1)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SASH_INDEX", NULL); return TCL_ERROR; } slavePtr = pwPtr->slaves[sash]; coords[0] = Tcl_NewWideIntObj(slavePtr->sashx); coords[1] = Tcl_NewWideIntObj(slavePtr->sashy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; case SASH_MARK: if (objc != 6 && objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "index ?x y?"); return TCL_ERROR; |
︙ | ︙ | |||
1162 1163 1164 1165 1166 1167 1168 | if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) { return TCL_ERROR; } pwPtr->slaves[sash]->markx = x; pwPtr->slaves[sash]->marky = y; } else { | | | | 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 | if (Tcl_GetIntFromObj(interp, objv[5], &y) != TCL_OK) { return TCL_ERROR; } pwPtr->slaves[sash]->markx = x; pwPtr->slaves[sash]->marky = y; } else { coords[0] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->markx); coords[1] = Tcl_NewWideIntObj(pwPtr->slaves[sash]->marky); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); } break; case SASH_DRAGTO: case SASH_PLACE: if (objc != 6) { |
︙ | ︙ | |||
1245 1246 1247 1248 1249 1250 1251 | PanedWindow *pwPtr, /* Information about widget. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; int typemask = 0; | | | 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 | PanedWindow *pwPtr, /* Information about widget. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_SavedOptions savedOptions; int typemask = 0; if (Tk_SetOptions(interp, pwPtr, pwPtr->optionTable, objc, objv, pwPtr->tkwin, &savedOptions, &typemask) != TCL_OK) { Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } Tk_FreeSavedOptions(&savedOptions); |
︙ | ︙ | |||
1480 1481 1482 1483 1484 1485 1486 | /* * Set up boilerplate geometry values for sashes (width, height, common * coordinates). */ if (horizontal) { | | | | 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 | /* * Set up boilerplate geometry values for sashes (width, height, common * coordinates). */ if (horizontal) { sashHeight = Tk_Height(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashWidth = pwPtr->sashWidth; } else { sashWidth = Tk_Width(tkwin) - (2 * Tk_InternalBorderLeft(tkwin)); sashHeight = pwPtr->sashWidth; } /* * Draw the sashes. */ |
︙ | ︙ | |||
1750 1751 1752 1753 1754 1755 1756 | GetFirstLastVisiblePane(pwPtr, &first, &last); /* * First pass; compute sizes */ paneDynSize = paneDynMinSize = 0; | | | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 | GetFirstLastVisiblePane(pwPtr, &first, &last); /* * First pass; compute sizes */ paneDynSize = paneDynMinSize = 0; internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW); pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW); x = y = internalBW; stretchReserve = (horizontal ? pwWidth : pwHeight); /* * Calculate the sash width, including handle and padding, and the sash |
︙ | ︙ | |||
2196 2197 2198 2199 2200 2201 2202 | int sashWidth, sashOffset, handleOffset; int reqWidth, reqHeight, dim; Slave *slavePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags |= REQUESTED_RELAYOUT; | | | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 | int sashWidth, sashOffset, handleOffset; int reqWidth, reqHeight, dim; Slave *slavePtr; const int horizontal = (pwPtr->orient == ORIENT_HORIZONTAL); pwPtr->flags |= REQUESTED_RELAYOUT; x = y = internalBw = Tk_InternalBorderLeft(pwPtr->tkwin); reqWidth = reqHeight = 0; /* * Sashes and handles share space on the display. To simplify processing * below, precompute the x and y offsets of the handles and sashes within * the space occupied by their combination; later, just add those offsets * blindly (avoiding the extra showHandle, etc, checks). |
︙ | ︙ | |||
2451 2452 2453 2454 2455 2456 2457 | char *recordPtr, /* Pointer to storage for the widget record. */ int internalOffset, /* Offset within *recordPtr at which the * internal value is to be stored. */ char *oldInternalPtr, /* Pointer to storage for the old value. */ int flags) /* Flags for the option, set Tk_SetOptions. */ { int sticky = 0; | > | | 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 | char *recordPtr, /* Pointer to storage for the widget record. */ int internalOffset, /* Offset within *recordPtr at which the * internal value is to be stored. */ char *oldInternalPtr, /* Pointer to storage for the old value. */ int flags) /* Flags for the option, set Tk_SetOptions. */ { int sticky = 0; char c; void *internalPtr; const char *string; internalPtr = ComputeSlotAddress(recordPtr, internalOffset); if (flags & TK_OPTION_NULL_OK && ObjectIsEmpty(*value)) { *value = NULL; } else { |
︙ | ︙ | |||
2872 2873 2874 2875 2876 2877 2878 | switch ((enum options) index) { case PROXY_COORD: if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } | | | | 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 | switch ((enum options) index) { case PROXY_COORD: if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } coords[0] = Tcl_NewWideIntObj(pwPtr->proxyx); coords[1] = Tcl_NewWideIntObj(pwPtr->proxyy); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; case PROXY_FORGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; |
︙ | ︙ | |||
2902 2903 2904 2905 2906 2907 2908 | return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) { return TCL_ERROR; } | | | | | | | 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 | return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK) { return TCL_ERROR; } internalBW = Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->orient == ORIENT_HORIZONTAL) { if (x < 0) { x = 0; } pwWidth = Tk_Width(pwPtr->tkwin) - (2 * internalBW); if (x > pwWidth) { x = pwWidth; } y = Tk_InternalBorderLeft(pwPtr->tkwin); sashWidth = pwPtr->sashWidth; sashHeight = Tk_Height(pwPtr->tkwin) - (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } else { if (y < 0) { y = 0; } pwHeight = Tk_Height(pwPtr->tkwin) - (2 * internalBW); if (y > pwHeight) { y = pwHeight; } x = Tk_InternalBorderLeft(pwPtr->tkwin); sashHeight = pwPtr->sashWidth; sashWidth = Tk_Width(pwPtr->tkwin) - (2 * Tk_InternalBorderLeft(pwPtr->tkwin)); } if (sashWidth < 1) { sashWidth = 1; } if (sashHeight < 1) { sashHeight = 1; |
︙ | ︙ | |||
3015 3016 3017 3018 3019 3020 3021 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | | | 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static void * ComputeSlotAddress( void *recordPtr, /* Pointer to the start of a record. */ size_t offset) /* Offset of a slot within that record; may be -1. */ { if (offset != (size_t)-1) { return (char *)recordPtr + offset; } else { return NULL; } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3062 3063 3064 3065 3066 3067 3068 | if (pwPtr->orient == ORIENT_HORIZONTAL) { if (Tk_IsMapped(pwPtr->tkwin)) { sashHeight = Tk_Height(pwPtr->tkwin); } else { sashHeight = Tk_ReqHeight(pwPtr->tkwin); } | | | 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 | if (pwPtr->orient == ORIENT_HORIZONTAL) { if (Tk_IsMapped(pwPtr->tkwin)) { sashHeight = Tk_Height(pwPtr->tkwin); } else { sashHeight = Tk_ReqHeight(pwPtr->tkwin); } sashHeight -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); if (pwPtr->showHandle && pwPtr->handleSize > pwPtr->sashWidth) { sashWidth = pwPtr->handleSize; lpad = (pwPtr->handleSize - pwPtr->sashWidth) / 2; rpad = pwPtr->handleSize - lpad; lpad += pwPtr->sashPad; rpad += pwPtr->sashPad; } else { |
︙ | ︙ | |||
3090 3091 3092 3093 3094 3095 3096 | tpad = bpad = pwPtr->sashPad; } if (Tk_IsMapped(pwPtr->tkwin)) { sashWidth = Tk_Width(pwPtr->tkwin); } else { sashWidth = Tk_ReqWidth(pwPtr->tkwin); } | | | 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 | tpad = bpad = pwPtr->sashPad; } if (Tk_IsMapped(pwPtr->tkwin)) { sashWidth = Tk_Width(pwPtr->tkwin); } else { sashWidth = Tk_ReqWidth(pwPtr->tkwin); } sashWidth -= 2 * Tk_InternalBorderLeft(pwPtr->tkwin); lpad = rpad = 0; } GetFirstLastVisiblePane(pwPtr, &first, &last); isHandle = 0; found = -1; for (i = 0; i < pwPtr->numSlaves - 1; i++) { |
︙ | ︙ | |||
3137 3138 3139 3140 3141 3142 3143 | * Set results. Note that the empty string is the default (this function * is called inside the implementation of a command). */ if (found != -1) { Tcl_Obj *list[2]; | | | 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 | * Set results. Note that the empty string is the default (this function * is called inside the implementation of a command). */ if (found != -1) { Tcl_Obj *list[2]; list[0] = Tcl_NewWideIntObj(found); list[1] = Tcl_NewStringObj((isHandle ? "handle" : "sash"), -1); Tcl_SetObjResult(interp, Tcl_NewListObj(2, list)); } return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Added generic/tkPkgConfig.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /* * tkPkgConfig.c -- * * This file contains the configuration information to embed into the tcl * binary library. * * Copyright (c) 2002 Andreas Kupries <[email protected]> * Copyright (c) 2017 Stuart Cassoff <[email protected]> * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ /* Note, the definitions in this module are influenced by the following C * preprocessor macros: * * OSCMa = shortcut for "old style configuration macro activates" * NSCMdt = shortcut for "new style configuration macro declares that" * * - TCL_THREADS OSCMa compilation as threaded. * - TCL_MEM_DEBUG OSCMa memory debugging. * * - TCL_CFG_DO64BIT NSCMdt tk is compiled for a 64bit system. * - NDEBUG NSCMdt tk is compiled with symbol info off. * - TCL_CFG_OPTIMIZED NSCMdt tk is compiled with cc optimizations on * - TCL_CFG_PROFILED NSCMdt tk is compiled with profiling info. * * - _WIN32 || __CYGWIN__ The value for the fontsytem key will be * MAC_OSX_TK chosen based on these macros/defines. * HAVE_XFT NSCMdt xft font support was requested. * * - CFG_RUNTIME_* Paths to various stuff at runtime. * - CFG_INSTALL_* Paths to various stuff at installation time. * * - TCL_CFGVAL_ENCODING string containing the encoding used for the * configuration values. */ #include "tkInt.h" #ifndef TCL_CFGVAL_ENCODING #define TCL_CFGVAL_ENCODING "ascii" #endif /* * Use C preprocessor statements to define the various values for the embedded * configuration information. */ #ifdef TCL_THREADS # define CFG_THREADED "1" #else # define CFG_THREADED "0" #endif #ifdef TCL_MEM_DEBUG # define CFG_MEMDEBUG "1" #else # define CFG_MEMDEBUG "0" #endif #ifdef TCL_CFG_DO64BIT # define CFG_64 "1" #else # define CFG_64 "0" #endif #ifndef NDEBUG # define CFG_DEBUG "1" #else # define CFG_DEBUG "0" #endif #ifdef TCL_CFG_OPTIMIZED # define CFG_OPTIMIZED "1" #else # define CFG_OPTIMIZED "0" #endif #ifdef TCL_CFG_PROFILED # define CFG_PROFILED "1" #else # define CFG_PROFILED "0" #endif #if defined(_WIN32) || defined(__CYGWIN__) # define CFG_FONTSYSTEM "gdi" #elif defined(MAC_OSX_TK) # define CFG_FONTSYSTEM "cocoa" #elif defined(HAVE_XFT) # define CFG_FONTSYSTEM "xft" #else # define CFG_FONTSYSTEM "x11" #endif static Tcl_Config const cfg[] = { {"debug", CFG_DEBUG}, {"threaded", CFG_THREADED}, {"profiled", CFG_PROFILED}, {"64bit", CFG_64}, {"optimized", CFG_OPTIMIZED}, {"mem_debug", CFG_MEMDEBUG}, {"fontsystem", CFG_FONTSYSTEM}, /* Runtime paths to various stuff */ #ifdef CFG_RUNTIME_LIBDIR {"libdir,runtime", CFG_RUNTIME_LIBDIR}, #endif #ifdef CFG_RUNTIME_BINDIR {"bindir,runtime", CFG_RUNTIME_BINDIR}, #endif #ifdef CFG_RUNTIME_SCRDIR {"scriptdir,runtime", CFG_RUNTIME_SCRDIR}, #endif #ifdef CFG_RUNTIME_INCDIR {"includedir,runtime", CFG_RUNTIME_INCDIR}, #endif #ifdef CFG_RUNTIME_DOCDIR {"docdir,runtime", CFG_RUNTIME_DOCDIR}, #endif #ifdef CFG_RUNTIME_DEMODIR {"demodir,runtime", CFG_RUNTIME_DEMODIR}, #endif /* Installation paths to various stuff */ #ifdef CFG_INSTALL_LIBDIR {"libdir,install", CFG_INSTALL_LIBDIR}, #endif #ifdef CFG_INSTALL_BINDIR {"bindir,install", CFG_INSTALL_BINDIR}, #endif #ifdef CFG_INSTALL_SCRDIR {"scriptdir,install", CFG_INSTALL_SCRDIR}, #endif #ifdef CFG_INSTALL_INCDIR {"includedir,install", CFG_INSTALL_INCDIR}, #endif #ifdef CFG_INSTALL_DOCDIR {"docdir,install", CFG_INSTALL_DOCDIR}, #endif #ifdef CFG_INSTALL_DEMODIR {"demodir,install", CFG_INSTALL_DEMODIR}, #endif /* Last entry, closes the array */ {NULL, NULL} }; void TkInitEmbeddedConfigurationInformation( Tcl_Interp *interp) /* Interpreter the configuration command is * registered in. */ { Tcl_RegisterConfig(interp, "tk", cfg, TCL_CFGVAL_ENCODING); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkPlace.c.
︙ | ︙ | |||
78 79 80 81 82 83 84 | * Type masks for options: */ #define IN_MASK 1 static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, | | | | | | | | | | | | | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | * Type masks for options: */ #define IN_MASK 1 static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", NULL, NULL, "nw", -1, offsetof(Slave, anchor), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-bordermode", NULL, NULL, "inside", -1, offsetof(Slave, borderMode), 0, borderModeStrings, 0}, {TK_OPTION_PIXELS, "-height", NULL, NULL, "", offsetof(Slave, heightPtr), offsetof(Slave, height), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_WINDOW, "-in", NULL, NULL, "", -1, offsetof(Slave, inTkwin), 0, 0, IN_MASK}, {TK_OPTION_DOUBLE, "-relheight", NULL, NULL, "", offsetof(Slave, relHeightPtr), offsetof(Slave, relHeight), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relwidth", NULL, NULL, "", offsetof(Slave, relWidthPtr), offsetof(Slave, relWidth), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-relx", NULL, NULL, "0", -1, offsetof(Slave, relX), 0, 0, 0}, {TK_OPTION_DOUBLE, "-rely", NULL, NULL, "0", -1, offsetof(Slave, relY), 0, 0, 0}, {TK_OPTION_PIXELS, "-width", NULL, NULL, "", offsetof(Slave, widthPtr), offsetof(Slave, width), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-x", NULL, NULL, "0", offsetof(Slave, xPtr), offsetof(Slave, x), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-y", NULL, NULL, "0", offsetof(Slave, yPtr), offsetof(Slave, y), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * Flag definitions for Slave structures: * * CHILD_WIDTH - 1 means -width was specified; |
︙ | ︙ | |||
286 287 288 289 290 291 292 | if (objc == 3 || objc == 4) { Tcl_Obj *objPtr; slavePtr = FindSlave(tkwin); if (slavePtr == NULL) { return TCL_OK; } | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | if (objc == 3 || objc == 4) { Tcl_Obj *objPtr; slavePtr = FindSlave(tkwin); if (slavePtr == NULL) { return TCL_OK; } objPtr = Tk_GetOptionInfo(interp, slavePtr, optionTable, (objc == 4) ? objv[3] : NULL, tkwin); if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } |
︙ | ︙ | |||
311 312 313 314 315 316 317 | } if ((slavePtr->masterPtr != NULL) && (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); } UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | } if ((slavePtr->masterPtr != NULL) && (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin))) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); } UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, slavePtr); Tk_ManageGeometry(tkwin, NULL, NULL); Tk_UnmapWindow(tkwin); FreeSlave(slavePtr); break; |
︙ | ︙ | |||
451 452 453 454 455 456 457 | static Slave * FindSlave( Tk_Window tkwin) /* Token for desired slave. */ { register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | static Slave * FindSlave( Tk_Window tkwin) /* Token for desired slave. */ { register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin); if (hPtr == NULL) { return NULL; } return Tcl_GetHashValue(hPtr); } /* |
︙ | ︙ | |||
574 575 576 577 578 579 580 | static Master * FindMaster( Tk_Window tkwin) /* Token for desired master. */ { register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | static Master * FindMaster( Tk_Window tkwin) /* Token for desired master. */ { register Tcl_HashEntry *hPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; hPtr = Tcl_FindHashEntry(&dispPtr->masterTable, tkwin); if (hPtr == NULL) { return NULL; } return Tcl_GetHashValue(hPtr); } /* |
︙ | ︙ | |||
612 613 614 615 616 617 618 | int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { register Master *masterPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; | | > | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | int objc, /* Number of config arguments. */ Tcl_Obj *const objv[]) /* Object values for arguments. */ { register Master *masterPtr; Tk_SavedOptions savedOptions; int mask; Slave *slavePtr; Tk_Window masterWin = NULL; TkWindow *master; if (Tk_TopWinHierarchy(tkwin)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use placer on top-level window \"%s\"; use " "wm command instead", Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "TOPLEVEL", NULL); return TCL_ERROR; } slavePtr = CreateSlave(tkwin, table); if (Tk_SetOptions(interp, slavePtr, table, objc, objv, slavePtr->tkwin, &savedOptions, &mask) != TCL_OK) { goto error; } /* * Set slave flags. First clear the field, then add bits as needed. */ |
︙ | ︙ | |||
690 691 692 693 694 695 696 697 698 699 700 701 702 703 | if (slavePtr->tkwin == tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", Tk_PathName(slavePtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } if ((slavePtr->masterPtr != NULL) && (slavePtr->masterPtr->tkwin == tkwin)) { /* * Re-using same old master. Nothing to do. */ masterPtr = slavePtr->masterPtr; | > > > > > > > > > > > > > > > > > > > | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | if (slavePtr->tkwin == tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't place %s relative to itself", Tk_PathName(slavePtr->tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } /* * Check for management loops. */ for (master = (TkWindow *)tkwin; master != NULL; master = (TkWindow *)TkGetGeomMaster(master)) { if (master == (TkWindow *)slavePtr->tkwin) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't put %s inside %s, would cause management loop", Tk_PathName(slavePtr->tkwin), Tk_PathName(tkwin))); Tcl_SetErrorCode(interp, "TK", "GEOMETRY", "LOOP", NULL); goto error; } } if (tkwin != Tk_Parent(slavePtr->tkwin)) { ((TkWindow *)slavePtr->tkwin)->maintainerPtr = (TkWindow *)tkwin; } if ((slavePtr->masterPtr != NULL) && (slavePtr->masterPtr->tkwin == tkwin)) { /* * Re-using same old master. Nothing to do. */ masterPtr = slavePtr->masterPtr; |
︙ | ︙ | |||
1080 1081 1082 1083 1084 1085 1086 | for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = nextPtr) { slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, | | | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 | for (slavePtr = masterPtr->slavePtr; slavePtr != NULL; slavePtr = nextPtr) { slavePtr->masterPtr = NULL; nextPtr = slavePtr->nextPtr; slavePtr->nextPtr = NULL; } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->masterTable, masterPtr->tkwin)); if (masterPtr->flags & PARENT_RECONFIG_PENDING) { Tcl_CancelIdleCall(RecomputePlacement, masterPtr); } masterPtr->tkwin = NULL; if (masterPtr->abortPtr != NULL) { *masterPtr->abortPtr = 1; } |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { if (slavePtr->masterPtr != NULL) { UnlinkSlave(slavePtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, | | | 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 | TkDisplay *dispPtr = ((TkWindow *) slavePtr->tkwin)->dispPtr; if (eventPtr->type == DestroyNotify) { if (slavePtr->masterPtr != NULL) { UnlinkSlave(slavePtr); } Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, slavePtr->tkwin)); FreeSlave(slavePtr); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 | Tk_Window tkwin) /* Window that changed its desired size. */ { Slave *slavePtr = clientData; Master *masterPtr; if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { return; } masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { return; } if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { | > > > > > > | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 | Tk_Window tkwin) /* Window that changed its desired size. */ { Slave *slavePtr = clientData; Master *masterPtr; if ((slavePtr->flags & (CHILD_WIDTH|CHILD_REL_WIDTH)) && (slavePtr->flags & (CHILD_HEIGHT|CHILD_REL_HEIGHT))) { /* * Send a ConfigureNotify to indicate that the size change * request was rejected. */ TkDoConfigureNotify((TkWindow *)(slavePtr->tkwin)); return; } masterPtr = slavePtr->masterPtr; if (masterPtr == NULL) { return; } if (!(masterPtr->flags & PARENT_RECONFIG_PENDING)) { |
︙ | ︙ | |||
1226 1227 1228 1229 1230 1231 1232 | if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); } Tk_UnmapWindow(tkwin); UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, | | | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | if (slavePtr->masterPtr->tkwin != Tk_Parent(slavePtr->tkwin)) { Tk_UnmaintainGeometry(slavePtr->tkwin, slavePtr->masterPtr->tkwin); } Tk_UnmapWindow(tkwin); UnlinkSlave(slavePtr); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->slaveTable, tkwin)); Tk_DeleteEventHandler(tkwin, StructureNotifyMask, SlaveStructureProc, slavePtr); FreeSlave(slavePtr); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkPointer.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #endif #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #define Cursor XCursor #endif | < < < < < < < < < < < < | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #endif #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #define Cursor XCursor #endif typedef struct { TkWindow *grabWinPtr; /* Window that defines the top of the grab * tree in a global grab. */ int lastState; /* Last known state flags. */ XPoint lastPos; /* Last reported mouse position. */ TkWindow *lastWinPtr; /* Last reported mouse window. */ TkWindow *restrictWinPtr; /* Window to which all mouse events will be * reported. */ |
︙ | ︙ | |||
262 263 264 265 266 267 268 | } /* * Generate ButtonPress/ButtonRelease events based on the differences * between the current button state and the last known button state. */ | | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | } /* * Generate ButtonPress/ButtonRelease events based on the differences * between the current button state and the last known button state. */ for (b = Button1; b <= Button9; b++) { mask = TkGetButtonMask(b); if (changes & mask) { if (state & mask) { type = ButtonPress; /* * ButtonPress - Set restrict window if we aren't grabbed, or * if this is the first button down. |
︙ | ︙ |
Changes to generic/tkRectOval.c.
︙ | ︙ | |||
56 57 58 59 60 61 62 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, | | | | | | | | | | | | | | | | | | | | | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | }; static const Tk_CustomOption pixelOption = { TkPixelParseProc, TkPixelPrintProc, NULL }; static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_CUSTOM, "-activedash", NULL, NULL, NULL, offsetof(RectOvalItem, outline.activeDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-activefill", NULL, NULL, NULL, offsetof(RectOvalItem, activeFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-activeoutline", NULL, NULL, NULL, offsetof(RectOvalItem, outline.activeColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activeoutlinestipple", NULL, NULL, NULL, offsetof(RectOvalItem, outline.activeStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-activestipple", NULL, NULL, NULL, offsetof(RectOvalItem, activeFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-activewidth", NULL, NULL, "0.0", offsetof(RectOvalItem, outline.activeWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_CUSTOM, "-dash", NULL, NULL, NULL, offsetof(RectOvalItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, "0", offsetof(RectOvalItem, outline.offset), TK_CONFIG_DONT_SET_DEFAULT, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_COLOR, "-disabledfill", NULL, NULL, NULL, offsetof(RectOvalItem, disabledFillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-disabledoutline", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledoutlinestipple", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_BITMAP, "-disabledstipple", NULL, NULL, NULL, offsetof(RectOvalItem, disabledFillStipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-disabledwidth", NULL, NULL, "0.0", offsetof(RectOvalItem, outline.disabledWidth), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_COLOR, "-fill", NULL, NULL, NULL, offsetof(RectOvalItem, fillColor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-offset", NULL, NULL, "0,0", offsetof(RectOvalItem, tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_COLOR, "-outline", NULL, NULL, "black", offsetof(RectOvalItem, outline.color), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-outlineoffset", NULL, NULL, "0,0", offsetof(RectOvalItem, outline.tsoffset), TK_CONFIG_DONT_SET_DEFAULT, &offsetOption}, {TK_CONFIG_BITMAP, "-outlinestipple", NULL, NULL, NULL, offsetof(RectOvalItem, outline.stipple), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-state", NULL, NULL, NULL, offsetof(Tk_Item, state),TK_CONFIG_NULL_OK, &stateOption}, {TK_CONFIG_BITMAP, "-stipple", NULL, NULL, NULL, offsetof(RectOvalItem, fillStipple),TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_CUSTOM, "-tags", NULL, NULL, NULL, 0, TK_CONFIG_NULL_OK, &tagsOption}, {TK_CONFIG_CUSTOM, "-width", NULL, NULL, "1.0", offsetof(RectOvalItem, outline.width), TK_CONFIG_DONT_SET_DEFAULT, &pixelOption}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Prototypes for functions defined in this file: */ |
︙ | ︙ | |||
144 145 146 147 148 149 150 151 152 153 154 155 156 157 | Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static int RectOvalToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *areaPtr); static double RectToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static void ScaleRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* | > > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | Tk_Item *itemPtr, int objc, Tcl_Obj *const objv[]); static int RectOvalToPostscript(Tcl_Interp *interp, Tk_Canvas canvas, Tk_Item *itemPtr, int prepass); static int RectToArea(Tk_Canvas canvas, Tk_Item *itemPtr, double *areaPtr); static double RectToPoint(Tk_Canvas canvas, Tk_Item *itemPtr, double *pointPtr); static void RotateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double angleRad); static void ScaleRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, double originX, double originY, double scaleX, double scaleY); static void TranslateRectOval(Tk_Canvas canvas, Tk_Item *itemPtr, double deltaX, double deltaY); /* |
︙ | ︙ | |||
176 177 178 179 180 181 182 | TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* icursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateRectOval, /* rotateProc */ 0, NULL, NULL }; Tk_ItemType tkOvalType = { "oval", /* name */ sizeof(RectOvalItem), /* itemSize */ CreateRectOval, /* createProc */ configSpecs, /* configSpecs */ |
︙ | ︙ | |||
200 201 202 203 204 205 206 | TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ | > | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | TranslateRectOval, /* translateProc */ NULL, /* indexProc */ NULL, /* cursorProc */ NULL, /* selectionProc */ NULL, /* insertProc */ NULL, /* dTextProc */ NULL, /* nextPtr */ RotateRectOval, /* rotateProc */ 0, NULL, NULL }; /* *-------------------------------------------------------------- * * CreateRectOval -- * |
︙ | ︙ | |||
511 512 513 514 515 516 517 | mask = GCForeground; } #ifdef MAC_OSX_TK /* * Mac OS X CG drawing needs access to the outline linewidth even for * fills (as linewidth controls antialiasing). */ | < | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | mask = GCForeground; } #ifdef MAC_OSX_TK /* * Mac OS X CG drawing needs access to the outline linewidth even for * fills (as linewidth controls antialiasing). */ gcValues.line_width = rectOvalPtr->outline.gc != NULL ? rectOvalPtr->outline.gc->line_width : 0; mask |= GCLineWidth; #endif newGC = Tk_GetGC(tkwin, mask, &gcValues); } if (rectOvalPtr->fillGC != NULL) { Tk_FreeGC(Tk_Display(tkwin), rectOvalPtr->fillGC); |
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | && ((xDelta2 + yDelta1) < 1.0) && ((xDelta2 + yDelta2) < 1.0)) { return -1; } } return result; } /* *-------------------------------------------------------------- * * ScaleRectOval -- * * This function is invoked to rescale a rectangle or oval item. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 | && ((xDelta2 + yDelta1) < 1.0) && ((xDelta2 + yDelta2) < 1.0)) { return -1; } } return result; } /* *-------------------------------------------------------------- * * RotateRectOval -- * * This function is invoked to rotate a rectangle or oval item's * coordinates. It works by rotating a computed point in the centre of * the bounding box, NOT by rotating the corners of the bounding box. * * Results: * None. * * Side effects: * The position of the rectangle or oval is rotated by angleRad about * (originX, originY), and the bounding box is updated in the generic * part of the item structure. * *-------------------------------------------------------------- */ static void RotateRectOval( Tk_Canvas canvas, /* Canvas containing rectangle. */ Tk_Item *itemPtr, /* Rectangle to be scaled. */ double originX, double originY, /* Origin about which to rotate rect. */ double angleRad) /* Amount to scale in X direction. */ { RectOvalItem *rectOvalPtr = (RectOvalItem *) itemPtr; double newX, newY, oldX, oldY; /* * Compute the centre of the box, then rotate that about the origin. */ newX = oldX = (rectOvalPtr->bbox[0] + rectOvalPtr->bbox[2]) / 2.0; newY = oldY = (rectOvalPtr->bbox[1] + rectOvalPtr->bbox[3]) / 2.0; TkRotatePoint(originX, originY, sin(angleRad), cos(angleRad), &newX, &newY); /* * Apply the translation to the box. */ rectOvalPtr->bbox[0] += newX - oldX; rectOvalPtr->bbox[1] += newY - oldY; rectOvalPtr->bbox[2] += newX - oldX; rectOvalPtr->bbox[3] += newY - oldY; ComputeRectOvalBbox(canvas, rectOvalPtr); } /* *-------------------------------------------------------------- * * ScaleRectOval -- * * This function is invoked to rescale a rectangle or oval item. |
︙ | ︙ |
Changes to generic/tkScale.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ | | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright (c) 1998-2000 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScale.h" #include "default.h" #if defined(_WIN32) #define snprintf _snprintf #endif /* * The following table defines the legal values for the -orient option. It is |
︙ | ︙ | |||
41 42 43 44 45 46 47 | static const char *const stateStrings[] = { "active", "disabled", "normal", NULL }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | static const char *const stateStrings[] = { "active", "disabled", "normal", NULL }; static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCALE_ACTIVE_BG_COLOR, -1, offsetof(TkScale, activeBorder), 0, DEF_SCALE_ACTIVE_BG_MONO, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_SCALE_BG_COLOR, -1, offsetof(TkScale, bgBorder), 0, DEF_SCALE_BG_MONO, 0}, {TK_OPTION_DOUBLE, "-bigincrement", "bigIncrement", "BigIncrement", DEF_SCALE_BIG_INCREMENT, -1, offsetof(TkScale, bigIncrement), 0, 0, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_SCALE_BORDER_WIDTH, -1, offsetof(TkScale, borderWidth), 0, 0, 0}, {TK_OPTION_STRING, "-command", "command", "Command", DEF_SCALE_COMMAND, -1, offsetof(TkScale, command), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_SCALE_CURSOR, -1, offsetof(TkScale, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-digits", "digits", "Digits", DEF_SCALE_DIGITS, -1, offsetof(TkScale, digits), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_SCALE_FONT, -1, offsetof(TkScale, tkfont), 0, 0, 0}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_SCALE_FG_COLOR, -1, offsetof(TkScale, textColorPtr), 0, (ClientData) DEF_SCALE_FG_MONO, 0}, {TK_OPTION_DOUBLE, "-from", "from", "From", DEF_SCALE_FROM, -1, offsetof(TkScale, fromValue), 0, 0, 0}, {TK_OPTION_BORDER, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_SCALE_HIGHLIGHT_BG_COLOR, -1, offsetof(TkScale, highlightBorder), 0, DEF_SCALE_HIGHLIGHT_BG_MONO, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_SCALE_HIGHLIGHT, -1, offsetof(TkScale, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_SCALE_HIGHLIGHT_WIDTH, -1, offsetof(TkScale, highlightWidth), 0, 0, 0}, {TK_OPTION_STRING, "-label", "label", "Label", DEF_SCALE_LABEL, -1, offsetof(TkScale, label), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, -1, offsetof(TkScale, length), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", DEF_SCALE_ORIENT, -1, offsetof(TkScale, orient), 0, orientStrings, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_SCALE_RELIEF, -1, offsetof(TkScale, relief), 0, 0, 0}, {TK_OPTION_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_SCALE_REPEAT_DELAY, -1, offsetof(TkScale, repeatDelay), 0, 0, 0}, {TK_OPTION_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_SCALE_REPEAT_INTERVAL, -1, offsetof(TkScale, repeatInterval), 0, 0, 0}, {TK_OPTION_DOUBLE, "-resolution", "resolution", "Resolution", DEF_SCALE_RESOLUTION, -1, offsetof(TkScale, resolution), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-showvalue", "showValue", "ShowValue", DEF_SCALE_SHOW_VALUE, -1, offsetof(TkScale, showValue), 0, 0, 0}, {TK_OPTION_PIXELS, "-sliderlength", "sliderLength", "SliderLength", DEF_SCALE_SLIDER_LENGTH, -1, offsetof(TkScale, sliderLength), 0, 0, 0}, {TK_OPTION_RELIEF, "-sliderrelief", "sliderRelief", "SliderRelief", DEF_SCALE_SLIDER_RELIEF, -1, offsetof(TkScale, sliderRelief), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_SCALE_STATE, -1, offsetof(TkScale, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_SCALE_TAKE_FOCUS, offsetof(TkScale, takeFocusPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_DOUBLE, "-tickinterval", "tickInterval", "TickInterval", DEF_SCALE_TICK_INTERVAL, -1, offsetof(TkScale, tickInterval), 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", DEF_SCALE_TO, -1, offsetof(TkScale, toValue), 0, 0, 0}, {TK_OPTION_COLOR, "-troughcolor", "troughColor", "Background", DEF_SCALE_TROUGH_COLOR, -1, offsetof(TkScale, troughColorPtr), 0, DEF_SCALE_TROUGH_MONO, 0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", DEF_SCALE_VARIABLE, offsetof(TkScale, varNamePtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", DEF_SCALE_WIDTH, -1, offsetof(TkScale, width), 0, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, 0, 0} }; /* * The following tables define the scale widget commands and map the indexes * into the string tables into a single enumerated type used to dispatch the * scale widget command. |
︙ | ︙ | |||
153 154 155 156 157 158 159 | COMMAND_IDENTIFY, COMMAND_SET }; /* * Forward declarations for procedures defined later in this file: */ | | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | COMMAND_IDENTIFY, COMMAND_SET }; /* * Forward declarations for procedures defined later in this file: */ static void ComputeFormat(TkScale *scalePtr, int forTicks); static void ComputeScaleGeometry(TkScale *scalePtr); static int ConfigureScale(Tcl_Interp *interp, TkScale *scalePtr, int objc, Tcl_Obj *const objv[]); static void DestroyScale(char *memPtr); static double MaxTickRoundingError(TkScale *scalePtr, double tickResolution); static void ScaleCmdDeletedProc(ClientData clientData); static void ScaleEventProc(ClientData clientData, XEvent *eventPtr); static char * ScaleVarProc(ClientData clientData, Tcl_Interp *interp, const char *name1, const char *name2, int flags); static int ScaleWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void ScaleWorldChanged(ClientData instanceData); static void ScaleSetVariable(TkScale *scalePtr); /* * The structure below defines scale class behavior by means of procedures * that can be invoked from generic window code. */ static const Tk_ClassProcs scaleClass = { sizeof(Tk_ClassProcs), /* size */ ScaleWorldChanged, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* *-------------------------------------------------------------- * * ScaleDigit, ScaleMax, ScaleMin, ScaleRound -- * * Simple math helper functions, designed to be automatically inlined by * the compiler most of the time. * *-------------------------------------------------------------- */ static inline int ScaleDigit( double value) { return (int) floor(log10(fabs(value))); } static inline double ScaleMax( double a, double b) { return (a > b) ? a : b; } static inline double ScaleMin( double a, double b) { return (a < b) ? a : b; } static inline int ScaleRound( double value) { return (int) floor(value + 0.5); } /* *-------------------------------------------------------------- * * Tk_ScaleObjCmd -- * * This procedure is invoked to process the "scale" Tcl command. See the |
︙ | ︙ | |||
296 297 298 299 300 301 302 | scalePtr->flags = NEVER_SET; Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, scalePtr); Tk_CreateEventHandler(scalePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ScaleEventProc, scalePtr); | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | scalePtr->flags = NEVER_SET; Tk_SetClassProcs(scalePtr->tkwin, &scaleClass, scalePtr); Tk_CreateEventHandler(scalePtr->tkwin, ExposureMask|StructureNotifyMask|FocusChangeMask, ScaleEventProc, scalePtr); if ((Tk_InitOptions(interp, scalePtr, optionTable, tkwin) != TCL_OK) || (ConfigureScale(interp, scalePtr, objc - 2, objv + 2) != TCL_OK)) { Tk_DestroyWindow(scalePtr->tkwin); return TCL_ERROR; } /* |
︙ | ︙ | |||
359 360 361 362 363 364 365 | switch (index) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } | | | | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | switch (index) { case COMMAND_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "cget option"); goto error; } objPtr = Tk_GetOptionValue(interp, scalePtr, scalePtr->optionTable, objv[2], scalePtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); break; case COMMAND_CONFIGURE: if (objc <= 3) { objPtr = Tk_GetOptionInfo(interp, scalePtr, scalePtr->optionTable, (objc == 3) ? objv[2] : NULL, scalePtr->tkwin); if (objPtr == NULL) { goto error; } Tcl_SetObjResult(interp, objPtr); } else { |
︙ | ︙ | |||
404 405 406 407 408 409 410 | + scalePtr->borderWidth; y = TkScaleValueToPixel(scalePtr, value); } else { x = TkScaleValueToPixel(scalePtr, value); y = scalePtr->horizTroughY + scalePtr->width/2 + scalePtr->borderWidth; } | | | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | + scalePtr->borderWidth; y = TkScaleValueToPixel(scalePtr, value); } else { x = TkScaleValueToPixel(scalePtr, value); y = scalePtr->horizTroughY + scalePtr->width/2 + scalePtr->borderWidth; } coords[0] = Tcl_NewWideIntObj(x); coords[1] = Tcl_NewWideIntObj(y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, coords)); break; } case COMMAND_GET: { double value; int x, y; if ((objc != 2) && (objc != 4)) { Tcl_WrongNumArgs(interp, 1, objv, "get ?x y?"); goto error; } if (objc == 2) { value = scalePtr->value; } else { if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) { goto error; } value = TkScalePixelToValue(scalePtr, x, y); } Tcl_SetObjResult(interp, Tcl_ObjPrintf(scalePtr->valueFormat, value)); break; } case COMMAND_IDENTIFY: { int x, y; const char *zone = ""; if (objc != 4) { |
︙ | ︙ | |||
578 579 580 581 582 583 584 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | for (error = 0; error <= 1; error++) { if (!error) { /* * First pass: set options to new values. */ if (Tk_SetOptions(interp, scalePtr, scalePtr->optionTable, objc, objv, scalePtr->tkwin, &savedOptions, NULL) != TCL_OK) { continue; } } else { /* * Second pass: restore options to old values. |
︙ | ︙ | |||
607 608 609 610 611 612 613 | double value; Tcl_Obj *valuePtr; valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL, TCL_GLOBAL_ONLY); if ((valuePtr != NULL) && (Tcl_GetDoubleFromObj(NULL, valuePtr, &value) == TCL_OK)) { | | | | | | > | | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | double value; Tcl_Obj *valuePtr; valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL, TCL_GLOBAL_ONLY); if ((valuePtr != NULL) && (Tcl_GetDoubleFromObj(NULL, valuePtr, &value) == TCL_OK)) { scalePtr->value = TkRoundValueToResolution(scalePtr, value); } } /* * Several options need special processing, such as parsing the * orientation and creating GCs. */ scalePtr->fromValue = TkRoundValueToResolution(scalePtr, scalePtr->fromValue); scalePtr->toValue = TkRoundValueToResolution(scalePtr, scalePtr->toValue); scalePtr->tickInterval = TkRoundIntervalToResolution(scalePtr, scalePtr->tickInterval); /* * Make sure that the tick interval has the right sign so that * addition moves from fromValue to toValue. */ if ((scalePtr->tickInterval < 0) ^ ((scalePtr->toValue - scalePtr->fromValue) < 0)) { scalePtr->tickInterval = -scalePtr->tickInterval; } ComputeFormat(scalePtr, 0); ComputeFormat(scalePtr, 1); scalePtr->labelLength = scalePtr->label ? strlen(scalePtr->label) : 0; Tk_SetBackgroundFromBorder(scalePtr->tkwin, scalePtr->bgBorder); if (scalePtr->highlightWidth < 0) { scalePtr->highlightWidth = 0; } scalePtr->inset = scalePtr->highlightWidth + scalePtr->borderWidth; |
︙ | ︙ | |||
754 755 756 757 758 759 760 761 | * know how much space is needed now. */ ComputeScaleGeometry(scalePtr); TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | < | > | > | > > > > > > > > > > > > > > > > > > > > > > | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 | * know how much space is needed now. */ ComputeScaleGeometry(scalePtr); TkEventuallyRedrawScale(scalePtr, REDRAW_ALL); } /* *---------------------------------------------------------------------- * * MaxTickRoundingError -- * * Given the separation between values that can be displayed on ticks, * this calculates the maximum magnitude of error for the displayed * value. Tries to be clever by working out the increment in error * between ticks rather than testing all of them, so may overestimate * error if it is greater than 0.25 x the value separation. * * Results: * Maximum error magnitude of tick numbers. * * Side effects: * None. * *---------------------------------------------------------------------- */ static double MaxTickRoundingError( TkScale *scalePtr, /* Information about scale widget. */ double tickResolution) /* Separation between displayable values. */ { double tickPosn, firstTickError, lastTickError, intervalError; int tickCount; /* * Compute the error for each tick-related measure. */ tickPosn = scalePtr->fromValue / tickResolution; firstTickError = tickPosn - ScaleRound(tickPosn); tickPosn = scalePtr->tickInterval / tickResolution; intervalError = tickPosn - ScaleRound(tickPosn); tickCount = (int) ((scalePtr->toValue - scalePtr->fromValue) / scalePtr->tickInterval); /* not including first */ lastTickError = ScaleMin(0.5, fabs(firstTickError + tickCount * intervalError)); /* * Compute the maximum cumulative rounding error. */ return ScaleMax(fabs(firstTickError), lastTickError) * tickResolution; } /* *---------------------------------------------------------------------- * * ComputeFormat -- * * This procedure is invoked to recompute the "valueFormat" or * "tickFormat" field of a scale's widget record, which determines how * the value of the scale or one of its ticks is converted to a string. * * Results: * None. * * Side effects: The valueFormat or tickFormat field of scalePtr is modified. * *---------------------------------------------------------------------- */ static void ComputeFormat( TkScale *scalePtr, /* Information about scale widget. */ int forTicks) /* Do for ticks rather than value */ { double maxValue, x; int mostSigDigit, numDigits, leastSigDigit, afterDecimal; int eDigits, fDigits; /* * Compute the displacement from the decimal of the most significant digit * required for any number in the scale's range. */ maxValue = fabs(scalePtr->fromValue); x = fabs(scalePtr->toValue); if (x > maxValue) { maxValue = x; } if (maxValue == 0) { maxValue = 1; } mostSigDigit = ScaleDigit(maxValue); if (forTicks) { /* * Display only enough digits to ensure adjacent ticks have different * values. */ if (scalePtr->tickInterval != 0) { leastSigDigit = ScaleDigit(scalePtr->tickInterval); /* * Now add more digits until max error is less than * TICK_VALUES_DISPLAY_ACCURACY intervals */ while (MaxTickRoundingError(scalePtr, pow(10, leastSigDigit)) > fabs(TICK_VALUES_DISPLAY_ACCURACY * scalePtr->tickInterval)) { --leastSigDigit; } numDigits = 1 + mostSigDigit - leastSigDigit; } else { numDigits = 1; } } else { /* * If the number of significant digits wasn't specified explicitly, * compute it. It's the difference between the most significant digit * needed to represent any number on the scale and the most * significant digit of the smallest difference between numbers on the * scale. In other words, display enough digits so that at least one * digit will be different between any two adjacent positions of the * scale. */ numDigits = scalePtr->digits; if (numDigits > TCL_MAX_PREC) { numDigits = 0; } if (numDigits <= 0) { if (scalePtr->resolution > 0) { /* * A resolution was specified for the scale, so just use it. */ leastSigDigit = ScaleDigit(scalePtr->resolution); } else { /* * No resolution was specified, so compute the difference in * value between adjacent pixels and use it for the least * significant digit. */ x = fabs(scalePtr->fromValue - scalePtr->toValue); if (scalePtr->length > 0) { x /= scalePtr->length; } if (x > 0) { leastSigDigit = ScaleDigit(x); } else { leastSigDigit = 0; } } numDigits = mostSigDigit - leastSigDigit + 1; if (numDigits < 1) { numDigits = 1; } } } /* * Compute the number of characters required using "e" format and "f" * format, and then choose whichever one takes fewer characters. */ |
︙ | ︙ | |||
859 860 861 862 863 864 865 | fDigits = (mostSigDigit >= 0) ? mostSigDigit + afterDecimal : afterDecimal; if (afterDecimal > 0) { fDigits++; /* Decimal point. */ } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } | > > | | | | > > > > > > > | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | fDigits = (mostSigDigit >= 0) ? mostSigDigit + afterDecimal : afterDecimal; if (afterDecimal > 0) { fDigits++; /* Decimal point. */ } if (mostSigDigit < 0) { fDigits++; /* Zero to left of decimal point. */ } if (forTicks) { if (fDigits <= eDigits) { sprintf(scalePtr->tickFormat, "%%.%df", afterDecimal); } else { sprintf(scalePtr->tickFormat, "%%.%de", numDigits - 1); } } else { if (fDigits <= eDigits) { sprintf(scalePtr->valueFormat, "%%.%df", afterDecimal); } else { sprintf(scalePtr->valueFormat, "%%.%de", numDigits - 1); } } } /* *---------------------------------------------------------------------- * * ComputeScaleGeometry -- |
︙ | ︙ | |||
890 891 892 893 894 895 896 | */ static void ComputeScaleGeometry( register TkScale *scalePtr) /* Information about widget. */ { char valueString[TCL_DOUBLE_SPACE]; | | | 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | */ static void ComputeScaleGeometry( register TkScale *scalePtr) /* Information about widget. */ { char valueString[TCL_DOUBLE_SPACE]; int tmp, valuePixels, tickPixels, x, y, extraSpace; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); scalePtr->fontHeight = fm.linespace + SPACING; /* * Horizontal scales are simpler than vertical ones because all sizes are |
︙ | ︙ | |||
936 937 938 939 940 941 942 | /* * Vertical scale: compute the amount of space needed to display the * scales value by formatting strings for the two end points; use * whichever length is longer. */ | | | > > > > > > > > > > > > > > > > > > > | | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | /* * Vertical scale: compute the amount of space needed to display the * scales value by formatting strings for the two end points; use * whichever length is longer. */ if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->fromValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } valuePixels = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->toValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tmp = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (valuePixels < tmp) { valuePixels = tmp; } /* * Now do the same thing for the tick values */ if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat, scalePtr->fromValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tickPixels = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat, scalePtr->toValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } tmp = Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (tickPixels < tmp) { tickPixels = tmp; } /* * Assign x-locations to the elements of the scale, working from left to * right. */ x = scalePtr->inset; if ((scalePtr->tickInterval != 0) && (scalePtr->showValue)) { scalePtr->vertTickRightX = x + SPACING + tickPixels; scalePtr->vertValueRightX = scalePtr->vertTickRightX + valuePixels + fm.ascent/2; x = scalePtr->vertValueRightX + SPACING; } else if (scalePtr->tickInterval != 0) { scalePtr->vertTickRightX = x + SPACING + tickPixels; scalePtr->vertValueRightX = scalePtr->vertTickRightX; x = scalePtr->vertTickRightX + SPACING; } else if (scalePtr->showValue) { scalePtr->vertTickRightX = x; scalePtr->vertValueRightX = x + SPACING + valuePixels; x = scalePtr->vertValueRightX + SPACING; } else { |
︙ | ︙ | |||
1115 1116 1117 1118 1119 1120 1121 | } scalePtr->flags |= what; } /* *-------------------------------------------------------------- * | | > > > > | > > > > > > > > > | | | | | | | 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 | } scalePtr->flags |= what; } /* *-------------------------------------------------------------- * * TkRoundValueToResolution, TkRoundIntervalToResolution -- * * Round a given floating-point value to the nearest multiple of the * scale's resolution. * TkRoundValueToResolution rounds an absolute value based on the from * value as a reference. * TkRoundIntervalToResolution rounds a relative value without * reference, i.e. it rounds an interval. * * Results: * The return value is the rounded result. * * Side effects: * None. * *-------------------------------------------------------------- */ double TkRoundValueToResolution( TkScale *scalePtr, /* Information about scale widget. */ double value) /* Value to round. */ { return TkRoundIntervalToResolution(scalePtr, value - scalePtr->fromValue) + scalePtr->fromValue; } double TkRoundIntervalToResolution( TkScale *scalePtr, /* Information about scale widget. */ double value) /* Value to round. */ { double rem, rounded, tick; if (scalePtr->resolution <= 0) { return value; } tick = floor(value/scalePtr->resolution); rounded = scalePtr->resolution * tick; rem = value - rounded; if (rem < 0) { if (rem <= -scalePtr->resolution/2) { rounded = (tick - 1.0) * scalePtr->resolution; } } else { if (rem >= scalePtr->resolution/2) { rounded = (tick + 1.0) * scalePtr->resolution; } } return rounded; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1188 1189 1190 1191 1192 1193 1194 | { register TkScale *scalePtr = clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; | < < < < < < < < < < < < < > > | > > > > > > > > > > > > > > > > > > | 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 | { register TkScale *scalePtr = clientData; const char *resultStr; double value; Tcl_Obj *valuePtr; int result; /* * If the variable is unset, then immediately recreate it unless the whole * interpreter is going away. */ if (flags & TCL_TRACE_UNSETS) { if (!Tcl_InterpDeleted(interp) && scalePtr->varNamePtr) { ClientData probe = NULL; do { probe = Tcl_VarTraceInfo(interp, Tcl_GetString(scalePtr->varNamePtr), TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, probe); if (probe == (ClientData)scalePtr) { break; } } while (probe); if (probe) { /* * We were able to fetch the unset trace for our * varNamePtr, which means it is not unset and not * the cause of this unset trace. Instead some outdated * former variable must be, and we should ignore it. */ return NULL; } Tcl_TraceVar2(interp, Tcl_GetString(scalePtr->varNamePtr), NULL, TCL_GLOBAL_ONLY|TCL_TRACE_WRITES|TCL_TRACE_UNSETS, ScaleVarProc, clientData); scalePtr->flags |= NEVER_SET; TkScaleSetValue(scalePtr, scalePtr->value, 1, 0); } return NULL; |
︙ | ︙ | |||
1234 1235 1236 1237 1238 1239 1240 | valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL, TCL_GLOBAL_ONLY); result = Tcl_GetDoubleFromObj(interp, valuePtr, &value); if (result != TCL_OK) { resultStr = "can't assign non-numeric value to scale variable"; ScaleSetVariable(scalePtr); } else { | | | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 | valuePtr = Tcl_ObjGetVar2(interp, scalePtr->varNamePtr, NULL, TCL_GLOBAL_ONLY); result = Tcl_GetDoubleFromObj(interp, valuePtr, &value); if (result != TCL_OK) { resultStr = "can't assign non-numeric value to scale variable"; ScaleSetVariable(scalePtr); } else { scalePtr->value = TkRoundValueToResolution(scalePtr, value); /* * This code is a bit tricky because it sets the scale's value before * calling TkScaleSetValue. This way, TkScaleSetValue won't bother to * set the variable again or to invoke the -command. However, it also * won't redisplay the scale, so we have to ask for that explicitly. */ |
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | double value, /* New value for scale. Gets adjusted if it's * off the scale. */ int setVar, /* Non-zero means reflect new value through to * associated variable, if any. */ int invokeCommand) /* Non-zero means invoked -command option to * notify of new value, 0 means don't. */ { | | | 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 | double value, /* New value for scale. Gets adjusted if it's * off the scale. */ int setVar, /* Non-zero means reflect new value through to * associated variable, if any. */ int invokeCommand) /* Non-zero means invoked -command option to * notify of new value, 0 means don't. */ { value = TkRoundValueToResolution(scalePtr, value); if ((value < scalePtr->fromValue) ^ (scalePtr->toValue < scalePtr->fromValue)) { value = scalePtr->fromValue; } if ((value > scalePtr->toValue) ^ (scalePtr->toValue < scalePtr->fromValue)) { value = scalePtr->toValue; |
︙ | ︙ | |||
1333 1334 1335 1336 1337 1338 1339 | static void ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; | | | 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | static void ScaleSetVariable( register TkScale *scalePtr) /* Info about widget. */ { if (scalePtr->varNamePtr != NULL) { char string[TCL_DOUBLE_SPACE]; if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } scalePtr->flags |= SETTING_VAR; Tcl_ObjSetVar2(scalePtr->interp, scalePtr->varNamePtr, NULL, Tcl_NewStringObj(string, -1), TCL_GLOBAL_ONLY); scalePtr->flags &= ~SETTING_VAR; |
︙ | ︙ | |||
1398 1399 1400 1401 1402 1403 1404 | value = 0; } if (value > 1) { value = 1; } value = scalePtr->fromValue + value * (scalePtr->toValue - scalePtr->fromValue); | | | 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 | value = 0; } if (value > 1) { value = 1; } value = scalePtr->fromValue + value * (scalePtr->toValue - scalePtr->fromValue); return TkRoundValueToResolution(scalePtr, value); } /* *---------------------------------------------------------------------- * * TkScaleValueToPixel -- * |
︙ | ︙ | |||
1435 1436 1437 1438 1439 1440 1441 | valueRange = scalePtr->toValue - scalePtr->fromValue; pixelRange = ((scalePtr->orient == ORIENT_VERTICAL) ? Tk_Height(scalePtr->tkwin) : Tk_Width(scalePtr->tkwin)) - scalePtr->sliderLength - 2*scalePtr->inset - 2*scalePtr->borderWidth; if (valueRange == 0) { y = 0; } else { | | | | 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 | valueRange = scalePtr->toValue - scalePtr->fromValue; pixelRange = ((scalePtr->orient == ORIENT_VERTICAL) ? Tk_Height(scalePtr->tkwin) : Tk_Width(scalePtr->tkwin)) - scalePtr->sliderLength - 2*scalePtr->inset - 2*scalePtr->borderWidth; if (valueRange == 0) { y = 0; } else { y = ScaleRound((value - scalePtr->fromValue) * pixelRange / valueRange); if (y < 0) { y = 0; } else if (y > pixelRange) { y = pixelRange; } } y += scalePtr->sliderLength/2 + scalePtr->inset + scalePtr->borderWidth; |
︙ | ︙ |
Changes to generic/tkScale.h.
︙ | ︙ | |||
69 70 71 72 73 74 75 | * display any tick marks. */ double resolution; /* If > 0, all values are rounded to an even * multiple of this value. */ int digits; /* Number of significant digits to print in * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ | | > > | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | * display any tick marks. */ double resolution; /* If > 0, all values are rounded to an even * multiple of this value. */ int digits; /* Number of significant digits to print in * values. 0 means we get to choose the number * based on resolution and/or the range of the * scale. */ char valueFormat[16]; /* Sprintf conversion specifier computed from * digits and other information. */ char tickFormat[16]; /* Sprintf conversion specifier computed from * tick interval. */ double bigIncrement; /* Amount to use for large increments to scale * value. (0 means we pick a value). */ char *command; /* Command prefix to use when invoking Tcl * commands because the scale value changed. * NULL means don't invoke commands. */ int repeatDelay; /* How long to wait before auto-repeating on * scrolling actions (in ms). */ int repeatInterval; /* Interval between autorepeats (in ms). */ char *label; /* Label to display above or to right of * scale; NULL means don't display a label. */ TkSizeT labelLength; /* Number of non-NULL chars. in label. */ enum state state; /* Values are active, normal, or disabled. * Value of scale cannot be changed when * disabled. */ /* * Information used when displaying widget: */ |
︙ | ︙ | |||
210 211 212 213 214 215 216 217 218 219 220 221 | /* * Space to leave between scale area and text, and between text and edge of * window. */ #define SPACING 2 /* * Declaration of procedures used in the implementation of the scale widget. */ MODULE_SCOPE void TkEventuallyRedrawScale(TkScale *scalePtr, int what); | > > > > > > > > | > | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | /* * Space to leave between scale area and text, and between text and edge of * window. */ #define SPACING 2 /* * The tick values are all displayed with the same number of decimal places. * This number of decimal places is such that the displayed values are all * accurate to within the following proportion of a tick interval. */ #define TICK_VALUES_DISPLAY_ACCURACY 0.2 /* * Declaration of procedures used in the implementation of the scale widget. */ MODULE_SCOPE void TkEventuallyRedrawScale(TkScale *scalePtr, int what); MODULE_SCOPE double TkRoundValueToResolution(TkScale *scalePtr, double value); MODULE_SCOPE double TkRoundIntervalToResolution(TkScale *scalePtr, double value); MODULE_SCOPE TkScale * TkpCreateScale(Tk_Window tkwin); MODULE_SCOPE void TkpDestroyScale(TkScale *scalePtr); MODULE_SCOPE void TkpDisplayScale(ClientData clientData); MODULE_SCOPE int TkpScaleElement(TkScale *scalePtr, int x, int y); MODULE_SCOPE void TkScaleSetValue(TkScale *scalePtr, double value, int setVar, int invokeCommand); MODULE_SCOPE double TkScalePixelToValue(TkScale *scalePtr, int x, int y); MODULE_SCOPE int TkScaleValueToPixel(TkScale *scalePtr, double value); #endif /* _TKSCALE */ |
Changes to generic/tkScrollbar.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | /* * Information used for argv parsing. */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", | | | | | | | | | | | | | | | | | | | | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /* * Information used for argv parsing. */ static const Tk_ConfigSpec configSpecs[] = { {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCROLLBAR_ACTIVE_BG_COLOR, offsetof(TkScrollbar, activeBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-activebackground", "activeBackground", "Foreground", DEF_SCROLLBAR_ACTIVE_BG_MONO, offsetof(TkScrollbar, activeBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_RELIEF, "-activerelief", "activeRelief", "Relief", DEF_SCROLLBAR_ACTIVE_RELIEF, offsetof(TkScrollbar, activeRelief), 0, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", DEF_SCROLLBAR_BG_COLOR, offsetof(TkScrollbar, bgBorder), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_BORDER, "-background", "background", "Background", DEF_SCROLLBAR_BG_MONO, offsetof(TkScrollbar, bgBorder), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_SYNONYM, "-bd", "borderWidth", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_SYNONYM, "-bg", "background", NULL, NULL, 0, 0, NULL}, {TK_CONFIG_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_SCROLLBAR_BORDER_WIDTH, offsetof(TkScrollbar, borderWidth), 0, NULL}, {TK_CONFIG_STRING, "-command", "command", "Command", DEF_SCROLLBAR_COMMAND, offsetof(TkScrollbar, command), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_ACTIVE_CURSOR, "-cursor", "cursor", "Cursor", DEF_SCROLLBAR_CURSOR, offsetof(TkScrollbar, cursor), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_PIXELS, "-elementborderwidth", "elementBorderWidth", "BorderWidth", DEF_SCROLLBAR_EL_BORDER_WIDTH, offsetof(TkScrollbar, elementBorderWidth), 0, NULL}, {TK_CONFIG_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_SCROLLBAR_HIGHLIGHT_BG, offsetof(TkScrollbar, highlightBgColorPtr), 0, NULL}, {TK_CONFIG_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_SCROLLBAR_HIGHLIGHT, offsetof(TkScrollbar, highlightColorPtr), 0, NULL}, {TK_CONFIG_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_SCROLLBAR_HIGHLIGHT_WIDTH, offsetof(TkScrollbar, highlightWidth), 0, NULL}, {TK_CONFIG_BOOLEAN, "-jump", "jump", "Jump", DEF_SCROLLBAR_JUMP, offsetof(TkScrollbar, jump), 0, NULL}, {TK_CONFIG_CUSTOM, "-orient", "orient", "Orient", DEF_SCROLLBAR_ORIENT, offsetof(TkScrollbar, vertical), 0, &orientOption}, {TK_CONFIG_RELIEF, "-relief", "relief", "Relief", DEF_SCROLLBAR_RELIEF, offsetof(TkScrollbar, relief), 0, NULL}, {TK_CONFIG_INT, "-repeatdelay", "repeatDelay", "RepeatDelay", DEF_SCROLLBAR_REPEAT_DELAY, offsetof(TkScrollbar, repeatDelay), 0, NULL}, {TK_CONFIG_INT, "-repeatinterval", "repeatInterval", "RepeatInterval", DEF_SCROLLBAR_REPEAT_INTERVAL, offsetof(TkScrollbar, repeatInterval), 0, NULL}, {TK_CONFIG_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_SCROLLBAR_TAKE_FOCUS, offsetof(TkScrollbar, takeFocus), TK_CONFIG_NULL_OK, NULL}, {TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background", DEF_SCROLLBAR_TROUGH_COLOR, offsetof(TkScrollbar, troughColorPtr), TK_CONFIG_COLOR_ONLY, NULL}, {TK_CONFIG_COLOR, "-troughcolor", "troughColor", "Background", DEF_SCROLLBAR_TROUGH_MONO, offsetof(TkScrollbar, troughColorPtr), TK_CONFIG_MONO_ONLY, NULL}, {TK_CONFIG_PIXELS, "-width", "width", "Width", tkDefScrollbarWidth, offsetof(TkScrollbar, width), 0, NULL}, {TK_CONFIG_END, NULL, NULL, NULL, NULL, 0, 0, NULL} }; /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | scrollPtr->inset = 0; scrollPtr->elementBorderWidth = -1; scrollPtr->arrowLength = 0; scrollPtr->sliderFirst = 0; scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; scrollPtr->totalUnits = 0; scrollPtr->windowUnits = 0; scrollPtr->firstUnit = 0; scrollPtr->lastUnit = 0; scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; if (ConfigureScrollbar(interp, scrollPtr, objc-2, objv+2, 0) != TCL_OK) { | > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | scrollPtr->inset = 0; scrollPtr->elementBorderWidth = -1; scrollPtr->arrowLength = 0; scrollPtr->sliderFirst = 0; scrollPtr->sliderLast = 0; scrollPtr->activeField = 0; scrollPtr->activeRelief = TK_RELIEF_RAISED; #ifndef TK_NO_DEPRECATED scrollPtr->totalUnits = 0; scrollPtr->windowUnits = 0; scrollPtr->firstUnit = 0; scrollPtr->lastUnit = 0; #endif /* TK_NO_DEPRECATED */ scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 0.0; scrollPtr->cursor = NULL; scrollPtr->takeFocus = NULL; scrollPtr->flags = 0; if (ConfigureScrollbar(interp, scrollPtr, objc-2, objv+2, 0) != TCL_OK) { |
︙ | ︙ | |||
220 221 222 223 224 225 226 | ScrollbarWidgetObjCmd( ClientData clientData, /* Information about scrollbar widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { register TkScrollbar *scrollPtr = clientData; | | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | ScrollbarWidgetObjCmd( ClientData clientData, /* Information about scrollbar widget. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { register TkScrollbar *scrollPtr = clientData; int result = TCL_OK, cmdIndex; TkSizeT length; static const char *const commandNames[] = { "activate", "cget", "configure", "delta", "fraction", "get", "identify", "set", NULL }; enum command { COMMAND_ACTIVATE, COMMAND_CGET, COMMAND_CONFIGURE, COMMAND_DELTA, COMMAND_FRACTION, COMMAND_GET, COMMAND_IDENTIFY, COMMAND_SET |
︙ | ︙ | |||
265 266 267 268 269 270 271 | Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); goto done; } if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } | | | 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 | Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); goto done; } if (objc != 3) { Tcl_WrongNumArgs(interp, 1, objv, "activate element"); goto error; } c = TkGetStringFromObj(objv[2], &length)[0]; oldActiveField = scrollPtr->activeField; if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow1") == 0)) { scrollPtr->activeField = TOP_ARROW; } else if ((c == 'a') && (strcmp(Tcl_GetString(objv[2]), "arrow2") == 0)) { scrollPtr->activeField = BOTTOM_ARROW; } else if ((c == 's') && (strncmp(Tcl_GetString(objv[2]), "slider", length) == 0)) { scrollPtr->activeField = SLIDER; |
︙ | ︙ | |||
373 374 375 376 377 378 379 | case COMMAND_GET: { Tcl_Obj *resObjs[4]; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } | > | < < < < | | | | > > > > > | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | case COMMAND_GET: { Tcl_Obj *resObjs[4]; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "get"); goto error; } #ifndef TK_NO_DEPRECATED if (scrollPtr->flags & OLD_STYLE_COMMANDS) { resObjs[0] = Tcl_NewWideIntObj(scrollPtr->totalUnits); resObjs[1] = Tcl_NewWideIntObj(scrollPtr->windowUnits); resObjs[2] = Tcl_NewWideIntObj(scrollPtr->firstUnit); resObjs[3] = Tcl_NewWideIntObj(scrollPtr->lastUnit); Tcl_SetObjResult(interp, Tcl_NewListObj(4, resObjs)); break; } #endif /* TK_NO_DEPRECATED */ resObjs[0] = Tcl_NewDoubleObj(scrollPtr->firstFraction); resObjs[1] = Tcl_NewDoubleObj(scrollPtr->lastFraction); Tcl_SetObjResult(interp, Tcl_NewListObj(2, resObjs)); break; } case COMMAND_IDENTIFY: { int x, y; const char *zone = ""; if (objc != 4) { |
︙ | ︙ | |||
409 410 411 412 413 414 415 | case BOTTOM_GAP: zone = "trough2"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); break; } case COMMAND_SET: { | < < | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | case BOTTOM_GAP: zone = "trough2"; break; case BOTTOM_ARROW: zone = "arrow2"; break; } Tcl_SetObjResult(interp, Tcl_NewStringObj(zone, -1)); break; } case COMMAND_SET: { if (objc == 4) { double first, last; if (Tcl_GetDoubleFromObj(interp, objv[2], &first) != TCL_OK) { goto error; } if (Tcl_GetDoubleFromObj(interp, objv[3], &last) != TCL_OK) { |
︙ | ︙ | |||
434 435 436 437 438 439 440 | if (last < scrollPtr->firstFraction) { scrollPtr->lastFraction = scrollPtr->firstFraction; } else if (last > 1.0) { scrollPtr->lastFraction = 1.0; } else { scrollPtr->lastFraction = last; } | > | > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | if (last < scrollPtr->firstFraction) { scrollPtr->lastFraction = scrollPtr->firstFraction; } else if (last > 1.0) { scrollPtr->lastFraction = 1.0; } else { scrollPtr->lastFraction = last; } #ifndef TK_NO_DEPRECATED scrollPtr->flags &= ~OLD_STYLE_COMMANDS; } else if (objc == 6) { int totalUnits, windowUnits, firstUnit, lastUnit; if (Tcl_GetIntFromObj(interp, objv[2], &totalUnits) != TCL_OK) { goto error; } if (totalUnits < 0) { totalUnits = 0; } if (Tcl_GetIntFromObj(interp, objv[3], &windowUnits) != TCL_OK) { |
︙ | ︙ | |||
472 473 474 475 476 477 478 | if (scrollPtr->totalUnits == 0) { scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 1.0; } else { scrollPtr->firstFraction = ((double) firstUnit)/totalUnits; scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits; } | | > < < | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | if (scrollPtr->totalUnits == 0) { scrollPtr->firstFraction = 0.0; scrollPtr->lastFraction = 1.0; } else { scrollPtr->firstFraction = ((double) firstUnit)/totalUnits; scrollPtr->lastFraction = ((double) (lastUnit+1))/totalUnits; } scrollPtr->flags |= OLD_STYLE_COMMANDS; #endif /* !TK_NO_DEPRECATED */ } else { Tcl_WrongNumArgs(interp, 1, objv, "set firstFraction lastFraction"); goto error; } TkpComputeScrollbarGeometry(scrollPtr); TkScrollbarEventuallyRedraw(scrollPtr); break; } } |
︙ | ︙ |
Changes to generic/tkScrollbar.h.
︙ | ︙ | |||
89 90 91 92 93 94 95 | /* * Information describing the application related to the scrollbar. This * information is provided by the application by invoking the "set" widget * command. This information can now be provided in two ways: the "old" * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new" * form (firstFraction and lastFraction). FirstFraction and lastFraction * will always be valid, but the old-style information is only valid if | | > | | | | | > > > | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | /* * Information describing the application related to the scrollbar. This * information is provided by the application by invoking the "set" widget * command. This information can now be provided in two ways: the "old" * form (totalUnits, windowUnits, firstUnit, and lastUnit), or the "new" * form (firstFraction and lastFraction). FirstFraction and lastFraction * will always be valid, but the old-style information is only valid if * the OLD_STYLE_COMMANDS flag is 1. */ #ifndef TK_NO_DEPRECATED int totalUnits; /* Total dimension of application, in units. * Valid only if the OLD_STYLE_COMMANDS flag * is set. */ int windowUnits; /* Maximum number of units that can be * displayed in the window at once. Valid only * if the OLD_STYLE_COMMANDS flag is set. */ int firstUnit; /* Number of last unit visible in * application's window. Valid only if the * OLD_STYLE_COMMANDS flag is set. */ int lastUnit; /* Index of last unit visible in window. * Valid only if the OLD_STYLE_COMMANDS flag * isn't set. */ #else int dummy1,dummy2,dummy3,dummy4; /* sizeof(TkScrollbar) should not depend on TK_NO_DEPRECATED */ #endif /* TK_NO_DEPRECATED */ double firstFraction; /* Position of first visible thing in window, * specified as a fraction between 0 and * 1.0. */ double lastFraction; /* Position of last visible thing in window, * specified as a fraction between 0 and * 1.0. */ |
︙ | ︙ | |||
140 141 142 143 144 145 146 | #define BOTTOM_ARROW 5 /* * Flag bits for scrollbars: * * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has * already been queued to redraw this window. | | > | < > | > | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | #define BOTTOM_ARROW 5 /* * Flag bits for scrollbars: * * REDRAW_PENDING: Non-zero means a DoWhenIdle handler has * already been queued to redraw this window. * OLD_STYLE_COMMANDS: Non-zero means the old style of commands * should be used to communicate with the widget: * ".t yview 40", instead of * ".t yview scroll 2 lines", for example. * GOT_FOCUS: Non-zero means this window has the input * focus. */ #define REDRAW_PENDING 1 #ifndef TK_NO_DEPRECATED # define OLD_STYLE_COMMANDS 2 #endif /* TK_NO_DEPRECATED */ #define GOT_FOCUS 4 /* * Declaration of scrollbar class functions structure * and default scrollbar width, for use in configSpec. */ |
︙ | ︙ |
Changes to generic/tkSelect.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | typedef struct { Tcl_Interp *interp; /* Interpreter in which to invoke command. */ int cmdLength; /* # of non-NULL bytes in command. */ int charOffset; /* The offset of the next char to retrieve. */ int byteOffset; /* The expected byte offset of the next * chunk. */ | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | typedef struct { Tcl_Interp *interp; /* Interpreter in which to invoke command. */ int cmdLength; /* # of non-NULL bytes in command. */ int charOffset; /* The offset of the next char to retrieve. */ int byteOffset; /* The expected byte offset of the next * chunk. */ char buffer[4]; /* A buffer to hold part of a UTF character * that is split across chunks. */ char command[1]; /* Command to invoke. Actual space is * allocated as large as necessary. This must * be the last entry in the structure. */ } CommandInfo; /* |
︙ | ︙ | |||
44 45 46 47 48 49 50 | Tcl_Obj *cmdObj; /* Reference to command to invoke. */ } LostCommand; /* * The structure below is used to keep each thread's pending list separate. */ | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | Tcl_Obj *cmdObj; /* Reference to command to invoke. */ } LostCommand; /* * The structure below is used to keep each thread's pending list separate. */ typedef struct { TkSelInProgress *pendingPtr; /* Topmost search in progress, or NULL if * none. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* |
︙ | ︙ | |||
186 187 188 189 190 191 192 | selPtr->proc = proc; if (selPtr->proc == HandleTclCommand) { /* * The clientData is selection controlled memory, so we * should make a copy for this selPtr. */ | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | selPtr->proc = proc; if (selPtr->proc == HandleTclCommand) { /* * The clientData is selection controlled memory, so we * should make a copy for this selPtr. */ size_t cmdInfoLen = offsetof(CommandInfo, command) + 1 + ((CommandInfo *)clientData)->cmdLength; selPtr->clientData = ckalloc(cmdInfoLen); memcpy(selPtr->clientData, clientData, cmdInfoLen); } else { selPtr->clientData = clientData; } |
︙ | ︙ | |||
353 354 355 356 357 358 359 | ClientData clientData) /* Arbitrary one-word argument to pass to * proc. */ { register TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | ClientData clientData) /* Arbitrary one-word argument to pass to * proc. */ { register TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; Tk_LostSelProc *clearProc = NULL; void *clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } Tk_MakeWindowExist(tkwin); |
︙ | ︙ | |||
462 463 464 465 466 467 468 | { register TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; TkSelectionInfo *nextPtr; Tk_LostSelProc *clearProc = NULL; | | | 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | { register TkWindow *winPtr = (TkWindow *) tkwin; TkDisplay *dispPtr = winPtr->dispPtr; TkSelectionInfo *infoPtr; TkSelectionInfo *prevPtr; TkSelectionInfo *nextPtr; Tk_LostSelProc *clearProc = NULL; void *clearData = NULL;/* Initialization needed only to prevent * compiler warning. */ if (dispPtr->multipleAtom == None) { TkSelInit(tkwin); } for (infoPtr = dispPtr->selectionInfoPtr, prevPtr = NULL; |
︙ | ︙ | |||
827 828 829 830 831 832 833 | } case SELECTION_HANDLE: { Atom target, format; const char *targetName = NULL; const char *formatName = NULL; register CommandInfo *cmdInfoPtr; | | | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 | } case SELECTION_HANDLE: { Atom target, format; const char *targetName = NULL; const char *formatName = NULL; register CommandInfo *cmdInfoPtr; TkSizeT cmdLength; static const char *const handleOptionStrings[] = { "-format", "-selection", "-type", NULL }; enum handleOptions { HANDLE_FORMAT, HANDLE_SELECTION, HANDLE_TYPE }; int handleIndex; |
︙ | ︙ | |||
896 897 898 899 900 901 902 | if (count > 3) { format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3])); } else if (formatName != NULL) { format = Tk_InternAtom(tkwin, formatName); } else { format = XA_STRING; } | | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 | if (count > 3) { format = Tk_InternAtom(tkwin, Tcl_GetString(objs[3])); } else if (formatName != NULL) { format = Tk_InternAtom(tkwin, formatName); } else { format = XA_STRING; } string = TkGetStringFromObj(objs[1], &cmdLength); if (cmdLength == 0) { Tk_DeleteSelHandler(tkwin, selection, target); } else { cmdInfoPtr = ckalloc(offsetof(CommandInfo, command) + 1 + cmdLength); cmdInfoPtr->interp = interp; cmdInfoPtr->charOffset = 0; cmdInfoPtr->byteOffset = 0; cmdInfoPtr->buffer[0] = '\0'; cmdInfoPtr->cmdLength = cmdLength; memcpy(cmdInfoPtr->command, string, cmdLength + 1); |
︙ | ︙ | |||
1242 1243 1244 1245 1246 1247 1248 | if (infoPtr->selection == eventPtr->xselectionclear.selection) { break; } prevPtr = infoPtr; } if (infoPtr != NULL && (infoPtr->owner == tkwin) && | | | 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | if (infoPtr->selection == eventPtr->xselectionclear.selection) { break; } prevPtr = infoPtr; } if (infoPtr != NULL && (infoPtr->owner == tkwin) && (eventPtr->xselectionclear.serial >= (unsigned long) infoPtr->serial)) { if (prevPtr == NULL) { dispPtr->selectionInfoPtr = infoPtr->nextPtr; } else { prevPtr->nextPtr = infoPtr->nextPtr; } /* |
︙ | ︙ | |||
1383 1384 1385 1386 1387 1388 1389 | if (code == TCL_OK) { /* * TODO: This assumes that bytes are characters; that's not true! */ string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length); count = (length > maxBytes) ? maxBytes : length; | | | 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 | if (code == TCL_OK) { /* * TODO: This assumes that bytes are characters; that's not true! */ string = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), &length); count = (length > maxBytes) ? maxBytes : length; memcpy(buffer, string, count); buffer[count] = '\0'; /* * Update the partial character information for the next retrieval if * the command has not been deleted. */ |
︙ | ︙ | |||
1406 1407 1408 1409 1410 1411 1412 | while (p < string) { p = Tcl_UtfNext(p); numChars++; } cmdInfoPtr->charOffset += numChars; length = p - string; if (length > 0) { | | | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 | while (p < string) { p = Tcl_UtfNext(p); numChars++; } cmdInfoPtr->charOffset += numChars; length = p - string; if (length > 0) { strncpy(cmdInfoPtr->buffer, string, length); } cmdInfoPtr->buffer[length] = '\0'; } cmdInfoPtr->byteOffset += count + extraBytes; } count += extraBytes; } else { |
︙ | ︙ | |||
1504 1505 1506 1507 1508 1509 1510 | } } length = Tcl_DStringLength(&ds); if (length >= maxBytes) { Tcl_DStringFree(&ds); return -1; } | | | 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 | } } length = Tcl_DStringLength(&ds); if (length >= maxBytes) { Tcl_DStringFree(&ds); return -1; } memcpy(buffer, Tcl_DStringValue(&ds), length + 1); Tcl_DStringFree(&ds); *typePtr = XA_ATOM; return length; } if (target == dispPtr->applicationAtom) { int length; |
︙ | ︙ |
Changes to generic/tkSelect.h.
︙ | ︙ | |||
21 22 23 24 25 26 27 | * structures because a display can have multiple different selections active * at the same time. */ typedef struct TkSelectionInfo { Atom selection; /* Selection name, e.g. XA_PRIMARY. */ Tk_Window owner; /* Current owner of this selection. */ | > | > > > | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | * structures because a display can have multiple different selections active * at the same time. */ typedef struct TkSelectionInfo { Atom selection; /* Selection name, e.g. XA_PRIMARY. */ Tk_Window owner; /* Current owner of this selection. */ #if TCL_MAJOR_VERSION > 8 unsigned long serial; /* Serial number of last XSelectionSetOwner * request made to server for this selection * (used to filter out redundant * SelectionClear events). */ #else int serial; #endif Time time; /* Timestamp used to acquire selection. */ Tk_LostSelProc *clearProc; /* Procedure to call when owner loses * selection. */ void *clearData; /* Info to pass to clearProc. */ struct TkSelectionInfo *nextPtr; /* Next in list of current selections on this * display. NULL means end of list. */ } TkSelectionInfo; /* * One of the following structures exists for each selection handler created * for a window by calling Tk_CreateSelHandler. The handlers are linked in a * list rooted in the TkWindow structure. */ typedef struct TkSelHandler { Atom selection; /* Selection name, e.g. XA_PRIMARY. */ Atom target; /* Target type for selection conversion, such * as TARGETS or STRING. */ Atom format; /* Format in which selection info will be * returned, such as STRING or ATOM. */ Tk_SelectionProc *proc; /* Procedure to generate selection in this * format. */ void *clientData; /* Argument to pass to proc. */ TkSizeT size; /* Size of units returned by proc (8 for * STRING, 32 for almost anything else). */ struct TkSelHandler *nextPtr; /* Next selection handler associated with same * window (NULL for end of list). */ } TkSelHandler; /* |
︙ | ︙ |
Changes to generic/tkSquare.c.
︙ | ︙ | |||
62 63 64 65 66 67 68 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", | | | | | | | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /* * Information used for argv parsing. */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BORDER, "-background", "background", "Background", "#d9d9d9", offsetof(Square, bgBorderPtr), -1, 0, "white", 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", 0}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", "2", offsetof(Square, borderWidthPtr), -1, 0, NULL, 0}, {TK_OPTION_BOOLEAN, "-dbl", "doubleBuffer", "DoubleBuffer", "1", offsetof(Square, doubleBufferPtr), -1, 0 , NULL, 0}, {TK_OPTION_SYNONYM, "-fg", NULL, NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", "#b03060", offsetof(Square, fgBorderPtr), -1, 0, "black", 0}, {TK_OPTION_PIXELS, "-posx", "posx", "PosX", "0", offsetof(Square, xPtr), -1, 0, NULL, 0}, {TK_OPTION_PIXELS, "-posy", "posy", "PosY", "0", offsetof(Square, yPtr), -1, 0, NULL, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", offsetof(Square, reliefPtr), -1, 0, NULL, 0}, {TK_OPTION_PIXELS, "-size", "size", "Size", "20", offsetof(Square, sizeObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; /* * Forward declarations for procedures defined later in this file: */ |
︙ | ︙ | |||
168 169 170 171 172 173 174 | squarePtr->interp = interp; squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr, SquareDeletedProc); squarePtr->gc = NULL; squarePtr->optionTable = optionTable; | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | squarePtr->interp = interp; squarePtr->widgetCmd = Tcl_CreateObjCommand(interp, Tk_PathName(squarePtr->tkwin), SquareWidgetObjCmd, squarePtr, SquareDeletedProc); squarePtr->gc = NULL; squarePtr->optionTable = optionTable; if (Tk_InitOptions(interp, squarePtr, optionTable, tkwin) != TCL_OK) { Tk_DestroyWindow(squarePtr->tkwin); ckfree(squarePtr); return TCL_ERROR; } Tk_CreateEventHandler(squarePtr->tkwin, ExposureMask|StructureNotifyMask, SquareObjEventProc, squarePtr); if (Tk_SetOptions(interp, squarePtr, optionTable, objc - 2, objv + 2, tkwin, NULL, NULL) != TCL_OK) { goto error; } if (SquareConfigure(interp, squarePtr) != TCL_OK) { goto error; } |
︙ | ︙ | |||
246 247 248 249 250 251 252 | switch (index) { case SQUARE_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } | | | | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | switch (index) { case SQUARE_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); goto error; } resultObjPtr = Tk_GetOptionValue(interp, squarePtr, squarePtr->optionTable, objv[2], squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObjPtr); } break; case SQUARE_CONFIGURE: resultObjPtr = NULL; if (objc == 2) { resultObjPtr = Tk_GetOptionInfo(interp, squarePtr, squarePtr->optionTable, NULL, squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } } else if (objc == 3) { resultObjPtr = Tk_GetOptionInfo(interp, squarePtr, squarePtr->optionTable, objv[2], squarePtr->tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } } else { result = Tk_SetOptions(interp, squarePtr, squarePtr->optionTable, objc - 2, objv + 2, squarePtr->tkwin, NULL, NULL); if (result == TCL_OK) { result = SquareConfigure(interp, squarePtr); } if (!squarePtr->updatePending) { Tcl_DoWhenIdle(SquareDisplay, squarePtr); |
︙ | ︙ | |||
331 332 333 334 335 336 337 | */ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin, squarePtr->bgBorderPtr); Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); | | | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | */ bgBorder = Tk_Get3DBorderFromObj(squarePtr->tkwin, squarePtr->bgBorderPtr); Tk_SetWindowBackground(squarePtr->tkwin, Tk_3DBorderColor(bgBorder)->pixel); Tcl_GetBooleanFromObj(NULL, squarePtr->doubleBufferPtr, &doubleBuffer); if ((squarePtr->gc == NULL) && doubleBuffer) { XGCValues gcValues; gcValues.function = GXcopy; gcValues.graphics_exposures = False; squarePtr->gc = Tk_GetGC(squarePtr->tkwin, GCFunction|GCGraphicsExposures, &gcValues); } |
︙ | ︙ |
Changes to generic/tkStubInit.c.
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | MODULE_SCOPE const TkStubs tkStubs; /* * Remove macro that might interfere with the definition below. */ #undef Tk_MainEx #ifdef _WIN32 int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { /* dummy implementation, no need to do anything */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | MODULE_SCOPE const TkStubs tkStubs; /* * Remove macro that might interfere with the definition below. */ #undef Tk_MainEx #undef Tk_FreeXId #undef Tk_FreeStyleFromObj #undef Tk_GetStyleFromObj #undef TkWinGetPlatformId #if defined(TK_NO_DEPRECATED) || TCL_MAJOR_VERSION > 8 #define Tk_MainEx 0 #define Tk_FreeXId 0 #define Tk_FreeStyleFromObj 0 #define Tk_GetStyleFromObj 0 #define TkWinGetPlatformId 0 #define Tk_PhotoPutBlock_NoComposite 0 #define Tk_PhotoPutZoomedBlock_NoComposite 0 #define Tk_PhotoExpand_Panic 0 #define Tk_PhotoPutBlock_Panic 0 #define Tk_PhotoPutZoomedBlock_Panic 0 #define Tk_PhotoSetSize_Panic 0 #else static void doNothing(void) { /* dummy implementation, no need to do anything */ } #define Tk_FreeXId ((void (*)(Display *, XID)) doNothing) #define Tk_FreeStyleFromObj ((void (*)(Tcl_Obj *)) doNothing) #define Tk_GetStyleFromObj getStyleFromObj static Tk_Style Tk_GetStyleFromObj(Tcl_Obj *obj) { return Tk_AllocStyleFromObj(NULL, obj); } #if defined(_WIN32) || defined(__CYGWIN__) #define TkWinGetPlatformId winGetPlatformId static int TkWinGetPlatformId(void) { return 2; } #endif /* defined(_WIN32) || defined(__CYGWIN__) */ #endif /* !TK_NO_DEPRECATED */ #ifdef _WIN32 int TkpCmapStressed(Tk_Window tkwin, Colormap colormap) { /* dummy implementation, no need to do anything */ |
︙ | ︙ | |||
61 62 63 64 65 66 67 68 69 70 71 72 73 74 | # define TkUnixContainerId 0 # define TkUnixDoOneXEvent 0 # define TkUnixSetMenubar 0 # define XCreateWindow 0 # define XOffsetRegion 0 # define XUnionRegion 0 # define TkWmCleanup (void (*)(TkDisplay *)) TkpSync # define TkSendCleanup (void (*)(TkDisplay *)) TkpSync # define TkpTestsendCmd 0 #else /* !_WIN32 */ /* | > > | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | # define TkUnixContainerId 0 # define TkUnixDoOneXEvent 0 # define TkUnixSetMenubar 0 # define XCreateWindow 0 # define XOffsetRegion 0 # define XUnionRegion 0 # define XPolygonRegion 0 # define XPointInRegion 0 # define TkWmCleanup (void (*)(TkDisplay *)) TkpSync # define TkSendCleanup (void (*)(TkDisplay *)) TkpSync # define TkpTestsendCmd 0 #else /* !_WIN32 */ /* |
︙ | ︙ | |||
199 200 201 202 203 204 205 | # define TkWinSetWindowPos 0 # define TkWinWmCleanup 0 # define TkWinXCleanup 0 # define TkWinXInit 0 # define TkWinSetForegroundWindow 0 # define TkWinDialogDebug 0 # define TkWinGetMenuSystemDefault 0 | < | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | # define TkWinSetWindowPos 0 # define TkWinWmCleanup 0 # define TkWinXCleanup 0 # define TkWinXInit 0 # define TkWinSetForegroundWindow 0 # define TkWinDialogDebug 0 # define TkWinGetMenuSystemDefault 0 # define TkWinSetHINSTANCE 0 # define TkWinGetPlatformTheme 0 # define TkWinChildProc 0 # elif !defined(MAC_OSX_TK) /* UNIX */ # undef TkClipBox |
︙ | ︙ | |||
232 233 234 235 236 237 238 239 240 241 242 243 244 245 | /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations * below should be made in the generic/tk.decls script. */ /* !BEGIN!: Do not edit below this line. */ static const TkIntStubs tkIntStubs = { TCL_STUB_MAGIC, 0, TkAllocWindow, /* 0 */ TkBezierPoints, /* 1 */ | > > > > > > > > | 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | /* * WARNING: The contents of this file is automatically generated by the * tools/genStubs.tcl script. Any modifications to the function declarations * below should be made in the generic/tk.decls script. */ #ifdef __GNUC__ /* * The rest of this file shouldn't warn about deprecated functions; they're * there because we intend them to be so and know that this file is OK to * touch those fields. */ #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif /* !BEGIN!: Do not edit below this line. */ static const TkIntStubs tkIntStubs = { TCL_STUB_MAGIC, 0, TkAllocWindow, /* 0 */ TkBezierPoints, /* 1 */ |
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ TkDrawAngledTextLayout, /* 181 */ TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ }; static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ | > | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | TkOrientPrintProc, /* 178 */ TkSmoothParseProc, /* 179 */ TkSmoothPrintProc, /* 180 */ TkDrawAngledTextLayout, /* 181 */ TkUnderlineAngledTextLayout, /* 182 */ TkIntersectAngledTextLayout, /* 183 */ TkDrawAngledChars, /* 184 */ TkDebugPhotoStringMatchDef, /* 185 */ }; static const TkIntPlatStubs tkIntPlatStubs = { TCL_STUB_MAGIC, 0, #if defined(_WIN32) || defined(__CYGWIN__) /* WIN */ TkAlignImageData, /* 0 */ |
︙ | ︙ | |||
720 721 722 723 724 725 726 727 728 729 730 731 732 733 | XDrawArcs, /* 131 */ XDrawRectangles, /* 132 */ XDrawSegments, /* 133 */ XDrawPoint, /* 134 */ XDrawPoints, /* 135 */ XReparentWindow, /* 136 */ XPutImage, /* 137 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ XGetImage, /* 3 */ XGetAtomName, /* 4 */ | > > | 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | XDrawArcs, /* 131 */ XDrawRectangles, /* 132 */ XDrawSegments, /* 133 */ XDrawPoint, /* 134 */ XDrawPoints, /* 135 */ XReparentWindow, /* 136 */ XPutImage, /* 137 */ XPolygonRegion, /* 138 */ XPointInRegion, /* 139 */ #endif /* WIN */ #ifdef MAC_OSX_TK /* AQUA */ XSetDashes, /* 0 */ XGetModifierMapping, /* 1 */ XCreateImage, /* 2 */ XGetImage, /* 3 */ XGetAtomName, /* 4 */ |
︙ | ︙ |
Changes to generic/tkStyle.c.
︙ | ︙ | |||
94 95 96 97 98 99 100 | * (by a derived element). */ } Element; /* * Thread-local data. */ | | | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | * (by a derived element). */ } Element; /* * Thread-local data. */ typedef struct { int nbInit; /* Number of calls to the init proc. */ Tcl_HashTable engineTable; /* Map a name to a style engine. Keys are * strings, values are Tk_StyleEngine * pointers. */ StyleEngine *defaultEnginePtr; /* Default, core-defined style engine. Global * fallback for all engines. */ |
︙ | ︙ | |||
151 152 153 154 155 156 157 | */ static const Tcl_ObjType styleObjType = { "style", /* name */ FreeStyleObjProc, /* freeIntRepProc */ DupStyleObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ | | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | */ static const Tcl_ObjType styleObjType = { "style", /* name */ FreeStyleObjProc, /* freeIntRepProc */ DupStyleObjProc, /* dupIntRepProc */ NULL, /* updateStringProc */ NULL /* setFromAnyProc */ }; /* *--------------------------------------------------------------------------- * * TkStylePkgInit -- * |
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | */ void Tk_GetElementSize( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ | | | 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 | */ void Tk_GetElementSize( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ int width, int height, /* Requested size. */ int inner, /* If TRUE, compute the outer size according * to the requested minimum inner size. If * FALSE, compute the inner size according to * the requested maximum outer size. */ int *widthPtr, int *heightPtr) |
︙ | ︙ | |||
1113 1114 1115 1116 1117 1118 1119 | */ void Tk_GetElementBox( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ | | | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | */ void Tk_GetElementBox( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ int x, int y, /* Top left corner of available area. */ int width, int height, /* Size of available area. */ int inner, /* Boolean. If TRUE, compute the bounding box * according to the requested inscribed box * size. If FALSE, compute the inscribed box * according to the requested bounding box. */ |
︙ | ︙ | |||
1155 1156 1157 1158 1159 1160 1161 | */ int Tk_GetElementBorderWidth( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ | | | 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 | */ int Tk_GetElementBorderWidth( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ void *recordPtr, /* The widget record. */ Tk_Window tkwin) /* The widget window. */ { Style *stylePtr = (Style *) style; StyledWidgetSpec *widgetSpecPtr = (StyledWidgetSpec *) element; return widgetSpecPtr->elementPtr->specPtr->getBorderWidth( stylePtr->clientData, recordPtr, widgetSpecPtr->optionsPtr, tkwin); |
︙ | ︙ | |||
1186 1187 1188 1189 1190 1191 1192 | */ void Tk_DrawElement( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ | | | 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 | */ void Tk_DrawElement( Tk_Style style, /* The widget style. */ Tk_StyledElement element, /* The styled element, previously returned by * Tk_GetStyledElement. */ void *recordPtr, /* The widget record. */ Tk_Window tkwin, /* The widget window. */ Drawable d, /* Where to draw element. */ int x, int y, /* Top left corner of element. */ int width, int height, /* Size of element. */ int state) /* Drawing state flags. */ { Style *stylePtr = (Style *) style; |
︙ | ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | entryPtr = Tcl_FindHashEntry(&tsdPtr->styleTable, (name!=NULL?name:"")); if (entryPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "style \"%s\" doesn't exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "STYLE", name, NULL); } | | | 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 | entryPtr = Tcl_FindHashEntry(&tsdPtr->styleTable, (name!=NULL?name:"")); if (entryPtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "style \"%s\" doesn't exist", name)); Tcl_SetErrorCode(interp, "TK", "LOOKUP", "STYLE", name, NULL); } return NULL; } stylePtr = Tcl_GetHashValue(entryPtr); return (Tk_Style) stylePtr; } /* |
︙ | ︙ | |||
1401 1402 1403 1404 1405 1406 1407 | Tk_Style Tk_AllocStyleFromObj( Tcl_Interp *interp, /* Interp for error return. */ Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { | < < | < < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | > > > > > | | 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 | Tk_Style Tk_AllocStyleFromObj( Tcl_Interp *interp, /* Interp for error return. */ Tcl_Obj *objPtr) /* Object containing name of the style to * retrieve. */ { if (objPtr->typePtr != &styleObjType) { if (SetStyleFromAny(interp, objPtr) != TCL_OK) { return NULL; } } return objPtr->internalRep.twoPtrValue.ptr1; } /* *---------------------------------------------------------------------- * * SetStyleFromAny -- * * Convert the internal representation of a Tcl object to the style * internal form. * * Results: * If an error occurs is returned (e.g. the style doesn't exist), an * error message will be left in interp's result and TCL_ERROR is returned. * * Side effects: * The object is left with its typePtr pointing to styleObjType. * *---------------------------------------------------------------------- */ static int SetStyleFromAny( Tcl_Interp *interp, /* Used for error reporting if not NULL. */ Tcl_Obj *objPtr) /* The object to convert. */ { const Tcl_ObjType *typePtr; const char *name; Tk_Style style; /* * Free the old internalRep before setting the new one. */ name = Tcl_GetString(objPtr); typePtr = objPtr->typePtr; if ((typePtr != NULL) && (typePtr->freeIntRepProc != NULL)) { typePtr->freeIntRepProc(objPtr); } style = Tk_GetStyle(interp, name); if (style == NULL) { return TCL_ERROR; } objPtr->typePtr = &styleObjType; objPtr->internalRep.twoPtrValue.ptr1 = style; return TCL_OK; } /* *--------------------------------------------------------------------------- * |
︙ | ︙ |
Changes to generic/tkTest.c.
︙ | ︙ | |||
27 28 29 30 31 32 33 | #ifdef _WIN32 #include "tkWinInt.h" #endif #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #include "tkScrollbar.h" | | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #ifdef _WIN32 #include "tkWinInt.h" #endif #if defined(MAC_OSX_TK) #include "tkMacOSXInt.h" #include "tkScrollbar.h" #define LOG_DISPLAY TkTestLogDisplay() #else #define LOG_DISPLAY 1 #endif #ifdef __UNIX__ #include "tkUnixInt.h" #endif /* |
︙ | ︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | static void CustomOptionRestore(ClientData clientData, Tk_Window tkwin, char *internalPtr, char *saveInternalPtr); static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestwrapperObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #endif static void TrivialCmdDeletedProc(ClientData clientData); static int TrivialConfigObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void TrivialEventProc(ClientData clientData, XEvent *eventPtr); /* *---------------------------------------------------------------------- * * Tktest_Init -- * | > > > > > > | | | | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | static void CustomOptionRestore(ClientData clientData, Tk_Window tkwin, char *internalPtr, char *saveInternalPtr); static void CustomOptionFree(ClientData clientData, Tk_Window tkwin, char *internalPtr); static int TestpropObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static int TestprintfObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) static int TestwrapperObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); #endif static void TrivialCmdDeletedProc(ClientData clientData); static int TrivialConfigObjCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); static void TrivialEventProc(ClientData clientData, XEvent *eventPtr); static int TestPhotoStringMatchCmd(ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[]); /* *---------------------------------------------------------------------- * * Tktest_Init -- * * This function performs initialization for the Tk test suite extensions. * * Results: * Returns a standard Tcl completion code, and leaves an error message in * the interp's result if an error occurs. * * Side effects: * Creates several test commands. * *---------------------------------------------------------------------- */ int Tktest_Init( Tcl_Interp *interp) /* Interpreter for application. */ { static int initialized = 0; if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { return TCL_ERROR; } if (Tk_InitStubs(interp, TK_VERSION, 0) == NULL) { return TCL_ERROR; } /* * Create additional commands for testing Tk. */ if (Tcl_PkgProvideEx(interp, "Tktest", TK_PATCH_LEVEL, NULL) == TCL_ERROR) { return TCL_ERROR; } Tcl_CreateObjCommand(interp, "square", SquareObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testbitmap", TestbitmapObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testborder", TestborderObjCmd, (ClientData) Tk_MainWindow(interp), NULL); |
︙ | ︙ | |||
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testmakeexist", TestmakeexistObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd, (ClientData) Tk_MainWindow(interp), NULL); #if defined(_WIN32) Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd, (ClientData) Tk_MainWindow(interp), NULL); #elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK) Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd, (ClientData) Tk_MainWindow(interp), NULL); | > > > > | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testfont", TestfontObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testmakeexist", TestmakeexistObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprop", TestpropObjCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testprintf", TestprintfObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "testtext", TkpTesttextCmd, (ClientData) Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testphotostringmatch", TestPhotoStringMatchCmd, (ClientData) Tk_MainWindow(interp), NULL); #if defined(_WIN32) Tcl_CreateObjCommand(interp, "testmetrics", TestmetricsObjCmd, (ClientData) Tk_MainWindow(interp), NULL); #elif !defined(__CYGWIN__) && !defined(MAC_OSX_TK) Tcl_CreateObjCommand(interp, "testmenubar", TestmenubarObjCmd, (ClientData) Tk_MainWindow(interp), NULL); |
︙ | ︙ | |||
451 452 453 454 455 456 457 | * This function implements the "testdeleteapps" command. It cleans up * all the interpreters left behind by the "testnewapp" command. * * Results: * A standard Tcl result. * * Side effects: | | | 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | * This function implements the "testdeleteapps" command. It cleans up * all the interpreters left behind by the "testnewapp" command. * * Results: * A standard Tcl result. * * Side effects: * All the interpreters created by previous calls to "testnewapp" get * deleted. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static int |
︙ | ︙ | |||
523 524 525 526 527 528 529 | "custom option", CustomOptionSet, CustomOptionGet, CustomOptionRestore, CustomOptionFree, INT2PTR(1) }; | | | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | "custom option", CustomOptionSet, CustomOptionGet, CustomOptionRestore, CustomOptionFree, INT2PTR(1) }; Tk_Window mainWin = clientData; Tk_Window tkwin; int index, result = TCL_OK; /* * Structures used by the "chain1" subcommand and also shared by the * "chain2" subcommand: */ typedef struct ExtensionWidgetRecord { TrivialCommandHeader header; Tcl_Obj *base1ObjPtr; Tcl_Obj *base2ObjPtr; Tcl_Obj *extension3ObjPtr; Tcl_Obj *extension4ObjPtr; Tcl_Obj *extension5ObjPtr; } ExtensionWidgetRecord; static const Tk_OptionSpec baseSpecs[] = { {TK_OPTION_STRING, "-one", "one", "One", "one", offsetof(ExtensionWidgetRecord, base1ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-two", "two", "Two", "two", offsetof(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "command"); return TCL_ERROR; } |
︙ | ︙ | |||
586 587 588 589 590 591 592 | } TypesRecord; TypesRecord *recordPtr; static const char *const stringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", | | | | | | | | | | | | | | | | | | 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | } TypesRecord; TypesRecord *recordPtr; static const char *const stringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec typesSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", offsetof(TypesRecord, booleanPtr), -1, 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "7", offsetof(TypesRecord, integerPtr), -1, 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", offsetof(TypesRecord, doublePtr), -1, 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", "foo", offsetof(TypesRecord, stringPtr), -1, TK_CONFIG_NULL_OK, 0, 0x8}, {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", "one", offsetof(TypesRecord, stringTablePtr), -1, TK_CONFIG_NULL_OK, stringTable, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", "red", offsetof(TypesRecord, colorPtr), -1, TK_CONFIG_NULL_OK, "black", 0x20}, {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12", offsetof(TypesRecord, fontPtr), -1, TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", offsetof(TypesRecord, bitmapPtr), -1, TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", offsetof(TypesRecord, borderPtr), -1, TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", offsetof(TypesRecord, reliefPtr), -1, TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", offsetof(TypesRecord, cursorPtr), -1, TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", offsetof(TypesRecord, justifyPtr), -1, TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, offsetof(TypesRecord, anchorPtr), -1, TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", offsetof(TypesRecord, pixelPtr), -1, TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "", offsetof(TypesRecord, customPtr), -1, TK_CONFIG_NULL_OK, &CustomOption, 0x4000}, {TK_OPTION_SYNONYM, "-synonym", NULL, NULL, NULL, 0, -1, 0, "-color", 0x8000}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, typesSpecs); tables[index] = optionTable; tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); recordPtr = ckalloc(sizeof(TypesRecord)); |
︙ | ︙ | |||
664 665 666 667 668 669 670 | recordPtr->cursorPtr = NULL; recordPtr->justifyPtr = NULL; recordPtr->anchorPtr = NULL; recordPtr->pixelPtr = NULL; recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; recordPtr->customPtr = NULL; | | | | | | | | | | | | | | | 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 | recordPtr->cursorPtr = NULL; recordPtr->justifyPtr = NULL; recordPtr->anchorPtr = NULL; recordPtr->pixelPtr = NULL; recordPtr->mmPtr = NULL; recordPtr->stringTablePtr = NULL; recordPtr->customPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, (ClientData) recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, (ClientData) recordPtr); result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_DestroyWindow(tkwin); } } else { Tk_DestroyWindow(tkwin); ckfree(recordPtr); } if (result == TCL_OK) { Tcl_SetObjResult(interp, objv[2]); } break; } case CHAIN1: { ExtensionWidgetRecord *recordPtr; Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); optionTable = Tk_CreateOptionTable(interp, baseSpecs); tables[index] = optionTable; recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL; recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_FreeConfigOptions(recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, (ClientData) recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, (ClientData) recordPtr); Tcl_SetObjResult(interp, objv[2]); } break; } case CHAIN2: case CHAIN3: { ExtensionWidgetRecord *recordPtr; static const Tk_OptionSpec extensionSpecs[] = { {TK_OPTION_STRING, "-three", "three", "Three", "three", offsetof(ExtensionWidgetRecord, extension3ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-four", "four", "Four", "four", offsetof(ExtensionWidgetRecord, extension4ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-two", "two", "Two", "two and a half", offsetof(ExtensionWidgetRecord, base2ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-oneAgain", "oneAgain", "OneAgain", "one again", offsetof(ExtensionWidgetRecord, extension5ObjPtr), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, -1, 0, (ClientData) baseSpecs, 0} }; Tk_Window tkwin; Tk_OptionTable optionTable; tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); optionTable = Tk_CreateOptionTable(interp, extensionSpecs); tables[index] = optionTable; recordPtr = ckalloc(sizeof(ExtensionWidgetRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = optionTable; recordPtr->header.tkwin = tkwin; recordPtr->base1ObjPtr = recordPtr->base2ObjPtr = NULL; recordPtr->extension3ObjPtr = recordPtr->extension4ObjPtr = NULL; recordPtr->extension5ObjPtr = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, optionTable, objc-3, objv+3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_FreeConfigOptions((char *) recordPtr, optionTable, tkwin); } } if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, |
︙ | ︙ | |||
787 788 789 790 791 792 793 | case CONFIG_ERROR: { typedef struct ErrorWidgetRecord { Tcl_Obj *intPtr; } ErrorWidgetRecord; ErrorWidgetRecord widgetRecord; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-int", "integer", "Integer", "bogus", | | | | 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 | case CONFIG_ERROR: { typedef struct ErrorWidgetRecord { Tcl_Obj *intPtr; } ErrorWidgetRecord; ErrorWidgetRecord widgetRecord; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-int", "integer", "Integer", "bogus", offsetof(ErrorWidgetRecord, intPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; widgetRecord.intPtr = NULL; optionTable = Tk_CreateOptionTable(interp, errorSpecs); tables[index] = optionTable; return Tk_InitOptions(interp, &widgetRecord, optionTable, (Tk_Window) NULL); } case DEL: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "tableName"); return TCL_ERROR; |
︙ | ︙ | |||
861 862 863 864 865 866 867 | } InternalRecord; InternalRecord *recordPtr; static const char *const internalStringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", | | | | | | | | | | | | | | | | | | | 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | } InternalRecord; InternalRecord *recordPtr; static const char *const internalStringTable[] = { "one", "two", "three", "four", NULL }; static const Tk_OptionSpec internalSpecs[] = { {TK_OPTION_BOOLEAN, "-boolean", "boolean", "Boolean", "1", -1, offsetof(InternalRecord, boolean), 0, 0, 0x1}, {TK_OPTION_INT, "-integer", "integer", "Integer", "148962237", -1, offsetof(InternalRecord, integer), 0, 0, 0x2}, {TK_OPTION_DOUBLE, "-double", "double", "Double", "3.14159", -1, offsetof(InternalRecord, doubleValue), 0, 0, 0x4}, {TK_OPTION_STRING, "-string", "string", "String", "foo", -1, offsetof(InternalRecord, string), TK_CONFIG_NULL_OK, 0, 0x8}, {TK_OPTION_STRING_TABLE, "-stringtable", "StringTable", "stringTable", "one", -1, offsetof(InternalRecord, index), TK_CONFIG_NULL_OK, internalStringTable, 0x10}, {TK_OPTION_COLOR, "-color", "color", "Color", "red", -1, offsetof(InternalRecord, colorPtr), TK_CONFIG_NULL_OK, "black", 0x20}, {TK_OPTION_FONT, "-font", "font", "Font", "Helvetica 12", -1, offsetof(InternalRecord, tkfont), TK_CONFIG_NULL_OK, 0, 0x40}, {TK_OPTION_BITMAP, "-bitmap", "bitmap", "Bitmap", "gray50", -1, offsetof(InternalRecord, bitmap), TK_CONFIG_NULL_OK, 0, 0x80}, {TK_OPTION_BORDER, "-border", "border", "Border", "blue", -1, offsetof(InternalRecord, border), TK_CONFIG_NULL_OK, "white", 0x100}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", "raised", -1, offsetof(InternalRecord, relief), TK_CONFIG_NULL_OK, 0, 0x200}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", "xterm", -1, offsetof(InternalRecord, cursor), TK_CONFIG_NULL_OK, 0, 0x400}, {TK_OPTION_JUSTIFY, "-justify", NULL, NULL, "left", -1, offsetof(InternalRecord, justify), TK_CONFIG_NULL_OK, 0, 0x800}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, -1, offsetof(InternalRecord, anchor), TK_CONFIG_NULL_OK, 0, 0x1000}, {TK_OPTION_PIXELS, "-pixel", "pixel", "Pixel", "1", -1, offsetof(InternalRecord, pixels), TK_CONFIG_NULL_OK, 0, 0x2000}, {TK_OPTION_WINDOW, "-window", "window", "Window", NULL, -1, offsetof(InternalRecord, tkwin), TK_CONFIG_NULL_OK, 0, 0}, {TK_OPTION_CUSTOM, "-custom", NULL, NULL, "", -1, offsetof(InternalRecord, custom), TK_CONFIG_NULL_OK, &CustomOption, 0x4000}, {TK_OPTION_SYNONYM, "-synonym", NULL, NULL, NULL, -1, -1, 0, "-color", 0x8000}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_OptionTable optionTable; Tk_Window tkwin; optionTable = Tk_CreateOptionTable(interp, internalSpecs); tables[index] = optionTable; tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); recordPtr = ckalloc(sizeof(InternalRecord)); |
︙ | ︙ | |||
943 944 945 946 947 948 949 | recordPtr->cursor = NULL; recordPtr->justify = TK_JUSTIFY_LEFT; recordPtr->anchor = TK_ANCHOR_N; recordPtr->pixels = 0; recordPtr->mm = 0.0; recordPtr->tkwin = NULL; recordPtr->custom = NULL; | | | | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | recordPtr->cursor = NULL; recordPtr->justify = TK_JUSTIFY_LEFT; recordPtr->anchor = TK_ANCHOR_N; recordPtr->pixels = 0; recordPtr->mm = 0.0; recordPtr->tkwin = NULL; recordPtr->custom = NULL; result = Tk_InitOptions(interp, recordPtr, optionTable, tkwin); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); result = Tk_SetOptions(interp, recordPtr, optionTable, objc - 3, objv + 3, tkwin, NULL, NULL); if (result != TCL_OK) { Tk_DestroyWindow(tkwin); } } else { Tk_DestroyWindow(tkwin); ckfree(recordPtr); |
︙ | ︙ | |||
978 979 980 981 982 983 984 | Tcl_Obj *three; Tcl_Obj *four; Tcl_Obj *five; } FiveRecord; FiveRecord *recordPtr; static const Tk_OptionSpec smallSpecs[] = { {TK_OPTION_INT, "-one", "one", "One", "1", | | | | | | | | | | | | | | | | | | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | Tcl_Obj *three; Tcl_Obj *four; Tcl_Obj *five; } FiveRecord; FiveRecord *recordPtr; static const Tk_OptionSpec smallSpecs[] = { {TK_OPTION_INT, "-one", "one", "One", "1", offsetof(FiveRecord, one), -1, 0, NULL, 0}, {TK_OPTION_INT, "-two", "two", "Two", "2", offsetof(FiveRecord, two), -1, 0, NULL, 0}, {TK_OPTION_INT, "-three", "three", "Three", "3", offsetof(FiveRecord, three), -1, 0, NULL, 0}, {TK_OPTION_INT, "-four", "four", "Four", "4", offsetof(FiveRecord, four), -1, 0, NULL, 0}, {TK_OPTION_STRING, "-five", NULL, NULL, NULL, offsetof(FiveRecord, five), -1, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "new name ?-option value ...?"); return TCL_ERROR; } recordPtr = ckalloc(sizeof(FiveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, smallSpecs); tables[index] = recordPtr->header.optionTable; recordPtr->header.tkwin = NULL; recordPtr->one = recordPtr->two = recordPtr->three = NULL; recordPtr->four = recordPtr->five = NULL; Tcl_SetObjResult(interp, objv[2]); result = Tk_InitOptions(interp, recordPtr, recordPtr->header.optionTable, (Tk_Window) NULL); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, (Tk_Window) NULL, NULL, NULL); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, (ClientData) recordPtr, TrivialCmdDeletedProc); } else { Tk_FreeConfigOptions(recordPtr, recordPtr->header.optionTable, (Tk_Window) NULL); } } if (result != TCL_OK) { ckfree(recordPtr); } break; } case NOT_ENOUGH_PARAMS: { typedef struct NotEnoughRecord { Tcl_Obj *fooObjPtr; } NotEnoughRecord; NotEnoughRecord record; static const Tk_OptionSpec errorSpecs[] = { {TK_OPTION_INT, "-foo", "foo", "Foo", "0", offsetof(NotEnoughRecord, fooObjPtr), 0, 0, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tcl_Obj *newObjPtr = Tcl_NewStringObj("-foo", -1); Tk_OptionTable optionTable; record.fooObjPtr = NULL; tkwin = Tk_CreateWindowFromPath(interp, mainWin, ".config", NULL); Tk_SetClass(tkwin, "Config"); optionTable = Tk_CreateOptionTable(interp, errorSpecs); tables[index] = optionTable; Tk_InitOptions(interp, &record, optionTable, tkwin); if (Tk_SetOptions(interp, &record, optionTable, 1, &newObjPtr, tkwin, NULL, NULL) != TCL_OK) { result = TCL_ERROR; } Tcl_DecrRefCount(newObjPtr); Tk_FreeConfigOptions( (char *) &record, optionTable, tkwin); Tk_DestroyWindow(tkwin); return result; } case TWO_WINDOWS: { typedef struct SlaveRecord { TrivialCommandHeader header; Tcl_Obj *windowPtr; } SlaveRecord; SlaveRecord *recordPtr; static const Tk_OptionSpec slaveSpecs[] = { {TK_OPTION_WINDOW, "-window", "window", "Window", ".bar", offsetof(SlaveRecord, windowPtr), -1, TK_CONFIG_NULL_OK, NULL, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 0} }; Tk_Window tkwin = Tk_CreateWindowFromPath(interp, clientData, Tcl_GetString(objv[2]), NULL); if (tkwin == NULL) { return TCL_ERROR; } Tk_SetClass(tkwin, "Test"); recordPtr = ckalloc(sizeof(SlaveRecord)); recordPtr->header.interp = interp; recordPtr->header.optionTable = Tk_CreateOptionTable(interp, slaveSpecs); tables[index] = recordPtr->header.optionTable; recordPtr->header.tkwin = tkwin; recordPtr->windowPtr = NULL; result = Tk_InitOptions(interp, recordPtr, recordPtr->header.optionTable, tkwin); if (result == TCL_OK) { result = Tk_SetOptions(interp, recordPtr, recordPtr->header.optionTable, objc - 3, objv + 3, tkwin, NULL, NULL); if (result == TCL_OK) { recordPtr->header.widgetCmd = Tcl_CreateObjCommand(interp, Tcl_GetString(objv[2]), TrivialConfigObjCmd, recordPtr, TrivialCmdDeletedProc); Tk_CreateEventHandler(tkwin, StructureNotifyMask, TrivialEventProc, recordPtr); Tcl_SetObjResult(interp, objv[2]); } else { Tk_FreeConfigOptions(recordPtr, recordPtr->header.optionTable, tkwin); } } if (result != TCL_OK) { Tk_DestroyWindow(tkwin); ckfree(recordPtr); } |
︙ | ︙ | |||
1144 1145 1146 1147 1148 1149 1150 | "cget", "configure", "csave", NULL }; enum { CGET, CONFIGURE, CSAVE }; Tcl_Obj *resultObjPtr; int index, mask; | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | "cget", "configure", "csave", NULL }; enum { CGET, CONFIGURE, CSAVE }; Tcl_Obj *resultObjPtr; int index, mask; TrivialCommandHeader *headerPtr = clientData; Tk_Window tkwin = headerPtr->tkwin; Tk_SavedOptions saved; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg arg...?"); return TCL_ERROR; } |
︙ | ︙ | |||
1167 1168 1169 1170 1171 1172 1173 | switch (index) { case CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } | | | | | | | | | 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | switch (index) { case CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } resultObjPtr = Tk_GetOptionValue(interp, clientData, headerPtr->optionTable, objv[2], tkwin); if (resultObjPtr != NULL) { Tcl_SetObjResult(interp, resultObjPtr); result = TCL_OK; } else { result = TCL_ERROR; } break; case CONFIGURE: if (objc == 2) { resultObjPtr = Tk_GetOptionInfo(interp, clientData, headerPtr->optionTable, NULL, tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObjPtr); } } else if (objc == 3) { resultObjPtr = Tk_GetOptionInfo(interp, clientData, headerPtr->optionTable, objv[2], tkwin); if (resultObjPtr == NULL) { result = TCL_ERROR; } else { Tcl_SetObjResult(interp, resultObjPtr); } } else { result = Tk_SetOptions(interp, clientData, headerPtr->optionTable, objc - 2, objv + 2, tkwin, NULL, &mask); if (result == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask)); } } break; case CSAVE: result = Tk_SetOptions(interp, clientData, headerPtr->optionTable, objc - 2, objv + 2, tkwin, &saved, &mask); Tk_FreeSavedOptions(&saved); if (result == TCL_OK) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(mask)); } break; } done: Tcl_Release(clientData); return result; } |
︙ | ︙ | |||
1239 1240 1241 1242 1243 1244 1245 | *---------------------------------------------------------------------- */ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { | | | | | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 | *---------------------------------------------------------------------- */ static void TrivialCmdDeletedProc( ClientData clientData) /* Pointer to widget record for widget. */ { TrivialCommandHeader *headerPtr = clientData; Tk_Window tkwin = headerPtr->tkwin; if (tkwin != NULL) { Tk_DestroyWindow(tkwin); } else if (headerPtr->optionTable != NULL) { /* * This is a "new" object, which doesn't have a window, so we can't * depend on cleaning up in the event function. Free its resources * here. */ Tk_FreeConfigOptions(clientData, headerPtr->optionTable, NULL); Tcl_EventuallyFree(clientData, TCL_DYNAMIC); } } /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | */ static void TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { | | | | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | */ static void TrivialEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TrivialCommandHeader *headerPtr = clientData; if (eventPtr->type == DestroyNotify) { if (headerPtr->tkwin != NULL) { Tk_FreeConfigOptions(clientData, headerPtr->optionTable, headerPtr->tkwin); headerPtr->optionTable = NULL; headerPtr->tkwin = NULL; Tcl_DeleteCommandFromToken(headerPtr->interp, headerPtr->widgetCmd); } Tcl_EventuallyFree(clientData, TCL_DYNAMIC); |
︙ | ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | { static const char *const options[] = {"counts", "subfonts", NULL}; enum option {COUNTS, SUBFONTS}; int index; Tk_Window tkwin; Tk_Font tkfont; | | | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 | { static const char *const options[] = {"counts", "subfonts", NULL}; enum option {COUNTS, SUBFONTS}; int index; Tk_Window tkwin; Tk_Font tkfont; tkwin = clientData; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option fontName"); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], options, |
︙ | ︙ | |||
1444 1445 1446 1447 1448 1449 1450 | static int ImageObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { | | | 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | static int ImageObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TImageMaster *timPtr = clientData; int x, y, width, height; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } if (strcmp(Tcl_GetString(objv[1]), "changed") == 0) { |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { | | | 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | static ClientData ImageGet( Tk_Window tkwin, /* Token for window in which image will be * used. */ ClientData clientData) /* Pointer to TImageMaster for image. */ { TImageMaster *timPtr = clientData; TImageInstance *instPtr; char buffer[100]; XGCValues gcValues; sprintf(buffer, "%s get", timPtr->imageName); Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); |
︙ | ︙ | |||
1546 1547 1548 1549 1550 1551 1552 | int imageX, int imageY, /* Origin of area to redraw, relative to * origin of image. */ int width, int height, /* Dimensions of area to redraw. */ int drawableX, int drawableY) /* Coordinates in drawable corresponding to * imageX and imageY. */ { | | < < < | | | > > | > > > | > > | < | < > > > > > > > > > > | | < | | 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 | int imageX, int imageY, /* Origin of area to redraw, relative to * origin of image. */ int width, int height, /* Dimensions of area to redraw. */ int drawableX, int drawableY) /* Coordinates in drawable corresponding to * imageX and imageY. */ { TImageInstance *instPtr = clientData; char buffer[200 + TCL_INTEGER_SPACE * 6]; /* * The purpose of the test image type is to track the calls to an image * display proc and record the parameters passed in each call. On macOS * a display proc must be run inside of the drawRect method of an NSView * in order for the graphics operations to have any effect. To deal with * this, whenever a display proc is called outside of any drawRect method * it schedules a redraw of the NSView by calling [view setNeedsDisplay:YES]. * This will trigger a later call to the view's drawRect method which will * run the display proc a second time. * * This complicates testing, since it can result in more calls to the display * proc than are expected by the test. It can also result in an inconsistent * number of calls unless the test waits until the call to drawRect actually * occurs before validating its results. * * In an attempt to work around this, this display proc only logs those * calls which occur within a drawRect method. This means that tests must * be written so as to ensure that the drawRect method is run before * results are validated. In practice it usually suffices to run update * idletasks (to run the display proc the first time) followed by update * (to run the display proc in drawRect). * * This also has the consequence that the image changed command will log * different results on Aqua than on other systems, because when the image * is redisplayed in the drawRect method the entire image will be drawn, * not just the changed portion. Tests must account for this. */ if (LOG_DISPLAY) { sprintf(buffer, "%s display %d %d %d %d", instPtr->masterPtr->imageName, imageX, imageY, width, height); Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); } if (width > (instPtr->masterPtr->width - imageX)) { width = instPtr->masterPtr->width - imageX; } if (height > (instPtr->masterPtr->height - imageY)) { height = instPtr->masterPtr->height - imageY; } |
︙ | ︙ | |||
1610 1611 1612 1613 1614 1615 1616 | */ static void ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { | | | 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 | */ static void ImageFree( ClientData clientData, /* Pointer to TImageInstance for instance. */ Display *display) /* Display where image was to be drawn. */ { TImageInstance *instPtr = clientData; char buffer[200]; sprintf(buffer, "%s free", instPtr->masterPtr->imageName); Tcl_SetVar2(instPtr->masterPtr->interp, instPtr->masterPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tk_FreeColor(instPtr->fg); Tk_FreeGC(display, instPtr->gc); |
︙ | ︙ | |||
1644 1645 1646 1647 1648 1649 1650 | static void ImageDelete( ClientData clientData) /* Pointer to TImageMaster for image. When * this function is called, no more instances * exist. */ { | | | 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 | static void ImageDelete( ClientData clientData) /* Pointer to TImageMaster for image. When * this function is called, no more instances * exist. */ { TImageMaster *timPtr = clientData; char buffer[100]; sprintf(buffer, "%s delete", timPtr->imageName); Tcl_SetVar2(timPtr->interp, timPtr->varName, NULL, buffer, TCL_GLOBAL_ONLY|TCL_APPEND_VALUE|TCL_LIST_ELEMENT); Tcl_DeleteCommand(timPtr->interp, timPtr->imageName); |
︙ | ︙ | |||
1683 1684 1685 1686 1687 1688 1689 | static int TestmakeexistObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { | | | 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 | static int TestmakeexistObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window mainWin = clientData; int i; Tk_Window tkwin; for (i = 1; i < objc; i++) { tkwin = Tk_NameToWindow(interp, Tcl_GetString(objv[i]), mainWin); if (tkwin == NULL) { return TCL_ERROR; |
︙ | ︙ | |||
1726 1727 1728 1729 1730 1731 1732 | TestmenubarObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ | | | 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 | TestmenubarObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { #ifdef __UNIX__ Tk_Window mainWin = clientData; Tk_Window tkwin, menubar; if (objc < 2) { Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?"); return TCL_ERROR; } |
︙ | ︙ | |||
1839 1840 1841 1842 1843 1844 1845 | static int TestpropObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { | | | 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 | static int TestpropObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tk_Window mainWin = clientData; int result, actualFormat; unsigned long bytesAfter, length, value; Atom actualType, propName; unsigned char *property, *p; char *end; Window w; char buffer[30]; |
︙ | ︙ | |||
1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 | } } if (property != NULL) { XFree(property); } return TCL_OK; } #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- * * TestwrapperObjCmd -- * | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 | } } if (property != NULL) { XFree(property); } return TCL_OK; } /* *---------------------------------------------------------------------- * * TestpropObjCmd -- * * This function implements the "testprop" command. It fetches and prints * the value of a property on a window. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static int TestprintfObjCmd( ClientData clientData, /* Not used */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { char buffer[256]; Tcl_WideInt wideInt; #ifdef _WIN32 __int64 longLongInt; #else long long longLongInt; #endif if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "wideint"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &wideInt) != TCL_OK) { return TCL_ERROR; } longLongInt = wideInt; /* Just add a lot of arguments to sprintf. Reason: on AMD64, the first * 4 or 6 arguments (we assume 8, just in case) might be put in registers, * which still woudn't tell if the assumed size is correct: We want this * test-case to fail if the 64-bit value is printed as truncated to 32-bit. */ sprintf(buffer, "%s%s%s%s%s%s%s%s%" TCL_LL_MODIFIER "d %" TCL_LL_MODIFIER "u", "", "", "", "", "", "", "", "", (Tcl_WideInt)longLongInt, (Tcl_WideUInt)longLongInt); Tcl_AppendResult(interp, buffer, NULL); return TCL_OK; } #if !(defined(_WIN32) || defined(MAC_OSX_TK) || defined(__CYGWIN__)) /* *---------------------------------------------------------------------- * * TestwrapperObjCmd -- * |
︙ | ︙ | |||
1926 1927 1928 1929 1930 1931 1932 | Tk_Window tkwin; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "window"); return TCL_ERROR; } | | | 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 | Tk_Window tkwin; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "window"); return TCL_ERROR; } tkwin = clientData; winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[1]), tkwin); if (winPtr == NULL) { return TCL_ERROR; } wrapperPtr = TkpGetWrapperWindow(winPtr); if (wrapperPtr != NULL) { |
︙ | ︙ | |||
1985 1986 1987 1988 1989 1990 1991 | int flags) { int objEmpty; char *newStr, *string, *internalPtr; objEmpty = 0; | | | 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 | int flags) { int objEmpty; char *newStr, *string, *internalPtr; objEmpty = 0; if (internalOffset != -1) { internalPtr = recordPtr + internalOffset; } else { internalPtr = NULL; } /* * See if the object is empty. |
︙ | ︙ | |||
2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | Tk_Window tkwin, char *internalPtr) { if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 | Tk_Window tkwin, char *internalPtr) { if (*(char **)internalPtr != NULL) { ckfree(*(char **)internalPtr); } } /* *---------------------------------------------------------------------- * * TestPhotoStringMatchCmd -- * * This function implements the "testphotostringmatch" command. It * provides a way from Tcl to call the string match function for the * default image handler directly. * * Results: * A standard Tcl result. If data is in the proper format, the result in * interp will contain width and height as a list. If the data cannot be * parsed as default image format, returns TCL_ERROR and leaves an * appropriate error message in interp. * * Side effects: * None. * *---------------------------------------------------------------------- */ /* ARGSUSED */ static int TestPhotoStringMatchCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { Tcl_Obj *dummy = NULL; Tcl_Obj *resultObj[2]; int width, height; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "imageData"); return TCL_ERROR; } if (TkDebugPhotoStringMatchDef(interp, objv[1], dummy, &width, &height)) { resultObj[0] = Tcl_NewWideIntObj(width); resultObj[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, resultObj)); return TCL_OK; } else { return TCL_ERROR; } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkText.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | * Copyright (c) 1994-1996 Sun Microsystems, Inc. * Copyright (c) 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. */ | | | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Copyright (c) 1994-1996 Sun Microsystems, Inc. * Copyright (c) 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. */ #include "tkInt.h" #include "tkUndo.h" #include "default.h" #if defined(MAC_OSX_TK) #define Style TkStyle #define DInfo TkDInfo #endif /* |
︙ | ︙ | |||
118 119 120 121 122 123 124 | /* * Information used to parse text configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators", "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, -1, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | /* * Information used to parse text configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_BOOLEAN, "-autoseparators", "autoSeparators", "AutoSeparators", DEF_TEXT_AUTO_SEPARATORS, -1, offsetof(TkText, autoSeparators), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BORDER, "-background", "background", "Background", DEF_TEXT_BG_COLOR, -1, offsetof(TkText, border), 0, DEF_TEXT_BG_MONO, 0}, {TK_OPTION_SYNONYM, "-bd", NULL, NULL, NULL, 0, -1, 0, "-borderwidth", TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_SYNONYM, "-bg", NULL, NULL, NULL, 0, -1, 0, "-background", 0}, {TK_OPTION_BOOLEAN, "-blockcursor", "blockCursor", "BlockCursor", DEF_TEXT_BLOCK_CURSOR, -1, offsetof(TkText, insertCursorType), 0, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEF_TEXT_BORDER_WIDTH, -1, offsetof(TkText, borderWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", DEF_TEXT_CURSOR, -1, offsetof(TkText, cursor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_CUSTOM, "-endline", NULL, NULL, NULL, -1, offsetof(TkText, end), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", DEF_TEXT_EXPORT_SELECTION, -1, offsetof(TkText, exportSelection), 0, 0, 0}, {TK_OPTION_SYNONYM, "-fg", "foreground", NULL, NULL, 0, -1, 0, "-foreground", 0}, {TK_OPTION_FONT, "-font", "font", "Font", DEF_TEXT_FONT, -1, offsetof(TkText, tkfont), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_COLOR, "-foreground", "foreground", "Foreground", DEF_TEXT_FG, -1, offsetof(TkText, fgColor), 0, 0, 0}, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_TEXT_HEIGHT, -1, offsetof(TkText, height), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightbackground", "highlightBackground", "HighlightBackground", DEF_TEXT_HIGHLIGHT_BG, -1, offsetof(TkText, highlightBgColorPtr), 0, 0, 0}, {TK_OPTION_COLOR, "-highlightcolor", "highlightColor", "HighlightColor", DEF_TEXT_HIGHLIGHT, -1, offsetof(TkText, highlightColorPtr), 0, 0, 0}, {TK_OPTION_PIXELS, "-highlightthickness", "highlightThickness", "HighlightThickness", DEF_TEXT_HIGHLIGHT_WIDTH, -1, offsetof(TkText, highlightWidth), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_BORDER, "-inactiveselectbackground","inactiveSelectBackground", "Foreground", DEF_TEXT_INACTIVE_SELECT_COLOR, -1, offsetof(TkText, inactiveSelBorder), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_MONO, 0}, {TK_OPTION_BORDER, "-insertbackground", "insertBackground", "Foreground", DEF_TEXT_INSERT_BG, -1, offsetof(TkText, insertBorder), 0, 0, 0}, {TK_OPTION_PIXELS, "-insertborderwidth", "insertBorderWidth", "BorderWidth", DEF_TEXT_INSERT_BD_COLOR, -1, offsetof(TkText, insertBorderWidth), 0, (ClientData) DEF_TEXT_INSERT_BD_MONO, 0}, {TK_OPTION_INT, "-insertofftime", "insertOffTime", "OffTime", DEF_TEXT_INSERT_OFF_TIME, -1, offsetof(TkText, insertOffTime), 0, 0, 0}, {TK_OPTION_INT, "-insertontime", "insertOnTime", "OnTime", DEF_TEXT_INSERT_ON_TIME, -1, offsetof(TkText, insertOnTime), 0, 0, 0}, {TK_OPTION_STRING_TABLE, "-insertunfocussed", "insertUnfocussed", "InsertUnfocussed", DEF_TEXT_INSERT_UNFOCUSSED, -1, offsetof(TkText, insertUnfocussed), 0, insertUnfocussedStrings, 0}, {TK_OPTION_PIXELS, "-insertwidth", "insertWidth", "InsertWidth", DEF_TEXT_INSERT_WIDTH, -1, offsetof(TkText, insertWidth), 0, 0, 0}, {TK_OPTION_INT, "-maxundo", "maxUndo", "MaxUndo", DEF_TEXT_MAX_UNDO, -1, offsetof(TkText, maxUndo), TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_PIXELS, "-padx", "padX", "Pad", DEF_TEXT_PADX, -1, offsetof(TkText, padX), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_PIXELS, "-pady", "padY", "Pad", DEF_TEXT_PADY, -1, offsetof(TkText, padY), 0, 0, 0}, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", DEF_TEXT_RELIEF, -1, offsetof(TkText, relief), 0, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", "selectBackground", "Foreground", DEF_TEXT_SELECT_COLOR, -1, offsetof(TkText, selBorder), 0, DEF_TEXT_SELECT_MONO, 0}, {TK_OPTION_PIXELS, "-selectborderwidth", "selectBorderWidth", "BorderWidth", DEF_TEXT_SELECT_BD_COLOR, offsetof(TkText, selBorderWidthPtr), offsetof(TkText, selBorderWidth), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_BD_MONO, 0}, {TK_OPTION_COLOR, "-selectforeground", "selectForeground", "Background", DEF_TEXT_SELECT_FG_COLOR, -1, offsetof(TkText, selFgColorPtr), TK_OPTION_NULL_OK, DEF_TEXT_SELECT_FG_MONO, 0}, {TK_OPTION_BOOLEAN, "-setgrid", "setGrid", "SetGrid", DEF_TEXT_SET_GRID, -1, offsetof(TkText, setGrid), 0, 0, 0}, {TK_OPTION_PIXELS, "-spacing1", "spacing1", "Spacing", DEF_TEXT_SPACING1, -1, offsetof(TkText, spacing1), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing2", "spacing2", "Spacing", DEF_TEXT_SPACING2, -1, offsetof(TkText, spacing2), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_PIXELS, "-spacing3", "spacing3", "Spacing", DEF_TEXT_SPACING3, -1, offsetof(TkText, spacing3), 0, 0 , TK_TEXT_LINE_GEOMETRY }, {TK_OPTION_CUSTOM, "-startline", NULL, NULL, NULL, -1, offsetof(TkText, start), TK_OPTION_NULL_OK, &lineOption, TK_TEXT_LINE_RANGE}, {TK_OPTION_STRING_TABLE, "-state", "state", "State", DEF_TEXT_STATE, -1, offsetof(TkText, state), 0, stateStrings, 0}, {TK_OPTION_STRING, "-tabs", "tabs", "Tabs", DEF_TEXT_TABS, offsetof(TkText, tabOptionPtr), -1, TK_OPTION_NULL_OK, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-tabstyle", "tabStyle", "TabStyle", DEF_TEXT_TABSTYLE, -1, offsetof(TkText, tabStyle), 0, tabStyleStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", DEF_TEXT_TAKE_FOCUS, -1, offsetof(TkText, takeFocus), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BOOLEAN, "-undo", "undo", "Undo", DEF_TEXT_UNDO, -1, offsetof(TkText, undo), TK_OPTION_DONT_SET_DEFAULT, 0 , 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_TEXT_WIDTH, -1, offsetof(TkText, width), 0, 0, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING_TABLE, "-wrap", "wrap", "Wrap", DEF_TEXT_WRAP, -1, offsetof(TkText, wrapMode), 0, wrapStrings, TK_TEXT_LINE_GEOMETRY}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", DEF_TEXT_XSCROLL_COMMAND, -1, offsetof(TkText, xScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", DEF_TEXT_YSCROLL_COMMAND, -1, offsetof(TkText, yScrollCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0} }; /* * These three typedefs, the structure and the SearchPerform, SearchCore * functions below are used for line-based searches of the text widget, and, |
︙ | ︙ | |||
656 657 658 659 660 661 662 | Tk_CreateEventHandler(textPtr->tkwin, KeyPressMask|KeyReleaseMask |ButtonPressMask|ButtonReleaseMask|EnterWindowMask |LeaveWindowMask|PointerMotionMask|VirtualEventMask, TkTextBindProc, textPtr); Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING, TextFetchSelection, textPtr, XA_STRING); | | | 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 | Tk_CreateEventHandler(textPtr->tkwin, KeyPressMask|KeyReleaseMask |ButtonPressMask|ButtonReleaseMask|EnterWindowMask |LeaveWindowMask|PointerMotionMask|VirtualEventMask, TkTextBindProc, textPtr); Tk_CreateSelHandler(textPtr->tkwin, XA_PRIMARY, XA_STRING, TextFetchSelection, textPtr, XA_STRING); if (Tk_InitOptions(interp, textPtr, optionTable, textPtr->tkwin) != TCL_OK) { Tk_DestroyWindow(textPtr->tkwin); return TCL_ERROR; } if (ConfigureText(interp, textPtr, objc-2, objv+2) != TCL_OK) { Tk_DestroyWindow(textPtr->tkwin); return TCL_ERROR; |
︙ | ︙ | |||
744 745 746 747 748 749 750 | result = TCL_ERROR; goto done; } if (TkTextIndexBbox(textPtr, indexPtr, &x, &y, &width, &height, NULL) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); | | | | | | | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | result = TCL_ERROR; goto done; } if (TkTextIndexBbox(textPtr, indexPtr, &x, &y, &width, &height, NULL) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height)); Tcl_SetObjResult(interp, listObj); } break; } case TEXT_CGET: if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "option"); result = TCL_ERROR; goto done; } else { Tcl_Obj *objPtr = Tk_GetOptionValue(interp, textPtr, textPtr->optionTable, objv[2], textPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; } Tcl_SetObjResult(interp, objPtr); |
︙ | ︙ | |||
822 823 824 825 826 827 828 | " <, <=, ==, >=, >, or !=", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "COMPARISON", NULL); result = TCL_ERROR; goto done; } case TEXT_CONFIGURE: if (objc <= 3) { | | | 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 | " <, <=, ==, >=, >, or !=", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "VALUE", "COMPARISON", NULL); result = TCL_ERROR; goto done; } case TEXT_CONFIGURE: if (objc <= 3) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, textPtr, textPtr->optionTable, ((objc == 3) ? objv[2] : NULL), textPtr->tkwin); if (objPtr == NULL) { result = TCL_ERROR; goto done; } |
︙ | ︙ | |||
860 861 862 863 864 865 866 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; | | | < | 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 | if (indexToPtr == NULL) { result = TCL_ERROR; goto done; } for (i = 2; i < objc-2; i++) { int value; TkSizeT length; const char *option = TkGetStringFromObj(objv[i], &length); char c; if (length < 2 || option[0] != '-') { goto badOption; } c = option[1]; if (c == 'c' && !strncmp("-chars", option, length)) { value = CountIndices(textPtr, indexFromPtr, indexToPtr, COUNT_CHARS); |
︙ | ︙ | |||
1016 1017 1018 1019 1020 1021 1022 | } else { goto badOption; } countDone: found++; if (found == 1) { | | | | | 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 | } else { goto badOption; } countDone: found++; if (found == 1) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else { if (found == 2) { /* * Move the first item we put into the result into the * first element of the list object. */ objPtr = Tcl_NewObj(); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_GetObjResult(interp)); } Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj(value)); } } if (found == 0) { /* * Use the default '-indices'. */ int value = CountIndices(textPtr, indexFromPtr, indexToPtr, COUNT_INDICES); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(value)); } else if (found > 1) { Tcl_SetObjResult(interp, objPtr); } break; badOption: Tcl_SetObjResult(interp, Tcl_ObjPrintf( |
︙ | ︙ | |||
1151 1152 1153 1154 1155 1156 1157 | if (objc & 1) { indices[i] = indices[i-1]; TkTextIndexForwChars(NULL, &indices[i], 1, &indices[i], COUNT_INDICES); objc++; } useIdx = ckalloc(objc); | | | | 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 | if (objc & 1) { indices[i] = indices[i-1]; TkTextIndexForwChars(NULL, &indices[i], 1, &indices[i], COUNT_INDICES); objc++; } useIdx = ckalloc(objc); memset(useIdx, 0, objc); /* * Do a decreasing order sort so that we delete the end ranges * first to maintain index consistency. */ qsort(indices, objc / 2, 2 * sizeof(TkTextIndex), TextIndexSortProc); lastStart = NULL; /* * Second pass will handle bogus ranges (end < start) and * overlapping ranges. */ |
︙ | ︙ | |||
1236 1237 1238 1239 1240 1241 1242 | result = TCL_ERROR; goto done; } if (TkTextDLineInfo(textPtr, indexPtr, &x, &y, &width, &height, &base) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); | | | | | | | | < | < | 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 | result = TCL_ERROR; goto done; } if (TkTextDLineInfo(textPtr, indexPtr, &x, &y, &width, &height, &base) == 0) { Tcl_Obj *listObj = Tcl_NewListObj(0, NULL); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(x)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(y)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(width)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(height)); Tcl_ListObjAppendElement(interp, listObj, Tcl_NewWideIntObj(base)); Tcl_SetObjResult(interp, listObj); } break; } case TEXT_DUMP: result = TextDumpCmd(textPtr, interp, objc, objv); break; case TEXT_EDIT: result = TextEditCmd(textPtr, interp, objc, objv); break; case TEXT_GET: { Tcl_Obj *objPtr = NULL; int i, found = 0, visible = 0; const char *name; TkSizeT length; if (objc < 3) { Tcl_WrongNumArgs(interp, 2, objv, "?-displaychars? ?--? index1 ?index2 ...?"); result = TCL_ERROR; goto done; } /* * Simple, restrictive argument parsing. The only options are -- and * -displaychars (or any unique prefix). */ i = 2; if (objc > 3) { name = TkGetStringFromObj(objv[i], &length); if (length > 1 && name[0] == '-') { if (strncmp("-displaychars", name, length) == 0) { i++; visible = 1; name = TkGetStringFromObj(objv[i], &length); } if ((i < objc-1) && (length == 2) && !strcmp("--", name)) { i++; } } } |
︙ | ︙ | |||
2630 2631 2632 2633 2634 2635 2636 | * modified if the index is not valid for * insertion (e.g. if at "end"). */ Tcl_Obj *stringPtr, /* Null-terminated string containing new * information to add to text. */ int viewUpdate) /* Update the view if set. */ { int lineIndex; | | | < | 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 | * modified if the index is not valid for * insertion (e.g. if at "end"). */ Tcl_Obj *stringPtr, /* Null-terminated string containing new * information to add to text. */ int viewUpdate) /* Update the view if set. */ { int lineIndex; TkSizeT length; TkText *tPtr; int *lineAndByteIndex; int resetViewCount; int pixels[2*PIXEL_CLIENTS]; const char *string = TkGetStringFromObj(stringPtr, &length); if (sharedTextPtr == NULL) { sharedTextPtr = textPtr->sharedTextPtr; } /* * Don't allow insertions on the last (dummy) line of the text. This is * the only place in this function where the indexPtr is modified. |
︙ | ︙ | |||
2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | const TkTextIndex *index1Ptr, /* Index describing first location. */ const TkTextIndex *index2Ptr) /* Index describing second location. */ { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; /* * Create the helpers. */ Tcl_Obj *seeInsertObj = Tcl_NewObj(); Tcl_Obj *markSet1InsertObj = Tcl_NewObj(); Tcl_Obj *markSet2InsertObj = NULL; Tcl_Obj *insertCmdObj = Tcl_NewObj(); Tcl_Obj *deleteCmdObj = Tcl_NewObj(); /* * Get the index positions. */ Tcl_Obj *index1Obj = TkTextNewIndexObj(NULL, index1Ptr); Tcl_Obj *index2Obj = TkTextNewIndexObj(NULL, index2Ptr); | > > > > > > > | 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 | const TkTextIndex *index1Ptr, /* Index describing first location. */ const TkTextIndex *index2Ptr) /* Index describing second location. */ { TkUndoSubAtom *iAtom, *dAtom; int canUndo, canRedo; char lMarkName[20] = "tk::undoMarkL"; char rMarkName[20] = "tk::undoMarkR"; char stringUndoMarkId[16] = ""; /* * Create the helpers. */ Tcl_Obj *seeInsertObj = Tcl_NewObj(); Tcl_Obj *markSet1InsertObj = Tcl_NewObj(); Tcl_Obj *markSet2InsertObj = NULL; Tcl_Obj *insertCmdObj = Tcl_NewObj(); Tcl_Obj *deleteCmdObj = Tcl_NewObj(); Tcl_Obj *markSetLUndoMarkCmdObj = Tcl_NewObj(); Tcl_Obj *markSetRUndoMarkCmdObj = NULL; Tcl_Obj *markGravityLUndoMarkCmdObj = Tcl_NewObj(); Tcl_Obj *markGravityRUndoMarkCmdObj = NULL; /* * Get the index positions. */ Tcl_Obj *index1Obj = TkTextNewIndexObj(NULL, index1Ptr); Tcl_Obj *index2Obj = TkTextNewIndexObj(NULL, index2Ptr); |
︙ | ︙ | |||
2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 | Tcl_ListObjAppendElement(NULL, insertCmdObj, undoString); Tcl_ListObjAppendElement(NULL, deleteCmdObj, Tcl_NewStringObj("delete", 6)); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj); /* * Note: we don't wish to use textPtr->widgetCmd in these callbacks * because if we delete the textPtr, but peers still exist, we will then * have references to a non-existent Tcl_Command in the undo stack, which * will lead to crashes later. Also, the behaviour of the widget w.r.t. * bindings (%W substitutions) always uses the widget path name, so there * is no good reason the undo stack should do otherwise. * * For the 'insert' and 'delete' actions, we have to register a functional * callback, because these actions are defined to operate on the * underlying data shared by all peers. */ iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, insertCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom); dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, deleteCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom); Tcl_DecrRefCount(seeInsertObj); Tcl_DecrRefCount(index1Obj); Tcl_DecrRefCount(index2Obj); canUndo = TkUndoCanUndo(textPtr->sharedTextPtr->undoStack); canRedo = TkUndoCanRedo(textPtr->sharedTextPtr->undoStack); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 | Tcl_ListObjAppendElement(NULL, insertCmdObj, undoString); Tcl_ListObjAppendElement(NULL, deleteCmdObj, Tcl_NewStringObj("delete", 6)); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, deleteCmdObj, index2Obj); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj("mark", 4)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj("set", 3)); markSetRUndoMarkCmdObj = Tcl_DuplicateObj(markSetLUndoMarkCmdObj); textPtr->sharedTextPtr->undoMarkId++; sprintf(stringUndoMarkId, "%d", textPtr->sharedTextPtr->undoMarkId); strcat(lMarkName, stringUndoMarkId); strcat(rMarkName, stringUndoMarkId); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, Tcl_NewStringObj(lMarkName, -1)); Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, Tcl_NewStringObj(rMarkName, -1)); Tcl_ListObjAppendElement(NULL, markSetLUndoMarkCmdObj, index1Obj); Tcl_ListObjAppendElement(NULL, markSetRUndoMarkCmdObj, index2Obj); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj(Tk_PathName(textPtr->tkwin), -1)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("mark", 4)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("gravity", 7)); markGravityRUndoMarkCmdObj = Tcl_DuplicateObj(markGravityLUndoMarkCmdObj); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj(lMarkName, -1)); Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, Tcl_NewStringObj(rMarkName, -1)); Tcl_ListObjAppendElement(NULL, markGravityLUndoMarkCmdObj, Tcl_NewStringObj("left", 4)); Tcl_ListObjAppendElement(NULL, markGravityRUndoMarkCmdObj, Tcl_NewStringObj("right", 5)); /* * Note: we don't wish to use textPtr->widgetCmd in these callbacks * because if we delete the textPtr, but peers still exist, we will then * have references to a non-existent Tcl_Command in the undo stack, which * will lead to crashes later. Also, the behaviour of the widget w.r.t. * bindings (%W substitutions) always uses the widget path name, so there * is no good reason the undo stack should do otherwise. * * For the 'insert' and 'delete' actions, we have to register a functional * callback, because these actions are defined to operate on the * underlying data shared by all peers. */ iAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, insertCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet2InsertObj, iAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, iAtom); TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, iAtom); TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, iAtom); TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, iAtom); TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, iAtom); dAtom = TkUndoMakeSubAtom(&TextUndoRedoCallback, textPtr->sharedTextPtr, deleteCmdObj, NULL); TkUndoMakeCmdSubAtom(NULL, markSet1InsertObj, dAtom); TkUndoMakeCmdSubAtom(NULL, seeInsertObj, dAtom); TkUndoMakeCmdSubAtom(NULL, markSetLUndoMarkCmdObj, dAtom); TkUndoMakeCmdSubAtom(NULL, markSetRUndoMarkCmdObj, dAtom); TkUndoMakeCmdSubAtom(NULL, markGravityLUndoMarkCmdObj, dAtom); TkUndoMakeCmdSubAtom(NULL, markGravityRUndoMarkCmdObj, dAtom); Tcl_DecrRefCount(seeInsertObj); Tcl_DecrRefCount(index1Obj); Tcl_DecrRefCount(index2Obj); canUndo = TkUndoCanUndo(textPtr->sharedTextPtr->undoStack); canRedo = TkUndoCanRedo(textPtr->sharedTextPtr->undoStack); |
︙ | ︙ | |||
3460 3461 3462 3463 3464 3465 3466 | break; } } } if ((segPtr->typePtr == &tkTextCharType) && !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) { memcpy(buffer, segPtr->body.chars + offsetInSeg, | | | 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 | break; } } } if ((segPtr->typePtr == &tkTextCharType) && !TkTextIsElided(textPtr, &textPtr->selIndex, NULL)) { memcpy(buffer, segPtr->body.chars + offsetInSeg, chunkSize); buffer += chunkSize; maxBytes -= chunkSize; count += chunkSize; } TkTextIndexForwBytes(textPtr, &textPtr->selIndex, chunkSize, &textPtr->selIndex); } |
︙ | ︙ | |||
4224 4225 4226 4227 4228 4229 4230 | * exact searches, and is allowed to be NULL * for regexp searches. */ int matchOffset, /* Offset of found item in utf-8 bytes for * exact search, Unicode chars for regexp. */ int matchLength) /* Length also in bytes/chars as per search * type. */ { | | | 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 | * exact searches, and is allowed to be NULL * for regexp searches. */ int matchOffset, /* Offset of found item in utf-8 bytes for * exact search, Unicode chars for regexp. */ int matchLength) /* Length also in bytes/chars as per search * type. */ { TkSizeT numChars; int leftToScan; TkTextIndex curIndex, foundIndex; TkTextSegment *segPtr; TkTextLine *linePtr; TkText *textPtr = searchSpecPtr->clientData; if (lineNum == searchSpecPtr->stopLine) { |
︙ | ︙ | |||
4264 4265 4266 4267 4268 4269 4270 | /* * If we're using strict limits checking, ensure that the match with its * full length fits inside the given range. */ if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) { if (searchSpecPtr->backwards ^ | | | 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 | /* * If we're using strict limits checking, ensure that the match with its * full length fits inside the given range. */ if (searchSpecPtr->strictLimits && lineNum == searchSpecPtr->stopLine) { if (searchSpecPtr->backwards ^ ((matchOffset + numChars + 1) > (TkSizeT) searchSpecPtr->stopOffset + 1)) { return 0; } } /* * The index information returned by the regular expression parser only * considers textual information: it doesn't account for embedded windows, |
︙ | ︙ | |||
4417 4418 4419 4420 4421 4422 4423 | } /* * Now store the count result, if it is wanted. */ if (searchSpecPtr->varPtr != NULL) { | | | 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 | } /* * Now store the count result, if it is wanted. */ if (searchSpecPtr->varPtr != NULL) { Tcl_Obj *tmpPtr = Tcl_NewWideIntObj(numChars); if (searchSpecPtr->all) { if (searchSpecPtr->countPtr == NULL) { searchSpecPtr->countPtr = Tcl_NewObj(); } Tcl_ListObjAppendElement(NULL, searchSpecPtr->countPtr, tmpPtr); } else { searchSpecPtr->countPtr = tmpPtr; |
︙ | ︙ | |||
4704 4705 4706 4707 4708 4709 4710 | return TCL_ERROR; } arg++; atEnd = 0; if (objc == arg) { TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES); } else { | | | < | 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 | return TCL_ERROR; } arg++; atEnd = 0; if (objc == arg) { TkTextIndexForwChars(NULL, &index1, 1, &index2, COUNT_INDICES); } else { TkSizeT length; const char *str; if (TkTextGetObjIndex(interp, textPtr, objv[arg], &index2) != TCL_OK) { return TCL_ERROR; } str = TkGetStringFromObj(objv[arg], &length); if (strncmp(str, "end", length) == 0) { atEnd = 1; } } if (TkTextIndexCmp(&index1, &index2) >= 0) { return TCL_OK; } |
︙ | ︙ | |||
4923 4924 4925 4926 4927 4928 4929 | lineChanged = DumpSegment(textPtr, interp, "image", name, command, &index, what); } else if ((what & TK_DUMP_WIN) && (segPtr->typePtr == &tkTextEmbWindowType)) { TkTextEmbWindow *ewPtr = &segPtr->body.ew; const char *pathname; | | | 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 | lineChanged = DumpSegment(textPtr, interp, "image", name, command, &index, what); } else if ((what & TK_DUMP_WIN) && (segPtr->typePtr == &tkTextEmbWindowType)) { TkTextEmbWindow *ewPtr = &segPtr->body.ew; const char *pathname; if (ewPtr->tkwin == NULL) { pathname = ""; } else { pathname = Tk_PathName(ewPtr->tkwin); } TkTextMakeByteIndex(textPtr->sharedTextPtr->tree, textPtr, lineno, offset, &index); lineChanged = DumpSegment(textPtr, interp, "window", pathname, |
︙ | ︙ | |||
5027 5028 5029 5030 5031 5032 5033 | values[2] = Tcl_NewStringObj(buffer, -1); tuple = Tcl_NewListObj(3, values); if (command == NULL) { Tcl_ListObjAppendList(NULL, Tcl_GetObjResult(interp), tuple); Tcl_DecrRefCount(tuple); return 0; } else { | | | 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 | values[2] = Tcl_NewStringObj(buffer, -1); tuple = Tcl_NewListObj(3, values); if (command == NULL) { Tcl_ListObjAppendList(NULL, Tcl_GetObjResult(interp), tuple); Tcl_DecrRefCount(tuple); return 0; } else { TkSizeT oldStateEpoch = TkBTreeEpoch(textPtr->sharedTextPtr->tree); Tcl_DString buf; int code; Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, Tcl_GetString(command), -1); Tcl_DStringAppend(&buf, " ", -1); Tcl_DStringAppend(&buf, Tcl_GetString(tuple), -1); |
︙ | ︙ | |||
5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 | */ static int TextEditUndo( TkText *textPtr) /* Overall information about text widget. */ { int status; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } /* * Turn off the undo feature while we revert a compound action, setting | > > | 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 | */ static int TextEditUndo( TkText *textPtr) /* Overall information about text widget. */ { int status; Tcl_Obj *cmdObj; int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } /* * Turn off the undo feature while we revert a compound action, setting |
︙ | ︙ | |||
5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 | status = TkUndoRevert(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; return status; } /* *---------------------------------------------------------------------- * * TextEditRedo -- | > > > > > > > > > > > > > > > > | 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 | status = TkUndoRevert(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; /* * Convert undo/redo temporary marks set by TkUndoRevert() into * indices left in the interp result. */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", Tk_PathName(textPtr->tkwin)); Tcl_IncrRefCount(cmdObj); code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_AddErrorInfo(textPtr->interp, "\n (on undoing)"); Tcl_BackgroundException(textPtr->interp, code); } Tcl_DecrRefCount(cmdObj); return status; } /* *---------------------------------------------------------------------- * * TextEditRedo -- |
︙ | ︙ | |||
5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 | */ static int TextEditRedo( TkText *textPtr) /* Overall information about text widget. */ { int status; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } /* * Turn off the undo feature temporarily while we revert a previously | > > | 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 | */ static int TextEditRedo( TkText *textPtr) /* Overall information about text widget. */ { int status; Tcl_Obj *cmdObj; int code; if (!textPtr->sharedTextPtr->undo) { return TCL_OK; } /* * Turn off the undo feature temporarily while we revert a previously |
︙ | ︙ | |||
5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 | status = TkUndoApply(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; return status; } /* *---------------------------------------------------------------------- * * TextEditCmd -- | > > > > > > > > > > > > > > > > > | 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 | status = TkUndoApply(textPtr->sharedTextPtr->undoStack); if (textPtr->sharedTextPtr->dirtyMode != TK_TEXT_DIRTY_FIXED) { textPtr->sharedTextPtr->dirtyMode = TK_TEXT_DIRTY_NORMAL; } textPtr->sharedTextPtr->undo = 1; /* * Convert undo/redo temporary marks set by TkUndoApply() into * indices left in the interp result. */ cmdObj = Tcl_ObjPrintf("::tk::TextUndoRedoProcessMarks %s", Tk_PathName(textPtr->tkwin)); Tcl_IncrRefCount(cmdObj); code = Tcl_EvalObjEx(textPtr->interp, cmdObj, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_AddErrorInfo(textPtr->interp, "\n (on undoing)"); Tcl_BackgroundException(textPtr->interp, code); } Tcl_DecrRefCount(cmdObj); return status; } /* *---------------------------------------------------------------------- * * TextEditCmd -- |
︙ | ︙ | |||
5519 5520 5521 5522 5523 5524 5525 | *---------------------------------------------------------------------- */ void TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { | | | | 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 | *---------------------------------------------------------------------- */ void TkTextRunAfterSyncCmd( ClientData clientData) /* Information about text widget. */ { register TkText *textPtr = clientData; int code; if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) { /* * The widget has been deleted. Don't do anything. */ if (textPtr->refCount-- <= 1) { ckfree((char *) textPtr); } return; } Tcl_Preserve((ClientData) textPtr->interp); code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL); if (code == TCL_ERROR) { Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)"); Tcl_BackgroundException(textPtr->interp, TCL_ERROR); } Tcl_Release((ClientData) textPtr->interp); Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } /* |
︙ | ︙ | |||
5674 5675 5676 5677 5678 5679 5680 | * pattern. Must have a refCount > 0. */ { /* * For exact searches these are utf-8 char* offsets, for regexp searches * they are Unicode char offsets. */ | | > | | | | 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 | * pattern. Must have a refCount > 0. */ { /* * For exact searches these are utf-8 char* offsets, for regexp searches * they are Unicode char offsets. */ int firstOffset, lastOffset; TkSizeT matchOffset, matchLength; int passes; int lineNum = searchSpecPtr->startLine; int code = TCL_OK; Tcl_Obj *theLine; int alreadySearchOffset = -1; const char *pattern = NULL; /* For exact searches only. */ int firstNewLine = -1; /* For exact searches only. */ Tcl_RegExp regexp = NULL; /* For regexp searches only. */ /* * These items are for backward regexp searches only. They are for two * purposes: to allow us to report backwards matches in the correct order, * even though the implementation uses repeated forward searches; and to * provide for overlap checking between backwards matches on different * text lines. */ #define LOTS_OF_MATCHES 20 int matchNum = LOTS_OF_MATCHES; TkSizeT smArray[2 * LOTS_OF_MATCHES]; TkSizeT *storeMatch = smArray; TkSizeT *storeLength = smArray + LOTS_OF_MATCHES; int lastBackwardsLineMatch = -1; int lastBackwardsMatchOffset = -1; if (searchSpecPtr->exact) { /* * Convert the pattern to lower-case if we're supposed to ignore case. */ |
︙ | ︙ | |||
5747 5748 5749 5750 5751 5752 5753 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ | < | | 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 | /* * We only need to set the matchLength once for exact searches, and we * do it here. It is also used below as the actual pattern length, so * it has dual purpose. */ pattern = TkGetStringFromObj(patObj, &matchLength); nl = strchr(pattern, '\n'); /* * If there is no newline, or it is the very end of the string, then * we don't need any special treatment, since single-line matching * will work fine. */ |
︙ | ︙ | |||
5873 5874 5875 5876 5877 5878 5879 | * Check for matches within the current line 'lineNum'. If so, and if * we're searching backwards or for all matches, repeat the search * until we find the last match in the line. The 'lastOffset' is one * beyond the last position in the line at which a match is allowed to * begin. */ | | | | | 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 | * Check for matches within the current line 'lineNum'. If so, and if * we're searching backwards or for all matches, repeat the search * until we find the last match in the line. The 'lastOffset' is one * beyond the last position in the line at which a match is allowed to * begin. */ matchOffset = TCL_INDEX_NONE; if (searchSpecPtr->exact) { int maxExtraLines = 0; const char *startOfLine = Tcl_GetString(theLine); CLANG_ASSERT(pattern); do { int ch; const char *p; TkSizeT lastFullLine = lastOffset; if (firstNewLine == -1) { if (searchSpecPtr->strictLimits && (firstOffset + matchLength + 1 > (TkSizeT)lastOffset + 1)) { /* * Not enough characters to match. */ break; } |
︙ | ︙ | |||
5917 5918 5919 5920 5921 5922 5923 | p = startOfLine + alreadySearchOffset; alreadySearchOffset = -1; } else { p = startOfLine + lastOffset -1; } while (p >= startOfLine + firstOffset) { if (matchLength == 0 || (p[0] == c && !strncmp( | | | 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 | p = startOfLine + alreadySearchOffset; alreadySearchOffset = -1; } else { p = startOfLine + lastOffset -1; } while (p >= startOfLine + firstOffset) { if (matchLength == 0 || (p[0] == c && !strncmp( p, pattern, matchLength))) { goto backwardsMatch; } p--; } break; } else { p = strstr(startOfLine + firstOffset, pattern); |
︙ | ︙ | |||
5946 5947 5948 5949 5950 5951 5952 | } else { /* * Multi-line match has only one possible match position, * because we know where the '\n' is. */ p = startOfLine + lastOffset - firstNewLine - 1; | | | 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 | } else { /* * Multi-line match has only one possible match position, * because we know where the '\n' is. */ p = startOfLine + lastOffset - firstNewLine - 1; if (strncmp(p, pattern, firstNewLine + 1)) { /* * No match. */ break; } else { int extraLines = 1; |
︙ | ︙ | |||
6005 6006 6007 6008 6009 6010 6011 | p = startOfLine + skipFirst; /* * Use the fact that 'matchLength = patLength' for * exact searches. */ | | | | 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 | p = startOfLine + skipFirst; /* * Use the fact that 'matchLength = patLength' for * exact searches. */ if ((TkSizeT)lastTotal - skipFirst + 1 >= matchLength + 1) { /* * We now have enough text to match, so we * make a final test and break whatever the * result. */ if (strncmp(p, pattern, matchLength)) { p = NULL; } break; } else { /* * Not enough text yet, but check the prefix. */ |
︙ | ︙ | |||
6087 6088 6089 6090 6091 6092 6093 | alreadySearchOffset -= (matchLength ? matchLength : 1); if (alreadySearchOffset < 0) { break; } } } else { firstOffset = matchLength ? p - startOfLine + matchLength | | | 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 | alreadySearchOffset -= (matchLength ? matchLength : 1); if (alreadySearchOffset < 0) { break; } } } else { firstOffset = matchLength ? p - startOfLine + matchLength : p - startOfLine + (TkSizeT)1; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find * overlapping matches either on the same or * following lines. Assume that if we did find * something, it goes until the last extra line we * added. |
︙ | ︙ | |||
6127 6128 6129 6130 6131 6132 6133 | int maxExtraLines = 0; int matches = 0; int lastNonOverlap = -1; do { Tcl_RegExpInfo info; int match; | | | | | | 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 | int maxExtraLines = 0; int matches = 0; int lastNonOverlap = -1; do { Tcl_RegExpInfo info; int match; TkSizeT lastFullLine = lastOffset; match = Tcl_RegExpExecObj(interp, regexp, theLine, firstOffset, 1, (firstOffset>0 ? TCL_REG_NOTBOL : 0)); if (match < 0) { code = TCL_ERROR; goto searchDone; } Tcl_RegExpGetInfo(regexp, &info); /* * If we don't have a match, or if we do, but it extends to * the end of the line, we must try to add more lines to get a * full greedy match. */ if (!match || ((info.extendStart == info.matches[0].start) && (info.matches[0].end == (TkSizeT) (lastOffset - firstOffset)))) { int extraLines = 0; TkSizeT prevFullLine; /* * If we find a match that overlaps more than one line, we * will use this value to determine the first allowed * starting offset for the following search (to avoid * overlapping results). */ int lastTotal = lastOffset; if ((lastBackwardsLineMatch != -1) && (lastBackwardsLineMatch == (lineNum + 1))) { lastNonOverlap = lastTotal; } if (info.extendStart == TCL_INDEX_NONE) { /* * No multi-line match is possible. */ break; } |
︙ | ︙ | |||
6260 6261 6262 6263 6264 6265 6266 | * This means we often add and search one more line * than might be necessary if Tcl were able to give us * a correct value of info.extendStart under all * circumstances. */ if ((match && | | | | | | 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350 6351 6352 6353 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 | * This means we often add and search one more line * than might be necessary if Tcl were able to give us * a correct value of info.extendStart under all * circumstances. */ if ((match && firstOffset + info.matches[0].end != (TkSizeT) lastTotal && firstOffset + info.matches[0].end + 1 < prevFullLine + 1) || info.extendStart == TCL_INDEX_NONE) { break; } /* * If there is a match, but that match starts after * the end of the first line, then we'll handle that * next time around, when we're actually looking at * that line. */ if (match && (info.matches[0].start + 1 >= (TkSizeT) lastOffset + 1)) { break; } if (match && ((firstOffset + info.matches[0].end) >= prevFullLine)) { if (extraLines > 0) { extraLinesSearched = extraLines - 1; } |
︙ | ︙ | |||
6330 6331 6332 6333 6334 6335 6336 | - info.matches[0].start; if (lastNonOverlap != -1) { /* * Possible overlap or enclosure. */ | | | | 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 6426 | - info.matches[0].start; if (lastNonOverlap != -1) { /* * Possible overlap or enclosure. */ if ((TkSizeT)thisOffset - lastNonOverlap >= lastBackwardsMatchOffset + matchLength + 1){ /* * Totally encloses previous match, so * forget the previous match. */ lastBackwardsLineMatch = -1; } else if ((thisOffset - lastNonOverlap) |
︙ | ︙ | |||
6412 6413 6414 6415 6416 6417 6418 | /* * Update our local variables with the match, if we haven't * yet found anything, or if we're doing '-all' or * '-backwards' _and_ this match isn't fully enclosed in the * previous match. */ | | | | | | | | | 6493 6494 6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 6528 6529 6530 6531 6532 6533 6534 | /* * Update our local variables with the match, if we haven't * yet found anything, or if we're doing '-all' or * '-backwards' _and_ this match isn't fully enclosed in the * previous match. */ if (matchOffset == TCL_INDEX_NONE || ((searchSpecPtr->all || searchSpecPtr->backwards) && (((TkSizeT)firstOffset + 1 < matchOffset + 1) || ((firstOffset + info.matches[0].end - info.matches[0].start) > matchOffset + matchLength)))) { matchOffset = firstOffset; matchLength = info.matches[0].end - info.matches[0].start; if (searchSpecPtr->backwards) { /* * To get backwards searches in the correct order, we * must store them away here. */ if (matches == matchNum) { /* * We've run out of space in our normal store, so * we must allocate space for these backwards * matches on the heap. */ TkSizeT *newArray = ckalloc(4 * matchNum * sizeof(TkSizeT)); memcpy(newArray, storeMatch, matchNum*sizeof(TkSizeT)); memcpy(newArray + 2*matchNum, storeLength, matchNum * sizeof(TkSizeT)); if (storeMatch != smArray) { ckfree(storeMatch); } matchNum *= 2; storeMatch = newArray; storeLength = newArray + matchNum; } |
︙ | ︙ | |||
6474 6475 6476 6477 6478 6479 6480 | /* * For forward matches, unless we allow overlaps, we move * this on by the length of the current match so that we * explicitly disallow overlapping matches. */ | | | 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 | /* * For forward matches, unless we allow overlaps, we move * this on by the length of the current match so that we * explicitly disallow overlapping matches. */ if (matchLength + 1 > 1 && !searchSpecPtr->overlap && !searchSpecPtr->backwards) { firstOffset += matchLength; if (firstOffset >= lastOffset) { /* * Now, we have to be careful not to find * overlapping matches either on the same or * following lines. Assume that if we did find |
︙ | ︙ | |||
6531 6532 6533 6534 6535 6536 6537 | * if (storeMatch[matches]<searchSpecPtr->stopOffset) * break; * * might be needed here, but no test case has been * found which would exercise such a problem. */ } | | | | 6612 6613 6614 6615 6616 6617 6618 6619 6620 6621 6622 6623 6624 6625 6626 6627 | * if (storeMatch[matches]<searchSpecPtr->stopOffset) * break; * * might be needed here, but no test case has been * found which would exercise such a problem. */ } if (storeMatch[matches] + storeLength[matches] + 1 >= matchOffset + matchLength + 1) { /* * The new match totally encloses the previous one, so * we overwrite the previous one. */ matchOffset = storeMatch[matches]; matchLength = storeLength[matches]; |
︙ | ︙ | |||
6580 6581 6582 6583 6584 6585 6586 | * If the 'all' flag is set, we will already have stored all matches, * so we just proceed to the next line. * * If not, and there is a match we need to store that information and * we are done. */ | | | 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 6672 6673 6674 6675 | * If the 'all' flag is set, we will already have stored all matches, * so we just proceed to the next line. * * If not, and there is a match we need to store that information and * we are done. */ if ((lastBackwardsLineMatch == -1) && (matchOffset != TCL_INDEX_NONE) && !searchSpecPtr->all) { searchSpecPtr->foundMatchProc(lineNum, searchSpecPtr, lineInfo, theLine, matchOffset, matchLength); goto searchDone; } /* |
︙ | ︙ | |||
6707 6708 6709 6710 6711 6712 6713 | * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); if (linePtr == NULL) { return Tcl_NewObj(); } | | | 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 | * line value. */ { TkTextLine *linePtr = *(TkTextLine **)(recordPtr + internalOffset); if (linePtr == NULL) { return Tcl_NewObj(); } return Tcl_NewWideIntObj(1 + TkBTreeLinesTo(NULL, linePtr)); } /* *---------------------------------------------------------------------- * * SetLineStartEnd -- * |
︙ | ︙ | |||
6748 6749 6750 6751 6752 6753 6754 | int flags) /* Flags for the option, set Tk_SetOptions. */ { TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; if (internalOffset >= 0) { | | | 6829 6830 6831 6832 6833 6834 6835 6836 6837 6838 6839 6840 6841 6842 6843 | int flags) /* Flags for the option, set Tk_SetOptions. */ { TkTextLine *linePtr = NULL; char *internalPtr; TkText *textPtr = (TkText *) recordPtr; if (internalOffset >= 0) { internalPtr = (char *)recordPtr + internalOffset; } else { internalPtr = NULL; } if (flags & TK_OPTION_NULL_OK && ObjectIsEmpty(*value)) { *value = NULL; } else { |
︙ | ︙ | |||
6855 6856 6857 6858 6859 6860 6861 | TkpTesttextCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; | | | 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 | TkpTesttextCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { TkText *textPtr; TkSizeT len; int lineIndex, byteIndex, byteOffset; TkTextIndex index; char buf[64]; Tcl_CmdInfo info; if (objc < 3) { return TCL_ERROR; |
︙ | ︙ |
Changes to generic/tkText.h.
︙ | ︙ | |||
527 528 529 530 531 532 533 534 535 | TK_TEXT_STATE_DISABLED, TK_TEXT_STATE_NORMAL } TkTextState; /* * A data structure of the following type is shared between each text widget * that are peers. */ typedef struct TkSharedText { | > > > > > > > > | | 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | TK_TEXT_STATE_DISABLED, TK_TEXT_STATE_NORMAL } TkTextState; /* * A data structure of the following type is shared between each text widget * that are peers. */ #ifndef TkSizeT # if TCL_MAJOR_VERSION > 8 # define TkSizeT size_t # else # define TkSizeT int # endif #endif typedef struct TkSharedText { TkSizeT refCount; /* Reference count this shared object. */ TkTextBTree tree; /* B-tree representation of text and tags for * widget. */ Tcl_HashTable tagTable; /* Hash table that maps from tag names to * pointers to TkTextTag structures. The "sel" * tag does not feature in this table, since * there's one of those for each text peer. */ int numTags; /* Number of tags currently defined for |
︙ | ︙ | |||
558 559 560 561 562 563 564 | * image, there is no entry for it here. */ Tk_BindingTable bindingTable; /* Table of all bindings currently defined for * this widget. NULL means that no bindings * exist, so the table hasn't been created. * Each "object" used for this table is the * name of a tag. */ | | > > | 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | * image, there is no entry for it here. */ Tk_BindingTable bindingTable; /* Table of all bindings currently defined for * this widget. NULL means that no bindings * exist, so the table hasn't been created. * Each "object" used for this table is the * name of a tag. */ TkSizeT stateEpoch; /* This is incremented each time the B-tree's * contents change structurally, or when the * start/end limits change, and means that any * cached TkTextIndex objects are no longer * valid. */ /* * Information related to the undo/redo functionality. */ TkUndoRedoStack *undoStack; /* The undo/redo stack. */ int undo; /* Non-zero means the undo/redo behaviour is * enabled. */ int maxUndo; /* The maximum depth of the undo stack * expressed as the maximum number of compound * statements. */ int autoSeparators; /* Non-zero means the separators will be * inserted automatically. */ int undoMarkId; /* Counts undo marks temporarily used during undo and redo operations. */ int isDirty; /* Flag indicating the 'dirtyness' of the * text widget. If the flag is not zero, * unsaved modifications have been applied to * the text widget. */ TkTextDirtyMode dirtyMode; /* The nature of the dirtyness characterized * by the isDirty flag. */ TkTextEditMode lastEditMode;/* Keeps track of what the last edit mode |
︙ | ︙ | |||
777 778 779 780 781 782 783 | * horizontal scrollbar when view changes. */ char *yScrollCmd; /* Prefix of command to issue to update * vertical scrollbar when view changes. */ int flags; /* Miscellaneous flags; see below for * definitions. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ | | | 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 | * horizontal scrollbar when view changes. */ char *yScrollCmd; /* Prefix of command to issue to update * vertical scrollbar when view changes. */ int flags; /* Miscellaneous flags; see below for * definitions. */ Tk_OptionTable optionTable; /* Token representing the configuration * specifications. */ TkSizeT refCount; /* Number of cached TkTextIndex objects * refering to us. */ int insertCursorType; /* 0 = standard insertion cursor, 1 = block * cursor. */ /* * Copies of information from the shared section relating to the undo/redo * functonality |
︙ | ︙ | |||
1003 1004 1005 1006 1007 1008 1009 | MODULE_SCOPE void TkBTreeClientRangeChanged(TkText *textPtr, int defaultHeight); MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, TkText *textPtr); MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr); | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | MODULE_SCOPE void TkBTreeClientRangeChanged(TkText *textPtr, int defaultHeight); MODULE_SCOPE void TkBTreeRemoveClient(TkTextBTree tree, TkText *textPtr); MODULE_SCOPE void TkBTreeDestroy(TkTextBTree tree); MODULE_SCOPE void TkBTreeDeleteIndexRange(TkTextBTree tree, TkTextIndex *index1Ptr, TkTextIndex *index2Ptr); MODULE_SCOPE TkSizeT TkBTreeEpoch(TkTextBTree tree); MODULE_SCOPE TkTextLine *TkBTreeFindLine(TkTextBTree tree, const TkText *textPtr, int line); MODULE_SCOPE TkTextLine *TkBTreeFindPixelLine(TkTextBTree tree, const TkText *textPtr, int pixels, int *pixelOffset); MODULE_SCOPE TkTextTag **TkBTreeGetTags(const TkTextIndex *indexPtr, const TkText *textPtr, int *numTagsPtr); |
︙ | ︙ |
Changes to generic/tkTextBTree.c.
︙ | ︙ | |||
101 102 103 104 105 106 107 | */ typedef struct BTree { Node *rootPtr; /* Pointer to root of B-tree. */ int clients; /* Number of clients of this B-tree. */ int pixelReferences; /* Number of clients of this B-tree which care * about pixel heights. */ | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | */ typedef struct BTree { Node *rootPtr; /* Pointer to root of B-tree. */ int clients; /* Number of clients of this B-tree. */ int pixelReferences; /* Number of clients of this B-tree which care * about pixel heights. */ TkSizeT stateEpoch; /* Updated each time any aspect of the B-tree * changes. */ TkSharedText *sharedTextPtr;/* Used to find tagTable in consistency * checking code, and to access list of all * B-tree clients. */ int startEndCount; TkTextLine **startEnd; TkText **startEndRef; |
︙ | ︙ | |||
136 137 138 139 140 141 142 | int tkBTreeDebug = 0; /* * Macros that determine how much space to allocate for new segments: */ | | | | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | int tkBTreeDebug = 0; /* * Macros that determine how much space to allocate for new segments: */ #define CSEG_SIZE(chars) (offsetof(TkTextSegment, body) \ + 1 + (chars)) #define TSEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextToggle)) /* * Forward declarations for functions defined in this file: */ static int AdjustPixelClient(BTree *treePtr, int defaultHeight, Node *nodePtr, TkTextLine *start, TkTextLine *end, |
︙ | ︙ | |||
497 498 499 500 501 502 503 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | * * Side effects: * None. * *---------------------------------------------------------------------- */ TkSizeT TkBTreeEpoch( TkTextBTree tree) /* Tree to get epoch for. */ { BTree *treePtr = (BTree *) tree; return treePtr->stateEpoch; } |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | TkTextSegment *curPtr; /* Current segment; new characters are * inserted just after this one. NULL means * insert at beginning of line. */ TkTextLine *linePtr; /* Current line (new segments are added to * this line). */ register TkTextSegment *segPtr; TkTextLine *newLinePtr; | | | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 | TkTextSegment *curPtr; /* Current segment; new characters are * inserted just after this one. NULL means * insert at beginning of line. */ TkTextLine *linePtr; /* Current line (new segments are added to * this line). */ register TkTextSegment *segPtr; TkTextLine *newLinePtr; size_t chunkSize; /* # characters in current chunk. */ register const char *eol; /* Pointer to character just after last one in * current chunk. */ int changeToLineCount; /* Counts change to total number of lines in * file. */ int *changeToPixelCount; /* Counts change to total number of pixels in * file. */ int ref; |
︙ | ︙ | |||
1066 1067 1068 1069 1070 1071 1072 | segPtr->nextPtr = linePtr->segPtr; linePtr->segPtr = segPtr; } else { segPtr->nextPtr = curPtr->nextPtr; curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; | | | 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | segPtr->nextPtr = linePtr->segPtr; linePtr->segPtr = segPtr; } else { segPtr->nextPtr = curPtr->nextPtr; curPtr->nextPtr = segPtr; } segPtr->size = chunkSize; memcpy(segPtr->body.chars, string, chunkSize); segPtr->body.chars[chunkSize] = 0; if (eol[-1] != '\n') { break; } /* |
︙ | ︙ | |||
4559 4560 4561 4562 4563 4564 4565 | TkTextSegment *newPtr1, *newPtr2; newPtr1 = ckalloc(CSEG_SIZE(index)); newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index)); newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; | | | 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 | TkTextSegment *newPtr1, *newPtr2; newPtr1 = ckalloc(CSEG_SIZE(index)); newPtr2 = ckalloc(CSEG_SIZE(segPtr->size - index)); newPtr1->typePtr = &tkTextCharType; newPtr1->nextPtr = newPtr2; newPtr1->size = index; memcpy(newPtr1->body.chars, segPtr->body.chars, index); newPtr1->body.chars[index] = 0; newPtr2->typePtr = &tkTextCharType; newPtr2->nextPtr = segPtr->nextPtr; newPtr2->size = segPtr->size - index; memcpy(newPtr2->body.chars, segPtr->body.chars + index, newPtr2->size); newPtr2->body.chars[newPtr2->size] = 0; ckfree(segPtr); |
︙ | ︙ |
Changes to generic/tkTextDisp.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" | < < < < < < | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkText.h" #ifdef MAC_OSX_TK #include "tkMacOSXInt.h" #define OK_TO_LOG (!TkpAppIsDrawing()) #define FORCE_DISPLAY(winPtr) TkpDisplayWindow(winPtr) #else #define OK_TO_LOG 1 #define FORCE_DISPLAY(winPtr) |
︙ | ︙ | |||
169 170 171 172 173 174 175 | /* * The following structure extends the StyleValues structure above with * graphics contexts used to actually draw the characters. The entries in * dInfoPtr->styleTable point to structures of this type. */ typedef struct TextStyle { | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /* * The following structure extends the StyleValues structure above with * graphics contexts used to actually draw the characters. The entries in * dInfoPtr->styleTable point to structures of this type. */ typedef struct TextStyle { TkSizeT refCount; /* Number of times this structure is * referenced in Chunks. */ GC bgGC; /* Graphics context for background. None means * use widget background. */ GC fgGC; /* Graphics context for foreground. */ GC ulGC; /* Graphics context for underline. */ GC ovGC; /* Graphics context for overstrike. */ StyleValues *sValuePtr; /* Raw information from which GCs were |
︙ | ︙ | |||
416 417 418 419 420 421 422 | * calculations, if they are out of date. */ TkTextIndex metricIndex; /* If the current metric update line wraps * into very many display lines, then this is * used to keep track of what index we've got * to so far... */ int metricPixelHeight; /* ...and this is for the height calculation * so far...*/ | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | * calculations, if they are out of date. */ TkTextIndex metricIndex; /* If the current metric update line wraps * into very many display lines, then this is * used to keep track of what index we've got * to so far... */ int metricPixelHeight; /* ...and this is for the height calculation * so far...*/ TkSizeT metricEpoch; /* ...and this for the epoch of the partial * calculation so it can be cancelled if * things change once more. This field will be * -1 if there is no long-line calculation in * progress, and take a non-negative value if * there is such a calculation in progress. */ int lastMetricUpdateLine; /* When the current update line reaches this * line, we are done and should stop the |
︙ | ︙ | |||
622 623 624 625 626 627 628 | TkText *textPtr, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); static void AsyncUpdateLineMetrics(ClientData clientData); static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync); static void AsyncUpdateYScrollbar(ClientData clientData); static int IsStartOfNotMergedLine(TkText *textPtr, | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 | TkText *textPtr, int objc, Tcl_Obj *const objv[], double *dblPtr, int *intPtr); static void AsyncUpdateLineMetrics(ClientData clientData); static void GenerateWidgetViewSyncEvent(TkText *textPtr, Bool InSync); static void AsyncUpdateYScrollbar(ClientData clientData); static int IsStartOfNotMergedLine(TkText *textPtr, const TkTextIndex *indexPtr); /* * Result values returned by TextGetScrollInfoObj: */ #define TKTEXT_SCROLL_MOVETO 1 #define TKTEXT_SCROLL_PAGES 2 |
︙ | ︙ | |||
1070 1071 1072 1073 1074 1075 1076 | static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ register TextStyle *stylePtr) /* Information about style to free. */ { | < | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 | static void FreeStyle( TkText *textPtr, /* Information about overall widget. */ register TextStyle *stylePtr) /* Information about style to free. */ { if (stylePtr->refCount-- <= 1) { if (stylePtr->bgGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->bgGC); } if (stylePtr->fgGC != NULL) { Tk_FreeGC(textPtr->display, stylePtr->fgGC); } if (stylePtr->ulGC != NULL) { |
︙ | ︙ | |||
3062 3063 3064 3065 3066 3067 3068 | } /* * If we're not in the middle of a long-line calculation (metricEpoch==-1) * and we've reached the last line, then we're done. */ | | | | 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 | } /* * If we're not in the middle of a long-line calculation (metricEpoch==-1) * and we've reached the last line, then we're done. */ if (dInfoPtr->metricEpoch == TCL_AUTO_LENGTH && lineNum == dInfoPtr->lastMetricUpdateLine) { /* * We have looped over all lines, so we're done. We must release our * refCount on the widget (the timer token was already set to NULL * above). If there is a registered aftersync command, run that first. * Cancel any pending idle task which would try to run the command * after the afterSyncCmd pointer had been set to NULL. */ if (textPtr->afterSyncCmd) { int code; Tcl_CancelIdleCall(TkTextRunAfterSyncCmd, textPtr); Tcl_Preserve((ClientData) textPtr->interp); code = Tcl_EvalObjEx(textPtr->interp, textPtr->afterSyncCmd, TCL_EVAL_GLOBAL); if (code == TCL_ERROR) { Tcl_AddErrorInfo(textPtr->interp, "\n (text sync)"); Tcl_BackgroundException(textPtr->interp, TCL_ERROR); } Tcl_Release((ClientData) textPtr->interp); Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } /* |
︙ | ︙ | |||
3246 3247 3248 3249 3250 3251 3252 | } /* * If we're in the middle of a partial-line height calculation, * then we can't be done. */ | | > | 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 | } /* * If we're in the middle of a partial-line height calculation, * then we can't be done. */ if (textPtr->dInfoPtr->metricEpoch == TCL_AUTO_LENGTH && lineNum == endLine) { /* * We have looped over all lines, so we're done. */ break; } |
︙ | ︙ | |||
6155 6156 6157 6158 6159 6160 6161 | Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "yview". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; int pickPlace, type; int pixels, count; | | | | | 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 | Tcl_Obj *const objv[]) /* Argument objects. Someone else has already * parsed this command enough to know that * objv[1] is "yview". */ { TextDInfo *dInfoPtr = textPtr->dInfoPtr; int pickPlace, type; int pixels, count; TkSizeT switchLength; double fraction; TkTextIndex index; if (dInfoPtr->flags & DINFO_OUT_OF_DATE) { UpdateDisplayInfo(textPtr); } if (objc == 2) { GetYView(interp, textPtr, 0); return TCL_OK; } /* * Next, handle the old syntax: "pathName yview ?-pickplace? where" */ pickPlace = 0; if (Tcl_GetString(objv[2])[0] == '-') { const char *switchStr = TkGetStringFromObj(objv[2], &switchLength); if ((switchLength >= 2) && (strncmp(switchStr, "-pickplace", (unsigned) switchLength) == 0)) { pickPlace = 1; if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "lineNum|index"); return TCL_ERROR; |
︙ | ︙ | |||
6984 6985 6986 6987 6988 6989 6990 | * *---------------------------------------------------------------------- */ static int IsStartOfNotMergedLine( TkText *textPtr, /* Widget record for text widget. */ | | | 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 | * *---------------------------------------------------------------------- */ static int IsStartOfNotMergedLine( TkText *textPtr, /* Widget record for text widget. */ const TkTextIndex *indexPtr) /* Index to check. */ { TkTextIndex indexPtr2; if (indexPtr->byteIndex != 0) { /* * Not the start of a logical line. */ |
︙ | ︙ | |||
7759 7760 7761 7762 7763 7764 7765 | chunkPtr->minAscent = fm.ascent + chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minDescent = fm.descent - chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minHeight = 0; chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS | | | | 7753 7754 7755 7756 7757 7758 7759 7760 7761 7762 7763 7764 7765 7766 7767 7768 7769 | chunkPtr->minAscent = fm.ascent + chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minDescent = fm.descent - chunkPtr->stylePtr->sValuePtr->offset; chunkPtr->minHeight = 0; chunkPtr->width = nextX - chunkPtr->x; chunkPtr->breakIndex = -1; #if !TK_LAYOUT_WITH_BASE_CHUNKS ciPtr = ckalloc(offsetof(CharInfo, chars) + 1 + bytesThatFit); chunkPtr->clientData = ciPtr; memcpy(ciPtr->chars, p, bytesThatFit); #endif /* TK_LAYOUT_WITH_BASE_CHUNKS */ ciPtr->numBytes = bytesThatFit; if (p[bytesThatFit - 1] == '\n') { ciPtr->numBytes--; } |
︙ | ︙ | |||
8772 8773 8774 8775 8776 8777 8778 | static const char *const subcommands[] = { "moveto", "scroll", NULL }; enum viewSubcmds { VIEW_MOVETO, VIEW_SCROLL }; static const char *const units[] = { | | | | | 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 | static const char *const subcommands[] = { "moveto", "scroll", NULL }; enum viewSubcmds { VIEW_MOVETO, VIEW_SCROLL }; static const char *const units[] = { "pages", "pixels", "units", NULL }; enum viewUnits { VIEW_SCROLL_PAGES, VIEW_SCROLL_PIXELS, VIEW_SCROLL_UNITS }; int index; if (Tcl_GetIndexFromObjStruct(interp, objv[2], subcommands, sizeof(char *), "option", 0, &index) != TCL_OK) { return TKTEXT_SCROLL_ERROR; } switch ((enum viewSubcmds) index) { case VIEW_MOVETO: if (objc != 4) { Tcl_WrongNumArgs(interp, 3, objv, "fraction"); return TKTEXT_SCROLL_ERROR; } if (Tcl_GetDoubleFromObj(interp, objv[3], dblPtr) != TCL_OK) { return TKTEXT_SCROLL_ERROR; } return TKTEXT_SCROLL_MOVETO; case VIEW_SCROLL: if (objc != 5) { Tcl_WrongNumArgs(interp, 3, objv, "number pages|pixels|units"); return TKTEXT_SCROLL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[4], units, sizeof(char *), "argument", 0, &index) != TCL_OK) { return TKTEXT_SCROLL_ERROR; } switch ((enum viewUnits) index) { |
︙ | ︙ |
Changes to generic/tkTextImage.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | #include "tkText.h" /* * Macro that determines the size of an embedded image segment: */ #define EI_SEG_SIZE \ | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include "tkText.h" /* * Macro that determines the size of an embedded image segment: */ #define EI_SEG_SIZE \ (offsetof(TkTextSegment, body) + sizeof(TkTextEmbImage)) /* * Prototypes for functions defined in this file: */ static TkTextSegment * EmbImageCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); |
︙ | ︙ | |||
79 80 81 82 83 84 85 | /* * Information used for parsing image configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, | | | | | | | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | /* * Information used for parsing image configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", -1, offsetof(TkTextEmbImage, align), 0, alignStrings, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, "0", -1, offsetof(TkTextEmbImage, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, "0", -1, offsetof(TkTextEmbImage, padY), 0, 0, 0}, {TK_OPTION_STRING, "-image", NULL, NULL, NULL, -1, offsetof(TkTextEmbImage, imageString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-name", NULL, NULL, NULL, -1, offsetof(TkTextEmbImage, imageName), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* *-------------------------------------------------------------- * |
︙ | ︙ | |||
157 158 159 160 161 162 163 | if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL); return TCL_ERROR; } | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | if (eiPtr->typePtr != &tkTextEmbImageType) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL); return TCL_ERROR; } objPtr = Tk_GetOptionValue(interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); return TCL_OK; } |
︙ | ︙ | |||
184 185 186 187 188 189 190 | "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL); return TCL_ERROR; } if (objc <= 5) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | "no embedded image at index \"%s\"", Tcl_GetString(objv[3]))); Tcl_SetErrorCode(interp, "TK", "TEXT", "NO_IMAGE", NULL); return TCL_ERROR; } if (objc <= 5) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } else { Tcl_SetObjResult(interp, objPtr); return TCL_OK; |
︙ | ︙ | |||
333 334 335 336 337 338 339 | Tcl_HashSearch search; char *name; int dummy; int count = 0; /* The counter for picking a unique name */ int conflict = 0; /* True if we have a name conflict */ size_t len; /* length of image name */ | | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | Tcl_HashSearch search; char *name; int dummy; int count = 0; /* The counter for picking a unique name */ int conflict = 0; /* True if we have a name conflict */ size_t len; /* length of image name */ if (Tk_SetOptions(textPtr->interp, &eiPtr->body.ei, eiPtr->body.ei.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } /* * Create the image. Save the old image around and don't free it until |
︙ | ︙ |
Changes to generic/tkTextIndex.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * tkTextIndex.c -- * * This module provides functions that manipulate indices for text * widgets. * * Copyright (c) 1992-1994 The Regents of the University of California. * 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. */ | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | /* * tkTextIndex.c -- * * This module provides functions that manipulate indices for text * widgets. * * Copyright (c) 1992-1994 The Regents of the University of California. * 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. */ #include "tkInt.h" #include "tkText.h" #include "default.h" /* * Index to use to select last character in line (very large integer): */ #define LAST_CHAR 1000000 |
︙ | ︙ | |||
36 37 38 39 40 41 42 | static const char * ForwBack(TkText *textPtr, const char *string, TkTextIndex *indexPtr); static const char * StartEnd(TkText *textPtr, const char *string, TkTextIndex *indexPtr); static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); | | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | static const char * ForwBack(TkText *textPtr, const char *string, TkTextIndex *indexPtr); static const char * StartEnd(TkText *textPtr, const char *string, TkTextIndex *indexPtr); static int GetIndex(Tcl_Interp *interp, TkSharedText *sharedPtr, TkText *textPtr, const char *string, TkTextIndex *indexPtr, int *canCachePtr); static int IndexCountBytesOrdered(const TkText *textPtr, const TkTextIndex *indexPtr1, const TkTextIndex *indexPtr2); /* * The "textindex" Tcl_Obj definition: */ static void DupTextIndexInternalRep(Tcl_Obj *srcPtr, Tcl_Obj *copyPtr); |
︙ | ︙ | |||
60 61 62 63 64 65 66 | #define GET_TEXTINDEX(objPtr) \ ((TkTextIndex *) (objPtr)->internalRep.twoPtrValue.ptr1) #define GET_INDEXEPOCH(objPtr) \ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2)) #define SET_TEXTINDEX(objPtr, indexPtr) \ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr)) #define SET_INDEXEPOCH(objPtr, epoch) \ | | | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #define GET_TEXTINDEX(objPtr) \ ((TkTextIndex *) (objPtr)->internalRep.twoPtrValue.ptr1) #define GET_INDEXEPOCH(objPtr) \ (PTR2INT((objPtr)->internalRep.twoPtrValue.ptr2)) #define SET_TEXTINDEX(objPtr, indexPtr) \ ((objPtr)->internalRep.twoPtrValue.ptr1 = (void *) (indexPtr)) #define SET_INDEXEPOCH(objPtr, epoch) \ ((objPtr)->internalRep.twoPtrValue.ptr2 = (void *) (size_t) (epoch)) /* * Define the 'textindex' object type, which Tk uses to represent indices in * text widgets internally. */ const Tcl_ObjType tkTextIndexType = { |
︙ | ︙ | |||
100 101 102 103 104 105 106 | } static void DupTextIndexInternalRep( Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */ { | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | } static void DupTextIndexInternalRep( Tcl_Obj *srcPtr, /* TextIndex obj with internal rep to copy. */ Tcl_Obj *copyPtr) /* TextIndex obj with internal rep to set. */ { TkSizeT epoch; TkTextIndex *dupIndexPtr, *indexPtr; dupIndexPtr = ckalloc(sizeof(TkTextIndex)); indexPtr = GET_TEXTINDEX(srcPtr); epoch = GET_INDEXEPOCH(srcPtr); dupIndexPtr->tree = indexPtr->tree; |
︙ | ︙ | |||
202 203 204 205 206 207 208 | * position. */ { TkTextIndex index; TkTextIndex *indexPtr = NULL; int cache; if (objPtr->typePtr == &tkTextIndexType) { | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | * position. */ { TkTextIndex index; TkTextIndex *indexPtr = NULL; int cache; if (objPtr->typePtr == &tkTextIndexType) { TkSizeT epoch; indexPtr = GET_TEXTINDEX(objPtr); epoch = GET_INDEXEPOCH(objPtr); if (epoch == textPtr->sharedTextPtr->stateEpoch) { if (indexPtr->textPtr == textPtr) { return indexPtr; |
︙ | ︙ | |||
919 920 921 922 923 924 925 | *endOfBase = c; if (result != 0) { goto gotBase; } } if ((string[0] == 'e') && (strncmp(string, "end", | | | 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | *endOfBase = c; if (result != 0) { goto gotBase; } } if ((string[0] == 'e') && (strncmp(string, "end", endOfBase-Tcl_DStringValue(©)) == 0)) { /* * Base position is end of text. */ TkTextMakeByteIndex(sharedPtr->tree, textPtr, TkBTreeNumLines(sharedPtr->tree, textPtr), 0, indexPtr); canCache = 1; |
︙ | ︙ | |||
1632 1633 1634 1635 1636 1637 1638 | * None. * *--------------------------------------------------------------------------- */ int TkTextIndexCountBytes( | | | | | | | | 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 | * None. * *--------------------------------------------------------------------------- */ int TkTextIndexCountBytes( const TkText *textPtr, const TkTextIndex *indexPtr1, /* Index describing one location. */ const TkTextIndex *indexPtr2) /* Index describing second location. */ { int compare = TkTextIndexCmp(indexPtr1, indexPtr2); if (compare == 0) { return 0; } else if (compare > 0) { return IndexCountBytesOrdered(textPtr, indexPtr2, indexPtr1); } else { return IndexCountBytesOrdered(textPtr, indexPtr1, indexPtr2); } } static int IndexCountBytesOrdered( const TkText *textPtr, const TkTextIndex *indexPtr1, /* Index describing location of character from * which to count. */ const TkTextIndex *indexPtr2) /* Index describing location of last character * at which to stop the count. */ { int byteCount, offset; TkTextSegment *segPtr, *segPtr1; TkTextLine *linePtr; |
︙ | ︙ |
Changes to generic/tkTextMark.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include "tkText.h" #include "tk3d.h" /* * Macro that determines the size of a mark segment: */ | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "tkText.h" #include "tk3d.h" /* * Macro that determines the size of a mark segment: */ #define MSEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextMark)) /* * Forward references for functions defined in this file: */ static Tcl_Obj * GetMarkName(TkText *textPtr, TkTextSegment *segPtr); static void InsertUndisplayProc(TkText *textPtr, |
︙ | ︙ | |||
122 123 124 125 126 127 128 | sizeof(char *), "mark option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum markOptions) optionIndex) { case MARK_GRAVITY: { char c; | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | sizeof(char *), "mark option", 0, &optionIndex) != TCL_OK) { return TCL_ERROR; } switch ((enum markOptions) optionIndex) { case MARK_GRAVITY: { char c; TkSizeT length; const char *str; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 3, objv, "markName ?gravity?"); return TCL_ERROR; } str = TkGetStringFromObj(objv[3], &length); if (length == 6 && !strcmp(str, "insert")) { markPtr = textPtr->insertMarkPtr; } else if (length == 7 && !strcmp(str, "current")) { markPtr = textPtr->currentMarkPtr; } else { hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->markTable, str); if (hPtr == NULL) { |
︙ | ︙ | |||
156 157 158 159 160 161 162 | typeStr = "right"; } else { typeStr = "left"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); return TCL_OK; } | | | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | typeStr = "right"; } else { typeStr = "left"; } Tcl_SetObjResult(interp, Tcl_NewStringObj(typeStr, -1)); return TCL_OK; } str = TkGetStringFromObj(objv[4],&length); c = str[0]; if ((c == 'l') && (strncmp(str, "left", length) == 0)) { newTypePtr = &tkTextLeftMarkType; } else if ((c == 'r') && (strncmp(str, "right", length) == 0)) { newTypePtr = &tkTextRightMarkType; } else { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad mark gravity \"%s\": must be left or right", str)); Tcl_SetErrorCode(interp, "TK", "VALUE", "MARK_GRAVITY", NULL); return TCL_ERROR; } |
︙ | ︙ |
Changes to generic/tkTextTag.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | * Copyright (c) 1992-1994 The Regents of the University of California. * 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. */ | | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * Copyright (c) 1992-1994 The Regents of the University of California. * 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. */ #include "tkInt.h" #include "tkText.h" #include "default.h" /* * The 'TkWrapMode' enum in tkText.h is used to define a type for the -wrap * option of tags in a Text widget. These values are used as indices into the * string table below. Tags are allowed an empty wrap value, but the widget as * a whole is not. */ |
︙ | ︙ | |||
36 37 38 39 40 41 42 | static const char *const tabStyleStrings[] = { "tabular", "wordprocessor", "", NULL }; static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | static const char *const tabStyleStrings[] = { "tabular", "wordprocessor", "", NULL }; static const Tk_OptionSpec tagOptionSpecs[] = { {TK_OPTION_BORDER, "-background", NULL, NULL, NULL, -1, offsetof(TkTextTag, border), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BITMAP, "-bgstipple", NULL, NULL, NULL, -1, offsetof(TkTextTag, bgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-borderwidth", NULL, NULL, NULL, offsetof(TkTextTag, borderWidthPtr), offsetof(TkTextTag, borderWidth), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_STRING, "-elide", NULL, NULL, NULL, -1, offsetof(TkTextTag, elideString), TK_OPTION_NULL_OK|TK_OPTION_DONT_SET_DEFAULT, 0, 0}, {TK_OPTION_BITMAP, "-fgstipple", NULL, NULL, NULL, -1, offsetof(TkTextTag, fgStipple), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_FONT, "-font", NULL, NULL, NULL, -1, offsetof(TkTextTag, tkfont), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-foreground", NULL, NULL, NULL, -1, offsetof(TkTextTag, fgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-justify", NULL, NULL, NULL, -1, offsetof(TkTextTag, justifyString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_STRING, "-lmargin1", NULL, NULL, NULL, -1, offsetof(TkTextTag, lMargin1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-lmargin2", NULL, NULL, NULL, -1, offsetof(TkTextTag, lMargin2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_BORDER, "-lmargincolor", NULL, NULL, NULL, -1, offsetof(TkTextTag, lMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-offset", NULL, NULL, NULL, -1, offsetof(TkTextTag, offsetString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-overstrike", NULL, NULL, NULL, -1, offsetof(TkTextTag, overstrikeString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-overstrikefg", NULL, NULL, NULL, -1, offsetof(TkTextTag, overstrikeColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-relief", NULL, NULL, NULL, -1, offsetof(TkTextTag, reliefString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-rmargin", NULL, NULL, NULL, -1, offsetof(TkTextTag, rMarginString), TK_OPTION_NULL_OK, 0,0}, {TK_OPTION_BORDER, "-rmargincolor", NULL, NULL, NULL, -1, offsetof(TkTextTag, rMarginColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_BORDER, "-selectbackground", NULL, NULL, NULL, -1, offsetof(TkTextTag, selBorder), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-selectforeground", NULL, NULL, NULL, -1, offsetof(TkTextTag, selFgColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-spacing1", NULL, NULL, NULL, -1, offsetof(TkTextTag, spacing1String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing2", NULL, NULL, NULL, -1, offsetof(TkTextTag, spacing2String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-spacing3", NULL, NULL, NULL, -1, offsetof(TkTextTag, spacing3String), TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-tabs", NULL, NULL, NULL, offsetof(TkTextTag, tabStringPtr), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-tabstyle", NULL, NULL, NULL, -1, offsetof(TkTextTag, tabStyle), TK_OPTION_NULL_OK, tabStyleStrings, 0}, {TK_OPTION_STRING, "-underline", NULL, NULL, NULL, -1, offsetof(TkTextTag, underlineString), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_COLOR, "-underlinefg", NULL, NULL, NULL, -1, offsetof(TkTextTag, underlineColor), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING_TABLE, "-wrap", NULL, NULL, NULL, -1, offsetof(TkTextTag, wrapMode), TK_OPTION_NULL_OK, wrapStrings, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* * Forward declarations for functions defined later in this file: */ |
︙ | ︙ | |||
288 289 290 291 292 293 294 | mask = Tk_CreateBinding(interp, textPtr->sharedTextPtr->bindingTable, (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth, append); if (mask == 0) { return TCL_ERROR; } | | | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | mask = Tk_CreateBinding(interp, textPtr->sharedTextPtr->bindingTable, (ClientData) tagPtr->name, Tcl_GetString(objv[4]), fifth, append); if (mask == 0) { return TCL_ERROR; } if (mask & ~(unsigned long)(ButtonMotionMask|Button1MotionMask |Button2MotionMask|Button3MotionMask|Button4MotionMask |Button5MotionMask|ButtonPressMask|ButtonReleaseMask |EnterWindowMask|LeaveWindowMask|KeyPressMask |KeyReleaseMask|PointerMotionMask|VirtualEventMask)) { Tk_DeleteBinding(interp, textPtr->sharedTextPtr->bindingTable, (ClientData) tagPtr->name, Tcl_GetString(objv[4])); Tcl_SetObjResult(interp, Tcl_NewStringObj( |
︙ | ︙ | |||
339 340 341 342 343 344 345 | } else { Tcl_Obj *objPtr; tagPtr = FindTag(interp, textPtr, objv[3]); if (tagPtr == NULL) { return TCL_ERROR; } | | | | | 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 | } else { Tcl_Obj *objPtr; tagPtr = FindTag(interp, textPtr, objv[3]); if (tagPtr == NULL) { return TCL_ERROR; } objPtr = Tk_GetOptionValue(interp, tagPtr, tagPtr->optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } break; case TAG_CONFIGURE: { int newTag; if (objc < 4) { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?-option? ?value? ?-option value ...?"); return TCL_ERROR; } tagPtr = TkTextCreateTag(textPtr, Tcl_GetString(objv[3]), &newTag); if (objc <= 5) { Tcl_Obj *objPtr = Tk_GetOptionInfo(interp, tagPtr, tagPtr->optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } else { int result = TCL_OK; if (Tk_SetOptions(interp, tagPtr, tagPtr->optionTable, objc-4, objv+4, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } /* * Some of the configuration options, like -underline and * -justify, require additional translation (this is needed |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | Tcl_Interp *interp, /* Interpreter to use for error message; if * NULL, then don't record an error * message. */ TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; | | | | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 | Tcl_Interp *interp, /* Interpreter to use for error message; if * NULL, then don't record an error * message. */ TkText *textPtr, /* Widget in which tag is being used. */ Tcl_Obj *tagName) /* Name of desired tag. */ { Tcl_HashEntry *hPtr; TkSizeT len; const char *str; str = TkGetStringFromObj(tagName, &len); if (len == 3 && !strcmp(str, "sel")) { return textPtr->selTagPtr; } hPtr = Tcl_FindHashEntry(&textPtr->sharedTextPtr->tagTable, Tcl_GetString(tagName)); if (hPtr != NULL) { return Tcl_GetHashValue(hPtr); |
︙ | ︙ | |||
1442 1443 1444 1445 1446 1447 1448 | TkTextBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkText *textPtr = clientData; int repick = 0; | < < < | < < < < < < < < < < < < < < < < < < < | | | | < | 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | TkTextBindProc( ClientData clientData, /* Pointer to canvas structure. */ XEvent *eventPtr) /* Pointer to X event that just happened. */ { TkText *textPtr = clientData; int repick = 0; textPtr->refCount++; /* * This code simulates grabs for mouse buttons by keeping track of whether * a button is pressed and refusing to pick a new current character while * a button is pressed. */ if (eventPtr->type == ButtonPress) { textPtr->flags |= BUTTON_DOWN; } else if (eventPtr->type == ButtonRelease) { unsigned long mask; mask = TkGetButtonMask(eventPtr->xbutton.button); if ((eventPtr->xbutton.state & ALL_BUTTONS) == mask) { textPtr->flags &= ~BUTTON_DOWN; repick = 1; } } else if ((eventPtr->type == EnterNotify) || (eventPtr->type == LeaveNotify)) { if (eventPtr->xcrossing.state & ALL_BUTTONS) { textPtr->flags |= BUTTON_DOWN; } else { textPtr->flags &= ~BUTTON_DOWN; } TkTextPickCurrent(textPtr, eventPtr); goto done; } else if (eventPtr->type == MotionNotify) { if (eventPtr->xmotion.state & ALL_BUTTONS) { textPtr->flags |= BUTTON_DOWN; } else { textPtr->flags &= ~BUTTON_DOWN; } TkTextPickCurrent(textPtr, eventPtr); } if ((textPtr->numCurTags > 0) && (textPtr->sharedTextPtr->bindingTable != NULL) && (textPtr->tkwin != NULL) && !(textPtr->flags & DESTROYED)) { TagBindEvent(textPtr, eventPtr, textPtr->numCurTags, textPtr->curTagArrayPtr); } if (repick) { unsigned int oldState; oldState = eventPtr->xbutton.state; eventPtr->xbutton.state &= ~(unsigned long)ALL_BUTTONS; if (!(textPtr->flags & DESTROYED)) { TkTextPickCurrent(textPtr, eventPtr); } eventPtr->xbutton.state = oldState; } done: |
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 | * ButtonRelease, or MotionNotify. */ { TkTextIndex index; TkTextTag **oldArrayPtr, **newArrayPtr; TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ | | > | 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 | * ButtonRelease, or MotionNotify. */ { TkTextIndex index; TkTextTag **oldArrayPtr, **newArrayPtr; TkTextTag **copyArrayPtr = NULL; /* Initialization needed to prevent compiler * warning. */ int numOldTags, numNewTags, i, j, nearby; size_t size; XEvent event; /* * If a button is down, then don't do anything at all; we'll be called * again when all buttons are up, and we can repick then. This implements * a form of mouse grabbing. */ |
︙ | ︙ | |||
1652 1653 1654 1655 1656 1657 1658 | * in both groups (i.e. the tags that haven't changed). */ SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr); if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); copyArrayPtr = ckalloc(size); | | | 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 | * in both groups (i.e. the tags that haven't changed). */ SortTags(textPtr->numCurTags, textPtr->curTagArrayPtr); if (numNewTags > 0) { size = numNewTags * sizeof(TkTextTag *); copyArrayPtr = ckalloc(size); memcpy(copyArrayPtr, newArrayPtr, size); for (i = 0; i < textPtr->numCurTags; i++) { for (j = 0; j < numNewTags; j++) { if (textPtr->curTagArrayPtr[i] == copyArrayPtr[j]) { textPtr->curTagArrayPtr[i] = NULL; copyArrayPtr[j] = NULL; break; } |
︙ | ︙ |
Changes to generic/tkTextWind.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | EmbWinLostSlaveProc, /* lostSlaveProc */ }; /* * Macro that determines the size of an embedded window segment: */ | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | EmbWinLostSlaveProc, /* lostSlaveProc */ }; /* * Macro that determines the size of an embedded window segment: */ #define EW_SEG_SIZE (offsetof(TkTextSegment, body) \ + sizeof(TkTextEmbWindow)) /* * Prototypes for functions defined in this file: */ static TkTextSegment * EmbWinCleanupProc(TkTextSegment *segPtr, TkTextLine *linePtr); |
︙ | ︙ | |||
95 96 97 98 99 100 101 | /* * Information used for parsing window configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, | | | | | | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | /* * Information used for parsing window configuration options: */ static const Tk_OptionSpec optionSpecs[] = { {TK_OPTION_STRING_TABLE, "-align", NULL, NULL, "center", -1, offsetof(TkTextEmbWindow, align), 0, alignStrings, 0}, {TK_OPTION_STRING, "-create", NULL, NULL, NULL, -1, offsetof(TkTextEmbWindow, create), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_PIXELS, "-padx", NULL, NULL, "0", -1, offsetof(TkTextEmbWindow, padX), 0, 0, 0}, {TK_OPTION_PIXELS, "-pady", NULL, NULL, "0", -1, offsetof(TkTextEmbWindow, padY), 0, 0, 0}, {TK_OPTION_BOOLEAN, "-stretch", NULL, NULL, "0", -1, offsetof(TkTextEmbWindow, stretch), 0, 0, 0}, {TK_OPTION_WINDOW, "-window", NULL, NULL, NULL, -1, offsetof(TkTextEmbWindow, tkwin), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /* *-------------------------------------------------------------- * * TkTextWindowCmd -- |
︙ | ︙ | |||
187 188 189 190 191 192 193 | client = EmbWinGetClient(textPtr, ewPtr); if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } | | | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | client = EmbWinGetClient(textPtr, ewPtr); if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } objPtr = Tk_GetOptionValue(interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, objv[4], textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; } |
︙ | ︙ | |||
229 230 231 232 233 234 235 | client = EmbWinGetClient(textPtr, ewPtr); if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | client = EmbWinGetClient(textPtr, ewPtr); if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } objPtr = Tk_GetOptionInfo(interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, (objc == 5) ? objv[4] : NULL, textPtr->tkwin); if (objPtr == NULL) { return TCL_ERROR; } Tcl_SetObjResult(interp, objPtr); return TCL_OK; |
︙ | ︙ | |||
399 400 401 402 403 404 405 | if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } oldWindow = ewPtr->body.ew.tkwin; | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | if (client != NULL) { ewPtr->body.ew.tkwin = client->tkwin; } else { ewPtr->body.ew.tkwin = NULL; } oldWindow = ewPtr->body.ew.tkwin; if (Tk_SetOptions(textPtr->interp, &ewPtr->body.ew, ewPtr->body.ew.optionTable, objc, objv, textPtr->tkwin, NULL, NULL) != TCL_OK) { return TCL_ERROR; } if (oldWindow != ewPtr->body.ew.tkwin) { if (oldWindow != NULL) { |
︙ | ︙ |
Changes to generic/tkUtil.c.
︙ | ︙ | |||
664 665 666 667 668 669 670 | } return TK_SCROLL_MOVETO; } else if ((c == 's') && (strncmp(argv[2], "scroll", length) == 0)) { if (argc != 5) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # args: should be \"%s %s %s\"", | | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | } return TK_SCROLL_MOVETO; } else if ((c == 's') && (strncmp(argv[2], "scroll", length) == 0)) { if (argc != 5) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "wrong # args: should be \"%s %s %s\"", argv[0], argv[1], "scroll number pages|units")); Tcl_SetErrorCode(interp, "TCL", "WRONGARGS", NULL); return TK_SCROLL_ERROR; } if (Tcl_GetInt(interp, argv[3], intPtr) != TCL_OK) { return TK_SCROLL_ERROR; } length = strlen(argv[4]); c = argv[4][0]; if ((c == 'p') && (strncmp(argv[4], "pages", length) == 0)) { return TK_SCROLL_PAGES; } else if ((c == 'u') && (strncmp(argv[4], "units", length) == 0)) { return TK_SCROLL_UNITS; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be pages or units", argv[4])); Tcl_SetErrorCode(interp, "TK", "VALUE", "SCROLL_UNITS", NULL); return TK_SCROLL_ERROR; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be moveto or scroll", argv[2])); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option", argv[2], NULL); |
︙ | ︙ | |||
725 726 727 728 729 730 731 | int objc, /* # arguments for command. */ Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { | > | < | | < | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 | int objc, /* # arguments for command. */ Tcl_Obj *const objv[], /* Arguments for command. */ double *dblPtr, /* Filled in with argument "moveto" option, if * any. */ int *intPtr) /* Filled in with number of pages or lines to * scroll, if any. */ { TkSizeT length; const char *arg = TkGetStringFromObj(objv[2], &length); #define ArgPfxEq(str) \ ((arg[0] == str[0]) && !strncmp(arg, str, length)) if (ArgPfxEq("moveto")) { if (objc != 4) { Tcl_WrongNumArgs(interp, 2, objv, "moveto fraction"); return TK_SCROLL_ERROR; } if (Tcl_GetDoubleFromObj(interp, objv[3], dblPtr) != TCL_OK) { return TK_SCROLL_ERROR; } return TK_SCROLL_MOVETO; } else if (ArgPfxEq("scroll")) { if (objc != 5) { Tcl_WrongNumArgs(interp, 2, objv, "scroll number pages|units"); return TK_SCROLL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[3], intPtr) != TCL_OK) { return TK_SCROLL_ERROR; } arg = TkGetStringFromObj(objv[4], &length); if (ArgPfxEq("pages")) { return TK_SCROLL_PAGES; } else if (ArgPfxEq("units")) { return TK_SCROLL_UNITS; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad argument \"%s\": must be pages or units", arg)); Tcl_SetErrorCode(interp, "TK", "VALUE", "SCROLL_UNITS", NULL); return TK_SCROLL_ERROR; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "unknown option \"%s\": must be moveto or scroll", arg)); Tcl_SetErrorCode(interp, "TCL", "LOOKUP", "INDEX", "option", arg, NULL); return TK_SCROLL_ERROR; |
︙ | ︙ | |||
1183 1184 1185 1186 1187 1188 1189 | event.general.xany.type = VirtualEvent; event.general.xany.serial = NextRequest(Tk_Display(target)); event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(target); event.general.xany.display = Tk_Display(target); event.virtual.name = Tk_GetUid(eventName); if (detail != NULL) { | | | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | event.general.xany.type = VirtualEvent; event.general.xany.serial = NextRequest(Tk_Display(target)); event.general.xany.send_event = False; event.general.xany.window = Tk_WindowId(target); event.general.xany.display = Tk_Display(target); event.virtual.name = Tk_GetUid(eventName); if (detail != NULL) { event.virtual.user_data = detail; } Tk_QueueWindowEvent(&event.general, TCL_QUEUE_TAIL); } #if TCL_UTF_MAX <= 4 /* |
︙ | ︙ | |||
1209 1210 1211 1212 1213 1214 1215 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ | | | | | 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ size_t TkUtfToUniChar( const char *src, /* The UTF-8 string. */ int *chPtr) /* Filled with the Tcl_UniChar represented by * the UTF-8 string. */ { Tcl_UniChar uniChar = 0; size_t len = Tcl_UtfToUniChar(src, &uniChar); if ((uniChar & 0xfc00) == 0xd800) { Tcl_UniChar high = uniChar; /* This can only happen if Tcl is compiled with TCL_UTF_MAX=4, * or when a high surrogate character is detected in UTF-8 form */ size_t len2 = Tcl_UtfToUniChar(src+len, &uniChar); if ((uniChar & 0xfc00) == 0xdc00) { *chPtr = (((high & 0x3ff) << 10) | (uniChar & 0x3ff)) + 0x10000; len += len2; } else { *chPtr = high; } } else { |
︙ | ︙ | |||
1253 1254 1255 1256 1257 1258 1259 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ | | | > > > > > > > > > > > > > | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | * * Side effects: * None. * *--------------------------------------------------------------------------- */ size_t TkUniCharToUtf(int ch, char *buf) { size_t size = Tcl_UniCharToUtf(ch, buf); if ((((unsigned)(ch - 0x10000) <= 0xFFFFF)) && (size < 4)) { /* Hey, this is wrong, we must be running TCL_UTF_MAX==3 * The best thing we can do is spit out 2 surrogates */ ch -= 0x10000; size = Tcl_UniCharToUtf(((ch >> 10) | 0xd800), buf); size += Tcl_UniCharToUtf(((ch & 0x3ff) | 0xdc00), buf+size); } return size; } #endif #if TCL_MAJOR_VERSION > 8 unsigned char * TkGetByteArrayFromObj( Tcl_Obj *objPtr, size_t *lengthPtr ) { unsigned char *result = Tcl_GetByteArrayFromObj(objPtr, NULL); *lengthPtr = *(size_t *) objPtr->internalRep.twoPtrValue.ptr1; return result; } #endif /* TCL_MAJOR_VERSION > 8 */ /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkVisual.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | /* * The table below maps from symbolic names for visual classes to the * associated X class symbols. */ typedef struct VisualDictionary { const char *name; /* Textual name of class. */ | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * The table below maps from symbolic names for visual classes to the * associated X class symbols. */ typedef struct VisualDictionary { const char *name; /* Textual name of class. */ unsigned short minLength; /* Minimum # characters that must be specified * for an unambiguous match. */ short class; /* X symbol for class. */ } VisualDictionary; static const VisualDictionary visualNames[] = { {"best", 1, 0}, {"directcolor", 2, DirectColor}, {"grayscale", 1, GrayScale}, {"greyscale", 1, GrayScale}, {"pseudocolor", 1, PseudoColor}, |
︙ | ︙ | |||
42 43 44 45 46 47 48 | * One of the following structures exists for each distinct non-default * colormap allocated for a display by Tk_GetColormap. */ struct TkColormap { Colormap colormap; /* X's identifier for the colormap. */ Visual *visual; /* Visual for which colormap was allocated. */ | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | * One of the following structures exists for each distinct non-default * colormap allocated for a display by Tk_GetColormap. */ struct TkColormap { Colormap colormap; /* X's identifier for the colormap. */ Visual *visual; /* Visual for which colormap was allocated. */ size_t refCount; /* How many uses of the colormap are still * outstanding (calls to Tk_GetColormap minus * calls to Tk_FreeColormap). */ int shareable; /* 0 means this colormap was allocated by a * call to Tk_GetColormap with "new", implying * that the window wants it all for itself. 1 * means that the colormap was allocated as a * default for a particular visual, so it can |
︙ | ︙ | |||
95 96 97 98 99 100 101 | * eventually be freed by calling * Tk_FreeColormap. */ { Tk_Window tkwin2; XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | * eventually be freed by calling * Tk_FreeColormap. */ { Tk_Window tkwin2; XVisualInfo template, *visInfoList, *bestPtr; long mask; Visual *visual; size_t length; int c, numVisuals, prio, bestPrio, i; const char *p; const VisualDictionary *dictPtr; TkColormap *cmapPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; /* |
︙ | ︙ | |||
133 134 135 136 137 138 139 | * allocated here). */ *colormapPtr = Tk_Colormap(tkwin2); for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == *colormapPtr) { | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | * allocated here). */ *colormapPtr = Tk_Colormap(tkwin2); for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == *colormapPtr) { cmapPtr->refCount++; break; } } } return visual; } template.depth = Tk_Depth(tkwin2); |
︙ | ︙ | |||
191 192 193 194 195 196 197 | break; } } length = p - string; template.class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) | | < | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | break; } } length = p - string; template.class = -1; for (dictPtr = visualNames; dictPtr->name != NULL; dictPtr++) { if ((dictPtr->name[0] == c) && (length >= dictPtr->minLength) && (strncmp(string, dictPtr->name, length) == 0)) { template.class = dictPtr->class; break; } } if (template.class == -1) { Tcl_Obj *msgObj = Tcl_ObjPrintf( "unknown or ambiguous visual name \"%s\": class must be ", |
︙ | ︙ | |||
320 321 322 323 324 325 326 | if (visual == DefaultVisualOfScreen(Tk_Screen(tkwin))) { *colormapPtr = DefaultColormapOfScreen(Tk_Screen(tkwin)); } else { for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->shareable && (cmapPtr->visual == visual)) { *colormapPtr = cmapPtr->colormap; | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | if (visual == DefaultVisualOfScreen(Tk_Screen(tkwin))) { *colormapPtr = DefaultColormapOfScreen(Tk_Screen(tkwin)); } else { for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->shareable && (cmapPtr->visual == visual)) { *colormapPtr = cmapPtr->colormap; cmapPtr->refCount++; goto done; } } cmapPtr = ckalloc(sizeof(TkColormap)); cmapPtr->colormap = XCreateColormap(Tk_Display(tkwin), RootWindowOfScreen(Tk_Screen(tkwin)), visual, AllocNone); |
︙ | ︙ | |||
423 424 425 426 427 428 429 | * If the colormap was a special one allocated by code in this file, * increment its reference count. */ for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | * If the colormap was a special one allocated by code in this file, * increment its reference count. */ for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { cmapPtr->refCount++; } } return colormap; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
472 473 474 475 476 477 478 | dispPtr = TkGetDisplay(display); if (dispPtr == NULL) { Tcl_Panic("unknown display passed to Tk_FreeColormap"); } for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { | < | | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | dispPtr = TkGetDisplay(display); if (dispPtr == NULL) { Tcl_Panic("unknown display passed to Tk_FreeColormap"); } for (prevPtr = NULL, cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; prevPtr = cmapPtr, cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { if (cmapPtr->refCount-- <= 1) { XFreeColormap(display, colormap); if (prevPtr == NULL) { dispPtr->cmapPtr = cmapPtr->nextPtr; } else { prevPtr->nextPtr = cmapPtr->nextPtr; } ckfree(cmapPtr); |
︙ | ︙ | |||
530 531 532 533 534 535 536 | dispPtr = TkGetDisplay(display); if (dispPtr == NULL) { Tcl_Panic("unknown display passed to Tk_PreserveColormap"); } for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { | | | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | dispPtr = TkGetDisplay(display); if (dispPtr == NULL) { Tcl_Panic("unknown display passed to Tk_PreserveColormap"); } for (cmapPtr = dispPtr->cmapPtr; cmapPtr != NULL; cmapPtr = cmapPtr->nextPtr) { if (cmapPtr->colormap == colormap) { cmapPtr->refCount++; return; } } } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to generic/tkWindow.c.
︙ | ︙ | |||
33 34 35 36 37 38 39 | typedef struct TkHalfdeadWindow { int flags; struct TkWindow *winPtr; struct TkHalfdeadWindow *nextPtr; } TkHalfdeadWindow; | | | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | typedef struct TkHalfdeadWindow { int flags; struct TkWindow *winPtr; struct TkHalfdeadWindow *nextPtr; } TkHalfdeadWindow; typedef struct { int numMainWindows; /* Count of numver of main windows currently * open in this thread. */ TkMainInfo *mainWindowList; /* First in list of all main windows managed * by this thread. */ TkHalfdeadWindow *halfdeadWindowList; /* First in list of partially deallocated |
︙ | ︙ | |||
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | Tk_CreateImageType(&tkBitmapImageType); Tk_CreateImageType(&tkPhotoImageType); /* * Create built-in photo image formats. */ Tk_CreatePhotoImageFormat(&tkImgFmtGIF); Tk_CreatePhotoImageFormat(&tkImgFmtPNG); Tk_CreatePhotoImageFormat(&tkImgFmtPPM); } if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) { dispPtr = ((TkWindow *) parent)->dispPtr; screenId = Tk_ScreenNumber(parent); } else { dispPtr = GetScreen(interp, screenName, &screenId); | > > | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | Tk_CreateImageType(&tkBitmapImageType); Tk_CreateImageType(&tkPhotoImageType); /* * Create built-in photo image formats. */ Tk_CreatePhotoImageFormat(&tkImgFmtDefault); Tk_CreatePhotoImageFormat(&tkImgFmtGIF); Tk_CreatePhotoImageFormat(&tkImgFmtPNG); Tk_CreatePhotoImageFormat(&tkImgFmtPPM); Tk_CreatePhotoImageFormat(&tkImgFmtSVGnano); } if ((parent != NULL) && (screenName != NULL) && (screenName[0] == '\0')) { dispPtr = ((TkWindow *) parent)->dispPtr; screenId = Tk_ScreenNumber(parent); } else { dispPtr = GetScreen(interp, screenName, &screenId); |
︙ | ︙ | |||
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | #endif /* TK_USE_INPUT_METHODS */ winPtr->tagPtr = NULL; winPtr->numTags = 0; winPtr->optionLevel = -1; winPtr->selHandlerList = NULL; winPtr->geomMgrPtr = NULL; winPtr->geomData = NULL; winPtr->reqWidth = winPtr->reqHeight = 1; winPtr->internalBorderLeft = 0; winPtr->wmInfoPtr = NULL; winPtr->classProcsPtr = NULL; winPtr->instanceData = NULL; winPtr->privatePtr = NULL; winPtr->internalBorderRight = 0; winPtr->internalBorderTop = 0; winPtr->internalBorderBottom = 0; winPtr->minReqWidth = 0; winPtr->minReqHeight = 0; | > > < | 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 | #endif /* TK_USE_INPUT_METHODS */ winPtr->tagPtr = NULL; winPtr->numTags = 0; winPtr->optionLevel = -1; winPtr->selHandlerList = NULL; winPtr->geomMgrPtr = NULL; winPtr->geomData = NULL; winPtr->geomMgrName = NULL; winPtr->maintainerPtr = NULL; winPtr->reqWidth = winPtr->reqHeight = 1; winPtr->internalBorderLeft = 0; winPtr->wmInfoPtr = NULL; winPtr->classProcsPtr = NULL; winPtr->instanceData = NULL; winPtr->privatePtr = NULL; winPtr->internalBorderRight = 0; winPtr->internalBorderTop = 0; winPtr->internalBorderBottom = 0; winPtr->minReqWidth = 0; winPtr->minReqHeight = 0; return winPtr; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
847 848 849 850 851 852 853 | Tcl_Panic("TkWindow and Tk_FakeWin are not the same size"); } /* * Create the basic TkWindow structure. */ | | | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | Tcl_Panic("TkWindow and Tk_FakeWin are not the same size"); } /* * Create the basic TkWindow structure. */ tkwin = CreateTopLevelWindow(interp, NULL, baseName, screenName, /* flags */ 0); if (tkwin == NULL) { return NULL; } /* * Create the TkMainInfo structure for this application, and set up |
︙ | ︙ | |||
945 946 947 948 949 950 951 | } if (isSafe && !(cmdPtr->flags & ISSAFE)) { Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name); } } /* | | | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | } if (isSafe && !(cmdPtr->flags & ISSAFE)) { Tcl_HideCommand(interp, cmdPtr->name, cmdPtr->name); } } /* * Set variables for the interpreter. */ Tcl_SetVar2(interp, "tk_patchLevel", NULL, TK_PATCH_LEVEL, TCL_GLOBAL_ONLY); Tcl_SetVar2(interp, "tk_version", NULL, TK_VERSION, TCL_GLOBAL_ONLY); tsdPtr->numMainWindows++; return tkwin; |
︙ | ︙ | |||
1131 1132 1133 1134 1135 1136 1137 | * screen on which to create new window; * window will be a top-level window. */ { #define FIXED_SPACE 5 char fixedSpace[FIXED_SPACE+1]; char *p; Tk_Window parent; | | | | | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 | * screen on which to create new window; * window will be a top-level window. */ { #define FIXED_SPACE 5 char fixedSpace[FIXED_SPACE+1]; char *p; Tk_Window parent; size_t numChars; /* * Strip the parent's name out of pathName (it's everything up to the last * dot). There are two tricky parts: (a) must copy the parent's name * somewhere else to avoid modifying the pathName string (for large names, * space for the copy will have to be malloc'ed); (b) must special-case * the situation where the parent is ".". */ p = strrchr(pathName, '.'); if (p == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "bad window path name \"%s\"", pathName)); Tcl_SetErrorCode(interp, "TK", "VALUE", "WINDOW_PATH", NULL); return NULL; } numChars = p-pathName; if (numChars > FIXED_SPACE) { p = ckalloc(numChars + 1); } else { p = fixedSpace; } if (numChars == 0) { *p = '.'; p[1] = '\0'; } else { strncpy(p, pathName, numChars); p[numChars] = '\0'; } /* * Find the parent window. */ |
︙ | ︙ | |||
1438 1439 1440 1441 1442 1443 1444 | * to do an explicit destroy of this X window. */ XDestroyWindow(winPtr->display, winPtr->window); } #endif Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, | | | | | | 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 | * to do an explicit destroy of this X window. */ XDestroyWindow(winPtr->display, winPtr->window); } #endif Tcl_DeleteHashEntry(Tcl_FindHashEntry(&dispPtr->winTable, winPtr->window)); winPtr->window = None; } UnlinkWindow(winPtr); TkEventDeadWindow(winPtr); #ifdef TK_USE_INPUT_METHODS if (winPtr->inputContext != NULL && winPtr->ximGeneration == winPtr->dispPtr->ximGeneration) { XDestroyIC(winPtr->inputContext); } winPtr->inputContext = NULL; #endif /* TK_USE_INPUT_METHODS */ if (winPtr->tagPtr != NULL) { TkFreeBindingTags(winPtr); } TkOptionDeadWindow(winPtr); TkSelDeadWindow(winPtr); TkGrabDeadWindow(winPtr); if (winPtr->geomMgrName != NULL) { ckfree(winPtr->geomMgrName); winPtr->geomMgrName = NULL; } if (winPtr->mainPtr != NULL) { if (winPtr->pathName != NULL) { Tk_DeleteAllBindings(winPtr->mainPtr->bindingTable, winPtr->pathName); Tcl_DeleteHashEntry(Tcl_FindHashEntry(&winPtr->mainPtr->nameTable, winPtr->pathName)); |
︙ | ︙ | |||
2357 2358 2359 2360 2361 2362 2363 | break; } } if (window == None) { return NULL; } | | | 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 | break; } } if (window == None) { return NULL; } hPtr = Tcl_FindHashEntry(&dispPtr->winTable, window); if (hPtr == NULL) { return NULL; } return Tcl_GetHashValue(hPtr); } /* |
︙ | ︙ | |||
2829 2830 2831 2832 2833 2834 2835 | #if defined(_WIN32) static HMODULE tkcygwindll = NULL; /* * Run Tk_MainEx from libtk8.?.dll * | | | | | | | | 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 | #if defined(_WIN32) static HMODULE tkcygwindll = NULL; /* * Run Tk_MainEx from libtk8.?.dll * * This function is only ever called from wish8.?.exe, the cygwin port of Tcl. * This means that the system encoding is utf-8, so we don't have to do any * encoding conversions. */ int TkCygwinMainEx( int argc, /* Number of arguments. */ char **argv, /* Array of argument strings. */ Tcl_AppInitProc *appInitProc, /* Application-specific initialization * procedure to call after most initialization * but before starting to execute commands. */ Tcl_Interp *interp) { WCHAR name[MAX_PATH]; size_t len; void (*tkmainex)(int, char **, Tcl_AppInitProc *, Tcl_Interp *); /* construct "<path>/libtk8.?.dll", from "<path>/tk8?.dll" */ len = GetModuleFileNameW(Tk_GetHINSTANCE(), name, MAX_PATH); name[len-2] = '.'; name[len-1] = name[len-5]; wcscpy(name+len, L".dll"); memcpy(name+len-8, L"libtk8", 6 * sizeof(WCHAR)); tkcygwindll = LoadLibrary(name); if (!tkcygwindll) { /* dll is not present */ return 0; } tkmainex = (void (*)(int, char **, Tcl_AppInitProc *, Tcl_Interp *)) |
︙ | ︙ | |||
3055 3056 3057 3058 3059 3060 3061 | TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; /* * Ensure that we are getting a compatible version of Tcl. */ | | > > > > > > | 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 | TCL_ARGV_AUTO_REST, TCL_ARGV_AUTO_HELP, TCL_ARGV_TABLE_END }; /* * Ensure that we are getting a compatible version of Tcl. */ if (Tcl_InitStubs(interp, "8.6-", 0) == NULL) { return TCL_ERROR; } /* * TIP #59: Make embedded configuration information available. */ TkInitEmbeddedConfigurationInformation(interp); /* * Ensure that our obj-types are registered with the Tcl runtime. */ TkRegisterObjTypes(); tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); |
︙ | ︙ | |||
3165 3166 3167 3168 3169 3170 3171 | "\n (processing arguments in argv variable)"); code = TCL_ERROR; } if (code == TCL_OK) { Tcl_SetVar2Ex(interp, "argv", NULL, Tcl_NewListObj(objc-1, rest+1), TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "argc", NULL, | | | 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 | "\n (processing arguments in argv variable)"); code = TCL_ERROR; } if (code == TCL_OK) { Tcl_SetVar2Ex(interp, "argv", NULL, Tcl_NewListObj(objc-1, rest+1), TCL_GLOBAL_ONLY); Tcl_SetVar2Ex(interp, "argc", NULL, Tcl_NewWideIntObj(objc-1), TCL_GLOBAL_ONLY); ckfree(rest); } Tcl_DecrRefCount(parseList); if (code != TCL_OK) { goto done; } } |
︙ | ︙ | |||
3197 3198 3199 3200 3201 3202 3203 | } /* * The -class argument is always the ToTitle of the -name */ { | | | | 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 | } /* * The -class argument is always the ToTitle of the -name */ { TkSizeT numBytes; const char *bytes = TkGetStringFromObj(nameObj, &numBytes); classObj = Tcl_NewStringObj(bytes, numBytes); numBytes = Tcl_UtfToTitle(Tcl_GetString(classObj)); Tcl_SetObjLength(classObj, numBytes); } |
︙ | ︙ |
Changes to generic/ttk/ttkBlink.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | * to display the cursor or not (e.g., readonly or disabled states); * TtkBlinkCursor() does not account for this. * * TODO: * Add script-level access to configure application-wide blink rate. */ | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | * to display the cursor or not (e.g., readonly or disabled states); * TtkBlinkCursor() does not account for this. * * TODO: * Add script-level access to configure application-wide blink rate. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #define DEF_CURSOR_ON_TIME 600 /* milliseconds */ #define DEF_CURSOR_OFF_TIME 300 /* milliseconds */ /* Interp-specific data for tracking cursors: |
︙ | ︙ | |||
64 65 66 67 68 69 70 | /* CursorBlinkProc -- * Timer handler to blink the insert cursor on and off. */ static void CursorBlinkProc(ClientData clientData) { | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | /* CursorBlinkProc -- * Timer handler to blink the insert cursor on and off. */ static void CursorBlinkProc(ClientData clientData) { CursorManager *cm = clientData; int blinkTime; if (cm->owner->flags & CURSOR_ON) { cm->owner->flags &= ~CURSOR_ON; blinkTime = cm->offTime; } else { cm->owner->flags |= CURSOR_ON; |
︙ | ︙ |
Changes to generic/ttk/ttkButton.c.
1 2 3 4 5 6 | /* * Copyright (c) 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. */ | < | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* * Copyright (c) 2003, Joe English * * label, button, checkbutton, radiobutton, and menubutton widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /* Bit fields for OptionSpec mask field: */ #define STATE_CHANGED (0x100) /* -state option changed */ #define DEFAULTSTATE_CHANGED (0x200) /* -default option changed */ /*------------------------------------------------------------------------ * +++ Base resources for labels, buttons, checkbuttons, etc: */ typedef struct { /* * Text element resources: */ Tcl_Obj *textObj; Tcl_Obj *justifyObj; Tcl_Obj *textVariableObj; Tcl_Obj *underlineObj; Tcl_Obj *widthObj; Ttk_TraceHandle *textVariableTrace; Ttk_ImageSpec *imageSpec; |
︙ | ︙ | |||
52 53 54 55 56 57 58 59 | { WidgetCore core; BasePart base; } Base; static Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", | > > > | | | | | | | | | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | { WidgetCore core; BasePart base; } Base; static Tk_OptionSpec BaseOptionSpecs[] = { {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Base,base.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Base,base.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", "", offsetof(Base,base.textVariableObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", offsetof(Base,base.underlineObj), -1, 0,0,0 }, /* SB: OPTION_INT, see <<NOTE-NULLOPTIONS>> */ {TK_OPTION_STRING, "-width", "width", "Width", NULL, offsetof(Base,base.widthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Image options */ {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, offsetof(Base,base.imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, /* * Compound base/image options */ {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", offsetof(Base,base.compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Base,base.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, /* * Compatibility/legacy options */ {TK_OPTION_STRING, "-state", "state", "State", "normal", offsetof(Base,base.stateObj), -1, 0,0,STATE_CHANGED }, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Variable trace procedure for -textvariable option: |
︙ | ︙ | |||
225 226 227 228 229 230 231 | BasePart base; LabelPart label; } Label; static Tk_OptionSpec LabelOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor", | | | | | | | | | | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | BasePart base; LabelPart label; } Label; static Tk_OptionSpec LabelOptionSpecs[] = { {TK_OPTION_BORDER, "-background", "frameColor", "FrameColor", NULL, offsetof(Label,label.backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, offsetof(Label,label.foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", NULL, offsetof(Label,label.fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, offsetof(Label,label.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Label,label.reliefObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, offsetof(Label,label.anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", NULL, offsetof(Label, label.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", NULL, offsetof(Label, label.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED /*SB: SIZE_CHANGED*/ }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static const Ttk_Ensemble LabelCommands[] = { |
︙ | ︙ | |||
308 309 310 311 312 313 314 | /* * Option specifications: */ static Tk_OptionSpec ButtonOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", | | | | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | /* * Option specifications: */ static Tk_OptionSpec ButtonOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Button, button.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-default", "default", "Default", "normal", offsetof(Button, button.defaultStateObj), -1, 0, (ClientData) ttkDefaultStrings, DEFAULTSTATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static int ButtonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) |
︙ | ︙ | |||
418 419 420 421 422 423 424 | /* * Option specifications: */ static Tk_OptionSpec CheckbuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", | | | | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | /* * Option specifications: */ static Tk_OptionSpec CheckbuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", NULL, offsetof(Checkbutton, checkbutton.variableObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-onvalue", "onValue", "OnValue", "1", offsetof(Checkbutton, checkbutton.onValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-offvalue", "offValue", "OffValue", "0", offsetof(Checkbutton, checkbutton.offValueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Checkbutton, checkbutton.commandObj), -1, 0,0,0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; /* |
︙ | ︙ | |||
487 488 489 490 491 492 493 | static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; Tcl_Obj *varName = checkPtr->checkbutton.variableObj; Ttk_TraceHandle *vt = NULL; | | | 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 | static int CheckbuttonConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Checkbutton *checkPtr = recordPtr; Tcl_Obj *varName = checkPtr->checkbutton.variableObj; Ttk_TraceHandle *vt = NULL; if (varName != NULL && *Tcl_GetString(varName) != '\0') { vt = Ttk_TraceVariable(interp, varName, CheckbuttonVariableChanged, checkPtr); if (!vt) { return TCL_ERROR; } } |
︙ | ︙ | |||
626 627 628 629 630 631 632 | /* * Option specifications: */ static Tk_OptionSpec RadiobuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", | | | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | /* * Option specifications: */ static Tk_OptionSpec RadiobuttonOptionSpecs[] = { {TK_OPTION_STRING, "-variable", "variable", "Variable", "::selectedButton", offsetof(Radiobutton, radiobutton.variableObj),-1, 0,0,0}, {TK_OPTION_STRING, "-value", "Value", "Value", "1", offsetof(Radiobutton, radiobutton.valueObj), -1, 0,0,0}, {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Radiobutton, radiobutton.commandObj), -1, 0,0,0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; /* |
︙ | ︙ | |||
801 802 803 804 805 806 807 | */ static const char *const directionStrings[] = { "above", "below", "left", "right", "flush", NULL }; static Tk_OptionSpec MenubuttonOptionSpecs[] = { {TK_OPTION_STRING, "-menu", "menu", "Menu", | | | | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | */ static const char *const directionStrings[] = { "above", "below", "left", "right", "flush", NULL }; static Tk_OptionSpec MenubuttonOptionSpecs[] = { {TK_OPTION_STRING, "-menu", "menu", "Menu", "", offsetof(Menubutton, menubutton.menuObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-direction", "direction", "Direction", "below", offsetof(Menubutton, menubutton.directionObj), -1, 0,(ClientData)directionStrings,GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(BaseOptionSpecs) }; static const Ttk_Ensemble MenubuttonCommands[] = { |
︙ | ︙ |
Changes to generic/ttk/ttkCache.c.
︙ | ︙ | |||
24 25 26 27 28 29 30 | * @@@ BUGS/TODO: Need distinct caches for each combination * of display, visual, and colormap. * * @@@ Colormap flashing on PseudoColor visuals is still possible, * but this will be a transient effect. */ | < | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * @@@ BUGS/TODO: Need distinct caches for each combination * of display, visual, and colormap. * * @@@ Colormap flashing on PseudoColor visuals is still possible, * but this will be a transient effect. */ #include "tkInt.h" #include "ttkTheme.h" struct Ttk_ResourceCache_ { Tcl_Interp *interp; /* Interpreter for error reporting */ Tk_Window tkwin; /* Cache window. */ Tcl_HashTable fontTable; /* Entries: Tcl_Obj* holding FontObjs */ Tcl_HashTable colorTable; /* Entries: Tcl_Obj* holding ColorObjs */ |
︙ | ︙ |
Changes to generic/ttk/ttkClamTheme.c.
1 2 3 4 5 6 | /* * Copyright (C) 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * Copyright (C) 2004 Joe English * * "clam" theme; inspired by the XFCE family of Gnome themes. */ #include "tkInt.h" #include "ttkTheme.h" /* * Under windows, the Tk-provided XDrawLine and XDrawArc have an * off-by-one error in the end point. This is especially apparent with this * theme. Defining this macro as true handles this case. */ #if defined(_WIN32) && !defined(WIN32_XDRAWLINE_HACK) # define WIN32_XDRAWLINE_HACK 1 #else # define WIN32_XDRAWLINE_HACK 0 |
︙ | ︙ | |||
104 105 106 107 108 109 110 | Tcl_Obj *darkColorObj; Tcl_Obj *reliefObj; Tcl_Obj *borderWidthObj; /* See <<NOTE-BORDERWIDTH>> */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, | | | | | | | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | Tcl_Obj *darkColorObj; Tcl_Obj *reliefObj; Tcl_Obj *borderWidthObj; /* See <<NOTE-BORDERWIDTH>> */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, offsetof(BorderElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(BorderElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(BorderElement,darkColorObj), DARK_COLOR }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; /* * <<NOTE-BORDERWIDTH>>: -borderwidth is only partially supported: * in this theme, borders are always exactly 2 pixels thick. * With -borderwidth 0, border is not drawn at all; * otherwise a 2-pixel border is used. For -borderwidth > 2, * the excess is used as padding. */ static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
194 195 196 197 198 199 200 | Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, | | | | | | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-bordercolor", TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(FieldElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(FieldElement,darkColorObj), DARK_COLOR }, { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, { NULL, 0, 0, NULL } }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
276 277 278 279 280 281 282 | Tcl_Obj *foregroundObj; Tcl_Obj *upperColorObj; Tcl_Obj *lowerColorObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatorsize", TK_OPTION_PIXELS, | | | | | | | | 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | Tcl_Obj *foregroundObj; Tcl_Obj *upperColorObj; Tcl_Obj *lowerColorObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-indicatorsize", TK_OPTION_PIXELS, offsetof(IndicatorElement,sizeObj), "10" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "1" }, { "-indicatorbackground", TK_OPTION_COLOR, offsetof(IndicatorElement,backgroundObj), "white" }, { "-indicatorforeground", TK_OPTION_COLOR, offsetof(IndicatorElement,foregroundObj), "black" }, { "-upperbordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,upperColorObj), DARKEST_COLOR }, { "-lowerbordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,lowerColorObj), DARK_COLOR }, { NULL, 0, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
398 399 400 401 402 403 404 | Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, | | | | | 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | Tcl_Obj *colorObj; Tcl_Obj *paddingObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,sizeObj), STR(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, offsetof(MenuIndicatorElement,colorObj), "black" }, { "-arrowpadding",TK_OPTION_STRING, offsetof(MenuIndicatorElement,paddingObj), "3" }, { NULL, 0, 0, NULL } }; static void MenuIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
467 468 469 470 471 472 473 | Tcl_Obj *lightColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *gripCountObj; } GripElement; static Ttk_ElementOptionSpec GripElementOptions[] = { { "-lightcolor", TK_OPTION_COLOR, | | | | | 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | Tcl_Obj *lightColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *gripCountObj; } GripElement; static Ttk_ElementOptionSpec GripElementOptions[] = { { "-lightcolor", TK_OPTION_COLOR, offsetof(GripElement,lightColorObj), LIGHT_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(GripElement,borderColorObj), DARKEST_COLOR }, { "-gripcount", TK_OPTION_INT, offsetof(GripElement,gripCountObj), "5" }, { NULL, 0, 0, NULL } }; static void GripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
552 553 554 555 556 557 558 | Tcl_Obj *arrowSizeObj; Tcl_Obj *gripCountObj; Tcl_Obj *sliderlengthObj; } ScrollbarElement; static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { { "-orient", TK_OPTION_ANY, | | | | | | | | | | | | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | Tcl_Obj *arrowSizeObj; Tcl_Obj *gripCountObj; Tcl_Obj *sliderlengthObj; } ScrollbarElement; static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ScrollbarElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(ScrollbarElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,borderColorObj), DARKEST_COLOR }, { "-troughcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,troughColorObj), DARKER_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,darkColorObj), DARK_COLOR }, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ScrollbarElement,arrowColorObj), "#000000" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ScrollbarElement,arrowSizeObj), STR(SCROLLBAR_THICKNESS) }, { "-gripcount", TK_OPTION_INT, offsetof(ScrollbarElement,gripCountObj), "5" }, { "-sliderlength", TK_OPTION_INT, offsetof(ScrollbarElement,sliderlengthObj), "30" }, { NULL, 0, 0, NULL } }; static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { |
︙ | ︙ | |||
626 627 628 629 630 631 632 | /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); | | | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | /* * Draw grip: */ Ttk_GetOrientFromObj(NULL, sb->orientObj, &orient); Tcl_GetIntFromObj(NULL, sb->gripCountObj, &gripCount); lightGC = Ttk_GCForColor(tkwin,sb->lightColorObj,d); darkGC = Ttk_GCForColor(tkwin,sb->borderColorObj,d); if (orient == TTK_ORIENT_HORIZONTAL) { dx = 1; dy = 0; x1 = x2 = b.x + b.width / 2 - gripCount; y1 = b.y + 2; y2 = b.y + b.height - 3 + w; } else { dx = 0; dy = 1; |
︙ | ︙ | |||
706 707 708 709 710 711 712 | } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; | | | | 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned state) { ScrollbarElement *sb = elementRecord; b = Ttk_PadBox(b, Ttk_UniformPadding(2)); if (b.width > 4 && b.height > 4) { DrawSmoothBorder(tkwin, d, b, sb->borderColorObj, sb->lightColorObj, sb->darkColorObj); XFillRectangle(Tk_Display(tkwin), d, BackgroundGC(tkwin, sb->backgroundObj), b.x+2, b.y+2, b.width-4, b.height-4); } } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, |
︙ | ︙ | |||
776 777 778 779 780 781 782 | ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. | | | | | | | | 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 | ArrowElementSize, ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Notebook elements. * * Note: Tabs, except for the rightmost, overlap the neighbor to * their right by one pixel. */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *borderColorObj; Tcl_Obj *lightColorObj; Tcl_Obj *darkColorObj; } NotebookElement; static Ttk_ElementOptionSpec NotebookElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(NotebookElement,backgroundObj), FRAME_COLOR }, { "-bordercolor", TK_OPTION_COLOR, offsetof(NotebookElement,borderColorObj), DARKEST_COLOR }, { "-lightcolor", TK_OPTION_COLOR, offsetof(NotebookElement,lightColorObj), LIGHT_COLOR }, { "-darkcolor", TK_OPTION_COLOR, offsetof(NotebookElement,darkColorObj), DARK_COLOR }, { NULL, 0, 0, NULL } }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ |
Changes to generic/ttk/ttkClassicTheme.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; } HighlightElement; static Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, | | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | typedef struct { Tcl_Obj *highlightColorObj; Tcl_Obj *highlightThicknessObj; } HighlightElement; static Ttk_ElementOptionSpec HighlightElementOptions[] = { { "-highlightcolor",TK_OPTION_COLOR, offsetof(HighlightElement,highlightColorObj), DEFAULT_BACKGROUND }, { "-highlightthickness",TK_OPTION_PIXELS, offsetof(HighlightElement,highlightThicknessObj), "0" }, { NULL, 0, 0, NULL } }; static void HighlightElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
62 63 64 65 66 67 68 | HighlightElementOptions, HighlightElementSize, HighlightElementDraw }; /*------------------------------------------------------------------------ * +++ Button Border element: | | | | | | | | | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | HighlightElementOptions, HighlightElementSize, HighlightElementDraw }; /*------------------------------------------------------------------------ * +++ Button Border element: * * The Motif-style button border on X11 consists of (from outside-in): * * + focus indicator (controlled by -highlightcolor and -highlightthickness), * + default ring (if -default active; blank if -default normal) * + shaded border (controlled by -background, -borderwidth, and -relief) */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(ButtonBorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ButtonBorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, { NULL, 0, 0, NULL } }; static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
109 110 111 112 113 114 115 | borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | borderWidth += 5; } *paddingPtr = Ttk_UniformPadding((short)borderWidth); } /* * (@@@ Note: ButtonBorderElement still still still buggy: * padding for default ring is drawn in the wrong color * when the button is active.) */ static void ButtonBorderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { ButtonBorderElement *bd = elementRecord; |
︙ | ︙ | |||
193 194 195 196 197 198 199 | Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { | | | | | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), DEFAULT_ARROW_SIZE }, { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised" }, { NULL, 0, 0, NULL } }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
275 276 277 278 279 280 281 | ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * | | | | | | | | | | | | | | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | ArrowElementDraw }; /*------------------------------------------------------------------------ * +++ Sash element (for ttk::panedwindow) * * NOTES: * * panedwindows with -orient horizontal use vertical sashes, and vice versa. * * Interpretation of -sashrelief 'groove' and 'ridge' are * swapped wrt. the core panedwindow, which (I think) has them backwards. * * Default -sashrelief is sunken; the core panedwindow has default * -sashrelief raised, but that looks wrong to me. */ static Ttk_Orient SashClientData[] = { TTK_ORIENT_HORIZONTAL, TTK_ORIENT_VERTICAL }; typedef struct { Tcl_Obj *borderObj; /* background color */ Tcl_Obj *sashReliefObj; /* sash relief */ Tcl_Obj *sashThicknessObj; /* overall thickness of sash */ Tcl_Obj *sashPadObj; /* padding on either side of handle */ Tcl_Obj *handleSizeObj; /* handle width and height */ Tcl_Obj *handlePadObj; /* handle's distance from edge */ } SashElement; static Ttk_ElementOptionSpec SashOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SashElement,borderObj), DEFAULT_BACKGROUND }, { "-sashrelief", TK_OPTION_RELIEF, offsetof(SashElement,sashReliefObj), "sunken" }, { "-sashthickness", TK_OPTION_PIXELS, offsetof(SashElement,sashThicknessObj), "6" }, { "-sashpad", TK_OPTION_PIXELS, offsetof(SashElement,sashPadObj), "2" }, { "-handlesize", TK_OPTION_PIXELS, offsetof(SashElement,handleSizeObj), "8" }, { "-handlepad", TK_OPTION_PIXELS, offsetof(SashElement,handlePadObj), "8" }, { NULL, 0, 0, NULL } }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
361 362 363 364 365 366 367 | gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; | | | | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_SUNKEN: case TK_RELIEF_GROOVE: gc1 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_LIGHT_GC); break; case TK_RELIEF_SOLID: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_DARK_GC); break; case TK_RELIEF_FLAT: default: gc1 = gc2 = Tk_3DBorderGC(tkwin, border, TK_3D_FLAT_GC); break; } /* Draw sash line: */ |
︙ | ︙ | |||
392 393 394 395 396 397 398 | if (horizontal) { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W); hb.x += handlePad; } else { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | if (horizontal) { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_W); hb.x += handlePad; } else { hb = Ttk_StickBox(b, handleSize, handleSize, TTK_STICK_N); hb.y += handlePad; } Tk_Fill3DRectangle(tkwin, d, border, hb.x, hb.y, hb.width, hb.height, 1, TK_RELIEF_RAISED); } } static Ttk_ElementSpec SashElementSpec = { TK_STYLE_VERSION_2, sizeof(SashElement), |
︙ | ︙ | |||
489 490 491 492 493 494 495 | Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); | | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | Ttk_RegisterElement(interp, theme, "leftarrow", &ArrowElementSpec, &ArrowElements[2]); Ttk_RegisterElement(interp, theme, "rightarrow", &ArrowElementSpec, &ArrowElements[3]); Ttk_RegisterElement(interp, theme, "arrow", &ArrowElementSpec, &ArrowElements[0]); Ttk_RegisterElement(interp, theme, "hsash", &SashElementSpec, &SashClientData[0]); Ttk_RegisterElement(interp, theme, "vsash", &SashElementSpec, &SashClientData[1]); /* * Register layouts: */ |
︙ | ︙ |
Changes to generic/ttk/ttkDefaultTheme.c.
︙ | ︙ | |||
241 242 243 244 245 246 247 | Tcl_Obj *borderColorObj; /* Extra border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; /* for buttons */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { | | | | | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | Tcl_Obj *borderColorObj; /* Extra border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *defaultStateObj; /* for buttons */ } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor",TK_OPTION_COLOR, offsetof(BorderElement,borderColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(BorderElement,defaultStateObj), "disabled" }, { "-borderwidth",TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, 0, 0, NULL } }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
321 322 323 324 325 326 327 | */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { | | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; /* Extra border color */ } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, { "-bordercolor",TK_OPTION_COLOR, offsetof(FieldElement,borderColorObj), "black" }, { NULL, 0, 0, NULL } }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
463 464 465 466 467 468 469 | Tcl_Obj *shadeColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *marginObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_COLOR, | | | | | | | | | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | Tcl_Obj *shadeColorObj; Tcl_Obj *borderColorObj; Tcl_Obj *marginObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_COLOR, offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_COLOR, offsetof(IndicatorElement,foregroundObj), DEFAULT_FOREGROUND }, { "-indicatorcolor", TK_OPTION_COLOR, offsetof(IndicatorElement,colorObj), "#FFFFFF" }, { "-lightcolor", TK_OPTION_COLOR, offsetof(IndicatorElement,lightColorObj), "#DDDDDD" }, { "-shadecolor", TK_OPTION_COLOR, offsetof(IndicatorElement,shadeColorObj), "#888888" }, { "-bordercolor", TK_OPTION_COLOR, offsetof(IndicatorElement,borderColorObj), "black" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { NULL, 0, 0, NULL } }; static void IndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
650 651 652 653 654 655 656 | Tcl_Obj *borderColorObj; /* Extra color for borders */ Tcl_Obj *reliefObj; Tcl_Obj *colorObj; /* Arrow color */ } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, | | | | | | | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 | Tcl_Obj *borderColorObj; /* Extra color for borders */ Tcl_Obj *reliefObj; Tcl_Obj *colorObj; /* Arrow color */ } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ArrowElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised"}, { "-arrowcolor", TK_OPTION_COLOR, offsetof(ArrowElement,colorObj),"black"}, { NULL, 0, 0, NULL } }; /* * Note asymmetric padding: * top/left padding is 1 less than bottom/right, * since in this theme 2-pixel borders are asymmetric. |
︙ | ︙ | |||
727 728 729 730 731 732 733 | typedef struct { Tcl_Obj *directionObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } MenubuttonArrowElement; | | | | | | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | typedef struct { Tcl_Obj *directionObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } MenubuttonArrowElement; static const char *const directionStrings[] = { /* See also: button.c */ "above", "below", "left", "right", "flush", NULL }; enum { POST_ABOVE, POST_BELOW, POST_LEFT, POST_RIGHT, POST_FLUSH }; static Ttk_ElementOptionSpec MenubuttonArrowElementOptions[] = { { "-direction", TK_OPTION_STRING, offsetof(MenubuttonArrowElement,directionObj), "below" }, { "-arrowsize", TK_OPTION_PIXELS, offsetof(MenubuttonArrowElement,sizeObj), STRINGIFY(MENUBUTTON_ARROW_SIZE)}, { "-arrowcolor",TK_OPTION_COLOR, offsetof(MenubuttonArrowElement,colorObj), "black"}, { NULL, 0, 0, NULL } }; static Ttk_Padding MenubuttonArrowPadding = { 3, 0, 3, 0 }; static void MenubuttonArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, |
︙ | ︙ | |||
818 819 820 821 822 823 824 | Tcl_Obj *reliefObj; Tcl_Obj *grooveWidthObj; Tcl_Obj *orientObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-orient", TK_OPTION_ANY, | | | | | | | 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | Tcl_Obj *reliefObj; Tcl_Obj *grooveWidthObj; Tcl_Obj *orientObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(TroughElement, orientObj), "horizontal" }, { "-troughborderwidth", TK_OPTION_PIXELS, offsetof(TroughElement,borderWidthObj), "1" }, { "-troughcolor", TK_OPTION_BORDER, offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, offsetof(TroughElement,reliefObj), "sunken" }, { "-groovewidth", TK_OPTION_PIXELS, offsetof(TroughElement,grooveWidthObj), "-1" }, { NULL, 0, 0, NULL } }; static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
897 898 899 900 901 902 903 | Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; Tcl_Obj *reliefObj; Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { | | | | | | | 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | Tcl_Obj *borderObj; Tcl_Obj *borderColorObj; Tcl_Obj *reliefObj; Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-width", TK_OPTION_PIXELS, offsetof(ThumbElement,sizeObj), STRINGIFY(SCROLLBAR_WIDTH) }, { "-background", TK_OPTION_BORDER, offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj), "black" }, { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj),"raised" }, { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, 0, 0, NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
980 981 982 983 984 985 986 | Tcl_Obj *borderObj; /* Border / background color */ Tcl_Obj *borderColorObj; /* Additional border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *orientObj; /* Orientation of overall slider */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { | | | | | | | | | 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 | Tcl_Obj *borderObj; /* Border / background color */ Tcl_Obj *borderColorObj; /* Additional border color */ Tcl_Obj *borderWidthObj; Tcl_Obj *orientObj; /* Orientation of overall slider */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj), "15" }, { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), STRINGIFY(BORDERWIDTH) }, { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-bordercolor", TK_OPTION_COLOR, offsetof(ThumbElement,borderColorObj), "black" }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
1063 1064 1065 1066 1067 1068 1069 | Tcl_Obj *colorObj; Tcl_Obj *marginObj; Tcl_Obj *diameterObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, | | | | | 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | Tcl_Obj *colorObj; Tcl_Obj *marginObj; Tcl_Obj *diameterObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-diameter", TK_OPTION_PIXELS, offsetof(TreeitemIndicator,diameterObj), "9" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginObj), "2 2 4 2" }, { NULL, 0, 0, NULL } }; static void TreeitemIndicatorSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ |
Changes to generic/ttk/ttkElements.c.
1 2 3 4 5 6 7 | /* * Copyright (c) 2003, Joe English * * Default implementation for themed elements. * */ | < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * Copyright (c) 2003, Joe English * * Default implementation for themed elements. * */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #define DEFAULT_BORDERWIDTH "2" #define DEFAULT_ARROW_SIZE "15" #define MIN_THUMB_SIZE 10 |
︙ | ︙ | |||
56 57 58 59 60 61 62 | typedef struct { Tcl_Obj *backgroundObj; } BackgroundElement; static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | typedef struct { Tcl_Obj *backgroundObj; } BackgroundElement; static Ttk_ElementOptionSpec BackgroundElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BackgroundElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { |
︙ | ︙ | |||
109 110 111 112 113 114 115 | Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, | | | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(BorderElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(BorderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, { NULL, 0, 0, NULL } }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
164 165 166 167 168 169 170 | typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, | | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | typedef struct { Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,borderObj), "white" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(FieldElement,borderWidthObj), "2" }, { NULL, 0, 0, NULL } }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
220 221 222 223 224 225 226 | Tcl_Obj *paddingObj; Tcl_Obj *reliefObj; Tcl_Obj *shiftreliefObj; } PaddingElement; static Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, | | | | | 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | Tcl_Obj *paddingObj; Tcl_Obj *reliefObj; Tcl_Obj *shiftreliefObj; } PaddingElement; static Ttk_ElementOptionSpec PaddingElementOptions[] = { { "-padding", TK_OPTION_STRING, offsetof(PaddingElement,paddingObj), "0" }, { "-relief", TK_OPTION_RELIEF, offsetof(PaddingElement,reliefObj), "flat" }, { "-shiftrelief", TK_OPTION_INT, offsetof(PaddingElement,shiftreliefObj), "0" }, { NULL, 0, 0, NULL } }; static void PaddingElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
286 287 288 289 290 291 292 | gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } static Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, | | | | 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | gc = Tk_GetGC(tkwin, mask, &gcvalues); XDrawRectangle(Tk_Display(tkwin), d, gc, b.x, b.y, b.width-1, b.height-1); Tk_FreeGC(Tk_Display(tkwin), gc); } static Ttk_ElementOptionSpec FocusElementOptions[] = { { "-focuscolor",TK_OPTION_COLOR, offsetof(FocusElement,focusColorObj), "black" }, { "-focusthickness",TK_OPTION_PIXELS, offsetof(FocusElement,focusThicknessObj), "1" }, { NULL, 0, 0, NULL } }; static void FocusElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
338 339 340 341 342 343 344 | typedef struct { Tcl_Obj *orientObj; Tcl_Obj *borderObj; } SeparatorElement; static Ttk_ElementOptionSpec SeparatorElementOptions[] = { { "-orient", TK_OPTION_ANY, | | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | typedef struct { Tcl_Obj *orientObj; Tcl_Obj *borderObj; } SeparatorElement; static Ttk_ElementOptionSpec SeparatorElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SeparatorElement, orientObj), "horizontal" }, { "-background", TK_OPTION_BORDER, offsetof(SeparatorElement,borderObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; static void SeparatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
430 431 432 433 434 435 436 | typedef struct { Tcl_Obj *backgroundObj; } SizegripElement; static Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, | | | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | typedef struct { Tcl_Obj *backgroundObj; } SizegripElement; static Ttk_ElementOptionSpec SizegripOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SizegripElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; static void SizegripSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
491 492 493 494 495 496 497 | Tcl_Obj *diameterObj; Tcl_Obj *marginObj; Tcl_Obj *borderWidthObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, | | | | | | | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | Tcl_Obj *diameterObj; Tcl_Obj *marginObj; Tcl_Obj *borderWidthObj; } IndicatorElement; static Ttk_ElementOptionSpec IndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(IndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorcolor", TK_OPTION_BORDER, offsetof(IndicatorElement,colorObj), DEFAULT_BACKGROUND }, { "-indicatorrelief", TK_OPTION_RELIEF, offsetof(IndicatorElement,reliefObj), "raised" }, { "-indicatordiameter", TK_OPTION_PIXELS, offsetof(IndicatorElement,diameterObj), "12" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(IndicatorElement,marginObj), "0 2 4 2" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(IndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, 0, 0, NULL } }; /* * Checkbutton indicators (default): 3-D square. */ static void SquareIndicatorElementSize( |
︙ | ︙ | |||
637 638 639 640 641 642 643 | Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *marginObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, | | | | | | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *marginObj; } MenuIndicatorElement; static Ttk_ElementOptionSpec MenuIndicatorElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(MenuIndicatorElement,backgroundObj), DEFAULT_BACKGROUND }, { "-indicatorwidth", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,widthObj), "4.0m" }, { "-indicatorheight", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,heightObj), "1.7m" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(MenuIndicatorElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-indicatorrelief", TK_OPTION_RELIEF, offsetof(MenuIndicatorElement,reliefObj),"raised" }, { "-indicatormargin", TK_OPTION_STRING, offsetof(MenuIndicatorElement,marginObj), "5 0" }, { NULL, 0, 0, NULL } }; static void MenuIndicatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
706 707 708 709 710 711 712 | Tcl_Obj *reliefObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-background", TK_OPTION_BORDER, | | | | | | | 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | Tcl_Obj *reliefObj; Tcl_Obj *sizeObj; Tcl_Obj *colorObj; } ArrowElement; static Ttk_ElementOptionSpec ArrowElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(ArrowElement,borderObj), DEFAULT_BACKGROUND }, { "-relief",TK_OPTION_RELIEF, offsetof(ArrowElement,reliefObj),"raised"}, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ArrowElement,borderWidthObj), "1" }, { "-arrowcolor",TK_OPTION_COLOR, offsetof(ArrowElement,colorObj),"black"}, { "-arrowsize", TK_OPTION_PIXELS, offsetof(ArrowElement,sizeObj), "14" }, { NULL, 0, 0, NULL } }; static Ttk_Padding ArrowMargins = { 3,3,3,3 }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, |
︙ | ︙ | |||
777 778 779 780 781 782 783 | Tcl_Obj *colorObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, | | | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | Tcl_Obj *colorObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; } TroughElement; static Ttk_ElementOptionSpec TroughElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, offsetof(TroughElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-troughcolor", TK_OPTION_BORDER, offsetof(TroughElement,colorObj), DEFAULT_BACKGROUND }, { "-troughrelief",TK_OPTION_RELIEF, offsetof(TroughElement,reliefObj), "sunken" }, { NULL, 0, 0, NULL } }; static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
837 838 839 840 841 842 843 | Tcl_Obj *reliefObj; Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, | | | | | | | 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | Tcl_Obj *reliefObj; Tcl_Obj *borderObj; Tcl_Obj *borderWidthObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement, orientObj), "horizontal" }, { "-width", TK_OPTION_PIXELS, offsetof(ThumbElement,thicknessObj), DEFAULT_ARROW_SIZE }, { "-relief", TK_OPTION_RELIEF, offsetof(ThumbElement,reliefObj), "raised" }, { "-background", TK_OPTION_BORDER, offsetof(ThumbElement,borderObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(ThumbElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { NULL, 0, 0, NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
907 908 909 910 911 912 913 | Tcl_Obj *thicknessObj; /* slider thickness */ Tcl_Obj *reliefObj; /* the relief for this object */ Tcl_Obj *borderObj; /* the background color */ Tcl_Obj *borderWidthObj; /* the size of the border */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { | | | | | | | | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | Tcl_Obj *thicknessObj; /* slider thickness */ Tcl_Obj *reliefObj; /* the relief for this object */ Tcl_Obj *borderObj; /* the background color */ Tcl_Obj *borderWidthObj; /* the size of the border */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-sliderlength", TK_OPTION_PIXELS, offsetof(SliderElement,lengthObj), "30" }, { "-sliderthickness",TK_OPTION_PIXELS, offsetof(SliderElement,thicknessObj), "15" }, { "-sliderrelief", TK_OPTION_RELIEF, offsetof(SliderElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(SliderElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(SliderElement,borderObj), DEFAULT_BACKGROUND }, { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
1018 1019 1020 1021 1022 1023 1024 | Tcl_Obj *lengthObj; /* default width/height of the bar */ Tcl_Obj *reliefObj; /* border relief for this object */ Tcl_Obj *borderObj; /* background color */ Tcl_Obj *borderWidthObj; /* thickness of the border */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { | | | | | | | | 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | Tcl_Obj *lengthObj; /* default width/height of the bar */ Tcl_Obj *reliefObj; /* border relief for this object */ Tcl_Obj *borderObj; /* background color */ Tcl_Obj *borderWidthObj; /* thickness of the border */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(PbarElement,orientObj), "horizontal" }, { "-thickness", TK_OPTION_PIXELS, offsetof(PbarElement,thicknessObj), DEFAULT_PBAR_THICKNESS }, { "-barsize", TK_OPTION_PIXELS, offsetof(PbarElement,lengthObj), DEFAULT_PBAR_LENGTH }, { "-pbarrelief", TK_OPTION_RELIEF, offsetof(PbarElement,reliefObj), "raised" }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(PbarElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-background", TK_OPTION_BORDER, offsetof(PbarElement,borderObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ | |||
1092 1093 1094 1095 1096 1097 1098 | typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; } TabElement; static Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, | | | | 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 | typedef struct { Tcl_Obj *borderWidthObj; Tcl_Obj *backgroundObj; } TabElement; static Ttk_ElementOptionSpec TabElementOptions[] = { { "-borderwidth", TK_OPTION_PIXELS, offsetof(TabElement,borderWidthObj),"1" }, { "-background", TK_OPTION_BORDER, offsetof(TabElement,backgroundObj), DEFAULT_BACKGROUND }, {0,0,0,0} }; static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ |
Changes to generic/ttk/ttkEntry.c.
︙ | ︙ | |||
65 66 67 68 69 70 71 72 73 74 75 76 77 78 | * displayString points to string if showChar == NULL, * or to malloc'ed storage if showChar != NULL. */ /* Style parameters: */ typedef struct { Tcl_Obj *foregroundObj; /* Foreground color for normal text */ Tcl_Obj *backgroundObj; /* Entry widget background color */ Tcl_Obj *selBorderObj; /* Border and background for selection */ Tcl_Obj *selBorderWidthObj; /* Width of selection border */ Tcl_Obj *selForegroundObj; /* Foreground color for selected text */ Tcl_Obj *insertColorObj; /* Color of insertion cursor */ Tcl_Obj *insertWidthObj; /* Insert cursor width */ | > | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | * displayString points to string if showChar == NULL, * or to malloc'ed storage if showChar != NULL. */ /* Style parameters: */ typedef struct { Tcl_Obj *placeholderForegroundObj;/* Foreground color for placeholder text */ Tcl_Obj *foregroundObj; /* Foreground color for normal text */ Tcl_Obj *backgroundObj; /* Entry widget background color */ Tcl_Obj *selBorderObj; /* Border and background for selection */ Tcl_Obj *selBorderWidthObj; /* Width of selection border */ Tcl_Obj *selForegroundObj; /* Foreground color for selected text */ Tcl_Obj *insertColorObj; /* Color of insertion cursor */ Tcl_Obj *insertWidthObj; /* Insert cursor width */ |
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | Tk_Justify justify; /* Text justification */ EntryStyleData styleData; /* Display style data (widget options) */ EntryStyleData styleDefaults;/* Style defaults (fallback values) */ Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */ /* * Derived resources: */ Ttk_TraceHandle *textVariableTrace; char *displayString; /* String to use when displaying */ Tk_TextLayout textLayout; /* Cached text layout information. */ | > > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | Tk_Justify justify; /* Text justification */ EntryStyleData styleData; /* Display style data (widget options) */ EntryStyleData styleDefaults;/* Style defaults (fallback values) */ Tcl_Obj *stateObj; /* Compatibility option -- see CheckStateObj */ Tcl_Obj *placeholderObj; /* Text to display for placeholder text */ /* * Derived resources: */ Ttk_TraceHandle *textVariableTrace; char *displayString; /* String to use when displaying */ Tk_TextLayout textLayout; /* Cached text layout information. */ |
︙ | ︙ | |||
139 140 141 142 143 144 145 | #define STATE_CHANGED (0x100) /* -state option changed */ #define TEXTVAR_CHANGED (0x200) /* -textvariable option changed */ #define SCROLLCMD_CHANGED (0x400) /* -xscrollcommand option changed */ /* * Default option values: */ | | | > | | | | | | | | > > > | | | | | | | > > > | | > | > > | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | #define STATE_CHANGED (0x100) /* -state option changed */ #define TEXTVAR_CHANGED (0x200) /* -textvariable option changed */ #define SCROLLCMD_CHANGED (0x400) /* -xscrollcommand option changed */ /* * Default option values: */ #define DEF_SELECT_BG "#000000" #define DEF_SELECT_FG "#ffffff" #define DEF_PLACEHOLDER_FG "#b3b3b3" #define DEF_INSERT_BG "black" #define DEF_ENTRY_WIDTH "20" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_LIST_HEIGHT "10" static Tk_OptionSpec EntryOptionSpecs[] = { {TK_OPTION_BOOLEAN, "-exportselection", "exportSelection", "ExportSelection", "1", -1, offsetof(Entry, entry.exportSelection), 0,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", DEF_ENTRY_FONT, offsetof(Entry, entry.fontObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-invalidcommand", "invalidCommand", "InvalidCommand", NULL, -1, offsetof(Entry, entry.invalidCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", -1, offsetof(Entry, entry.justify), 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-placeholder", "placeHolder", "PlaceHolder", NULL, offsetof(Entry, entry.placeholderObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-show", "show", "Show", NULL, -1, offsetof(Entry, entry.showChar), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_STRING, "-state", "state", "State", "normal", offsetof(Entry, entry.stateObj), -1, 0,0,STATE_CHANGED}, {TK_OPTION_STRING, "-textvariable", "textVariable", "Variable", NULL, offsetof(Entry, entry.textVariableObj), -1, TK_OPTION_NULL_OK,0,TEXTVAR_CHANGED}, {TK_OPTION_STRING_TABLE, "-validate", "validate", "Validate", "none", -1, offsetof(Entry, entry.validate), 0, (ClientData) validateStrings, 0}, {TK_OPTION_STRING, "-validatecommand", "validateCommand", "ValidateCommand", NULL, -1, offsetof(Entry, entry.validateCmd), TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_INT, "-width", "width", "Width", DEF_ENTRY_WIDTH, offsetof(Entry, entry.widthObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", NULL, -1, offsetof(Entry, entry.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, /* EntryStyleData options: */ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", NULL, offsetof(Entry, entry.styleData.backgroundObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, offsetof(Entry, entry.styleData.foregroundObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_COLOR, "-placeholderforeground", "placeholderForeground", "PlaceholderForeground", NULL, offsetof(Entry, entry.styleData.placeholderForegroundObj), -1, TK_OPTION_NULL_OK,0,0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ EntryStyleData management. * This is still more awkward than it should be; * it should be able to use the Element API instead. */ /* EntryInitStyleDefaults -- * Initialize EntryStyleData record to fallback values. */ static void EntryInitStyleDefaults(EntryStyleData *es) { #define INIT(member, value) \ es->member = Tcl_NewStringObj(value, -1); \ Tcl_IncrRefCount(es->member); INIT(placeholderForegroundObj, DEF_PLACEHOLDER_FG) INIT(foregroundObj, DEFAULT_FOREGROUND) INIT(selBorderObj, DEF_SELECT_BG) INIT(selForegroundObj, DEF_SELECT_FG) INIT(insertColorObj, DEFAULT_FOREGROUND) INIT(selBorderWidthObj, "0") INIT(insertWidthObj, "1") #undef INIT } static void EntryFreeStyleDefaults(EntryStyleData *es) { Tcl_DecrRefCount(es->placeholderForegroundObj); Tcl_DecrRefCount(es->foregroundObj); Tcl_DecrRefCount(es->selBorderObj); Tcl_DecrRefCount(es->selForegroundObj); Tcl_DecrRefCount(es->insertColorObj); Tcl_DecrRefCount(es->selBorderWidthObj); Tcl_DecrRefCount(es->insertWidthObj); } |
︙ | ︙ | |||
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /* Initialize to fallback values: */ *es = entryPtr->entry.styleDefaults; # define INIT(member, name) \ if ((tmp=Ttk_QueryOption(entryPtr->core.layout,name,state))) \ es->member=tmp; INIT(foregroundObj, "-foreground"); INIT(selBorderObj, "-selectbackground") INIT(selBorderWidthObj, "-selectborderwidth") INIT(selForegroundObj, "-selectforeground") INIT(insertColorObj, "-insertcolor") INIT(insertWidthObj, "-insertwidth") #undef INIT /* Reacquire color & border resources from resource cache. */ es->foregroundObj = Ttk_UseColor(cache, tkwin, es->foregroundObj); es->selForegroundObj = Ttk_UseColor(cache, tkwin, es->selForegroundObj); es->insertColorObj = Ttk_UseColor(cache, tkwin, es->insertColorObj); es->selBorderObj = Ttk_UseBorder(cache, tkwin, es->selBorderObj); } /*------------------------------------------------------------------------ | > > | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | /* Initialize to fallback values: */ *es = entryPtr->entry.styleDefaults; # define INIT(member, name) \ if ((tmp=Ttk_QueryOption(entryPtr->core.layout,name,state))) \ es->member=tmp; INIT(placeholderForegroundObj, "-placeholderforeground"); INIT(foregroundObj, "-foreground"); INIT(selBorderObj, "-selectbackground") INIT(selBorderWidthObj, "-selectborderwidth") INIT(selForegroundObj, "-selectforeground") INIT(insertColorObj, "-insertcolor") INIT(insertWidthObj, "-insertwidth") #undef INIT /* Reacquire color & border resources from resource cache. */ es->placeholderForegroundObj = Ttk_UseColor(cache, tkwin, es->placeholderForegroundObj); es->foregroundObj = Ttk_UseColor(cache, tkwin, es->foregroundObj); es->selForegroundObj = Ttk_UseColor(cache, tkwin, es->selForegroundObj); es->insertColorObj = Ttk_UseColor(cache, tkwin, es->insertColorObj); es->selBorderObj = Ttk_UseBorder(cache, tkwin, es->selBorderObj); } /*------------------------------------------------------------------------ |
︙ | ︙ | |||
296 297 298 299 300 301 302 303 | /* EntryUpdateTextLayout -- * Recompute textLayout, layoutWidth, and layoutHeight * from displayString and fontObj. */ static void EntryUpdateTextLayout(Entry *entryPtr) { Tk_FreeTextLayout(entryPtr->entry.textLayout); | > > > | > > > > > > > > | 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | /* EntryUpdateTextLayout -- * Recompute textLayout, layoutWidth, and layoutHeight * from displayString and fontObj. */ static void EntryUpdateTextLayout(Entry *entryPtr) { TkSizeT length; char *text; Tk_FreeTextLayout(entryPtr->entry.textLayout); if ((entryPtr->entry.numChars != 0) || (entryPtr->entry.placeholderObj == NULL)) { entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), entryPtr->entry.displayString, entryPtr->entry.numChars, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } else { text = TkGetStringFromObj(entryPtr->entry.placeholderObj, &length); entryPtr->entry.textLayout = Tk_ComputeTextLayout( Tk_GetFontFromObj(entryPtr->core.tkwin, entryPtr->entry.fontObj), text, length, 0/*wraplength*/, entryPtr->entry.justify, TK_IGNORE_NEWLINES, &entryPtr->entry.layoutWidth, &entryPtr->entry.layoutHeight); } } /* EntryEditable -- * Returns 1 if the entry widget accepts user changes, 0 otherwise */ static int EntryEditable(Entry *entryPtr) |
︙ | ︙ | |||
324 325 326 327 328 329 330 | /* EntryFetchSelection -- * Selection handler for entry widgets. */ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { | | | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | /* EntryFetchSelection -- * Selection handler for entry widgets. */ static int EntryFetchSelection( ClientData clientData, int offset, char *buffer, int maxBytes) { Entry *entryPtr = clientData; int byteCount; const char *string; const char *selStart, *selEnd; if (entryPtr->entry.selectFirst < 0 || (!entryPtr->entry.exportSelection) || Tcl_IsSafe(entryPtr->core.interp)) { return -1; |
︙ | ︙ | |||
357 358 359 360 361 362 363 | /* EntryLostSelection -- * Tk_LostSelProc for Entry widgets; called when an entry * loses ownership of the selection. */ static void EntryLostSelection(ClientData clientData) { | | | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | /* EntryLostSelection -- * Tk_LostSelProc for Entry widgets; called when an entry * loses ownership of the selection. */ static void EntryLostSelection(ClientData clientData) { Entry *entryPtr = clientData; entryPtr->core.flags &= ~GOT_SELECTION; entryPtr->entry.selectFirst = entryPtr->entry.selectLast = -1; TtkRedisplayWidget(&entryPtr->core); } /* EntryOwnSelection -- * Assert ownership of the PRIMARY selection, |
︙ | ︙ | |||
553 554 555 556 557 558 559 | /* EntryValidateChange -- * Validate a proposed change to the entry widget's value if required. * Call the -invalidcommand if validation fails. * * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected | | | 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 | /* EntryValidateChange -- * Validate a proposed change to the entry widget's value if required. * Call the -invalidcommand if validation fails. * * Returns: * TCL_OK if the change is accepted * TCL_BREAK if the change is rejected * TCL_ERROR if any errors occurred * * The change will be rejected if -validatecommand returns 0, * or if -validatecommand or -invalidcommand modifies the value. */ static int EntryValidateChange( Entry *entryPtr, /* Entry that needs validation. */ |
︙ | ︙ | |||
892 893 894 895 896 897 898 | * Extra event handling for entry widgets: * Triggers validation on FocusIn and FocusOut events. */ #define EntryEventMask (FocusChangeMask) static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | * Extra event handling for entry widgets: * Triggers validation on FocusIn and FocusOut events. */ #define EntryEventMask (FocusChangeMask) static void EntryEventProc(ClientData clientData, XEvent *eventPtr) { Entry *entryPtr = clientData; Tcl_Preserve(clientData); switch (eventPtr->type) { case DestroyNotify: Tk_DeleteEventHandler(entryPtr->core.tkwin, EntryEventMask, EntryEventProc, clientData); break; |
︙ | ︙ | |||
971 972 973 974 975 976 977 | static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Entry *entryPtr = recordPtr; Tcl_Obj *textVarName = entryPtr->entry.textVariableObj; Ttk_TraceHandle *vt = 0; if (mask & TEXTVAR_CHANGED) { | | | 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | static int EntryConfigure(Tcl_Interp *interp, void *recordPtr, int mask) { Entry *entryPtr = recordPtr; Tcl_Obj *textVarName = entryPtr->entry.textVariableObj; Ttk_TraceHandle *vt = 0; if (mask & TEXTVAR_CHANGED) { if (textVarName && *Tcl_GetString(textVarName) != '\0') { vt = Ttk_TraceVariable(interp, textVarName,EntryTextVariableTrace,entryPtr); if (!vt) return TCL_ERROR; } } if (TtkCoreConfigure(interp, recordPtr, mask) != TCL_OK) { |
︙ | ︙ | |||
1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | selLast = entryPtr->entry.selectLast; EntryStyleData es; GC gc; int showSelection, showCursor; Ttk_Box textarea; TkRegion clipRegion; XRectangle rect; EntryInitStyleData(entryPtr, &es); textarea = Ttk_ClientRegion(entryPtr->core.layout, "textarea"); showCursor = (entryPtr->core.flags & CURSOR_ON) && EntryEditable(entryPtr) | > | 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 | selLast = entryPtr->entry.selectLast; EntryStyleData es; GC gc; int showSelection, showCursor; Ttk_Box textarea; TkRegion clipRegion; XRectangle rect; Tcl_Obj *foregroundObj; EntryInitStyleData(entryPtr, &es); textarea = Ttk_ClientRegion(entryPtr->core.layout, "textarea"); showCursor = (entryPtr->core.flags & CURSOR_ON) && EntryEditable(entryPtr) |
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 | XFillRectangle(Tk_Display(tkwin), d, gc, cursorX, cursorY, cursorWidth, cursorHeight); Tk_FreeGC(Tk_Display(tkwin), gc); } /* Draw the text: */ | > > > > > > > > > > > > > > | | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 | XFillRectangle(Tk_Display(tkwin), d, gc, cursorX, cursorY, cursorWidth, cursorHeight); Tk_FreeGC(Tk_Display(tkwin), gc); } /* Draw the text: */ if ((*(entryPtr->entry.displayString) == '\0') && (entryPtr->entry.placeholderObj != NULL)) { /* No text displayed, but -placeholder is given */ if (Tcl_GetCharLength(es.placeholderForegroundObj) > 0) { foregroundObj = es.placeholderForegroundObj; } else { foregroundObj = es.foregroundObj; } /* Use placeholder text width */ leftIndex = 0; Tcl_GetStringFromObj(entryPtr->entry.placeholderObj,&rightIndex); } else { foregroundObj = es.foregroundObj; } gc = EntryGetGC(entryPtr, foregroundObj, clipRegion); Tk_DrawTextLayout( Tk_Display(tkwin), d, gc, entryPtr->entry.textLayout, entryPtr->entry.layoutX, entryPtr->entry.layoutY, leftIndex, rightIndex); XSetClipMask(Tk_Display(tkwin), gc, None); Tk_FreeGC(Tk_Display(tkwin), gc); |
︙ | ︙ | |||
1317 1318 1319 1320 1321 1322 1323 | EntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ int *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ | > | < | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | EntryIndex( Tcl_Interp *interp, /* For error messages. */ Entry *entryPtr, /* Entry widget to query */ Tcl_Obj *indexObj, /* Symbolic index name */ int *indexPtr) /* Return value */ { # define EntryWidth(e) (Tk_Width(entryPtr->core.tkwin)) /* Not Right */ TkSizeT length; const char *string = TkGetStringFromObj(indexObj, &length); if (strncmp(string, "end", length) == 0) { *indexPtr = entryPtr->entry.numChars; } else if (strncmp(string, "insert", length) == 0) { *indexPtr = entryPtr->entry.insertPos; } else if (strncmp(string, "left", length) == 0) { /* for debugging */ *indexPtr = entryPtr->entry.xscroll.first; |
︙ | ︙ | |||
1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 | if (x > maxWidth) { x = maxWidth; roundUp = 1; } *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout, x - entryPtr->entry.layoutX, 0); if (*indexPtr < entryPtr->entry.xscroll.first) { *indexPtr = entryPtr->entry.xscroll.first; } /* * Special trick: if the x-position was off-screen to the right, * round the index up to refer to the character just after the | > | 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 | if (x > maxWidth) { x = maxWidth; roundUp = 1; } *indexPtr = Tk_PointToChar(entryPtr->entry.textLayout, x - entryPtr->entry.layoutX, 0); TtkUpdateScrollInfo(entryPtr->entry.xscrollHandle); if (*indexPtr < entryPtr->entry.xscroll.first) { *indexPtr = entryPtr->entry.xscroll.first; } /* * Special trick: if the x-position was off-screen to the right, * round the index up to refer to the character just after the |
︙ | ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, | | | 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 | { Entry *entryPtr = recordPtr; if (objc != 3) { Tcl_WrongNumArgs(interp, 3, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(entryPtr->entry.selectFirst >= 0)); return TCL_OK; } /* $entry selection range $start $end -- * Explicitly set the selection range. */ static int EntrySelectionRangeCommand( |
︙ | ︙ | |||
1637 1638 1639 1640 1641 1642 1643 | } code = EntryRevalidate(interp, entryPtr, VALIDATE_FORCED); if (code == TCL_ERROR) return code; | | | | 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 | } code = EntryRevalidate(interp, entryPtr, VALIDATE_FORCED); if (code == TCL_ERROR) return code; Tcl_SetObjResult(interp, Tcl_NewWideIntObj(code == TCL_OK)); return TCL_OK; } /* $entry xview -- horizontal scrolling interface */ static int EntryXViewCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Entry *entryPtr = recordPtr; if (objc == 3) { int newFirst; if (EntryIndex(interp, entryPtr, objv[2], &newFirst) != TCL_OK) { return TCL_ERROR; } TtkScrollTo(entryPtr->entry.xscrollHandle, newFirst, 1); return TCL_OK; } return TtkScrollviewCommand(interp, objc, objv, entryPtr->entry.xscrollHandle); } static const Ttk_Ensemble EntryCommands[] = { { "bbox", EntryBBoxCommand,0 }, |
︙ | ︙ | |||
1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 | EntryConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * +++ Combobox widget record. */ typedef struct { Tcl_Obj *postCommandObj; Tcl_Obj *valuesObj; Tcl_Obj *heightObj; int currentIndex; } ComboboxPart; typedef struct { WidgetCore core; EntryPart entry; ComboboxPart combobox; } Combobox; static Tk_OptionSpec ComboboxOptionSpecs[] = { {TK_OPTION_STRING, "-height", "height", "Height", | > > > > > > > > > > | | | | 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | EntryConfigure, /* configureProc */ EntryPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ EntryDoLayout, /* layoutProc */ EntryDisplay /* displayProc */ }; /*------------------------------------------------------------------------ * Named indices for the combobox "current" command */ static const char *const comboboxCurrentIndexNames[] = { "end", NULL }; enum comboboxCurrentIndices { INDEX_END }; /*------------------------------------------------------------------------ * +++ Combobox widget record. */ typedef struct { Tcl_Obj *postCommandObj; Tcl_Obj *valuesObj; Tcl_Obj *heightObj; int currentIndex; } ComboboxPart; typedef struct { WidgetCore core; EntryPart entry; ComboboxPart combobox; } Combobox; static Tk_OptionSpec ComboboxOptionSpecs[] = { {TK_OPTION_STRING, "-height", "height", "Height", DEF_LIST_HEIGHT, offsetof(Combobox, combobox.heightObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-postcommand", "postCommand", "PostCommand", "", offsetof(Combobox, combobox.postCommandObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-values", "values", "Values", "", offsetof(Combobox, combobox.valuesObj), -1, 0,0,0 }, WIDGET_INHERIT_OPTIONS(EntryOptionSpecs) }; /* ComboboxInitialize -- * Initialization hook for combobox widgets. */ |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | currentIndex = -1; } } cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex)); return TCL_OK; } else if (objc == 3) { | > > > > > > > > > > > > > > > > > > > > > > | > > > | | > | | | | | | > | 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 | currentIndex = -1; } } cbPtr->combobox.currentIndex = currentIndex; Tcl_SetObjResult(interp, Tcl_NewIntObj(currentIndex)); return TCL_OK; } else if (objc == 3) { int result, index; result = Tcl_GetIndexFromObj(NULL, objv[2], comboboxCurrentIndexNames, "", 0, &index); if (result == TCL_OK) { /* * The index is one of the named indices. */ switch (index) { case INDEX_END: /* "end" index */ currentIndex = nValues - 1; break; } } else { /* * The index should be just an integer. */ if (Tcl_GetIntFromObj(NULL, objv[2], ¤tIndex) != TCL_OK) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Incorrect index %s", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_VALUE", NULL); return TCL_ERROR; } if (currentIndex < 0 || currentIndex >= nValues) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Index %s out of range", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "COMBOBOX", "IDX_RANGE", NULL); return TCL_ERROR; } } cbPtr->combobox.currentIndex = currentIndex; return EntrySetValue(recordPtr, Tcl_GetString(values[currentIndex])); } else { Tcl_WrongNumArgs(interp, 2, objv, "?newIndex?"); return TCL_ERROR; |
︙ | ︙ | |||
1878 1879 1880 1881 1882 1883 1884 | WidgetCore core; EntryPart entry; SpinboxPart spinbox; } Spinbox; static Tk_OptionSpec SpinboxOptionSpecs[] = { {TK_OPTION_STRING, "-values", "values", "Values", | | | | | | | | | 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 | WidgetCore core; EntryPart entry; SpinboxPart spinbox; } Spinbox; static Tk_OptionSpec SpinboxOptionSpecs[] = { {TK_OPTION_STRING, "-values", "values", "Values", "", offsetof(Spinbox, spinbox.valuesObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", offsetof(Spinbox,spinbox.fromObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-to", "to", "To", "0", offsetof(Spinbox,spinbox.toObj), -1, 0,0,0 }, {TK_OPTION_DOUBLE, "-increment", "increment", "Increment", "1", offsetof(Spinbox,spinbox.incrementObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-format", "format", "Format", "", offsetof(Spinbox, spinbox.formatObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Spinbox, spinbox.commandObj), -1, 0,0,0 }, {TK_OPTION_BOOLEAN, "-wrap", "wrap", "Wrap", "0", offsetof(Spinbox,spinbox.wrapObj), -1, 0,0,0 }, WIDGET_INHERIT_OPTIONS(EntryOptionSpecs) }; /* SpinboxInitialize -- * Initialization hook for spinbox widgets. |
︙ | ︙ | |||
1980 1981 1982 1983 1984 1985 1986 | typedef struct { Tcl_Obj *fontObj; Tcl_Obj *widthObj; } TextareaElement; static Ttk_ElementOptionSpec TextareaElementOptions[] = { { "-font", TK_OPTION_FONT, | | | | 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 | typedef struct { Tcl_Obj *fontObj; Tcl_Obj *widthObj; } TextareaElement; static Ttk_ElementOptionSpec TextareaElementOptions[] = { { "-font", TK_OPTION_FONT, offsetof(TextareaElement,fontObj), DEF_ENTRY_FONT }, { "-width", TK_OPTION_INT, offsetof(TextareaElement,widthObj), "20" }, { NULL, 0, 0, NULL } }; static void TextareaElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ |
Changes to generic/ttk/ttkFrame.c.
1 2 3 4 5 6 | /* * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. */ | | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Copyright (c) 2004, Joe English * * ttk::frame and ttk::labelframe widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" /* ====================================================================== * +++ Frame widget: */ |
︙ | ︙ | |||
25 26 27 28 29 30 31 | typedef struct { WidgetCore core; FramePart frame; } Frame; static Tk_OptionSpec FrameOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, | | | | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | typedef struct { WidgetCore core; FramePart frame; } Frame; static Tk_OptionSpec FrameOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", NULL, offsetof(Frame,frame.borderWidthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Frame,frame.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Frame,frame.reliefObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_PIXELS, "-width", "width", "Width", "0", offsetof(Frame,frame.widthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-height", "height", "Height", "0", offsetof(Frame,frame.heightObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static const Ttk_Ensemble FrameCommands[] = { |
︙ | ︙ | |||
246 247 248 249 250 251 252 | LabelframePart label; } Labelframe; #define LABELWIDGET_CHANGED 0x100 static Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", | | | | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | LabelframePart label; } Labelframe; #define LABELWIDGET_CHANGED 0x100 static Tk_OptionSpec LabelframeOptionSpecs[] = { {TK_OPTION_STRING, "-labelanchor", "labelAnchor", "LabelAnchor", "nw", offsetof(Labelframe, label.labelAnchorObj),-1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Labelframe,label.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", offsetof(Labelframe,label.underlineObj), -1, 0,0,0 }, {TK_OPTION_WINDOW, "-labelwidget", "labelWidget", "LabelWidget", NULL, -1, offsetof(Labelframe,label.labelWidget), TK_OPTION_NULL_OK,0,LABELWIDGET_CHANGED|GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(FrameOptionSpecs) }; /* * Labelframe style parameters: |
︙ | ︙ |
Deleted generic/ttk/ttkGenStubs.tcl.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to generic/ttk/ttkImage.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * Image specifications and image element factory. * * Copyright (C) 2004 Pat Thoyts <[email protected]> * Copyright (C) 2004 Joe English * * An imageSpec is a multi-element list; the first element * is the name of the default image to use, the remainder of the * list is a sequence of statespec/imagename options as per * [style map]. */ | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * Image specifications and image element factory. * * Copyright (C) 2004 Pat Thoyts <[email protected]> * Copyright (C) 2004 Joe English * * An imageSpec is a multi-element list; the first element * is the name of the default image to use, the remainder of the * list is a sequence of statespec/imagename options as per * [style map]. */ #include "tkInt.h" #include "ttkTheme.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) /*------------------------------------------------------------------------ * +++ ImageSpec management. */ |
︙ | ︙ | |||
341 342 343 344 345 346 347 | Ttk_CreateImageElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { | | | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | Ttk_CreateImageElement( Tcl_Interp *interp, void *clientData, Ttk_Theme theme, const char *elementName, int objc, Tcl_Obj *const objv[]) { static const char *const optionStrings[] = { "-border","-height","-padding","-sticky","-width",NULL }; enum { O_BORDER, O_HEIGHT, O_PADDING, O_STICKY, O_WIDTH }; Ttk_ImageSpec *imageSpec = 0; ImageData *imageData = 0; int padding_specified = 0; int i; |
︙ | ︙ |
Changes to generic/ttk/ttkInit.c.
1 2 3 4 5 6 | /* * Copyright (c) 2003, Joe English * * Ttk package: initialization routine and miscellaneous utilities. */ | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Copyright (c) 2003, Joe English * * Ttk package: initialization routine and miscellaneous utilities. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /* * Legal values for the button -default option. * See also: enum Ttk_ButtonDefaultState. */ |
︙ | ︙ | |||
58 59 60 61 62 63 64 | sizeof(char *), "orientation", 0, resultPtr); } /* * Recognized values for the -state compatibility option. * Other options are accepted and interpreted as synonyms for "normal". */ | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | sizeof(char *), "orientation", 0, resultPtr); } /* * Recognized values for the -state compatibility option. * Other options are accepted and interpreted as synonyms for "normal". */ static const char *const ttkStateStrings[] = { "normal", "readonly", "disabled", "active", NULL }; enum { TTK_COMPAT_STATE_NORMAL, TTK_COMPAT_STATE_READONLY, TTK_COMPAT_STATE_DISABLED, TTK_COMPAT_STATE_ACTIVE |
︙ | ︙ | |||
175 176 177 178 179 180 181 | * type name dbName dbClass default objOffset intOffset flags clientData mask */ /* public */ Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL, | | | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | * type name dbName dbClass default objOffset intOffset flags clientData mask */ /* public */ Tk_OptionSpec ttkCoreOptionSpecs[] = { {TK_OPTION_CURSOR, "-cursor", "cursor", "Cursor", NULL, offsetof(WidgetCore, cursorObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-style", "style", "Style", "", offsetof(WidgetCore,styleObj), -1, 0,0,STYLE_CHANGED}, {TK_OPTION_STRING, "-class", "", "", NULL, offsetof(WidgetCore,classObj), -1, 0,0,READONLY_OPTION}, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0} }; /*------------------------------------------------------------------------ * +++ Initialization: elements and element factories. */ |
︙ | ︙ |
Changes to generic/ttk/ttkLabel.c.
︙ | ︙ | |||
44 45 46 47 48 49 50 | } TextElement; /* Text element options table. * NB: Keep in sync with label element option table. */ static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, | | | | | | | | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | } TextElement; /* Text element options table. * NB: Keep in sync with label element option table. */ static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(TextElement,fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(TextElement,foregroundObj), "black" }, { "-underline", TK_OPTION_INT, offsetof(TextElement,underlineObj), "-1"}, { "-width", TK_OPTION_INT, offsetof(TextElement,widthObj), "-1"}, { "-anchor", TK_OPTION_ANCHOR, offsetof(TextElement,anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, offsetof(TextElement,justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, offsetof(TextElement,wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, offsetof(TextElement,embossedObj), "0"}, { NULL, 0, 0, NULL } }; static int TextSetup(TextElement *text, Tk_Window tkwin) { const char *string = Tcl_GetString(text->textObj); Tk_Justify justify = TK_JUSTIFY_LEFT; |
︙ | ︙ | |||
134 135 136 137 138 139 140 | gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | gcValues.font = Tk_FontId(text->tkfont); gcValues.foreground = color->pixel; gc1 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); gcValues.foreground = WhitePixelOfScreen(Tk_Screen(tkwin)); gc2 = Tk_GetGC(tkwin, GCFont | GCForeground, &gcValues); /* * Place text according to -anchor: */ Tk_GetAnchorFromObj(NULL, text->anchorObj, &anchor); b = Ttk_AnchorBox(b, text->width, text->height, anchor); /* * Clip text if it's too wide: |
︙ | ︙ | |||
244 245 246 247 248 249 250 | int height; } ImageElement; /* ===> NB: Keep in sync with label element option table. <=== */ static Ttk_ElementOptionSpec ImageElementOptions[] = { { "-image", TK_OPTION_STRING, | | | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | int height; } ImageElement; /* ===> NB: Keep in sync with label element option table. <=== */ static Ttk_ElementOptionSpec ImageElementOptions[] = { { "-image", TK_OPTION_STRING, offsetof(ImageElement,imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ offsetof(ImageElement,stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(ImageElement,backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; /* * ImageSetup() -- * Look up the Tk_Image from the image element's imageObj resource. * Caller must release the image with ImageCleanup(). |
︙ | ︙ | |||
337 338 339 340 341 342 343 | /* Completely clipped - bail out. */ return; } Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); | | | | | 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | /* Completely clipped - bail out. */ return; } Tk_RedrawImage(image->tkimg, 0,0, width, height, d, b.x, b.y); /* If we're disabled there's no state-specific 'disabled' image, * stipple the image. * @@@ Possibly: Don't do disabled-stippling at all; * @@@ it's ugly and out of fashion. * Do not stipple at all under Aqua, just draw the image: it shows up * as a white rectangle otherwise. */ if (state & TTK_STATE_DISABLED) { if (TtkSelectImage(image->imageSpec, 0ul) == image->tkimg) { #ifndef MAC_OSX_TK StippleOver(image, tkwin, d, b.x,b.y); #endif } } |
︙ | ︙ | |||
438 439 440 441 442 443 444 | Ttk_Compound compound; int space; int totalWidth, totalHeight; } LabelElement; static Ttk_ElementOptionSpec LabelElementOptions[] = { { "-compound", TK_OPTION_ANY, | | | | | | | | | | | | | | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 | Ttk_Compound compound; int space; int totalWidth, totalHeight; } LabelElement; static Ttk_ElementOptionSpec LabelElementOptions[] = { { "-compound", TK_OPTION_ANY, offsetof(LabelElement,compoundObj), "none" }, { "-space", TK_OPTION_PIXELS, offsetof(LabelElement,spaceObj), "4" }, /* Text element part: * NB: Keep in sync with TextElementOptions. */ { "-text", TK_OPTION_STRING, offsetof(LabelElement,text.textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(LabelElement,text.fontObj), DEFAULT_FONT }, { "-foreground", TK_OPTION_COLOR, offsetof(LabelElement,text.foregroundObj), "black" }, { "-underline", TK_OPTION_INT, offsetof(LabelElement,text.underlineObj), "-1"}, { "-width", TK_OPTION_INT, offsetof(LabelElement,text.widthObj), ""}, { "-anchor", TK_OPTION_ANCHOR, offsetof(LabelElement,text.anchorObj), "w"}, { "-justify", TK_OPTION_JUSTIFY, offsetof(LabelElement,text.justifyObj), "left" }, { "-wraplength", TK_OPTION_PIXELS, offsetof(LabelElement,text.wrapLengthObj), "0" }, { "-embossed", TK_OPTION_INT, offsetof(LabelElement,text.embossedObj), "0"}, /* Image element part: * NB: Keep in sync with ImageElementOptions. */ { "-image", TK_OPTION_STRING, offsetof(LabelElement,image.imageObj), "" }, { "-stipple", TK_OPTION_STRING, /* Really: TK_OPTION_BITMAP */ offsetof(LabelElement,image.stippleObj), "gray50" }, { "-background", TK_OPTION_COLOR, offsetof(LabelElement,image.backgroundObj), DEFAULT_BACKGROUND }, { NULL, 0, 0, NULL } }; /* * LabelSetup -- * Fills in computed fields of the label element. * |
︙ | ︙ | |||
572 573 574 575 576 577 578 | *heightPtr = label->totalHeight; /* Requested width based on -width option, not actual text width: */ if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); | | | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 | *heightPtr = label->totalHeight; /* Requested width based on -width option, not actual text width: */ if (label->compound != TTK_COMPOUND_IMAGE) textReqWidth = TextReqWidth(&label->text); switch (label->compound) { case TTK_COMPOUND_TEXT: *widthPtr = textReqWidth; break; case TTK_COMPOUND_IMAGE: *widthPtr = label->image.width; break; case TTK_COMPOUND_TOP: case TTK_COMPOUND_BOTTOM: case TTK_COMPOUND_CENTER: *widthPtr = MAX(label->image.width, textReqWidth); break; case TTK_COMPOUND_LEFT: case TTK_COMPOUND_RIGHT: *widthPtr = label->image.width + textReqWidth + label->space; break; case TTK_COMPOUND_NONE: break; /* Can't happen */ } LabelCleanup(label); } |
︙ | ︙ |
Changes to generic/ttk/ttkLayout.c.
1 2 3 4 5 6 7 8 | /* * ttkLayout.c -- * * Generic layout processing. * * Copyright (c) 2003 Joe English. Freely redistributable. */ | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * ttkLayout.c -- * * Generic layout processing. * * Copyright (c) 2003 Joe English. Freely redistributable. */ #include "tkInt.h" #include "ttkThemeInt.h" #define MAX(a,b) (a > b ? a : b) #define MIN(a,b) (a < b ? a : b) /*------------------------------------------------------------------------ |
︙ | ︙ | |||
600 601 602 603 604 605 606 | * Convert a Tcl list into a layout template. * * Syntax: * layoutSpec ::= { elementName ?-option value ...? }+ */ /* NB: This must match bit definitions TTK_PACK_LEFT etc. */ | | | | 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 | * Convert a Tcl list into a layout template. * * Syntax: * layoutSpec ::= { elementName ?-option value ...? }+ */ /* NB: This must match bit definitions TTK_PACK_LEFT etc. */ static const char *const packSideStrings[] = { "left", "right", "top", "bottom", NULL }; Ttk_LayoutTemplate Ttk_ParseLayoutTemplate(Tcl_Interp *interp, Tcl_Obj *objPtr) { enum { OP_SIDE, OP_STICKY, OP_EXPAND, OP_BORDER, OP_UNIT, OP_CHILDREN }; static const char *const optStrings[] = { "-side", "-sticky", "-expand", "-border", "-unit", "-children", 0 }; int i = 0, objc; Tcl_Obj **objv; Ttk_TemplateNode *head = 0, *tail = 0; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) |
︙ | ︙ |
Changes to generic/ttk/ttkManager.c.
1 2 3 4 5 6 | /* * Copyright 2005, Joe English. Freely redistributable. * * Support routines for geometry managers. */ | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Copyright 2005, Joe English. Freely redistributable. * * Support routines for geometry managers. */ #include "tkInt.h" #include "ttkManager.h" /*------------------------------------------------------------------------ * +++ The Geometry Propagation Dance. * * When a slave window requests a new size or some other parameter changes, * the manager recomputes the required size for the master window and calls |
︙ | ︙ | |||
316 317 318 319 320 321 322 | { Ttk_Manager *mgr = clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( | | | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 | { Ttk_Manager *mgr = clientData; int slaveIndex = Ttk_SlaveIndex(mgr, slaveWindow); int reqWidth = Tk_ReqWidth(slaveWindow); int reqHeight= Tk_ReqHeight(slaveWindow); if (mgr->managerSpec->SlaveRequest( mgr->managerData, slaveIndex, reqWidth, reqHeight)) { ScheduleUpdate(mgr, MGR_RESIZE_REQUIRED); } } void Ttk_LostSlaveProc(ClientData clientData, Tk_Window slaveWindow) { |
︙ | ︙ |
Changes to generic/ttk/ttkManager.h.
︙ | ︙ | |||
18 19 20 21 22 23 24 | * * PlaceSlaves sets the position and size of all managed slaves * by calling Ttk_PlaceSlave(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * * PlaceSlaves sets the position and size of all managed slaves * by calling Ttk_PlaceSlave(). * * SlaveRemoved() is called immediately before a slave is removed. * NB: the associated slave window may have been destroyed when this * routine is called. * * SlaveRequest() is called when a slave requests a size change. * It should return 1 if the request should propagate, 0 otherwise. */ typedef struct { /* Manager hooks */ Tk_GeomMgr tkGeomMgr; /* "real" Tk Geometry Manager */ int (*RequestedSize)(void *managerData, int *widthPtr, int *heightPtr); |
︙ | ︙ |
Changes to generic/ttk/ttkNotebook.c.
1 2 3 4 | /* * Copyright (c) 2004, Joe English */ | < < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * Copyright (c) 2004, Joe English */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #include "ttkManager.h" #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
︙ | ︙ | |||
58 59 60 61 62 63 64 | * * PaneOptionSpecs includes additional options for child window placement * and is used to configure the slave. */ static Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", | | | | | | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | * * PaneOptionSpecs includes additional options for child window placement * and is used to configure the slave. */ static Tk_OptionSpec TabOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-state", "", "", "normal", -1, offsetof(Tab,state), 0,(ClientData)TabStateStrings,0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Tab,textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-image", "image", "Image", NULL/*default*/, offsetof(Tab,imageObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-compound", "compound", "Compound", "none", offsetof(Tab,compoundObj), -1, 0,(ClientData)ttkCompoundStrings,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-underline", "underline", "Underline", "-1", offsetof(Tab,underlineObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, NULL, NULL, NULL, NULL, 0, 0, 0, 0, 0 } }; static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_STRING, "-padding", "padding", "Padding", "0", offsetof(Tab,paddingObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-sticky", "sticky", "Sticky", "nsew", offsetof(Tab,stickyObj), -1, 0,0,GEOMETRY_CHANGED }, WIDGET_INHERIT_OPTIONS(TabOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Notebook resources. */ |
︙ | ︙ | |||
110 111 112 113 114 115 116 | WidgetCore core; NotebookPart notebook; } Notebook; static Tk_OptionSpec NotebookOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", "0", | | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | WidgetCore core; NotebookPart notebook; } Notebook; static Tk_OptionSpec NotebookOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", "0", offsetof(Notebook,notebook.widthObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", offsetof(Notebook,notebook.heightObj),-1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-padding", "padding", "Padding", NULL, offsetof(Notebook,notebook.paddingObj),-1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* Notebook style options: |
︙ | ︙ | |||
217 218 219 220 221 222 223 | int objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; Ttk_Padding padding = tab->padding; Tk_SavedOptions savedOptions; int mask = 0; | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | int objc, Tcl_Obj *const objv[]) { Ttk_Sticky sticky = tab->sticky; Ttk_Padding padding = tab->padding; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, tab, nb->notebook.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Check options: * @@@ TODO: validate -image option. |
︙ | ︙ | |||
1049 1050 1051 1052 1053 1054 1055 | /* $nb identify $x $y -- * Returns name of tab element at $x,$y; empty string if none. */ static int NotebookIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { | | | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 | /* $nb identify $x $y -- * Returns name of tab element at $x,$y; empty string if none. */ static int NotebookIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const whatTable[] = { "element", "tab", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_TAB }; int what = IDENTIFY_ELEMENT; Notebook *nb = recordPtr; Ttk_Element element = NULL; int x, y, tabIndex; if (objc < 4 || objc > 5) { |
︙ | ︙ |
Changes to generic/ttk/ttkPanedwindow.c.
1 2 3 4 5 6 7 8 | /* * Copyright (c) 2005, Joe English. Freely redistributable. * * ttk::panedwindow widget implementation. * * TODO: track active/pressed sash. */ | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | /* * Copyright (c) 2005, Joe English. Freely redistributable. * * ttk::panedwindow widget implementation. * * TODO: track active/pressed sash. */ #include "tkInt.h" #include "ttkManager.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Layout algorithm. * |
︙ | ︙ | |||
73 74 75 76 77 78 79 | PanedPart paned; } Paned; /* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI */ static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", | | | | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | PanedPart paned; } Paned; /* @@@ NOTE: -orient is readonly 'cause dynamic oriention changes NYI */ static Tk_OptionSpec PanedOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Paned,paned.orientObj), offsetof(Paned,paned.orient), 0,(ClientData)ttkOrientStrings,READONLY_OPTION|STYLE_CHANGED }, {TK_OPTION_INT, "-width", "width", "Width", "0", -1, offsetof(Paned,paned.width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-height", "height", "Height", "0", -1, offsetof(Paned,paned.height), 0,0,GEOMETRY_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Slave pane record. */ typedef struct { int reqSize; /* Pane request size */ int sashPos; /* Folowing sash position */ int weight; /* Pane -weight, for resizing */ } Pane; static Tk_OptionSpec PaneOptionSpecs[] = { {TK_OPTION_INT, "-weight", "weight", "Weight", "0", -1, offsetof(Pane,weight), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /* CreatePane -- * Create a new pane record. */ static Pane *CreatePane(Tcl_Interp *interp, Paned *pw, Tk_Window slaveWindow) |
︙ | ︙ | |||
144 145 146 147 148 149 150 | Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, int objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; Tk_SavedOptions savedOptions; int mask = 0; | | | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | Tcl_Interp *interp, Paned *pw, Pane *pane, Tk_Window slaveWindow, int objc, Tcl_Obj *const objv[]) { Ttk_Manager *mgr = pw->paned.mgr; Tk_SavedOptions savedOptions; int mask = 0; if (Tk_SetOptions(interp, pane, pw->paned.paneOptionTable, objc, objv, slaveWindow, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Sanity-check: */ |
︙ | ︙ | |||
711 712 713 714 715 716 717 | /* $pw identify ?what? $x $y -- * Return index of sash at $x,$y */ static int PanedIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { | | | 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | /* $pw identify ?what? $x $y -- * Return index of sash at $x,$y */ static int PanedIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const whatTable[] = { "element", "sash", NULL }; enum { IDENTIFY_ELEMENT, IDENTIFY_SASH }; int what = IDENTIFY_SASH; Paned *pw = recordPtr; int sashThickness = pw->paned.sashThickness; int nSashes = Ttk_NumberSlaves(pw->paned.mgr) - 1; int x, y, pos; int index; |
︙ | ︙ | |||
919 920 921 922 923 924 925 | typedef struct { Tcl_Obj *thicknessObj; } SashElement; static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, | | | 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 | typedef struct { Tcl_Obj *thicknessObj; } SashElement; static Ttk_ElementOptionSpec SashElementOptions[] = { { "-sashthickness", TK_OPTION_INT, offsetof(SashElement,thicknessObj), "5" }, { NULL, 0, 0, NULL } }; static void SashElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ |
Changes to generic/ttk/ttkProgress.c.
1 2 3 4 5 6 | /* * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * * ttk::progressbar widget. */ | < | < > | > > > > | | | > > > > > > > > > | > | | | > > > | | > > > | | | | < > | | | | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /* * Copyright (c) Joe English, Pat Thoyts, Michael Kirkham * * ttk::progressbar widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Widget record: */ #define DEF_PROGRESSBAR_LENGTH "100" enum { TTK_PROGRESSBAR_DETERMINATE, TTK_PROGRESSBAR_INDETERMINATE }; static const char *const ProgressbarModeStrings[] = { "determinate", "indeterminate", NULL }; typedef struct { Tcl_Obj *anchorObj; Tcl_Obj *fontObj; Tcl_Obj *foregroundObj; Tcl_Obj *justifyObj; Tcl_Obj *lengthObj; Tcl_Obj *maximumObj; Tcl_Obj *modeObj; Tcl_Obj *orientObj; Tcl_Obj *phaseObj; Tcl_Obj *textObj; Tcl_Obj *valueObj; Tcl_Obj *variableObj; Tcl_Obj *wrapLengthObj; int mode; Ttk_TraceHandle *variableTrace; /* Trace handle for -variable option */ int period; /* Animation period */ int maxPhase; /* Max animation phase */ Tcl_TimerToken timer; /* Animation timer */ } ProgressbarPart; typedef struct { WidgetCore core; ProgressbarPart progress; } Progressbar; static Tk_OptionSpec ProgressbarOptionSpecs[] = { {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", offsetof(Progressbar,progress.anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, {TK_OPTION_FONT, "-font", "font", "Font", DEFAULT_FONT, offsetof(Progressbar,progress.fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", "black", offsetof(Progressbar,progress.foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_JUSTIFY, "-justify", "justify", "Justify", "left", offsetof(Progressbar,progress.justifyObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_PROGRESSBAR_LENGTH, offsetof(Progressbar,progress.lengthObj), -1, 0, 0, GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-maximum", "maximum", "Maximum", "100", offsetof(Progressbar,progress.maximumObj), -1, 0, 0, 0 }, {TK_OPTION_STRING_TABLE, "-mode", "mode", "ProgressMode", "determinate", offsetof(Progressbar,progress.modeObj), offsetof(Progressbar,progress.mode), 0, (ClientData)ProgressbarModeStrings, 0 }, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Progressbar,progress.orientObj), -1, 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_INT, "-phase", "phase", "Phase", "0", offsetof(Progressbar,progress.phaseObj), -1, 0, 0, 0 }, {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(Progressbar,progress.textObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0.0", offsetof(Progressbar,progress.valueObj), -1, 0, 0, 0 }, {TK_OPTION_STRING, "-variable", "variable", "Variable", NULL, offsetof(Progressbar,progress.variableObj), -1, TK_OPTION_NULL_OK, 0, 0 }, {TK_OPTION_PIXELS, "-wraplength", "wrapLength", "WrapLength", "0", offsetof(Progressbar, progress.wrapLengthObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED}, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Animation procedures: |
︙ | ︙ | |||
133 134 135 136 137 138 139 | * If animation is disabled but scheduled, cancel it. */ static void CheckAnimation(Progressbar *pb) { if (AnimationEnabled(pb)) { if (pb->progress.timer == 0) { pb->progress.timer = Tcl_CreateTimerHandler( | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | * If animation is disabled but scheduled, cancel it. */ static void CheckAnimation(Progressbar *pb) { if (AnimationEnabled(pb)) { if (pb->progress.timer == 0) { pb->progress.timer = Tcl_CreateTimerHandler( pb->progress.period, AnimateProgressProc, pb); } } else { if (pb->progress.timer != 0) { Tcl_DeleteTimerHandler(pb->progress.timer); pb->progress.timer = 0; } } |
︙ | ︙ | |||
394 395 396 397 398 399 400 | /* $sb step ?amount? */ static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | /* $sb step ?amount? */ static int ProgressbarStepCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Progressbar *pb = recordPtr; double value = 0.0, stepAmount = 1.0; Tcl_Obj *newValueObj; if (objc == 3) { if (Tcl_GetDoubleFromObj(interp, objv[2], &stepAmount) != TCL_OK) { return TCL_ERROR; } } else if (objc != 2) { Tcl_WrongNumArgs(interp, 2,objv, "?stepAmount?"); |
︙ | ︙ | |||
421 422 423 424 425 426 427 | } newValueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(newValueObj); TtkRedisplayWidget(&pb->core); | | | | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | } newValueObj = Tcl_NewDoubleObj(value); Tcl_IncrRefCount(newValueObj); TtkRedisplayWidget(&pb->core); /* Update value by setting the linked -variable, if there is one: */ if (pb->progress.variableTrace) { int result = Tcl_ObjSetVar2( interp, pb->progress.variableObj, 0, newValueObj, TCL_GLOBAL_ONLY | TCL_LEAVE_ERR_MSG) ? TCL_OK : TCL_ERROR; Tcl_DecrRefCount(newValueObj); return result; } /* Otherwise, change the -value directly: */ Tcl_DecrRefCount(pb->progress.valueObj); pb->progress.valueObj = newValueObj; CheckAnimation(pb); return TCL_OK; } /* $sb start|stop ?args? -- * Change [$sb $cmd ...] to [ttk::progressbar::$cmd ...] * and pass to interpreter. */ static int ProgressbarStartStopCommand( Tcl_Interp *interp, const char *cmdName, int objc, Tcl_Obj *const objv[]) { Tcl_Obj *cmd = Tcl_NewListObj(objc, objv); Tcl_Obj *prefix[2]; |
︙ | ︙ | |||
520 521 522 523 524 525 526 | TTK_BEGIN_LAYOUT(VerticalProgressbarLayout) TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout) TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH, | | > | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | TTK_BEGIN_LAYOUT(VerticalProgressbarLayout) TTK_GROUP("Vertical.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Vertical.Progressbar.pbar", TTK_PACK_BOTTOM|TTK_FILL_X)) TTK_END_LAYOUT TTK_BEGIN_LAYOUT(HorizontalProgressbarLayout) TTK_GROUP("Horizontal.Progressbar.trough", TTK_FILL_BOTH, TTK_NODE("Horizontal.Progressbar.pbar", TTK_PACK_LEFT|TTK_FILL_Y) TTK_NODE("Horizontal.Progressbar.text", TTK_PACK_LEFT)) TTK_END_LAYOUT /* * Initialization: */ MODULE_SCOPE |
︙ | ︙ |
Changes to generic/ttk/ttkScale.c.
1 2 3 4 5 6 | /* * Copyright (C) 2004 Pat Thoyts <[email protected]> * * ttk::scale widget. */ | | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Copyright (C) 2004 Pat Thoyts <[email protected]> * * ttk::scale widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #define DEF_SCALE_LENGTH "100" #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
︙ | ︙ | |||
51 52 53 54 55 56 57 | WidgetCore core; ScalePart scale; } Scale; static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", | | | | | | | | | | | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | WidgetCore core; ScalePart scale; } Scale; static Tk_OptionSpec ScaleOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Scale,scale.commandObj), -1, TK_OPTION_NULL_OK,0,0}, {TK_OPTION_STRING, "-variable", "variable", "Variable", "", offsetof(Scale,scale.variableObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Scale,scale.orientObj), offsetof(Scale,scale.orient), 0, (ClientData)ttkOrientStrings, STYLE_CHANGED }, {TK_OPTION_DOUBLE, "-from", "from", "From", "0", offsetof(Scale,scale.fromObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-to", "to", "To", "1.0", offsetof(Scale,scale.toObj), -1, 0, 0, 0}, {TK_OPTION_DOUBLE, "-value", "value", "Value", "0", offsetof(Scale,scale.valueObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-length", "length", "Length", DEF_SCALE_LENGTH, offsetof(Scale,scale.lengthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-state", "state", "State", "normal", offsetof(Scale,scale.stateObj), -1, 0,0,STATE_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; static XPoint ValueToPoint(Scale *scalePtr, double value); static double PointToValue(Scale *scalePtr, int x, int y); /* ScaleVariableChanged -- * Variable trace procedure for scale -variable; * Updates the scale's value. * If the linked variable is not a valid double, * sets the 'invalid' state. */ static void ScaleVariableChanged(void *recordPtr, const char *value) { Scale *scale = recordPtr; double v; |
︙ | ︙ | |||
185 186 187 188 189 190 191 | return status; } /* ScaleGetLayout -- * getLayout hook. */ | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | return status; } /* ScaleGetLayout -- * getLayout hook. */ static Ttk_Layout ScaleGetLayout(Tcl_Interp *interp, Ttk_Theme theme, void *recordPtr) { Scale *scalePtr = recordPtr; return TtkWidgetGetOrientedLayout( interp, theme, recordPtr, scalePtr->scale.orientObj); } |
︙ | ︙ | |||
249 250 251 252 253 254 255 | fraction = (value - from) / (to - from); return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; } /* $scale get ?x y? -- | | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | fraction = (value - from) / (to - from); return fraction < 0 ? 0 : fraction > 1 ? 1 : fraction; } /* $scale get ?x y? -- * Returns the current value of the scale widget, or if $x and * $y are specified, the value represented by point @x,y. */ static int ScaleGetCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Scale *scalePtr = recordPtr; |
︙ | ︙ |
Changes to generic/ttk/ttkScroll.c.
︙ | ︙ | |||
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | * -yscrollcommand has changed). */ void TtkScrollbarUpdateRequired(ScrollHandle h) { h->flags |= SCROLL_UPDATE_REQUIRED; } /* TtkScrollviewCommand -- * Widget [xy]view command implementation. * * $w [xy]view -- return current view region * $w [xy]view $index -- set topmost item * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; | > > > > > > > > > > > > > > > > | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | * -yscrollcommand has changed). */ void TtkScrollbarUpdateRequired(ScrollHandle h) { h->flags |= SCROLL_UPDATE_REQUIRED; } /* TtkUpdateScrollInfo -- * Call the layoutProc to update the scroll info first, last, and total. * Do it only if needed, that is when a redisplay is pending (which * indicates scroll info are possibly out of date). */ void TtkUpdateScrollInfo(ScrollHandle h) { if (h->corePtr->flags & REDISPLAY_PENDING) { h->corePtr->widgetSpec->layoutProc(h->corePtr); } } /* TtkScrollviewCommand -- * Widget [xy]view command implementation. * * $w [xy]view -- return current view region * $w [xy]view $index -- set topmost item * $w [xy]view moveto $fraction * $w [xy]view scroll $number $what -- scrollbar interface */ int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle h) { Scrollable *s = h->scrollPtr; int newFirst; TtkUpdateScrollInfo(h); newFirst = s->first; if (objc == 2) { Tcl_Obj *result[2]; result[0] = Tcl_NewDoubleObj((double)s->first / s->total); result[1] = Tcl_NewDoubleObj((double)s->last / s->total); Tcl_SetObjResult(interp, Tcl_NewListObj(2, result)); return TCL_OK; |
︙ | ︙ | |||
222 223 224 225 226 227 228 | int perPage = s->last - s->first; /* @@@ */ newFirst = s->first + count * perPage; break; } } } | | | > > > > | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | int perPage = s->last - s->first; /* @@@ */ newFirst = s->first + count * perPage; break; } } } TtkScrollTo(h, newFirst, 0); return TCL_OK; } void TtkScrollTo(ScrollHandle h, int newFirst, int updateScrollInfo) { Scrollable *s = h->scrollPtr; if (updateScrollInfo) { TtkUpdateScrollInfo(h); } if (newFirst >= s->total) newFirst = s->total - 1; if (newFirst > s->first && s->last >= s->total) /* don't scroll past end */ newFirst = s->first; if (newFirst < 0) newFirst = 0; |
︙ | ︙ |
Changes to generic/ttk/ttkScrollbar.c.
1 2 3 4 5 6 | /* * Copyright (c) 2003, Joe English * * ttk::scrollbar widget. */ | | < | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /* * Copyright (c) 2003, Joe English * * ttk::scrollbar widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Scrollbar widget record. */ typedef struct { Tcl_Obj *commandObj; int orient; Tcl_Obj *orientObj; double first; /* top fraction */ double last; /* bottom fraction */ Ttk_Box troughBox; /* trough parcel */ int minSize; /* minimum size of thumb */ } ScrollbarPart; typedef struct { WidgetCore core; ScrollbarPart scrollbar; } Scrollbar; static Tk_OptionSpec ScrollbarOptionSpecs[] = { {TK_OPTION_STRING, "-command", "command", "Command", "", offsetof(Scrollbar,scrollbar.commandObj), -1, 0,0,0}, {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "vertical", offsetof(Scrollbar,scrollbar.orientObj), offsetof(Scrollbar,scrollbar.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ * +++ Widget hooks. */ static void ScrollbarInitialize(Tcl_Interp *interp, void *recordPtr) { Scrollbar *sb = recordPtr; sb->scrollbar.first = 0.0; sb->scrollbar.last = 1.0; TtkTrackElementState(&sb->core); |
︙ | ︙ | |||
237 238 239 240 241 242 243 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta)); return TCL_OK; } /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | Tcl_SetObjResult(interp, Tcl_NewDoubleObj(delta)); return TCL_OK; } /* $sb fraction $x $y -- * Returns a real number between 0 and 1 indicating where the * point given by x and y lies in the trough area of the scrollbar. */ static int ScrollbarFractionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Scrollbar *sb = recordPtr; Ttk_Box b = sb->scrollbar.troughBox; |
︙ | ︙ |
Changes to generic/ttk/ttkSeparator.c.
1 2 3 4 5 6 | /* * Copyright (c) 2004, Joe English * * ttk::separator and ttk::sizegrip widgets. */ | | < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* * Copyright (c) 2004, Joe English * * ttk::separator and ttk::sizegrip widgets. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /* +++ Separator widget record: */ typedef struct { Tcl_Obj *orientObj; int orient; } SeparatorPart; typedef struct { WidgetCore core; SeparatorPart separator; } Separator; static Tk_OptionSpec SeparatorOptionSpecs[] = { {TK_OPTION_STRING_TABLE, "-orient", "orient", "Orient", "horizontal", offsetof(Separator,separator.orientObj), offsetof(Separator,separator.orient), 0,(ClientData)ttkOrientStrings,STYLE_CHANGED }, WIDGET_TAKEFOCUS_FALSE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* |
︙ | ︙ |
Changes to generic/ttk/ttkSquare.c.
1 2 3 4 5 | /* square.c - Copyright (C) 2004 Pat Thoyts <[email protected]> * * Minimal sample ttk widget. */ | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* square.c - Copyright (C) 2004 Pat Thoyts <[email protected]> * * Minimal sample ttk widget. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #if defined(TTK_SQUARE_WIDGET) || 1 #ifndef DEFAULT_BORDERWIDTH #define DEFAULT_BORDERWIDTH "2" |
︙ | ︙ | |||
47 48 49 50 51 52 53 | * default values. At the bottom we bring in the standard widget option * defined for all widgets. */ static Tk_OptionSpec SquareOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", | | | | | | | | | | | | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | * default values. At the bottom we bring in the standard widget option * defined for all widgets. */ static Tk_OptionSpec SquareOptionSpecs[] = { {TK_OPTION_PIXELS, "-borderwidth", "borderWidth", "BorderWidth", DEFAULT_BORDERWIDTH, offsetof(Square,square.borderWidthObj), -1, 0,0,GEOMETRY_CHANGED }, {TK_OPTION_BORDER, "-foreground", "foreground", "Foreground", DEFAULT_BACKGROUND, offsetof(Square,square.foregroundObj), -1, 0, 0, 0}, {TK_OPTION_PIXELS, "-width", "width", "Width", "50", offsetof(Square,square.widthObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_PIXELS, "-height", "height", "Height", "50", offsetof(Square,square.heightObj), -1, 0, 0, GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Square,square.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_RELIEF, "-relief", "relief", "Relief", NULL, offsetof(Square,square.reliefObj), -1, TK_OPTION_NULL_OK, 0, 0}, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, offsetof(Square,square.anchorObj), -1, TK_OPTION_NULL_OK, 0, 0}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /* * Almost all of the widget functionality is handled by the default Ttk * widget code and the contained element. The one thing that we must handle |
︙ | ︙ | |||
134 135 136 137 138 139 140 | { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { 0,0,0 } }; /* | | | | | | | | | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | { "identify", TtkWidgetIdentifyCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "state", TtkWidgetStateCommand,0 }, { 0,0,0 } }; /* * The Widget specification structure holds all the implementation * information about this widget and this is what must be registered * with Tk in the package initialization code (see bottom). */ static WidgetSpec SquareWidgetSpec = { "TSquare", /* className */ sizeof(Square), /* recordSize */ SquareOptionSpecs, /* optionSpecs */ SquareCommands, /* subcommands */ TtkNullInitialize, /* initializeProc */ TtkNullCleanup, /* cleanupProc */ TtkCoreConfigure, /* configureProc */ TtkNullPostConfigure, /* postConfigureProc */ TtkWidgetGetLayout, /* getLayoutProc */ TtkWidgetSize, /* sizeProc */ SquareDoLayout, /* layoutProc */ TtkWidgetDisplay /* displayProc */ }; /* ---------------------------------------------------------------------- * Square element * * In this section we demonstrate what is required to create a new themed * element. */ typedef struct { Tcl_Obj *borderObj; Tcl_Obj *foregroundObj; Tcl_Obj *borderWidthObj; Tcl_Obj *reliefObj; Tcl_Obj *widthObj; Tcl_Obj *heightObj; } SquareElement; static Ttk_ElementOptionSpec SquareElementOptions[] = { { "-background", TK_OPTION_BORDER, offsetof(SquareElement,borderObj), DEFAULT_BACKGROUND }, { "-foreground", TK_OPTION_BORDER, offsetof(SquareElement,foregroundObj), DEFAULT_BACKGROUND }, { "-borderwidth", TK_OPTION_PIXELS, offsetof(SquareElement,borderWidthObj), DEFAULT_BORDERWIDTH }, { "-relief", TK_OPTION_RELIEF, offsetof(SquareElement,reliefObj), "raised" }, { "-width", TK_OPTION_PIXELS, offsetof(SquareElement,widthObj), "20"}, { "-height", TK_OPTION_PIXELS, offsetof(SquareElement,heightObj), "20"}, { NULL, 0, 0, NULL } }; /* * The element geometry function is called when the layout code wishes to * find out how big this element wants to be. We must return our preferred * size and padding information |
︙ | ︙ | |||
244 245 246 247 248 249 250 | * Layout section. * * Every widget class needs a layout style that specifies which elements * are part of the widget and how they should be placed. The element layout * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will | | | | | 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | * Layout section. * * Every widget class needs a layout style that specifies which elements * are part of the widget and how they should be placed. The element layout * engine is similar to the Tk pack geometry manager. Read the documentation * for the details. In this example we just need to have the square element * that has been defined for this widget placed on a background. We will * also need some padding to keep it away from the edges. */ TTK_BEGIN_LAYOUT(SquareLayout) TTK_NODE("Square.background", TTK_FILL_BOTH) TTK_GROUP("Square.padding", TTK_FILL_BOTH, TTK_NODE("Square.square", 0)) TTK_END_LAYOUT /* ---------------------------------------------------------------------- * * Widget initialization. * * This file defines a new element and a new widget. We need to register * the element with the themes that will need it. In this case we will * register with the default theme that is the root of the theme inheritance * tree. This means all themes will find this element. * We then need to register the widget class style. This is the layout * specification. If a different theme requires an alternative layout, we * could register that here. For instance, in some themes the scrollbars have * one uparrow, in other themes there are two uparrow elements. * Finally we register the widget itself. This step creates a tcl command so |
︙ | ︙ | |||
283 284 285 286 287 288 289 | /* public */ MODULE_SCOPE int TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); | | | | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | /* public */ MODULE_SCOPE int TtkSquareWidget_Init(Tcl_Interp *interp) { Ttk_Theme theme = Ttk_GetDefaultTheme(interp); /* register the new elements for this theme engine */ Ttk_RegisterElement(interp, theme, "square", &SquareElementSpec, NULL); /* register the layout for this theme */ Ttk_RegisterLayout(theme, "TSquare", SquareLayout); /* register the widget */ RegisterWidget(interp, "ttk::square", &SquareWidgetSpec); return TCL_OK; } #endif /* TTK_SQUARE_WIDGET */ |
Changes to generic/ttk/ttkState.c.
1 2 3 4 5 6 7 | /* * Tk widget state utilities. * * Copyright (c) 2003 Joe English. Freely redistributable. * */ | < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* * Tk widget state utilities. * * Copyright (c) 2003 Joe English. Freely redistributable. * */ #include "tkInt.h" #include "ttkTheme.h" /* * Table of state names. Must be kept in sync with TTK_STATE_* * #defines in ttkTheme.h. */ static const char *const stateNames[] = |
︙ | ︙ |
Changes to generic/ttk/ttkStubLib.c.
︙ | ︙ | |||
63 64 65 66 67 68 69 | error: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", | | | 63 64 65 66 67 68 69 70 71 72 73 74 | error: Tcl_ResetResult(interp); Tcl_AppendResult(interp, "Error loading ", packageName, " package", " (requested version '", version, "', loaded version '", actualVersion, "'): ", errMsg, NULL); return NULL; } |
Changes to generic/ttk/ttkTagSet.c.
1 2 3 4 5 6 | /* * Tag tables. 3/4-baked, work in progress. * * Copyright (C) 2005, Joe English. Freely redistributable. */ | < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | /* * Tag tables. 3/4-baked, work in progress. * * Copyright (C) 2005, Joe English. Freely redistributable. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" /*------------------------------------------------------------------------ * +++ Internal data structures. */ struct TtkTag { |
︙ | ︙ | |||
184 185 186 187 188 189 190 | { int i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; } } | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | { int i; for (i = 0; i < tagset->nTags; ++i) { if (tagset->tags[i] == tag) { return 0; } } tagset->tags = ckrealloc(tagset->tags, (tagset->nTags+1)*sizeof(tagset->tags[0])); tagset->tags[tagset->nTags++] = tag; return 1; } /* Ttk_TagSetRemove -- remove a tag from a tag set. * |
︙ | ︙ |
Changes to generic/ttk/ttkTheme.c.
︙ | ︙ | |||
145 146 147 148 149 150 151 | const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable); if (!optionSpec) return 0; /* Make sure widget option has a Tcl_Obj* entry: */ | | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | const Tk_OptionSpec *optionSpec = TkGetOptionSpec(optionName, optionTable); if (!optionSpec) return 0; /* Make sure widget option has a Tcl_Obj* entry: */ if (optionSpec->objOffset == TCL_AUTO_LENGTH) { return 0; } /* Grrr. Ignore accidental mismatches caused by prefix-matching: */ if (strcmp(optionSpec->optionName, optionName)) { return 0; |
︙ | ︙ | |||
974 975 976 977 978 979 980 | * Tcl_Obj * reference counts are _NOT_ adjusted. */ static int InitializeElementRecord( Ttk_ElementClass *eclass, /* Element instance to initialize */ Ttk_Style style, /* Style table */ | | | | | | 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | * Tcl_Obj * reference counts are _NOT_ adjusted. */ static int InitializeElementRecord( Ttk_ElementClass *eclass, /* Element instance to initialize */ Ttk_Style style, /* Style table */ void *widgetRecord, /* Source of widget option values */ Tk_OptionTable optionTable, /* Option table describing widget record */ Tk_Window tkwin, /* Corresponding window */ Ttk_State state) /* Widget or element state */ { void *elementRecord = eclass->elementRecord; OptionMap optionMap = GetOptionMap(eclass,optionTable); int nResources = eclass->nResources; Ttk_ResourceCache cache = style->cache; Ttk_ElementOptionSpec *elementOption = eclass->specPtr->options; int i; for (i=0; i<nResources; ++i, ++elementOption) { Tcl_Obj **dest = (Tcl_Obj **) ((char *)elementRecord + elementOption->offset); const char *optionName = elementOption->optionName; Tcl_Obj *dynamicSetting = Ttk_StyleMap(style, optionName, state); Tcl_Obj *widgetValue = 0; Tcl_Obj *elementDefault = eclass->defaultValues[i]; if (optionMap[i]) { widgetValue = *(Tcl_Obj **) ((char *)widgetRecord + optionMap[i]->objOffset); } if (widgetValue) { *dest = widgetValue; } else if (dynamicSetting) { *dest = dynamicSetting; } else { |
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | * Compute the requested size of the given element. */ void Ttk_ElementSize( Ttk_ElementClass *eclass, /* Element to query */ Ttk_Style style, /* Style settings */ | | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | * Compute the requested size of the given element. */ void Ttk_ElementSize( Ttk_ElementClass *eclass, /* Element to query */ Ttk_Style style, /* Style settings */ void *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of widget record */ Tk_Window tkwin, /* The widget window. */ Ttk_State state, /* Current widget state */ int *widthPtr, /* Requested width */ int *heightPtr, /* Reqested height */ Ttk_Padding *paddingPtr) /* Requested inner border */ { |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 | * Draw the given widget element in a given drawable area. */ void Ttk_DrawElement( Ttk_ElementClass *eclass, /* Element instance */ Ttk_Style style, /* Style settings */ | | | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | * Draw the given widget element in a given drawable area. */ void Ttk_DrawElement( Ttk_ElementClass *eclass, /* Element instance */ Ttk_Style style, /* Style settings */ void *recordPtr, /* The widget record. */ Tk_OptionTable optionTable, /* Description of option table */ Tk_Window tkwin, /* The widget window. */ Drawable d, /* Where to draw element. */ Ttk_Box b, /* Element area */ Ttk_State state) /* Widget or element state flags. */ { if (b.width <= 0 || b.height <= 0) |
︙ | ︙ | |||
1378 1379 1380 1381 1382 1383 1384 | /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; | | | 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | /* + style theme create name ?-parent $theme? ?-settings { script }? */ static int StyleThemeCreateCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { StylePackageData *pkgPtr = clientData; static const char *const optStrings[] = { "-parent", "-settings", NULL }; enum { OP_PARENT, OP_SETTINGS }; Ttk_Theme parentTheme = pkgPtr->defaultTheme, newTheme; Tcl_Obj *settingsScript = NULL; const char *themeName; int i; |
︙ | ︙ |
Changes to generic/ttk/ttkTheme.h.
︙ | ︙ | |||
25 26 27 28 29 30 31 32 33 | #define TTK_VERSION TK_VERSION #define TTK_PATCH_LEVEL TK_PATCH_LEVEL /*------------------------------------------------------------------------ * +++ Defaults for element option specifications. */ #define DEFAULT_FONT "TkDefaultFont" #define DEFAULT_BACKGROUND "#d9d9d9" #define DEFAULT_FOREGROUND "black" | > > > > | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #define TTK_VERSION TK_VERSION #define TTK_PATCH_LEVEL TK_PATCH_LEVEL /*------------------------------------------------------------------------ * +++ Defaults for element option specifications. */ #define DEFAULT_FONT "TkDefaultFont" #ifdef MAC_OSX_TK #define DEFAULT_BACKGROUND "systemTextBackgroundColor" #define DEFAULT_FOREGROUND "systemTextColor" #else #define DEFAULT_BACKGROUND "#d9d9d9" #define DEFAULT_FOREGROUND "black" #endif /*------------------------------------------------------------------------ * +++ Widget states. * Keep in sync with stateNames[] in tkstate.c. */ typedef unsigned int Ttk_State; |
︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 | enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 }; typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*); typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); typedef struct Ttk_ElementOptionSpec { const char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ | > > > > > > > > | | 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | enum TTKStyleVersion2 { TK_STYLE_VERSION_2 = 2 }; typedef void (Ttk_ElementSizeProc)(void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding*); typedef void (Ttk_ElementDrawProc)(void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); #ifndef TkSizeT # if TCL_MAJOR_VERSION > 8 # define TkSizeT size_t # else # define TkSizeT int # endif #endif typedef struct Ttk_ElementOptionSpec { const char *optionName; /* Command-line name of the widget option */ Tk_OptionType type; /* Accepted option types */ TkSizeT offset; /* Offset of Tcl_Obj* field in element record */ const char *defaultValue; /* Default value to used if resource missing */ } Ttk_ElementOptionSpec; #define TK_OPTION_ANY TK_OPTION_STRING typedef struct Ttk_ElementSpec { enum TTKStyleVersion2 version; /* Version of the style support. */ |
︙ | ︙ |
Changes to generic/ttk/ttkThemeInt.h.
︙ | ︙ | |||
11 12 13 14 15 16 17 | typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate; MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name); MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *); MODULE_SCOPE void Ttk_ElementSize( | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | typedef struct Ttk_TemplateNode_ Ttk_TemplateNode, *Ttk_LayoutTemplate; MODULE_SCOPE Ttk_ElementClass *Ttk_GetElement(Ttk_Theme, const char *name); MODULE_SCOPE const char *Ttk_ElementClassName(Ttk_ElementClass *); MODULE_SCOPE void Ttk_ElementSize( Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable, Tk_Window tkwin, Ttk_State state, int *widthPtr, int *heightPtr, Ttk_Padding*); MODULE_SCOPE void Ttk_DrawElement( Ttk_ElementClass *, Ttk_Style, void *recordPtr, Tk_OptionTable, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state); MODULE_SCOPE Tcl_Obj *Ttk_QueryStyle( Ttk_Style, void *, Tk_OptionTable, const char *, Ttk_State state); MODULE_SCOPE Ttk_LayoutTemplate Ttk_ParseLayoutTemplate( Tcl_Interp *, Tcl_Obj *); |
︙ | ︙ |
Changes to generic/ttk/ttkTrace.c.
1 2 3 4 5 | /* * Copyright 2003, Joe English * * Simplified interface to Tcl_TraceVariable. * | | | | | < < < | < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /* * Copyright 2003, Joe English * * Simplified interface to Tcl_TraceVariable. * * PROBLEM: Can't distinguish "variable does not exist" (which is OK) * from other errors (which are not). */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" struct TtkTraceHandle_ { Tcl_Interp *interp; /* Containing interpreter */ Tcl_Obj *varnameObj; /* Name of variable being traced */ Ttk_TraceProc callback; /* Callback procedure */ void *clientData; /* Data to pass to callback */ }; /* * Tcl_VarTraceProc for trace handles. */ static char * VarTraceProc( ClientData clientData, /* Widget record pointer */ Tcl_Interp *interp, /* Interpreter containing variable. */ const char *name1, /* (unused) */ const char *name2, /* (unused) */ int flags) /* Information about what happened. */ { Ttk_TraceHandle *tracePtr = clientData; const char *name, *value; Tcl_Obj *valuePtr; if (Tcl_InterpDeleted(interp)) { return NULL; } name = Tcl_GetString(tracePtr->varnameObj); /* * If the variable is being unset, then re-establish the trace: |
︙ | ︙ |
Changes to generic/ttk/ttkTrack.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | * The active element becomes "pressed" on <ButtonPress> events, * and remains "active" and "pressed" until the corresponding * <ButtonRelease> event. * * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>) */ | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | * The active element becomes "pressed" on <ButtonPress> events, * and remains "active" and "pressed" until the corresponding * <ButtonRelease> event. * * TODO: Handle "chords" properly (e.g., <B1-ButtonPress-2>) */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" typedef struct { WidgetCore *corePtr; /* widget to track */ Ttk_Layout tracking; /* current layout being tracked */ Ttk_Element activeElement; /* element under the mouse cursor */ |
︙ | ︙ |
Changes to generic/ttk/ttkTreeview.c.
1 2 3 4 5 6 | /* * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. */ | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Copyright (c) 2004, Joe English * * ttk::treeview widget implementation. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #define DEF_TREE_ROWS "10" #define DEF_COLWIDTH "200" #define DEF_MINWIDTH "20" |
︙ | ︙ | |||
59 60 61 62 63 64 65 | }; #define ITEM_OPTION_TAGS_CHANGED 0x100 #define ITEM_OPTION_IMAGE_CHANGED 0x200 static Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", | | | | | | | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | }; #define ITEM_OPTION_TAGS_CHANGED 0x100 #define ITEM_OPTION_IMAGE_CHANGED 0x200 static Tk_OptionSpec ItemOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(TreeItem,textObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(TreeItem,imageObj), -1, TK_OPTION_NULL_OK,0,ITEM_OPTION_IMAGE_CHANGED }, {TK_OPTION_STRING, "-values", "values", "Values", NULL, offsetof(TreeItem,valuesObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_BOOLEAN, "-open", "open", "Open", "0", offsetof(TreeItem,openObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-tags", "tags", "Tags", NULL, offsetof(TreeItem,tagsObj), -1, TK_OPTION_NULL_OK,0,ITEM_OPTION_TAGS_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /* + NewItem -- * Allocate a new, uninitialized, unlinked item |
︙ | ︙ | |||
187 188 189 190 191 192 193 | Tcl_Obj *backgroundObj; /* remainder from tag */ Tcl_Obj *foregroundObj; Tcl_Obj *fontObj; } DisplayItem; static Tk_OptionSpec TagOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", | | | | | | | | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | Tcl_Obj *backgroundObj; /* remainder from tag */ Tcl_Obj *foregroundObj; Tcl_Obj *fontObj; } DisplayItem; static Tk_OptionSpec TagOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", NULL, offsetof(DisplayItem,textObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", NULL, offsetof(DisplayItem,imageObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", NULL, offsetof(DisplayItem,anchorObj), -1, TK_OPTION_NULL_OK, 0, GEOMETRY_CHANGED}, /* <<NOTE-ANCHOR>> */ {TK_OPTION_COLOR, "-background", "windowColor", "WindowColor", NULL, offsetof(DisplayItem,backgroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_COLOR, "-foreground", "textColor", "TextColor", NULL, offsetof(DisplayItem,foregroundObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_FONT, "-font", "font", "Font", NULL, offsetof(DisplayItem,fontObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /*------------------------------------------------------------------------ * +++ Columns. |
︙ | ︙ | |||
271 272 273 274 275 276 277 | if (column->headingCommandObj) { Tcl_DecrRefCount(column->headingCommandObj); } /* Don't touch column->data, it's scratch storage */ } static Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", | | | | | | | | | | | | | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | if (column->headingCommandObj) { Tcl_DecrRefCount(column->headingCommandObj); } /* Don't touch column->data, it's scratch storage */ } static Tk_OptionSpec ColumnOptionSpecs[] = { {TK_OPTION_INT, "-width", "width", "Width", DEF_COLWIDTH, -1, offsetof(TreeColumn,width), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_INT, "-minwidth", "minWidth", "MinWidth", DEF_MINWIDTH, -1, offsetof(TreeColumn,minWidth), 0,0,0 }, {TK_OPTION_BOOLEAN, "-stretch", "stretch", "Stretch", "1", -1, offsetof(TreeColumn,stretch), 0,0,GEOMETRY_CHANGED }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "w", offsetof(TreeColumn,anchorObj), -1, /* <<NOTE-ANCHOR>> */ 0,0,0 }, {TK_OPTION_STRING, "-id", "id", "ID", NULL, offsetof(TreeColumn,idObj), -1, TK_OPTION_NULL_OK,0,READONLY_OPTION }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; static Tk_OptionSpec HeadingOptionSpecs[] = { {TK_OPTION_STRING, "-text", "text", "Text", "", offsetof(TreeColumn,headingObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-image", "image", "Image", "", offsetof(TreeColumn,headingImageObj), -1, 0,0,0 }, {TK_OPTION_ANCHOR, "-anchor", "anchor", "Anchor", "center", offsetof(TreeColumn,headingAnchorObj), -1, 0,0,0 }, {TK_OPTION_STRING, "-command", "", "", "", offsetof(TreeColumn,headingCommandObj), -1, TK_OPTION_NULL_OK,0,0 }, {TK_OPTION_STRING, "state", "", "", "", offsetof(TreeColumn,headingStateObj), -1, 0,0,STATE_CHANGED }, {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0,0,0} }; /*------------------------------------------------------------------------ * +++ -show option: * TODO: Implement SHOW_BRANCHES. */ #define SHOW_TREE (0x1) /* Show tree column? */ #define SHOW_HEADINGS (0x2) /* Show heading row? */ #define DEFAULT_SHOW "tree headings" static const char *const showStrings[] = { "tree", "headings", NULL }; static int GetEnumSetFromObj( Tcl_Interp *interp, Tcl_Obj *objPtr, const char *const table[], unsigned *resultPtr) { unsigned result = 0; int i, objc; Tcl_Obj **objv; if (Tcl_ListObjGetElements(interp, objPtr, &objc, &objv) != TCL_OK) |
︙ | ︙ | |||
431 432 433 434 435 436 437 | #define USER_MASK 0x0100 #define COLUMNS_CHANGED (USER_MASK) #define DCOLUMNS_CHANGED (USER_MASK<<1) #define SCROLLCMD_CHANGED (USER_MASK<<2) #define SHOW_CHANGED (USER_MASK<<3) | | | | | | | | | | | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | #define USER_MASK 0x0100 #define COLUMNS_CHANGED (USER_MASK) #define DCOLUMNS_CHANGED (USER_MASK<<1) #define SCROLLCMD_CHANGED (USER_MASK<<2) #define SHOW_CHANGED (USER_MASK<<3) static const char *const SelectModeStrings[] = { "none", "browse", "extended", NULL }; static Tk_OptionSpec TreeviewOptionSpecs[] = { {TK_OPTION_STRING, "-columns", "columns", "Columns", "", offsetof(Treeview,tree.columnsObj), -1, 0,0,COLUMNS_CHANGED | GEOMETRY_CHANGED /*| READONLY_OPTION*/ }, {TK_OPTION_STRING, "-displaycolumns","displayColumns","DisplayColumns", "#all", offsetof(Treeview,tree.displayColumnsObj), -1, 0,0,DCOLUMNS_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-show", "show", "Show", DEFAULT_SHOW, offsetof(Treeview,tree.showObj), -1, 0,0,SHOW_CHANGED | GEOMETRY_CHANGED }, {TK_OPTION_STRING_TABLE, "-selectmode", "selectMode", "SelectMode", "extended", offsetof(Treeview,tree.selectModeObj), -1, 0,(ClientData)SelectModeStrings,0 }, {TK_OPTION_PIXELS, "-height", "height", "Height", DEF_TREE_ROWS, offsetof(Treeview,tree.heightObj), -1, 0,0,GEOMETRY_CHANGED}, {TK_OPTION_STRING, "-padding", "padding", "Pad", NULL, offsetof(Treeview,tree.paddingObj), -1, TK_OPTION_NULL_OK,0,GEOMETRY_CHANGED }, {TK_OPTION_STRING, "-xscrollcommand", "xScrollCommand", "ScrollCommand", NULL, -1, offsetof(Treeview, tree.xscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, {TK_OPTION_STRING, "-yscrollcommand", "yScrollCommand", "ScrollCommand", NULL, -1, offsetof(Treeview, tree.yscroll.scrollCmd), TK_OPTION_NULL_OK, 0, SCROLLCMD_CHANGED}, WIDGET_TAKEFOCUS_TRUE, WIDGET_INHERIT_OPTIONS(ttkCoreOptionSpecs) }; /*------------------------------------------------------------------------ |
︙ | ︙ | |||
919 920 921 922 923 924 925 | /*------------------------------------------------------------------------ * +++ Event handlers. */ static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/ | | | 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | /*------------------------------------------------------------------------ * +++ Event handlers. */ static TreeItem *IdentifyItem(Treeview *tv, int y); /*forward*/ static const unsigned long TreeviewBindEventMask = KeyPressMask|KeyReleaseMask | ButtonPressMask|ButtonReleaseMask | PointerMotionMask|ButtonMotionMask | VirtualEventMask ; static void TreeviewBindEventProc(void *clientData, XEvent *event) |
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout); if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout); if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout); TreeviewFreeColumns(tv); if (tv->tree.displayColumns) | | | 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 | if (tv->tree.cellLayout) Ttk_FreeLayout(tv->tree.cellLayout); if (tv->tree.headingLayout) Ttk_FreeLayout(tv->tree.headingLayout); if (tv->tree.rowLayout) Ttk_FreeLayout(tv->tree.rowLayout); TreeviewFreeColumns(tv); if (tv->tree.displayColumns) ckfree((ClientData)tv->tree.displayColumns); foreachHashEntry(&tv->tree.items, FreeItemCB); Tcl_DeleteHashTable(&tv->tree.items); TtkFreeScrollHandle(tv->tree.xscrollHandle); TtkFreeScrollHandle(tv->tree.yscrollHandle); } |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; Ttk_ImageSpec *newImageSpec = NULL; Ttk_TagSet newTagSet = NULL; | | | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 | int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; Ttk_ImageSpec *newImageSpec = NULL; Ttk_TagSet newTagSet = NULL; if (Tk_SetOptions(interp, item, tv->tree.itemOptionTable, objc, objv, tv->core.tkwin, &savedOptions, &mask) != TCL_OK) { return TCL_ERROR; } /* Make sure that -values is a valid list: |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | static int ConfigureColumn( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; | | | 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 | static int ConfigureColumn( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, column, tv->tree.columnOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { return TCL_ERROR; } if (mask & READONLY_OPTION) { |
︙ | ︙ | |||
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 | * geometry jumping during interactive column resize. */ if (mask & GEOMETRY_CHANGED) { if (!Tk_IsMapped(tv->core.tkwin)) { TtkResizeWidget(&tv->core); } RecomputeSlack(tv); } TtkRedisplayWidget(&tv->core); | > < < | | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 | * geometry jumping during interactive column resize. */ if (mask & GEOMETRY_CHANGED) { if (!Tk_IsMapped(tv->core.tkwin)) { TtkResizeWidget(&tv->core); } RecomputeSlack(tv); ResizeColumns(tv, TreeWidth(tv)); } TtkRedisplayWidget(&tv->core); Tk_FreeSavedOptions(&savedOptions); return TCL_OK; error: Tk_RestoreSavedOptions(&savedOptions); return TCL_ERROR; } /* + ConfigureHeading -- * Set heading options. */ static int ConfigureHeading( Tcl_Interp *interp, Treeview *tv, TreeColumn *column, int objc, Tcl_Obj *const objv[]) { Tk_SavedOptions savedOptions; int mask; if (Tk_SetOptions(interp, column, tv->tree.headingOptionTable, objc, objv, tv->core.tkwin, &savedOptions,&mask) != TCL_OK) { return TCL_ERROR; } /* @@@ testing ... */ |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | REGION_NOTHING = 0, REGION_HEADING, REGION_SEPARATOR, REGION_TREE, REGION_CELL } TreeRegion; | | | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 | REGION_NOTHING = 0, REGION_HEADING, REGION_SEPARATOR, REGION_TREE, REGION_CELL } TreeRegion; static const char *const regionStrings[] = { "nothing", "heading", "separator", "tree", "cell", 0 }; static TreeRegion IdentifyRegion(Treeview *tv, int x, int y) { int x1 = 0, colno; |
︙ | ︙ | |||
1611 1612 1613 1614 1615 1616 1617 | * Invokes scroll callbacks. */ static void TreeviewDoLayout(void *clientData) { Treeview *tv = clientData; int visibleRows; | < < < | 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 | * Invokes scroll callbacks. */ static void TreeviewDoLayout(void *clientData) { Treeview *tv = clientData; int visibleRows; Ttk_PlaceLayout(tv->core.layout,tv->core.state,Ttk_WinBox(tv->core.tkwin)); tv->tree.treeArea = Ttk_ClientRegion(tv->core.layout, "treearea"); ResizeColumns(tv, tv->tree.treeArea.width); TtkScrolled(tv->tree.xscrollHandle, tv->tree.xscroll.first, tv->tree.xscroll.first + tv->tree.treeArea.width, TreeWidth(tv)); if (tv->tree.showFlags & SHOW_HEADINGS) { |
︙ | ︙ | |||
2142 2143 2144 2145 2146 2147 2148 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "itemid"); return TCL_ERROR; } entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2])); | | | 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 | if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "itemid"); return TCL_ERROR; } entryPtr = Tcl_FindHashEntry(&tv->tree.items, Tcl_GetString(objv[2])); Tcl_SetObjResult(interp, Tcl_NewWideIntObj(entryPtr != 0)); return TCL_OK; } /* + $tv bbox $itemid ?$column? -- * Return bounding box [x y width height] of specified item. */ static int TreeviewBBoxCommand( |
︙ | ︙ | |||
2229 2230 2231 2232 2233 2234 2235 | } else if (item) { Ttk_Layout layout = tv->tree.itemLayout; Ttk_Box itemBox; DisplayItem displayItem; Ttk_Element element; BoundingBox(tv, item, NULL, &itemBox); | | > > | 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 | } else if (item) { Ttk_Layout layout = tv->tree.itemLayout; Ttk_Box itemBox; DisplayItem displayItem; Ttk_Element element; BoundingBox(tv, item, NULL, &itemBox); PrepareItem(tv, item, &displayItem); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } Ttk_RebindSublayout(layout, &displayItem); Ttk_PlaceLayout(layout, ItemState(tv,item), itemBox); element = Ttk_IdentifyElement(layout, x, y); if (element) { what = "item"; detail = Ttk_ElementName(element); |
︙ | ︙ | |||
2262 2263 2264 2265 2266 2267 2268 | /* + $tv identify $component $x $y -- * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { | | | 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 | /* + $tv identify $component $x $y -- * Identify the component at position x,y. */ static int TreeviewIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { static const char *const submethodStrings[] = { "region", "item", "column", "row", "element", NULL }; enum { I_REGION, I_ITEM, I_COLUMN, I_ROW, I_ELEMENT }; Treeview *tv = recordPtr; int submethod; int x, y; |
︙ | ︙ | |||
2341 2342 2343 2344 2345 2346 2347 | break; } if (!BoundingBox(tv, item, column, &bbox)) { return TCL_OK; } | | > > | 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 | break; } if (!BoundingBox(tv, item, column, &bbox)) { return TCL_OK; } PrepareItem(tv, item, &displayItem); if (item->textObj) { displayItem.textObj = item->textObj; } if (item->imageObj) { displayItem.imageObj = item->imageObj; } Ttk_RebindSublayout(layout, &displayItem); Ttk_PlaceLayout(layout, ItemState(tv,item), bbox); element = Ttk_IdentifyElement(layout, x, y); if (element) { const char *elementName = Ttk_ElementName(element); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); |
︙ | ︙ | |||
2676 2677 2678 2679 2680 2681 2682 | */ static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = recordPtr; TreeItem **items, *delq; | | | 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 | */ static int TreeviewDeleteCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = recordPtr; TreeItem **items, *delq; int i, selItemDeleted = 0; if (objc != 3) { Tcl_WrongNumArgs(interp, 2, objv, "items"); return TCL_ERROR; } if (!(items = GetItemListFromObj(interp, tv, objv[2]))) { |
︙ | ︙ | |||
2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 | } } /* Remove items from hash table. */ delq = 0; for (i=0; items[i]; ++i) { delq = DeleteItems(items[i], delq); } /* Free items: */ while (delq) { TreeItem *next = delq->next; if (tv->tree.focus == delq) tv->tree.focus = 0; if (tv->tree.endPtr == delq) tv->tree.endPtr = 0; FreeItem(delq); delq = next; } ckfree(items); TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv move $item $parent $index * Move $item to the specified $index in $parent's child list. */ | > > > > > > | 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 | } } /* Remove items from hash table. */ delq = 0; for (i=0; items[i]; ++i) { if (items[i]->state & TTK_STATE_SELECTED) { selItemDeleted = 1; } delq = DeleteItems(items[i], delq); } /* Free items: */ while (delq) { TreeItem *next = delq->next; if (tv->tree.focus == delq) tv->tree.focus = 0; if (tv->tree.endPtr == delq) tv->tree.endPtr = 0; FreeItem(delq); delq = next; } ckfree(items); if (selItemDeleted) { TtkSendVirtualEvent(tv->core.tkwin, "TreeviewSelect"); } TtkRedisplayWidget(&tv->core); return TCL_OK; } /* + $tv move $item $parent $index * Move $item to the specified $index in $parent's child list. */ |
︙ | ︙ | |||
2837 2838 2839 2840 2841 2842 2843 | } tv->tree.yscroll.total = CountRows(tv->tree.root) - 1; /* Make sure item is visible: */ rowNumber = RowNumber(tv, item); if (rowNumber < tv->tree.yscroll.first) { | | | | 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 | } tv->tree.yscroll.total = CountRows(tv->tree.root) - 1; /* Make sure item is visible: */ rowNumber = RowNumber(tv, item); if (rowNumber < tv->tree.yscroll.first) { TtkScrollTo(tv->tree.yscrollHandle, rowNumber, 1); } else if (rowNumber >= tv->tree.yscroll.last) { TtkScrollTo(tv->tree.yscrollHandle, tv->tree.yscroll.first + (1+rowNumber - tv->tree.yscroll.last), 1); } return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- interactive column resize |
︙ | ︙ | |||
2877 2878 2879 2880 2881 2882 2883 | return TCL_ERROR; } for (;i < tv->tree.nDisplayColumns; ++i) { TreeColumn *c = tv->tree.displayColumns[i]; int right = left + c->width; if (c == column) { | > > > > > > > > > > > > > > > > > > > | < | > > > > > > > > > > > > > > > | 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 | return TCL_ERROR; } for (;i < tv->tree.nDisplayColumns; ++i) { TreeColumn *c = tv->tree.displayColumns[i]; int right = left + c->width; if (c == column) { /* The limit not to exceed at the right is given by the tree width minus the sum of the min widths of the columns at the right of the one being resized (and don't forget possible x scrolling!). For stretchable columns, this min width really is the minWidth, for non-stretchable columns, this is the column width. */ int newxRightLimit = tv->tree.treeArea.x - tv->tree.xscroll.first + tv->tree.treeArea.width; int j = i + 1; while (j < tv->tree.nDisplayColumns) { TreeColumn *cr = tv->tree.displayColumns[j]; if (cr->stretch) { newxRightLimit -= cr->minWidth; } else { newxRightLimit -= cr->width; } ++j; } if (newx <= newxRightLimit) { DragColumn(tv, i, newx - right); TtkRedisplayWidget(&tv->core); } return TCL_OK; } left = right; } Tcl_SetObjResult(interp, Tcl_ObjPrintf( "column %s is not displayed", Tcl_GetString(objv[2]))); Tcl_SetErrorCode(interp, "TTK", "TREE", "COLUMN_INVISIBLE", NULL); return TCL_ERROR; } static int TreeviewDropCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Treeview *tv = recordPtr; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "drop"); return TCL_ERROR; } ResizeColumns(tv, TreeWidth(tv)); TtkRedisplayWidget(&tv->core); return TCL_OK; } /*------------------------------------------------------------------------ * +++ Widget commands -- focus and selection */ /* + $tree focus ?item? */ |
︙ | ︙ | |||
2928 2929 2930 2931 2932 2933 2934 | */ static int TreeviewSelectionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { enum { SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; | | | 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 | */ static int TreeviewSelectionCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { enum { SELECTION_SET, SELECTION_ADD, SELECTION_REMOVE, SELECTION_TOGGLE }; static const char *const selopStrings[] = { "set", "add", "remove", "toggle", NULL }; Treeview *tv = recordPtr; int selop, i; TreeItem *item, **items; |
︙ | ︙ | |||
3108 3109 3110 3111 3112 3113 3114 | } else if (objc == 5) { /* Test if item has specified tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); TreeItem *item = FindItem(interp, tv, objv[4]); if (!item) { return TCL_ERROR; } Tcl_SetObjResult(interp, | | | 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 | } else if (objc == 5) { /* Test if item has specified tag */ Ttk_Tag tag = Ttk_GetTagFromObj(tv->tree.tagTable, objv[3]); TreeItem *item = FindItem(interp, tv, objv[4]); if (!item) { return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Ttk_TagSetContains(item->tagset, tag))); return TCL_OK; } else { Tcl_WrongNumArgs(interp, 3, objv, "tagName ?item?"); return TCL_ERROR; } } |
︙ | ︙ | |||
3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 | { "children", TreeviewChildrenCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, { "column", TreeviewColumnCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "delete", TreeviewDeleteCommand,0 }, { "detach", TreeviewDetachCommand,0 }, { "drag", TreeviewDragCommand,0 }, { "exists", TreeviewExistsCommand,0 }, { "focus", TreeviewFocusCommand,0 }, { "heading", TreeviewHeadingCommand,0 }, { "identify", TreeviewIdentifyCommand,0 }, { "index", TreeviewIndexCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "insert", TreeviewInsertCommand,0 }, | > | 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 | { "children", TreeviewChildrenCommand,0 }, { "cget", TtkWidgetCgetCommand,0 }, { "column", TreeviewColumnCommand,0 }, { "configure", TtkWidgetConfigureCommand,0 }, { "delete", TreeviewDeleteCommand,0 }, { "detach", TreeviewDetachCommand,0 }, { "drag", TreeviewDragCommand,0 }, { "drop", TreeviewDropCommand,0 }, { "exists", TreeviewExistsCommand,0 }, { "focus", TreeviewFocusCommand,0 }, { "heading", TreeviewHeadingCommand,0 }, { "identify", TreeviewIdentifyCommand,0 }, { "index", TreeviewIndexCommand,0 }, { "instate", TtkWidgetInstateCommand,0 }, { "insert", TreeviewInsertCommand,0 }, |
︙ | ︙ | |||
3327 3328 3329 3330 3331 3332 3333 | Tcl_Obj *colorObj; Tcl_Obj *sizeObj; Tcl_Obj *marginsObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, | | | | | 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 | Tcl_Obj *colorObj; Tcl_Obj *sizeObj; Tcl_Obj *marginsObj; } TreeitemIndicator; static Ttk_ElementOptionSpec TreeitemIndicatorOptions[] = { { "-foreground", TK_OPTION_COLOR, offsetof(TreeitemIndicator,colorObj), DEFAULT_FOREGROUND }, { "-indicatorsize", TK_OPTION_PIXELS, offsetof(TreeitemIndicator,sizeObj), "12" }, { "-indicatormargins", TK_OPTION_STRING, offsetof(TreeitemIndicator,marginsObj), "2 2 4 2" }, { NULL, 0, 0, NULL } }; static void TreeitemIndicatorSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
3396 3397 3398 3399 3400 3401 3402 | typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *rowNumberObj; } RowElement; static Ttk_ElementOptionSpec RowElementOptions[] = { { "-background", TK_OPTION_COLOR, | | | | 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 | typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *rowNumberObj; } RowElement; static Ttk_ElementOptionSpec RowElementOptions[] = { { "-background", TK_OPTION_COLOR, offsetof(RowElement,backgroundObj), DEFAULT_BACKGROUND }, { "-rownumber", TK_OPTION_INT, offsetof(RowElement,rowNumberObj), "0" }, { NULL, 0, 0, NULL } }; static void RowElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { |
︙ | ︙ |
Changes to generic/ttk/ttkWidget.c.
1 2 3 4 5 6 | /* * Copyright (c) 2003, Joe English * * Core widget utilities. */ | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 | /* * Copyright (c) 2003, Joe English * * Core widget utilities. */ #include "tkInt.h" #include "ttkTheme.h" #include "ttkWidget.h" #ifdef MAC_OSX_TK #define TK_NO_DOUBLE_BUFFERING 1 #endif |
︙ | ︙ | |||
331 332 333 334 335 336 337 | static void WidgetWorldChanged(ClientData clientData) { WidgetCore *corePtr = clientData; SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } | | | 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | static void WidgetWorldChanged(ClientData clientData) { WidgetCore *corePtr = clientData; SizeChanged(corePtr); TtkRedisplayWidget(corePtr); } static const Tk_ClassProcs widgetClassProcs = { sizeof(Tk_ClassProcs), /* size */ WidgetWorldChanged, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* |
︙ | ︙ | |||
735 736 737 738 739 740 741 | } status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec); if (status != TCL_OK) return status; if (objc == 3) { Tcl_SetObjResult(interp, | | | | 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | } status = Ttk_GetStateSpecFromObj(interp, objv[2], &spec); if (status != TCL_OK) return status; if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(Ttk_StateMatches(state,&spec))); } else if (objc == 4) { if (Ttk_StateMatches(state,&spec)) { status = Tcl_EvalObjEx(interp, objv[3], 0); } } return status; } /* $w identify $x $y * $w identify element $x $y * Returns: name of element at $x, $y */ int TtkWidgetIdentifyCommand( void *recordPtr, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { WidgetCore *corePtr = recordPtr; Ttk_Element element; static const char *const whatTable[] = { "element", NULL }; int x, y, what; if (objc < 4 || objc > 5) { Tcl_WrongNumArgs(interp, 2, objv, "?what? x y"); return TCL_ERROR; } if (objc == 5) { |
︙ | ︙ |
Changes to generic/ttk/ttkWidget.h.
︙ | ︙ | |||
107 108 109 110 111 112 113 | #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- | | | | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | #define RegisterWidget(interp, name, specPtr) \ Tcl_CreateObjCommand(interp, name, \ TtkWidgetConstructorObjCmd, (ClientData)specPtr,NULL) /* WIDGET_TAKEFOCUS_TRUE -- * WIDGET_TAKEFOCUS_FALSE -- * Add one or the other of these to each OptionSpecs table * to indicate whether the widget should take focus * during keyboard traversal. */ #define WIDGET_TAKEFOCUS_TRUE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ "ttk::takefocus", offsetof(WidgetCore, takeFocusPtr), -1, 0,0,0 } #define WIDGET_TAKEFOCUS_FALSE \ {TK_OPTION_STRING, "-takefocus", "takeFocus", "TakeFocus", \ "", offsetof(WidgetCore, takeFocusPtr), -1, 0,0,0 } /* WIDGET_INHERIT_OPTIONS(baseOptionSpecs) -- * Add this at the end of an OptionSpecs table to inherit * the options from 'baseOptionSpecs'. */ #define WIDGET_INHERIT_OPTIONS(baseOptionSpecs) \ {TK_OPTION_END, 0,0,0, NULL, -1,-1, 0, (ClientData)baseOptionSpecs, 0} |
︙ | ︙ | |||
191 192 193 194 195 196 197 | MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle); | > | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | MODULE_SCOPE ScrollHandle TtkCreateScrollHandle(WidgetCore *, Scrollable *); MODULE_SCOPE void TtkFreeScrollHandle(ScrollHandle); MODULE_SCOPE int TtkScrollviewCommand( Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], ScrollHandle); MODULE_SCOPE void TtkUpdateScrollInfo(ScrollHandle h); MODULE_SCOPE void TtkScrollTo(ScrollHandle, int newFirst, int updateScrollInfo); MODULE_SCOPE void TtkScrolled(ScrollHandle, int first, int last, int total); MODULE_SCOPE void TtkScrollbarUpdateRequired(ScrollHandle); /* * Tag sets (work in progress, half-baked) */ |
︙ | ︙ |
Changes to library/bgerror.tcl.
︙ | ︙ | |||
93 94 95 96 97 98 99 | # It tries to execute tkerror, if that fails it posts a dialog box # containing the error message and gives the user a chance to ask # to see a stack trace. # # Arguments: # err - The error message. # | | | | > > > < | > | | | > > | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | # It tries to execute tkerror, if that fails it posts a dialog box # containing the error message and gives the user a chance to ask # to see a stack trace. # # Arguments: # err - The error message. # proc ::tk::dialog::error::bgerror {err {flag 1}} { global errorInfo variable button set info $errorInfo set ret [catch {::tkerror $err} msg]; if {$ret != 1} {return -code $ret $msg} # The application's tkerror either failed or was not found # so we use the default dialog. But on Aqua we cannot display # the dialog if the background error occurs in an idle task # being processed inside of [NSView drawRect]. In that case # we post the dialog as an after task instead. set windowingsystem [tk windowingsystem] if {$windowingsystem eq "aqua"} { if $flag { after 500 [list bgerror "$err" 0] return } } set ok [mc OK] # Truncate the message if it is too wide (>maxLine characters) or # too tall (>4 lines). Truncation occurs at the first point at # which one of those conditions is met. set displayedErr "" set lines 0 set maxLine 45 foreach line [split $err \n] { |
︙ | ︙ |
Changes to library/button.tcl.
︙ | ︙ | |||
744 745 746 747 748 749 750 | proc ::tk::CheckLeave {w} { variable ::tk::Priv if {[$w cget -state] ne "disabled"} { $w configure -state normal } | | | > > > | > | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | proc ::tk::CheckLeave {w} { variable ::tk::Priv if {[$w cget -state] ne "disabled"} { $w configure -state normal } # Restore the original button "selected" color; but only if the user # has not changed it in the meantime. if {![$w cget -indicatoron] && [info exist Priv($w,selectcolor)]} { if {[$w cget -selectcolor] eq $Priv($w,selectcolor) || ([info exist Priv($w,aselectcolor)] && [$w cget -selectcolor] eq $Priv($w,aselectcolor))} { $w configure -selectcolor $Priv($w,selectcolor) } } unset -nocomplain Priv($w,selectcolor) Priv($w,aselectcolor) # Restore the original button relief if it was changed by Tk. That is # signaled by the existence of Priv($w,prelief). if {[info exists Priv($w,relief)]} { |
︙ | ︙ |
Changes to library/demos/combo.tcl.
︙ | ︙ | |||
39 40 41 42 43 44 45 | Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart Darwin "Alice Springs" } set secondValue unchangable set ozCity Sydney ttk::labelframe $w.c1 -text "Fully Editable" | | > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | Canberra Sydney Melbourne Perth Adelaide Brisbane Hobart Darwin "Alice Springs" } set secondValue unchangable set ozCity Sydney ttk::labelframe $w.c1 -text "Fully Editable" ttk::combobox $w.c1.c -textvariable firstValue -placeholder {Enter text here} ttk::style configure TEntry -placeholderforeground gray50 ttk::labelframe $w.c2 -text Disabled ttk::combobox $w.c2.c -textvariable secondValue -state disabled ttk::labelframe $w.c3 -text "Defined List Only" ttk::combobox $w.c3.c -textvariable ozCity -state readonly \ -values $australianCities bind $w.c1.c <Return> { if {[%W get] ni [%W cget -values]} { |
︙ | ︙ |
Changes to library/demos/ctext.tcl.
︙ | ︙ | |||
36 37 38 39 40 41 42 | set textFont {Helvetica 24} $c create rectangle 245 195 255 205 -outline black -fill red # First, create the text item and give it bindings so it can be edited. | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | set textFont {Helvetica 24} $c create rectangle 245 195 255 205 -outline black -fill red # First, create the text item and give it bindings so it can be edited. $c addtag text withtag [$c create text 250 200 -text "This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been defined to support editing (see above)." -width 440 -anchor n -font $textFont -justify left] $c bind text <1> "textB1Press $c %x %y" $c bind text <B1-Motion> "textB1Move $c %x %y" $c bind text <Shift-1> "$c select adjust current @%x,%y" $c bind text <Shift-B1-Motion> "textB1Move $c %x %y" $c bind text <KeyPress> "textInsert $c %A" $c bind text <Return> "textInsert $c \\n" $c bind text <Control-h> "textBs $c" |
︙ | ︙ |
Changes to library/demos/entry1.tcl.
︙ | ︙ | |||
21 22 23 24 25 26 27 | ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x entry $w.e1 entry $w.e2 | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x entry $w.e1 entry $w.e2 entry $w.e3 -placeholder {Enter text here} -placeholderforeground gray75 pack $w.e1 $w.e2 $w.e3 -side top -pady 5 -padx 10 -fill x $w.e1 insert 0 "Initial value" $w.e2 insert end "This entry contains a long value, much too long " $w.e2 insert end "to fit in the window at one time, so long in fact " $w.e2 insert end "that you'll have to scan or scroll to see the end." |
Changes to library/demos/entry2.tcl.
︙ | ︙ | |||
40 41 42 43 44 45 46 | pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \ $w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x $w.frame.e1 insert 0 "Initial value" $w.frame.e2 insert end "This entry contains a long value, much too long " $w.frame.e2 insert end "to fit in the window at one time, so long in fact " $w.frame.e2 insert end "that you'll have to scan or scroll to see the end." | > | 40 41 42 43 44 45 46 47 | pack $w.frame.e1 $w.frame.s1 $w.frame.spacer1 $w.frame.e2 $w.frame.s2 \ $w.frame.spacer2 $w.frame.e3 $w.frame.s3 -side top -fill x $w.frame.e1 insert 0 "Initial value" $w.frame.e2 insert end "This entry contains a long value, much too long " $w.frame.e2 insert end "to fit in the window at one time, so long in fact " $w.frame.e2 insert end "that you'll have to scan or scroll to see the end." $w.frame.e3 configure -placeholder {Enter text here} -placeholderforeground gray75 |
Changes to library/demos/menu.tcl.
︙ | ︙ | |||
127 128 129 130 131 132 133 | puts "You invoked the $i bitmap" ] } $m entryconfigure 2 -columnbreak 1 set m $w.menu.more $w.menu add cascade -label "More" -menu $m -underline 0 menu $m -tearoff 0 | | > > > > > > > | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | puts "You invoked the $i bitmap" ] } $m entryconfigure 2 -columnbreak 1 set m $w.menu.more $w.menu add cascade -label "More" -menu $m -underline 0 menu $m -tearoff 0 foreach i {{An entry} {Another entry} {Does nothing} {Does almost nothing} {Does almost nothing also} {Make life meaningful}} { $m add command -label $i -command [list puts "You invoked \"$i\""] } $m entryconfigure "Does almost nothing" -bitmap questhead -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a bitmap and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] $m entryconfigure "Does almost nothing also" -image lilearth -compound left \ -command [list \ tk_dialog $w.compound {Compound Menu Entry} \ "The menu entry you invoked displays both a image and a\ text string. Other than this, it is just like any other\ menu entry." {} 0 OK ] set m $w.menu.colors $w.menu add cascade -label "Colors" -menu $m -underline 1 menu $m -tearoff 1 foreach i {red orange yellow green blue} { $m add command -label $i -background $i -command [list \ puts "You invoked \"$i\"" ] |
︙ | ︙ |
Changes to library/demos/pendulum.tcl.
︙ | ︙ | |||
122 123 124 125 126 127 128 | } bind $w.c <ButtonRelease-1> { showPendulum %W at %x %y set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]] } bind $w.c <Configure> { %W coords plate 0 25 %w 25 | | | | | | | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | } bind $w.c <ButtonRelease-1> { showPendulum %W at %x %y set animationCallbacks(pendulum) [after 15 repeat [winfo toplevel %W]] } bind $w.c <Configure> { %W coords plate 0 25 %w 25 set home [expr {%w/2}] %W coords pivot [expr {$home-5}] 20 [expr {$home+5}] 30 } bind $w.k <Configure> { set psh [expr {%h/2}] set psw [expr {%w/2}] %W coords x_axis 2 $psh [expr {%w-2}] $psh %W coords y_axis $psw [expr {%h-2}] $psw 2 %W coords label_dtheta [expr {$psw-4}] 6 %W coords label_theta [expr {%w-6}] [expr {$psh+4}] } # This procedure is the "business" part of the simulation that does # simple numerical integration of the formula for a simple rotational # pendulum. proc recomputeAngle {} { global Theta dTheta pi length |
︙ | ︙ |
Changes to library/demos/puzzle.tcl.
︙ | ︙ | |||
69 70 71 72 73 74 75 | destroy $w.s set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12} for {set i 0} {$i < 15} {set i [expr {$i+1}]} { set num [lindex $order $i] set xpos($num) [expr {($i%4)*.25}] set ypos($num) [expr {($i/4)*.25}] | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | destroy $w.s set order {3 1 6 2 5 7 15 13 4 11 8 9 14 10 12} for {set i 0} {$i < 15} {set i [expr {$i+1}]} { set num [lindex $order $i] set xpos($num) [expr {($i%4)*.25}] set ypos($num) [expr {($i/4)*.25}] button $w.frame.$num -relief raised -text $num -bd 0 -highlightthickness 0 \ -command "puzzleSwitch $w $num" place $w.frame.$num -relx $xpos($num) -rely $ypos($num) \ -relwidth .25 -relheight .25 } set xpos(space) .75 set ypos(space) .75 |
Changes to library/demos/square.
︙ | ︙ | |||
23 24 25 26 27 28 29 | bind .s a animate focus .s # The procedure below centers the square on a given position. proc center {x y} { set a [.s size] | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | bind .s a animate focus .s # The procedure below centers the square on a given position. proc center {x y} { set a [.s size] .s position [expr {$x-($a/2)}] [expr {$y-($a/2)}] } # The procedures below provide a simple form of animation where # the box changes size in a pulsing pattern: larger, smaller, larger, # and so on. set inc 0 |
︙ | ︙ |
Changes to library/demos/toolbar.tcl.
︙ | ︙ | |||
27 28 29 30 31 32 33 | ## Set up the toolbar hull set t [frame $w.toolbar] ;# Must be a frame! ttk::separator $w.sep ttk::frame $t.tearoff -cursor fleur ttk::separator $t.tearoff.to -orient vertical ttk::separator $t.tearoff.to2 -orient vertical | | | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ## Set up the toolbar hull set t [frame $w.toolbar] ;# Must be a frame! ttk::separator $w.sep ttk::frame $t.tearoff -cursor fleur ttk::separator $t.tearoff.to -orient vertical ttk::separator $t.tearoff.to2 -orient vertical pack $t.tearoff.to -fill y -expand 1 -padx 4 -side left pack $t.tearoff.to2 -fill y -expand 1 -side left ttk::frame $t.contents grid $t.tearoff $t.contents -sticky nsew grid columnconfigure $t $t.contents -weight 1 grid columnconfigure $t.contents 1000 -weight 1 ## Bindings so that the toolbar can be torn off and reattached |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } ## Some content for the rest of the toplevel text $w.txt -width 40 -height 10 interp alias {} doInsert {} $w.txt insert end ;# Make bindings easy to write ## Arrange contents | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | } ## Some content for the rest of the toplevel text $w.txt -width 40 -height 10 interp alias {} doInsert {} $w.txt insert end ;# Make bindings easy to write ## Arrange contents grid $t.button $t.check $t.menu $t.combo -in $t.contents -padx 2 -pady 4 -sticky ns grid $t -sticky ew grid $w.sep -sticky ew grid $w.msg -sticky ew grid $w.txt -sticky nsew grid rowconfigure $w $w.txt -weight 1 grid columnconfigure $w $w.txt -weight 1 ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] grid $btns -sticky ew |
Changes to library/demos/tree.tcl.
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 | proc populateTree {tree node} { if {[$tree set $node type] ne "directory"} { return } set path [$tree set $node fullpath] $tree delete [$tree children $node] foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] { set type [file type $f] set id [$tree insert $node end -text [file tail $f] \ -values [list $f $type]] if {$type eq "directory"} { ## Make it so that this node is openable $tree insert $id 0 -text dummy ;# a dummy | > | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | proc populateTree {tree node} { if {[$tree set $node type] ne "directory"} { return } set path [$tree set $node fullpath] $tree delete [$tree children $node] foreach f [lsort -dictionary [glob -nocomplain -dir $path *]] { set f [file normalize $f] set type [file type $f] set id [$tree insert $node end -text [file tail $f] \ -values [list $f $type]] if {$type eq "directory"} { ## Make it so that this node is openable $tree insert $id 0 -text dummy ;# a dummy |
︙ | ︙ | |||
71 72 73 74 75 76 77 | ## Create the tree and set it up ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \ -yscroll "$w.vsb set" -xscroll "$w.hsb set" ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview" ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview" $w.tree heading \#0 -text "Directory Structure" $w.tree heading size -text "File Size" | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | ## Create the tree and set it up ttk::treeview $w.tree -columns {fullpath type size} -displaycolumns {size} \ -yscroll "$w.vsb set" -xscroll "$w.hsb set" ttk::scrollbar $w.vsb -orient vertical -command "$w.tree yview" ttk::scrollbar $w.hsb -orient horizontal -command "$w.tree xview" $w.tree heading \#0 -text "Directory Structure" $w.tree heading size -text "File Size" $w.tree column size -width 70 populateRoots $w.tree bind $w.tree <<TreeviewOpen>> {populateTree %W [%W focus]} ## Arrange the tree and its scrollbars in the toplevel lower [ttk::frame $w.dummy] pack $w.dummy -fill both -expand 1 grid $w.tree $w.vsb -sticky nsew -in $w.dummy grid $w.hsb -sticky nsew -in $w.dummy grid columnconfigure $w.dummy 0 -weight 1 grid rowconfigure $w.dummy 0 -weight 1 |
Changes to library/demos/ttkpane.tcl.
︙ | ︙ | |||
100 101 102 103 104 105 106 | pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2 ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" pack $w.sb -side right -fill y -in $w.outer.inRight.bot pack $w.outer.inRight.bot.f -fill both -expand 1 pack $w.outer -fill both -expand 1 } else { text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 | pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot.f -pady 2 -padx 2 ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" pack $w.sb -side right -fill y -in $w.outer.inRight.bot pack $w.outer.inRight.bot.f -fill both -expand 1 pack $w.outer -fill both -expand 1 } else { text $w.txt -wrap word -yscroll "$w.sb set" -width 30 -borderwidth 0 ttk::scrollbar $w.sb -orient vertical -command "$w.txt yview" pack $w.sb -side right -fill y -in $w.outer.inRight.bot pack $w.txt -fill both -expand 1 -in $w.outer.inRight.bot pack $w.outer -fill both -expand 1 -padx 10 -pady {6 10} } |
Changes to library/demos/twind.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # twind.tcl -- # # This demonstration script creates a text widget with a bunch of # embedded windows. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk set w .twind catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Embedded Windows and Other Features" wm iconname $w "Embedded Windows" positionWindow $w | > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # twind.tcl -- # # This demonstration script creates a text widget with a bunch of # embedded windows. if {![info exists widgetDemo]} { error "This script should be run from the \"widget\" demo." } package require Tk # Make an Aqua button's fill color match its parent's background proc blend {bt} { if {[tk windowingsystem] eq "aqua"} { $bt configure -highlightbackground [[winfo parent $bt] cget -background] } return $bt } set w .twind catch {destroy $w} toplevel $w wm title $w "Text Demonstration - Embedded Windows and Other Features" wm iconname $w "Embedded Windows" positionWindow $w |
︙ | ︙ | |||
49 50 51 52 53 54 55 | $t insert end "scrolling in all directions is provided.\n\n" $t insert end "A text widget can contain other widgets embedded " $t insert end "it. These are called \"embedded windows\", " $t insert end "and they can consist of arbitrary widgets. " $t insert end "For example, here are two embedded button " $t insert end "widgets. You can click on the first button to " | | | | > > | > | > | > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | $t insert end "scrolling in all directions is provided.\n\n" $t insert end "A text widget can contain other widgets embedded " $t insert end "it. These are called \"embedded windows\", " $t insert end "and they can consist of arbitrary widgets. " $t insert end "For example, here are two embedded button " $t insert end "widgets. You can click on the first button to " $t window create end -window [blend $t.on] $t insert end " horizontal scrolling, which also turns off " $t insert end "word wrapping. Or, you can click on the second " $t insert end "button to\n" $t window create end -window [blend $t.off] $t insert end " horizontal scrolling and turn back on word wrapping.\n\n" $t insert end "Or, here is another example. If you " $t window create end -create { button %W.click -text "Click Here" -command "textWindPlot %W" \ -cursor top_left_arrow blend %W.click } $t insert end " a canvas displaying an x-y plot will appear right here." $t mark set plot insert $t mark gravity plot left $t insert end " You can drag the data points around with the mouse, " $t insert end "or you can click here to " $t window create end -create { button %W.delete -text "Delete" -command "textWindDel %W" \ -cursor top_left_arrow blend %W.delete } $t insert end " the plot again.\n\n" $t insert end "You can also create multiple text widgets each of which " $t insert end "display the same underlying text. Click this button to " $t window create end \ -create {button %W.peer -text "Make A Peer" -command "textMakePeer %W" \ -cursor top_left_arrow blend %W.peer} -padx 3 $t insert end " widget. Notice how peer widgets can have different " $t insert end "font settings, and by default contain all the images " $t insert end "of the 'parent', but that the embedded windows, " $t insert end "such as buttons may not appear in the peer. To ensure " $t insert end "that embedded windows appear in all peers you can set the " $t insert end "'-create' option to a script or a string containing %W. " $t insert end "(The plot above and the 'Make A Peer' button are " $t insert end "designed to show up in all peers.) A good use of " $t insert end "peers is for " $t window create end \ -create {button %W.split -text "Split Windows" -command "textSplitWindow %W" \ -cursor top_left_arrow blend %W.split} -padx 3 $t insert end " \n\n" $t insert end "Users of previous versions of Tk will also be interested " $t insert end "to note that now cursor movement is now by visual line by " $t insert end "default, and that all scrolling of this widget is by pixel.\n\n" $t insert end "You may also find it useful to put embedded windows in " |
︙ | ︙ | |||
124 125 126 127 128 129 130 | $t window create end -window $t.toggle -padx 3 -pady 2 set i 1 foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4} { button $t.color$i -text $color -cursor top_left_arrow -command \ | | | | | | | | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | $t window create end -window $t.toggle -padx 3 -pady 2 set i 1 foreach color {AntiqueWhite3 Bisque1 Bisque2 Bisque3 Bisque4 SlateBlue3 RoyalBlue1 SteelBlue2 DeepSkyBlue3 LightBlue1 DarkSlateGray1 Aquamarine2 DarkSeaGreen2 SeaGreen1 Yellow1 IndianRed1 IndianRed2 Tan1 Tan4} { button $t.color$i -text $color -cursor top_left_arrow -command \ "changeBg $t $color" $t window create end -window [blend $t.color$i] -padx 3 -pady 2 incr i } $t tag add buttons [blend $t.default] end button $t.bigB -text "Big borders" -command "textWindBigB $t" \ -cursor top_left_arrow button $t.smallB -text "Small borders" -command "textWindSmallB $t" \ -cursor top_left_arrow button $t.bigH -text "Big highlight" -command "textWindBigH $t" \ -cursor top_left_arrow button $t.smallH -text "Small highlight" -command "textWindSmallH $t" \ -cursor top_left_arrow button $t.bigP -text "Big pad" -command "textWindBigP $t" \ -cursor top_left_arrow button $t.smallP -text "Small pad" -command "textWindSmallP $t" \ -cursor top_left_arrow set text_normal(border) [$t cget -borderwidth] set text_normal(highlight) [$t cget -highlightthickness] set text_normal(pad) [$t cget -padx] $t insert end "\nYou can also change the usual border width and " $t insert end "highlightthickness and padding.\n" $t window create end -window [blend $t.bigB] $t window create end -window [blend $t.smallB] $t window create end -window [blend $t.bigH] $t window create end -window [blend $t.smallH] $t window create end -window [blend $t.bigP] $t window create end -window [blend $t.smallP] $t insert end "\n\nFinally, images fit comfortably in text widgets too:" $t image create end -image \ [image create photo -file [file join $tk_demoDirectory images ouster.png]] proc textWindBigB w { |
︙ | ︙ | |||
184 185 186 187 188 189 190 | proc textWindSmallH w { $w configure -highlightthickness $::text_normal(highlight) } proc textWindSmallP w { $w configure -padx $::text_normal(pad) -pady $::text_normal(pad) } | < | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | proc textWindSmallH w { $w configure -highlightthickness $::text_normal(highlight) } proc textWindSmallP w { $w configure -padx $::text_normal(pad) -pady $::text_normal(pad) } proc textWindOn w { catch {destroy $w.scroll2} set t $w.f.text ttk::scrollbar $w.scroll2 -orient horizontal -command "$t xview" pack $w.scroll2 -after $w.buttons -side bottom -fill x $t configure -xscrollcommand "$w.scroll2 set" -wrap none |
︙ | ︙ | |||
285 286 287 288 289 290 291 292 293 | $t delete $t.c while {[string first [$t get plot] " \t\n"] >= 0} { $t delete plot } $t insert plot " " } } proc embDefBg t { | > > > > > > > > > > > | > | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 | $t delete $t.c while {[string first [$t get plot] " \t\n"] >= 0} { $t delete plot } $t insert plot " " } } proc changeBg {t c} { $t configure -background $c if {[tk windowingsystem] eq "aqua"} { foreach b [$t window names] { if {[winfo class $b] eq "Button"} { $b configure -highlightbackground $c } } } } proc embDefBg t { set bg [lindex [$t configure -background] 3] changeBg $t $bg } proc textMakePeer {parent} { set n 1 while {[winfo exists .peer$n]} { incr n } set w [toplevel .peer$n] wm title $w "Text Peer #$n" |
︙ | ︙ |
Changes to library/demos/unicodeout.tcl.
︙ | ︙ | |||
18 19 20 21 22 23 24 | label $w.msg -font $font -wraplength 4i -anchor w -justify left \ -text "This is a sample of Tk's support for languages that use\ non-Western character sets. However, what you will actually see\ below depends largely on what character sets you have installed,\ and what you see for characters that are not present varies greatly\ between platforms as well. The strings are written in Tcl using\ | | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | label $w.msg -font $font -wraplength 4i -anchor w -justify left \ -text "This is a sample of Tk's support for languages that use\ non-Western character sets. However, what you will actually see\ below depends largely on what character sets you have installed,\ and what you see for characters that are not present varies greatly\ between platforms as well. The strings are written in Tcl using\ UNICODE characters using the \\uXXXX (or \\UXXXXXX) escape so as to\ do so in a portable fashion." pack $w.msg -side top ## See Code / Dismiss buttons set btns [addSeeDismiss $w.buttons $w] pack $btns -side bottom -fill x ## The frame that will contain the sample texts. |
︙ | ︙ | |||
127 128 129 130 131 132 133 134 135 136 137 | addSample $w Icelandic "\u00CDslenska" addSample $w Japanese \ "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \ "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA" addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00" addSample $w Russian \ "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A" ## We're done processing, so change things back to normal running... destroy $w.wait $w conf -cursor $oldCursor | > > | 127 128 129 130 131 132 133 134 135 136 137 138 139 | addSample $w Icelandic "\u00CDslenska" addSample $w Japanese \ "\u65E5\u672C\u8A9E\u306E\u3072\u3089\u304C\u306A, " \ "\u6F22\u5B57\u3068\u30AB\u30BF\u30AB\u30CA" addSample $w Korean "\uB300\uD55C\uBBFC\uAD6D\uC758 \uD55C\uAE00" addSample $w Russian \ "\u0420\u0443\u0441\u0441\u043A\u0438\u0439 \u044F\u0437\u044B\u043A" addSample $w Emoji \ "\U1F600\U1F4A9\U1F44D\U1F1F3\U1F1F1" ## We're done processing, so change things back to normal running... destroy $w.wait $w conf -cursor $oldCursor |
Changes to library/entry.tcl.
︙ | ︙ | |||
70 71 72 73 74 75 76 77 78 79 80 81 82 83 | bind Entry <<TraverseIn>> { %W selection range 0 end %W icursor end } # Standard Motif bindings: bind Entry <1> { tk::EntryButton1 %W %x %W selection clear } bind Entry <B1-Motion> { set tk::Priv(x) %x tk::EntryMouseSelect %W %x | > > > > > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | bind Entry <<TraverseIn>> { %W selection range 0 end %W icursor end } # Standard Motif bindings: bind Entry <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } bind Entry <1> { tk::EntryButton1 %W %x %W selection clear } bind Entry <B1-Motion> { set tk::Priv(x) %x tk::EntryMouseSelect %W %x |
︙ | ︙ | |||
648 649 650 651 652 653 654 | [expr {[$w index sel.last] - 1}]] if {[$w cget -show] ne ""} { return [string repeat [string index [$w cget -show] 0] \ [string length $entryString]] } return $entryString } | > > > > > > > > > | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | [expr {[$w index sel.last] - 1}]] if {[$w cget -show] ne ""} { return [string repeat [string index [$w cget -show] 0] \ [string length $entryString]] } return $entryString } |
Changes to library/images/logo.eps.
︙ | ︙ | |||
24 25 26 27 28 29 30 | %AI5_NumLayers: 1 %AI5_OpenToView: 90 576 2 938 673 18 1 1 2 40 %AI5_OpenViewLayers: 7 %%EndComments %%BeginProlog %%BeginResource: procset Adobe_level2_AI5 1.0 0 %%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation) | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | %AI5_NumLayers: 1 %AI5_OpenToView: 90 576 2 938 673 18 1 1 2 40 %AI5_OpenViewLayers: 7 %%EndComments %%BeginProlog %%BeginResource: procset Adobe_level2_AI5 1.0 0 %%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation) %%Version: 1.0 %%CreationDate: (04/10/93) () %%Copyright: ((C) 1987-1993 Adobe Systems Incorporated All Rights Reserved) userdict /Adobe_level2_AI5 21 dict dup begin put /packedarray where not { userdict begin |
︙ | ︙ | |||
73 74 75 76 77 78 79 | 4 index mul 4 1 roll } repeat 5 -1 roll pop setcmykcolor } def } if | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 4 index mul 4 1 roll } repeat 5 -1 roll pop setcmykcolor } def } if /gt38? mark {version cvx exec} stopped {cleartomark true} {38 gt exch pop} ifelse def userdict /deviceDPI 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt put userdict /level2? systemdict /languagelevel known dup { pop systemdict /languagelevel get 2 ge } if |
︙ | ︙ | |||
174 175 176 177 178 179 180 | /customColor? isCMYKSep? not def end } if end defaultpacking setpacking %%EndResource %%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0 %%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog) | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /customColor? isCMYKSep? not def end } if end defaultpacking setpacking %%EndResource %%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0 %%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog) %%Version: 1.1 %%CreationDate: (3/7/1994) () %%Copyright: ((C) 1987-1994 Adobe Systems Incorporated All Rights Reserved) currentpacking true setpacking userdict /Adobe_IllustratorA_AI5_vars 70 dict dup begin put /_lp /none def /_pf |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | { 0 eq { (%AI5_BeginLayer) 1 (%AI5_EndLayer--) discard } { /clipForward? true def | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | { 0 eq { (%AI5_BeginLayer) 1 (%AI5_EndLayer--) discard } { /clipForward? true def /Tx /pop load def /Tj /pop load def currentdict end clipRenderOff begin begin } ifelse } { 0 eq |
︙ | ︙ | |||
1085 1086 1087 1088 1089 1090 1091 | pop clipForward? { currentdict end end begin | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | pop clipForward? { currentdict end end begin /clipForward? false ddef } if } ifelse } bind def /Pb { pop pop |
︙ | ︙ |
Changes to library/images/pwrdLogo.eps.
︙ | ︙ | |||
24 25 26 27 28 29 30 | %AI5_NumLayers: 1 %AI5_OpenToView: 102 564 2 938 673 18 1 1 2 40 %AI5_OpenViewLayers: 7 %%EndComments %%BeginProlog %%BeginResource: procset Adobe_level2_AI5 1.0 0 %%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation) | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | %AI5_NumLayers: 1 %AI5_OpenToView: 102 564 2 938 673 18 1 1 2 40 %AI5_OpenViewLayers: 7 %%EndComments %%BeginProlog %%BeginResource: procset Adobe_level2_AI5 1.0 0 %%Title: (Adobe Illustrator (R) Version 5.0 Level 2 Emulation) %%Version: 1.0 %%CreationDate: (04/10/93) () %%Copyright: ((C) 1987-1993 Adobe Systems Incorporated All Rights Reserved) userdict /Adobe_level2_AI5 21 dict dup begin put /packedarray where not { userdict begin |
︙ | ︙ | |||
73 74 75 76 77 78 79 | 4 index mul 4 1 roll } repeat 5 -1 roll pop setcmykcolor } def } if | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 4 index mul 4 1 roll } repeat 5 -1 roll pop setcmykcolor } def } if /gt38? mark {version cvx exec} stopped {cleartomark true} {38 gt exch pop} ifelse def userdict /deviceDPI 72 0 matrix defaultmatrix dtransform dup mul exch dup mul add sqrt put userdict /level2? systemdict /languagelevel known dup { pop systemdict /languagelevel get 2 ge } if |
︙ | ︙ | |||
174 175 176 177 178 179 180 | /customColor? isCMYKSep? not def end } if end defaultpacking setpacking %%EndResource %%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0 %%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog) | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /customColor? isCMYKSep? not def end } if end defaultpacking setpacking %%EndResource %%BeginResource: procset Adobe_IllustratorA_AI5 1.1 0 %%Title: (Adobe Illustrator (R) Version 5.0 Abbreviated Prolog) %%Version: 1.1 %%CreationDate: (3/7/1994) () %%Copyright: ((C) 1987-1994 Adobe Systems Incorporated All Rights Reserved) currentpacking true setpacking userdict /Adobe_IllustratorA_AI5_vars 70 dict dup begin put /_lp /none def /_pf |
︙ | ︙ | |||
1058 1059 1060 1061 1062 1063 1064 | { 0 eq { (%AI5_BeginLayer) 1 (%AI5_EndLayer--) discard } { /clipForward? true def | | | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | { 0 eq { (%AI5_BeginLayer) 1 (%AI5_EndLayer--) discard } { /clipForward? true def /Tx /pop load def /Tj /pop load def currentdict end clipRenderOff begin begin } ifelse } { 0 eq |
︙ | ︙ | |||
1085 1086 1087 1088 1089 1090 1091 | pop clipForward? { currentdict end end begin | | | 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | pop clipForward? { currentdict end end begin /clipForward? false ddef } if } ifelse } bind def /Pb { pop pop |
︙ | ︙ |
Changes to library/menu.tcl.
︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 | if {![winfo exists $w]} { return } if {[$w cget -state] eq "active" && [tk windowingsystem] ne "aqua"} { $w configure -state normal } } # ::tk::MbPost -- # Given a menubutton, this procedure does all the work of posting # its associated menu and unposting any other menu that is currently # posted. # # Arguments: | > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | if {![winfo exists $w]} { return } if {[$w cget -state] eq "active" && [tk windowingsystem] ne "aqua"} { $w configure -state normal } } # ::tk::MbPost -- # Given a menubutton, this procedure does all the work of posting # its associated menu and unposting any other menu that is currently # posted. # # Arguments: |
︙ | ︙ | |||
278 279 280 281 282 283 284 | $w configure -state active } set Priv(postedMb) $w set Priv(focus) [focus] $menu activate none GenerateMenuSelect $menu | < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | $w configure -state active } set Priv(postedMb) $w set Priv(focus) [focus] $menu activate none GenerateMenuSelect $menu update idletasks if {[catch {PostMenubuttonMenu $w $menu} msg opt]} { # Error posting menu (e.g. bogus -postcommand). Unpost it and # reflect the error. MenuUnpost {} return -options $opt $msg } set Priv(tearoff) $tearoff if {$tearoff != 0 && [tk windowingsystem] ne "aqua"} { focus $menu if {[winfo viewable $w]} { SaveGrabInfo $w grab -global $w } } } |
︙ | ︙ | |||
572 573 574 575 576 577 578 579 | if {[info exists Priv(menuActivated)] \ && $index ne "none" \ && $index ne $activeindex} { set mode [option get $menu clickToFocus ClickToFocus] if {[string is false $mode]} { set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}] if {[$menu type $index] eq "cascade"} { set Priv(menuActivatedTimer) \ | > > | | | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | if {[info exists Priv(menuActivated)] \ && $index ne "none" \ && $index ne $activeindex} { set mode [option get $menu clickToFocus ClickToFocus] if {[string is false $mode]} { set delay [expr {[$menu cget -type] eq "menubar" ? 0 : 50}] if {[$menu type $index] eq "cascade"} { # Catch these postcascade commands since the menu could be # destroyed before they run. set Priv(menuActivatedTimer) \ [after $delay "catch {$menu postcascade active}"] } else { set Priv(menuDeactivatedTimer) \ [after $delay "catch {$menu postcascade none}"] } } } } } # ::tk::MenuButtonDown -- |
︙ | ︙ | |||
1203 1204 1205 1206 1207 1208 1209 1210 1211 | if {$label eq $s} { return $i } } } return "" } # ::tk::PostOverPoint -- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > > | | | > | | > | < < > > > > > | < | < | | | | > | 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 | if {$label eq $s} { return $i } } } return "" } # ::tk::PostMenubuttonMenu -- # # Given a menubutton and a menu, this procedure posts the menu at the # appropriate location. If the menubutton looks like an option # menubutton, meaning that the indicator is on and the direction is # neither above nor below, then the menu is posted so that the current # entry is vertically aligned with the menubutton. On the Mac this # will expose a small amount of the blue indicator on the right hand # side. On other platforms the entry is centered over the button. if {[tk windowingsystem] eq "aqua"} { proc ::tk::PostMenubuttonMenu {button menu} { set entry "" if {[$button cget -indicatoron]} { set entry [MenuFindName $menu [$button cget -text]] if {$entry eq ""} { set entry 0 } } set x [winfo rootx $button] set y [expr {2 + [winfo rooty $button]}] switch [$button cget -direction] { above { set entry "" incr y [expr {4 - [winfo reqheight $menu]}] } below { set entry "" incr y [expr {2 + [winfo height $button]}] } left { incr x [expr {-[winfo reqwidth $menu]}] } right { incr x [winfo width $button] } default { incr x [expr {[winfo width $button] - [winfo reqwidth $menu] - 5}] } } PostOverPoint $menu $x $y $entry } } else { proc ::tk::PostMenubuttonMenu {button menu} { set entry "" if {[$button cget -indicatoron]} { set entry [MenuFindName $menu [$button cget -text]] if {$entry eq ""} { set entry 0 } } set x [winfo rootx $button] set y [winfo rooty $button] switch [$button cget -direction] { above { incr y [expr {-[winfo reqheight $menu]}] # if we go offscreen to the top, show as 'below' if {$y < [winfo vrooty $button]} { set y [expr {[winfo vrooty $button] + [winfo rooty $button]\ + [winfo reqheight $button]}] } set entry {} } below { incr y [winfo height $button] # if we go offscreen to the bottom, show as 'above' set mh [winfo reqheight $menu] if {($y + $mh) > ([winfo vrooty $button] + [winfo vrootheight $button])} { set y [expr {[winfo vrooty $button] + [winfo vrootheight $button] \ + [winfo rooty $button] - $mh}] } set entry {} } left { # It is not clear why this is needed. if {[tk windowingsystem] eq "win32"} { incr x [expr {-4 - [winfo reqwidth $button] / 2}] } incr x [expr {- [winfo reqwidth $menu]}] } right { incr x [expr {[winfo width $button]}] } default { if {[$button cget -indicatoron]} { incr x [expr {([winfo width $button] - \ [winfo reqwidth $menu])/ 2}] } else { incr y [winfo height $button] } } } PostOverPoint $menu $x $y $entry } } # ::tk::PostOverPoint -- # # This procedure posts a menu on the screen so that a given entry in # the menu is positioned with its upper left corner at a given point # in the root window. The procedure also activates that entry. If no # entry is specified the upper left corner of the entire menu is # placed at the point. # # Arguments: # menu - Menu to post. # x, y - Root coordinates of point. # entry - Index of entry within menu to center over (x,y). # If omitted or specified as {}, then the menu's # upper-left corner goes at (x,y). if {[tk windowingsystem] ne "win32"} { proc ::tk::PostOverPoint {menu x y {entry {}}} { if {$entry ne ""} { $menu post $x $y $entry if {[$menu entrycget $entry -state] ne "disabled"} { $menu activate $entry GenerateMenuSelect $menu } } else { $menu post $x $y } return } } else { proc ::tk::PostOverPoint {menu x y {entry {}}} { if {$entry ne ""} { incr y [expr {-[$menu yposition $entry]}] } # osVersion is not available in safe interps set ver 5 if {[info exists ::tcl_platform(osVersion)]} { scan $::tcl_platform(osVersion) %d ver } # We need to fix some problems with menu posting on Windows, # where, if the menu would overlap top or bottom of screen, # Windows puts it in the wrong place for us. We must also # subtract an extra amount for half the height of the current # entry. To be safe we subtract an extra 10. # NOTE: this issue appears to have been resolved in the Window # manager provided with Vista and Windows 7. if {$ver < 6} { set yoffset [expr {[winfo screenheight $menu] \ - $y - [winfo reqheight $menu] - 10}] if {$yoffset < [winfo vrooty $menu]} { # The bottom of the menu is offscreen, so adjust upwards incr y [expr {$yoffset - [winfo vrooty $menu]}] } # If we're off the top of the screen (either because we were # originally or because we just adjusted too far upwards), # then make the menu popup on the top edge. if {$y < [winfo vrooty $menu]} { set y [winfo vrooty $menu] } } $menu post $x $y if {$entry ne "" && [$menu entrycget $entry -state] ne "disabled"} { $menu activate $entry GenerateMenuSelect $menu } } } # ::tk::SaveGrabInfo -- # Sets the variables tk::Priv(oldGrab) and tk::Priv(grabStatus) to record # the state of any existing grab on the w's display. # |
︙ | ︙ |
Changes to library/msgs/cs.msg.
1 | namespace eval ::tk { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | namespace eval ::tk { ::msgcat::mcset cs "&Abort" "&Přerušit" ::msgcat::mcset cs "&About..." "&O programu..." ::msgcat::mcset cs "All Files" "Všechny soubory" ::msgcat::mcset cs "Application Error" "Chyba programu" ::msgcat::mcset cs "Bold Italic" ::msgcat::mcset cs "&Blue" "&Modá" ::msgcat::mcset cs "Cancel" "Zrušit" ::msgcat::mcset cs "&Cancel" "&Zrušit" ::msgcat::mcset cs "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nemohu změnit atkálí adreář na \"%1\$s\".\nPístup odítnut." ::msgcat::mcset cs "Choose Directory" "ýběr adreáře" ::msgcat::mcset cs "Cl&ear" "Sma&zat" ::msgcat::mcset cs "&Clear Console" "&Smazat konzolu" ::msgcat::mcset cs "Color" "Barva" ::msgcat::mcset cs "Console" "Konzole" ::msgcat::mcset cs "&Copy" "&Koírovat" ::msgcat::mcset cs "Cu&t" "V&yíznout" ::msgcat::mcset cs "&Delete" "&Smazat" ::msgcat::mcset cs "Details >>" "Detaily >>" ::msgcat::mcset cs "Directory \"%1\$s\" does not exist." "Adreář \"%1\$s\" neexistuje." ::msgcat::mcset cs "&Directory:" "&Adreář:" ::msgcat::mcset cs "&Edit" "Úpravy" ::msgcat::mcset cs "Error: %1\$s" "Chyba: %1\$s" ::msgcat::mcset cs "E&xit" "&Konec" ::msgcat::mcset cs "&File" "&Soubor" ::msgcat::mcset cs "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Soubor \"%1\$s\" již existuje.\nChcete jej přepsat?" ::msgcat::mcset cs "File \"%1\$s\" already exists.\n\n" "Soubor \"%1\$s\" již existuje.\n\n" ::msgcat::mcset cs "File \"%1\$s\" does not exist." "Soubor \"%1\$s\" neexistuje." ::msgcat::mcset cs "File &name:" "&Jéno souboru:" ::msgcat::mcset cs "File &names:" "&Jéna souborů:" ::msgcat::mcset cs "Files of &type:" "&Typy souborů:" ::msgcat::mcset cs "Fi&les:" "Sou&bory:" ::msgcat::mcset cs "&Filter" "&Filtr" ::msgcat::mcset cs "Fil&ter:" "Fil&tr:" ::msgcat::mcset cs "Font st&yle:" ::msgcat::mcset cs "&Green" "Ze&leá" ::msgcat::mcset cs "&Help" "&ápověda" ::msgcat::mcset cs "Hi" "Ahoj" ::msgcat::mcset cs "&Hide Console" "&Schovat Konzolu" ::msgcat::mcset cs "&Ignore" "&Ignorovat" ::msgcat::mcset cs "Invalid file name \"%1\$s\"." "Špaté jéno souboru \"%1\$s\"." ::msgcat::mcset cs "Log Files" "Log soubory" ::msgcat::mcset cs "&No" "&Ne" ::msgcat::mcset cs "&OK" ::msgcat::mcset cs "OK" ::msgcat::mcset cs "Ok" ::msgcat::mcset cs "Open" "Otevít" ::msgcat::mcset cs "&Open" "&Otevít" ::msgcat::mcset cs "Open Multiple Files" "Otevít íce souborů" ::msgcat::mcset cs "P&aste" "&Vložit" ::msgcat::mcset cs "&Quit" "&Ukončit" ::msgcat::mcset cs "&Red" "Če&rveá" ::msgcat::mcset cs "Replace existing file?" "Nahradit sávaíí soubor?" ::msgcat::mcset cs "&Retry" "Z&novu" ::msgcat::mcset cs "&Save" "&Uložit" ::msgcat::mcset cs "Save As" "Uložit jako" ::msgcat::mcset cs "Save To Log" "Uložit do logu" ::msgcat::mcset cs "Select Log File" "Vybrat log soubor" ::msgcat::mcset cs "Select a file to source" "Vybrat soubor k naháí" ::msgcat::mcset cs "&Selection:" "&ýběr:" ::msgcat::mcset cs "Skip Messages" "Přeskočit zpávy" ::msgcat::mcset cs "&Source..." "&Zdroj..." ::msgcat::mcset cs "Tcl Scripts" "Tcl skripty" ::msgcat::mcset cs "Tcl for Windows" "Tcl pro Windows" ::msgcat::mcset cs "Text Files" "Textoé soubory" ::msgcat::mcset cs "abort" "přerušit" ::msgcat::mcset cs "blue" "modá" ::msgcat::mcset cs "cancel" "zrušit" ::msgcat::mcset cs "extension" "pípona" ::msgcat::mcset cs "extensions" "pípony" ::msgcat::mcset cs "green" "zeleá" ::msgcat::mcset cs "ignore" "ignorovat" ::msgcat::mcset cs "ok" ::msgcat::mcset cs "red" "červeá" ::msgcat::mcset cs "retry" "znovu" ::msgcat::mcset cs "yes" "ano" } |
Changes to library/msgs/de.msg.
1 2 | namespace eval ::tk { ::msgcat::mcset de "&Abort" "&Abbruch" | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | namespace eval ::tk { ::msgcat::mcset de "&Abort" "&Abbruch" ::msgcat::mcset de "&About..." "&Über..." ::msgcat::mcset de "All Files" "Alle Dateien" ::msgcat::mcset de "Application Error" "Applikationsfehler" ::msgcat::mcset de "&Apply" "&Anwenden" ::msgcat::mcset de "Bold" "Fett" ::msgcat::mcset de "Bold Italic" "Fett kursiv" ::msgcat::mcset de "&Blue" "&Blau" ::msgcat::mcset de "Cancel" "Abbruch" ::msgcat::mcset de "&Cancel" "&Abbruch" ::msgcat::mcset de "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kann nicht in das Verzeichnis \"%1\$s\" wechseln.\nKeine Rechte vorhanden." ::msgcat::mcset de "Choose Directory" "Wähle Verzeichnis" ::msgcat::mcset de "Cl&ear" "&Rücksetzen" ::msgcat::mcset de "&Clear Console" "&Konsole löschen" ::msgcat::mcset de "Color" "Farbe" ::msgcat::mcset de "Console" "Konsole" ::msgcat::mcset de "&Copy" "&Kopieren" ::msgcat::mcset de "Cu&t" "Aus&schneiden" ::msgcat::mcset de "&Delete" "&Löschen" ::msgcat::mcset de "Details >>" ::msgcat::mcset de "Directory \"%1\$s\" does not exist." "Das Verzeichnis \"%1\$s\" existiert nicht." ::msgcat::mcset de "&Directory:" "&Verzeichnis:" ::msgcat::mcset de "&Edit" "&Bearbeiten" ::msgcat::mcset de "Effects" "Effekte" ::msgcat::mcset de "Error: %1\$s" "Fehler: %1\$s" ::msgcat::mcset de "E&xit" "&Ende" ::msgcat::mcset de "&File" "&Datei" ::msgcat::mcset de "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Die Datei \"%1\$s\" ist bereits vorhanden.\nWollen sie diese Datei überschreiben ?" ::msgcat::mcset de "File \"%1\$s\" already exists.\n\n" "Die Datei \"%1\$s\" ist bereits vorhanden.\n\n" ::msgcat::mcset de "File \"%1\$s\" does not exist." "Die Datei \"%1\$s\" existiert nicht." ::msgcat::mcset de "File &name:" "Datei&name:" ::msgcat::mcset de "File &names:" "Datei&namen:" ::msgcat::mcset de "Files of &type:" "Dateien des &Typs:" ::msgcat::mcset de "Fi&les:" "Dat&eien:" ::msgcat::mcset de "&Filter" ::msgcat::mcset de "Fil&ter:" ::msgcat::mcset de "Font" "Schriftart" ::msgcat::mcset de "&Font:" "Schriftart:" ::msgcat::mcset de "Font st&yle:" "Schriftschnitt:" ::msgcat::mcset de "&Green" "&Grün" ::msgcat::mcset de "&Help" "&Hilfe" ::msgcat::mcset de "Hi" "Hallo" ::msgcat::mcset de "&Hide Console" "&Konsole unsichtbar machen" ::msgcat::mcset de "&Ignore" "&Ignorieren" ::msgcat::mcset de "Invalid file name \"%1\$s\"." "Ungültiger Dateiname \"%1\$s\"." ::msgcat::mcset de "Italic" "Kursiv" ::msgcat::mcset de "Log Files" "Protokolldatei" ::msgcat::mcset de "&No" "&Nein" ::msgcat::mcset de "&OK" ::msgcat::mcset de "OK" ::msgcat::mcset de "Ok" ::msgcat::mcset de "Open" "Öffnen" ::msgcat::mcset de "&Open" "Ö&ffnen" ::msgcat::mcset de "Open Multiple Files" "Mehrere Dateien \u00F6ffnen" ::msgcat::mcset de "P&aste" "E&infügen" ::msgcat::mcset de "&Quit" "&Beenden" ::msgcat::mcset de "&Red" "&Rot" ::msgcat::mcset de "Regular" "Standard" ::msgcat::mcset de "Replace existing file?" "Existierende Datei ersetzen?" ::msgcat::mcset de "&Retry" "&Wiederholen" ::msgcat::mcset de "Sample" "Beispiel" ::msgcat::mcset de "&Save" "&Speichern" ::msgcat::mcset de "Save As" "Speichern unter" ::msgcat::mcset de "Save To Log" "In Protokoll speichern" ::msgcat::mcset de "Select Log File" "Protokolldatei auswählen" ::msgcat::mcset de "Select a file to source" "Auszuführende Datei auswählen" ::msgcat::mcset de "&Selection:" "Auswah&l:" ::msgcat::mcset de "&Size:" "Schriftgrad:" ::msgcat::mcset de "Show &Hidden Directories" "Zeige versteckte Dateien" ::msgcat::mcset de "Show &Hidden Files and Directories" "Zeige versteckte Dateien und Verzeichnisse" ::msgcat::mcset de "Skip Messages" "Weitere Nachrichten überspringen" ::msgcat::mcset de "&Source..." "&Ausführen..." ::msgcat::mcset de "Stri&keout" "&Durchgestrichen" ::msgcat::mcset de "Tcl Scripts" "Tcl-Skripte" ::msgcat::mcset de "Tcl for Windows" "Tcl für Windows" ::msgcat::mcset de "Text Files" "Textdateien" ::msgcat::mcset de "&Underline" "&Unterstrichen" ::msgcat::mcset de "&Yes" "&Ja" ::msgcat::mcset de "abort" "abbrechen" ::msgcat::mcset de "blue" "blau" ::msgcat::mcset de "cancel" "abbrechen" ::msgcat::mcset de "extension" "Erweiterung" ::msgcat::mcset de "extensions" "Erweiterungen" ::msgcat::mcset de "green" "grün" ::msgcat::mcset de "ignore" "ignorieren" ::msgcat::mcset de "ok" ::msgcat::mcset de "red" "rot" ::msgcat::mcset de "retry" "wiederholen" ::msgcat::mcset de "yes" "ja" } |
Changes to library/msgs/el.msg.
1 2 3 4 5 | ## Messages for the Greek (Hellenic - "el") language. ## Please report any changes/suggestions to: ## [email protected] namespace eval ::tk { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ## Messages for the Greek (Hellenic - "el") language. ## Please report any changes/suggestions to: ## [email protected] namespace eval ::tk { ::msgcat::mcset el "&Abort" "Τερματισμός" ::msgcat::mcset el "About..." "Σχετικά..." ::msgcat::mcset el "All Files" "Όλα τα Αρχεία" ::msgcat::mcset el "Application Error" "Λάθος Εφαρμογής" ::msgcat::mcset el "&Blue" "Μπλε" ::msgcat::mcset el "&Cancel" "Ακύρωση" ::msgcat::mcset el \ "Cannot change to the directory \"%1\$s\".\nPermission denied." \ "Δεν είναι δυνατή η αλλαγή καταλόγου σε \"%1\$s\".\nΗ πρόσβαση δεν επιτρέπεται." ::msgcat::mcset el "Choose Directory" "Επιλογή Καταλόγου" ::msgcat::mcset el "Clear" "Καθαρισμός" ::msgcat::mcset el "Color" "Χρώμα" ::msgcat::mcset el "Console" "Κονσόλα" ::msgcat::mcset el "Copy" "Αντιγραφή" ::msgcat::mcset el "Cut" "Αποκοπή" ::msgcat::mcset el "Delete" "Διαγραφή" ::msgcat::mcset el "Details >>" "Λεπτομέρειες >>" ::msgcat::mcset el "Directory \"%1\$s\" does not exist." \ "Ο κατάλογος \"%1\$s\" δεν υπάρχει." ::msgcat::mcset el "&Directory:" "&Κατάλογος:" ::msgcat::mcset el "Error: %1\$s" "Λάθος: %1\$s" ::msgcat::mcset el "Exit" "Έξοδος" ::msgcat::mcset el \ "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ "Το αρχείο \"%1\$s\" ήδη υπάρχει.\nΘέλετε να επικαλυφθεί;" ::msgcat::mcset el "File \"%1\$s\" already exists.\n\n" \ "Το αρχείο \"%1\$s\" ήδη υπάρχει.\n\n" ::msgcat::mcset el "File \"%1\$s\" does not exist." \ "Το αρχείο \"%1\$s\" δεν υπάρχει." ::msgcat::mcset el "File &name:" "Ό&νομα αρχείου:" ::msgcat::mcset el "File &names:" "Ό&νομα αρχείων:" ::msgcat::mcset el "Files of &type:" "Αρχεία του &τύπου:" ::msgcat::mcset el "Fi&les:" "Αρχεία:" ::msgcat::mcset el "&Filter" "Φίλτρο" ::msgcat::mcset el "Fil&ter:" "Φίλτρο:" ::msgcat::mcset el "&Green" "Πράσινο" ::msgcat::mcset el "Hi" "Γεια" ::msgcat::mcset el "Hide Console" "Απόκρυψη κονσόλας" ::msgcat::mcset el "&Ignore" "Αγνόηση" ::msgcat::mcset el "Invalid file name \"%1\$s\"." \ "Άκυρο όνομα αρχείου \"%1\$s\"." ::msgcat::mcset el "Log Files" "Αρχεία Καταγραφής" ::msgcat::mcset el "&No" "Όχι" ::msgcat::mcset el "&OK" "Εντάξει" ::msgcat::mcset el "OK" "Εντάξει" ::msgcat::mcset el "Ok" "Εντάξει" ::msgcat::mcset el "Open" "Άνοιγμα" ::msgcat::mcset el "&Open" "Άνοιγμα" ::msgcat::mcset el "Open Multiple Files" \ "Άνοιγμα πολλαπλών αρχείων" ::msgcat::mcset el "P&aste" "Επικόλληση" ::msgcat::mcset el "Quit" "Έξοδος" ::msgcat::mcset el "&Red" "Κόκκινο" ::msgcat::mcset el "Replace existing file?" \ "Επικάλυψη υπάρχοντος αρχείου;" ::msgcat::mcset el "&Retry" "Προσπάθησε ξανά" ::msgcat::mcset el "&Save" "Αποθήκευση" ::msgcat::mcset el "Save As" "Αποθήκευση σαν" ::msgcat::mcset el "Save To Log" "Αποθήκευση στο αρχείο καταγραφής" ::msgcat::mcset el "Select Log File" "Επιλογή αρχείου καταγραφής" ::msgcat::mcset el "Select a file to source" \ "Επιλέξτε αρχείο για εκτέλεση" ::msgcat::mcset el "&Selection:" "Επιλογή:" ::msgcat::mcset el "Skip Messages" "Αποφυγήμηνυμάτων" ::msgcat::mcset el "&Source..." "Εκτέλεση..." ::msgcat::mcset el "Tcl Scripts" "Tcl Scripts" ::msgcat::mcset el "Tcl for Windows" "Tcl για Windows" ::msgcat::mcset el "Text Files" "Αρχεία Κειμένου" ::msgcat::mcset el "&Yes" "Ναι" ::msgcat::mcset el "abort" "τερματισμός" ::msgcat::mcset el "blue" "μπλε" ::msgcat::mcset el "cancel" "ακύρωση" ::msgcat::mcset el "extension" "επέκταση" ::msgcat::mcset el "extensions" "επεκτάσεις" ::msgcat::mcset el "green" "πράσινο" ::msgcat::mcset el "ignore" "αγνόηση" ::msgcat::mcset el "ok" "εντάξει" ::msgcat::mcset el "red" "κόκκινο" ::msgcat::mcset el "retry" "προσπάθησε ξανά" ::msgcat::mcset el "yes" "ναι" } |
Changes to library/msgs/eo.msg.
1 | namespace eval ::tk { | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | namespace eval ::tk { ::msgcat::mcset eo "&Abort" "&Ĉesigo" ::msgcat::mcset eo "&About..." "Pri..." ::msgcat::mcset eo "All Files" "Ĉioj dosieroj" ::msgcat::mcset eo "Application Error" "Aplikoerraro" ::msgcat::mcset eo "&Blue" "&Blua" ::msgcat::mcset eo "Cancel" "Rezignu" ::msgcat::mcset eo "&Cancel" "&Rezignu" ::msgcat::mcset eo "Cannot change to the directory \"%1\$s\".\nPermission denied." "Neeble ĉangi al dosierulon \"%1\$s\".\nVi ne rajtas tion." ::msgcat::mcset eo "Choose Directory" "Elektu Dosierujo" ::msgcat::mcset eo "Cl&ear" "&Klaru" ::msgcat::mcset eo "&Clear Console" "&Klaru konzolon" ::msgcat::mcset eo "Color" "Farbo" ::msgcat::mcset eo "Console" "Konzolo" ::msgcat::mcset eo "&Copy" "&Kopiu" ::msgcat::mcset eo "Cu&t" "&Enpoŝigu" ::msgcat::mcset eo "&Delete" "&Forprenu" ::msgcat::mcset eo "Details >>" "Detaloj >>" ::msgcat::mcset eo "Directory \"%1\$s\" does not exist." "La dosierujo \"%1\$s\" ne ekzistas." ::msgcat::mcset eo "&Directory:" "&Dosierujo:" ::msgcat::mcset eo "&Edit" "&Redaktu" ::msgcat::mcset eo "Error: %1\$s" "Eraro: %1\$s" ::msgcat::mcset eo "E&xit" "&Eliru" ::msgcat::mcset eo "&File" "&Dosiero" ::msgcat::mcset eo "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "La dosiero \"%1\$s\" jam ekzistas.\nĈu vi volas anstataûigi la dosieron?" ::msgcat::mcset eo "File \"%1\$s\" already exists.\n\n" "La dosiero \"%1\$s\" jam egzistas. \n\n" ::msgcat::mcset eo "File \"%1\$s\" does not exist." "La dosierp \"%1\$s\" ne estas." ::msgcat::mcset eo "File &name:" "Dosiero&nomo:" ::msgcat::mcset eo "File &names:" "Dosiero&nomoj:" ::msgcat::mcset eo "Files of &type:" "Dosieroj de &Typo:" ::msgcat::mcset eo "Fi&les:" "Do&sieroj:" ::msgcat::mcset eo "&Filter" "&Filtrilo" ::msgcat::mcset eo "Fil&ter:" "&Filtrilo:" ::msgcat::mcset eo "&Green" "&Verda" ::msgcat::mcset eo "&Help" "&Helpu" ::msgcat::mcset eo "Hi" "Saluton" ::msgcat::mcset eo "&Hide Console" "&Kaŝu konzolon" ::msgcat::mcset eo "&Ignore" "&Ignoru" ::msgcat::mcset eo "Invalid file name \"%1\$s\"." "Malvalida dosieronomo \"%1\$s\"." ::msgcat::mcset eo "Log Files" "Protokolo" ::msgcat::mcset eo "&No" "&Ne" ::msgcat::mcset eo "&OK" ::msgcat::mcset eo "OK" ::msgcat::mcset eo "Ok" ::msgcat::mcset eo "Open" "Malfermu" ::msgcat::mcset eo "&Open" "&Malfermu" ::msgcat::mcset eo "Open Multiple Files" "Melfermu multan dosierojn" ::msgcat::mcset eo "P&aste" "&Elpoŝigi" ::msgcat::mcset eo "&Quit" "&Finigu" ::msgcat::mcset eo "&Red" "&Rosa" ::msgcat::mcset eo "Replace existing file?" "Ĉu anstataûu ekzistantan dosieron?" ::msgcat::mcset eo "&Retry" "&Ripetu" ::msgcat::mcset eo "&Save" "&Savu" ::msgcat::mcset eo "Save As" "Savu kiel" ::msgcat::mcset eo "Save To Log" "Savu en protokolon" ::msgcat::mcset eo "Select Log File" "Elektu prokolodosieron" ::msgcat::mcset eo "Select a file to source" "Elektu dosieron por interpreti" ::msgcat::mcset eo "&Selection:" "&Elekto:" ::msgcat::mcset eo "Skip Messages" "transsaltu pluajn mesaĝojn" ::msgcat::mcset eo "&Source..." "&Fontoprogramo..." ::msgcat::mcset eo "Tcl Scripts" "Tcl-skriptoj" ::msgcat::mcset eo "Tcl for Windows" "Tcl por vindoso" ::msgcat::mcset eo "Text Files" "Tekstodosierojn" ::msgcat::mcset eo "&Yes" "&Jes" ::msgcat::mcset eo "abort" "ĉesigo" ::msgcat::mcset eo "blue" "blua" ::msgcat::mcset eo "cancel" "rezignu" ::msgcat::mcset eo "extension" "ekspansio" ::msgcat::mcset eo "extensions" "ekspansioj" ::msgcat::mcset eo "green" "verda" ::msgcat::mcset eo "ignore" "ignorieren" ::msgcat::mcset eo "red" "ruĝa" ::msgcat::mcset eo "retry" "ripetu" ::msgcat::mcset eo "yes" "jes" } |
Changes to library/msgs/es.msg.
1 2 3 4 | namespace eval ::tk { ::msgcat::mcset es "&Abort" "&Abortar" ::msgcat::mcset es "&About..." "&Acerca de ..." ::msgcat::mcset es "All Files" "Todos los archivos" | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | namespace eval ::tk { ::msgcat::mcset es "&Abort" "&Abortar" ::msgcat::mcset es "&About..." "&Acerca de ..." ::msgcat::mcset es "All Files" "Todos los archivos" ::msgcat::mcset es "Application Error" "Error de la aplicación" ::msgcat::mcset es "&Blue" "&Azul" ::msgcat::mcset es "Cancel" "Cancelar" ::msgcat::mcset es "&Cancel" "&Cancelar" ::msgcat::mcset es "Cannot change to the directory \"%1\$s\".\nPermission denied." "No es posible acceder al directorio \"%1\$s\".\nPermiso denegado." ::msgcat::mcset es "Choose Directory" "Elegir directorio" ::msgcat::mcset es "Cl&ear" "&Borrar" ::msgcat::mcset es "&Clear Console" "&Borrar consola" ::msgcat::mcset es "Color" ::msgcat::mcset es "Console" "Consola" ::msgcat::mcset es "&Copy" "&Copiar" ::msgcat::mcset es "Cu&t" "Cor&tar" ::msgcat::mcset es "&Delete" "&Borrar" ::msgcat::mcset es "Details >>" "Detalles >>" ::msgcat::mcset es "Directory \"%1\$s\" does not exist." "El directorio \"%1\$s\" no existe." ::msgcat::mcset es "&Directory:" "&Directorio:" ::msgcat::mcset es "&Edit" "&Editar" ::msgcat::mcset es "Error: %1\$s" ::msgcat::mcset es "E&xit" "Salir" ::msgcat::mcset es "&File" "&Archivo" ::msgcat::mcset es "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "El archivo \"%1\$s\" ya existe.\n¿Desea sobreescribirlo?" ::msgcat::mcset es "File \"%1\$s\" already exists.\n\n" "El archivo \"%1\$s\" ya existe.\n\n" ::msgcat::mcset es "File \"%1\$s\" does not exist." "El archivo \"%1\$s\" no existe." ::msgcat::mcset es "File &name:" "&Nombre de archivo:" ::msgcat::mcset es "File &names:" "&Nombres de archivo:" ::msgcat::mcset es "Files of &type:" "Archivos de &tipo:" ::msgcat::mcset es "Fi&les:" "&Archivos:" ::msgcat::mcset es "&Filter" "&Filtro" ::msgcat::mcset es "Fil&ter:" "Fil&tro:" ::msgcat::mcset es "&Green" "&Verde" ::msgcat::mcset es "&Help" "&Ayuda" ::msgcat::mcset es "Hi" "Hola" ::msgcat::mcset es "&Hide Console" "&Esconder la consola" ::msgcat::mcset es "&Ignore" "&Ignorar" ::msgcat::mcset es "Invalid file name \"%1\$s\"." "Nombre de archivo inválido \"%1\$s\"." ::msgcat::mcset es "Log Files" "Ficheros de traza" ::msgcat::mcset es "&No" ::msgcat::mcset es "&OK" ::msgcat::mcset es "OK" ::msgcat::mcset es "Ok" ::msgcat::mcset es "Open" "Abrir" ::msgcat::mcset es "&Open" "&Abrir" ::msgcat::mcset es "Open Multiple Files" "Abrir múltiples archivos" ::msgcat::mcset es "P&aste" "Peg&ar" ::msgcat::mcset es "&Quit" "&Abandonar" ::msgcat::mcset es "&Red" "&Rojo" ::msgcat::mcset es "Replace existing file?" "¿Reemplazar el archivo existente?" ::msgcat::mcset es "&Retry" "&Reintentar" ::msgcat::mcset es "&Save" "&Guardar" ::msgcat::mcset es "Save As" "Guardar como" ::msgcat::mcset es "Save To Log" "Guardar al archivo de traza" ::msgcat::mcset es "Select Log File" "Elegir un archivo de traza" ::msgcat::mcset es "Select a file to source" "Seleccionar un archivo a evaluar" ::msgcat::mcset es "&Selection:" "&Selección:" ::msgcat::mcset es "Skip Messages" "Omitir los mensajes" ::msgcat::mcset es "&Source..." "E&valuar..." ::msgcat::mcset es "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset es "Tcl for Windows" "Tcl para Windows" ::msgcat::mcset es "Text Files" "Archivos de texto" ::msgcat::mcset es "&Yes" "&Sí" ::msgcat::mcset es "abort" "abortar" ::msgcat::mcset es "blue" "azul" ::msgcat::mcset es "cancel" "cancelar" ::msgcat::mcset es "extension" "extensión" ::msgcat::mcset es "extensions" "extensiones" ::msgcat::mcset es "green" "verde" ::msgcat::mcset es "ignore" "ignorar" ::msgcat::mcset es "ok" ::msgcat::mcset es "red" "rojo" ::msgcat::mcset es "retry" "reintentar" ::msgcat::mcset es "yes" "sí" } |
Changes to library/msgs/fr.msg.
1 2 | namespace eval ::tk { ::msgcat::mcset fr "&Abort" "&Annuler" | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | namespace eval ::tk { ::msgcat::mcset fr "&Abort" "&Annuler" ::msgcat::mcset fr "About..." "À propos..." ::msgcat::mcset fr "All Files" "Tous les fichiers" ::msgcat::mcset fr "Application Error" "Erreur d'application" ::msgcat::mcset fr "&Blue" "&Bleu" ::msgcat::mcset fr "Cancel" "Annuler" ::msgcat::mcset fr "&Cancel" "&Annuler" ::msgcat::mcset fr "Cannot change to the directory \"%1\$s\".\nPermission denied." "Impossible d'accéder au répertoire \"%1\$s\".\nPermission refusée." ::msgcat::mcset fr "Choose Directory" "Choisir répertoire" ::msgcat::mcset fr "Cl&ear" "Effacer" ::msgcat::mcset fr "Color" "Couleur" ::msgcat::mcset fr "Console" ::msgcat::mcset fr "Copy" "Copier" ::msgcat::mcset fr "Cu&t" "Couper" ::msgcat::mcset fr "Delete" "Effacer" ::msgcat::mcset fr "Details >>" "Détails >>" ::msgcat::mcset fr "Directory \"%1\$s\" does not exist." "Le répertoire \"%1\$s\" n'existe pas." ::msgcat::mcset fr "&Directory:" "&Répertoire:" ::msgcat::mcset fr "Error: %1\$s" "Erreur: %1\$s" ::msgcat::mcset fr "E&xit" "Quitter" ::msgcat::mcset fr "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Le fichier \"%1\$s\" existe déjà.\nVoulez-vous l'écraser?" ::msgcat::mcset fr "File \"%1\$s\" already exists.\n\n" "Le fichier \"%1\$s\" existe déjà.\n\n" ::msgcat::mcset fr "File \"%1\$s\" does not exist." "Le fichier \"%1\$s\" n'existe pas." ::msgcat::mcset fr "File &name:" "&Nom de fichier:" ::msgcat::mcset fr "File &names:" "&Noms de fichiers:" ::msgcat::mcset fr "Files of &type:" "&Type de fichiers:" ::msgcat::mcset fr "Fi&les:" "Fich&iers:" ::msgcat::mcset fr "&Filter" "&Filtre" ::msgcat::mcset fr "Fil&ter:" "Fil&tre:" |
︙ | ︙ | |||
41 42 43 44 45 46 47 | ::msgcat::mcset fr "Open" "Ouvrir" ::msgcat::mcset fr "&Open" "&Ouvrir" ::msgcat::mcset fr "Open Multiple Files" "Ouvrir plusieurs fichiers" ::msgcat::mcset fr "P&aste" "Coller" ::msgcat::mcset fr "&Quit" "&Quitter" ::msgcat::mcset fr "&Red" "&Rouge" ::msgcat::mcset fr "Replace existing file?" "Remplacer le fichier existant?" | | | | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | ::msgcat::mcset fr "Open" "Ouvrir" ::msgcat::mcset fr "&Open" "&Ouvrir" ::msgcat::mcset fr "Open Multiple Files" "Ouvrir plusieurs fichiers" ::msgcat::mcset fr "P&aste" "Coller" ::msgcat::mcset fr "&Quit" "&Quitter" ::msgcat::mcset fr "&Red" "&Rouge" ::msgcat::mcset fr "Replace existing file?" "Remplacer le fichier existant?" ::msgcat::mcset fr "&Retry" "&Ré-essayer" ::msgcat::mcset fr "&Save" "&Sauvegarder" ::msgcat::mcset fr "Save As" "Sauvegarder sous" ::msgcat::mcset fr "Save To Log" "Sauvegarde au fichier de trace" ::msgcat::mcset fr "Select Log File" "Choisir un fichier de trace" ::msgcat::mcset fr "Select a file to source" "Choisir un fichier à évaluer" ::msgcat::mcset fr "&Selection:" "&Sélection:" ::msgcat::mcset fr "Skip Messages" "Omettre les messages" ::msgcat::mcset fr "&Source..." "Évaluer..." ::msgcat::mcset fr "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset fr "Tcl for Windows" "Tcl pour Windows" ::msgcat::mcset fr "Text Files" "Fichiers texte" ::msgcat::mcset fr "&Yes" "&Oui" ::msgcat::mcset fr "abort" "abandonner" ::msgcat::mcset fr "blue" "bleu" ::msgcat::mcset fr "cancel" "annuler" ::msgcat::mcset fr "extension" ::msgcat::mcset fr "extensions" ::msgcat::mcset fr "green" "vert" ::msgcat::mcset fr "ignore" "ignorer" ::msgcat::mcset fr "ok" ::msgcat::mcset fr "red" "rouge" ::msgcat::mcset fr "retry" "réessayer" ::msgcat::mcset fr "yes" "oui" } |
Changes to library/msgs/hu.msg.
1 | namespace eval ::tk { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | namespace eval ::tk { ::msgcat::mcset hu "&Abort" "&Megszakítás" ::msgcat::mcset hu "&About..." "Névjegy..." ::msgcat::mcset hu "All Files" "Minden fájl" ::msgcat::mcset hu "Application Error" "Alkalmazás hiba" ::msgcat::mcset hu "&Blue" "&Kék" ::msgcat::mcset hu "Cancel" "Mégsem" ::msgcat::mcset hu "&Cancel" "Még&sem" ::msgcat::mcset hu "Cannot change to the directory \"%1\$s\".\nPermission denied." "A könyvtárváltás nem sikerült: \"%1\$s\".\nHozzáférés megtagadva." ::msgcat::mcset hu "Choose Directory" "Könyvtár kiválasztása" ::msgcat::mcset hu "Cl&ear" "Törlés" ::msgcat::mcset hu "&Clear Console" "&Törlés Konzol" ::msgcat::mcset hu "Color" "Szín" ::msgcat::mcset hu "Console" "Konzol" ::msgcat::mcset hu "&Copy" "&Másolás" ::msgcat::mcset hu "Cu&t" "&Kivágás" ::msgcat::mcset hu "&Delete" "&Törlés" ::msgcat::mcset hu "Details >>" "Részletek >>" ::msgcat::mcset hu "Directory \"%1\$s\" does not exist." "\"%1\$s\" könyvtár nem létezik." ::msgcat::mcset hu "&Directory:" "&Könyvtár:" #::msgcat::mcset hu "&Edit" ::msgcat::mcset hu "Error: %1\$s" "Hiba: %1\$s" ::msgcat::mcset hu "E&xit" "Kilépés" ::msgcat::mcset hu "&File" "&Fájl" ::msgcat::mcset hu "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "\"%1\$s\" fájl már létezik.\nFelülírjam?" ::msgcat::mcset hu "File \"%1\$s\" already exists.\n\n" "\"%1\$s\" fájl már létezik.\n\n" ::msgcat::mcset hu "File \"%1\$s\" does not exist." "\"%1\$s\" fájl nem létezik." ::msgcat::mcset hu "File &name:" "Fájl &neve:" ::msgcat::mcset hu "File &names:" "Fájlok &nevei:" ::msgcat::mcset hu "Files of &type:" "Fájlok &típusa:" ::msgcat::mcset hu "Fi&les:" "Fáj&lok:" ::msgcat::mcset hu "&Filter" "&Szűrő" ::msgcat::mcset hu "Fil&ter:" "S&zűrő:" ::msgcat::mcset hu "&Green" "&Zöld" #::msgcat::mcset hu "&Help" ::msgcat::mcset hu "Hi" "Üdv" ::msgcat::mcset hu "&Hide Console" "Konzol &elrejtése" ::msgcat::mcset hu "&Ignore" "K&ihagyás" ::msgcat::mcset hu "Invalid file name \"%1\$s\"." "Érvénytelen fájlnév: \"%1\$s\"." ::msgcat::mcset hu "Log Files" "Log fájlok" ::msgcat::mcset hu "&No" "&Nem" ::msgcat::mcset hu "&OK" ::msgcat::mcset hu "OK" ::msgcat::mcset hu "Ok" ::msgcat::mcset hu "Open" "Megnyitás" ::msgcat::mcset hu "&Open" "&Megnyitás" ::msgcat::mcset hu "Open Multiple Files" "Több fájl megnyitása" ::msgcat::mcset hu "P&aste" "&Beillesztés" ::msgcat::mcset hu "&Quit" "&Kilépés" ::msgcat::mcset hu "&Red" "&Vörös" ::msgcat::mcset hu "Replace existing file?" "Meglévő fájl cseréje?" ::msgcat::mcset hu "&Retry" "Új&ra" ::msgcat::mcset hu "&Save" "&Mentés" ::msgcat::mcset hu "Save As" "Mentés másként" ::msgcat::mcset hu "Save To Log" "Mentés log fájlba" ::msgcat::mcset hu "Select Log File" "Log fájl kiválasztása" ::msgcat::mcset hu "Select a file to source" "Forrásfájl kiválasztása" ::msgcat::mcset hu "&Selection:" "&Kijelölés:" ::msgcat::mcset hu "Show &Hidden Directories" "&Rejtett könyvtárak megjelenítése" ::msgcat::mcset hu "Show &Hidden Files and Directories" "&Rejtett fájlok és könyvtárak megjelenítése" ::msgcat::mcset hu "Skip Messages" "Üzenetek kihagyása" ::msgcat::mcset hu "&Source..." "&Forrás..." ::msgcat::mcset hu "Tcl Scripts" "Tcl scriptek" ::msgcat::mcset hu "Tcl for Windows" "Tcl Windows-hoz" ::msgcat::mcset hu "Text Files" "Szövegfájlok" ::msgcat::mcset hu "&Yes" "&Igen" ::msgcat::mcset hu "abort" "megszakítás" ::msgcat::mcset hu "blue" "kék" ::msgcat::mcset hu "cancel" "mégsem" ::msgcat::mcset hu "extension" "kiterjesztés" ::msgcat::mcset hu "extensions" "kiterjesztések" ::msgcat::mcset hu "green" "zöld" ::msgcat::mcset hu "ignore" "ignorer" ::msgcat::mcset hu "ok" ::msgcat::mcset hu "red" "vörös" ::msgcat::mcset hu "retry" "újra" ::msgcat::mcset hu "yes" "igen" } |
Changes to library/msgs/it.msg.
︙ | ︙ | |||
16 17 18 19 20 21 22 | ::msgcat::mcset it "Cu&t" "Taglia" ::msgcat::mcset it "Delete" "Cancella" ::msgcat::mcset it "Details >>" "Dettagli >>" ::msgcat::mcset it "Directory \"%1\$s\" does not exist." "La directory \"%1\$s\" non esiste." ::msgcat::mcset it "&Directory:" ::msgcat::mcset it "Error: %1\$s" "Errore: %1\$s" ::msgcat::mcset it "E&xit" "Esci" | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ::msgcat::mcset it "Cu&t" "Taglia" ::msgcat::mcset it "Delete" "Cancella" ::msgcat::mcset it "Details >>" "Dettagli >>" ::msgcat::mcset it "Directory \"%1\$s\" does not exist." "La directory \"%1\$s\" non esiste." ::msgcat::mcset it "&Directory:" ::msgcat::mcset it "Error: %1\$s" "Errore: %1\$s" ::msgcat::mcset it "E&xit" "Esci" ::msgcat::mcset it "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Il file \"%1\$s\" esiste già.\nVuoi sovrascriverlo?" ::msgcat::mcset it "File \"%1\$s\" already exists.\n\n" "Il file \"%1\$s\" esiste già.\n\n" ::msgcat::mcset it "File \"%1\$s\" does not exist." "Il file \"%1\$s\" non esiste." ::msgcat::mcset it "File &name:" "&Nome del file:" ::msgcat::mcset it "File &names:" "&Nomi dei file:" ::msgcat::mcset it "Files of &type:" "File di &tipo:" ::msgcat::mcset it "Fi&les:" "Fi&le:" ::msgcat::mcset it "&Filter" "&Filtro" ::msgcat::mcset it "Fil&ter:" "Fil&tro:" |
︙ | ︙ | |||
54 55 56 57 58 59 60 | ::msgcat::mcset it "Select a file to source" "Scegli un file da eseguire" ::msgcat::mcset it "&Selection:" "&Selezione:" ::msgcat::mcset it "Skip Messages" "Salta i messaggi" ::msgcat::mcset it "Source..." "Esegui..." ::msgcat::mcset it "Tcl Scripts" "Script Tcl" ::msgcat::mcset it "Tcl for Windows" "Tcl per Windows" ::msgcat::mcset it "Text Files" "File di testo" | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | ::msgcat::mcset it "Select a file to source" "Scegli un file da eseguire" ::msgcat::mcset it "&Selection:" "&Selezione:" ::msgcat::mcset it "Skip Messages" "Salta i messaggi" ::msgcat::mcset it "Source..." "Esegui..." ::msgcat::mcset it "Tcl Scripts" "Script Tcl" ::msgcat::mcset it "Tcl for Windows" "Tcl per Windows" ::msgcat::mcset it "Text Files" "File di testo" ::msgcat::mcset it "&Yes" "&Sì" ::msgcat::mcset it "abort" "interrompi" ::msgcat::mcset it "blue" "blu" ::msgcat::mcset it "cancel" "annulla" ::msgcat::mcset it "extension" "estensione" ::msgcat::mcset it "extensions" "estensioni" ::msgcat::mcset it "green" "verde" ::msgcat::mcset it "ignore" "ignora" ::msgcat::mcset it "ok" ::msgcat::mcset it "red" "rosso" ::msgcat::mcset it "retry" "riprova" ::msgcat::mcset it "yes" "sì" } |
Changes to library/msgs/nl.msg.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ::msgcat::mcset nl "&Cancel" "&Annuleren" ::msgcat::mcset nl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan niet naar map \"%1\$s\" gaan.\nU heeft hiervoor geen toestemming." ::msgcat::mcset nl "Choose Directory" "Kies map" ::msgcat::mcset nl "Cl&ear" "Wissen" ::msgcat::mcset nl "&Clear Console" "&Wis Console" ::msgcat::mcset nl "Color" "Kleur" ::msgcat::mcset nl "Console" | | | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ::msgcat::mcset nl "&Cancel" "&Annuleren" ::msgcat::mcset nl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan niet naar map \"%1\$s\" gaan.\nU heeft hiervoor geen toestemming." ::msgcat::mcset nl "Choose Directory" "Kies map" ::msgcat::mcset nl "Cl&ear" "Wissen" ::msgcat::mcset nl "&Clear Console" "&Wis Console" ::msgcat::mcset nl "Color" "Kleur" ::msgcat::mcset nl "Console" ::msgcat::mcset nl "&Copy" "Kopiëren" ::msgcat::mcset nl "Cu&t" "Knippen" ::msgcat::mcset nl "&Delete" "Wissen" ::msgcat::mcset nl "Details >>" ::msgcat::mcset nl "Directory \"%1\$s\" does not exist." "Map \"%1\$s\" bestaat niet." ::msgcat::mcset nl "&Directory:" "&Map:" ::msgcat::mcset nl "&Edit" "Bewerken" ::msgcat::mcset nl "Effects" "Effecten" ::msgcat::mcset nl "Error: %1\$s" "Fout: %1\$s" ::msgcat::mcset nl "E&xit" "Beëindigen" ::msgcat::mcset nl "&File" "Bestand" ::msgcat::mcset nl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Bestand \"%1\$s\" bestaat al.\nWilt u het overschrijven?" ::msgcat::mcset nl "File \"%1\$s\" already exists.\n\n" "Bestand \"%1\$s\" bestaat al.\n\n" ::msgcat::mcset nl "File \"%1\$s\" does not exist." "Bestand \"%1\$s\" bestaat niet." ::msgcat::mcset nl "File &name:" "Bestands&naam:" ::msgcat::mcset nl "File &names:" "Bestands&namen:" ::msgcat::mcset nl "Files of &type:" "Bestanden van het &type:" ::msgcat::mcset nl "Fi&les:" "&Bestanden:" ::msgcat::mcset nl "&Filter" ::msgcat::mcset nl "Fil&ter:" ::msgcat::mcset nl "Font" ::msgcat::mcset nl "&Font:" ::msgcat::mcset nl "Font st&yle:" "Font stijl:" ::msgcat::mcset nl "&Green" "&Groen" ::msgcat::mcset nl "&Help" ::msgcat::mcset nl "Hi" "Hé" ::msgcat::mcset nl "&Hide Console" "Verberg Console" ::msgcat::mcset nl "&Ignore" "&Negeren" ::msgcat::mcset nl "Invalid file name \"%1\$s\"." "Ongeldige bestandsnaam \"%1\$s\"." ::msgcat::mcset nl "Italic" "Cursief" ::msgcat::mcset nl "Log Files" "Log Bestanden" ::msgcat::mcset nl "&No" "&Nee" ::msgcat::mcset nl "&OK" |
︙ | ︙ |
Changes to library/msgs/pl.msg.
1 2 3 4 | namespace eval ::tk { ::msgcat::mcset pl "&Abort" "&Przerwij" ::msgcat::mcset pl "&About..." "O programie..." ::msgcat::mcset pl "All Files" "Wszystkie pliki" | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | namespace eval ::tk { ::msgcat::mcset pl "&Abort" "&Przerwij" ::msgcat::mcset pl "&About..." "O programie..." ::msgcat::mcset pl "All Files" "Wszystkie pliki" ::msgcat::mcset pl "Application Error" "Błąd w programie" ::msgcat::mcset pl "&Apply" "Zastosuj" ::msgcat::mcset pl "Bold" "Pogrubienie" ::msgcat::mcset pl "Bold Italic" "Pogrubiona kursywa" ::msgcat::mcset pl "&Blue" "&Niebieski" ::msgcat::mcset pl "Cancel" "Anuluj" ::msgcat::mcset pl "&Cancel" "&Anuluj" ::msgcat::mcset pl "Cannot change to the directory \"%1\$s\".\nPermission denied." "Nie można otworzyć katalogu \"%1\$s\".\nOdmowa dostępu." ::msgcat::mcset pl "Choose Directory" "Wybierz katalog" ::msgcat::mcset pl "Cl&ear" "&Wyczyść" ::msgcat::mcset pl "&Clear Console" "&Wyczyść konsolę" ::msgcat::mcset pl "Color" "Kolor" ::msgcat::mcset pl "Console" "Konsola" ::msgcat::mcset pl "&Copy" "&Kopiuj" ::msgcat::mcset pl "Cu&t" "&Wytnij" ::msgcat::mcset pl "&Delete" "&Usuń" ::msgcat::mcset pl "Details >>" "Szczegóły >>" ::msgcat::mcset pl "Directory \"%1\$s\" does not exist." "Katalog \"%1\$s\" nie istnieje." ::msgcat::mcset pl "&Directory:" "&Katalog:" ::msgcat::mcset pl "&Edit" "&Edytuj" ::msgcat::mcset pl "Effects" "Efekty" ::msgcat::mcset pl "Error: %1\$s" "Błąd: %1\$s" ::msgcat::mcset pl "E&xit" "&Wyjdź" ::msgcat::mcset pl "&File" "&Plik" ::msgcat::mcset pl "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Plik \"%1\$s\" już istnieje.\nCzy chcesz go nadpisać?" ::msgcat::mcset pl "File \"%1\$s\" already exists.\n\n" "Plik \"%1\$s\" już istnieje.\n\n" ::msgcat::mcset pl "File \"%1\$s\" does not exist." "Plik \"%1\$s\" nie istnieje." ::msgcat::mcset pl "File &name:" "Nazwa &pliku:" ::msgcat::mcset pl "File &names:" "Nazwy &plików:" ::msgcat::mcset pl "Files of &type:" "Pliki &typu:" ::msgcat::mcset pl "Fi&les:" "Pli&ki:" ::msgcat::mcset pl "&Filter" "&Filtr" ::msgcat::mcset pl "Fil&ter:" "&Filtr:" ::msgcat::mcset pl "Font" "Czcionka" ::msgcat::mcset pl "&Font:" "Czcio&nka:" ::msgcat::mcset pl "Font st&yle:" "&Styl czcionki:" ::msgcat::mcset pl "&Green" "&Zielony" ::msgcat::mcset pl "&Help" "&Pomoc" ::msgcat::mcset pl "Hi" "Witaj" ::msgcat::mcset pl "&Hide Console" "&Ukryj konsolę" ::msgcat::mcset pl "&Ignore" "&Ignoruj" ::msgcat::mcset pl "Invalid file name \"%1\$s\"." "Niewłaściwa nazwa pliku \"%1\$s\"." ::msgcat::mcset pl "Italic" "Kursywa" ::msgcat::mcset pl "Log Files" "Pliki dziennika" ::msgcat::mcset pl "&No" "&Nie" ::msgcat::mcset pl "&OK" ::msgcat::mcset pl "OK" ::msgcat::mcset pl "Ok" ::msgcat::mcset pl "Open" "Otwórz" ::msgcat::mcset pl "&Open" "&Otwórz" ::msgcat::mcset pl "Open Multiple Files" "Otwórz wiele plików" ::msgcat::mcset pl "P&aste" "&Wklej" ::msgcat::mcset pl "&Quit" "&Zakończ" ::msgcat::mcset pl "&Red" "&Czerwony" ::msgcat::mcset pl "Regular" "Regularne" ::msgcat::mcset pl "Replace existing file?" "Czy zastąpić istniejący plik?" ::msgcat::mcset pl "&Retry" "&Ponów" ::msgcat::mcset pl "Sample" "Przykład" ::msgcat::mcset pl "&Save" "&Zapisz" ::msgcat::mcset pl "Save As" "Zapisz jako" ::msgcat::mcset pl "Save To Log" "Wpisz do dziennika" ::msgcat::mcset pl "Select Log File" "Wybierz plik dziennika" ::msgcat::mcset pl "Select a file to source" "Wybierz plik do wykonania" ::msgcat::mcset pl "&Selection:" "&Wybór:" ::msgcat::mcset pl "&Size:" "&Rozmiar:" ::msgcat::mcset pl "Show &Hidden Directories" "Pokaż &ukryte katalogi" ::msgcat::mcset pl "Show &Hidden Files and Directories" "Pokaż &ukryte pliki i katalogi" ::msgcat::mcset pl "Skip Messages" "Pomiń pozostałe komunikaty" ::msgcat::mcset pl "&Source..." "&Kod źródłowy..." ::msgcat::mcset pl "Stri&keout" "&Przekreślenie" ::msgcat::mcset pl "Tcl Scripts" "Skrypty Tcl" ::msgcat::mcset pl "Tcl for Windows" "Tcl dla Windows" ::msgcat::mcset pl "Text Files" "Pliki tekstowe" ::msgcat::mcset pl "&Underline" "Po&dkreślenie" ::msgcat::mcset pl "&Yes" "&Tak" ::msgcat::mcset pl "abort" "przerwij" ::msgcat::mcset pl "blue" "niebieski" ::msgcat::mcset pl "cancel" "anuluj" ::msgcat::mcset pl "extension" "rozszerzenie" ::msgcat::mcset pl "extensions" "rozszerzenia" ::msgcat::mcset pl "green" "zielony" ::msgcat::mcset pl "ignore" "ignoruj" ::msgcat::mcset pl "ok" ::msgcat::mcset pl "red" "czerwony" ::msgcat::mcset pl "retry" "ponów" ::msgcat::mcset pl "yes" "tak" } |
Changes to library/msgs/pt.msg.
1 2 3 4 | namespace eval ::tk { ::msgcat::mcset pt "&Abort" "&Abortar" ::msgcat::mcset pt "About..." "Sobre ..." ::msgcat::mcset pt "All Files" "Todos os arquivos" | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | namespace eval ::tk { ::msgcat::mcset pt "&Abort" "&Abortar" ::msgcat::mcset pt "About..." "Sobre ..." ::msgcat::mcset pt "All Files" "Todos os arquivos" ::msgcat::mcset pt "Application Error" "Erro de aplicação" ::msgcat::mcset pt "&Blue" "&Azul" ::msgcat::mcset pt "Cancel" "Cancelar" ::msgcat::mcset pt "&Cancel" "&Cancelar" ::msgcat::mcset pt "Cannot change to the directory \"%1\$s\".\nPermission denied." "Não foi possível mudar para o diretório \"%1\$s\".\nPermissão negada." ::msgcat::mcset pt "Choose Directory" "Escolha um diretório" ::msgcat::mcset pt "Cl&ear" "Apagar" ::msgcat::mcset pt "&Clear Console" "Apagar Console" ::msgcat::mcset pt "Color" "Cor" ::msgcat::mcset pt "Console" ::msgcat::mcset pt "&Copy" "Copiar" ::msgcat::mcset pt "Cu&t" "Recortar" ::msgcat::mcset pt "&Delete" "Excluir" ::msgcat::mcset pt "Details >>" "Detalhes >>" ::msgcat::mcset pt "Directory \"%1\$s\" does not exist." "O diretório \"%1\$s\" não existe." ::msgcat::mcset pt "&Directory:" "&Diretório:" ::msgcat::mcset pt "Error: %1\$s" "Erro: %1\$s" ::msgcat::mcset pt "E&xit" "Sair" ::msgcat::mcset pt "&File" "Arquivo" ::msgcat::mcset pt "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "O arquivo \"%1\$s\" já existe.\nDeseja sobrescreve-lo?" ::msgcat::mcset pt "File \"%1\$s\" already exists.\n\n" "O arquivo \"%1\$s\" já existe.\n\n" ::msgcat::mcset pt "File \"%1\$s\" does not exist." "Arquivo \"%1\$s\" não existe." ::msgcat::mcset pt "File &name:" "&Nome do arquivo:" ::msgcat::mcset pt "File &names:" "&Nomes dos arquivos:" ::msgcat::mcset pt "Files of &type:" "Arquivos do &tipo:" ::msgcat::mcset pt "Fi&les:" "&Arquivos:" ::msgcat::mcset pt "&Filter" "&Filtro" ::msgcat::mcset pt "Fil&ter:" "Fil&tro:" ::msgcat::mcset pt "&Green" "&Verde" ::msgcat::mcset pt "Hi" "Oi" ::msgcat::mcset pt "&Hide Console" "Ocultar console" ::msgcat::mcset pt "&Ignore" "&Ignorar" ::msgcat::mcset pt "Invalid file name \"%1\$s\"." "O nome do arquivo é inválido \"%1\$s\"." ::msgcat::mcset pt "Log Files" "Arquivos de log" ::msgcat::mcset pt "&No" "&Não" ::msgcat::mcset pt "&OK" ::msgcat::mcset pt "OK" ::msgcat::mcset pt "Ok" ::msgcat::mcset pt "Open" "Abrir" ::msgcat::mcset pt "&Open" "&Abrir" ::msgcat::mcset pt "Open Multiple Files" "Abrir múltiplos arquivos" ::msgcat::mcset pt "P&aste" "Col&ar" ::msgcat::mcset pt "Quit" "Encerrar" ::msgcat::mcset pt "&Red" "&Vermelho" ::msgcat::mcset pt "Replace existing file?" "Substituir arquivo existente?" ::msgcat::mcset pt "&Retry" "Tenta&r novamente" ::msgcat::mcset pt "&Save" "&Salvar" ::msgcat::mcset pt "Save As" "Salvar como" ::msgcat::mcset pt "Save To Log" "Salvar arquivo de log" ::msgcat::mcset pt "Select Log File" "Selecionar arquivo de log" ::msgcat::mcset pt "Select a file to source" "Selecione um arquivo como fonte" ::msgcat::mcset pt "&Selection:" "&Seleção:" ::msgcat::mcset pt "Skip Messages" "Omitir as mensagens" ::msgcat::mcset pt "&Source..." "&Fonte..." ::msgcat::mcset pt "Tcl Scripts" "Scripts Tcl" ::msgcat::mcset pt "Tcl for Windows" "Tcl para Windows" ::msgcat::mcset pt "Text Files" "Arquivos de texto" ::msgcat::mcset pt "&Yes" "&Sim" ::msgcat::mcset pt "abort" "abortar" ::msgcat::mcset pt "blue" "azul" ::msgcat::mcset pt "cancel" "cancelar" ::msgcat::mcset pt "extension" "extensão" ::msgcat::mcset pt "extensions" "extensões" ::msgcat::mcset pt "green" "verde" ::msgcat::mcset pt "ignore" "ignorar" ::msgcat::mcset pt "ok" ::msgcat::mcset pt "red" "vermelho" ::msgcat::mcset pt "retry" "tentar novamente" ::msgcat::mcset pt "yes" "sim" } |
Changes to library/msgs/ru.msg.
1 | namespace eval ::tk { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | namespace eval ::tk { ::msgcat::mcset ru "&Abort" "&Отменить" ::msgcat::mcset ru "&About..." "Про..." ::msgcat::mcset ru "All Files" "Все файлы" ::msgcat::mcset ru "Application Error" "Ошибка в программе" ::msgcat::mcset ru "&Blue" " &Голубой" ::msgcat::mcset ru "Cancel" "От&мена" ::msgcat::mcset ru "&Cancel" "От&мена" ::msgcat::mcset ru "Cannot change to the directory \"%1\$s\".\nPermission denied." \ "Не могу перейти в каталог \"%1\$s\".\nНедостаточно прав доступа" ::msgcat::mcset ru "Choose Directory" "Выберите каталог" ::msgcat::mcset ru "Cl&ear" "Очистить" ::msgcat::mcset ru "Color" "Цвет" ::msgcat::mcset ru "Console" "Консоль" ::msgcat::mcset ru "&Copy" "Копировать" ::msgcat::mcset ru "Cu&t" "Вырезать" ::msgcat::mcset ru "&Delete" "Удалить" ::msgcat::mcset ru "Details >>" "Подробнее >>" ::msgcat::mcset ru "Directory \"%1\$s\" does not exist." "Каталога \"%1\$s\" не существует." ::msgcat::mcset ru "&Directory:" "&Каталог:" ::msgcat::mcset ru "Error: %1\$s" "Ошибка: %1\$s" ::msgcat::mcset ru "E&xit" "Выход" ::msgcat::mcset ru "File \"%1\$s\" already exists.\nDo you want to overwrite it?" \ "Файл \"%1\$s\" уже существует.\nЗаменить его?" ::msgcat::mcset ru "File \"%1\$s\" already exists.\n\n" "Файл \"%1\$s\" уже существует.\n\n" ::msgcat::mcset ru "File \"%1\$s\" does not exist." "Файл \"%1\$s\" не найден." ::msgcat::mcset ru "File &name:" "&Имя файла:" ::msgcat::mcset ru "File &names:" "&Имена файлов:" ::msgcat::mcset ru "Files of &type:" "&Тип файлов:" ::msgcat::mcset ru "Fi&les:" "Фай&лы:" ::msgcat::mcset ru "&Filter" "&Фильтр" ::msgcat::mcset ru "Fil&ter:" "Филь&тр:" ::msgcat::mcset ru "&Green" " &Зеленый" ::msgcat::mcset ru "Hi" "Привет" ::msgcat::mcset ru "&Hide Console" "Спрятать консоль" ::msgcat::mcset ru "&Ignore" "&Игнорировать" ::msgcat::mcset ru "Invalid file name \"%1\$s\"." "Неверное имя файла \"%1\$s\"." ::msgcat::mcset ru "Log Files" "Файлы журнала" ::msgcat::mcset ru "&No" "&Нет" ::msgcat::mcset ru "&OK" "&ОК" ::msgcat::mcset ru "OK" "ОК" ::msgcat::mcset ru "Ok" "Да" ::msgcat::mcset ru "Open" "Открыть" ::msgcat::mcset ru "&Open" "&Открыть" ::msgcat::mcset ru "Open Multiple Files" "Открыть несколько файлов" ::msgcat::mcset ru "P&aste" "Вставить" ::msgcat::mcset ru "&Quit" "Выход" ::msgcat::mcset ru "&Red" " &Красный" ::msgcat::mcset ru "Replace existing file?" "Заменить существующий файл?" ::msgcat::mcset ru "&Retry" "&Повторить" ::msgcat::mcset ru "&Save" "&Сохранить" ::msgcat::mcset ru "Save As" "Сохранить как" ::msgcat::mcset ru "Save To Log" "Сохранить в журнал" ::msgcat::mcset ru "Select Log File" "Выбрать журнал" ::msgcat::mcset ru "Select a file to source" "Выберите файл для интерпретации" ::msgcat::mcset ru "&Selection:" ::msgcat::mcset ru "Skip Messages" "Пропустить сообщения" ::msgcat::mcset ru "&Source..." "Интерпретировать файл..." ::msgcat::mcset ru "Tcl Scripts" "Программа на языке TCL" ::msgcat::mcset ru "Tcl for Windows" "TCL для Windows" ::msgcat::mcset ru "Text Files" "Текстовые файлы" ::msgcat::mcset ru "&Yes" "&Да" ::msgcat::mcset ru "abort" "отмена" ::msgcat::mcset ru "blue" " голубой" ::msgcat::mcset ru "cancel" "отмена" ::msgcat::mcset ru "extension" "расширение" ::msgcat::mcset ru "extensions" "расширения" ::msgcat::mcset ru "green" " зеленый" ::msgcat::mcset ru "ignore" "пропустить" ::msgcat::mcset ru "ok" "ок" ::msgcat::mcset ru "red" " красный" ::msgcat::mcset ru "retry" "повторить" ::msgcat::mcset ru "yes" "да" } |
Changes to library/msgs/sv.msg.
1 2 3 4 5 | namespace eval ::tk { ::msgcat::mcset sv "&Abort" "&Avsluta" ::msgcat::mcset sv "&About..." "&Om..." ::msgcat::mcset sv "All Files" "Samtliga filer" ::msgcat::mcset sv "Application Error" "Programfel" | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | namespace eval ::tk { ::msgcat::mcset sv "&Abort" "&Avsluta" ::msgcat::mcset sv "&About..." "&Om..." ::msgcat::mcset sv "All Files" "Samtliga filer" ::msgcat::mcset sv "Application Error" "Programfel" ::msgcat::mcset sv "&Blue" "&Blå" ::msgcat::mcset sv "Cancel" "Avbryt" ::msgcat::mcset sv "&Cancel" "&Avbryt" ::msgcat::mcset sv "Cannot change to the directory \"%1\$s\".\nPermission denied." "Kan ej nå mappen \"%1\$s\".\nSaknar rättigheter." ::msgcat::mcset sv "Choose Directory" "Välj mapp" ::msgcat::mcset sv "Cl&ear" "&Radera" ::msgcat::mcset sv "&Clear Console" "&Radera konsollen" ::msgcat::mcset sv "Color" "Färg" ::msgcat::mcset sv "Console" "Konsoll" ::msgcat::mcset sv "&Copy" "&Kopiera" ::msgcat::mcset sv "Cu&t" "Klipp u&t" ::msgcat::mcset sv "&Delete" "&Radera" ::msgcat::mcset sv "Details >>" "Detaljer >>" ::msgcat::mcset sv "Directory \"%1\$s\" does not exist." "Mappen \"%1\$s\" finns ej." ::msgcat::mcset sv "&Directory:" "&Mapp:" ::msgcat::mcset sv "&Edit" "R&edigera" ::msgcat::mcset sv "Error: %1\$s" "Fel: %1\$s" ::msgcat::mcset sv "E&xit" "&Avsluta" ::msgcat::mcset sv "&File" "&Fil" ::msgcat::mcset sv "File \"%1\$s\" already exists.\nDo you want to overwrite it?" "Filen \"%1\$s\" finns redan.\nVill du skriva över den?" ::msgcat::mcset sv "File \"%1\$s\" already exists.\n\n" "Filen \"%1\$s\" finns redan.\n\n" ::msgcat::mcset sv "File \"%1\$s\" does not exist." "Filen \"%1\$s\" finns ej." ::msgcat::mcset sv "File &name:" "Fil&namn:" ::msgcat::mcset sv "File &names:" "Fil&namn:" ::msgcat::mcset sv "Files of &type:" "Filer av &typ:" ::msgcat::mcset sv "Fi&les:" "Fi&ler:" ::msgcat::mcset sv "&Filter" ::msgcat::mcset sv "Fil&ter:" ::msgcat::mcset sv "&Green" "&Grön" ::msgcat::mcset sv "&Help" "&Hjälp" ::msgcat::mcset sv "Hi" "Hej" ::msgcat::mcset sv "&Hide Console" "&Göm konsollen" ::msgcat::mcset sv "&Ignore" "&Ignorera" ::msgcat::mcset sv "Invalid file name \"%1\$s\"." "Ogiltigt filnamn \"%1\$s\"." ::msgcat::mcset sv "Log Files" "Loggfiler" ::msgcat::mcset sv "&No" "&Nej" ::msgcat::mcset sv "&OK" ::msgcat::mcset sv "OK" ::msgcat::mcset sv "Ok" ::msgcat::mcset sv "Open" "Öppna" ::msgcat::mcset sv "&Open" "&Öppna" ::msgcat::mcset sv "Open Multiple Files" "Öppna flera filer" ::msgcat::mcset sv "P&aste" "&Klistra in" ::msgcat::mcset sv "&Quit" "&Avsluta" ::msgcat::mcset sv "&Red" "&Röd" ::msgcat::mcset sv "Replace existing file?" "Ersätt existerande fil?" ::msgcat::mcset sv "&Retry" "&Försök igen" ::msgcat::mcset sv "&Save" "&Spara" ::msgcat::mcset sv "Save As" "Spara som" ::msgcat::mcset sv "Save To Log" "Spara till logg" ::msgcat::mcset sv "Select Log File" "Välj loggfil" ::msgcat::mcset sv "Select a file to source" "Välj källfil" ::msgcat::mcset sv "&Selection:" "&Val:" ::msgcat::mcset sv "Skip Messages" "Hoppa över meddelanden" ::msgcat::mcset sv "&Source..." "&Källa..." ::msgcat::mcset sv "Tcl Scripts" "Tcl skript" ::msgcat::mcset sv "Tcl for Windows" "Tcl för Windows" ::msgcat::mcset sv "Text Files" "Textfiler" ::msgcat::mcset sv "&Yes" "&Ja" ::msgcat::mcset sv "abort" "avbryt" ::msgcat::mcset sv "blue" "blå" ::msgcat::mcset sv "cancel" "avbryt" ::msgcat::mcset sv "extension" "utvidgning" ::msgcat::mcset sv "extensions" "utvidgningar" ::msgcat::mcset sv "green" "grön" ::msgcat::mcset sv "ignore" "ignorera" ::msgcat::mcset sv "ok" ::msgcat::mcset sv "red" "röd" ::msgcat::mcset sv "retry" "försök igen" ::msgcat::mcset sv "yes" "ja" } |
Changes to library/tclIndex.
︙ | ︙ | |||
243 244 245 246 247 248 249 | set auto_index(::tk::MotifFDialog_FilterCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::MotifFDialog_CancelCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Set) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]] | < | 243 244 245 246 247 248 249 250 251 252 | set auto_index(::tk::MotifFDialog_FilterCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::MotifFDialog_CancelCmd) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Set) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Unset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Key) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Goto) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::ListBoxKeyAccel_Reset) [list source [file join $dir xmfbox.tcl]] set auto_index(::tk::unsupported::ExposePrivateCommand) [list source [file join $dir unsupported.tcl]] set auto_index(::tk::unsupported::ExposePrivateVariable) [list source [file join $dir unsupported.tcl]] set auto_index(::tk::fontchooser) [list source [file join $dir fontchooser.tcl]] |
Changes to library/text.tcl.
︙ | ︙ | |||
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # and auto-scanning. # #------------------------------------------------------------------------- #------------------------------------------------------------------------- # The code below creates the default class bindings for text widgets. #------------------------------------------------------------------------- # Standard Motif bindings: bind Text <1> { tk::TextButton1 %W %x %y %W tag remove sel 0.0 end } bind Text <B1-Motion> { set tk::Priv(x) %x | > > > > > > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # and auto-scanning. # #------------------------------------------------------------------------- #------------------------------------------------------------------------- # The code below creates the default class bindings for text widgets. #------------------------------------------------------------------------- # Standard Motif bindings: bind Text <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } bind Text <1> { tk::TextButton1 %W %x %y %W tag remove sel 0.0 end } bind Text <B1-Motion> { set tk::Priv(x) %x |
︙ | ︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | } bind Text <B1-Enter> { tk::CancelRepeat } bind Text <ButtonRelease-1> { tk::CancelRepeat } bind Text <Control-1> { %W mark set insert @%x,%y # An operation that moves the insert mark without making it # one end of the selection must insert an autoseparator if {[%W cget -autoseparators]} { %W edit separator } | > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | } bind Text <B1-Enter> { tk::CancelRepeat } bind Text <ButtonRelease-1> { tk::CancelRepeat } bind Text <Control-1> { %W mark set insert @%x,%y # An operation that moves the insert mark without making it # one end of the selection must insert an autoseparator if {[%W cget -autoseparators]} { %W edit separator } |
︙ | ︙ | |||
1201 1202 1203 1204 1205 1206 1207 | if {($x != $Priv(x)) || ($y != $Priv(y))} { set Priv(mouseMoved) 1 } if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} { $w scan dragto $x $y } } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 | if {($x != $Priv(x)) || ($y != $Priv(y))} { set Priv(mouseMoved) 1 } if {[info exists Priv(mouseMoved)] && $Priv(mouseMoved)} { $w scan dragto $x $y } } # ::tk::TextUndoRedoProcessMarks -- # # This proc is executed after an undo or redo action. # It processes the list of undo/redo marks temporarily set in the # text widget to positions delimiting where changes happened, and # returns a flat list of ranges. The temporary marks are removed # from the text widget. # # Arguments: # w - The text widget proc ::tk::TextUndoRedoProcessMarks {w} { set indices {} set undoMarks {} # only consider the temporary marks set by an undo/redo action foreach mark [$w mark names] { if {[string range $mark 0 11] eq "tk::undoMark"} { lappend undoMarks $mark } } # transform marks into indices # the number of undo/redo marks is always even, each right mark # completes a left mark to give a range # this is true because: # - undo/redo only deals with insertions and deletions of text # - insertions may move marks but not delete them # - when deleting text, marks located inside the deleted range # are not erased but moved to the start of the deletion range # . this is done in TkBTreeDeleteIndexRange ("This segment # refuses to die...") # . because MarkDeleteProc does nothing else than returning # a value indicating that marks are not deleted by this # deleteProc # . mark deletion rather happen through [.text mark unset xxx] # which was not used _up to this point of the code_ (it # is a bit later just before exiting the present proc) set nUndoMarks [llength $undoMarks] set n [expr {$nUndoMarks / 2}] set undoMarks [lsort -dictionary $undoMarks] set Lmarks [lrange $undoMarks 0 [expr {$n - 1}]] set Rmarks [lrange $undoMarks $n [llength $undoMarks]] foreach Lmark $Lmarks Rmark $Rmarks { lappend indices [$w index $Lmark] [$w index $Rmark] $w mark unset $Lmark $Rmark } # process ranges to: # - remove those already fully included in another range # - merge overlapping ranges set ind [lsort -dictionary -stride 2 $indices] set indices {} for {set i 0} {$i < $nUndoMarks} {incr i 2} { set il1 [lindex $ind $i] set ir1 [lindex $ind [expr {$i + 1}]] lappend indices $il1 $ir1 for {set j [expr {$i + 2}]} {$j < $nUndoMarks} {incr j 2} { set il2 [lindex $ind $j] set ir2 [lindex $ind [expr {$j + 1}]] if {[$w compare $il2 > $ir1]} { # second range starts after the end of first range # -> further second ranges do not need to be considered # because ranges were sorted by increasing first index set j $nUndoMarks } else { if {[$w compare $ir2 > $ir1]} { # second range overlaps first range # -> merge them into a single range set indices [lreplace $indices end-1 end] lappend indices $il1 $ir2 } else { # second range is fully included in first range # -> ignore it } # in both cases above, the second range shall be # trimmed out from the list of ranges set ind [lreplace $ind $j [expr {$j + 1}]] incr j -2 incr nUndoMarks -2 } } } return $indices } |
Changes to library/tk.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # tk.tcl -- # # Initialization script normally executed in the interpreter for each Tk-based # application. Arranges class bindings for widgets. # # Copyright (c) 1992-1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-2000 Ajuba Solutions. # # See the file "license.terms" for information on usage and redistribution of # this file, and for a DISCLAIMER OF ALL WARRANTIES. # Verify that we have Tk binary and script components from the same release package require -exact Tk 8.7a2 # Create a ::tk namespace namespace eval ::tk { # Set up the msgcat commands namespace eval msgcat { namespace export mc mcmax if {[interp issafe] || [catch {package require msgcat}]} { |
︙ | ︙ | |||
672 673 674 675 676 677 678 | if {$length > $maxlen} { set maxlen $length } } return $maxlen } | | > > > > > > > | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 | if {$length > $maxlen} { set maxlen $length } } return $maxlen } # For now, turn off the custom mdef proc for the Mac: if {[tk windowingsystem] eq "aqua"} { namespace eval ::tk::mac { set useCustomMDEF 0 } } #register to send data to macOS Services if {[tk windowingsystem] eq "aqua"} { proc ::tk::RegisterServiceWidget {w} { ::tk::mac::registerServiceWidget $w } } # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { uplevel \#0 [list source $::ttk::library/ttk.tcl] } # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to library/ttk/altTheme.tcl.
︙ | ︙ | |||
92 93 94 95 96 97 98 | ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ | < < | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | ; # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] ttk::style configure TScale \ -groovewidth 4 -troughrelief sunken \ -sliderwidth raised -borderwidth 2 ttk::style configure TProgressbar \ -background $colors(-selectbg) -borderwidth 0 |
︙ | ︙ |
Changes to library/ttk/aquaTheme.tcl.
1 2 3 4 5 6 7 8 9 | # # Aqua theme (OSX native look and feel) # namespace eval ttk::theme::aqua { ttk::style theme settings aqua { ttk::style configure . \ -font TkDefaultFont \ | | | | | > | | > | | > | > > > > > > > > > > > < < | > > > > > > | > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > | > > > | > > > | < < | < < < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | # # Aqua theme (OSX native look and feel) # namespace eval ttk::theme::aqua { ttk::style theme settings aqua { ttk::style configure . \ -font TkDefaultFont \ -background systemWindowBackgroundColor \ -foreground systemLabelColor \ -selectbackground systemHighlight \ -selectforeground systemLabelColor \ -selectborderwidth 0 \ -insertwidth 1 ttk::style map . \ -foreground { disabled systemDisabledControlTextColor background systemLabelColor} \ -selectbackground { background systemSelectedTextBackgroundColor !focus systemSelectedTextBackgroundColor} \ -selectforeground { background systemSelectedTextColor !focus systemSelectedTextColor} # Button ttk::style configure TButton -anchor center -width -6\ -foreground systemControlTextColor ttk::style configure TMenubutton -anchor center -padding {2 0 0 2} ttk::style configure Toolbutton -anchor center # Entry ttk::style configure TEntry \ -foreground systemTextColor \ -background systemTextBackgroundColor \ # Workaround for #1100117: # Actually, on Aqua we probably shouldn't stipple images in # disabled buttons even if it did work... ttk::style configure . -stipple {} # Notebook ttk::style configure TNotebook -tabmargins {10 0} -tabposition n ttk::style configure TNotebook -padding {18 8 18 17} ttk::style configure TNotebook.Tab -padding {12 3 12 2} ttk::style configure TNotebook.Tab -foreground systemControlTextColor ttk::style map TNotebook.Tab \ -foreground { background systemControlTextColor disabled systemDisabledControlTextColor selected systemSelectedTabTextColor} # Combobox: ttk::style configure TCombobox \ -foreground systemTextColor \ -background systemTransparent \ -selectforeground systemSelectedTextColor \ -selectbackground systemSelectedTextBackgroundColor ttk::style map TCombobox \ -foreground { disabled systemDisabledControlTextColor } \ -selectforeground { !active systemTextColor } \ -selectbackground { !active systemTextBackgroundColor !focus systemTextBackgroundColor focus systemSelectedTextBackgroundColor } # Spinbox ttk::style configure TSpinbox \ -foreground systemTextColor \ -background systemTextBackgroundColor \ -selectforeground systemSelectedTextColor \ -selectbackground systemSelectedTextBackgroundColor ttk::style map TSpinbox \ -foreground { disabled systemDisabledControlTextColor } \ -selectforeground { !active systemTextColor } \ -selectbackground { !active systemTextBackgroundColor !focus systemTextBackgroundColor focus systemSelectedTextBackgroundColor } # Treeview: ttk::style configure Heading \ -font TkHeadingFont \ -foreground systemTextColor \ -background systemWindowBackgroundColor ttk::style configure Treeview -rowheight 18 \ -background systemTextBackgroundColor \ -foreground systemTextColor \ -fieldbackground systemTextBackgroundColor ttk::style map Treeview \ -background { selected systemSelectedTextBackgroundColor } # Enable animation for ttk::progressbar widget: ttk::style configure TProgressbar -period 100 -maxphase 255 # For Aqua, labelframe labels should appear outside the border, # with a 14 pixel inset and 4 pixels spacing between border and label # (ref: Apple Human Interface Guidelines / Controls / Grouping Controls) |
︙ | ︙ |
Changes to library/ttk/button.tcl.
1 2 3 4 5 6 7 8 9 10 | # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # # Notes: <Button1-Leave>, <Button1-Enter> only control the "pressed" # state; widgets remain "active" if the pointer is dragged out. # This doesn't seem to be conventional, but it's a nice way # to provide extra feedback while the grab is active. # (If the button is released off the widget, the grab deactivates and # we get a <Leave> event then, which turns off the "active" state) # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # # Bindings for Buttons, Checkbuttons, and Radiobuttons. # # Notes: <Button1-Leave>, <Button1-Enter> only control the "pressed" # state; widgets remain "active" if the pointer is dragged out. # This doesn't seem to be conventional, but it's a nice way # to provide extra feedback while the grab is active. # (If the button is released off the widget, the grab deactivates and # we get a <Leave> event then, which turns off the "active" state) # # Normally, <ButtonRelease> and <ButtonN-Enter/Leave> events are # delivered to the widget which received the initial <ButtonPress> # event. However, Tk [grab]s (#1223103) and menu interactions # (#1222605) can interfere with this. To guard against spurious # <Button1-Enter> events, the <Button1-Enter> binding only sets # the pressed state if the button is currently active. # |
︙ | ︙ |
Changes to library/ttk/clamTheme.tcl.
1 2 3 4 5 6 7 | # # "Clam" theme. # # Inspired by the XFCE family of Gnome themes. # namespace eval ttk::theme::clam { | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # # "Clam" theme. # # Inspired by the XFCE family of Gnome themes. # namespace eval ttk::theme::clam { variable colors array set colors { -disabledfg "#999999" -frame "#dcdad5" -window "#ffffff" -dark "#cfcdc8" -darker "#bab5ab" -darkest "#9e9a91" |
︙ | ︙ | |||
128 129 130 131 132 133 134 | # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ | < < | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | # Treeview: ttk::style configure Heading \ -font TkHeadingFont -relief raised -padding {3} ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] ttk::style configure TLabelframe \ -labeloutside true -labelmargins {0 0 0 4} \ -borderwidth 2 -relief raised ttk::style configure TProgressbar -background $colors(-frame) ttk::style configure Sash -sashthickness 6 -gripcount 10 } } |
Changes to library/ttk/classicTheme.tcl.
︙ | ︙ | |||
95 96 97 98 99 100 101 | ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ | < < | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | ttk::style map TNotebook.Tab -background [list selected $colors(-frame)] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background $colors(-window) ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] # # Toolbar buttons: # ttk::style configure Toolbutton -padding 2 -relief flat -shiftrelief 2 ttk::style map Toolbutton -relief \ |
︙ | ︙ |
Changes to library/ttk/combobox.tcl.
︙ | ︙ | |||
247 248 249 250 251 252 253 | ## UnmapPopdown -- <Unmap> binding for ComboboxPopdown # proc ttk::combobox::UnmapPopdown {w} { [winfo parent $w] state !pressed ttk::releaseGrab $w } | < < < < < < < < < < < < < < | | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | ## UnmapPopdown -- <Unmap> binding for ComboboxPopdown # proc ttk::combobox::UnmapPopdown {w} { [winfo parent $w] state !pressed ttk::releaseGrab $w } ## PopdownWindow -- # Returns the popdown widget associated with a combobox, # creating it if necessary. # proc ttk::combobox::PopdownWindow {cb} { if {![winfo exists $cb.popdown]} { set poplevel [PopdownToplevel $cb.popdown] set popdown [ttk::frame $poplevel.f -style ComboboxPopdownFrame] ttk::scrollbar $popdown.sb \ -orient vertical -command [list $popdown.l yview] listbox $popdown.l \ -listvariable ttk::combobox::Values($cb) \ -yscrollcommand [list $popdown.sb set] \ -exportselection false \ -selectmode browse \ -activestyle none \ |
︙ | ︙ |
Changes to library/ttk/defaults.tcl.
︙ | ︙ | |||
39 40 41 42 43 44 45 | [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style configure TButton \ -anchor center -padding "3 3" -width -9 \ -relief raised -shiftrelief 1 | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | [list disabled $colors(-frame) active $colors(-activebg)] ttk::style map "." -foreground \ [list disabled $colors(-disabledfg)] ttk::style configure TButton \ -anchor center -padding "3 3" -width -9 \ -relief raised -shiftrelief 1 ttk::style map TButton -relief [list {!disabled pressed} sunken] ttk::style configure TCheckbutton \ -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1 ttk::style map TCheckbutton -indicatorcolor \ [list pressed $colors(-activebg) \ {!disabled alternate} $colors(-altindicator) \ {disabled alternate} $colors(-disabledaltindicator) \ |
︙ | ︙ | |||
107 108 109 110 111 112 113 | # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ -background $colors(-window) \ -foreground $colors(-text) ; ttk::style map Treeview \ -background [list disabled $colors(-frame)\ | < < | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | # ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview \ -background $colors(-window) \ -foreground $colors(-text) ; ttk::style map Treeview \ -background [list disabled $colors(-frame)\ selected $colors(-selectbg)] \ -foreground [list disabled $colors(-disabledfg) \ selected $colors(-selectfg)] # Combobox popdown frame ttk::style layout ComboboxPopdownFrame { ComboboxPopdownFrame.border -sticky nswe } ttk::style configure ComboboxPopdownFrame \ |
︙ | ︙ |
Changes to library/ttk/entry.tcl.
︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # Judgment call. If <Meta> happens to be assigned to the Alt key, # these could conflict with application accelerators. # (Plus, who has a Meta key these days?) # <Control-Key-t>: # Another judgment call. If anyone misses this, let me know # and I'll put it back. # ## Clipboard events: # bind TEntry <<Cut>> { ttk::entry::Cut %W } bind TEntry <<Copy>> { ttk::entry::Copy %W } bind TEntry <<Paste>> { ttk::entry::Paste %W } bind TEntry <<Clear>> { ttk::entry::Clear %W } | > > > > > > > | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # Judgment call. If <Meta> happens to be assigned to the Alt key, # these could conflict with application accelerators. # (Plus, who has a Meta key these days?) # <Control-Key-t>: # Another judgment call. If anyone misses this, let me know # and I'll put it back. # ##Bindings to register with macOS Services API. bind T.Entry <Map> { if {[tk windowingsystem] eq "aqua"} { ::tk::RegisterServiceWidget %W } } ## Clipboard events: # bind TEntry <<Cut>> { ttk::entry::Cut %W } bind TEntry <<Copy>> { ttk::entry::Copy %W } bind TEntry <<Paste>> { ttk::entry::Paste %W } bind TEntry <<Clear>> { ttk::entry::Clear %W } |
︙ | ︙ | |||
207 208 209 210 211 212 213 | } return $pos } ## See $index -- Make sure that the character at $index is visible. # proc ttk::entry::See {w {index insert}} { | < | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | } return $pos } ## See $index -- Make sure that the character at $index is visible. # proc ttk::entry::See {w {index insert}} { set c [$w index $index] # @@@ OR: check [$w index left] / [$w index right] if {$c < [$w index @0] || $c >= [$w index @[winfo width $w]]} { $w xview $c } } |
︙ | ︙ |
Changes to library/ttk/menubutton.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 | # # Bindings for Menubuttons. # # Menubuttons have three interaction modes: # # Pulldown: Press menubutton, drag over menu, release to activate menu entry # Popdown: Click menubutton to post menu # Keyboard: <Key-space> or accelerator key to post menu # # (In addition, when menu system is active, "dropdown" -- menu posts # on mouse-over. Ttk menubuttons don't implement this). # | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # # Bindings for Menubuttons. # # Menubuttons have three interaction modes: # # Pulldown: Press menubutton, drag over menu, release to activate menu entry # Popdown: Click menubutton to post menu # Keyboard: <Key-space> or accelerator key to post menu # # (In addition, when menu system is active, "dropdown" -- menu posts # on mouse-over. Ttk menubuttons don't implement this). # # For keyboard and popdown mode, we hand off to tk_popup and let # the built-in Tk bindings handle the rest of the interaction. # # ON X11: # # Standard Tk menubuttons use a global grab on the menubutton. # This won't work for Ttk menubuttons in pulldown mode, # since we need to process the final <ButtonRelease> event, # and this might be delivered to the menu. So instead we # rely on the passive grab that occurs on <ButtonPress> events, # and transition to popdown mode when the mouse is released # or dragged outside the menubutton. # # ON WINDOWS: # # I'm not sure what the hell is going on here. [$menu post] apparently # sets up some kind of internal grab for native menus. # On this platform, just use [tk_popup] for all menu actions. # # ON MACOS: # # Same probably applies here. # namespace eval ttk { namespace eval menubutton { |
︙ | ︙ | |||
57 58 59 60 61 62 63 | bind TMenubutton <ButtonPress-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ { if {[winfo exists %W]} { %W state !pressed } } } # PostPosition -- | | > > > | < > > > | > > > > > > > > > > > > > > | | | > > > | > | > > > > > > > > > > > > > > > > > > > | > > | > | > > | > > | | > > | | > | > | > | > > | < < < | > > > > | > > > | > > | > > > > > > | | | | > | | | < > > > > | > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | bind TMenubutton <ButtonPress-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ { if {[winfo exists %W]} { %W state !pressed } } } # PostPosition -- # Returns x and y coordinates and a menu item index. # If the index is not an empty string the menu should # be posted so that the upper left corner of the indexed # menu item is located at the point (x, y). Otherwise # the top left corner of the menu itself should be located # at that point. # # TODO: adjust menu width to be at least as wide as the button # for -direction above, below. # if {[tk windowingsystem] eq "aqua"} { proc ::ttk::menubutton::PostPosition {mb menu} { set menuPad 5 set buttonPad 1 set bevelPad 4 set mh [winfo reqheight $menu] set bh [expr {[winfo height $mb]} + $buttonPad] set bbh [expr {[winfo height $mb]} + $bevelPad] set mw [winfo reqwidth $menu] set bw [winfo width $mb] set dF [expr {[winfo width $mb] - [winfo reqwidth $menu] - $menuPad}] set entry "" set entry [::tk::MenuFindName $menu [$mb cget -text]] if {$entry eq ""} { set entry 0 } set x [winfo rootx $mb] set y [winfo rooty $mb] switch [$mb cget -direction] { above { set entry "" incr y [expr {-$mh + 2 * $menuPad}] } below { set entry "" incr y $bh } left { incr y $menuPad incr x -$mw } right { incr y $menuPad incr x $bw } default { incr y $bbh } } return [list $x $y $entry] } } else { proc ::ttk::menubutton::PostPosition {mb menu} { set mh [expr {[winfo reqheight $menu]}] set bh [expr {[winfo height $mb]}] set mw [expr {[winfo reqwidth $menu]}] set bw [expr {[winfo width $mb]}] set dF [expr {[winfo width $mb] - [winfo reqwidth $menu]}] if {[tk windowingsystem] eq "win32"} { incr mh 6 incr mw 16 } set entry {} set entry [::tk::MenuFindName $menu [$mb cget -text]] if {$entry eq {}} { set entry 0 } set x [winfo rootx $mb] set y [winfo rooty $mb] switch [$mb cget -direction] { above { set entry {} incr y -$mh # if we go offscreen to the top, show as 'below' if {$y < [winfo vrooty $mb]} { set y [expr {[winfo vrooty $mb] + [winfo rooty $mb]\ + [winfo reqheight $mb]}] } } below { set entry {} incr y $bh # if we go offscreen to the bottom, show as 'above' if {($y + $mh) > ([winfo vrooty $mb] + [winfo vrootheight $mb])} { set y [expr {[winfo vrooty $mb] + [winfo vrootheight $mb] \ + [winfo rooty $mb] - $mh}] } } left { incr x -$mw } right { incr x $bw } default { if {[$mb cget -style] eq ""} { incr x [expr {([winfo width $mb] - \ [winfo reqwidth $menu])/ 2}] } else { incr y $bh } } } return [list $x $y $entry] } } # Popdown -- # Post the menu and set a grab on the menu. # proc ttk::menubutton::Popdown {mb} { if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} { return } foreach {x y entry} [PostPosition $mb $menu] { break } tk_popup $menu $x $y $entry } # Pulldown (X11 only) -- # Called when Button1 is pressed on a menubutton. # Posts the menu; a subsequent ButtonRelease # or Leave event will set a grab on the menu. # proc ttk::menubutton::Pulldown {mb} { variable State if {[$mb instate disabled] || [set menu [$mb cget -menu]] eq ""} { return } set State(pulldown) 1 set State(oldcursor) [$mb cget -cursor] $mb state pressed $mb configure -cursor [$menu cget -cursor] foreach {x y entry} [PostPosition $mb $menu] { break } if {$entry ne {}} { $menu post $x $y $entry } else { $menu post $x $y } tk_menuSetFocus $menu } # TransferGrab (X11 only) -- # Switch from pulldown mode (menubutton has an implicit grab) # to popdown mode (menu has an explicit grab). # proc ttk::menubutton::TransferGrab {mb} { variable State if {$State(pulldown)} { $mb configure -cursor $State(oldcursor) $mb state {!pressed !active} set State(pulldown) 0 set menu [$mb cget -menu] foreach {x y entry} [PostPosition $mb $menu] { break } tk_popup $menu [winfo rootx $menu] [winfo rooty $menu] } } # FindMenuEntry -- # Hack to support tk_optionMenus. # Returns the index of the menu entry with a matching -label, |
︙ | ︙ |
Changes to library/ttk/notebook.tcl.
︙ | ︙ | |||
66 67 68 69 70 71 72 | if {$select != $current} { ActivateTab $w $select } } } # MnemonicTab $nb $key -- | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | if {$select != $current} { ActivateTab $w $select } } } # MnemonicTab $nb $key -- # Scan all tabs in the specified notebook for one with the # specified mnemonic. If found, returns path name of tab; # otherwise returns "" # proc ttk::notebook::MnemonicTab {nb key} { set key [string toupper $key] foreach tab [$nb tabs] { set label [$nb tab $tab -text] |
︙ | ︙ | |||
90 91 92 93 94 95 96 | # +++ Toplevel keyboard traversal. # # enableTraversal -- # Enable keyboard traversal for a notebook widget # by adding bindings to the containing toplevel window. # | | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # +++ Toplevel keyboard traversal. # # enableTraversal -- # Enable keyboard traversal for a notebook widget # by adding bindings to the containing toplevel window. # # TLNotebooks($top) keeps track of the list of all traversal-enabled # notebooks contained in the toplevel # proc ttk::notebook::enableTraversal {nb} { variable TLNotebooks set top [winfo toplevel $nb] if {![info exists TLNotebooks($top)]} { |
︙ | ︙ | |||
141 142 143 144 145 146 147 | set top [winfo toplevel $nb] if {[info exists TLNotebooks($top)]} { set index [lsearch -exact $TLNotebooks($top) $nb] set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index] } } | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | set top [winfo toplevel $nb] if {[info exists TLNotebooks($top)]} { set index [lsearch -exact $TLNotebooks($top) $nb] set TLNotebooks($top) [lreplace $TLNotebooks($top) $index $index] } } # EnclosingNotebook $w -- # Return the nearest traversal-enabled notebook widget # that contains $w. # # BUGS: this only works properly for tabs that are direct children # of the notebook widget. This routine should follow the # geometry manager hierarchy, not window ancestry, but that # information is not available in Tk. |
︙ | ︙ | |||
167 168 169 170 171 172 173 | set w [winfo parent $w] } return "" } # TLCycleTab -- # toplevel binding procedure for Control-Tab / Control-Shift-Tab | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | set w [winfo parent $w] } return "" } # TLCycleTab -- # toplevel binding procedure for Control-Tab / Control-Shift-Tab # Select the next/previous tab in the nearest ancestor notebook. # proc ttk::notebook::TLCycleTab {w dir} { set nb [EnclosingNotebook $w] if {$nb ne ""} { CycleTab $nb $dir return -code break } |
︙ | ︙ |
Changes to library/ttk/scrollbar.tcl.
1 2 3 4 | # # Bindings for TScrollbar widget # | < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 | # # Bindings for TScrollbar widget # namespace eval ttk::scrollbar { variable State # State(xPress) -- # State(yPress) -- initial position of mouse at start of drag. # State(first) -- value of -first at start of drag. } |
︙ | ︙ | |||
82 83 84 85 86 87 88 | } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | } } } proc ttk::scrollbar::Drag {w x y} { variable State if {![info exists State(first)]} { # Initial buttonpress was not on the thumb, # or something screwy has happened. In either case, ignore: return; } set xDelta [expr {$x - $State(xPress)}] set yDelta [expr {$y - $State(yPress)}] Moveto $w [expr {$State(first) + [$w delta $xDelta $yDelta]}] } |
︙ | ︙ |
Changes to library/ttk/treeview.tcl.
︙ | ︙ | |||
42 43 44 45 46 47 48 | bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W } bind Treeview <Shift-ButtonPress-1> \ { ttk::treeview::Select %W %x %y extend } bind Treeview <<ToggleSelection>> \ { ttk::treeview::Select %W %x %y toggle } | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | bind Treeview <KeyPress-space> { ttk::treeview::ToggleFocus %W } bind Treeview <Shift-ButtonPress-1> \ { ttk::treeview::Select %W %x %y extend } bind Treeview <<ToggleSelection>> \ { ttk::treeview::Select %W %x %y toggle } ttk::copyBindings TtkScrollable Treeview ### Binding procedures. # ## Keynav -- Keyboard navigation # # @@@ TODO: verify/rewrite up and down code. |
︙ | ︙ | |||
201 202 203 204 205 206 207 | proc ttk::treeview::resize.drag {w x} { variable State $w drag $State(resizeColumn) $x } proc ttk::treeview::resize.release {w x} { | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | proc ttk::treeview::resize.drag {w x} { variable State $w drag $State(resizeColumn) $x } proc ttk::treeview::resize.release {w x} { $w drop } ### Heading activation. # proc ttk::treeview::heading.press {w x y} { variable State |
︙ | ︙ | |||
332 333 334 335 336 337 338 339 340 341 342 343 344 345 | $w focus $item event generate $w <<TreeviewClose>> } ## Toggle -- toggle opened/closed state of item # proc ttk::treeview::Toggle {w item} { if {[$w item $item -open]} { CloseItem $w $item } else { OpenItem $w $item } } | > > > > > > | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | $w focus $item event generate $w <<TreeviewClose>> } ## Toggle -- toggle opened/closed state of item # proc ttk::treeview::Toggle {w item} { # don't allow toggling on indicators that # are not present in front of leaf items if {[$w children $item] == {}} { return } # not a leaf, toggle! if {[$w item $item -open]} { CloseItem $w $item } else { OpenItem $w $item } } |
︙ | ︙ |
Changes to library/ttk/ttk.tcl.
︙ | ︙ | |||
118 119 120 121 122 123 124 | ### Load settings for built-in themes: # proc ttk::LoadThemes {} { variable library # "default" always present: | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | ### Load settings for built-in themes: # proc ttk::LoadThemes {} { variable library # "default" always present: uplevel #0 [list source [file join $library defaults.tcl]] set builtinThemes [style theme names] foreach {theme scripts} { classic classicTheme.tcl alt altTheme.tcl clam clamTheme.tcl winnative winTheme.tcl |
︙ | ︙ |
Changes to library/ttk/vistaTheme.tcl.
1 2 3 4 5 | # # Settings for Microsoft Windows Vista and Server 2008 # # The Vista theme can only be defined on Windows Vista and above. The theme | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 | # # Settings for Microsoft Windows Vista and Server 2008 # # The Vista theme can only be defined on Windows Vista and above. The theme # is created in C due to the need to assign a theme-enabled function for # detecting when themeing is disabled. On systems that cannot support the # Vista theme, there will be no such theme created and we must not # evaluate this script. if {"vista" ni [ttk::style theme names]} { return } |
︙ | ︙ | |||
44 45 46 47 48 49 50 | -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ | < < | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | -expand [list selected {2 2 2 2}] # Treeview: ttk::style configure Heading -font TkHeadingFont ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] # Label and Toolbutton ttk::style configure TLabelframe.Label -foreground SystemButtonText ttk::style configure Toolbutton -padding {4 4} |
︙ | ︙ | |||
149 150 151 152 153 154 155 | } } ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; | | | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | } } ttk::style map TSpinbox \ -selectbackground [list !focus SystemWindow] \ -selectforeground [list !focus SystemWindowText] \ ; # SCROLLBAR elements (Vista includes a state for 'hover') ttk::style element create Vertical.Scrollbar.uparrow vsapi \ SCROLLBAR 1 {disabled 4 pressed 3 active 2 hover 17 {} 1} \ -syssize {SM_CXVSCROLL SM_CYVSCROLL} ttk::style element create Vertical.Scrollbar.downarrow vsapi \ SCROLLBAR 1 {disabled 8 pressed 7 active 6 hover 18 {} 5} \ -syssize {SM_CXVSCROLL SM_CYVSCROLL} |
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | # Progressbar ttk::style element create Horizontal.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Horizontal.TProgressbar { Horizontal.Progressbar.trough -sticky nswe -children { Horizontal.Progressbar.pbar -side left -sticky ns } } ttk::style element create Vertical.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Vertical.TProgressbar { Vertical.Progressbar.trough -sticky nswe -children { Vertical.Progressbar.pbar -side bottom -sticky we } } | > | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | # Progressbar ttk::style element create Horizontal.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Horizontal.TProgressbar { Horizontal.Progressbar.trough -sticky nswe -children { Horizontal.Progressbar.pbar -side left -sticky ns Horizontal.Progressbar.text -sticky nesw } } ttk::style element create Vertical.Progressbar.pbar vsapi \ PROGRESS 3 {{} 1} -padding 8 ttk::style layout Vertical.TProgressbar { Vertical.Progressbar.trough -sticky nswe -children { Vertical.Progressbar.pbar -side bottom -sticky we } } # Scale ttk::style element create Horizontal.Scale.slider vsapi \ TRACKBAR 3 {disabled 5 focus 4 pressed 3 active 2 {} 1} \ -width 6 -height 12 ttk::style layout Horizontal.TScale { Scale.focus -expand 1 -sticky nswe -children { Horizontal.Scale.trough -expand 1 -sticky nswe -children { |
︙ | ︙ | |||
218 219 220 221 222 223 224 | Scale.focus -expand 1 -sticky nswe -children { Vertical.Scale.trough -expand 1 -sticky nswe -children { Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } } } | | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | Scale.focus -expand 1 -sticky nswe -children { Vertical.Scale.trough -expand 1 -sticky nswe -children { Vertical.Scale.track -sticky ns Vertical.Scale.slider -side top -sticky {} } } } # Treeview ttk::style configure Item -padding {4 0 0 0} package provide ttk::theme::vista 1.0 } } |
Changes to library/ttk/winTheme.tcl.
︙ | ︙ | |||
70 71 72 73 74 75 76 | ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ | < < | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | ttk::style map TNotebook.Tab -expand [list selected {2 2 2 0}] # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText] ttk::style configure TProgressbar \ -background SystemHighlight -borderwidth 0 ; } } |
Changes to library/ttk/xpTheme.tcl.
︙ | ︙ | |||
63 64 65 66 67 68 69 | ttk::style configure Toolbutton -padding {4 4} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ | < < | 63 64 65 66 67 68 69 70 71 72 73 74 | ttk::style configure Toolbutton -padding {4 4} # Treeview: ttk::style configure Heading -font TkHeadingFont -relief raised ttk::style configure Treeview -background SystemWindow ttk::style map Treeview \ -background [list disabled SystemButtonFace \ selected SystemHighlight] \ -foreground [list disabled SystemGrayText \ selected SystemHighlightText]; } } |
Changes to library/xmfbox.tcl.
︙ | ︙ | |||
206 207 208 209 210 211 212 | # This proc gets called whenever data(filter) is set # proc ::tk::MotifFDialog_SetFilter {w type} { upvar ::tk::dialog::file::[winfo name $w] data variable ::tk::Priv set data(filter) [lindex $type 1] | < | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | # This proc gets called whenever data(filter) is set # proc ::tk::MotifFDialog_SetFilter {w type} { upvar ::tk::dialog::file::[winfo name $w] data variable ::tk::Priv set data(filter) [lindex $type 1] MotifFDialog_Update $w } # ::tk::MotifFDialog_Config -- # # Iterates over the optional arguments to determine the option |
︙ | ︙ | |||
977 978 979 980 981 982 983 | proc ::tk::ListBoxKeyAccel_Reset {w} { variable ::tk::Priv unset -nocomplain Priv(lbAccel,$w) } | < < < < < < | 976 977 978 979 980 981 982 | proc ::tk::ListBoxKeyAccel_Reset {w} { variable ::tk::Priv unset -nocomplain Priv(lbAccel,$w) } |
Changes to macosx/GNUmakefile.
︙ | ︙ | |||
98 99 100 101 102 103 104 | #------------------------------------------------------------------------------------------------------- # project specific settings PROJECT := tk PRODUCT_NAME := Tk UNIX_DIR := ${CURDIR}/../unix | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | #------------------------------------------------------------------------------------------------------- # project specific settings PROJECT := tk PRODUCT_NAME := Tk UNIX_DIR := ${CURDIR}/../unix VERSION := $(shell awk -F= '/^TK_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.ac) TCL_VERSION := ${VERSION} wish := wish WISH = wish${VERSION} BUILD_TARGET := all tktest INSTALL_TARGET := install |
︙ | ︙ | |||
176 177 178 179 180 181 182 | ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/" ${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \ ${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \ | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/" ${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \ ${UNIX_DIR}/tkConfig.sh.in Tk-Info.plist.in Wish-Info.plist.in mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \ if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \ --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \ --mandir="${MANDIR}" --enable-framework \ --with-tcl="${TCL_DIR}" \ ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi ifneq (${VERSION},${TCL_VERSION}) @cd "${OBJ_DIR}" && sed -e 's#/Versions/${TCL_VERSION}#/Versions/${VERSION}#' \ tkConfig.sh > tkConfig.sh.1 && mv -f tkConfig.sh.1 tkConfig.sh endif |
︙ | ︙ |
Changes to macosx/README.
︙ | ︙ | |||
22 23 24 25 26 27 28 | - Please report bugs with Tk on macOS to the tracker: http://core.tcl.tk/tk/reportlist 2. Using Tcl/Tk on macOS --------------------------- - There are two versions of Tk available on macOS: TkAqua using the native | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | - Please report bugs with Tk on macOS to the tracker: http://core.tcl.tk/tk/reportlist 2. Using Tcl/Tk on macOS --------------------------- - There are two versions of Tk available on macOS: TkAqua using the native aqua widgets and look&feel, and TkX11 using the traditional unix X11 widgets. TkX11 requires an X11 server to be installed, such as Apple's X11 (which is available as an optional or default install on recent macOS). TkAqua and TkX11 can be distinguished at runtime via [tk windowingsystem]. - At a minimum, macOS 10.3 is required to run Tcl and TkX11. TkAqua requires macOS 10.6 or later. |
︙ | ︙ | |||
55 56 57 58 59 60 61 | $HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks (searched in that order). Given a potential package directory $pkg, Tcl on OSX checks for the file $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. This allows building extensions as frameworks with all script files contained in the Resources/Scripts directory of the framework. | < < < < < | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | $HOME/Library/Frameworks /Library/Frameworks /System/Library/Frameworks (searched in that order). Given a potential package directory $pkg, Tcl on OSX checks for the file $pkg/Resources/Scripts/pkgIndex.tcl as well as the usual $pkg/pkgIndex.tcl. This allows building extensions as frameworks with all script files contained in the Resources/Scripts directory of the framework. - The 'deploy' target of macosx/GNUmakefile installs the html manpages into the standard documentation location in the Tcl/Tk frameworks: Tcl.framework/Resources/Documentation/Reference/Tcl Tk.framework/Resources/Documentation/Reference/Tk No nroff manpages are installed by default by the GNUmakefile. - The Tcl and Tk frameworks can be installed in any of the system's standard |
︙ | ︙ | |||
83 84 85 86 87 88 89 | - the env array is different when Wish is started from the Finder (i.e. via LaunchServices) than when it (or tclsh) is invoked from the Terminal, in particular PATH may not be what you expect. (Wish started by LaunchServices inherits loginwindow's environment variables, which are essentially those set in $HOME/.MacOSX/environment.plist, and are unrelated to those set in your shell). | < < < < < < < < < < < < < < < < < < < < < < | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | - the env array is different when Wish is started from the Finder (i.e. via LaunchServices) than when it (or tclsh) is invoked from the Terminal, in particular PATH may not be what you expect. (Wish started by LaunchServices inherits loginwindow's environment variables, which are essentially those set in $HOME/.MacOSX/environment.plist, and are unrelated to those set in your shell). - TkAqua provides access to native OS X images via the Tk native bitmap facility (including any image file readable by NSImage). A native bitmap name is interpreted as follows (in order): - predefined builtin 32x32 icon name (stop, caution, document, etc) - name defined by [tk::mac::iconBitmap] - NSImage named image name - NSImage url string |
︙ | ︙ | |||
180 181 182 183 184 185 186 | canJoinAllSpaces, moveToActiveSpace, nonActivating Note that not all attributes are valid for all window classes. Support for the 3 argument form was added with the Cocoa-based Tk 8.5.7, at the same time support for some legacy Carbon-specific classes and attributes was removed (they are still accepted by the command but no longer have any effect). | | | | | > > > > > > > > > > > > > > > > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | canJoinAllSpaces, moveToActiveSpace, nonActivating Note that not all attributes are valid for all window classes. Support for the 3 argument form was added with the Cocoa-based Tk 8.5.7, at the same time support for some legacy Carbon-specific classes and attributes was removed (they are still accepted by the command but no longer have any effect). - Another command available in the tk::unsupported::MacWindowStyle namespace is: tk::unsupported::MacWindowStyle tabbingid window ?newId? which can be used to get or set the tabbingIdentifier for the NSWindow associated with a Tk Window. See section 3 for details. - The command: tk::unsupported::MacWindowStyle appearance window ?newAppearance? is available when Tk is built and run on macOS 10.14 (Mojave) or later. In that case the Ttk widgets all support the "Dark Mode" appearance which was introduced in 10.14. The command accepts the following values for the optional newAppearance option: "aqua", "darkaqua", or "auto". If the appearance is set to aqua or darkaqua then the window will be displayed with the corresponding appearance independent of any preferences settings. If it is set to "auto" the appearance will be determined by the preferences. This command can be used to opt out of Dark Mode on a per-window basis. - To determine the current appearance of a window in macOS 10.14 (Mojave) and higher, one can use the command: tk::unsupported::MacWindowStyle isdark The boolean return value is true if the window is currently displayed with the dark appearance. - If you want to use Remote Debugging with Xcode, you need to set the environment variable XCNOSTDIN to 1 in the Executable editor for Wish. That will cause us to force closing stdin & stdout. Otherwise, given how Xcode launches Wish remotely, they will be left open and then Wish & gdb will fight for stdin. 3. FullScreen, Split View and Tabbed Windows |
︙ | ︙ | |||
271 272 273 274 275 276 277 278 | Since NSWindows can only be grouped together as tabs if they all have the same tabbingIdentifier, one can prevent a window from becoming a tab by giving it a unique tabbingIdentifier. This is independent of any preferences setting. To ensure that we maintain consistency, changing the tabbingIdentifier of a window which is already displayed as a tab will also cause it to become a separate window. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < | | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | Since NSWindows can only be grouped together as tabs if they all have the same tabbingIdentifier, one can prevent a window from becoming a tab by giving it a unique tabbingIdentifier. This is independent of any preferences setting. To ensure that we maintain consistency, changing the tabbingIdentifier of a window which is already displayed as a tab will also cause it to become a separate window. 4. Ttk, Dark Mode and semantic colors --------------------------------------- With the release of OSX 10.14 (Mojave), Apple introduced the DarkAqua appearance. Part of the implementation of the Dark Mode was to make some of the named NSColors have dynamic values. Apple calls these "semantic colors" because the name does not specify a specific color, but rather refers to the context in which the color should be used. Tk now provides the following semantic colors as system colors: systemTextColor, systemTextBackgroundColor, systemSelectedTextColor, systemSelectedTextBackgroundColor, systemControlTextColor, systemDisabledControlTextColor, systemLabelColor, and systemControlAccentColor. All of these except the last two were present in OSX 10.0 (and those two are simulated in systems where they do not exist). The change in 10.14 was that the RGB color value of these colors became dynamic, meaning that the color value can change when the application appearance changes. In particular, when a user selects Dark Mode in the system preferences these colors change appearance. For example systemTextColor is dark in Aqua and light in DarkAqua. One additional color, systemSelectedTabTextColor, does not exist in macOS but is used by Tk to match the different colors used for Notebook tab text in different OS versions. The default background and foreground colors of most of the Tk widgets have been set to semantic colors, which means that the widgets will change appearance, and remain usable, when Dark Mode is selected in the system preferences. However, to get a close match to the native Dark Mode style it is recommended to use Ttk widgets when possible. Apple's tab view and GroupBox objects delimit their content by displaying it within a rounded rectangle with a background color that contrasts with the background of the containing object. This means that the background color of a Ttk widget depends on how deeply it is nested inside of other widgets that use contrasting backgrounds. To support this, there are 8 contrasting system colors named systemWindowBackgroundColor, and systemWindowBackgroundColor1 - 7. The systemWindowBackgroundColor is the standard background for a dialog window and the others match the contrasting background colors used in ttk::notebooks and ttk::labelframes which are nested to the corresponding depth. 5. Building Tcl/Tk on macOS ------------------------------ - macOS 10.6 is required to build TkAqua and TkX11. The XCode application provides everything needed to build Tk, but it is not necessary to install the full XCode. It suffices to install the Command Line Tools package, which can be done by running the command: xcode-select --install - Tcl/Tk are most easily built as macOS frameworks via GNUmakefile in tcl/macosx and tk/macosx (see below for details), but can also be built with the standard unix configure and make buildsystem in tcl/unix resp. tk/unix as on any |
︙ | ︙ | |||
336 337 338 339 340 341 342 | the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are set to the project-relative paths '../../tcl' and '../../tk', if your source directories are named differently, e.g. '../../tcl8.6' and '../../tk8.6', you need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. | < < < < < < < < < < < | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | the TCL_SRCROOT and TK_SRCROOT user build settings, by default these are set to the project-relative paths '../../tcl' and '../../tk', if your source directories are named differently, e.g. '../../tcl8.6' and '../../tk8.6', you need to manually change the TCL_SRCROOT and TK_SRCROOT settings by editing your ${USER}.pbxuser file (located inside the Tk.xcodeproj bundle directory) with a text editor. - To enable weak-linking, set the MACOSX_DEPLOYMENT_TARGET environment variable to the minimal OS version the binaries should be able to run on, e.g: export MACOSX_DEPLOYMENT_TARGET=10.6 This requires at least gcc 3.1; with gcc 4 or later, set/add to CFLAGS instead: export CFLAGS="-mmacosx-version-min=10.6" Support for weak-linking was added with 8.4.14/8.5a5. |
︙ | ︙ | |||
469 470 471 472 473 474 475 | all assume that an autorelease pool is in scope and will be drained when the event processing cycle ends. The macOS Tk application does not call the [NSApp run] method at all. Instead it uses the event loop built in to Tk. So the application must take care to replicate the important features of the method ourselves. The way that autorelease pools are handled is | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | all assume that an autorelease pool is in scope and will be drained when the event processing cycle ends. The macOS Tk application does not call the [NSApp run] method at all. Instead it uses the event loop built in to Tk. So the application must take care to replicate the important features of the method ourselves. The way that autorelease pools are handled is discussed in 5.2 below. Here we discuss the event handling itself. The Tcl event loop simply consists of repeated calls to TclDoOneEvent. Each call to TclDoOneEvent begins by collecting all pending events from an "event source", converting them to Tcl events and adding them to the Tcl event queue. For macOS, the event source is the NSApp object, which maintains an event queue even though its run method will never be called to process them. The NSApp provides methods for |
︙ | ︙ | |||
502 503 504 505 506 507 508 | 5.2 Autorelease pools ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to carry out the job of managing autorelease pools, which would normally be handled by the [NSApp run] method, a private | | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | 5.2 Autorelease pools ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In order to carry out the job of managing autorelease pools, which would normally be handled by the [NSApp run] method, a private NSAutoreleasePool* property is added to the TkApplication subclass of NSApplication. The TkpInit function calls [NSApp _setup] which initializes this property by creating an NSAutoreleasePool prior to calling [NSApp finishLaunching]. This mimics the behavior of the [NSApp run] method, which calls [NSApp finishLaunching] just before starting the event loop. Since the CheckProc function gets called for every Tk event, it is an |
︙ | ︙ | |||
527 528 529 530 531 532 533 | gets posted by a Tk Application. To address this, the NSApp object also implements a semaphore to prevent draining the autorelease pool in nested calls to CheckProc. One additional minor caveat for developers is that there are several steps of the Tk initialization which precede the call to TkpInit. Notably, the font package is initialized first. Since there is no | | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | gets posted by a Tk Application. To address this, the NSApp object also implements a semaphore to prevent draining the autorelease pool in nested calls to CheckProc. One additional minor caveat for developers is that there are several steps of the Tk initialization which precede the call to TkpInit. Notably, the font package is initialized first. Since there is no NSAutoreleasePool in scope prior to calling TkpInit, the functions called in these preliminary stages need to create and drain their own NSAutoreleasePools whenever they call methods of Appkit objects (e.g. NSFont). 5.3 Clipping regions and "ghost windows" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Another unusual aspect of the macOS port is its use of clipping regions. It was part of Daniel Steffen's original design that the TkWindowPrivate struct maintains three HIShapeRef regions, named visRgn, aboveVisRgn and drawRgn. These regions are used as clipping masks whenever drawing into an NSView. The visRgn is the bounding box of the window with a rectangle removed for each subwindow and for each sibling window at a higher stacking level. The drawRgn is the intersection of the visRgn with the clipping rectangle of the window. (Normally, the clipping rectangle is the same as the bounding rectangle, but drawing can be clipped to a smaller rectangle by calling TkpClipDrawableToRect.) The aboveVisRgn is the intersection of the window's bounding rectangle with the bounding rectangle of the parent window. Much of the code in tkMacOSXSubwindows.c is devoted to rebuilding these clipping regions whenever something changes in the layout of the windows. This turns out to be a tricky thing to do and it is extremely prone to errors which can be difficult to trace. It is not entirely clear what the original reason for using these clipping regions was. But one benefit is that if they are correctly maintained then it allows windows to be drawn in any order. You do |
︙ | ︙ | |||
651 652 653 654 655 656 657 | 10.14 supports system appearance changes, and has added a "Dark Mode" that casts all window frames and menus as black. Tk 8.6.9 has added two virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update your Tk app's appearance when the system appearance changes. Just bind your appearance-updating code to these virtual events and you will see it triggered when the system appearance toggles between dark and light. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | 10.14 supports system appearance changes, and has added a "Dark Mode" that casts all window frames and menus as black. Tk 8.6.9 has added two virtual events, <<LightAqua>> and <<DarkAqua>>, to allow you to update your Tk app's appearance when the system appearance changes. Just bind your appearance-updating code to these virtual events and you will see it triggered when the system appearance toggles between dark and light. 7.0 Mac Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~ With 8.6.10, Tk supports the Mac's NSServices API, documented at https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SysServices/introduction.html#//apple_ref/doc/uid/10000101-SW1 and in TIP 536 and Tk's man page. Tk presents a simple, straightforward API to implement the Services functionality. The Tk implementation of the NSServices API is intended for standalone applications, such as one wrapped by the standalone version of Wish and re-named into a different application. In particular such an application would specify its own unique CFBundleIdentifier in its Info.plist file. During development, however, if Wish itself is being used as the receiver, it may be necessary to take some care to ensure that the correct version of Wish.app is available as a receiver of NSServices data. When one macOS app uses NSServices to send data to another app that is not running, LaunchServices will launch the receiver. LaunchServices assumes that the CFBundleIdentifier uniquely identifies an app among all of the apps installed on a system. But this may not be the case for Wish.app if, for example, you have compiled Tk from source at some time in the past. In that case the Tk build directory will contain its own copy of Wish.app that will be visible to LaunchServices. It may be necessary when testing your app to take some steps to ensure that LaunchServices is launching the correct Wish.app. Instructions for doing this are provided below. The command line tool which manages the LaunchServices database has an amazingly unwieldy path name. So, first, run this command: alias lsregister='/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister' Then you can reset the LaunchServices database like this: $ lsregister -kill $ lsregister -seed To find out which versions of Wish.app have been located by LaunchServices, run: $ lsregister -dump | grep path | grep Wish If more than one version of Wish is showing up in this list, eliminate all of the unintended targets by running lsregister -u /path/to/bad/Wish.app Continue this until only the correct version of Wish shows up in the list. |
Changes to macosx/Tk-Common.xcconfig.
︙ | ︙ | |||
32 33 34 35 36 37 38 | FRAMEWORK_INSTALL_PATH = /Library/Frameworks INCLUDEDIR = $(PREFIX)/include LIBDIR = $(PREFIX)/lib MANDIR = $(PREFIX)/man PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc) PREFIX = /usr/local TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | FRAMEWORK_INSTALL_PATH = /Library/Frameworks INCLUDEDIR = $(PREFIX)/include LIBDIR = $(PREFIX)/lib MANDIR = $(PREFIX)/man PER_ARCH_CFLAGS_ppc = -mcpu=G3 -mtune=G4 $(PER_ARCH_CFLAGS_ppc) PREFIX = /usr/local TCL_BUILD_DIR = $(OBJROOT)/../tcl/Tcl.build/$(CONFIGURATION)/Tcl.build/Objects TCL_CONFIGURE_ARGS = --enable-dtrace TCL_FRAMEWORK_DIR = $(SYMROOT)/../tcl/$(CONFIGURATION) TCL_LIBRARY = $(LIBDIR)/tcl$(VERSION) TCL_PACKAGE_PATH = "$(LIBDIR)" TCL_DEFS = HAVE_TCL_CONFIG_H TK_LIBRARY = $(LIBDIR)/tk$(VERSION) TK_DEFS = HAVE_TK_CONFIG_H TCL_NO_DEPRECATED VERSION = 8.7 |
Changes to macosx/Tk.xcode/project.pbxproj.
︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; }; F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; }; F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; }; F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; }; F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; }; F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; }; F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; }; F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; }; F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; }; F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; }; F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F966BC6E08F27A3D005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; }; F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; }; F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F966BC7208F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F966BC7308F27A3D005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; }; F966BC7408F27A3D005CB29B /* tk.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.spec; sourceTree = "<group>"; }; F966BC7508F27A3D005CB29B /* tkAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAppInit.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; }; F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; }; F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; }; F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; }; F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | < < | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; }; F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; }; F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; }; F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; }; F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F966BC9708F27A3E005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; }; F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; }; F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; }; F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; }; F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; }; F966BCF808F27A3F005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; }; F966BCF908F27A3F005CB29B /* tkWin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWin.h; sourceTree = "<group>"; }; F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin32Dll.c; sourceTree = "<group>"; }; F966BCFB08F27A3F005CB29B /* tkWin3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin3d.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; }; F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; }; F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; }; F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; }; F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; }; F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; }; F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; }; F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; }; F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; }; F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; }; F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; }; F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; }; F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D43D308F272B8004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; }; F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; }; F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; }; F96D442708F272B8004A47F5 /* index.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = index.tcl; sourceTree = "<group>"; }; F96D442808F272B8004A47F5 /* installData.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = installData.tcl; sourceTree = "<group>"; }; F96D442908F272B8004A47F5 /* loadICU.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = loadICU.tcl; sourceTree = "<group>"; }; F96D442A08F272B8004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1936 1937 1938 1939 1940 1941 1942 | F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; }; F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; }; F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; }; F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; }; F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; }; F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; }; F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; }; F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; }; F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; }; F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; }; F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D444208F272B9004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; }; F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; }; F96D444708F272B9004A47F5 /* pkgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgc.c; sourceTree = "<group>"; }; F96D444808F272B9004A47F5 /* pkgd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgd.c; sourceTree = "<group>"; }; F96D444908F272B9004A47F5 /* pkge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkge.c; sourceTree = "<group>"; }; F96D444B08F272B9004A47F5 /* pkgua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgua.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1980 1981 1982 1983 1984 1985 1986 | F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D447508F272BA004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; F96D447D08F272BA004A47F5 /* stub16.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stub16.c; sourceTree = "<group>"; }; F96D447E08F272BA004A47F5 /* tcl.dsp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsp; sourceTree = "<group>"; }; |
︙ | ︙ | |||
2736 2737 2738 2739 2740 2741 2742 | sourceTree = "<group>"; }; F966BC6B08F27A3D005CB29B /* unix */ = { isa = PBXGroup; children = ( F966BC6C08F27A3D005CB29B /* aclocal.m4 */, F966BC6D08F27A3D005CB29B /* configure */, | | | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 | sourceTree = "<group>"; }; F966BC6B08F27A3D005CB29B /* unix */ = { isa = PBXGroup; children = ( F966BC6C08F27A3D005CB29B /* aclocal.m4 */, F966BC6D08F27A3D005CB29B /* configure */, F966BC6E08F27A3D005CB29B /* configure.ac */, F966BC6F08F27A3D005CB29B /* install-sh */, F966BC7008F27A3D005CB29B /* installManPage */, F966BC7108F27A3D005CB29B /* Makefile.in */, F966BC7208F27A3D005CB29B /* README */, F966BC7308F27A3D005CB29B /* tcl.m4 */, F974D57B0FBE7EC000BF728B /* tk.pc.in */, F966BC7408F27A3D005CB29B /* tk.spec */, |
︙ | ︙ | |||
2783 2784 2785 2786 2787 2788 2789 | }; F966BC9208F27A3D005CB29B /* win */ = { isa = PBXGroup; children = ( F966BC9408F27A3D005CB29B /* aclocal.m4 */, F966BC9508F27A3D005CB29B /* buildall.vc.bat */, F966BC9608F27A3E005CB29B /* configure */, | | < | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 | }; F966BC9208F27A3D005CB29B /* win */ = { isa = PBXGroup; children = ( F966BC9408F27A3D005CB29B /* aclocal.m4 */, F966BC9508F27A3D005CB29B /* buildall.vc.bat */, F966BC9608F27A3E005CB29B /* configure */, F966BC9708F27A3E005CB29B /* configure.ac */, F966BC9908F27A3E005CB29B /* Makefile.in */, F966BC9A08F27A3E005CB29B /* makefile.vc */, F966BC9C08F27A3E005CB29B /* nmakehlp.c */, F966BC9D08F27A3E005CB29B /* rc */, F966BCF308F27A3E005CB29B /* README */, F966BCF408F27A3E005CB29B /* rmd.bat */, F966BCF508F27A3F005CB29B /* rules.vc */, F966BCF608F27A3F005CB29B /* stubs.c */, F966BCF708F27A3F005CB29B /* tcl.m4 */, |
︙ | ︙ | |||
3718 3719 3720 3721 3722 3723 3724 | sourceTree = "<group>"; }; F96D43D008F272B8004A47F5 /* tools */ = { isa = PBXGroup; children = ( F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */, F96D43D208F272B8004A47F5 /* configure */, | | | 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 | sourceTree = "<group>"; }; F96D43D008F272B8004A47F5 /* tools */ = { isa = PBXGroup; children = ( F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */, F96D43D208F272B8004A47F5 /* configure */, F96D43D308F272B8004A47F5 /* configure.ac */, F96D442208F272B8004A47F5 /* eolFix.tcl */, F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */, F96D442508F272B8004A47F5 /* genStubs.tcl */, F96D442708F272B8004A47F5 /* index.tcl */, F96D442808F272B8004A47F5 /* installData.tcl */, F96D442908F272B8004A47F5 /* loadICU.tcl */, F96D442A08F272B8004A47F5 /* Makefile.in */, |
︙ | ︙ | |||
3751 3752 3753 3754 3755 3756 3757 | sourceTree = "<group>"; }; F96D443E08F272B9004A47F5 /* unix */ = { isa = PBXGroup; children = ( F96D444008F272B9004A47F5 /* aclocal.m4 */, F96D444108F272B9004A47F5 /* configure */, | | | 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 | sourceTree = "<group>"; }; F96D443E08F272B9004A47F5 /* unix */ = { isa = PBXGroup; children = ( F96D444008F272B9004A47F5 /* aclocal.m4 */, F96D444108F272B9004A47F5 /* configure */, F96D444208F272B9004A47F5 /* configure.ac */, F96D444308F272B9004A47F5 /* dltest */, F96D444D08F272B9004A47F5 /* install-sh */, F96D444E08F272B9004A47F5 /* installManPage */, F96D444F08F272B9004A47F5 /* ldAix */, F96D445008F272B9004A47F5 /* Makefile.in */, F96D445208F272B9004A47F5 /* README */, F96D445308F272B9004A47F5 /* tcl.m4 */, |
︙ | ︙ | |||
3812 3813 3814 3815 3816 3817 3818 | F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, | | | 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 | F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, F96D447508F272BA004A47F5 /* configure.ac */, F96D447708F272BA004A47F5 /* Makefile.in */, F96D447808F272BA004A47F5 /* makefile.vc */, F96D447908F272BA004A47F5 /* nmakehlp.c */, F96D447A08F272BA004A47F5 /* README */, F96D447C08F272BA004A47F5 /* rules.vc */, F96D447D08F272BA004A47F5 /* stub16.c */, F96D447E08F272BA004A47F5 /* tcl.dsp */, |
︙ | ︙ | |||
3964 3965 3966 3967 3968 3969 3970 | F9A5C5F508F651A2008AE941 /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", | | | | | | | | | | 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 | F9A5C5F508F651A2008AE941 /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", "$(TCL_SRCROOT)/unix/configure.ac", "$(TCL_SRCROOT)/unix/tcl.m4", "$(TCL_SRCROOT)/unix/aclocal.m4", "$(TCL_SRCROOT)/unix/tclConfig.sh.in", "$(TCL_SRCROOT)/unix/Makefile.in", "$(TCL_SRCROOT)/unix/dltest/Makefile.in", ); name = "Configure Tcl"; outputPaths = ( "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9A5C5F608F651AB008AE941 /* Configure Tk */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TK_SRCROOT)/macosx/configure.ac", "$(TK_SRCROOT)/unix/configure.ac", "$(TK_SRCROOT)/unix/tcl.m4", "$(TK_SRCROOT)/unix/aclocal.m4", "$(TK_SRCROOT)/unix/tkConfig.sh.in", ); name = "Configure Tk"; outputPaths = ( "$(DERIVED_FILE_DIR)/tk/tkConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9FD30B40CC1AD070073837D /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", "$(TCL_SRCROOT)/unix/configure.ac", "$(TCL_SRCROOT)/unix/tcl.m4", "$(TCL_SRCROOT)/unix/aclocal.m4", "$(TCL_SRCROOT)/unix/tclConfig.sh.in", "$(TCL_SRCROOT)/unix/Makefile.in", "$(TCL_SRCROOT)/unix/dltest/Makefile.in", ); name = "Configure Tcl"; outputPaths = ( "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9FD30B50CC1AD070073837D /* Configure Tk */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TK_SRCROOT)/macosx/configure.ac", "$(TK_SRCROOT)/unix/configure.ac", "$(TK_SRCROOT)/unix/tcl.m4", "$(TK_SRCROOT)/unix/aclocal.m4", "$(TK_SRCROOT)/unix/tkConfig.sh.in", ); name = "Configure Tk"; outputPaths = ( "$(DERIVED_FILE_DIR)/tk/tkConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DD76FAB0486AB0100D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; |
︙ | ︙ |
Changes to macosx/Tk.xcodeproj/project.pbxproj.
︙ | ︙ | |||
1168 1169 1170 1171 1172 1173 1174 | F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; }; F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; }; F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; }; F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; }; F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; }; F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 | F966BC6608F27A3D005CB29B /* winMenu.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winMenu.test; sourceTree = "<group>"; }; F966BC6708F27A3D005CB29B /* winSend.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winSend.test; sourceTree = "<group>"; }; F966BC6808F27A3D005CB29B /* winWm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winWm.test; sourceTree = "<group>"; }; F966BC6908F27A3D005CB29B /* wm.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = wm.test; sourceTree = "<group>"; }; F966BC6A08F27A3D005CB29B /* xmfbox.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = xmfbox.test; sourceTree = "<group>"; }; F966BC6C08F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC6D08F27A3D005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F966BC6E08F27A3D005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F966BC6F08F27A3D005CB29B /* install-sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = "install-sh"; sourceTree = "<group>"; }; F966BC7008F27A3D005CB29B /* installManPage */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = installManPage; sourceTree = "<group>"; }; F966BC7108F27A3D005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F966BC7208F27A3D005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F966BC7308F27A3D005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; }; F966BC7408F27A3D005CB29B /* tk.spec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.spec; sourceTree = "<group>"; }; F966BC7508F27A3D005CB29B /* tkAppInit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkAppInit.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; }; F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; }; F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; }; F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; }; F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | < < | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 | F966BC8E08F27A3D005CB29B /* tkUnixSelect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSelect.c; sourceTree = "<group>"; }; F966BC8F08F27A3D005CB29B /* tkUnixSend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixSend.c; sourceTree = "<group>"; }; F966BC9008F27A3D005CB29B /* tkUnixWm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixWm.c; sourceTree = "<group>"; }; F966BC9108F27A3D005CB29B /* tkUnixXId.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkUnixXId.c; sourceTree = "<group>"; }; F966BC9408F27A3D005CB29B /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F966BC9508F27A3D005CB29B /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F966BC9608F27A3E005CB29B /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F966BC9708F27A3E005CB29B /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F966BC9908F27A3E005CB29B /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F966BC9A08F27A3E005CB29B /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F966BC9C08F27A3E005CB29B /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F966BCEE08F27A3E005CB29B /* tk.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk.rc; sourceTree = "<group>"; }; F966BCEF08F27A3E005CB29B /* tk_base.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tk_base.rc; sourceTree = "<group>"; }; F966BCF208F27A3E005CB29B /* wish.rc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wish.rc; sourceTree = "<group>"; }; F966BCF308F27A3E005CB29B /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F966BCF508F27A3F005CB29B /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; F966BCF608F27A3F005CB29B /* stubs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stubs.c; sourceTree = "<group>"; }; F966BCF708F27A3F005CB29B /* tcl.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tcl.m4; sourceTree = "<group>"; }; F966BCF808F27A3F005CB29B /* tkConfig.sh.in */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = tkConfig.sh.in; sourceTree = "<group>"; }; F966BCF908F27A3F005CB29B /* tkWin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tkWin.h; sourceTree = "<group>"; }; F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin32Dll.c; sourceTree = "<group>"; }; F966BCFB08F27A3F005CB29B /* tkWin3d.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tkWin3d.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1911 1912 1913 1914 1915 1916 1917 | F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; }; F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; }; F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; }; F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; }; F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; }; F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; }; F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | F96D43CB08F272B7004A47F5 /* winFCmd.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFCmd.test; sourceTree = "<group>"; }; F96D43CC08F272B7004A47F5 /* winFile.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winFile.test; sourceTree = "<group>"; }; F96D43CD08F272B7004A47F5 /* winNotify.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winNotify.test; sourceTree = "<group>"; }; F96D43CE08F272B7004A47F5 /* winPipe.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winPipe.test; sourceTree = "<group>"; }; F96D43CF08F272B7004A47F5 /* winTime.test */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = winTime.test; sourceTree = "<group>"; }; F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = checkLibraryDoc.tcl; sourceTree = "<group>"; }; F96D43D208F272B8004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D43D308F272B8004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D442208F272B8004A47F5 /* eolFix.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = eolFix.tcl; sourceTree = "<group>"; }; F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = fix_tommath_h.tcl; sourceTree = "<group>"; }; F96D442508F272B8004A47F5 /* genStubs.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = genStubs.tcl; sourceTree = "<group>"; }; F96D442708F272B8004A47F5 /* index.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = index.tcl; sourceTree = "<group>"; }; F96D442808F272B8004A47F5 /* installData.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = installData.tcl; sourceTree = "<group>"; }; F96D442908F272B8004A47F5 /* loadICU.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = loadICU.tcl; sourceTree = "<group>"; }; F96D442A08F272B8004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1936 1937 1938 1939 1940 1941 1942 | F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; }; F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; }; F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; }; F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; }; F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; }; F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 | F96D443608F272B8004A47F5 /* tcl.wse.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.wse.in; sourceTree = "<group>"; }; F96D443908F272B9004A47F5 /* tcltk-man2html.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = "tcltk-man2html.tcl"; sourceTree = "<group>"; }; F96D443A08F272B9004A47F5 /* tclZIC.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = tclZIC.tcl; sourceTree = "<group>"; }; F96D443B08F272B9004A47F5 /* uniClass.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniClass.tcl; sourceTree = "<group>"; }; F96D443C08F272B9004A47F5 /* uniParse.tcl */ = {isa = PBXFileReference; explicitFileType = text.script; fileEncoding = 4; path = uniParse.tcl; sourceTree = "<group>"; }; F96D444008F272B9004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D444108F272B9004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D444208F272B9004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D444408F272B9004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D444508F272B9004A47F5 /* pkga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkga.c; sourceTree = "<group>"; }; F96D444608F272B9004A47F5 /* pkgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgb.c; sourceTree = "<group>"; }; F96D444708F272B9004A47F5 /* pkgc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgc.c; sourceTree = "<group>"; }; F96D444808F272B9004A47F5 /* pkgd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgd.c; sourceTree = "<group>"; }; F96D444908F272B9004A47F5 /* pkge.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkge.c; sourceTree = "<group>"; }; F96D444B08F272B9004A47F5 /* pkgua.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pkgua.c; sourceTree = "<group>"; }; |
︙ | ︙ | |||
1980 1981 1982 1983 1984 1985 1986 | F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 | F96D446B08F272B9004A47F5 /* tclUnixTime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclUnixTime.c; sourceTree = "<group>"; }; F96D446C08F272B9004A47F5 /* tclXtNotify.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtNotify.c; sourceTree = "<group>"; }; F96D446D08F272B9004A47F5 /* tclXtTest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tclXtTest.c; sourceTree = "<group>"; }; F96D447008F272BA004A47F5 /* aclocal.m4 */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = aclocal.m4; sourceTree = "<group>"; }; F96D447108F272BA004A47F5 /* buildall.vc.bat */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildall.vc.bat; sourceTree = "<group>"; }; F96D447208F272BA004A47F5 /* cat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cat.c; sourceTree = "<group>"; }; F96D447408F272BA004A47F5 /* configure */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = configure; sourceTree = "<group>"; }; F96D447508F272BA004A47F5 /* configure.ac */ = {isa = PBXFileReference; explicitFileType = text.script.sh; fileEncoding = 4; path = configure.ac; sourceTree = "<group>"; }; F96D447708F272BA004A47F5 /* Makefile.in */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = Makefile.in; sourceTree = "<group>"; }; F96D447808F272BA004A47F5 /* makefile.vc */ = {isa = PBXFileReference; explicitFileType = sourcecode.make; fileEncoding = 4; path = makefile.vc; sourceTree = "<group>"; }; F96D447908F272BA004A47F5 /* nmakehlp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nmakehlp.c; sourceTree = "<group>"; }; F96D447A08F272BA004A47F5 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; }; F96D447C08F272BA004A47F5 /* rules.vc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rules.vc; sourceTree = "<group>"; }; F96D447D08F272BA004A47F5 /* stub16.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stub16.c; sourceTree = "<group>"; }; F96D447E08F272BA004A47F5 /* tcl.dsp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = tcl.dsp; sourceTree = "<group>"; }; |
︙ | ︙ | |||
2736 2737 2738 2739 2740 2741 2742 | sourceTree = "<group>"; }; F966BC6B08F27A3D005CB29B /* unix */ = { isa = PBXGroup; children = ( F966BC6C08F27A3D005CB29B /* aclocal.m4 */, F966BC6D08F27A3D005CB29B /* configure */, | | | 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 | sourceTree = "<group>"; }; F966BC6B08F27A3D005CB29B /* unix */ = { isa = PBXGroup; children = ( F966BC6C08F27A3D005CB29B /* aclocal.m4 */, F966BC6D08F27A3D005CB29B /* configure */, F966BC6E08F27A3D005CB29B /* configure.ac */, F966BC6F08F27A3D005CB29B /* install-sh */, F966BC7008F27A3D005CB29B /* installManPage */, F966BC7108F27A3D005CB29B /* Makefile.in */, F966BC7208F27A3D005CB29B /* README */, F966BC7308F27A3D005CB29B /* tcl.m4 */, F974D57B0FBE7EC000BF728B /* tk.pc.in */, F966BC7408F27A3D005CB29B /* tk.spec */, |
︙ | ︙ | |||
2783 2784 2785 2786 2787 2788 2789 | }; F966BC9208F27A3D005CB29B /* win */ = { isa = PBXGroup; children = ( F966BC9408F27A3D005CB29B /* aclocal.m4 */, F966BC9508F27A3D005CB29B /* buildall.vc.bat */, F966BC9608F27A3E005CB29B /* configure */, | | < < | 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 | }; F966BC9208F27A3D005CB29B /* win */ = { isa = PBXGroup; children = ( F966BC9408F27A3D005CB29B /* aclocal.m4 */, F966BC9508F27A3D005CB29B /* buildall.vc.bat */, F966BC9608F27A3E005CB29B /* configure */, F966BC9708F27A3E005CB29B /* configure.ac */, F966BC9908F27A3E005CB29B /* Makefile.in */, F966BC9A08F27A3E005CB29B /* makefile.vc */, F966BC9C08F27A3E005CB29B /* nmakehlp.c */, F966BC9D08F27A3E005CB29B /* rc */, F966BCF308F27A3E005CB29B /* README */, F966BCF508F27A3F005CB29B /* rules.vc */, F966BCF608F27A3F005CB29B /* stubs.c */, F966BCF708F27A3F005CB29B /* tcl.m4 */, F966BCF808F27A3F005CB29B /* tkConfig.sh.in */, F966BCF908F27A3F005CB29B /* tkWin.h */, F966BCFA08F27A3F005CB29B /* tkWin32Dll.c */, F966BCFB08F27A3F005CB29B /* tkWin3d.c */, |
︙ | ︙ | |||
3718 3719 3720 3721 3722 3723 3724 | sourceTree = "<group>"; }; F96D43D008F272B8004A47F5 /* tools */ = { isa = PBXGroup; children = ( F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */, F96D43D208F272B8004A47F5 /* configure */, | | | 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 | sourceTree = "<group>"; }; F96D43D008F272B8004A47F5 /* tools */ = { isa = PBXGroup; children = ( F96D43D108F272B8004A47F5 /* checkLibraryDoc.tcl */, F96D43D208F272B8004A47F5 /* configure */, F96D43D308F272B8004A47F5 /* configure.ac */, F96D442208F272B8004A47F5 /* eolFix.tcl */, F96D442408F272B8004A47F5 /* fix_tommath_h.tcl */, F96D442508F272B8004A47F5 /* genStubs.tcl */, F96D442708F272B8004A47F5 /* index.tcl */, F96D442808F272B8004A47F5 /* installData.tcl */, F96D442908F272B8004A47F5 /* loadICU.tcl */, F96D442A08F272B8004A47F5 /* Makefile.in */, |
︙ | ︙ | |||
3751 3752 3753 3754 3755 3756 3757 | sourceTree = "<group>"; }; F96D443E08F272B9004A47F5 /* unix */ = { isa = PBXGroup; children = ( F96D444008F272B9004A47F5 /* aclocal.m4 */, F96D444108F272B9004A47F5 /* configure */, | | | 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 | sourceTree = "<group>"; }; F96D443E08F272B9004A47F5 /* unix */ = { isa = PBXGroup; children = ( F96D444008F272B9004A47F5 /* aclocal.m4 */, F96D444108F272B9004A47F5 /* configure */, F96D444208F272B9004A47F5 /* configure.ac */, F96D444308F272B9004A47F5 /* dltest */, F96D444D08F272B9004A47F5 /* install-sh */, F96D444E08F272B9004A47F5 /* installManPage */, F96D444F08F272B9004A47F5 /* ldAix */, F96D445008F272B9004A47F5 /* Makefile.in */, F96D445208F272B9004A47F5 /* README */, F96D445308F272B9004A47F5 /* tcl.m4 */, |
︙ | ︙ | |||
3812 3813 3814 3815 3816 3817 3818 | F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, | | | 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 | F96D446E08F272B9004A47F5 /* win */ = { isa = PBXGroup; children = ( F96D447008F272BA004A47F5 /* aclocal.m4 */, F96D447108F272BA004A47F5 /* buildall.vc.bat */, F96D447208F272BA004A47F5 /* cat.c */, F96D447408F272BA004A47F5 /* configure */, F96D447508F272BA004A47F5 /* configure.ac */, F96D447708F272BA004A47F5 /* Makefile.in */, F96D447808F272BA004A47F5 /* makefile.vc */, F96D447908F272BA004A47F5 /* nmakehlp.c */, F96D447A08F272BA004A47F5 /* README */, F96D447C08F272BA004A47F5 /* rules.vc */, F96D447D08F272BA004A47F5 /* stub16.c */, F96D447E08F272BA004A47F5 /* tcl.dsp */, |
︙ | ︙ | |||
3967 3968 3969 3970 3971 3972 3973 | F9A5C5F508F651A2008AE941 /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", | | | | | | | | | | 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 | F9A5C5F508F651A2008AE941 /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", "$(TCL_SRCROOT)/unix/configure.ac", "$(TCL_SRCROOT)/unix/tcl.m4", "$(TCL_SRCROOT)/unix/aclocal.m4", "$(TCL_SRCROOT)/unix/tclConfig.sh.in", "$(TCL_SRCROOT)/unix/Makefile.in", "$(TCL_SRCROOT)/unix/dltest/Makefile.in", ); name = "Configure Tcl"; outputPaths = ( "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9A5C5F608F651AB008AE941 /* Configure Tk */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TK_SRCROOT)/macosx/configure.ac", "$(TK_SRCROOT)/unix/configure.ac", "$(TK_SRCROOT)/unix/tcl.m4", "$(TK_SRCROOT)/unix/aclocal.m4", "$(TK_SRCROOT)/unix/tkConfig.sh.in", ); name = "Configure Tk"; outputPaths = ( "$(DERIVED_FILE_DIR)/tk/tkConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-aqua --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9FD30B40CC1AD070073837D /* Configure Tcl */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TCL_SRCROOT)/macosx/configure.ac", "$(TCL_SRCROOT)/unix/configure.ac", "$(TCL_SRCROOT)/unix/tcl.m4", "$(TCL_SRCROOT)/unix/aclocal.m4", "$(TCL_SRCROOT)/unix/tclConfig.sh.in", "$(TCL_SRCROOT)/unix/Makefile.in", "$(TCL_SRCROOT)/unix/dltest/Makefile.in", ); name = "Configure Tcl"; outputPaths = ( "$(DERIVED_FILE_DIR)/tcl/tclConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tcl configure shell script phase\n\ncd \"${TCL_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tcl/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tcl && cd tcl &&\nif [ \"${TCL_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tcl\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n \"${TCL_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi\n"; showEnvVarsInLog = 0; }; F9FD30B50CC1AD070073837D /* Configure Tk */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( "$(TK_SRCROOT)/macosx/configure.ac", "$(TK_SRCROOT)/unix/configure.ac", "$(TK_SRCROOT)/unix/tcl.m4", "$(TK_SRCROOT)/unix/aclocal.m4", "$(TK_SRCROOT)/unix/tkConfig.sh.in", ); name = "Configure Tk"; outputPaths = ( "$(DERIVED_FILE_DIR)/tk/tkConfig.sh", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; shellScript = "## tk configure shell script phase\n\ncd \"${TK_SRCROOT}\"/macosx &&\nif [ configure.ac -nt configure -o ../unix/configure.ac -nt configure -o ../unix/tcl.m4 -nt configure -o ../unix/aclocal.m4 -nt configure ]; then\n echo \"Running autoconf & autoheader in tk/macosx\"\n rm -rf autom4te.cache\n ${AUTOCONF:-${DEVELOPER_DIR}/usr/bin/autoconf} && ${AUTOHEADER:-${DEVELOPER_DIR}/usr/bin/autoheader} || exit $?\n rm -rf autom4te.cache\nfi\n\ncd \"${DERIVED_FILE_DIR}\" && mkdir -p tk && cd tk &&\nif [ \"${TK_SRCROOT}\"/macosx/configure -nt config.status ]; then\n echo \"Configuring Tk\"\n CC=$(xcrun -find ${GCC} || echo ${GCC})\n PATH=\"${PATH}:/usr/X11R6/bin\" \"${TK_SRCROOT}\"/macosx/configure --cache-file=../config.cache --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} --mandir=${MANDIR} --includedir=${INCLUDEDIR} --disable-shared --enable-xft --with-tcl=../tcl CC=${CC} LD=${CC} ${CONFIGURE_ARGS}\nelse\n ./config.status\nfi"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 8DD76FAB0486AB0100D96B5E /* Sources */ = { isa = PBXSourcesBuildPhase; |
︙ | ︙ |
Changes to macosx/Wish-Info.plist.in.
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | <string>TEXT</string> <string>****</string> </array> <key>CFBundleTypeRole</key> <string>Viewer</string> </dict> </array> <key>CFBundleExecutable</key> <string>Wish</string> <key>CFBundleGetInfoString</key> <string>Wish Shell @TK_VERSION@@TK_PATCH_LEVEL@, Copyright © 1989-@TK_YEAR@ Tcl Core Team, Copyright © 1989-@TK_YEAR@ Contributors, Copyright © 2011-@TK_YEAR@ Kevin Walzer/WordTech | > > > > > > > > > > > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | <string>TEXT</string> <string>****</string> </array> <key>CFBundleTypeRole</key> <string>Viewer</string> </dict> </array> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>CFBundleURLSchemes</key> <array> <string>foo</string> </array> <key>CFBundleURLName</key> <string>Get Foo</string> </dict> </array> <key>CFBundleExecutable</key> <string>Wish</string> <key>CFBundleGetInfoString</key> <string>Wish Shell @TK_VERSION@@TK_PATCH_LEVEL@, Copyright © 1989-@TK_YEAR@ Tcl Core Team, Copyright © 1989-@TK_YEAR@ Contributors, Copyright © 2011-@TK_YEAR@ Kevin Walzer/WordTech |
︙ | ︙ | |||
74 75 76 77 78 79 80 | <true/> <key>NSAppleScriptEnabled</key> <true/> <key>OSAScriptingDefinition</key> <string>Wish.sdef</string> <key>NSHighResolutionCapable</key> <string>True</string> | > > > > > > > | > > > > > > > > > > > > > > | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | <true/> <key>NSAppleScriptEnabled</key> <true/> <key>OSAScriptingDefinition</key> <string>Wish.sdef</string> <key>NSHighResolutionCapable</key> <string>True</string> <key>NSServices</key> <array> <dict> <key>NSMenuItem</key> <dict> <key>default</key> <string>Wish: Display Test Data</string> </dict> <key>NSMessage</key> <string>provideService</string> <key>NSPortName</key> <string>Wish</string> <key>NSSendTypes</key> <array> <string>NSStringPboardType</string> <string>NSPasteboardTypeString</string> </array> </dict> </array> </dict> </plist> |
Changes to macosx/Wish.sdef.
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | </command> <command name="quit" code="aevtquit" description="Quit the application."/> </suite> <suite name="Wish Suite" code="WIsH" description="Commands for the Wish application."> <command name="do script" code="miscdosc" description="Execute a Tcl script."> <direct-parameter description="Script to execute" type="text"> <type type="text"/> </direct-parameter> <result description="Result"> <type type="text"/> </result> </command> </suite> </dictionary> | > > > > > > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | </command> <command name="quit" code="aevtquit" description="Quit the application."/> </suite> <suite name="Wish Suite" code="WIsH" description="Commands for the Wish application."> <command name="do script" code="miscdosc" description="Execute a Tcl script."> <direct-parameter description="Script to execute" type="text"> <type type="text"/> </direct-parameter> <result description="Result"> <type type="text"/> </result> </command> <command name="open location" code="GURLGURL" description="Open a URL."> <direct-parameter description="URL" type="text"> <type type="text"/> </direct-parameter> <result description="Result"> <type type="text"/> </result> </command> </suite> </dictionary> |
Changes to macosx/configure.ac.
1 2 3 4 5 6 7 8 9 10 | #! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. dnl Ensure that the config (auto)headers support is used, then just dnl include the configure sources from ../unix: m4_include(../unix/aclocal.m4) m4_define(SC_USE_CONFIG_HEADERS) | | | 1 2 3 4 5 6 7 8 9 10 11 | #! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. dnl Ensure that the config (auto)headers support is used, then just dnl include the configure sources from ../unix: m4_include(../unix/aclocal.m4) m4_define(SC_USE_CONFIG_HEADERS) m4_include(../unix/configure.ac) |
Changes to macosx/tkMacOSXBitmap.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, {NULL} }; #define builtInIconSize 32 static Tcl_HashTable iconBitmapTable = {}; typedef struct { int kind, width, height; char *value; } IconBitmap; static const char *const iconBitmapOptionStrings[] = { | > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | {"note", kAlertNoteIcon}, {"caution", kAlertCautionIcon}, {NULL} }; #define builtInIconSize 32 #define OSTYPE_TO_UTI(x) (NSString *)UTTypeCreatePreferredIdentifierForTag( \ kUTTagClassOSType, UTCreateStringForOSType(x), nil) static Tcl_HashTable iconBitmapTable = {}; typedef struct { int kind, width, height; char *value; } IconBitmap; static const char *const iconBitmapOptionStrings[] = { |
︙ | ︙ | |||
103 104 105 106 107 108 109 110 111 112 113 | predefPtr->width = builtInIconSize; predefPtr->height = builtInIconSize; predefPtr->native = 1; Tcl_SetHashValue(predefHashPtr, predefPtr); } } } /* *---------------------------------------------------------------------- * | > | | | | | | < < > > | | > > > > | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | predefPtr->width = builtInIconSize; predefPtr->height = builtInIconSize; predefPtr->native = 1; Tcl_SetHashValue(predefHashPtr, predefPtr); } } } /* *---------------------------------------------------------------------- * * PixmapFromImage -- * * Results: * Returns a Pixmap with an NSImage drawn into it. * * Side effects: * None. * *---------------------------------------------------------------------- */ static Pixmap PixmapFromImage( Display *display, NSImage* image, CGSize size) { TkMacOSXDrawingContext dc; Pixmap pixmap; pixmap = Tk_GetPixmap(display, None, size.width, size.height, 0); if (TkMacOSXSetupDrawingContext(pixmap, NULL, 1, &dc)) { if (dc.context) { CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = size.height}; CGContextConcatCTM(dc.context, t); [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:dc.context flipped:NO]]; [image drawAtPoint:NSZeroPoint fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [NSGraphicsContext restoreGraphicsState]; } TkMacOSXRestoreDrawingContext(&dc); } return pixmap; } /* *---------------------------------------------------------------------- * * TkpCreateNativeBitmap -- * * Create native bitmap. |
︙ | ︙ | |||
164 165 166 167 168 169 170 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { | < < < | < | < | | < < > | < | < | | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | */ Pixmap TkpCreateNativeBitmap( Display *display, const void *source) /* Info about the icon to build. */ { NSString *iconUTI = OSTYPE_TO_UTI(PTR2UINT(source)); NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFileType: iconUTI]; CGSize size = CGSizeMake(builtInIconSize, builtInIconSize); Pixmap pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); return pixmap; } /* *---------------------------------------------------------------------- * * OSTypeFromString -- * * Helper to convert string to OSType. |
︙ | ︙ | |||
206 207 208 209 210 211 212 | int result = TCL_ERROR; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); Tcl_UtfToExternalDString(encoding, s, -1, &ds); if (Tcl_DStringLength(&ds) <= 4) { char string[4] = {}; | | > | 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | int result = TCL_ERROR; Tcl_DString ds; Tcl_Encoding encoding = Tcl_GetEncoding(NULL, "macRoman"); Tcl_UtfToExternalDString(encoding, s, -1, &ds); if (Tcl_DStringLength(&ds) <= 4) { char string[4] = {}; memcpy(string, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); *t = (OSType) string[0] << 24 | (OSType) string[1] << 16 | (OSType) string[2] << 8 | (OSType) string[3]; result = TCL_OK; } Tcl_DStringFree(&ds); Tcl_FreeEncoding(encoding); return result; } /* *---------------------------------------------------------------------- * * TkpGetNativeAppBitmap -- * * Get a named native bitmap. |
︙ | ︙ | |||
305 306 307 308 309 310 311 | } } if (image) { size = [image size]; } } if (image) { | < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < > > | < | < | < < < < | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | } } if (image) { size = [image size]; } } if (image) { *width = size.width; *height = size.height; pixmap = PixmapFromImage(display, image, NSSizeToCGSize(size)); } else if (name) { OSType iconType; if (OSTypeFromString(name, &iconType) == TCL_OK) { NSString *iconUTI = OSTYPE_TO_UTI(iconType); printf("Found image for UTI %s\n", iconUTI.UTF8String); NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFileType: iconUTI]; pixmap = PixmapFromImage(display, iconImage, NSSizeToCGSize(size)); } } return pixmap; } /* *---------------------------------------------------------------------- |
︙ | ︙ |
Changes to macosx/tkMacOSXButton.c.
1 2 3 | /* * tkMacOSXButton.c -- * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkMacOSXButton.c -- * * This file implements the Macintosh specific portion of the button * widgets. * * Copyright (c) 1996-1997 by Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2006-2007 Daniel A. Steffen <[email protected]> * Copyright 2007 Revar Desmera. * Copyright 2015 Kevin Walzer/WordTech Communications LLC. * Copyright 2015 Marc Culler. |
︙ | ︙ | |||
25 26 27 28 29 30 31 | #define ACTIVE 4 /* * Extra padding used for computing the content size that should * be allowed when drawing the HITheme button. */ | | < < < < < < < < < < | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #define ACTIVE 4 /* * Extra padding used for computing the content size that should * be allowed when drawing the HITheme button. */ #define HI_PADX 14 #define HI_PADY 1 /* * The delay in milliseconds between pulsing default button redraws. */ #define PULSE_TIMER_MSECS 62 /* Largest value that didn't look stuttery */ /* * Declaration of Mac specific button structure. */ typedef struct { Tk_3DBorder border; int relief; int offset; /* 0 means this is a normal widget. 1 means * it is an image button, so we offset the * image to make the button appear to move * up and down as the relief changes. */ GC gc; |
︙ | ︙ | |||
76 77 78 79 80 81 82 | Tcl_TimerToken defaultPulseHandler; } MacButton; /* * Forward declarations for procedures defined later in this file: */ | < | | > | | | | > | > | | > | > | | < | | | | | < | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | Tcl_TimerToken defaultPulseHandler; } MacButton; /* * Forward declarations for procedures defined later in this file: */ static void ButtonBackgroundDrawCB(const HIRect *btnbounds, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonContentDrawCB(const HIRect *bounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacButton *ptr, SInt16 depth, Boolean isColorDev); static void ButtonEventProc(ClientData clientData, XEvent *eventPtr); static void TkMacOSXComputeButtonParams(TkButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo); static int TkMacOSXComputeButtonDrawParams(TkButton *butPtr, DrawParams * dpPtr); static void TkMacOSXDrawButton(MacButton *butPtr, GC gc, Pixmap pixmap); static void DrawButtonImageAndText(TkButton *butPtr); static void PulseDefaultButtonProc(ClientData clientData); /* * The class procedure table for the button widgets. */ const Tk_ClassProcs tkpButtonProcs = { sizeof(Tk_ClassProcs), /* size */ TkButtonWorldChanged, /* worldChangedProc */ }; static int bCount; /* *---------------------------------------------------------------------- * * TkpButtonSetDefaults -- * * This procedure is invoked before option tables are created for buttons. * It modifies some of the default values to match the current values * defined for this platform. * * Results: * Some of the default values in *specPtr are modified. * * Side effects: * Updates some of. * *---------------------------------------------------------------------- */ void TkpButtonSetDefaults() { /*No-op.*/ } /* *---------------------------------------------------------------------- * * TkpCreateButton -- * * Allocate a new TkButton structure. |
︙ | ︙ | |||
147 148 149 150 151 152 153 | *---------------------------------------------------------------------- */ TkButton * TkpCreateButton( Tk_Window tkwin) { | | | | | | | | | | > > > < < < < < < < < > > > > > > > > | > > | > | > > > | > > > | > > > | > | < > > > | | | | | | < | < < < | | | | > | | | > | | | | > > | > > | | | | | | | < < | | | | | | | | | | | | | | | | | | | | | | | | | | < | | > > > > > > | > | > | < < < < | > | > > > | | | > > > > | > | < < | < < | < < < < < < < < < < < < < < < < | < | < | | | | | | | | | < | < | < | < | < | < < < | | | > | > > | < < < < < | | | | | | | | | < | | | < | | | | | | | | | | | | | | | < | | | | | | | | | | | | | < | | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | *---------------------------------------------------------------------- */ TkButton * TkpCreateButton( Tk_Window tkwin) { MacButton *macButtonPtr = ckalloc(sizeof(MacButton)); Tk_CreateEventHandler(tkwin, ActivateMask, ButtonEventProc, macButtonPtr); macButtonPtr->id = bCount++; macButtonPtr->flags = FIRST_DRAW; macButtonPtr->btnkind = kThemePushButton; macButtonPtr->defaultPulseHandler = NULL; bzero(&macButtonPtr->drawinfo, sizeof(macButtonPtr->drawinfo)); bzero(&macButtonPtr->lastdrawinfo, sizeof(macButtonPtr->lastdrawinfo)); return (TkButton *) macButtonPtr; } /* *---------------------------------------------------------------------- * * TkpDisplayButton -- * * This procedure is invoked to display a button widget. It is normally * invoked as an idle handler. * * Results: * None. * * Side effects: * Commands are output to X to display the button in its current mode. The * REDRAW_PENDING flag is cleared. * *---------------------------------------------------------------------- */ void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { MacButton *macButtonPtr = clientData; TkButton *butPtr = clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams* dpPtr = &macButtonPtr->drawParams; int needhighlight = 0; if (butPtr->flags & BUTTON_DELETED) { return; } butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } pixmap = (Pixmap) Tk_WindowId(tkwin); /* * Set up clipping region. Make sure the we are using the port * for this button, or we will set the wrong window's clip. */ TkMacOSXSetUpClippingRgn(Tk_WindowId(tkwin)); if (TkMacOSXComputeButtonDrawParams(butPtr, dpPtr)) { macButtonPtr->useTkText = 0; } else { macButtonPtr->useTkText = 1; } if (macButtonPtr->useTkText) { if (butPtr->type == TYPE_BUTTON) { Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } else { Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } /* * Display image or bitmap or text for labels or custom controls. */ DrawButtonImageAndText(butPtr); needhighlight = 1; } else { /* * Draw the native portion of the buttons. */ TkMacOSXDrawButton(macButtonPtr, dpPtr->gc, pixmap); /* * Ask for the highlight border, if needed. */ if (butPtr->highlightWidth < 3) { needhighlight = 1; } } /* * Draw highlight border, if needed. */ if (needhighlight) { GC gc = NULL; if ((butPtr->flags & GOT_FOCUS) && butPtr->highlightColorPtr) { gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); } else if (butPtr->type == TYPE_LABEL) { gc = Tk_GCForColor(Tk_3DBorderColor(butPtr->highlightBorder), pixmap); } if (gc) { TkMacOSXDrawSolidBorder(tkwin, gc, 0, butPtr->highlightWidth); } } } /* *---------------------------------------------------------------------- * * TkpComputeButtonGeometry -- * * After changes in a button's text or bitmap, this procedure recomputes * the button's geometry and passes this information along to the geometry * manager for the window. * * Results: * None. * * Side effects: * The button's window may change size. * *---------------------------------------------------------------------- */ void TkpComputeButtonGeometry( TkButton *butPtr) /* Button whose geometry may have changed. */ { int width = 0, height = 0, charWidth = 1, haveImage = 0, haveText = 0; int txtWidth = 0, txtHeight = 0; MacButton *mbPtr = (MacButton *) butPtr; Tk_FontMetrics fm; char *text = Tcl_GetString(butPtr->textPtr); TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); /* * If the indicator is on, get its size. */ if (butPtr->indicatorOn) { switch (butPtr->type) { case TYPE_RADIO_BUTTON: GetThemeMetric(kThemeMetricRadioButtonWidth, (SInt32 *) &butPtr->indicatorDiameter); break; case TYPE_CHECK_BUTTON: GetThemeMetric(kThemeMetricCheckBoxWidth, (SInt32 *) &butPtr->indicatorDiameter); break; default: break; } /* * Allow 2px extra space next to the indicator. */ butPtr->indicatorSpace = butPtr->indicatorDiameter + 2; } else { butPtr->indicatorSpace = 0; butPtr->indicatorDiameter = 0; } if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } if (haveImage == 0 || butPtr->compound != COMPOUND_NONE) { Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, text, -1, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth + 2*butPtr->padX; txtHeight = butPtr->textHeight + 2*butPtr->padY; haveText = 1; } if (haveImage && haveText) { /* Image and Text */ switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* * Image is above or below text. */ height += txtHeight + butPtr->padY; width = (width > txtWidth ? width : txtWidth); break; case COMPOUND_LEFT: case COMPOUND_RIGHT: /* * Image is left or right of text. */ width += txtWidth + 2*butPtr->padX; height = (height > txtHeight ? height : txtHeight); break; case COMPOUND_CENTER: /* * Image and text are superimposed. */ width = (width > txtWidth ? width : txtWidth); height = (height > txtHeight ? height : txtHeight); break; default: break; } width += butPtr->indicatorSpace; } else if (haveImage) { /* Image only */ width = butPtr->width > 0 ? butPtr->width : width + butPtr->indicatorSpace; height = butPtr->height > 0 ? butPtr->height : height; if (butPtr->type == TYPE_BUTTON) { /* * Allow room to shift the image. */ width += 2; height += 2; } } else { /* Text only */ width = txtWidth + butPtr->indicatorSpace; height = txtHeight; if (butPtr->width > 0) { charWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); width = butPtr->width * charWidth + 2*butPtr->padX; } if (butPtr->height > 0) { Tk_GetFontMetrics(butPtr->tkfont, &fm); height = butPtr->height * fm.linespace + 2*butPtr->padY; } } /* * Now figure out the size of the border decorations for the button. */ if (butPtr->highlightWidth < 0) { butPtr->highlightWidth = 0; } butPtr->inset = butPtr->borderWidth + butPtr->highlightWidth; width += butPtr->inset*2; height += butPtr->inset*2; if ([NSApp macMinorVersion] == 6) { width += 12; } if (mbPtr->btnkind == kThemePushButton) { HIRect tmpRect; HIRect contBounds; /* * A PushButton has a minimum size. We make sure that we are not * underestimating the size by requesting the content size of a * Pushbutton whose overall size is our content size expanded by the * standard padding. */ tmpRect = CGRectMake(0, 0, width + 2*HI_PADX, height + 2*HI_PADY); HIThemeGetButtonContentBounds(&tmpRect, &mbPtr->drawinfo, &contBounds); if (height < contBounds.size.height) { height = contBounds.size.height; } if (width < contBounds.size.width) { width = contBounds.size.width; } height += 2*HI_PADY; width += 2*HI_PADX; } Tk_GeometryRequest(butPtr->tkwin, width, height); Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset); } /* *---------------------------------------------------------------------- * * DrawButtonImageAndText -- * * Draws the image and text associated with a button or label. * * Results: * None. * * Side effects: * The image and text are drawn. * *---------------------------------------------------------------------- */ static void DrawButtonImageAndText( TkButton *butPtr) { MacButton *mbPtr = (MacButton *) butPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int haveImage = 0, haveText = 0, pressed = 0; int imageWidth = 0, imageHeight = 0; int imageXOffset = 0, imageYOffset = 0; int textXOffset = 0, textYOffset = 0; int width = 0, height = 0; int fullWidth = 0, fullHeight = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } DrawParams *dpPtr = &mbPtr->drawParams; pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != None) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } imageWidth = width; imageHeight = height; if (mbPtr->drawinfo.state == kThemeStatePressed) { /* * Offset bitmaps by a bit when the button is pressed. */ pressed = 1; } haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); if (haveImage && haveText) { /* Image and Text */ int x, y; switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* Image is above or below text */ if (butPtr->compound == COMPOUND_TOP) { textYOffset = height + butPtr->padY; } else { imageYOffset = butPtr->textHeight + butPtr->padY; } fullHeight = height + butPtr->textHeight + butPtr->padY; fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth); textXOffset = (fullWidth - butPtr->textWidth)/2; imageXOffset = (fullWidth - width)/2; break; case COMPOUND_LEFT: case COMPOUND_RIGHT: /* * Image is left or right of text */ if (butPtr->compound == COMPOUND_LEFT) { textXOffset = width + butPtr->padX; } else { imageXOffset = butPtr->textWidth + butPtr->padX; } fullWidth = butPtr->textWidth + butPtr->padX + width; fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); textYOffset = (fullHeight - butPtr->textHeight)/2; imageYOffset = (fullHeight - height)/2; break; case COMPOUND_CENTER: /* * Image and text are superimposed */ fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth); fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); textXOffset = (fullWidth - butPtr->textWidth)/2; imageXOffset = (fullWidth - width)/2; textYOffset = (fullHeight - butPtr->textHeight)/2; imageYOffset = (fullHeight - height)/2; break; default: break; } TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->borderWidth, butPtr->padY + butPtr->borderWidth, fullWidth + butPtr->indicatorSpace, fullHeight, &x, &y); x += butPtr->indicatorSpace; |
︙ | ︙ | |||
566 567 568 569 570 571 572 | } if (pressed) { x += dpPtr->offset; y += dpPtr->offset; } imageXOffset += x; imageYOffset += y; | < | | | | | | | | | | | | | | | | | | > | | | | | < | | < | | | | | | | | | | | | | | < | < | | > | | > | | | | | | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 | } if (pressed) { x += dpPtr->offset; y += dpPtr->offset; } imageXOffset += x; imageYOffset += y; if (butPtr->image != NULL) { if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) { Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else if ((butPtr->tristateImage != NULL) && (butPtr->flags & TRISTATED)) { Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else { Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } } else { XSetClipOrigin(butPtr->display, dpPtr->gc, imageXOffset, imageYOffset); XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } y += 1; /* Tweak to match native buttons. */ Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1); Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, butPtr->underline); } else if (haveImage) { /* Image only */ int x = 0, y; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->borderWidth, butPtr->padY + butPtr->borderWidth, width + butPtr->indicatorSpace, height, &x, &y); x += butPtr->indicatorSpace; if (pressed) { x += dpPtr->offset; y += dpPtr->offset; } imageXOffset += x; imageYOffset += y; if (butPtr->image != NULL) { if ((butPtr->selectImage != NULL) && (butPtr->flags & SELECTED)) { Tk_RedrawImage(butPtr->selectImage, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else if ((butPtr->tristateImage != NULL) && (butPtr->flags & TRISTATED)) { Tk_RedrawImage(butPtr->tristateImage, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else { Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } } else { XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } } else { /* Text only */ int x, y; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, butPtr->textWidth + butPtr->indicatorSpace, butPtr->textHeight, &x, &y); x += butPtr->indicatorSpace; y += 1; /* Tweak to match native buttons */ Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x, y, 0, -1); } /* * If the button is disabled with a stipple rather than a special * foreground color, generate the stippled effect. If the widget is * selected and we use a different background color when selected, must * temporarily modify the GC so the stippling is the right color. */ if (mbPtr->useTkText) { if ((butPtr->state == STATE_DISABLED) && ((butPtr->disabledFg == NULL) || (butPtr->image != NULL))) { if ((butPtr->flags & SELECTED) && !butPtr->indicatorOn && (butPtr->selectBorder != NULL)) { |
︙ | ︙ | |||
688 689 690 691 692 693 694 | /* * Draw the border and traversal highlight last. This way, if the * button's contents overflow they'll be covered up by the border. */ if (dpPtr->relief != TK_RELIEF_FLAT) { | | > | | | | | < < < < | 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | /* * Draw the border and traversal highlight last. This way, if the * button's contents overflow they'll be covered up by the border. */ if (dpPtr->relief != TK_RELIEF_FLAT) { int inset = butPtr->highlightWidth; Tk_Draw3DRectangle(tkwin, pixmap, dpPtr->border, inset, inset, Tk_Width(tkwin) - 2*inset, Tk_Height(tkwin) - 2*inset, butPtr->borderWidth, dpPtr->relief); } } } /* *---------------------------------------------------------------------- * * TkpDestroyButton -- * * Free data structures associated with the button control. * |
︙ | ︙ | |||
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 | */ void TkpDestroyButton( TkButton *butPtr) { MacButton *mbPtr = (MacButton *) butPtr; /* Mac button. */ if (mbPtr->defaultPulseHandler) { Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); } } /* *-------------------------------------------------------------- * * TkMacOSXDrawButton -- * | > | | < | | | | < < | < | < | | > > > > > > > > > | | | < | | > | | | | | | | | | | | | | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 | */ void TkpDestroyButton( TkButton *butPtr) { MacButton *mbPtr = (MacButton *) butPtr; /* Mac button. */ if (mbPtr->defaultPulseHandler) { Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); } } /* *-------------------------------------------------------------- * * TkMacOSXDrawButton -- * * This function draws the tk button using Mac controls. In addition, * this code may apply custom colors passed in the TkButton. * * Results: * None. * * Side effects: * The control is created, or reinitialised as needed * *-------------------------------------------------------------- */ static void TkMacOSXDrawButton( MacButton *mbPtr, /* Mac button. */ GC gc, /* The GC we are drawing into - needed for * the bevel button */ Pixmap pixmap) /* The pixmap we are drawing into - needed * for the bevel button */ { TkButton *butPtr = (TkButton *) mbPtr; TkWindow *winPtr = (TkWindow *) butPtr->tkwin; HIRect cntrRect; TkMacOSXDrawingContext dc; DrawParams *dpPtr = &mbPtr->drawParams; int useNewerHITools = 1; TkMacOSXComputeButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); cntrRect = CGRectMake(winPtr->privatePtr->xOff, winPtr->privatePtr->yOff, Tk_Width(butPtr->tkwin), Tk_Height(butPtr->tkwin)); cntrRect = CGRectInset(cntrRect, butPtr->inset, butPtr->inset); if (useNewerHITools == 1) { HIRect contHIRec; static HIThemeButtonDrawInfo hiinfo; ButtonBackgroundDrawCB(&cntrRect, mbPtr, 32, true); if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } hiinfo.version = 0; hiinfo.state = mbPtr->drawinfo.state; hiinfo.kind = mbPtr->btnkind; hiinfo.value = mbPtr->drawinfo.value; hiinfo.adornment = mbPtr->drawinfo.adornment; hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); if (hiinfo.animation.time.start == 0) { hiinfo.animation.time.start = hiinfo.animation.time.current; } /* * To avoid buttons with white text on a white background, we always * set the state to inactive in Dark Mode. It isn't perfect but it is * usable. Using a ttk::button would be a better choice, however. */ if (TkMacOSXInDarkMode(butPtr->tkwin)) { hiinfo.state = kThemeStateInactive; } HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); ButtonContentDrawCB(&contHIRec, mbPtr->btnkind, &mbPtr->drawinfo, (MacButton *) mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } TkMacOSXRestoreDrawingContext(&dc); } mbPtr->lastdrawinfo = mbPtr->drawinfo; } /* *-------------------------------------------------------------- * * ButtonBackgroundDrawCB -- * * This function draws the background that lies under checkboxes and * radiobuttons. * * Results: * None. * * Side effects: * The background gets updated to the current color. * *-------------------------------------------------------------- */ static void ButtonBackgroundDrawCB( const HIRect *btnbounds, MacButton *ptr, SInt16 depth, Boolean isColorDev) { MacButton *mbPtr = (MacButton *) ptr; TkButton *butPtr = (TkButton *) mbPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int usehlborder = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->type != TYPE_LABEL) { switch (mbPtr->btnkind) { case kThemeSmallBevelButton: case kThemeBevelButton: case kThemeRoundedBevelButton: case kThemePushButton: usehlborder = 1; break; } } if (usehlborder) { Tk_Fill3DRectangle(tkwin, pixmap, butPtr->highlightBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } else { Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, |
︙ | ︙ | |||
884 885 886 887 888 889 890 | const HIRect * btnbounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *drawinfo, MacButton *ptr, SInt16 depth, Boolean isColorDev) { | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | const HIRect * btnbounds, ThemeButtonKind kind, const HIThemeButtonDrawInfo *drawinfo, MacButton *ptr, SInt16 depth, Boolean isColorDev) { TkButton *butPtr = (TkButton *) ptr; Tk_Window tkwin = butPtr->tkwin; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } /* * Overlay Tk elements over button native region: drawing elements within * button boundaries/native region causes unpredictable metrics. */ DrawButtonImageAndText( butPtr); } /* *-------------------------------------------------------------- * * ButtonEventProc -- * * This procedure is invoked by the Tk dispatcher for various events on * buttons. * * Results: * None. * * Side effects: * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkButton *buttonPtr = clientData; MacButton *mbPtr = clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) { return; } if (eventPtr->type == ActivateNotify) { mbPtr->flags |= ACTIVE; } else { mbPtr->flags &= ~ACTIVE; } if ((buttonPtr->flags & REDRAW_PENDING) == 0) { Tcl_DoWhenIdle(TkpDisplayButton, buttonPtr); buttonPtr->flags |= REDRAW_PENDING; } } } /* *---------------------------------------------------------------------- * * TkMacOSXComputeButtonParams -- * * This procedure computes the various parameters used when creating a * Carbon Appearance control. These are determined by the various tk * button parameters * * Results: * None. * * Side effects: * Sets the btnkind and drawinfo parameters * *---------------------------------------------------------------------- */ static void TkMacOSXComputeButtonParams( TkButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo) { MacButton *mbPtr = (MacButton *) butPtr; if (butPtr->borderWidth <= 2) { *btnkind = kThemeSmallBevelButton; } else if (butPtr->borderWidth == 3) { *btnkind = kThemeBevelButton; } else if (butPtr->borderWidth == 4) { *btnkind = kThemeRoundedBevelButton; } else { *btnkind = kThemePushButton; } if ((butPtr->image == None) && (butPtr->bitmap == None)) { switch (butPtr->type) { case TYPE_BUTTON: *btnkind = kThemePushButton; break; case TYPE_RADIO_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallRadioButton; } else { *btnkind = kThemeRadioButton; } break; case TYPE_CHECK_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallCheckBox; } else { *btnkind = kThemeCheckBox; } break; } } if (butPtr->indicatorOn) { switch (butPtr->type) { case TYPE_RADIO_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallRadioButton; } else { *btnkind = kThemeRadioButton; } break; case TYPE_CHECK_BUTTON: if (butPtr->borderWidth <= 1) { *btnkind = kThemeSmallCheckBox; } else { *btnkind = kThemeCheckBox; } break; } } else { if (butPtr->type == TYPE_RADIO_BUTTON || butPtr->type == TYPE_CHECK_BUTTON) { if (*btnkind == kThemePushButton) { *btnkind = kThemeBevelButton; } } } if (butPtr->flags & SELECTED) { |
︙ | ︙ | |||
1060 1061 1062 1063 1064 1065 1066 | } drawinfo->adornment = kThemeAdornmentNone; if (butPtr->defaultState == DEFAULT_ACTIVE) { drawinfo->adornment |= kThemeAdornmentDefault; if (!mbPtr->defaultPulseHandler) { mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( | | < | < | | | | | | | | < | | > > | | | < < < < < | < < < < < < > | > | < < < < > | > | | 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | } drawinfo->adornment = kThemeAdornmentNone; if (butPtr->defaultState == DEFAULT_ACTIVE) { drawinfo->adornment |= kThemeAdornmentDefault; if (!mbPtr->defaultPulseHandler) { mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( PULSE_TIMER_MSECS, PulseDefaultButtonProc, butPtr); } } else if (mbPtr->defaultPulseHandler) { Tcl_DeleteTimerHandler(mbPtr->defaultPulseHandler); } if (butPtr->highlightWidth >= 3) { if ((butPtr->flags & GOT_FOCUS)) { drawinfo->adornment |= kThemeAdornmentFocus; } } } /* *---------------------------------------------------------------------- * * TkMacOSXComputeButtonDrawParams -- * * This procedure computes the various parameters used when drawing a * button. These are determined by the various tk button parameters * * Results: * 1 if control will be used, 0 otherwise. * * Side effects: * Sets the button draw parameters * *---------------------------------------------------------------------- */ static int TkMacOSXComputeButtonDrawParams( TkButton *butPtr, DrawParams *dpPtr) { MacButton *mbPtr = (MacButton *) butPtr; dpPtr->hasImageOrBitmap = ((butPtr->image != NULL) || (butPtr->bitmap != None)); if (butPtr->type != TYPE_LABEL) { dpPtr->offset = 0; if (dpPtr->hasImageOrBitmap) { switch (mbPtr->btnkind) { case kThemeSmallBevelButton: case kThemeBevelButton: case kThemeRoundedBevelButton: case kThemePushButton: dpPtr->offset = 1; break; } } } dpPtr->border = butPtr->normalBorder; if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) { dpPtr->gc = butPtr->disabledGC; } else if (butPtr->type == TYPE_BUTTON && butPtr->state == STATE_ACTIVE) { dpPtr->gc = butPtr->activeTextGC; dpPtr->border = butPtr->activeBorder; } else { dpPtr->gc = butPtr->normalTextGC; } if ((butPtr->flags & SELECTED) && (butPtr->state != STATE_ACTIVE) && (butPtr->selectBorder != NULL) && !butPtr->indicatorOn) { dpPtr->border = butPtr->selectBorder; } /* * Override the relief specified for the button if this is a checkbutton or * radiobutton and there's no indicator. */ dpPtr->relief = butPtr->relief; if ((butPtr->type >= TYPE_CHECK_BUTTON) && !butPtr->indicatorOn) { if (!dpPtr->hasImageOrBitmap) { dpPtr->relief = (butPtr->flags & SELECTED) ? TK_RELIEF_SUNKEN : TK_RELIEF_RAISED; } } if (butPtr->type != TYPE_LABEL && (butPtr->type == TYPE_BUTTON || butPtr->indicatorOn || dpPtr->hasImageOrBitmap)) { /* * Draw this widget as a native control. */ return 1; } else { /* * Draw this widget from scratch. */ return 0; } } /* *-------------------------------------------------------------- * * PulseDefaultButtonProc -- * * This function redraws the button on a timer, to pulse * default buttons. * * Results: * None. * * Side effects: * Sets a timer to run itself again. * *-------------------------------------------------------------- */ static void PulseDefaultButtonProc(ClientData clientData) { MacButton *mbPtr = clientData; TkpDisplayButton(clientData); mbPtr->defaultPulseHandler = Tcl_CreateTimerHandler( PULSE_TIMER_MSECS, PulseDefaultButtonProc, clientData); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXClipboard.c.
︙ | ︙ | |||
119 120 121 122 123 124 125 | * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ ClientData clientData) /* Arbitrary value to pass to proc. */ { int result = TCL_ERROR; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; | | | > | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | * returned. */ Tk_GetSelProc *proc, /* Procedure to call to process the selection, * once it has been retrieved. */ ClientData clientData) /* Arbitrary value to pass to proc. */ { int result = TCL_ERROR; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; int haveExternalClip = ([[NSPasteboard generalPasteboard] changeCount] != changeCount); if (dispPtr && (haveExternalClip || dispPtr->clipboardActive) && selection == dispPtr->clipboardAtom && (target == XA_STRING || target == dispPtr->utf8Atom)) { NSString *string = nil; NSPasteboard *pb = [NSPasteboard generalPasteboard]; NSString *type = [pb availableTypeFromArray:[NSArray arrayWithObject: NSStringPboardType]]; |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | { TkDisplay *dispPtr = TkGetDisplayList(); if (dispPtr && selection == dispPtr->clipboardAtom) { clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL; if (!dispPtr->clipboardActive) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; changeCount = [pb declareTypes:[NSArray array] owner:NSApp]; } } return Success; } /* *---------------------------------------------------------------------- * * TkMacOSXSelDeadWindow -- * | > | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | { TkDisplay *dispPtr = TkGetDisplayList(); if (dispPtr && selection == dispPtr->clipboardAtom) { clipboardOwner = owner ? Tk_IdToWindow(display, owner) : NULL; if (!dispPtr->clipboardActive) { NSPasteboard *pb = [NSPasteboard generalPasteboard]; changeCount = [pb declareTypes:[NSArray array] owner:NSApp]; } } return Success; } /* *---------------------------------------------------------------------- * * TkMacOSXSelDeadWindow -- * * This function is invoked just before a TkWindow is deleted. It performs * selection-related cleanup. * * Results: * None. * * Side effects: * clipboardOwner is cleared. * |
︙ | ︙ |
Changes to macosx/tkMacOSXColor.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 20 21 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkColor.h" struct SystemColorMapEntry { const char *name; | > > > > > > > > > > > > > > > > > > > > > > < | < > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > < < < < < < < < < < < | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > | > | | | < < | | | < | < | < < < < < < < < < | | | > | > > > > > > > | > < < < > > > > > > > > > > | > > > > > > > > > | > > > > > > > | > > > > | > > > > | > > > > | > > | < | < | < | > > | > | | > | < | > > > > > > > | > > | > > > > > > > > > > | > > > > > > > > > > > > > > > > > > | > > > > | > > > > > > > > > > > > > | > > > > > > > > > > > | > > > > > | > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > | < | < | < < | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkColor.h" /* * The colorType specifies how the color value should be interpreted. For the * unique rgbColor entry, the RGB values are generated from the pixel value of * an XColor. The ttkBackground and semantic types are dynamic, meaning * that they change when dark mode is enabled on OSX 10.13 and later. */ enum colorType { clearColor, /* There should be only one of these. */ rgbColor, /* There should be only one of these. */ appearance, /* There should be only one of these. */ HIBrush, /* The value is a HITheme brush color table index. */ HIText, /* The value is a HITheme text color table index. */ HIBackground, /* The value is a HITheme background color table index. */ ttkBackground, /* The value can be used as a parameter.*/ semantic, /* The value can be used as a parameter.*/ }; /* */ struct SystemColorMapEntry { const char *name; enum colorType type; long value; }; /* unsigned char pixelCode; */ /* * Array of system color definitions: the array index is required to equal the * color's (pixelCode - MIN_PIXELCODE), i.e. the array order needs to be kept * in sync with the public pixel code values in tkMacOSXPort.h ! */ #define MIN_PIXELCODE 30 static const struct SystemColorMapEntry systemColorMap[] = { { "Transparent", clearColor, 0 }, /* 30: TRANSPARENT_PIXEL */ { "Highlight", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 31 */ { "HighlightSecondary", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 32 */ { "HighlightText", HIBrush, kThemeBrushBlack }, /* 33 */ { "HighlightAlternate", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 34 */ { "ButtonText", HIText, kThemeTextColorPushButtonActive }, /* 35 */ { "PrimaryHighlightColor", HIBrush, kThemeBrushPrimaryHighlightColor }, /* 36 */ { "ButtonFace", HIBrush, kThemeBrushButtonFaceActive }, /* 37 */ { "SecondaryHighlightColor", HIBrush, kThemeBrushSecondaryHighlightColor }, /* 38 */ { "ButtonFrame", HIBrush, kThemeBrushButtonFrameActive }, /* 39 */ { "AlternatePrimaryHighlightColor", HIBrush, kThemeBrushAlternatePrimaryHighlightColor }, /* 40 */ { "WindowBody", HIBrush, kThemeBrushDocumentWindowBackground }, /* 41 */ { "SheetBackground", HIBrush, kThemeBrushSheetBackground }, /* 42 */ { "MenuActive", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 43 */ { "Black", HIBrush, kThemeBrushBlack }, /* 44 */ { "MenuActiveText", HIText, kThemeTextColorMenuItemSelected }, /* 45 */ { "White", HIBrush, kThemeBrushWhite }, /* 46 */ { "Menu", HIBrush, kThemeBrushMenuBackground }, /* 47 */ { "DialogBackgroundActive", HIBrush, kThemeBrushDialogBackgroundActive }, /* 48 */ { "MenuDisabled", HIText, kThemeTextColorMenuItemDisabled }, /* 49 */ { "DialogBackgroundInactive", HIBrush, kThemeBrushDialogBackgroundInactive }, /* 50 */ { "MenuText", HIText, kThemeTextColorMenuItemActive }, /* 51 */ { "AppearanceColor", appearance, 0 }, /* 52: APPEARANCE_PIXEL */ { "AlertBackgroundActive", HIBrush, kThemeBrushAlertBackgroundActive }, /* 53 */ { "AlertBackgroundInactive", HIBrush, kThemeBrushAlertBackgroundInactive }, /* 54 */ { "ModelessDialogBackgroundActive", HIBrush, kThemeBrushModelessDialogBackgroundActive }, /* 55 */ { "ModelessDialogBackgroundInactive", HIBrush, kThemeBrushModelessDialogBackgroundInactive }, /* 56 */ { "UtilityWindowBackgroundActive", HIBrush, kThemeBrushUtilityWindowBackgroundActive }, /* 57 */ { "UtilityWindowBackgroundInactive", HIBrush, kThemeBrushUtilityWindowBackgroundInactive }, /* 58 */ { "ListViewSortColumnBackground", HIBrush, kThemeBrushListViewSortColumnBackground }, /* 59 */ { "ListViewBackground", HIBrush, kThemeBrushListViewBackground }, /* 60 */ { "IconLabelBackground", HIBrush, kThemeBrushIconLabelBackground }, /* 61 */ { "ListViewSeparator", HIBrush, kThemeBrushListViewSeparator }, /* 62 */ { "ChasingArrows", HIBrush, kThemeBrushChasingArrows }, /* 63 */ { "DragHilite", HIBrush, kThemeBrushDragHilite }, /* 64 */ { "DocumentWindowBackground", HIBrush, kThemeBrushDocumentWindowBackground }, /* 65 */ { "FinderWindowBackground", HIBrush, kThemeBrushFinderWindowBackground }, /* 66 */ { "ScrollBarDelimiterActive", HIBrush, kThemeBrushScrollBarDelimiterActive }, /* 67 */ { "ScrollBarDelimiterInactive", HIBrush, kThemeBrushScrollBarDelimiterInactive }, /* 68 */ { "FocusHighlight", HIBrush, kThemeBrushFocusHighlight }, /* 69 */ { "PopupArrowActive", HIBrush, kThemeBrushPopupArrowActive }, /* 70 */ { "PopupArrowPressed", HIBrush, kThemeBrushPopupArrowPressed }, /* 71 */ { "PopupArrowInactive", HIBrush, kThemeBrushPopupArrowInactive }, /* 72 */ { "AppleGuideCoachmark", HIBrush, kThemeBrushAppleGuideCoachmark }, /* 73 */ { "IconLabelBackgroundSelected", HIBrush, kThemeBrushIconLabelBackgroundSelected }, /* 74 */ { "StaticAreaFill", HIBrush, kThemeBrushStaticAreaFill }, /* 75 */ { "ActiveAreaFill", HIBrush, kThemeBrushActiveAreaFill }, /* 76 */ { "ButtonFrameActive", HIBrush, kThemeBrushButtonFrameActive }, /* 77 */ { "ButtonFrameInactive", HIBrush, kThemeBrushButtonFrameInactive }, /* 78 */ { "ButtonFaceActive", HIBrush, kThemeBrushButtonFaceActive }, /* 79 */ { "ButtonFaceInactive", HIBrush, kThemeBrushButtonFaceInactive }, /* 80 */ { "ButtonFacePressed", HIBrush, kThemeBrushButtonFacePressed }, /* 81 */ { "ButtonActiveDarkShadow", HIBrush, kThemeBrushButtonActiveDarkShadow }, /* 82 */ { "ButtonActiveDarkHighlight", HIBrush, kThemeBrushButtonActiveDarkHighlight }, /* 83 */ { "ButtonActiveLightShadow", HIBrush, kThemeBrushButtonActiveLightShadow }, /* 84 */ { "ButtonActiveLightHighlight", HIBrush, kThemeBrushButtonActiveLightHighlight }, /* 85 */ { "ButtonInactiveDarkShadow", HIBrush, kThemeBrushButtonInactiveDarkShadow }, /* 86 */ { "ButtonInactiveDarkHighlight", HIBrush, kThemeBrushButtonInactiveDarkHighlight }, /* 87 */ { "ButtonInactiveLightShadow", HIBrush, kThemeBrushButtonInactiveLightShadow }, /* 88 */ { "ButtonInactiveLightHighlight", HIBrush, kThemeBrushButtonInactiveLightHighlight }, /* 89 */ { "ButtonPressedDarkShadow", HIBrush, kThemeBrushButtonPressedDarkShadow }, /* 90 */ { "ButtonPressedDarkHighlight", HIBrush, kThemeBrushButtonPressedDarkHighlight }, /* 91 */ { "ButtonPressedLightShadow", HIBrush, kThemeBrushButtonPressedLightShadow }, /* 92 */ { "ButtonPressedLightHighlight", HIBrush, kThemeBrushButtonPressedLightHighlight }, /* 93 */ { "BevelActiveLight", HIBrush, kThemeBrushBevelActiveLight }, /* 94 */ { "BevelActiveDark", HIBrush, kThemeBrushBevelActiveDark }, /* 95 */ { "BevelInactiveLight", HIBrush, kThemeBrushBevelInactiveLight }, /* 96 */ { "BevelInactiveDark", HIBrush, kThemeBrushBevelInactiveDark }, /* 97 */ { "NotificationWindowBackground", HIBrush, kThemeBrushNotificationWindowBackground }, /* 98 */ { "MovableModalBackground", HIBrush, kThemeBrushMovableModalBackground }, /* 99 */ { "SheetBackgroundOpaque", HIBrush, kThemeBrushSheetBackgroundOpaque }, /* 100 */ { "DrawerBackground", HIBrush, kThemeBrushDrawerBackground }, /* 101 */ { "ToolbarBackground", HIBrush, kThemeBrushToolbarBackground }, /* 102 */ { "SheetBackgroundTransparent", HIBrush, kThemeBrushSheetBackgroundTransparent }, /* 103 */ { "MenuBackground", HIBrush, kThemeBrushMenuBackground }, /* 104 */ { "Pixel", rgbColor, 0 }, /* 105: PIXEL_MAGIC */ { "MenuBackgroundSelected", HIBrush, kThemeBrushMenuBackgroundSelected }, /* 106 */ { "ListViewOddRowBackground", HIBrush, kThemeBrushListViewOddRowBackground }, /* 107 */ { "ListViewEvenRowBackground", HIBrush, kThemeBrushListViewEvenRowBackground }, /* 108 */ { "ListViewColumnDivider", HIBrush, kThemeBrushListViewColumnDivider }, /* 109 */ { "BlackText", HIText, kThemeTextColorBlack }, /* 110 */ { "DialogActiveText", HIText, kThemeTextColorDialogActive }, /* 111 */ { "DialogInactiveText", HIText, kThemeTextColorDialogInactive }, /* 112 */ { "AlertActiveText", HIText, kThemeTextColorAlertActive }, /* 113 */ { "AlertInactiveText", HIText, kThemeTextColorAlertInactive }, /* 114 */ { "ModelessDialogActiveText", HIText, kThemeTextColorModelessDialogActive }, /* 115 */ { "ModelessDialogInactiveText", HIText, kThemeTextColorModelessDialogInactive }, /* 116 */ { "WindowHeaderActiveText", HIText, kThemeTextColorWindowHeaderActive }, /* 117 */ { "WindowHeaderInactiveText", HIText, kThemeTextColorWindowHeaderInactive }, /* 118 */ { "PlacardActiveText", HIText, kThemeTextColorPlacardActive }, /* 119 */ { "PlacardInactiveText", HIText, kThemeTextColorPlacardInactive }, /* 120 */ { "PlacardPressedText", HIText, kThemeTextColorPlacardPressed }, /* 121 */ { "PushButtonActiveText", HIText, kThemeTextColorPushButtonActive }, /* 122 */ { "PushButtonInactiveText", HIText, kThemeTextColorPushButtonInactive }, /* 123 */ { "PushButtonPressedText", HIText, kThemeTextColorPushButtonPressed }, /* 124 */ { "BevelButtonActiveText", HIText, kThemeTextColorBevelButtonActive }, /* 125 */ { "BevelButtonInactiveText", HIText, kThemeTextColorBevelButtonInactive }, /* 126 */ { "BevelButtonPressedText", HIText, kThemeTextColorBevelButtonPressed }, /* 127 */ { "PopupButtonActiveText", HIText, kThemeTextColorPopupButtonActive }, /* 128 */ { "PopupButtonInactiveText", HIText, kThemeTextColorPopupButtonInactive }, /* 129 */ { "PopupButtonPressedText", HIText, kThemeTextColorPopupButtonPressed }, /* 130 */ { "IconLabelText", HIText, kThemeTextColorIconLabel }, /* 131 */ { "ListViewText", HIText, kThemeTextColorListView }, /* 132 */ { "DocumentWindowTitleActiveText", HIText, kThemeTextColorDocumentWindowTitleActive }, /* 133 */ { "DocumentWindowTitleInactiveText", HIText, kThemeTextColorDocumentWindowTitleInactive }, /* 134 */ { "MovableModalWindowTitleActiveText", HIText, kThemeTextColorMovableModalWindowTitleActive }, /* 135 */ { "MovableModalWindowTitleInactiveText",HIText, kThemeTextColorMovableModalWindowTitleInactive }, /* 136 */ { "UtilityWindowTitleActiveText", HIText, kThemeTextColorUtilityWindowTitleActive }, /* 137 */ { "UtilityWindowTitleInactiveText", HIText, kThemeTextColorUtilityWindowTitleInactive }, /* 138 */ { "PopupWindowTitleActiveText", HIText, kThemeTextColorPopupWindowTitleActive }, /* 139 */ { "PopupWindowTitleInactiveText", HIText, kThemeTextColorPopupWindowTitleInactive }, /* 140 */ { "RootMenuActiveText", HIText, kThemeTextColorRootMenuActive }, /* 141 */ { "RootMenuSelectedText", HIText, kThemeTextColorRootMenuSelected }, /* 142 */ { "RootMenuDisabledText", HIText, kThemeTextColorRootMenuDisabled }, /* 143 */ { "MenuItemActiveText", HIText, kThemeTextColorMenuItemActive }, /* 144 */ { "MenuItemSelectedText", HIText, kThemeTextColorMenuItemSelected }, /* 145 */ { "MenuItemDisabledText", HIText, kThemeTextColorMenuItemDisabled }, /* 146 */ { "PopupLabelActiveText", HIText, kThemeTextColorPopupLabelActive }, /* 147 */ { "PopupLabelInactiveText", HIText, kThemeTextColorPopupLabelInactive }, /* 148 */ { "TabFrontActiveText", HIText, kThemeTextColorTabFrontActive }, /* 149 */ { "TabNonFrontActiveText", HIText, kThemeTextColorTabNonFrontActive }, /* 150 */ { "TabNonFrontPressedText", HIText, kThemeTextColorTabNonFrontPressed }, /* 151 */ { "TabFrontInactiveText", HIText, kThemeTextColorTabFrontInactive }, /* 152 */ { "TabNonFrontInactiveText", HIText, kThemeTextColorTabNonFrontInactive }, /* 153 */ { "IconLabelSelectedText", HIText, kThemeTextColorIconLabelSelected }, /* 154 */ { "BevelButtonStickyActiveText", HIText, kThemeTextColorBevelButtonStickyActive }, /* 155 */ { "BevelButtonStickyInactiveText", HIText, kThemeTextColorBevelButtonStickyInactive }, /* 156 */ { "NotificationText", HIText, kThemeTextColorNotification }, /* 157 */ { "SystemDetailText", HIText, kThemeTextColorSystemDetail }, /* 158 */ { "WhiteText", HIText, kThemeTextColorWhite }, /* 159 */ { "TabPaneBackground", HIBackground, kThemeBackgroundTabPane }, /* 160 */ { "PlacardBackground", HIBackground, kThemeBackgroundPlacard }, /* 161 */ { "WindowHeaderBackground", HIBackground, kThemeBackgroundWindowHeader }, /* 162 */ { "ListViewWindowHeaderBackground", HIBackground, kThemeBackgroundListViewWindowHeader }, /* 163 */ { "SecondaryGroupBoxBackground", HIBackground, kThemeBackgroundSecondaryGroupBox }, /* 164 */ { "MetalBackground", HIBackground, kThemeBackgroundMetal }, /* 165 */ /* * Colors based on "semantic" NSColors. */ { "WindowBackgroundColor", ttkBackground, 0 }, /* 166 */ { "WindowBackgroundColor1", ttkBackground, 1 }, /* 167 */ { "WindowBackgroundColor2", ttkBackground, 2 }, /* 168 */ { "WindowBackgroundColor3", ttkBackground, 3 }, /* 169 */ { "WindowBackgroundColor4", ttkBackground, 4 }, /* 170 */ { "WindowBackgroundColor5", ttkBackground, 5 }, /* 171 */ { "WindowBackgroundColor6", ttkBackground, 6 }, /* 172 */ { "WindowBackgroundColor7", ttkBackground, 7 }, /* 173 */ { "TextColor", semantic, 0 }, /* 174 */ { "SelectedTextColor", semantic, 1 }, /* 175 */ { "LabelColor", semantic, 2 }, /* 176 */ { "ControlTextColor", semantic, 3 }, /* 177 */ { "DisabledControlTextColor", semantic, 4 }, /* 178 */ { "SelectedTabTextColor", semantic, 5 }, /* 179 */ { "TextBackgroundColor", semantic, 6 }, /* 180 */ { "SelectedTextBackgroundColor", semantic, 7 }, /* 181 */ { "ControlAccentColor", semantic, 8 }, /* 182 */ { NULL, 0, 0 } }; #define FIRST_SEMANTIC_COLOR 166 #define MAX_PIXELCODE 182 /* *---------------------------------------------------------------------- * * GetEntryFromPixelCode -- * * Extract a SystemColorMapEntry from the table. * * Results: * Returns false if the code is out of bounds. * * Side effects: * None. * *---------------------------------------------------------------------- */ static bool GetEntryFromPixelCode( unsigned char code, struct SystemColorMapEntry *entry) { if (code >= MIN_PIXELCODE && code <= MAX_PIXELCODE) { *entry = systemColorMap[code - MIN_PIXELCODE]; return true; } else { return false; } } /* *---------------------------------------------------------------------- * * SetCGColorComponents -- * * Set the components of a CGColorRef from an XColor pixel value and a * system color map entry. The pixel value is only used in the case where * the color is of type rgbColor. In that case the normalized XColor RGB * values are copied into the CGColorRef. * * Results: * OSStatus * * Side effects: * None. * *---------------------------------------------------------------------- */ static NSColorSpace* deviceRGB = NULL; static CGFloat blueAccentRGBA[4] = {0, 122.0 / 255, 1.0, 1.0}; static CGFloat windowBackground[4] = {236.0 / 255, 236.0 / 255, 236.0 / 255, 1.0}; static OSStatus SetCGColorComponents( struct SystemColorMapEntry entry, unsigned long pixel, CGColorRef *c) { OSStatus err = noErr; NSColor *bgColor, *color; CGFloat rgba[4] = {0, 0, 0, 1}; #if MAC_OS_X_VERSION_MAX_ALLOWED < 101400 NSInteger colorVariant; static CGFloat graphiteAccentRGBA[4] = {152.0 / 255, 152.0 / 255, 152.0 / 255, 1.0}; #endif if (!deviceRGB) { deviceRGB = [NSColorSpace deviceRGBColorSpace]; } /* * This function is called before our autorelease pool is set up, * so it needs its own pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; switch (entry.type) { case HIBrush: err = ChkErr(HIThemeBrushCreateCGColor, entry.value, c); return err; case rgbColor: rgba[0] = ((pixel >> 16) & 0xff) / 255.0; rgba[1] = ((pixel >> 8) & 0xff) / 255.0; rgba[2] = ((pixel ) & 0xff) / 255.0; break; case ttkBackground: /* * Prior to OSX 10.14, getComponents returns black when applied to * windowBackGroundColor. */ if ([NSApp macMinorVersion] < 14) { for (int i=0; i<3; i++) { rgba[i] = windowBackground[i]; } } else { bgColor = [[NSColor windowBackgroundColor] colorUsingColorSpace: deviceRGB]; [bgColor getComponents: rgba]; } if (rgba[0] + rgba[1] + rgba[2] < 1.5) { for (int i=0; i<3; i++) { rgba[i] += entry.value*8.0 / 255.0; } } else { for (int i=0; i<3; i++) { rgba[i] -= entry.value*8.0 / 255.0; } } break; case semantic: switch (entry.value) { case 0: color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; break; case 1: color = [[NSColor selectedTextColor] colorUsingColorSpace: deviceRGB]; break; case 2: if ([NSApp macMinorVersion] > 9) { color = [[NSColor labelColor] colorUsingColorSpace: deviceRGB]; } else { color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; } break; case 3: color = [[NSColor controlTextColor] colorUsingColorSpace: deviceRGB]; break; case 4: color = [[NSColor disabledControlTextColor] colorUsingColorSpace: deviceRGB]; break; case 5: if ([NSApp macMinorVersion] > 6) { color = [[NSColor whiteColor] colorUsingColorSpace: deviceRGB]; } else { color = [[NSColor blackColor] colorUsingColorSpace: deviceRGB]; } break; case 6: color = [[NSColor textBackgroundColor] colorUsingColorSpace: deviceRGB]; break; case 7: color = [[NSColor selectedTextBackgroundColor] colorUsingColorSpace: deviceRGB]; break; case 8: #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { color = [[NSColor controlAccentColor] colorUsingColorSpace: deviceRGB]; } else { color = [NSColor colorWithColorSpace: deviceRGB components: blueAccentRGBA count: 4]; } #else colorVariant = [[NSUserDefaults standardUserDefaults] integerForKey:@"AppleAquaColorVariant"]; if (colorVariant == 6) { color = [NSColor colorWithColorSpace: deviceRGB components: graphiteAccentRGBA count: 4]; } else { color = [NSColor colorWithColorSpace: deviceRGB components: blueAccentRGBA count: 4]; } #endif break; default: #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101000 if ([NSApp macMinorVersion] >= 10) { color = [[NSColor labelColor] colorUsingColorSpace: deviceRGB]; break; } #endif color = [[NSColor textColor] colorUsingColorSpace: deviceRGB]; break; } [color getComponents: rgba]; break; case clearColor: rgba[3] = 0.0; break; /* * There are no HITheme functions which convert Text or background colors * to CGColors. (GetThemeTextColor has been removed, and it was never * possible with backgrounds.) If we get one of these we return black. */ case HIText: case HIBackground: default: break; } *c = CGColorCreate(deviceRGB.CGColorSpace, rgba); [pool drain]; return err; } /* *---------------------------------------------------------------------- * * TkMacOSXInDarkMode -- * * Tests whether the given window's NSView has a DarkAqua Appearance. * * Results: * Returns true if the NSView is in DarkMode, false if not. * * Side effects: * None. * *---------------------------------------------------------------------- */ MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin) { int result = false; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if ([NSApp macMinorVersion] >= 14) { static NSAppearanceName darkAqua = @"NSAppearanceNameDarkAqua"; TkWindow *winPtr = (TkWindow*) tkwin; NSView *view = TkMacOSXDrawableView(winPtr->privatePtr); result = (view && [view.effectiveAppearance.name isEqualToString:darkAqua]); } #endif return result; } /* *---------------------------------------------------------------------- * * TkSetMacColor -- * * Sets the components of a CGColorRef from an XColor pixel value. * The high order byte of the pixel value is used as an index into * the system color table, and then SetCGColorComponents is called * with the table entry and the pixel value. * * Results: * Returns false if the high order byte is not a valid index, true * otherwise. * * Side effects: * The variable macColor is set to a new CGColorRef, the caller is * responsible for releasing it! * *---------------------------------------------------------------------- */ int TkSetMacColor( unsigned long pixel, /* Pixel value to convert. */ void *macColor) /* CGColorRef to modify. */ { CGColorRef *color = (CGColorRef*)macColor; OSStatus err = -1; struct SystemColorMapEntry entry; if (GetEntryFromPixelCode((pixel >> 24) & 0xff, &entry)) { err = ChkErr(SetCGColorComponents, entry, pixel, color); } return (err == noErr); } /* *---------------------------------------------------------------------- * * TkpInitGCCache, TkpFreeGCCache, CopyCachedColor, SetCachedColor -- * * Maintain a per-GC cache of previously converted CGColorRefs * * Results: * None resp. retained CGColorRef for CopyCachedColor() * * Side effects:M * None. * *---------------------------------------------------------------------- */ void TkpInitGCCache( |
︙ | ︙ | |||
446 447 448 449 450 451 452 453 454 455 456 457 458 459 | { CGColorRef cgColor = TkMacOSXCreateCGColor(gc, pixel); NSColor *nsColor = nil; if (cgColor) { NSColorSpace *colorSpace = [[NSColorSpace alloc] initWithCGColorSpace:CGColorGetColorSpace(cgColor)]; nsColor = [NSColor colorWithColorSpace:colorSpace components:CGColorGetComponents(cgColor) count:CGColorGetNumberOfComponents(cgColor)]; [colorSpace release]; CFRelease(cgColor); } return nsColor; | > | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | { CGColorRef cgColor = TkMacOSXCreateCGColor(gc, pixel); NSColor *nsColor = nil; if (cgColor) { NSColorSpace *colorSpace = [[NSColorSpace alloc] initWithCGColorSpace:CGColorGetColorSpace(cgColor)]; nsColor = [NSColor colorWithColorSpace:colorSpace components:CGColorGetComponents(cgColor) count:CGColorGetNumberOfComponents(cgColor)]; [colorSpace release]; CFRelease(cgColor); } return nsColor; |
︙ | ︙ | |||
480 481 482 483 484 485 486 | void TkMacOSXSetColorInContext( GC gc, unsigned long pixel, CGContextRef context) { | | | > > > | | | > > | > > > | | | | | > | | > | > | < < < < < | < < > | | | | < < > > > > > | 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 | void TkMacOSXSetColorInContext( GC gc, unsigned long pixel, CGContextRef context) { OSStatus err = noErr; CGColorRef cgColor = nil; struct SystemColorMapEntry entry; CGRect rect; int code = (pixel >> 24) & 0xff; HIThemeBackgroundDrawInfo info = {0, kThemeStateActive, 0};; static CGColorSpaceRef deviceRGBSpace = NULL; if (!deviceRGBSpace) { deviceRGBSpace = CGColorSpaceCreateDeviceRGB(); } if (code < FIRST_SEMANTIC_COLOR) { cgColor = CopyCachedColor(gc, pixel); } if (!cgColor && GetEntryFromPixelCode(code, &entry)) { switch (entry.type) { case HIBrush: err = ChkErr(HIThemeSetFill, entry.value, NULL, context, kHIThemeOrientationNormal); if (err == noErr) { err = ChkErr(HIThemeSetStroke, entry.value, NULL, context, kHIThemeOrientationNormal); } break; case HIText: err = ChkErr(HIThemeSetTextFill, entry.value, NULL, context, kHIThemeOrientationNormal); break; case HIBackground: info.kind = entry.value; rect = CGContextGetClipBoundingBox(context); err = ChkErr(HIThemeApplyBackground, &rect, &info, context, kHIThemeOrientationNormal); break; default: err = ChkErr(SetCGColorComponents, entry, pixel, &cgColor); if (err == noErr) { SetCachedColor(gc, pixel, cgColor); } break; } } if (cgColor) { CGContextSetFillColorWithColor(context, cgColor); CGContextSetStrokeColorWithColor(context, cgColor); CGColorRelease(cgColor); } if (err != noErr) { TkMacOSXDbgMsg("Ignored unknown pixel value 0x%lx", pixel); } } /* *---------------------------------------------------------------------- * * TkpGetColor -- * |
︙ | ︙ | |||
545 546 547 548 549 550 551 | * *---------------------------------------------------------------------- */ TkColor * TkpGetColor( Tk_Window tkwin, /* Window in which color will be used. */ | | > | | < < | | | | | | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | * *---------------------------------------------------------------------- */ TkColor * TkpGetColor( Tk_Window tkwin, /* Window in which color will be used. */ Tk_Uid name) /* Name of color to be allocated (in form * suitable for passing to XParseColor). */ { Display *display = tkwin != None ? Tk_Display(tkwin) : NULL; Colormap colormap = tkwin!= None ? Tk_Colormap(tkwin) : None; TkColor *tkColPtr; XColor color; /* * Check to see if this is a system color. Otherwise, XParseColor * will do all the work. */ if (strncasecmp(name, "system", 6) == 0) { Tcl_Obj *strPtr = Tcl_NewStringObj(name+6, -1); int idx, result; result = Tcl_GetIndexFromObjStruct(NULL, strPtr, systemColorMap, sizeof(struct SystemColorMapEntry), NULL, TCL_EXACT, &idx); Tcl_DecrRefCount(strPtr); if (result == TCL_OK) { OSStatus err; CGColorRef c; unsigned char pixelCode = idx + MIN_PIXELCODE; struct SystemColorMapEntry entry = systemColorMap[idx]; err = ChkErr(SetCGColorComponents, entry, 0, &c); if (err == noErr) { const size_t n = CGColorGetNumberOfComponents(c); const CGFloat *rgba = CGColorGetComponents(c); switch (n) { case 4: color.red = rgba[0] * 65535.0; color.green = rgba[1] * 65535.0; color.blue = rgba[2] * 65535.0; break; case 2: color.red = color.green = color.blue = rgba[0] * 65535.0; break; default: Tcl_Panic("CGColor with %d components", (int) n); } color.pixel = ((((((pixelCode << 8) | ((color.red >> 8) & 0xff)) << 8) | ((color.green >> 8) & 0xff)) << 8) | ((color.blue >> 8) & 0xff)); CGColorRelease(c); goto validXColor; } CGColorRelease(c); } } |
︙ | ︙ |
Changes to macosx/tkMacOSXConstants.h.
︙ | ︙ | |||
75 76 77 78 79 80 81 | #define NSCursorUpdate NSEventTypeCursorUpdate #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSCompositeCopy NSCompositingOperationCopy #define NSWarningAlertStyle NSAlertStyleWarning #define NSInformationalAlertStyle NSAlertStyleInformational #define NSCriticalAlertStyle NSAlertStyleCritical #define NSCenterTextAlignment NSTextAlignmentCenter | < < < < < < < < < < < < < < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #define NSCursorUpdate NSEventTypeCursorUpdate #define NSTexturedBackgroundWindowMask NSWindowStyleMaskTexturedBackground #define NSCompositeCopy NSCompositingOperationCopy #define NSWarningAlertStyle NSAlertStyleWarning #define NSInformationalAlertStyle NSAlertStyleInformational #define NSCriticalAlertStyle NSAlertStyleCritical #define NSCenterTextAlignment NSTextAlignmentCenter #define NSAnyEventMask NSEventMaskAny #define NSApplicationDefinedMask NSEventMaskApplicationDefined #define NSUtilityWindowMask NSWindowStyleMaskUtilityWindow #define NSNonactivatingPanelMask NSWindowStyleMaskNonactivatingPanel #define NSDocModalWindowMask NSWindowStyleMaskDocModalWindow #define NSHUDWindowMask NSWindowStyleMaskHUDWindow #define NSTitledWindowMask NSWindowStyleMaskTitled #define NSClosableWindowMask NSWindowStyleMaskClosable #define NSResizableWindowMask NSWindowStyleMaskResizable |
︙ | ︙ |
Changes to macosx/tkMacOSXCursor.c.
︙ | ︙ | |||
181 182 183 184 185 186 187 | {NULL} }; /* * Declarations of static variables used in this file. */ | | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | {NULL} }; /* * Declarations of static variables used in this file. */ static TkMacOSXCursor *gCurrentCursor = NULL; /* A pointer to the current cursor. */ static int gResizeOverride = false; /* A boolean indicating whether we should use * the resize cursor during installations. */ static int gTkOwnsCursor = true;/* A boolean indicating whether Tk owns the * cursor. If not (for instance, in the case * where a Tk window is embedded in another * app's window, and the cursor is out of the * Tk window, we will not attempt to adjust * the cursor. */ /* * Declarations of procedures local to this file */ static void FindCursorByName(TkMacOSXCursor *macCursorPtr, const char *string); |
︙ | ︙ | |||
274 275 276 277 278 279 280 281 282 283 284 285 286 287 | NSBitmapImageRep *bitmapImageRep = NULL; CGImageRef img = NULL, mask = NULL, maskedImg = NULL; static const CGFloat decodeWB[] = {1, 0}; CGColorSpaceRef colorspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericGray); CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, pix*pix/8, NULL); if (provider) { img = CGImageCreate(pix, pix, 1, 1, pix/8, colorspace, kCGBitmapByteOrderDefault, provider, decodeWB, 0, kCGRenderingIntentDefault); CFRelease(provider); } provider = CGDataProviderCreateWithData(NULL, bitmap + | > | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | NSBitmapImageRep *bitmapImageRep = NULL; CGImageRef img = NULL, mask = NULL, maskedImg = NULL; static const CGFloat decodeWB[] = {1, 0}; CGColorSpaceRef colorspace = CGColorSpaceCreateWithName( kCGColorSpaceGenericGray); CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap, pix*pix/8, NULL); if (provider) { img = CGImageCreate(pix, pix, 1, 1, pix/8, colorspace, kCGBitmapByteOrderDefault, provider, decodeWB, 0, kCGRenderingIntentDefault); CFRelease(provider); } provider = CGDataProviderCreateWithData(NULL, bitmap + |
︙ | ︙ | |||
295 296 297 298 299 300 301 | maskedImg = CGImageCreateWithMask(img, mask); } if (maskedImg) { bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:maskedImg]; CFRelease(maskedImg); } | | > > | > > | > > > | 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | maskedImg = CGImageCreateWithMask(img, mask); } if (maskedImg) { bitmapImageRep = [[NSBitmapImageRep alloc] initWithCGImage:maskedImg]; CFRelease(maskedImg); } if (mask) { CFRelease(mask); } if (img) { CFRelease(img); } if (colorspace) { CFRelease(colorspace); } if (bitmapImageRep) { image = [[NSImage alloc] initWithSize:NSMakeSize(pix, pix)]; [image addRepresentation:bitmapImageRep]; [bitmapImageRep release]; } uint16_t *hotSpotData = (uint16_t*)(bitmap + 2*pix*pix/8); hotSpot.y = CFSwapInt16BigToHost(*hotSpotData++); hotSpot.x = CFSwapInt16BigToHost(*hotSpotData); haveHotSpot = 1; break; } } |
︙ | ︙ |
Changes to macosx/tkMacOSXDefault.h.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | //#ifndef TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS //#define TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS 1 //#endif /* * The definitions below provide symbolic names for the default colors. * NORMAL_BG - Normal background color. * ACTIVE_BG - Background color when widget is active. * SELECT_BG - Background color for selected text. * SELECT_FG - Foreground color for selected text. * TROUGH - Background color for troughs in scales and scrollbars. * INDICATOR - Color for indicator when button is selected. * DISABLED - Foreground color when widget is disabled. */ #define BLACK "Black" #define WHITE "White" | > > | > > | | | | | < | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | //#ifndef TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS //#define TK_MAC_BUTTON_USE_COMPATIBILITY_METRICS 1 //#endif /* * The definitions below provide symbolic names for the default colors. * NORMAL_BG - Normal background color. * NORMAL_FG - Normal foreground color. * ACTIVE_BG - Background color when widget is active. * ACTIVE_FG - Foreground color when widget is active. * SELECT_BG - Background color for selected text. * SELECT_FG - Foreground color for selected text. * TROUGH - Background color for troughs in scales and scrollbars. * INDICATOR - Color for indicator when button is selected. * DISABLED - Foreground color when widget is disabled. */ #define BLACK "Black" #define WHITE "White" #define NORMAL_BG "systemWindowBackgroundColor" #define TEXT_BG "systemTextBackgroundColor" #define NORMAL_FG "systemTextColor" #define ACTIVE_BG "systemWindowBackgroundColor" #define ACTIVE_FG "systemTextColor" #define SELECT_BG "systemSelectedTextBackgroundColor" #define SELECT_FG "systemSelectedTextColor" #define INACTIVE_SELECT_BG "systemSelectedTextBackgroundColor" #define TROUGH "#c3c3c3" #define INDICATOR "#b03060" #define DISABLED "#a3a3a3" /* * Defaults for labels, buttons, checkbuttons, and radiobuttons: */ #define DEF_BUTTON_ANCHOR "center" #define DEF_BUTTON_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_BUTTON_ACTIVE_BG_MONO BLACK #define DEF_BUTTON_ACTIVE_FG_COLOR ACTIVE_FG #define DEF_CHKRAD_ACTIVE_FG_COLOR DEF_BUTTON_ACTIVE_FG_COLOR #define DEF_BUTTON_ACTIVE_FG_MONO WHITE #define DEF_BUTTON_BG_COLOR NORMAL_BG #define DEF_BUTTON_BG_MONO WHITE #define DEF_BUTTON_BITMAP "" #define DEF_BUTTON_BORDER_WIDTH "2" #define DEF_BUTTON_CURSOR "" #define DEF_BUTTON_COMMAND "" #define DEF_BUTTON_COMPOUND "none" #define DEF_BUTTON_DEFAULT "disabled" #define DEF_BUTTON_DISABLED_FG_COLOR DISABLED #define DEF_BUTTON_DISABLED_FG_MONO "" #define DEF_BUTTON_FG NORMAL_FG #define DEF_CHKRAD_FG DEF_BUTTON_FG #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT "systemButtonFrame" #define DEF_LABEL_HIGHLIGHT_WIDTH "0" |
︙ | ︙ | |||
165 166 167 168 169 170 171 | */ #define MAC_OSX_FOCUS_WIDTH 3 #define MAC_OSX_ENTRY_BORDER 2 #define MAC_OSX_ENTRY_RELIEF TK_RELIEF_SUNKEN #define MAC_OSX_ENTRY_SELECT_RELIEF TK_RELIEF_FLAT | | | < | | | | > < > > | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | */ #define MAC_OSX_FOCUS_WIDTH 3 #define MAC_OSX_ENTRY_BORDER 2 #define MAC_OSX_ENTRY_RELIEF TK_RELIEF_SUNKEN #define MAC_OSX_ENTRY_SELECT_RELIEF TK_RELIEF_FLAT #define DEF_ENTRY_BG_COLOR TEXT_BG #define DEF_ENTRY_BG_MONO WHITE #define DEF_ENTRY_BORDER_WIDTH "2" #define DEF_ENTRY_CURSOR "xterm" #define DEF_ENTRY_DISABLED_BG_COLOR NORMAL_BG #define DEF_ENTRY_DISABLED_BG_MONO WHITE #define DEF_ENTRY_DISABLED_FG DISABLED #define DEF_ENTRY_EXPORT_SELECTION "1" #define DEF_ENTRY_FONT "TkTextFont" #define DEF_ENTRY_FG NORMAL_FG #define DEF_ENTRY_HIGHLIGHT_BG NORMAL_BG #define DEF_ENTRY_HIGHLIGHT BLACK #define DEF_ENTRY_HIGHLIGHT_WIDTH "3" #define DEF_ENTRY_INSERT_BG NORMAL_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "1" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" #define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" #define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" #define DEF_ENTRY_SELECT_COLOR SELECT_BG #define DEF_ENTRY_SELECT_MONO BLACK #define DEF_ENTRY_SELECT_BD_COLOR "1" #define DEF_ENTRY_SELECT_BD_MONO "0" #define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG #define DEF_ENTRY_SELECT_FG_MONO WHITE #define DEF_ENTRY_SHOW NULL #define DEF_ENTRY_STATE "normal" #define DEF_ENTRY_TAKE_FOCUS NULL #define DEF_ENTRY_TEXT_VARIABLE "" #define DEF_ENTRY_WIDTH "20" /* * Defaults for frames: */ #define DEF_FRAME_BG_COLOR NORMAL_BG #define DEF_FRAME_BG_IMAGE NULL #define DEF_FRAME_BG_MONO WHITE #define DEF_FRAME_BG_TILE "0" #define DEF_FRAME_BORDER_WIDTH "0" #define DEF_FRAME_CLASS "Frame" #define DEF_FRAME_COLORMAP "" #define DEF_FRAME_CONTAINER "0" #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG |
︙ | ︙ | |||
233 234 235 236 237 238 239 | /* * Defaults for labelframes: */ #define DEF_LABELFRAME_BORDER_WIDTH "2" #define DEF_LABELFRAME_CLASS "Labelframe" #define DEF_LABELFRAME_RELIEF "groove" | | | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /* * Defaults for labelframes: */ #define DEF_LABELFRAME_BORDER_WIDTH "2" #define DEF_LABELFRAME_CLASS "Labelframe" #define DEF_LABELFRAME_RELIEF "groove" #define DEF_LABELFRAME_FG NORMAL_FG #define DEF_LABELFRAME_FONT "TkDefaultFont" #define DEF_LABELFRAME_TEXT "" #define DEF_LABELFRAME_LABELANCHOR "nw" /* * Defaults for listboxes: */ #define DEF_LISTBOX_ACTIVE_STYLE "dotbox" #define DEF_LISTBOX_BG_COLOR TEXT_BG #define DEF_LISTBOX_BG_MONO WHITE #define DEF_LISTBOX_BORDER_WIDTH "1" #define DEF_LISTBOX_CURSOR "" #define DEF_LISTBOX_DISABLED_FG DISABLED #define DEF_LISTBOX_EXPORT_SELECTION "1" #define DEF_LISTBOX_FONT "TkTextFont" #define DEF_LISTBOX_FG NORMAL_FG #define DEF_LISTBOX_HEIGHT "10" #define DEF_LISTBOX_HIGHLIGHT_BG NORMAL_BG #define DEF_LISTBOX_HIGHLIGHT BLACK #define DEF_LISTBOX_HIGHLIGHT_WIDTH "0" #define DEF_LISTBOX_JUSTIFY "left" #define DEF_LISTBOX_RELIEF "solid" #define DEF_LISTBOX_SCROLL_COMMAND "" |
︙ | ︙ | |||
308 309 310 311 312 313 314 315 316 317 318 319 320 321 | */ #define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive" #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText" #define DEF_MENU_ACTIVE_FG_MONO WHITE #define DEF_MENU_BG_COLOR "systemMenu" #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled" #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ | > | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | */ #define DEF_MENU_ACTIVE_BG_COLOR "systemMenuActive" #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR "systemMenuActiveText" #define DEF_MENU_ACTIVE_FG_MONO WHITE #define DEF_MENU_ACTIVE_RELIEF "flat" #define DEF_MENU_BG_COLOR "systemMenu" #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR "systemMenuDisabled" #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "menu" /* special: see tkMacOSXMenu.c */ |
︙ | ︙ | |||
330 331 332 333 334 335 336 | #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* * Defaults for menubuttons: */ | | | | | | | | | | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* * Defaults for menubuttons: */ #define DEF_MENUBUTTON_ANCHOR "w" #define DEF_MENUBUTTON_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_MENUBUTTON_ACTIVE_BG_MONO WHITE #define DEF_MENUBUTTON_ACTIVE_FG_COLOR ACTIVE_FG #define DEF_MENUBUTTON_ACTIVE_FG_MONO BLACK #define DEF_MENUBUTTON_BG_COLOR NORMAL_BG #define DEF_MENUBUTTON_BG_MONO WHITE #define DEF_MENUBUTTON_BITMAP "" #define DEF_MENUBUTTON_BORDER_WIDTH "0" #define DEF_MENUBUTTON_CURSOR "" #define DEF_MENUBUTTON_DIRECTION "below" #define DEF_MENUBUTTON_DISABLED_FG_COLOR DISABLED #define DEF_MENUBUTTON_DISABLED_FG_MONO "" #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG NORMAL_FG #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT BLACK #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "1" #define DEF_MENUBUTTON_JUSTIFY "left" #define DEF_MENUBUTTON_MENU "" #define DEF_MENUBUTTON_PADX "0" #define DEF_MENUBUTTON_PADY "0" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" #define DEF_MENUBUTTON_TAKE_FOCUS "0" #define DEF_MENUBUTTON_TEXT "" #define DEF_MENUBUTTON_TEXT_VARIABLE "" #define DEF_MENUBUTTON_UNDERLINE "-1" #define DEF_MENUBUTTON_WIDTH "0" #define DEF_MENUBUTTON_WRAP_LENGTH "0" /* * Defaults for messages: */ #define DEF_MESSAGE_ANCHOR "center" #define DEF_MESSAGE_ASPECT "150" #define DEF_MESSAGE_BG_COLOR NORMAL_BG #define DEF_MESSAGE_BG_MONO WHITE #define DEF_MESSAGE_BORDER_WIDTH "1" #define DEF_MESSAGE_CURSOR "" #define DEF_MESSAGE_FG NORMAL_FG #define DEF_MESSAGE_FONT "TkDefaultFont" #define DEF_MESSAGE_HIGHLIGHT_BG NORMAL_BG #define DEF_MESSAGE_HIGHLIGHT BLACK #define DEF_MESSAGE_HIGHLIGHT_WIDTH "0" #define DEF_MESSAGE_JUSTIFY "left" #define DEF_MESSAGE_PADX "-1" #define DEF_MESSAGE_PADY "-1" |
︙ | ︙ | |||
439 440 441 442 443 444 445 | #define DEF_SCALE_BG_MONO WHITE #define DEF_SCALE_BIG_INCREMENT "0" #define DEF_SCALE_BORDER_WIDTH "1" #define DEF_SCALE_COMMAND "" #define DEF_SCALE_CURSOR "" #define DEF_SCALE_DIGITS "0" #define DEF_SCALE_FONT "TkDefaultFont" | | | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | #define DEF_SCALE_BG_MONO WHITE #define DEF_SCALE_BIG_INCREMENT "0" #define DEF_SCALE_BORDER_WIDTH "1" #define DEF_SCALE_COMMAND "" #define DEF_SCALE_CURSOR "" #define DEF_SCALE_DIGITS "0" #define DEF_SCALE_FONT "TkDefaultFont" #define DEF_SCALE_FG_COLOR NORMAL_FG #define DEF_SCALE_FG_MONO BLACK #define DEF_SCALE_FROM "0" #define DEF_SCALE_HIGHLIGHT_BG_COLOR DEF_SCALE_BG_COLOR #define DEF_SCALE_HIGHLIGHT_BG_MONO DEF_SCALE_BG_MONO #define DEF_SCALE_HIGHLIGHT BLACK #define DEF_SCALE_HIGHLIGHT_WIDTH "0" #define DEF_SCALE_LABEL "" |
︙ | ︙ | |||
496 497 498 499 500 501 502 | #define DEF_SCROLLBAR_WIDTH "15" /* * Defaults for texts: */ #define DEF_TEXT_AUTO_SEPARATORS "1" | | | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | #define DEF_SCROLLBAR_WIDTH "15" /* * Defaults for texts: */ #define DEF_TEXT_AUTO_SEPARATORS "1" #define DEF_TEXT_BG_COLOR TEXT_BG #define DEF_TEXT_BG_MONO WHITE #define DEF_TEXT_BLOCK_CURSOR "0" #define DEF_TEXT_BORDER_WIDTH "0" #define DEF_TEXT_CURSOR "xterm" #define DEF_TEXT_FG NORMAL_FG #define DEF_TEXT_EXPORT_SELECTION "1" #define DEF_TEXT_FONT "TkFixedFont" #define DEF_TEXT_HEIGHT "24" #define DEF_TEXT_HIGHLIGHT_BG NORMAL_BG #define DEF_TEXT_HIGHLIGHT BLACK #define DEF_TEXT_HIGHLIGHT_WIDTH "3" #define DEF_TEXT_INSERT_BG NORMAL_FG #define DEF_TEXT_INSERT_BD_COLOR "0" #define DEF_TEXT_INSERT_BD_MONO "0" #define DEF_TEXT_INSERT_OFF_TIME "300" #define DEF_TEXT_INSERT_ON_TIME "600" #define DEF_TEXT_INSERT_UNFOCUSSED "none" #define DEF_TEXT_INSERT_WIDTH "1" #define DEF_TEXT_MAX_UNDO "0" |
︙ | ︙ |
Changes to macosx/tkMacOSXDialog.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel | | > | > > > | | > | | | > | > | > | | | | | | > | < | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOther -1 #define modalError -2 /* * Vars for filtering in "open file" and "save file" dialogs. */ typedef struct { bool doFileTypes; /* Show the accessory view which * displays the filter menu */ bool preselectFilter; /* A filter was selected by the * typevariable. */ bool userHasSelectedFilter; /* The user has changed the filter in * the accessory view. */ NSMutableArray *fileTypeNames; /* Array of names, e.g. "Text * document". */ NSMutableArray *fileTypeExtensions; /* Array of allowed extensions per * name, e.g. "txt", "doc". */ NSMutableArray *fileTypeLabels; /* Displayed string, e.g. "Text * document (.txt, .doc)". */ NSMutableArray *fileTypeAllowsAll; /* Boolean if the all pattern (*.*) is * included. */ NSMutableArray *allowedExtensions; /* Set of all allowed extensions. */ bool allowedExtensionsAllowAll; /* Set of all allowed extensions * includes *.* */ NSUInteger fileTypeIndex; /* Index of currently selected * filter. */ } filepanelFilterInfo; static filepanelFilterInfo filterInfo; static NSOpenPanel *openpanel; static NSSavePanel *savepanel; static const char *const colorOptionStrings[] = { "-initialcolor", "-parent", "-title", NULL }; enum colorOptions { COLOR_INITIAL, COLOR_PARENT, COLOR_TITLE }; |
︙ | ︙ | |||
162 163 164 165 166 167 168 | [TYPE_OKCANCEL] = {3, 4, 0}, [TYPE_RETRYCANCEL] = {1, 4, 0}, [TYPE_YESNO] = {6, 5, 0}, [TYPE_YESNOCANCEL] = {6, 5, 4}, }; /* | | | > | > > > > | 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | [TYPE_OKCANCEL] = {3, 4, 0}, [TYPE_RETRYCANCEL] = {1, 4, 0}, [TYPE_YESNO] = {6, 5, 0}, [TYPE_YESNOCANCEL] = {6, 5, 4}, }; /* * Construct a file URL from directory and filename. Either may be nil. If both * are nil, returns nil. */ static NSURL * getFileURL( NSString *directory, NSString *filename) { NSURL *url = nil; if (directory) { url = [NSURL fileURLWithPath:directory isDirectory:YES]; } if (filename) { url = [NSURL URLWithString:filename relativeToURL:url]; } |
︙ | ︙ | |||
225 226 227 228 229 230 231 | } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); ckfree(callbackInfo); } } | < | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | } if (callbackInfo->cmdObj) { Tcl_DecrRefCount(callbackInfo->cmdObj); ckfree(callbackInfo); } } - (void) tkAlertDidEnd: (NSAlert *) alert returnCode: (NSInteger) returnCode contextInfo: (void *) contextInfo { AlertCallbackInfo *callbackInfo = contextInfo; if (returnCode >= NSAlertFirstButtonReturn) { Tcl_Obj *resultObj = Tcl_NewStringObj(alertButtonStrings[ |
︙ | ︙ | |||
268 269 270 271 272 273 274 | - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [openpanel setAllowsOtherFileTypes:YES]; | > > | | | > > > > | > | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | - (void)selectFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [openpanel setAllowsOtherFileTypes:YES]; /* * setAllowsOtherFileTypes might have no effect; it's inherited from * the NSSavePanel, where it has the effect that it does not append an * extension. Setting the allowed file types to nil allows selecting * any file. */ [openpanel setAllowedFileTypes:nil]; } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; [openpanel setAllowedFileTypes:allowedtypes]; [openpanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } - (void)saveFormat:(id)sender { NSPopUpButton *button = (NSPopUpButton *)sender; filterInfo.fileTypeIndex = [button indexOfSelectedItem]; if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterInfo.fileTypeIndex] boolValue]) { [savepanel setAllowsOtherFileTypes:YES]; [savepanel setAllowedFileTypes:nil]; } else { NSMutableArray *allowedtypes = [filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]; [savepanel setAllowedFileTypes:allowedtypes]; [savepanel setAllowsOtherFileTypes:NO]; } filterInfo.userHasSelectedFilter = true; } |
︙ | ︙ | |||
380 381 382 383 384 385 386 387 388 389 390 391 392 393 | [colorPanel orderOut:NSApp]; [colorPanel setContinuous:NO]; [colorPanel setBecomesKeyOnlyIfNeeded:NO]; [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { NSString *s = [[NSString alloc] initWithUTF8String:title]; [colorPanel setTitle:s]; [s release]; } if (initialColor) { [colorPanel setColor:initialColor]; } returnCode = [NSApp runModalForWindow:colorPanel]; | > | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | [colorPanel orderOut:NSApp]; [colorPanel setContinuous:NO]; [colorPanel setBecomesKeyOnlyIfNeeded:NO]; [colorPanel setShowsAlpha: NO]; [colorPanel _setUseModalAppearance:YES]; if (title) { NSString *s = [[NSString alloc] initWithUTF8String:title]; [colorPanel setTitle:s]; [s release]; } if (initialColor) { [colorPanel setColor:initialColor]; } returnCode = [NSApp runModalForWindow:colorPanel]; |
︙ | ︙ | |||
411 412 413 414 415 416 417 | } result = TCL_OK; end: return result; } | > | | > > > > > > | > > | > | | | > | > > | | | | | > > > | > > | > > | > > | > | > > | > > | > > | > > | > > < | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | } result = TCL_OK; end: return result; } /* * Dissect the -filetype nested lists and store the information in the * filterInfo structure. */ static int parseFileFilters( Tcl_Interp *interp, Tcl_Obj *fileTypesPtr, Tcl_Obj *typeVariablePtr) { if (!fileTypesPtr) { filterInfo.doFileTypes = false; return TCL_OK; } FileFilterList fl; TkInitFileFilters(&fl); if (TkGetFileFilters(interp, &fl, fileTypesPtr, 0) != TCL_OK) { TkFreeFileFilters(&fl); return TCL_ERROR; } filterInfo.doFileTypes = (fl.filters != NULL); filterInfo.fileTypeIndex = 0; filterInfo.fileTypeExtensions = [NSMutableArray array]; filterInfo.fileTypeNames = [NSMutableArray array]; filterInfo.fileTypeLabels = [NSMutableArray array]; filterInfo.fileTypeAllowsAll = [NSMutableArray array]; filterInfo.allowedExtensions = [NSMutableArray array]; filterInfo.allowedExtensionsAllowAll = NO; if (filterInfo.doFileTypes) { for (FileFilter *filterPtr = fl.filters; filterPtr; filterPtr = filterPtr->next) { NSString *name = [[NSString alloc] initWithUTF8String: filterPtr->name]; [filterInfo.fileTypeNames addObject:name]; [name release]; NSMutableArray *clauseextensions = [NSMutableArray array]; NSMutableArray *displayextensions = [NSMutableArray array]; bool allowsAll = NO; for (FileFilterClause *clausePtr = filterPtr->clauses; clausePtr; clausePtr = clausePtr->next) { for (GlobPattern *globPtr = clausePtr->patterns; globPtr; globPtr = globPtr->next) { const char *str = globPtr->pattern; while (*str && (*str == '*' || *str == '.')) { str++; } if (*str) { NSString *extension = [[NSString alloc] initWithUTF8String:str]; if (![filterInfo.allowedExtensions containsObject:extension]) { [filterInfo.allowedExtensions addObject:extension]; } [clauseextensions addObject:extension]; [displayextensions addObject:[@"." stringByAppendingString:extension]]; [extension release]; } else { /* * It is the all pattern (*, .* or *.*) */ allowsAll = YES; filterInfo.allowedExtensionsAllowAll = YES; [displayextensions addObject:@"*"]; } } } [filterInfo.fileTypeExtensions addObject:clauseextensions]; [filterInfo.fileTypeAllowsAll addObject:[NSNumber numberWithBool:allowsAll]]; NSMutableString *label = [[NSMutableString alloc] initWithString:name]; [label appendString:@" ("]; [label appendString:[displayextensions componentsJoinedByString:@", "]]; [label appendString:@")"]; [filterInfo.fileTypeLabels addObject:label]; [label release]; } /* * Check if the typevariable exists and matches one of the names. */ filterInfo.preselectFilter = false; filterInfo.userHasSelectedFilter = false; if (typeVariablePtr) { /* * Extract the variable content as a NSString. */ Tcl_Obj *selectedFileTypeObj = Tcl_ObjGetVar2(interp, typeVariablePtr, NULL, TCL_GLOBAL_ONLY); /* * Check that the typevariable exists. */ if (selectedFileTypeObj != NULL) { const char *selectedFileType = Tcl_GetString(selectedFileTypeObj); NSString *selectedFileTypeStr = [[NSString alloc] initWithUTF8String:selectedFileType]; NSUInteger index = [filterInfo.fileTypeNames indexOfObject:selectedFileTypeStr]; if (index != NSNotFound) { filterInfo.fileTypeIndex = index; filterInfo.preselectFilter = true; } } } } TkFreeFileFilters(&fl); return TCL_OK; } static bool filterCompatible( NSString *extension, int filterIndex) { NSMutableArray *allowedExtensions = [filterInfo.fileTypeExtensions objectAtIndex: filterIndex]; /* * If this contains the all pattern, accept any extension. */ if ([[filterInfo.fileTypeAllowsAll objectAtIndex:filterIndex] boolValue]) { return true; } return [allowedExtensions containsObject: extension]; } /* *---------------------------------------------------------------------- * * Tk_GetOpenFileObjCmd -- * * This procedure implements the "open file" dialog box for the Mac |
︙ | ︙ | |||
627 628 629 630 631 632 633 | break; } } if (title) { [openpanel setTitle:title]; | > | | | | > | > > | | > > | > > > | | > > > > | > > | > > | | > | | | > | > | | > | | | > > > > | | > | | > > > > | | > > | > < | > < < > | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 | break; } } if (title) { [openpanel setTitle:title]; /* * From OSX 10.11, the title string is silently ignored in the open * panel. Prepend the title to the message in this case. NOTE should * be conditional on OSX version, but -mmacosx-version-min does not * revert this behaviour */ if (message) { NSString *fullmessage = [[NSString alloc] initWithFormat:@"%@\n%@", title, message]; [message release]; [title release]; message = fullmessage; } else { message = title; } } if (message) { [openpanel setMessage:message]; [message release]; } [openpanel setAllowsMultipleSelection:multiple]; if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { NSView *accessoryView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; [label setEditable:NO]; [label setStringValue:@"Filter:"]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 240, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton setAction:@selector(selectFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; if (filterInfo.preselectFilter) { /* * A specific filter was selected from the typevariable. Select it * and open the accessory view. */ [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; /* * On OSX > 10.11, the options are not visible by default. Ergo * allow all file types [openpanel setAllowedFileTypes:filterInfo.fileTypeExtensions[filterInfo.fileTypeIndex]]; */ [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } else { [openpanel setAllowedFileTypes:filterInfo.allowedExtensions]; } if (filterInfo.allowedExtensionsAllowAll) { [openpanel setAllowsOtherFileTypes:YES]; } else { [openpanel setAllowsOtherFileTypes:NO]; } [openpanel setAccessoryView:accessoryView]; } else { /* * No filters are given. Allow picking all files. */ [openpanel setAllowsOtherFileTypes:YES]; } if (cmdObj) { callbackInfo = ckalloc(sizeof(FilePanelCallbackInfo)); if (Tcl_IsShared(cmdObj)) { cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = multiple; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; if (directory || filename) { NSURL *fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } [openpanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:openpanel returnCode:returnCode contextInfo:callbackInfo ]; }]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:openpanel]; } else { if (directory || filename) { NSURL *fileURL = getFileURL(directory, filename); [openpanel setDirectoryURL:fileURL]; } modalReturnCode = [openpanel runModal]; [NSApp tkFilePanelDidEnd:openpanel returnCode:modalReturnCode contextInfo:callbackInfo]; } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if ((typeVariablePtr && (modalReturnCode == NSOKButton)) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the * dialog was not cancelled. */ NSUInteger selectedFilterIndex = filterInfo.fileTypeIndex; NSString *selectedFilter = NULL; if (filterInfo.userHasSelectedFilter) { selectedFilterIndex = filterInfo.fileTypeIndex; selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { /* * Difficult case: the user has not touched the filter settings, * but we must return something in the typevariable. First check if * the preselected type is compatible with the selected file, * otherwise choose the first compatible type from the list, * finally fall back to the empty string. */ NSURL *selectedFile; if (multiple) { /* * Use the first file in the case of multiple selection. * Anyway it is not overly useful here. */ selectedFile = [[openpanel URLs] objectAtIndex:0]; } else { selectedFile = [openpanel URL]; } NSString *extension = [selectedFile pathExtension]; if (filterInfo.preselectFilter && filterCompatible(extension, filterInfo.fileTypeIndex)) { selectedFilterIndex = filterInfo.fileTypeIndex; // The preselection from the typevariable selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { // scan the list NSUInteger i; for (i = 0; i < [filterInfo.fileTypeNames count]; i++) { if (filterCompatible(extension, i)) { selectedFilterIndex = i; break; } } if (i == selectedFilterIndex) { selectedFilter = [filterInfo.fileTypeNames objectAtIndex:selectedFilterIndex]; } else { selectedFilter = @""; } } } Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } end: return result; } /* *---------------------------------------------------------------------- * * Tk_GetSaveFileObjCmd -- * * This procedure implements the "save file" dialog box for the Mac * platform. See the user documentation for details on what it does. * * Results: * A standard Tcl result. * * Side effects: * See user documentation. * *---------------------------------------------------------------------- */ int Tk_GetSaveFileObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ |
︙ | ︙ | |||
824 825 826 827 828 829 830 | int index, len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; FilePanelCallbackInfo callbackInfoStruct; FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct; NSString *directory = nil, *filename = nil, *defaultType = nil; NSString *message = nil, *title = nil; NSWindow *parent; | | | 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 | int index, len; Tcl_Obj *cmdObj = NULL, *typeVariablePtr = NULL, *fileTypesPtr = NULL; FilePanelCallbackInfo callbackInfoStruct; FilePanelCallbackInfo *callbackInfo = &callbackInfoStruct; NSString *directory = nil, *filename = nil, *defaultType = nil; NSString *message = nil, *title = nil; NSWindow *parent; savepanel = [NSSavePanel savePanel]; NSInteger modalReturnCode = modalError; BOOL parentIsKey = NO; for (i = 1; i < objc; i += 2) { if (Tcl_GetIndexFromObjStruct(interp, objv[i], saveOptionStrings, sizeof(char *), "option", TCL_EXACT, &index) != TCL_OK) { goto end; |
︙ | ︙ | |||
902 903 904 905 906 907 908 | break; } } if (title) { [savepanel setTitle:title]; | > | | | | > > > | > | | > > | > > > | | | > > > | 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 | break; } } if (title) { [savepanel setTitle:title]; /* * From OSX 10.11, the title string is silently ignored, if the save * panel is a sheet. Prepend the title to the message in this case. * NOTE: should be conditional on OSX version, but -mmacosx-version-min * does not revert this behaviour. */ if (haveParentOption) { if (message) { NSString *fullmessage = [[NSString alloc] initWithFormat:@"%@\n%@",title,message]; [message release]; [title release]; message = fullmessage; } else { message = title; } } } if (message) { [savepanel setMessage:message]; [message release]; } if (parseFileFilters(interp, fileTypesPtr, typeVariablePtr) != TCL_OK) { goto end; } if (filterInfo.doFileTypes) { NSView *accessoryView = [[NSView alloc] initWithFrame:NSMakeRect(0.0, 0.0, 300, 32.0)]; NSTextField *label = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 60, 22)]; [label setEditable:NO]; [label setStringValue:NSLocalizedString(@"Format:", nil)]; [label setBordered:NO]; [label setBezeled:NO]; [label setDrawsBackground:NO]; NSPopUpButton *popupButton = [[NSPopUpButton alloc] initWithFrame:NSMakeRect(50.0, 2, 340, 22.0) pullsDown:NO]; [popupButton addItemsWithTitles:filterInfo.fileTypeLabels]; [popupButton selectItemAtIndex:filterInfo.fileTypeIndex]; [popupButton setAction:@selector(saveFormat:)]; [accessoryView addSubview:label]; [accessoryView addSubview:popupButton]; [savepanel setAccessoryView:accessoryView]; [savepanel setAllowedFileTypes:[filterInfo.fileTypeExtensions objectAtIndex:filterInfo.fileTypeIndex]]; [savepanel setAllowsOtherFileTypes:filterInfo.allowedExtensionsAllowAll]; } else if (defaultType) { /* * If no filetypes are given, defaultextension is an alternative way to * specify the attached extension. Just propose this extension, but * don't display an accessory view. */ NSMutableArray *AllowedFileTypes = [NSMutableArray array]; [AllowedFileTypes addObject:defaultType]; [savepanel setAllowedFileTypes:AllowedFileTypes]; [savepanel setAllowsOtherFileTypes:YES]; } [savepanel setCanSelectHiddenExtension:YES]; [savepanel setExtensionHidden:NO]; |
︙ | ︙ | |||
974 975 976 977 978 979 980 | } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { | | | > > | > > > | | | > | > > > | > > > | > | > > > | | > < | 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 | } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /* * Check for file name, otherwise set to empty string; crashes with * uncaught exception if set to nil. */ if (filename) { [savepanel setNameFieldStringValue:filename]; } else { [savepanel setNameFieldStringValue:@""]; } [savepanel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:savepanel returnCode:returnCode contextInfo:callbackInfo]; }]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:savepanel]; } else { if (directory) { [savepanel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; } /* * Check for file name, otherwise set to empty string; crashes with * uncaught exception if set to nil. */ if (filename) { [savepanel setNameFieldStringValue:filename]; } else { [savepanel setNameFieldStringValue:@""]; } modalReturnCode = [savepanel runModal]; [NSApp tkFilePanelDidEnd:savepanel returnCode:modalReturnCode contextInfo:callbackInfo]; } result = (modalReturnCode != modalError) ? TCL_OK : TCL_ERROR; if (parentIsKey) { [parent makeKeyWindow]; } if (typeVariablePtr && (modalReturnCode == NSOKButton) && filterInfo.doFileTypes) { /* * The -typevariable must be set to the selected file type, if the * dialog was not cancelled. */ NSString *selectedFilter = [filterInfo.fileTypeNames objectAtIndex:filterInfo.fileTypeIndex]; Tcl_ObjSetVar2(interp, typeVariablePtr, NULL, Tcl_NewStringObj([selectedFilter UTF8String], -1), TCL_GLOBAL_ONLY); } end: return result; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1126 1127 1128 1129 1130 1131 1132 | cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; | > > | > > > | | | | > | 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | cmdObj = Tcl_DuplicateObj(cmdObj); } Tcl_IncrRefCount(cmdObj); } callbackInfo->cmdObj = cmdObj; callbackInfo->interp = interp; callbackInfo->multiple = 0; /* * Check for directory value, set to root if not specified; otherwise * crashes with exception because of nil string parameter. */ if (!directory) { directory = @"/"; } parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; [panel beginSheetModalForWindow:parent completionHandler:^(NSInteger returnCode) { [NSApp tkFilePanelDidEnd:panel returnCode:returnCode contextInfo:callbackInfo]; }]; modalReturnCode = cmdObj ? modalOther : [NSApp runModalForWindow:panel]; } else { [panel setDirectoryURL:[NSURL fileURLWithPath:directory isDirectory:YES]]; modalReturnCode = [panel runModal]; [NSApp tkFilePanelDidEnd:panel returnCode:modalReturnCode contextInfo:callbackInfo]; } |
︙ | ︙ | |||
1197 1198 1199 1200 1201 1202 1203 | /* * This replaces the old about dialog with a standard alert that displays * correctly on 10.14. */ NSString *version = @"Tcl " TCL_PATCH_LEVEL " & Tk " TCL_PATCH_LEVEL; | | > | | > | > | 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 | /* * This replaces the old about dialog with a standard alert that displays * correctly on 10.14. */ NSString *version = @"Tcl " TCL_PATCH_LEVEL " & Tk " TCL_PATCH_LEVEL; NSString *url = @"www.tcl-lang.org"; NSTextView *credits = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,300,300)]; NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]]; NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; [credits insertText: [[NSAttributedString alloc] initWithString:[NSString stringWithFormat: @"\n" "Tcl and Tk are distributed under a modified BSD license: " "www.tcl.tk/software/tcltk/license.html\n\n" "%1$C 1987-%2$@ Tcl Core Team and Contributers.\n\n" "%1$C 2011-%2$@ Kevin Walzer/WordTech Communications LLC.\n\n" "%1$C 2014-%2$@ Marc Culler.\n\n" "%1$C 2002-2012 Daniel A. Steffen.\n\n" "%1$C 2001-2009 Apple Inc.\n\n" "%1$C 2001-2002 Jim Ingham & Ian Reid\n\n" "%1$C 1998-2000 Jim Ingham & Ray Johnson\n\n" "%1$C 1998-2000 Scriptics Inc.\n\n" "%1$C 1996-1997 Sun Microsystems Inc.", 0xA9, year] attributes:textAttributes] replacementRange:NSMakeRange(0,0)]; [credits setDrawsBackground:NO]; [credits setEditable:NO]; NSAlert *about = [[NSAlert alloc] init]; [[about window] setTitle:@"About Tcl & Tk"]; [about setMessageText: version]; [about setInformativeText:url]; about.accessoryView = credits; [about runModal]; [about release]; } |
︙ | ︙ | |||
1374 1375 1376 1377 1378 1379 1380 | if (indexDefaultOption) { /* * Any '-default' option needs to know the '-type' option, which is * why we do this here. */ if (Tcl_GetIndexFromObjStruct(interp, objv[indexDefaultOption + 1], | | > | | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 | if (indexDefaultOption) { /* * Any '-default' option needs to know the '-type' option, which is * why we do this here. */ if (Tcl_GetIndexFromObjStruct(interp, objv[indexDefaultOption + 1], alertButtonStrings, sizeof(char *), "-default value", TCL_EXACT, &index) != TCL_OK) { goto end; } /* * Need to map from "ok" etc. to 1, 2, 3, right to left. */ defaultNativeButtonIndex = alertButtonIndexAndTypeToNativeButtonIndex[typeIndex][index]; if (!defaultNativeButtonIndex) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Illegal default option", -1)); Tcl_SetErrorCode(interp, "TK", "MSGBOX", "DEFAULT", NULL); goto end; } } [alert setIcon:[NSApp applicationIconImage]]; [alert setAlertStyle:alertStyles[iconIndex]]; i = 0; while (i < 3 && alertButtonNames[typeIndex][i]) { [alert addButtonWithTitle:(NSString*) alertButtonNames[typeIndex][i++]]; } buttons = [alert buttons]; for (NSButton *b in buttons) { NSString *ke = [b keyEquivalent]; if (([ke isEqualToString:@"\r"] || [ke isEqualToString:@"\033"]) && ![b keyEquivalentModifierMask]) { |
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | callbackInfo->interp = interp; callbackInfo->typeIndex = typeIndex; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED > 1090 [alert beginSheetModalForWindow:parent | | | | | > | 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 | callbackInfo->interp = interp; callbackInfo->typeIndex = typeIndex; parent = TkMacOSXDrawableWindow(((TkWindow *) tkwin)->window); if (haveParentOption && parent && ![parent attachedSheet]) { parentIsKey = [parent isKeyWindow]; #if MAC_OS_X_VERSION_MIN_REQUIRED > 1090 [alert beginSheetModalForWindow:parent completionHandler:^(NSModalResponse returnCode) { [NSApp tkAlertDidEnd:alert returnCode:returnCode contextInfo:callbackInfo]; }]; #else [alert beginSheetModalForWindow:parent modalDelegate:NSApp didEndSelector:@selector(tkAlertDidEnd:returnCode:contextInfo:) contextInfo:callbackInfo]; #endif modalReturnCode = cmdObj ? 0 : |
︙ | ︙ | |||
1467 1468 1469 1470 1471 1472 1473 | typedef struct FontchooserData { Tcl_Obj *titleObj; Tcl_Obj *cmdObj; Tk_Window parent; } FontchooserData; | | > > > | 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | typedef struct FontchooserData { Tcl_Obj *titleObj; Tcl_Obj *cmdObj; Tk_Window parent; } FontchooserData; enum FontchooserEvent { FontchooserClosed, FontchooserSelection }; static void FontchooserEvent(int kind); static Tcl_Obj * FontchooserCget(FontchooserData *fcdPtr, int optionIndex); static int FontchooserConfigureCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); |
︙ | ︙ | |||
1559 1560 1561 1562 1563 1564 1565 | @end /* *---------------------------------------------------------------------- * * FontchooserEvent -- * | | | | 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 | @end /* *---------------------------------------------------------------------- * * FontchooserEvent -- * * This processes events generated by user interaction with the font * panel. * * Results: * None. * * Side effects: * Additional events may be place on the Tk event queue. * |
︙ | ︙ | |||
1619 1620 1621 1622 1623 1624 1625 | } /* *---------------------------------------------------------------------- * * FontchooserCget -- * | | | < | 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 | } /* *---------------------------------------------------------------------- * * FontchooserCget -- * * Helper for the FontchooserConfigure command to return the current value * of any of the options (which may be NULL in the structure). * * Results: * Tcl object of option value. * * Side effects: * None. * |
︙ | ︙ | |||
1670 1671 1672 1673 1674 1675 1676 | if (fcdPtr->cmdObj) { resObj = fcdPtr->cmdObj; } else { resObj = Tcl_NewObj(); } break; case FontchooserVisible: | | | | | | 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 | if (fcdPtr->cmdObj) { resObj = fcdPtr->cmdObj; } else { resObj = Tcl_NewObj(); } break; case FontchooserVisible: resObj = Tcl_NewWideIntObj([[[NSFontManager sharedFontManager] fontPanel:NO] isVisible] != 0); break; default: resObj = Tcl_NewObj(); } return resObj; } /* * ---------------------------------------------------------------------- * * FontchooserConfigureCmd -- * * Implementation of the 'tk fontchooser configure' ensemble command. See * the user documentation for what it does. * * Results: * See the user documentation. * * Side effects: * Per-interp data structure may be modified * |
︙ | ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | NSFontPanel *fp = [fm fontPanel:NO]; [fp setPanelFont:fontPanelFont isMultiple:NO]; [fm setSelectedFont:fontPanelFont isMultiple:NO]; [fm setSelectedAttributes:fontPanelFontAttributes isMultiple:NO]; if ([fp isVisible]) { | | > | 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | NSFontPanel *fp = [fm fontPanel:NO]; [fp setPanelFont:fontPanelFont isMultiple:NO]; [fm setSelectedFont:fontPanelFont isMultiple:NO]; [fm setSelectedAttributes:fontPanelFontAttributes isMultiple:NO]; if ([fp isVisible]) { TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserFontChanged", NULL); } break; case FontchooserCmd: if (fcdPtr->cmdObj) { Tcl_DecrRefCount(fcdPtr->cmdObj); } Tcl_GetStringFromObj(objv[i+1], &len); |
︙ | ︙ | |||
1846 1847 1848 1849 1850 1851 1852 | } /* * ---------------------------------------------------------------------- * * FontchooserShowCmd -- * | | | | | 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 | } /* * ---------------------------------------------------------------------- * * FontchooserShowCmd -- * * Implements the 'tk fontchooser show' ensemble command. The per-interp * configuration data for the dialog is held in an interp associated * structure. * * Results: * See the user documentation. * * Side effects: * Font Panel may be shown. * |
︙ | ︙ | |||
1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | NULL); if (fcdPtr->parent == None) { fcdPtr->parent = (Tk_Window) clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } NSFontManager *fm = [NSFontManager sharedFontManager]; NSFontPanel *fp = [fm fontPanel:YES]; if ([fp delegate] != NSApp) { [fp setDelegate:NSApp]; } if (![fp isVisible]) { [fm orderFrontFontPanel:NSApp]; TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL); } fontchooserInterp = interp; return TCL_OK; } /* * ---------------------------------------------------------------------- * * FontchooserHideCmd -- * | > > | | > | 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | NULL); if (fcdPtr->parent == None) { fcdPtr->parent = (Tk_Window) clientData; Tk_CreateEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); } NSFontManager *fm = [NSFontManager sharedFontManager]; NSFontPanel *fp = [fm fontPanel:YES]; if ([fp delegate] != NSApp) { [fp setDelegate:NSApp]; } if (![fp isVisible]) { [fm orderFrontFontPanel:NSApp]; TkSendVirtualEvent(fcdPtr->parent, "TkFontchooserVisibility", NULL); } fontchooserInterp = interp; return TCL_OK; } /* * ---------------------------------------------------------------------- * * FontchooserHideCmd -- * * Implementation of the 'tk fontchooser hide' ensemble. See the user * documentation for details. * * Results: * See the user documentation. * * Side effects: * Font Panel may be hidden. * * ---------------------------------------------------------------------- */ static int FontchooserHideCmd( ClientData clientData, /* Main window */ Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:NO]; if ([fp isVisible]) { [fp orderOut:NSApp]; } return TCL_OK; } /* |
︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 | XEvent *eventPtr) { FontchooserData *fcdPtr = clientData; if (eventPtr->type == DestroyNotify) { Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); | | | 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 | XEvent *eventPtr) { FontchooserData *fcdPtr = clientData; if (eventPtr->type == DestroyNotify) { Tk_DeleteEventHandler(fcdPtr->parent, StructureNotifyMask, FontchooserParentEventHandler, fcdPtr); fcdPtr->parent = NULL; FontchooserHideCmd(NULL, NULL, 0, NULL); } } /* * ---------------------------------------------------------------------- * |
︙ | ︙ | |||
1993 1994 1995 1996 1997 1998 1999 | } /* * ---------------------------------------------------------------------- * * TkInitFontchooser -- * | | | | 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 | } /* * ---------------------------------------------------------------------- * * TkInitFontchooser -- * * Associate the font chooser configuration data with the Tcl interpreter. * There is one font chooser per interp. * * Results: * None. * * Side effects: * per-interp configuration data is destroyed. * |
︙ | ︙ |
Changes to macosx/tkMacOSXDraw.c.
1 2 3 | /* * tkMacOSXDraw.c -- * | | < | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkMacOSXDraw.c -- * * This file contains functions that perform drawing to Xlib windows. Most * of the functions simply emulate Xlib functions. * * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright 2014 Marc Culler. * * See the file "license.terms" for information on usage and redistribution |
︙ | ︙ | |||
27 28 29 30 31 32 33 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_DRAWING #define TK_MAC_DEBUG_IMAGE_DRAWING #endif */ | | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_DRAWING #define TK_MAC_DEBUG_IMAGE_DRAWING #endif */ #define radians(d) ((d) * (M_PI/180.0)) /* * Non-antialiased CG drawing looks better and more like X11 drawing when using * very fine lines, so decrease all linewidths by the following constant. */ #define NON_AA_CG_OFFSET .999 static int cgAntiAliasLimit = 0; #define notAA(w) ((w) < cgAntiAliasLimit) static int useThemedToplevel = 0; static int useThemedFrame = 0; /* * Prototypes for functions used only in this file. */ |
︙ | ︙ | |||
115 116 117 118 119 120 121 | * implementation does not work correctly. Originally it relied on * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was * deprecated by Apple in OSX 10.14 and also required the use of other * deprecated functions such as [NSView lockFocus]. Apple's suggested * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that * is what is being used here. However, that method only works when the * view has a valid CGContext, and a view is only guaranteed to have a | | | | | | | | | | | | | | > | | | | | | | | | < < > > | | | | < | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | * implementation does not work correctly. Originally it relied on * [NSBitmapImageRep initWithFocusedViewRect:view_rect] which was * deprecated by Apple in OSX 10.14 and also required the use of other * deprecated functions such as [NSView lockFocus]. Apple's suggested * replacement is [NSView cacheDisplayInRect: toBitmapImageRep:] and that * is what is being used here. However, that method only works when the * view has a valid CGContext, and a view is only guaranteed to have a * valid context during a call to [NSView drawRect]. To further complicate * matters, cacheDisplayInRect calls [NSView drawRect]. Essentially it is * asking the view to draw a subrectangle of itself into a special * graphics context which is linked to the BitmapImageRep. But our * implementation of [NSView drawRect] does not allow recursive calls. If * called recursively it returns immediately without doing any drawing. * So the bottom line is that this function either returns a NULL pointer * or a black image. To make it useful would require a significant amount * of rewriting of the drawRect method. Perhaps the next release of OSX * will include some more helpful ways of doing this. * * Results: * Returns an NSBitmapRep representing the image of the given rectangle of * the given drawable. This object is retained. The caller is responsible * for releasing it. * * NOTE: The x,y coordinates should be relative to a coordinate system * with origin at the top left, as used by XImage and CGImage, not bottom * left as used by NSView. * * Side effects: * None * *---------------------------------------------------------------------- */ NSBitmapImageRep * TkMacOSXBitmapRepFromDrawableRect( Drawable drawable, int x, int y, unsigned int width, unsigned int height) { MacDrawable *mac_drawable = (MacDrawable *) drawable; CGContextRef cg_context = NULL; CGImageRef cg_image = NULL, sub_cg_image = NULL; NSBitmapImageRep *bitmap_rep = NULL; NSView *view = NULL; if (mac_drawable->flags & TK_IS_PIXMAP) { /* * This MacDrawable is a bitmap, so its view is NULL. */ CGRect image_rect = CGRectMake(x, y, width, height); cg_context = TkMacOSXGetCGContextForDrawable(drawable); cg_image = CGBitmapContextCreateImage((CGContextRef) cg_context); sub_cg_image = CGImageCreateWithImageInRect(cg_image, image_rect); if (sub_cg_image) { bitmap_rep = [NSBitmapImageRep alloc]; [bitmap_rep initWithCGImage:sub_cg_image]; } if (cg_image) { CGImageRelease(cg_image); } } else if ((view = TkMacOSXDrawableView(mac_drawable)) != NULL) { /* * Convert Tk top-left to NSView bottom-left coordinates. */ int view_height = [view bounds].size.height; NSRect view_rect = NSMakeRect(x + mac_drawable->xOff, view_height - height - y - mac_drawable->yOff, width, height); /* * Attempt to copy from the view to a bitmapImageRep. If the view does * not have a valid CGContext, doing this will silently corrupt memory * and make a big mess. So, in that case, we mark the view as needing * display and return NULL. */ |
︙ | ︙ | |||
214 215 216 217 218 219 220 | * * Copies data from one drawable to another. * * Results: * None. * * Side effects: | | < | | < > | > > > > | | | | | | | | | | | | | | | | | | | | | < < < < < | | | < | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | * * Copies data from one drawable to another. * * Results: * None. * * Side effects: * Data is moved from a window or bitmap to a second window or bitmap. * *---------------------------------------------------------------------- */ void XCopyArea( Display *display, /* Display. */ Drawable src, /* Source drawable. */ Drawable dst, /* Destination drawable. */ GC gc, /* GC to use. */ int src_x, /* X & Y, width & height */ int src_y, /* define the source rectangle */ unsigned int width, /* that will be copied. */ unsigned int height, int dest_x, /* Dest X & Y on dest rect. */ int dest_y) { TkMacOSXDrawingContext dc; MacDrawable *srcDraw = (MacDrawable *) src; NSBitmapImageRep *bitmap_rep = NULL; CGImageRef img = NULL; CGRect bounds, srcRect, dstRect; display->request++; if (!width || !height) { return; } if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { TkMacOSXDbgMsg("Failed to setup drawing context."); return; } if (!dc.context) { TkMacOSXDbgMsg("Invalid destination drawable - no context."); return; } if (srcDraw->flags & TK_IS_PIXMAP) { img = TkMacOSXCreateCGImageWithDrawable(src); } else if (TkMacOSXDrawableWindow(src)) { bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(src, src_x, src_y, width, height); if (bitmap_rep) { img = [bitmap_rep CGImage]; } } else { TkMacOSXDbgMsg("Invalid source drawable - neither window nor pixmap."); } if (img) { bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height); srcRect = CGRectMake(src_x, src_y, width, height); dstRect = CGRectMake(dest_x, dest_y, width, height); TkMacOSXDrawCGImage(dst, gc, dc.context, img, gc->foreground, gc->background, bounds, srcRect, dstRect); CFRelease(img); } else { TkMacOSXDbgMsg("Failed to construct CGImage."); } TkMacOSXRestoreDrawingContext(&dc); } /* *---------------------------------------------------------------------- * * XCopyPlane -- * * Copies a bitmap from a source drawable to a destination drawable. The * plane argument specifies which bit plane of the source contains the * bitmap. Note that this implementation ignores the gc->function. * * Results: * None. * * Side effects: * Changes the destination drawable. * |
︙ | ︙ | |||
330 331 332 333 334 335 336 337 338 339 340 341 342 | if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } if (srcDraw->flags & TK_IS_PIXMAP) { if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { return; } CGContextRef context = dc.context; if (context) { CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src); if (img) { TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask; unsigned long imageBackground = gc->background; | > > > > | | > | > > > > | > > | > > > | > > > > | | > > | > | > | > | | > | > > > | > > | > | 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 | if (plane != 1) { Tcl_Panic("Unexpected plane specified for XCopyPlane"); } if (srcDraw->flags & TK_IS_PIXMAP) { if (!TkMacOSXSetupDrawingContext(dst, gc, 1, &dc)) { return; } CGContextRef context = dc.context; if (context) { CGImageRef img = TkMacOSXCreateCGImageWithDrawable(src); if (img) { TkpClipMask *clipPtr = (TkpClipMask *) gc->clip_mask; unsigned long imageBackground = gc->background; if (clipPtr && clipPtr->type == TKP_CLIP_PIXMAP) { srcRect = CGRectMake(src_x, src_y, width, height); CGImageRef mask = TkMacOSXCreateCGImageWithDrawable( clipPtr->value.pixmap); CGImageRef submask = CGImageCreateWithImageInRect( img, srcRect); CGRect rect = CGRectMake(dest_x, dest_y, width, height); rect = CGRectOffset(rect, dstDraw->xOff, dstDraw->yOff); CGContextSaveGState(context); /* * Move the origin of the destination to top left. */ CGContextTranslateCTM(context, 0, rect.origin.y + CGRectGetMaxY(rect)); CGContextScaleCTM(context, 1, -1); /* * Fill with the background color, clipping to the mask. */ CGContextClipToMask(context, rect, submask); TkMacOSXSetColorInContext(gc, gc->background, dc.context); CGContextFillRect(context, rect); /* * Fill with the foreground color, clipping to the * intersection of img and mask. */ CGImageRef subimage = CGImageCreateWithImageInRect( img, srcRect); CGContextClipToMask(context, rect, subimage); TkMacOSXSetColorInContext(gc, gc->foreground, context); CGContextFillRect(context, rect); CGContextRestoreGState(context); CGImageRelease(img); CGImageRelease(mask); CGImageRelease(submask); CGImageRelease(subimage); } else { bounds = CGRectMake(0, 0, srcDraw->size.width, srcDraw->size.height); srcRect = CGRectMake(src_x, src_y, width, height); dstRect = CGRectMake(dest_x, dest_y, width, height); TkMacOSXDrawCGImage(dst, gc, dc.context, img, gc->foreground, imageBackground, bounds, srcRect, dstRect); CGImageRelease(img); } } else { /* no image */ TkMacOSXDbgMsg("Invalid source drawable"); } } else { TkMacOSXDbgMsg("Invalid destination drawable - " "could not get a bitmap context."); } TkMacOSXRestoreDrawingContext(&dc); } else { /* * Source drawable is a Window, not a Pixmap. */ XCopyArea(display, src, dst, gc, src_x, src_y, width, height, dest_x, dest_y); } } /* *---------------------------------------------------------------------- * * TkMacOSXCreateCGImageWithDrawable -- |
︙ | ︙ | |||
426 427 428 429 430 431 432 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | * * Side effects: * None. * *---------------------------------------------------------------------- */ static NSImage * CreateNSImageWithPixmap( Pixmap pixmap, int width, int height) { CGImageRef cgImage; NSImage *nsImage; |
︙ | ︙ | |||
462 463 464 465 466 467 468 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | * * Side effects: * None. * *---------------------------------------------------------------------- */ NSImage * TkMacOSXGetNSImageWithTkImage( Display *display, Tk_Image image, int width, int height) { Pixmap pixmap = Tk_GetPixmap(display, None, width, height, 0); |
︙ | ︙ | |||
495 496 497 498 499 500 501 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | * * Side effects: * None. * *---------------------------------------------------------------------- */ NSImage * TkMacOSXGetNSImageWithBitmap( Display *display, Pixmap bitmap, GC gc, int width, int height) { |
︙ | ︙ | |||
546 547 548 549 550 551 552 | if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; size_t bitsPerPixel, bytesPerRow, len; CGColorSpaceRef colorspace = NULL; CGBitmapInfo bitmapInfo = #ifdef __LITTLE_ENDIAN__ | | | | > | | | | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | if (macDraw && (macDraw->flags & TK_IS_PIXMAP) && !macDraw->context) { const size_t bitsPerComponent = 8; size_t bitsPerPixel, bytesPerRow, len; CGColorSpaceRef colorspace = NULL; CGBitmapInfo bitmapInfo = #ifdef __LITTLE_ENDIAN__ kCGBitmapByteOrder32Host; #else kCGBitmapByteOrderDefault; #endif char *data; CGRect bounds = CGRectMake(0, 0, macDraw->size.width, macDraw->size.height); if (macDraw->flags & TK_IS_BW_PIXMAP) { bitsPerPixel = 8; bitmapInfo = (CGBitmapInfo) kCGImageAlphaOnly; } else { colorspace = CGColorSpaceCreateDeviceRGB(); bitsPerPixel = 32; bitmapInfo |= kCGImageAlphaPremultipliedFirst; } bytesPerRow = ((size_t) macDraw->size.width * bitsPerPixel + 127) >> 3 & ~15; len = macDraw->size.height * bytesPerRow; data = ckalloc(len); bzero(data, len); macDraw->context = CGBitmapContextCreate(data, macDraw->size.width, macDraw->size.height, bitsPerComponent, bytesPerRow, colorspace, bitmapInfo); if (macDraw->context) { |
︙ | ︙ | |||
626 627 628 629 630 631 632 | if (subImage) { image = subImage; } } dstBounds = CGRectOffset(dstBounds, macDraw->xOff, macDraw->yOff); if (CGImageIsMask(image)) { if (macDraw->flags & TK_IS_BW_PIXMAP) { | | | | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | if (subImage) { image = subImage; } } dstBounds = CGRectOffset(dstBounds, macDraw->xOff, macDraw->yOff); if (CGImageIsMask(image)) { if (macDraw->flags & TK_IS_BW_PIXMAP) { /* * Set fill color to black; background comes from the context, * or is transparent. */ if (imageBackground != TRANSPARENT_PIXEL << 24) { CGContextClearRect(context, dstBounds); } CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0); |
︙ | ︙ | |||
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 | #ifdef TK_MAC_DEBUG_IMAGE_DRAWING CGContextSaveGState(context); CGContextSetLineWidth(context, 1.0); CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.1); CGContextSetRGBFillColor(context, 0, 1, 0, 0.1); CGContextFillRect(context, dstBounds); CGContextStrokeRect(context, dstBounds); CGPoint p[4] = {dstBounds.origin, CGPointMake(CGRectGetMaxX(dstBounds), CGRectGetMaxY(dstBounds)), CGPointMake(CGRectGetMinX(dstBounds), CGRectGetMaxY(dstBounds)), CGPointMake(CGRectGetMaxX(dstBounds), CGRectGetMinY(dstBounds)) }; CGContextStrokeLineSegments(context, p, 4); CGContextRestoreGState(context); TkMacOSXDbgMsg("Drawing CGImage at (x=%f, y=%f), (w=%f, h=%f)", dstBounds.origin.x, dstBounds.origin.y, dstBounds.size.width, dstBounds.size.height); #else /* TK_MAC_DEBUG_IMAGE_DRAWING */ CGContextSaveGState(context); | > > | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 | #ifdef TK_MAC_DEBUG_IMAGE_DRAWING CGContextSaveGState(context); CGContextSetLineWidth(context, 1.0); CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.1); CGContextSetRGBFillColor(context, 0, 1, 0, 0.1); CGContextFillRect(context, dstBounds); CGContextStrokeRect(context, dstBounds); CGPoint p[4] = {dstBounds.origin, CGPointMake(CGRectGetMaxX(dstBounds), CGRectGetMaxY(dstBounds)), CGPointMake(CGRectGetMinX(dstBounds), CGRectGetMaxY(dstBounds)), CGPointMake(CGRectGetMaxX(dstBounds), CGRectGetMinY(dstBounds)) }; CGContextStrokeLineSegments(context, p, 4); CGContextRestoreGState(context); TkMacOSXDbgMsg("Drawing CGImage at (x=%f, y=%f), (w=%f, h=%f)", dstBounds.origin.x, dstBounds.origin.y, dstBounds.size.width, dstBounds.size.height); #else /* TK_MAC_DEBUG_IMAGE_DRAWING */ CGContextSaveGState(context); |
︙ | ︙ | |||
732 733 734 735 736 737 738 739 | macWin->yOff + points[i].y + o); } else { prevx += points[i].x; prevy += points[i].y; CGContextAddLineToPoint(dc.context, prevx, prevy); } } /* | > | | | < > | 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 | macWin->yOff + points[i].y + o); } else { prevx += points[i].x; prevy += points[i].y; CGContextAddLineToPoint(dc.context, prevx, prevy); } } /* * In the case of closed polylines, the first and last points are the * same. We want miter or bevel join be rendered also at this point, * this needs telling CoreGraphics that the path is closed. */ if ((points[0].x == points[npoints-1].x) && (points[0].y == points[npoints-1].y)) { CGContextClosePath(dc.context); } CGContextStrokePath(dc.context); } TkMacOSXRestoreDrawingContext(&dc); |
︙ | ︙ | |||
816 817 818 819 820 821 822 | * Draws a filled polygon on the specified drawable. * *---------------------------------------------------------------------- */ void XFillPolygon( | | | | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 | * Draws a filled polygon on the specified drawable. * *---------------------------------------------------------------------- */ void XFillPolygon( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ XPoint *points, /* Array of points. */ int npoints, /* Number of points. */ int shape, /* Shape to draw. */ int mode) /* Drawing mode. */ { MacDrawable *macWin = (MacDrawable *) d; TkMacOSXDrawingContext dc; int i; |
︙ | ︙ | |||
898 899 900 901 902 903 904 | return; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; rect = CGRectMake( | | < | | < | | | | < | 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 | return; } if (dc.context) { CGRect rect; double o = (lw % 2) ? .5 : 0; rect = CGRectMake( macWin->xOff + x + o, macWin->yOff + y + o, width, height); CGContextStrokeRect(dc.context, rect); } TkMacOSXRestoreDrawingContext(&dc); } #ifdef TK_MACOSXDRAW_UNUSED /* *---------------------------------------------------------------------- * * XDrawRectangles -- * * Draws the outlines of the specified rectangles as if a five-point * PolyLine protocol request were specified for each rectangle: * * [x,y] [x+width,y] [x+width,y+height] [x,y+height] [x,y] * * For the specified rectangles, these functions do not draw a pixel more * than once. XDrawRectangles draws the rectangles in the order listed in * the array. If rectangles intersect, the intersecting pixels are drawn * multiple times. Draws a rectangle. * * Results: * None. * * Side effects: * Draws rectangles on the specified drawable. * |
︙ | ︙ | |||
987 988 989 990 991 992 993 | * Draws onto the specified drawable. * *---------------------------------------------------------------------- */ int XFillRectangles( | | | 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | * Draws onto the specified drawable. * *---------------------------------------------------------------------- */ int XFillRectangles( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ XRectangle *rectangles, /* Rectangle array. */ int n_rectangles) /* Number of rectangles. */ { MacDrawable *macWin = (MacDrawable *) d; TkMacOSXDrawingContext dc; |
︙ | ︙ | |||
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | TkMacOSXRestoreDrawingContext(&dc); return Success; } /* *---------------------------------------------------------------------- * * XDrawArc -- * * Draw an arc. * * Results: * None. * * Side effects: * Draws an arc on the specified drawable. * *---------------------------------------------------------------------- */ void XDrawArc( | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | TkMacOSXRestoreDrawingContext(&dc); return Success; } /* *---------------------------------------------------------------------- * * TkMacOSXDrawSolidBorder -- * * Draws a border rectangle of specified thickness inside the bounding * rectangle of a Tk Window. The border rectangle can be inset within the * bounding rectangle. For a highlight border the inset should be 0, but * for a solid border around the actual window the inset should equal the * thickness of the highlight border. The color of the border rectangle * is the foreground color of the graphics context passed to the function. * * Results: * None. * * Side effects: * Draws a rectangular border inside the bounding rectangle of a window. * *---------------------------------------------------------------------- */ MODULE_SCOPE void TkMacOSXDrawSolidBorder( Tk_Window tkwin, GC gc, int inset, int thickness) { Drawable d = Tk_WindowId(tkwin); TkMacOSXDrawingContext dc; CGRect outerRect, innerRect; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { return; } if (dc.context) { outerRect = CGRectMake(Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin)); outerRect = CGRectInset(outerRect, inset, inset); innerRect = CGRectInset(outerRect, thickness, thickness); CGContextBeginPath(dc.context); CGContextAddRect(dc.context, outerRect); CGContextAddRect(dc.context, innerRect); CGContextEOFillPath(dc.context); } TkMacOSXRestoreDrawingContext(&dc); } /* *---------------------------------------------------------------------- * * XDrawArc -- * * Draw an arc. * * Results: * None. * * Side effects: * Draws an arc on the specified drawable. * *---------------------------------------------------------------------- */ void XDrawArc( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ int x, int y, /* Upper left of bounding rect. */ unsigned int width, /* Width & height. */ unsigned int height, int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ |
︙ | ︙ | |||
1095 1096 1097 1098 1099 1100 1101 | #ifdef TK_MACOSXDRAW_UNUSED /* *---------------------------------------------------------------------- * * XDrawArcs -- * | | | | < | | | | < | 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 | #ifdef TK_MACOSXDRAW_UNUSED /* *---------------------------------------------------------------------- * * XDrawArcs -- * * Draws multiple circular or elliptical arcs. Each arc is specified by a * rectangle and two angles. The center of the circle or ellipse is the * center of the rect- angle, and the major and minor axes are specified * by the width and height. Positive angles indicate counterclock- wise * motion, and negative angles indicate clockwise motion. If the magnitude * of angle2 is greater than 360 degrees, XDrawArcs truncates it to 360 * degrees. * * Results: * None. * * Side effects: * Draws an arc for each array element on the specified drawable. * *---------------------------------------------------------------------- */ void XDrawArcs( Display *display, Drawable d, GC gc, XArc *arcArr, int nArcs) { MacDrawable *macWin = (MacDrawable *) d; TkMacOSXDrawingContext dc; XArc *arcPtr; int i, lw = gc->line_width; display->request++; if (!TkMacOSXSetupDrawingContext(d, gc, 1, &dc)) { |
︙ | ︙ | |||
1191 1192 1193 1194 1195 1196 1197 | * Draws a filled arc on the specified drawable. * *---------------------------------------------------------------------- */ void XFillArc( | | | 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | * Draws a filled arc on the specified drawable. * *---------------------------------------------------------------------- */ void XFillArc( Display *display, /* Display. */ Drawable d, /* Draw on this. */ GC gc, /* Use this GC. */ int x, int y, /* Upper left of bounding rect. */ unsigned int width, /* Width & height. */ unsigned int height, int angle1, /* Staring angle of arc. */ int angle2) /* Extent of arc. */ |
︙ | ︙ | |||
1356 1357 1358 1359 1360 1361 1362 | #endif /* *---------------------------------------------------------------------- * * TkScrollWindow -- * | | | | | < | | > | > > | | > | > > | | | > | > > | > > | > > > | > > | 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | #endif /* *---------------------------------------------------------------------- * * TkScrollWindow -- * * Scroll a rectangle of the specified window and accumulate a damage * region. * * Results: * Returns 0 if the scroll generated no additional damage. Otherwise, sets * the region that needs to be repainted after scrolling and returns 1. * * Side effects: * Scrolls the bits in the window. * *---------------------------------------------------------------------- */ int TkScrollWindow( Tk_Window tkwin, /* The window to be scrolled. */ GC gc, /* GC for window to be scrolled. */ int x, int y, /* Position rectangle to be scrolled. */ int width, int height, int dx, int dy, /* Distance rectangle should be moved. */ TkRegion damageRgn) /* Region to accumulate damage in. */ { Drawable drawable = Tk_WindowId(tkwin); MacDrawable *macDraw = (MacDrawable *) drawable; TKContentView *view = (TKContentView *) TkMacOSXDrawableView(macDraw); CGRect srcRect, dstRect; HIShapeRef dmgRgn = NULL, extraRgn = NULL; NSRect bounds, visRect, scrollSrc, scrollDst; int result = 0; if (view) { /* * Get the scroll area in NSView coordinates (origin at bottom left). */ bounds = [view bounds]; scrollSrc = NSMakeRect(macDraw->xOff + x, bounds.size.height - height - (macDraw->yOff + y), width, height); scrollDst = NSOffsetRect(scrollSrc, dx, -dy); /* * Limit scrolling to the window content area. */ visRect = [view visibleRect]; scrollSrc = NSIntersectionRect(scrollSrc, visRect); scrollDst = NSIntersectionRect(scrollDst, visRect); if (!NSIsEmptyRect(scrollSrc) && !NSIsEmptyRect(scrollDst)) { /* * Mark the difference between source and destination as damaged. * This region is described in NSView coordinates (y=0 at the * bottom) and converted to Tk coordinates later. */ srcRect = CGRectMake(x, y, width, height); dstRect = CGRectOffset(srcRect, dx, dy); /* * Compute the damage. */ dmgRgn = HIShapeCreateMutableWithRect(&srcRect); extraRgn = HIShapeCreateWithRect(&dstRect); ChkErr(HIShapeDifference, dmgRgn, extraRgn, (HIMutableShapeRef) dmgRgn); result = HIShapeIsEmpty(dmgRgn) ? 0 : 1; /* * Convert to Tk coordinates, offset by the window origin. */ TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); if (extraRgn) { CFRelease(extraRgn); } /* * Scroll the rectangle. */ [view scrollRect:scrollSrc by:NSMakeSize(dx, -dy)]; } } else { dmgRgn = HIShapeCreateEmpty(); TkMacOSXSetWithNativeRegion(damageRgn, dmgRgn); } |
︙ | ︙ | |||
1468 1469 1470 1471 1472 1473 1474 | *---------------------------------------------------------------------- * * TkMacOSXSetUpDrawingContext -- * * Set up a drawing context for the given drawable and GC. * * Results: | | | | | | | | | < > | > > | > | | | | | < | | | | | | | | | | | | | | | | < < < < | > > > | > > > | 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 | *---------------------------------------------------------------------- * * TkMacOSXSetUpDrawingContext -- * * Set up a drawing context for the given drawable and GC. * * Results: * Boolean indicating whether it is ok to draw; if false, drawing context * was not setup, so do not attempt to draw and do not call * TkMacOSXRestoreDrawingContext(). * * Side effects: * None. * *---------------------------------------------------------------------- */ Bool TkMacOSXSetupDrawingContext( Drawable d, GC gc, int useCG, /* advisory only ! */ TkMacOSXDrawingContext *dcPtr) { MacDrawable *macDraw = (MacDrawable *) d; Bool canDraw = true; NSWindow *win = NULL; TkMacOSXDrawingContext dc = {}; CGRect clipBounds; /* * If the drawable is not a pixmap and it has an associated NSWindow then * we know we are drawing to a window. */ if (!(macDraw->flags & TK_IS_PIXMAP)) { win = TkMacOSXDrawableWindow(d); } /* * Check that we have a non-empty clipping region. */ dc.clipRgn = TkMacOSXGetClipRgn(d); ClipToGC(d, gc, &dc.clipRgn); if (dc.clipRgn && HIShapeIsEmpty(dc.clipRgn)) { canDraw = false; goto end; } /* * If we already have a CGContext, use it. Otherwise, if we are drawing to * a window then we can get one from the window. */ dc.context = TkMacOSXGetCGContextForDrawable(d); if (dc.context) { dc.portBounds = clipBounds = CGContextGetClipBoundingBox(dc.context); } else if (win) { NSView *view = TkMacOSXDrawableView(macDraw); if (!view) { Tcl_Panic("TkMacOSXSetupDrawingContext(): " "no NSView to draw into !"); } /* * We can only draw into the view when the current CGContext is valid * and belongs to the view. Validity can only be guaranteed inside of * a view's drawRect or setFrame methods. The isDrawing attribute * tells us whether we are being called from one of those methods. * * If the CGContext is not valid, or belongs to a different View, then * we mark our view as needing display and return failure. It should * get drawn in a later call to drawRect. */ if (view != [NSView focusView]) { [view setNeedsDisplay:YES]; canDraw = false; goto end; } dc.view = view; dc.context = GET_CGCONTEXT; dc.portBounds = NSRectToCGRect([view bounds]); if (dc.clipRgn) { clipBounds = CGContextGetClipBoundingBox(dc.context); } } else { Tcl_Panic("TkMacOSXSetupDrawingContext(): " "no context to draw into !"); } /* * Configure the drawing context. */ if (dc.context) { CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = dc.portBounds.size.height }; dc.portBounds.origin.x += macDraw->xOff; dc.portBounds.origin.y += macDraw->yOff; CGContextSaveGState(dc.context); CGContextSetTextDrawingMode(dc.context, kCGTextFill); CGContextConcatCTM(dc.context, t); if (dc.clipRgn) { #ifdef TK_MAC_DEBUG_DRAWING CGContextSaveGState(dc.context); ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); CGContextSetRGBFillColor(dc.context, 1.0, 0.0, 0.0, 0.1); CGContextEOFillPath(dc.context); CGContextRestoreGState(dc.context); #endif /* TK_MAC_DEBUG_DRAWING */ CGRect r; if (!HIShapeIsRectangular(dc.clipRgn) || !CGRectContainsRect( *HIShapeGetBounds(dc.clipRgn, &r), CGRectApplyAffineTransform(clipBounds, t))) { ChkErr(HIShapeReplacePathInCGContext, dc.clipRgn, dc.context); CGContextEOClip(dc.context); } } |
︙ | ︙ | |||
1604 1605 1606 1607 1608 1609 1610 | double w = gc->line_width; TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); if (win) { CGContextSetPatternPhase(dc.context, CGSizeMake( dc.portBounds.size.width, dc.portBounds.size.height)); } | | > > | > > > | > > | | | | > > | | > | 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 | double w = gc->line_width; TkMacOSXSetColorInContext(gc, gc->foreground, dc.context); if (win) { CGContextSetPatternPhase(dc.context, CGSizeMake( dc.portBounds.size.width, dc.portBounds.size.height)); } if (gc->function != GXcopy) { TkMacOSXDbgMsg("Logical functions other than GXcopy are " "not supported for CG drawing!"); } /* * When should we antialias? */ shouldAntialias = !notAA(gc->line_width); if (!shouldAntialias) { /* * Make non-antialiased CG drawing look more like X11. */ w -= (gc->line_width ? NON_AA_CG_OFFSET : 0); } CGContextSetShouldAntialias(dc.context, shouldAntialias); CGContextSetLineWidth(dc.context, w); if (gc->line_style != LineSolid) { int num = 0; char *p = &gc->dashes; CGFloat dashOffset = gc->dash_offset; CGFloat lengths[10]; while (p[num] != '\0' && num < 10) { lengths[num] = p[num]; num++; } CGContextSetLineDash(dc.context, dashOffset, lengths, num); } if ((unsigned) gc->cap_style < sizeof(cgCap)/sizeof(CGLineCap)) { CGContextSetLineCap(dc.context, cgCap[(unsigned) gc->cap_style]); } if ((unsigned)gc->join_style < sizeof(cgJoin)/sizeof(CGLineJoin)) { CGContextSetLineJoin(dc.context, cgJoin[(unsigned) gc->join_style]); } } } end: #ifdef TK_MAC_DEBUG_DRAWING if (!canDraw && win != NULL) { TkWindow *winPtr = TkMacOSXGetTkWindow(win); if (winPtr) { fprintf(stderr, "Cannot draw in %s - postponing.\n", Tk_PathName(winPtr)); } } #endif if (!canDraw && dc.clipRgn) { CFRelease(dc.clipRgn); dc.clipRgn = NULL; } *dcPtr = dc; |
︙ | ︙ | |||
1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 | MacDrawable *macDraw = (MacDrawable *) drawable; HIShapeRef clipRgn = NULL; if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macDraw->winPtr); #ifdef TK_MAC_DEBUG_DRAWING TkMacOSXDbgMsg("%s", macDraw->winPtr->pathName); NSView *view = TkMacOSXDrawableView(macDraw); CGContextSaveGState(context); CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, [view bounds].size.height)); ChkErr(HIShapeReplacePathInCGContext, macDraw->visRgn, context); CGContextSetRGBFillColor(context, 0.0, 1.0, 0.0, 0.1); CGContextEOFillPath(context); CGContextRestoreGState(context); | > > | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | MacDrawable *macDraw = (MacDrawable *) drawable; HIShapeRef clipRgn = NULL; if (macDraw->winPtr && macDraw->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(macDraw->winPtr); #ifdef TK_MAC_DEBUG_DRAWING TkMacOSXDbgMsg("%s", macDraw->winPtr->pathName); NSView *view = TkMacOSXDrawableView(macDraw); CGContextSaveGState(context); CGContextConcatCTM(context, CGAffineTransformMake(1.0, 0.0, 0.0, -1.0, 0.0, [view bounds].size.height)); ChkErr(HIShapeReplacePathInCGContext, macDraw->visRgn, context); CGContextSetRGBFillColor(context, 0.0, 1.0, 0.0, 0.1); CGContextEOFillPath(context); CGContextRestoreGState(context); |
︙ | ︙ | |||
1739 1740 1741 1742 1743 1744 1745 | } /* *---------------------------------------------------------------------- * * TkMacOSXSetUpClippingRgn -- * | | | | 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 | } /* *---------------------------------------------------------------------- * * TkMacOSXSetUpClippingRgn -- * * Set up the clipping region so that drawing only occurs on the specified * X subwindow. * * Results: * None. * * Side effects: * None. * |
︙ | ︙ | |||
1762 1763 1764 1765 1766 1767 1768 | } /* *---------------------------------------------------------------------- * * TkpClipDrawableToRect -- * | | | | 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 | } /* *---------------------------------------------------------------------- * * TkpClipDrawableToRect -- * * Clip all drawing into the drawable d to the given rectangle. If width * or height are negative, reset to no clipping. * * Results: * None. * * Side effects: * Subsequent drawing into d is offset and clipped as specified. * |
︙ | ︙ | |||
1828 1829 1830 1831 1832 1833 1834 | static void ClipToGC( Drawable d, GC gc, HIShapeRef *clipRgnPtr) /* must point to initialized variable */ { if (gc && gc->clip_mask && | | | | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | static void ClipToGC( Drawable d, GC gc, HIShapeRef *clipRgnPtr) /* must point to initialized variable */ { if (gc && gc->clip_mask && ((TkpClipMask *) gc->clip_mask)->type == TKP_CLIP_REGION) { TkRegion gcClip = ((TkpClipMask *) gc->clip_mask)->value.region; int xOffset = ((MacDrawable *) d)->xOff + gc->clip_x_origin; int yOffset = ((MacDrawable *) d)->yOff + gc->clip_y_origin; HIShapeRef clipRgn = *clipRgnPtr, gcClipRgn; TkMacOSXOffsetRegion(gcClip, xOffset, yOffset); gcClipRgn = TkMacOSXGetNativeRegion(gcClip); if (clipRgn) { |
︙ | ︙ | |||
1852 1853 1854 1855 1856 1857 1858 | } /* *---------------------------------------------------------------------- * * TkMacOSXMakeStippleMap -- * | | | | < | 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 | } /* *---------------------------------------------------------------------- * * TkMacOSXMakeStippleMap -- * * Given a drawable and a stipple pattern this function draws the pattern * repeatedly over the drawable. The drawable can then be used as a mask * for bit-bliting a stipple pattern over an object. * * Results: * A BitMap data structure. * * Side effects: * None. * |
︙ | ︙ | |||
1879 1880 1881 1882 1883 1884 1885 | } /* *---------------------------------------------------------------------- * * TkpDrawHighlightBorder -- * | | | | | | | | | 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 | } /* *---------------------------------------------------------------------- * * TkpDrawHighlightBorder -- * * This procedure draws a rectangular ring around the outside of a widget * to indicate that it has received the input focus. * * On the Macintosh, this puts a 1 pixel border in the bgGC color between * the widget and the focus ring, except in the case where highlightWidth * is 1, in which case the border is left out. * * For proper Mac L&F, use highlightWidth of 3. * * Results: * None. * * Side effects: * A rectangle "width" pixels wide is drawn in "drawable", corresponding * to the outer area of "tkwin". * *---------------------------------------------------------------------- */ void TkpDrawHighlightBorder ( Tk_Window tkwin, |
︙ | ︙ | |||
1920 1921 1922 1923 1924 1925 1926 | } } } /* *---------------------------------------------------------------------- * | | | | | > | < | | < | 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 | } } } /* *---------------------------------------------------------------------- * * TkpDrawFrameEx -- * * This procedure draws the rectangular frame area. If the user has * requested themeing, it draws with the background theme. * * Results: * None. * * Side effects: * Draws inside the tkwin area. * *---------------------------------------------------------------------- */ void TkpDrawFrameEx( Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) { if (useThemedToplevel && Tk_IsTopLevel(tkwin)) { static Tk_3DBorder themedBorder = NULL; if (!themedBorder) { themedBorder = Tk_Get3DBorder(NULL, tkwin, "systemWindowHeaderBackground"); } if (themedBorder) { border = themedBorder; } } Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth, highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth, Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXEmbed.c.
︙ | ︙ | |||
268 269 270 271 272 273 274 | */ if (TkpScanWindowId(interp, string, (Window *)&parent) != TCL_OK) { return TCL_ERROR; } usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, (Window) parent); | > > > > > > > | | < < | < | < < < | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | */ if (TkpScanWindowId(interp, string, (Window *)&parent) != TCL_OK) { return TCL_ERROR; } usePtr = (TkWindow *) Tk_IdToWindow(winPtr->display, (Window) parent); if (usePtr == NULL) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "couldn't create child of window \"%s\"", string)); Tcl_SetErrorCode(interp, "TK", "EMBED", "NO_TARGET", NULL); } return TCL_ERROR; } else if (!(usePtr->flags & TK_CONTAINER)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" doesn't have -container option set", usePtr->pathName)); Tcl_SetErrorCode(interp, "TK", "EMBED", "CONTAINER", NULL); return TCL_ERROR; } /* * Since we do not allow embedding into windows belonging to a different * process, we know that a container will exist showing the parent window * as the parent. This loop finds that container. */ for (containerPtr = firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if (containerPtr->parent == (Window) parent) { winPtr->flags |= TK_BOTH_HALVES; containerPtr->parentPtr->flags |= TK_BOTH_HALVES; |
︙ | ︙ | |||
308 309 310 311 312 313 314 | macWin = ckalloc(sizeof(MacDrawable)); if (macWin == NULL) { winPtr->privatePtr = NULL; return TCL_ERROR; } macWin->winPtr = winPtr; | < < < < < < < < < < > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | < | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | macWin = ckalloc(sizeof(MacDrawable)); if (macWin == NULL) { winPtr->privatePtr = NULL; return TCL_ERROR; } macWin->winPtr = winPtr; macWin->view = nil; macWin->context = NULL; macWin->size = CGSizeZero; macWin->visRgn = NULL; macWin->aboveVisRgn = NULL; macWin->drawRgn = NULL; macWin->referenceCount = 0; macWin->flags = TK_CLIP_INVALID; macWin->toplevel = macWin; macWin->toplevel->referenceCount++; winPtr->privatePtr = macWin; winPtr->flags |= TK_EMBEDDED; /* * Make a copy of the TK_EMBEDDED flag, since sometimes we need this to * get the port after the TkWindow structure has been freed. */ macWin->flags |= TK_EMBEDDED; macWin->xOff = parent->winPtr->privatePtr->xOff + parent->winPtr->changes.border_width + winPtr->changes.x; macWin->yOff = parent->winPtr->privatePtr->yOff + parent->winPtr->changes.border_width + winPtr->changes.y; /* * Finish filling up the container structure with the embedded window's * information. */ containerPtr->embedded = (Window) macWin; containerPtr->embeddedPtr = macWin->winPtr; /* * Create an event handler to clean up the Container structure when * tkwin is eventually deleted. */ Tk_CreateEventHandler(tkwin, StructureNotifyMask, EmbeddedEventProc, winPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
538 539 540 541 542 543 544 | /* *---------------------------------------------------------------------- * * TkpClaimFocus -- * * This procedure is invoked when someone asks for the input focus to be | | < < | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | /* *---------------------------------------------------------------------- * * TkpClaimFocus -- * * This procedure is invoked when someone asks for the input focus to be * put on a window in an embedded application. * * Results: * None. * * Side effects: * The input focus may change. * |
︙ | ︙ | |||
579 580 581 582 583 584 585 | event.xfocus.type = FocusIn; event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display); event.xfocus.send_event = 1; event.xfocus.display = topLevelPtr->display; event.xfocus.window = containerPtr->parent; event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS; event.xfocus.detail = force; | | | 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 | event.xfocus.type = FocusIn; event.xfocus.serial = LastKnownRequestProcessed(topLevelPtr->display); event.xfocus.send_event = 1; event.xfocus.display = topLevelPtr->display; event.xfocus.window = containerPtr->parent; event.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS; event.xfocus.detail = force; Tk_HandleEvent(&event); } /* *---------------------------------------------------------------------- * * TkpTestembedCmd -- * |
︙ | ︙ | |||
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; } else { all = 0; } Tcl_DStringInit(&dString); for (containerPtr = firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { Tcl_DStringStartSublist(&dString); if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { | > > > > > > > > > > > > > > > > | > > > > > | > | < > | > | | | < > > > | | > | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; } else { all = 0; } Tcl_DStringInit(&dString); for (containerPtr = firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if (containerPtr->embeddedPtr != NULL) { embeddedInterp = containerPtr->embeddedPtr->mainPtr->interp; } if (containerPtr->parentPtr != NULL) { parentInterp = containerPtr->parentPtr->mainPtr->interp; } if (embeddedInterp != interp && parentInterp != interp) { continue; } Tcl_DStringStartSublist(&dString); /* * Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { sprintf(buffer, "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->parent); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* * Parent pathName */ if (containerPtr->parentPtr == NULL || parentInterp != interp) { Tcl_DStringAppendElement(&dString, ""); } else { Tcl_DStringAppendElement(&dString, containerPtr->parentPtr->pathName); } /* * On X11 embedded is a wrapper, which does not exist on macOS. */ Tcl_DStringAppendElement(&dString, ""); /* * Embedded window pathName */ if (containerPtr->embeddedPtr == NULL || embeddedInterp != interp) { Tcl_DStringAppendElement(&dString, ""); } else { Tcl_DStringAppendElement(&dString, containerPtr->embeddedPtr->pathName); } Tcl_DStringEndSublist(&dString); } |
︙ | ︙ | |||
799 800 801 802 803 804 805 806 807 808 809 810 811 812 | Container *containerPtr; Tk_ErrorHandler errHandler; if (!firstContainerPtr) { /* * When the interpreter is being dismantled this can be nil. */ return; } /* * Ignore any X protocol errors that happen in this procedure (almost any * operation could fail, for example, if the embedded application has * deleted its window). | > | 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 | Container *containerPtr; Tk_ErrorHandler errHandler; if (!firstContainerPtr) { /* * When the interpreter is being dismantled this can be nil. */ return; } /* * Ignore any X protocol errors that happen in this procedure (almost any * operation could fail, for example, if the embedded application has * deleted its window). |
︙ | ︙ | |||
864 865 866 867 868 869 870 | * the screen. */ XMapWindow(eventPtr->xmaprequest.display, eventPtr->xmaprequest.window); } else if (eventPtr->type == DestroyNotify) { /* | > > | | 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 | * the screen. */ XMapWindow(eventPtr->xmaprequest.display, eventPtr->xmaprequest.window); } else if (eventPtr->type == DestroyNotify) { /* * It is not clear whether the container should be destroyed * when an embedded window is destroyed. See ticket [67384bce7d]. * Here we are following unix, by destroying the container. */ Tk_DestroyWindow((Tk_Window) winPtr); } Tk_DeleteErrorHandler(errHandler); } |
︙ | ︙ | |||
900 901 902 903 904 905 906 907 908 909 910 911 912 913 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { if (containerPtr->embedded != None) { /* * Ignore errors, since the embedded application could have * deleted its window. */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, | > > > > > > > > | 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { /* * Send a ConfigureNotify to the embedded application. */ if (containerPtr->embeddedPtr != None) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->embedded != None) { /* * Ignore errors, since the embedded application could have * deleted its window. */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | int width, int height) /* Size that the child has requested. */ { TkWindow *winPtr = containerPtr->parentPtr; /* * Forward the requested size into our geometry management hierarchy via * the container window. We need to send a Configure event back to the | | | | | < | 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | int width, int height) /* Size that the child has requested. */ { TkWindow *winPtr = containerPtr->parentPtr; /* * Forward the requested size into our geometry management hierarchy via * the container window. We need to send a Configure event back to the * embedded application if we decide not to honor its request; to make this * happen, process all idle event handlers synchronously here (so that the * geometry managers have had a chance to do whatever they want to do), and * if the window's size didn't change then generate a configure event. */ Tk_GeometryRequest((Tk_Window) winPtr, width, height); while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) { /* Empty loop body. */ } if ((winPtr->changes.width != width) |
︙ | ︙ | |||
1074 1075 1076 1077 1078 1079 1080 | * * EmbedSendConfigure -- * * This is currently a stub. It is called to notify an embedded * application of its current size and location. This procedure is called * when the embedded application made a geometry request that we did not * grant, so that the embedded application knows that its geometry didn't | | | | 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 | * * EmbedSendConfigure -- * * This is currently a stub. It is called to notify an embedded * application of its current size and location. This procedure is called * when the embedded application made a geometry request that we did not * grant, so that the embedded application knows that its geometry didn't * change after all. It is a response to ConfigureRequest events, which we * do not currently synthesize on the Mac * * Results: * None. * * Side effects: * None. * |
︙ | ︙ | |||
1135 1136 1137 1138 1139 1140 1141 | * Fabricate an event to do this. */ if (containerPtr->parentPtr != NULL && containerPtr->parentPtr->flags & TK_BOTH_HALVES) { XEvent event; | | | | 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | * Fabricate an event to do this. */ if (containerPtr->parentPtr != NULL && containerPtr->parentPtr->flags & TK_BOTH_HALVES) { XEvent event; event.xany.serial = LastKnownRequestProcessed( Tk_Display(containerPtr->parentPtr)); event.xany.send_event = False; event.xany.display = Tk_Display(containerPtr->parentPtr); event.xany.type = DestroyNotify; event.xany.window = containerPtr->parent; event.xdestroywindow.event = containerPtr->parent; Tk_QueueWindowEvent(&event, TCL_QUEUE_HEAD); |
︙ | ︙ |
Changes to macosx/tkMacOSXEntry.c.
︙ | ︙ | |||
120 121 122 123 124 125 126 | * nicer. */ if (isSpinbox) { int incDecWidth; /* | > | | | < | | | > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | * nicer. */ if (isSpinbox) { int incDecWidth; /* * If native spinbox buttons are going to be drawn, then temporarily * change the width of the widget so that the same code can be used * for drawing the Entry portion of the Spinbox as is used to draw * an ordinary Entry. The width must be restored before returning. */ oldWidth = Tk_Width(tkwin); if (ComputeIncDecParameters(Tk_Height(tkwin) - 2 * MAC_OSX_FOCUS_WIDTH, &incDecWidth) != 0) { Tk_Width(tkwin) -= incDecWidth + 1; } } /* * The focus ring is drawn with an Alpha at the outside part of the ring, * so we have to draw over the edges of the ring before drawing the focus * or the text will peep through. */ |
︙ | ︙ | |||
182 183 184 185 186 187 188 | * This procedure redraws the buttons of an spinbox widget. It overrides * the generic button drawing code if the spinbox widget parameters are * such that the native widget drawing is a good fit. This version just * returns 0, so platforms that don't do special native drawing don't * have to implement it. * * Results: | | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | * This procedure redraws the buttons of an spinbox widget. It overrides * the generic button drawing code if the spinbox widget parameters are * such that the native widget drawing is a good fit. This version just * returns 0, so platforms that don't do special native drawing don't * have to implement it. * * Results: * 1 if it has drawn the buttons, 0 if not. * * Side effects: * May draw the buttons into pixmap. * *-------------------------------------------------------------- */ int TkpDrawSpinboxButtons( Spinbox *sbPtr, |
︙ | ︙ | |||
254 255 256 257 258 259 260 | /* * We had to make the entry part of the window smaller so that we wouldn't * overdraw the spin buttons with the focus highlight. So now we have to * draw the highlightbackground. */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); | | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | /* * We had to make the entry part of the window smaller so that we wouldn't * overdraw the spin buttons with the focus highlight. So now we have to * draw the highlightbackground. */ bgGC = Tk_GCForColor(sbPtr->entry.highlightBgColorPtr, d); rects[0].x = Tk_Width(tkwin) - incDecWidth - 1; rects[0].y = 0; rects[0].width = incDecWidth + 1; rects[0].height = Tk_Height(tkwin); XFillRectangles(Tk_Display(tkwin), d, bgGC, rects, 1); if (!TkMacOSXSetupDrawingContext(d, NULL, 1, &dc)) { return 0; } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); |
︙ | ︙ |
Changes to macosx/tkMacOSXEvent.c.
︙ | ︙ | |||
110 111 112 113 114 115 116 | /* *---------------------------------------------------------------------- * * TkMacOSXFlushWindows -- * * This routine is a stub called by XSync, which is called during the Tk * update command. The language specification does not require that the | | | | | < < < < | < | | > | < | < < | < < < < < < < | < < | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | /* *---------------------------------------------------------------------- * * TkMacOSXFlushWindows -- * * This routine is a stub called by XSync, which is called during the Tk * update command. The language specification does not require that the * update command be synchronous but many of the tests implicitly assume * that it is. It is definitely asynchronous on macOS since many idle * tasks are run inside of the drawRect method of a window's contentView, * which will not be called until after this function returns. * * Results: * None. * * Side effects: Processes all pending idle events then calls the display * method of each visible window. * *---------------------------------------------------------------------- */ MODULE_SCOPE void TkMacOSXFlushWindows(void) { if (Tk_GetNumMainWindows() == 0) { return; } while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)){} for (NSWindow *w in [NSApp orderedWindows]) { [w display]; } } /* * Local Variables: * mode: objc |
︙ | ︙ |
Changes to macosx/tkMacOSXFont.c.
1 2 3 | /* * tkMacOSXFont.c -- * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkMacOSXFont.c -- * * Contains the Macintosh implementation of the platform-independent font * package interface. * * Copyright 2002-2004 Benjamin Riefenstahl, [email protected] * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright 2008-2009, Apple Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
︙ | ︙ | |||
28 29 30 31 32 33 34 | /* * The following structure represents our Macintosh-specific implementation * of a font object. */ typedef struct { | | | < | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * The following structure represents our Macintosh-specific implementation * of a font object. */ typedef struct { TkFont font; /* Stuff used by generic font package. Must be * first in structure. */ NSFont *nsFont; NSDictionary *nsAttributes; } MacFont; /* * The names for our "native" fonts. */ |
︙ | ︙ | |||
79 80 81 82 83 84 85 | }; #undef ThemeFont static int antialiasedTextEnabled = -1; static NSCharacterSet *whitespaceCharacterSet = nil; static NSCharacterSet *lineendingCharacterSet = nil; | | | | > | > | | | > | | | > | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | }; #undef ThemeFont static int antialiasedTextEnabled = -1; static NSCharacterSet *whitespaceCharacterSet = nil; static NSCharacterSet *lineendingCharacterSet = nil; static void GetTkFontAttributesForNSFont(NSFont *nsFont, TkFontAttributes *faPtr); static NSFont * FindNSFont(const char *familyName, NSFontTraitMask traits, NSInteger weight, CGFloat size, int fallbackToDefault); static void InitFont(NSFont *nsFont, const TkFontAttributes *reqFaPtr, MacFont *fontPtr); static int CreateNamedSystemFont(Tcl_Interp *interp, Tk_Window tkwin, const char *name, TkFontAttributes *faPtr); static void DrawCharsInContext(Display *display, Drawable drawable, GC gc, Tk_Font tkfont, const char *source, int numBytes, int rangeStart, int rangeLength, int x, int y, double angle); #pragma mark - #pragma mark Font Helpers: #define GetNSFontTraitsFromTkFontAttributes(faPtr) \ ((faPtr)->weight == TK_FW_BOLD ? NSBoldFontMask : NSUnboldFontMask) | \ ((faPtr)->slant == TK_FS_ITALIC ? NSItalicFontMask : NSUnitalicFontMask) |
︙ | ︙ | |||
228 229 230 231 232 233 234 | NSDictionary *nsAttributes; NSRect bounds; CGFloat kern = 0.0; NSFontRenderingMode renderingMode = NSFontDefaultRenderingMode; int ascent, descent/*, dontAA*/; static const UniChar ch[] = {'.', 'W', ' ', 0xc4, 0xc1, 0xc2, 0xc3, 0xc7}; /* ., W, Space, Auml, Aacute, Acirc, Atilde, Ccedilla */ | | > > | > > | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | NSDictionary *nsAttributes; NSRect bounds; CGFloat kern = 0.0; NSFontRenderingMode renderingMode = NSFontDefaultRenderingMode; int ascent, descent/*, dontAA*/; static const UniChar ch[] = {'.', 'W', ' ', 0xc4, 0xc1, 0xc2, 0xc3, 0xc7}; /* ., W, Space, Auml, Aacute, Acirc, Atilde, Ccedilla */ #define nCh (sizeof(ch) / sizeof(UniChar)) CGGlyph glyphs[nCh]; CGRect boundingRects[nCh]; fontPtr->font.fid = (Font) fontPtr; faPtr = &fontPtr->font.fa; if (reqFaPtr) { *faPtr = *reqFaPtr; } else { TkInitFontAttributes(faPtr); } fontPtr->nsFont = nsFont; /* * Some don't like antialiasing on fixed-width even if bigger than limit */ // dontAA = [nsFont isFixedPitch] && fontPtr->font.fa.size <= 10; if (antialiasedTextEnabled >= 0/* || dontAA*/) { renderingMode = (antialiasedTextEnabled == 0/* || dontAA*/) ? NSFontIntegerAdvancementsRenderingMode : NSFontAntialiasedRenderingMode; } nsFont = [nsFont screenFontWithRenderingMode:renderingMode]; |
︙ | ︙ | |||
290 291 292 293 294 295 296 | [NSNumber numberWithInt:faPtr->overstrike ? NSUnderlineStyleSingle|NSUnderlinePatternSolid : NSUnderlineStyleNone], NSStrikethroughStyleAttributeName, [NSNumber numberWithInt:fmPtr->fixed ? 0 : 1], NSLigatureAttributeName, [NSNumber numberWithDouble:kern], NSKernAttributeName, nil]; fontPtr->nsAttributes = [nsAttributes retain]; | | | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | [NSNumber numberWithInt:faPtr->overstrike ? NSUnderlineStyleSingle|NSUnderlinePatternSolid : NSUnderlineStyleNone], NSStrikethroughStyleAttributeName, [NSNumber numberWithInt:fmPtr->fixed ? 0 : 1], NSLigatureAttributeName, [NSNumber numberWithDouble:kern], NSKernAttributeName, nil]; fontPtr->nsAttributes = [nsAttributes retain]; #undef nCh } /* *------------------------------------------------------------------------- * * CreateNamedSystemFont -- * |
︙ | ︙ | |||
354 355 356 357 358 359 360 | { Tcl_Interp *interp = mainPtr->interp; Tk_Window tkwin = (Tk_Window) mainPtr->winPtr; const struct SystemFontMapEntry *systemFont = systemFontMap; NSFont *nsFont; TkFontAttributes fa; NSMutableCharacterSet *cs; | > | > > | > | 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | { Tcl_Interp *interp = mainPtr->interp; Tk_Window tkwin = (Tk_Window) mainPtr->winPtr; const struct SystemFontMapEntry *systemFont = systemFontMap; NSFont *nsFont; TkFontAttributes fa; NSMutableCharacterSet *cs; /* * Since we called before TkpInit, we need our own autorelease pool. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; /* * Force this for now. */ if (!mainPtr->winPtr->mainPtr) { mainPtr->winPtr->mainPtr = mainPtr; } while (systemFont->systemName) { nsFont = (NSFont*) CTFontCreateUIFontForLanguage( HIThemeGetUIFontType(systemFont->id), 0, NULL); if (nsFont) { |
︙ | ︙ | |||
409 410 411 412 413 414 415 | *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. * * Results: | | | | | | | | | | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. * * Results: * The return value is a pointer to a TkFont that represents the native * font. If a native font by the given name could not be found, the return * value is NULL. * * Every call to this procedure returns a new TkFont structure, even if * the name has already been seen before. The caller should call * TkpDeleteFont() when the font is no longer needed. * * The caller is responsible for initializing the memory associated with * the generic TkFont when this function returns and releasing the * contents of the generics TkFont before calling TkpDeleteFont(). * * Side effects: * None. * *--------------------------------------------------------------------------- */ |
︙ | ︙ | |||
445 446 447 448 449 450 451 | } else if (strcmp(name, APPLFONT_NAME) == 0) { themeFontId = kThemeApplicationFont; } else if (strcmp(name, MENUITEMFONT_NAME) == 0) { themeFontId = kThemeMenuItemFont; } else { return NULL; } | | | | | | < | | | | | | | | | | | | | 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | } else if (strcmp(name, APPLFONT_NAME) == 0) { themeFontId = kThemeApplicationFont; } else if (strcmp(name, MENUITEMFONT_NAME) == 0) { themeFontId = kThemeMenuItemFont; } else { return NULL; } ctFont = CTFontCreateUIFontForLanguage( HIThemeGetUIFontType(themeFontId), 0, NULL); if (ctFont) { fontPtr = ckalloc(sizeof(MacFont)); InitFont((NSFont*) ctFont, NULL, fontPtr); } return (TkFont *) fontPtr; } /* *--------------------------------------------------------------------------- * * TkpGetFontFromAttributes -- * * Given a desired set of attributes for a font, find a font with the * closest matching attributes. * * Results: * The return value is a pointer to a TkFont that represents the font with * the desired attributes. If a font with the desired attributes could not * be constructed, some other font will be substituted automatically. * * Every call to this procedure returns a new TkFont structure, even if * the specified attributes have already been seen before. The caller * should call TkpDeleteFont() to free the platform- specific data when * the font is no longer needed. * * The caller is responsible for initializing the memory associated with * the generic TkFont when this function returns and releasing the * contents of the generic TkFont before calling TkpDeleteFont(). * * Side effects: * None. * *--------------------------------------------------------------------------- */ TkFont * TkpGetFontFromAttributes( TkFont *tkFontPtr, /* If non-NULL, store the information in this * existing TkFont structure, rather than * allocating a new structure to hold the font; * the existing contents of the font will be * released. If NULL, a new TkFont structure is * allocated. */ Tk_Window tkwin, /* For display where font will be used. */ const TkFontAttributes *faPtr) /* Set of attributes to match. */ { MacFont *fontPtr; int points = (int) (TkFontGetPoints(tkwin, faPtr->size) + 0.5); NSFontTraitMask traits = GetNSFontTraitsFromTkFontAttributes(faPtr); NSInteger weight = (faPtr->weight == TK_FW_BOLD ? 9 : 5); NSFont *nsFont; nsFont = FindNSFont(faPtr->family, traits, weight, points, 0); if (!nsFont) { const char *const *aliases = TkFontGetAliasList(faPtr->family); |
︙ | ︙ | |||
534 535 536 537 538 539 540 | /* *--------------------------------------------------------------------------- * * TkpDeleteFont -- * * Called to release a font allocated by TkpGetNativeFont() or | | | | | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | /* *--------------------------------------------------------------------------- * * TkpDeleteFont -- * * Called to release a font allocated by TkpGetNativeFont() or * TkpGetFontFromAttributes(). The caller should have already released the * fields of the TkFont that are used exclusively by the generic TkFont * code. * * Results: * TkFont is deallocated. * * Side effects: * None. * |
︙ | ︙ | |||
563 564 565 566 567 568 569 | } /* *--------------------------------------------------------------------------- * * TkpGetFontFamilies -- * | | | | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | } /* *--------------------------------------------------------------------------- * * TkpGetFontFamilies -- * * Return information about the font families that are available on the * display of the given window. * * Results: * Modifies interp's result object to hold a list of all the available * font families. * * Side effects: * None. |
︙ | ︙ | |||
596 597 598 599 600 601 602 | } /* *------------------------------------------------------------------------- * * TkpGetSubFonts -- * | | | | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | } /* *------------------------------------------------------------------------- * * TkpGetSubFonts -- * * A function used by the testing package for querying the actual screen * fonts that make up a font object. * * Results: * Modifies interp's result object to hold a list containing the names of * the screen fonts that make up the given font object. * * Side effects: * None. * *------------------------------------------------------------------------- */ |
︙ | ︙ | |||
638 639 640 641 642 643 644 | } /* *---------------------------------------------------------------------- * * TkpGetFontAttrsForChar -- * | | | | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 | } /* *---------------------------------------------------------------------- * * TkpGetFontAttrsForChar -- * * Retrieve the font attributes of the actual font used to render a given * character. * * Results: * None. * * Side effects: * The font attributes are stored in *faPtr. * |
︙ | ︙ | |||
741 742 743 744 745 746 747 | * that TkpDrawCharsInContext() will be used to actually display the * characters. * * This one is almost the same as Tk_MeasureChars(), but with access to * all the characters on the line for context. * * Results: | | | | < | 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | * that TkpDrawCharsInContext() will be used to actually display the * characters. * * This one is almost the same as Tk_MeasureChars(), but with access to * all the characters on the line for context. * * Results: * The return value is the number of bytes from source that fit into the * span that extends from 0 to maxLength. *lengthPtr is filled with the * x-coordinate of the right edge of the last character that did fit. * * Side effects: * None. * *--------------------------------------------------------------------------- */ |
︙ | ︙ | |||
770 771 772 773 774 775 776 | * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char * which only partially fits on this line. * TK_WHOLE_WORDS means stop on a word | | | | | | | 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | * character that would cross this x-position. * If < 0, then line length is unbounded and * the flags argument is ignored. */ int flags, /* Various flag bits OR-ed together: * TK_PARTIAL_OK means include the last char * which only partially fits on this line. * TK_WHOLE_WORDS means stop on a word * boundary, if possible. TK_AT_LEAST_ONE means * return at least one character even if no * characters fit. If TK_WHOLE_WORDS and * TK_AT_LEAST_ONE are set and the first word * doesn't fit, we return at least one * character or whatever characters fit into * maxLength. TK_ISOLATE_END means that the * last character should not be considered in * context with the rest of the string (used * for breaking lines). */ int *lengthPtr) /* Filled with x-location just after the * terminating character. */ |
︙ | ︙ | |||
860 861 862 863 864 865 866 | whitespaceCharacterSet : lineendingCharacterSet; while (index > start && [cs characterIsMember:[string characterAtIndex:(index - 1)]]) { index--; } /* | | | | | | | < | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | whitespaceCharacterSet : lineendingCharacterSet; while (index > start && [cs characterIsMember:[string characterAtIndex:(index - 1)]]) { index--; } /* * If there is no line breakpoint in the source string between its * start and the index position that fits in maxWidth, then * CTTypesetterSuggestLineBreak() returns that very last index. * However if the TK_WHOLE_WORDS flag is set, we want to break at a * word boundary. In this situation, unless TK_AT_LEAST_ONE is set, we * must report that zero chars actually fit (in other words the * smallest word of the source string is still larger than maxWidth). */ if ((index >= start) && (index < len) && (flags & TK_WHOLE_WORDS) && !(flags & TK_AT_LEAST_ONE) && ![cs characterIsMember:[string characterAtIndex:index]]) { index = start; } |
︙ | ︙ | |||
899 900 901 902 903 904 905 | if (width < maxWidth && (flags & TK_PARTIAL_OK) && index < len) { range.length = ++index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } | > | | | > > | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | if (width < maxWidth && (flags & TK_PARTIAL_OK) && index < len) { range.length = ++index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } /* * The call to CTTypesetterSuggestClusterBreak above will always return * at least one character regardless of whether it exceeded it or not. * Clean that up now. */ while (width > maxWidth && !(flags & TK_PARTIAL_OK) && index > start+(flags & TK_AT_LEAST_ONE)) { range.length = --index; line = CTTypesetterCreateLine(typesetter, range); width = CTLineGetTypographicBounds(line, NULL, NULL, NULL); CFRelease(line); } |
︙ | ︙ | |||
942 943 944 945 946 947 948 | * * Draw a string of characters on the screen. * * With ATSUI we need the line context to do this right, so we have the * actual implementation in TkpDrawCharsInContext(). * * Results: | | | | | | | 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | * * Draw a string of characters on the screen. * * With ATSUI we need the line context to do this right, so we have the * actual implementation in TkpDrawCharsInContext(). * * Results: * None. * * Side effects: * Information gets drawn on the screen. * *--------------------------------------------------------------------------- */ void Tk_DrawChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ int numBytes, /* Number of bytes in string. */ int x, int y) /* Coordinates at which to place origin of the * string when drawing. */ { DrawCharsInContext(display, drawable, gc, tkfont, source, numBytes, 0, numBytes, x, y, 0.0); } void TkDrawAngledChars( Display *display, /* Display on which to draw. */ Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; * must be the same as font used in GC. */ const char *source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ int numBytes, /* Number of bytes in string. */ double x, double y, /* Coordinates at which to place origin of * string when drawing. */ double angle) /* What angle to put text at, in degrees. */ { |
︙ | ︙ | |||
1025 1026 1027 1028 1029 1030 1031 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) | | | | 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ int numBytes, /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y) /* Coordinates at which to place origin of the * whole (not just the range) string when |
︙ | ︙ | |||
1050 1051 1052 1053 1054 1055 1056 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) | | | | 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 | Drawable drawable, /* Window or pixmap in which to draw. */ GC gc, /* Graphics context for drawing characters. */ Tk_Font tkfont, /* Font in which characters will be drawn; must * be the same as font used in GC. */ const char * source, /* UTF-8 string to be displayed. Need not be * '\0' terminated. All Tk meta-characters * (tabs, control characters, and newlines) * should be stripped out of the string that is * passed to this function. If they are not * stripped out, they will be displayed as * regular printing characters. */ int numBytes, /* Number of bytes in string. */ int rangeStart, /* Index of first byte to draw. */ int rangeLength, /* Length of range to draw in bytes. */ int x, int y, /* Coordinates at which to place origin of the * whole (not just the range) string when |
︙ | ︙ | |||
1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 | return; } string = [[NSString alloc] initWithBytesNoCopy:(void*)source length:numBytes encoding:NSUTF8StringEncoding freeWhenDone:NO]; if (!string) { return; } context = drawingContext.context; fg = TkMacOSXCreateCGColor(gc, gc->foreground); attributes = [fontPtr->nsAttributes mutableCopy]; [attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName]; CFRelease(fg); nsFont = [attributes objectForKey:NSFontAttributeName]; [nsFont setInContext:[NSGraphicsContext graphicsContextWithGraphicsPort: | > | 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 | return; } string = [[NSString alloc] initWithBytesNoCopy:(void*)source length:numBytes encoding:NSUTF8StringEncoding freeWhenDone:NO]; if (!string) { return; } context = drawingContext.context; fg = TkMacOSXCreateCGColor(gc, gc->foreground); attributes = [fontPtr->nsAttributes mutableCopy]; [attributes setObject:(id)fg forKey:(id)kCTForegroundColorAttributeName]; CFRelease(fg); nsFont = [attributes objectForKey:NSFontAttributeName]; [nsFont setInContext:[NSGraphicsContext graphicsContextWithGraphicsPort: |
︙ | ︙ | |||
1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 | } CGContextConcatCTM(context, t); CGContextSetTextPosition(context, x, y); start = Tcl_NumUtfChars(source, rangeStart); len = Tcl_NumUtfChars(source, rangeStart + rangeLength); if (start > 0) { CGRect clipRect = CGRectInfinite, startBounds; line = CTTypesetterCreateLine(typesetter, CFRangeMake(0, start)); startBounds = CTLineGetImageBounds(line, context); CFRelease(line); clipRect.origin.x = startBounds.origin.x + startBounds.size.width; CGContextClipToRect(context, clipRect); } line = CTTypesetterCreateLine(typesetter, CFRangeMake(0, len)); | > | 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 | } CGContextConcatCTM(context, t); CGContextSetTextPosition(context, x, y); start = Tcl_NumUtfChars(source, rangeStart); len = Tcl_NumUtfChars(source, rangeStart + rangeLength); if (start > 0) { CGRect clipRect = CGRectInfinite, startBounds; line = CTTypesetterCreateLine(typesetter, CFRangeMake(0, start)); startBounds = CTLineGetImageBounds(line, context); CFRelease(line); clipRect.origin.x = startBounds.origin.x + startBounds.size.width; CGContextClipToRect(context, clipRect); } line = CTTypesetterCreateLine(typesetter, CFRangeMake(0, len)); |
︙ | ︙ | |||
1237 1238 1239 1240 1241 1242 1243 1244 | if (nsFont && familyName) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; id underline = [nsAttributes objectForKey: NSUnderlineStyleAttributeName]; id strikethrough = [nsAttributes objectForKey: NSStrikethroughStyleAttributeName]; objv[i++] = Tcl_NewStringObj(familyName, -1); | > | | | 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 | if (nsFont && familyName) { NSFontTraitMask traits = [[NSFontManager sharedFontManager] traitsOfFont:nsFont]; id underline = [nsAttributes objectForKey: NSUnderlineStyleAttributeName]; id strikethrough = [nsAttributes objectForKey: NSStrikethroughStyleAttributeName]; objv[i++] = Tcl_NewStringObj(familyName, -1); objv[i++] = Tcl_NewWideIntObj([nsFont pointSize]); #define S(s) Tcl_NewStringObj(STRINGIFY(s), (int)(sizeof(STRINGIFY(s))-1)) objv[i++] = (traits & NSBoldFontMask) ? S(bold) : S(normal); objv[i++] = (traits & NSItalicFontMask) ? S(italic) : S(roman); if ([underline respondsToSelector:@selector(intValue)] && ([underline intValue] & (NSUnderlineStyleSingle | NSUnderlineStyleThick | NSUnderlineStyleDouble))) { objv[i++] = S(underline); } |
︙ | ︙ | |||
1263 1264 1265 1266 1267 1268 1269 | /* *---------------------------------------------------------------------- * * TkMacOSXUseAntialiasedText -- * * Enables or disables application-wide use of antialiased text (where | | | > | 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 | /* *---------------------------------------------------------------------- * * TkMacOSXUseAntialiasedText -- * * Enables or disables application-wide use of antialiased text (where * available). Sets up a linked Tcl global variable to allow disabling of * antialiased text from Tcl. * * The possible values for this variable are: * * -1 - Use system default as configurable in "System Prefs" -> "General". * 0 - Unconditionally disable antialiasing. * 1 - Unconditionally enable antialiasing. * * Results: |
︙ | ︙ |
Changes to macosx/tkMacOSXFont.h.
1 2 3 | /* * tkMacOSXFont.h -- * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * tkMacOSXFont.h -- * * Contains the Macintosh implementation of the platform-independent * font package interface. * * Copyright (c) 1990-1994 The Regents of the University of California. * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * |
︙ | ︙ |
Changes to macosx/tkMacOSXHLEvents.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | * AppleEvent */ } KillEvent; /* * Static functions used only in this file. */ | | | | < | | > > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | * AppleEvent */ } KillEvent; /* * Static functions used only in this file. */ static void tkMacOSXProcessFiles(NSAppleEventDescriptor *event, NSAppleEventDescriptor *replyEvent, Tcl_Interp *interp, const char* procedure); static int MissedAnyParameters(const AppleEvent *theEvent); static int ReallyKillMe(Tcl_Event *eventPtr, int flags); static void RunSimpleTclCommand(Tcl_Interp *interp, const char *command); #pragma mark TKApplication(TKHLEvents) @implementation TKApplication(TKHLEvents) - (void) terminate: (id) sender { [self handleQuitApplicationEvent:Nil withReplyEvent:Nil]; |
︙ | ︙ | |||
74 75 76 77 78 79 80 | Tcl_QueueEvent((Tcl_Event *) eventPtr, TCL_QUEUE_HEAD); } } - (void) handleOpenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { | < < < | < < < < < < < < | < < < < < < | < < < < < < | > > > > > > > | > > > > > > > > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | Tcl_QueueEvent((Tcl_Event *) eventPtr, TCL_QUEUE_HEAD); } } - (void) handleOpenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { RunSimpleTclCommand(_eventInterp, "::tk::mac::OpenApplication"); } - (void) handleReopenApplicationEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { [NSApp activateIgnoringOtherApps: YES]; RunSimpleTclCommand(_eventInterp, "::tk::mac::ReopenApplication"); } - (void) handleShowPreferencesEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { RunSimpleTclCommand(_eventInterp, "::tk::mac::ShowPreferences"); } - (void) handleOpenDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { tkMacOSXProcessFiles(event, replyEvent, _eventInterp, "::tk::mac::OpenDocument"); } - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { NSString* file = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *printFile = [file UTF8String]; Tcl_DString print; Tcl_DStringInit(&print); if (Tcl_FindCommand(_eventInterp, "::tk::mac::PrintDocument", NULL, 0)) { Tcl_DStringAppend(&print, "::tk::mac::PrintDocument", -1); } Tcl_DStringAppendElement(&print, printFile); int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&print), Tcl_DStringLength(&print), TCL_EVAL_GLOBAL); if (tclErr != TCL_OK) { Tcl_BackgroundException(_eventInterp, tclErr); } } - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent { OSStatus err; const AEDesc *theDesc = nil; |
︙ | ︙ | |||
148 149 150 151 152 153 154 | theDesc = [event aeDesc]; if (theDesc == nil) { return; } err = AEGetParamPtr(theDesc, keyDirectObject, typeWildCard, &initialType, | | | | | | | > > | > | | | | > > | | | > > | > | | > | | > > | > | | | | | | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | theDesc = [event aeDesc]; if (theDesc == nil) { return; } err = AEGetParamPtr(theDesc, keyDirectObject, typeWildCard, &initialType, NULL, 0, NULL); if (err != noErr) { sprintf(errString, "AEDoScriptHandler: GetParamDesc error %d", (int)err); AEPutParamPtr((AppleEvent *) [replyEvent aeDesc], keyErrorString, typeChar, errString, strlen(errString)); return; } if (MissedAnyParameters((AppleEvent *) theDesc)) { sprintf(errString, "AEDoScriptHandler: extra parameters"); AEPutParamPtr((AppleEvent *) [replyEvent aeDesc], keyErrorString, typeChar, errString, strlen(errString)); return; } Tcl_Preserve(_eventInterp); if (initialType == typeFileURL || initialType == typeAlias) { /* * The descriptor can be coerced to a file url. Source the file, or * pass the path as a string argument to ::tk::mac::DoScriptFile if * that procedure exists. */ err = AEGetParamPtr(theDesc, keyDirectObject, typeFileURL, &type, (Ptr) URLBuffer, URL_MAX_LENGTH, &actual); if (err == noErr && actual > 0){ URLBuffer[actual] = '\0'; NSString *urlString = [NSString stringWithUTF8String:(char*)URLBuffer]; NSURL *fileURL = [NSURL URLWithString:urlString]; Tcl_DString command; Tcl_DStringInit(&command); if (Tcl_FindCommand(_eventInterp, "::tk::mac::DoScriptFile", NULL, 0)) { Tcl_DStringAppend(&command, "::tk::mac::DoScriptFile", -1); } else { Tcl_DStringAppend(&command, "source", -1); } Tcl_DStringAppendElement(&command, [[fileURL path] UTF8String]); tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); } } else if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, NULL, 0, &actual)) { if (actual > 0) { /* * The descriptor can be coerced to UTF8 text. Evaluate as Tcl, or * or pass the text as a string argument to ::tk::mac::DoScriptText * if that procedure exists. */ char *data = ckalloc(actual + 1); if (noErr == AEGetParamPtr(theDesc, keyDirectObject, typeUTF8Text, &type, data, actual, NULL)) { if (Tcl_FindCommand(_eventInterp, "::tk::mac::DoScriptText", NULL, 0)) { Tcl_DString command; Tcl_DStringInit(&command); Tcl_DStringAppend(&command, "::tk::mac::DoScriptText", -1); Tcl_DStringAppendElement(&command, data); tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); } else { tclErr = Tcl_EvalEx(_eventInterp, data, actual, TCL_EVAL_GLOBAL); } } ckfree(data); } } else { /* * The descriptor can not be coerced to a fileURL or UTF8 text. */ for (int i = 0; i < 4; i++) { typeString[i] = ((char*)&initialType)[3-i]; } typeString[4] = '\0'; sprintf(errString, "AEDoScriptHandler: invalid script type '%s', " "must be coercable to 'furl' or 'utf8'", typeString); AEPutParamPtr((AppleEvent*)[replyEvent aeDesc], keyErrorString, typeChar, errString, strlen(errString)); } /* * If we ran some Tcl code, put the result in the reply. */ if (tclErr >= 0) { int reslen; const char *result = Tcl_GetStringFromObj(Tcl_GetObjResult(_eventInterp), &reslen); if (tclErr == TCL_OK) { AEPutParamPtr((AppleEvent *) [replyEvent aeDesc], keyDirectObject, typeChar, result, reslen); } else { AEPutParamPtr((AppleEvent *) [replyEvent aeDesc], keyErrorString, typeChar, result, reslen); AEPutParamPtr((AppleEvent *) [replyEvent aeDesc], keyErrorNumber, typeSInt32, (Ptr) &tclErr, sizeof(int)); } } Tcl_Release(_eventInterp); return; } - (void)handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent { NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue]; const char *cURL = [url UTF8String]; Tcl_DString launch; Tcl_DStringInit(&launch); if (Tcl_FindCommand(_eventInterp, "::tk::mac::LaunchURL", NULL, 0)) { Tcl_DStringAppend(&launch, "::tk::mac::LaunchURL", -1); } Tcl_DStringAppendElement(&launch, cURL); int tclErr = Tcl_EvalEx(_eventInterp, Tcl_DStringValue(&launch), Tcl_DStringLength(&launch), TCL_EVAL_GLOBAL); if (tclErr != TCL_OK) { Tcl_BackgroundException(_eventInterp, tclErr); } } @end #pragma mark - static void RunSimpleTclCommand( Tcl_Interp *interp, const char *command) { int code; if (interp && Tcl_FindCommand(interp, command, NULL, 0)) { Tcl_Preserve(interp); code = Tcl_EvalEx(interp, command, -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); } Tcl_Release(interp); } } /* *---------------------------------------------------------------------- * * TkMacOSXProcessFiles -- * * Extract a list of fileURLs from an AppleEvent and call the specified * procedure with the file paths as arguments. |
︙ | ︙ | |||
283 284 285 286 287 288 289 | Size actual; long count, index; AEKeyword keyword; Tcl_DString command, pathName; int code; /* | | > | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | Size actual; long count, index; AEKeyword keyword; Tcl_DString command, pathName; int code; /* * Do nothing if we don't have an interpreter or the procedure doesn't * exist. */ if (!interp || !Tcl_FindCommand(interp, procedure, NULL, 0)) { return; } fileSpecDesc = [event aeDesc]; |
︙ | ︙ | |||
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | Tcl_FreeEncoding(utf8); AEDisposeDesc(&contents); /* * Handle the event by evaluating the Tcl expression we constructed. */ code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); } Tcl_DStringFree(&command); } /* *---------------------------------------------------------------------- * * TkMacOSXInitAppleEvents -- * | > > | 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | Tcl_FreeEncoding(utf8); AEDisposeDesc(&contents); /* * Handle the event by evaluating the Tcl expression we constructed. */ Tcl_Preserve(interp); code = Tcl_EvalEx(interp, Tcl_DStringValue(&command), Tcl_DStringLength(&command), TCL_EVAL_GLOBAL); if (code != TCL_OK) { Tcl_BackgroundException(interp, code); } Tcl_DStringFree(&command); Tcl_Release(interp); } /* *---------------------------------------------------------------------- * * TkMacOSXInitAppleEvents -- * |
︙ | ︙ | |||
378 379 380 381 382 383 384 | *---------------------------------------------------------------------- */ void TkMacOSXInitAppleEvents( Tcl_Interp *interp) /* not used */ { | | > | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | *---------------------------------------------------------------------- */ void TkMacOSXInitAppleEvents( Tcl_Interp *interp) /* not used */ { NSAppleEventManager *aeManager = [NSAppleEventManager sharedAppleEventManager]; static Boolean initialized = FALSE; if (!initialized) { initialized = TRUE; [aeManager setEventHandler:NSApp andSelector:@selector(handleQuitApplicationEvent:withReplyEvent:) |
︙ | ︙ | |||
405 406 407 408 409 410 411 | forEventClass:kCoreEventClass andEventID:kAEShowPreferences]; [aeManager setEventHandler:NSApp andSelector:@selector(handleOpenDocumentsEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenDocuments]; [aeManager setEventHandler:NSApp | | > > > > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | forEventClass:kCoreEventClass andEventID:kAEShowPreferences]; [aeManager setEventHandler:NSApp andSelector:@selector(handleOpenDocumentsEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEOpenDocuments]; [aeManager setEventHandler:NSApp andSelector:@selector(handlePrintDocumentsEvent:withReplyEvent:) forEventClass:kCoreEventClass andEventID:kAEPrintDocuments]; [aeManager setEventHandler:NSApp andSelector:@selector(handleDoScriptEvent:withReplyEvent:) forEventClass:kAEMiscStandards andEventID:kAEDoScript]; [aeManager setEventHandler:NSApp andSelector:@selector(handleURLEvent:withReplyEvent:) forEventClass:kInternetEventClass andEventID:kAEGetURL]; } } /* *---------------------------------------------------------------------- * * TkMacOSXDoHLEvent -- |
︙ | ︙ | |||
484 485 486 487 488 489 490 491 | static int ReallyKillMe( Tcl_Event *eventPtr, int flags) { Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL; | > > > | > > | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | static int ReallyKillMe( Tcl_Event *eventPtr, int flags) { Tcl_Interp *interp = ((KillEvent *) eventPtr)->interp; Tcl_Preserve(interp); int quit = Tcl_FindCommand(interp, "::tk::mac::Quit", NULL, 0)!=NULL; int code = Tcl_EvalEx(interp, quit ? "::tk::mac::Quit" : "exit", -1, TCL_EVAL_GLOBAL); if (code != TCL_OK) { /* * Should be never reached... */ Tcl_BackgroundException(interp, code); } Tcl_Release(interp); return 1; } /* *---------------------------------------------------------------------- * * MissedAnyParameters -- |
︙ | ︙ | |||
527 528 529 530 531 532 533 | err = AEGetAttributePtr(theEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); return (err != errAEDescNotFound); } | < | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | err = AEGetAttributePtr(theEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); return (err != errAEDescNotFound); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXImage.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | int _XInitImageFuncPtrs( XImage *image) { return 0; } | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | int _XInitImageFuncPtrs( XImage *image) { return 0; } /* *---------------------------------------------------------------------- * * TkMacOSXCreateCGImageWithXImage -- * * Create CGImage from XImage, copying the image data. Called * in Tk_PutImage and (currently) nowhere else. |
︙ | ︙ | |||
77 78 79 80 81 82 83 | while (srcPtr < endPtr) { *destPtr++ = xBitReverseTable[(unsigned char)(*(srcPtr++))]; } } else { data = memcpy(ckalloc(len), image->data + image->xoffset, len); } if (data) { | | > | | > < | < | | > < | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | while (srcPtr < endPtr) { *destPtr++ = xBitReverseTable[(unsigned char)(*(srcPtr++))]; } } else { data = memcpy(ckalloc(len), image->data + image->xoffset, len); } if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); } if (provider) { img = CGImageMaskCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, provider, decode, 0); } } else if ((image->format == ZPixmap) && (image->bits_per_pixel == 32)) { /* * Color image */ CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); if (image->width == 0 && image->height == 0) { /* * CGCreateImage complains on early macOS releases. */ return NULL; } bitsPerComponent = 8; bitsPerPixel = 32; bitmapInfo = (image->byte_order == MSBFirst ? kCGBitmapByteOrder32Little : kCGBitmapByteOrder32Big); bitmapInfo |= kCGImageAlphaLast; data = memcpy(ckalloc(len), image->data + image->xoffset, len); if (data) { provider = CGDataProviderCreateWithData(data, data, len, releaseData); } if (provider) { img = CGImageCreate(image->width, image->height, bitsPerComponent, bitsPerPixel, image->bytes_per_line, colorspace, bitmapInfo, provider, decode, 0, kCGRenderingIntentDefault); CFRelease(provider); } if (colorspace) { CFRelease(colorspace); } } else { TkMacOSXDbgMsg("Unsupported image type"); } return img; } /* *---------------------------------------------------------------------- * * XGetImage -- * * This function copies data from a pixmap or window into an XImage. It * is essentially never used. At one time it was called by |
︙ | ︙ | |||
175 176 177 178 179 180 181 | unsigned int bytes_per_row, size, row, n, m; unsigned int scalefactor=1, scaled_height=height, scaled_width=width; NSWindow *win = TkMacOSXDrawableWindow(drawable); static enum {unknown, no, yes} has_retina = unknown; if (win && has_retina == unknown) { #ifdef __clang__ | | | < | | | | | | | | | | | | | | | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | unsigned int bytes_per_row, size, row, n, m; unsigned int scalefactor=1, scaled_height=height, scaled_width=width; NSWindow *win = TkMacOSXDrawableWindow(drawable); static enum {unknown, no, yes} has_retina = unknown; if (win && has_retina == unknown) { #ifdef __clang__ has_retina = [win respondsToSelector:@selector(backingScaleFactor)] ? yes : no; #else has_retina = no; #endif } if (has_retina == yes) { /* * We only allow scale factors 1 or 2, as Apple currently does. */ #ifdef __clang__ scalefactor = [win backingScaleFactor] == 2.0 ? 2 : 1; #endif scaled_height *= scalefactor; scaled_width *= scalefactor; } if (format == ZPixmap) { if (width == 0 || height == 0) { return NULL; } bitmap_rep = TkMacOSXBitmapRepFromDrawableRect(drawable, x, y, width, height); if (!bitmap_rep) { TkMacOSXDbgMsg("XGetImage: Failed to construct NSBitmapRep"); return NULL; } bitmap_fmt = [bitmap_rep bitmapFormat]; size = [bitmap_rep bytesPerPlane]; bytes_per_row = [bitmap_rep bytesPerRow]; bitmap = ckalloc(size); if (!bitmap || (bitmap_fmt != 0 && bitmap_fmt != 1) || [bitmap_rep samplesPerPixel] != 4 || [bitmap_rep isPlanar] != 0 || bytes_per_row < 4 * scaled_width || size != bytes_per_row * scaled_height) { TkMacOSXDbgMsg("XGetImage: Unrecognized bitmap format"); CFRelease(bitmap_rep); return NULL; } memcpy(bitmap, (char *)[bitmap_rep bitmapData], size); CFRelease(bitmap_rep); /* * When Apple extracts a bitmap from an NSView, it may be in either * BGRA or ABGR format. For an XImage we need RGBA. */ struct pixel_fmt pixel = bitmap_fmt == 0 ? bgra : abgr; for (row = 0, n = 0; row < scaled_height; row++, n += bytes_per_row) { for (m = n; m < n + 4*scaled_width; m += 4) { R = *(bitmap + m + pixel.r); G = *(bitmap + m + pixel.g); B = *(bitmap + m + pixel.b); A = *(bitmap + m + pixel.a); *(bitmap + m) = R; *(bitmap + m + 1) = G; *(bitmap + m + 2) = B; *(bitmap + m + 3) = A; } } imagePtr = XCreateImage(display, NULL, depth, format, offset, (char*) bitmap, scaled_width, scaled_height, bitmap_pad, bytes_per_row); if (scalefactor == 2) { imagePtr->pixelpower = 1; } } else { /* * There are some calls to XGetImage in the generic Tk code which pass * an XYPixmap rather than a ZPixmap. XYPixmaps should be handled * here. */ TkMacOSXDbgMsg("XGetImage does not handle XYPixmaps at the moment."); } return imagePtr; } /* |
︙ | ︙ | |||
319 320 321 322 323 324 325 | if (image && image->data) { unsigned char *srcPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); switch (image->bits_per_pixel) { | | | | | | | | | | | < | | | | | | | | | | | | | | | > | | | | | | | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | if (image && image->data) { unsigned char *srcPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); switch (image->bits_per_pixel) { case 32: r = (*((unsigned int*) srcPtr) >> 16) & 0xff; g = (*((unsigned int*) srcPtr) >> 8) & 0xff; b = (*((unsigned int*) srcPtr) ) & 0xff; /*if (image->byte_order == LSBFirst) { r = srcPtr[2]; g = srcPtr[1]; b = srcPtr[0]; } else { r = srcPtr[1]; g = srcPtr[2]; b = srcPtr[3]; }*/ break; case 16: r = (*((unsigned short*) srcPtr) >> 7) & 0xf8; g = (*((unsigned short*) srcPtr) >> 2) & 0xf8; b = (*((unsigned short*) srcPtr) << 3) & 0xf8; break; case 8: r = (*srcPtr << 2) & 0xc0; g = (*srcPtr << 4) & 0xc0; b = (*srcPtr << 6) & 0xc0; r |= r >> 2 | r >> 4 | r >> 6; g |= g >> 2 | g >> 4 | g >> 6; b |= b >> 2 | b >> 4 | b >> 6; break; case 4: { unsigned char c = (x % 2) ? *srcPtr : (*srcPtr >> 4); r = (c & 0x04) ? 0xff : 0; g = (c & 0x02) ? 0xff : 0; b = (c & 0x01) ? 0xff : 0; break; } case 1: r = g = b = ((*srcPtr) & (0x80 >> (x % 8))) ? 0xff : 0; break; } } return (PIXEL_MAGIC << 24) | (r << 16) | (g << 8) | b; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
385 386 387 388 389 390 391 392 393 394 395 396 397 398 | int y, unsigned long pixel) { if (image && image->data) { unsigned char *dstPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); if (image->bits_per_pixel == 32) { *((unsigned int*) dstPtr) = pixel; } else { unsigned char r = ((pixel & image->red_mask) >> 16) & 0xff; unsigned char g = ((pixel & image->green_mask) >> 8) & 0xff; unsigned char b = ((pixel & image->blue_mask) ) & 0xff; switch (image->bits_per_pixel) { | > | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | int y, unsigned long pixel) { if (image && image->data) { unsigned char *dstPtr = ((unsigned char*) image->data) + (y * image->bytes_per_line) + (((image->xoffset + x) * image->bits_per_pixel) / NBBY); if (image->bits_per_pixel == 32) { *((unsigned int*) dstPtr) = pixel; } else { unsigned char r = ((pixel & image->red_mask) >> 16) & 0xff; unsigned char g = ((pixel & image->green_mask) >> 8) & 0xff; unsigned char b = ((pixel & image->blue_mask) ) & 0xff; switch (image->bits_per_pixel) { |
︙ | ︙ | |||
416 417 418 419 420 421 422 | (*dstPtr & ~(0x80 >> (x % 8))); break; } } } return 0; } | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | (*dstPtr & ~(0x80 >> (x % 8))); break; } } } return 0; } /* *---------------------------------------------------------------------- * * XCreateImage -- * * Allocates storage for a new XImage. * |
︙ | ︙ | |||
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | char* data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage *ximage; display->request++; ximage = ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; ximage->depth = depth; ximage->xoffset = offset; ximage->format = format; ximage->data = data; ximage->obdata = NULL; | > > > | > > | > > | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | char* data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line) { XImage *ximage; display->request++; ximage = ckalloc(sizeof(XImage)); ximage->height = height; ximage->width = width; ximage->depth = depth; ximage->xoffset = offset; ximage->format = format; ximage->data = data; ximage->obdata = NULL; /* * The default pixelpower is 0. This must be explicitly set to 1 in the * case of an XImage extracted from a Retina display. */ ximage->pixelpower = 0; if (format == ZPixmap) { ximage->bits_per_pixel = 32; ximage->bitmap_unit = 32; } else { ximage->bits_per_pixel = 1; ximage->bitmap_unit = 8; } if (bitmap_pad) { ximage->bitmap_pad = bitmap_pad; } else { /* * Use 16 byte alignment for best Quartz perfomance. */ ximage->bitmap_pad = 128; } if (bytes_per_line) { ximage->bytes_per_line = bytes_per_line; } else { ximage->bytes_per_line = ((width * ximage->bits_per_pixel + (ximage->bitmap_pad - 1)) >> 3) & |
︙ | ︙ | |||
507 508 509 510 511 512 513 | } /* *---------------------------------------------------------------------- * * TkPutImage -- * | | | | | 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | } /* *---------------------------------------------------------------------- * * TkPutImage -- * * Copies a rectangular subimage of an XImage into a drawable. Currently * this is only called by TkImgPhotoDisplay, using a Window as the * drawable. * * Results: * None. * * Side effects: * Draws the image on the specified drawable. * |
︙ | ︙ | |||
555 556 557 558 559 560 561 | */ if (!(macDraw->flags & TK_IS_PIXMAP)) { CGContextSetBlendMode(dc.context, kCGBlendModeSourceAtop); } if (img) { | > | > | 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | */ if (!(macDraw->flags & TK_IS_PIXMAP)) { CGContextSetBlendMode(dc.context, kCGBlendModeSourceAtop); } if (img) { /* * If the XImage has big pixels, the source is rescaled to reflect * the actual pixel dimensions. This is not currently used, but * could arise if the image were copied from a retina monitor and * redrawn on an ordinary monitor. */ int pp = image->pixelpower; bounds = CGRectMake(0, 0, image->width, image->height); srcRect = CGRectMake(src_x<<pp, src_y<<pp, width<<pp, height<<pp); dstRect = CGRectMake(dest_x, dest_y, width, height); TkMacOSXDrawCGImage(drawable, gc, dc.context, img, gc->foreground, gc->background, bounds, srcRect, dstRect); CFRelease(img); |
︙ | ︙ |
Changes to macosx/tkMacOSXInit.c.
︙ | ︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | /* * If the App is in an App package, then we want to add the Scripts directory * to the auto_path. */ static char scriptPath[PATH_MAX + 1] = ""; #pragma mark TKApplication(TKInit) @implementation TKApplication @synthesize poolLock = _poolLock; @synthesize macMinorVersion = _macMinorVersion; @synthesize isDrawing = _isDrawing; @end /* * #define this to see a message on stderr whenever _resetAutoreleasePool is * called while the pool is locked. */ #undef DEBUG_LOCK @implementation TKApplication(TKInit) - (void) _resetAutoreleasePool { | > > > > > > > | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | /* * If the App is in an App package, then we want to add the Scripts directory * to the auto_path. */ static char scriptPath[PATH_MAX + 1] = ""; /* * Forward declarations... */ static int TkMacOSXGetAppPathCmd(ClientData cd, Tcl_Interp *ip, int objc, Tcl_Obj *const objv[]); #pragma mark TKApplication(TKInit) @implementation TKApplication @synthesize poolLock = _poolLock; @synthesize macMinorVersion = _macMinorVersion; @synthesize isDrawing = _isDrawing; @end /* * #define this to see a message on stderr whenever _resetAutoreleasePool is * called while the pool is locked. */ #undef DEBUG_LOCK @implementation TKApplication(TKInit) - (void) _resetAutoreleasePool { if ([self poolLock] == 0) { [_mainPool drain]; _mainPool = [NSAutoreleasePool new]; } else { #ifdef DEBUG_LOCK fprintf(stderr, "Pool is locked with count %d!!!!\n", [self poolLock]); #endif } |
︙ | ︙ | |||
98 99 100 101 102 103 104 | /* * Construct the menu bar. */ _defaultMainMenu = nil; [self _setupMenus]; | < > | | < > > > > > > > > > > | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | /* * Construct the menu bar. */ _defaultMainMenu = nil; [self _setupMenus]; /* * Initialize event processing. */ TkMacOSXInitAppleEvents(_eventInterp); /* * Initialize the graphics context. */ TkMacOSXUseAntialiasedText(_eventInterp, -1); TkMacOSXInitCGDrawing(_eventInterp, TRUE, 0); } -(void)applicationDidFinishLaunching:(NSNotification *)notification { /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. */ [NSApp activateIgnoringOtherApps: YES]; /* * Process events to ensure that the root window is fully initialized. See * ticket 56a1823c73. */ [NSApp _lockAutoreleasePool]; while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS| TCL_DONT_WAIT)) {} [NSApp _unlockAutoreleasePool]; } - (void) _setup: (Tcl_Interp *) interp { /* * Remember our interpreter. */ _eventInterp = interp; /* * Install the global autoreleasePool. */ _mainPool = [NSAutoreleasePool new]; [NSApp setPoolLock:0]; /* * Record the OS version we are running on. */ int minorVersion; #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMinor, (SInt32*)&minorVersion); #else NSOperatingSystemVersion systemVersion; systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; minorVersion = systemVersion.minorVersion; #endif [NSApp setMacMinorVersion: minorVersion]; |
︙ | ︙ | |||
297 298 299 300 301 302 303 | if (getenv("XCNOSTDIN") != NULL) { close(0); close(1); } /* | | | > > > > > > > > > > > | | < < > > > > < < < > > > < > | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | if (getenv("XCNOSTDIN") != NULL) { close(0); close(1); } /* * Instantiate our NSApplication object. This needs to be done before * we check whether to open a console window. */ NSAutoreleasePool *pool = [NSAutoreleasePool new]; [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithBool:YES], @"_NSCanWrapButtonTitles", [NSNumber numberWithInt:-1], @"NSStringDrawingTypesetterBehavior", nil]]; [TKApplication sharedApplication]; [pool drain]; [NSApp _setup:interp]; [NSApp finishLaunching]; Tk_MacOSXSetupTkNotifier(); /* * If the root window is mapped before the App has finished launching * it will open off screen (see ticket 56a1823c73). To avoid this we * ask Tk to process an event with no wait. We expect Tcl_DoOneEvent * to wait until the Mac event loop has been created and then return * immediately since the queue is empty. */ Tcl_DoOneEvent(TCL_WINDOW_EVENTS | TCL_DONT_WAIT); /* * If we don't have a TTY and stdin is a special character file of * length 0, (e.g. /dev/null, which is what Finder sets when double * clicking Wish) then use the Tk based console interpreter. */ if (getenv("TK_CONSOLE") || (!isatty(0) && (fstat(0, &st) || (S_ISCHR(st.st_mode) && st.st_blocks == 0)))) { Tk_InitConsoleChannels(interp); Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); /* * Only show the console if we don't have a startup script and * tcl_interactive hasn't been set already. */ if (Tcl_GetStartupScript(NULL) == NULL) { const char *intvar = Tcl_GetVar2(interp, "tcl_interactive", NULL, TCL_GLOBAL_ONLY); if (intvar == NULL) { Tcl_SetVar2(interp, "tcl_interactive", NULL, "1", TCL_GLOBAL_ONLY); } } if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { return TCL_ERROR; } } } if (tkLibPath[0] != '\0') { Tcl_SetVar2(interp, "tk_library", NULL, tkLibPath, TCL_GLOBAL_ONLY); } if (scriptPath[0] != '\0') { Tcl_SetVar2(interp, "auto_path", NULL, scriptPath, TCL_GLOBAL_ONLY|TCL_LIST_ELEMENT|TCL_APPEND_VALUE); } Tcl_CreateObjCommand(interp, "::tk::mac::standardAboutPanel", TkMacOSXStandardAboutPanelObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::registerServiceWidget", TkMacOSXRegisterServiceWidgetObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::iconBitmap", TkMacOSXIconBitmapObjCmd, NULL, NULL); Tcl_CreateObjCommand(interp, "::tk::mac::GetAppPath", TkMacOSXGetAppPathCmd, NULL, NULL); /* * Initialize the NSServices object here. Apple's docs say to do this * in applicationDidFinishLaunching, but the Tcl interpreter is not * initialized until this function call. */ TkMacOSXServices_Init(interp); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } Tcl_DStringAppend(namePtr, name, -1); } /* *---------------------------------------------------------------------- * * TkpDisplayWarning -- * * This routines is called from Tk_Main to display warning messages that | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | p = strrchr(name, '/'); if (p != NULL) { name = p+1; } } Tcl_DStringAppend(namePtr, name, -1); } /* *---------------------------------------------------------------------- * * TkMacOSXGetAppPathCmd -- * * Returns the path of the Wish application bundle. * * Results: * Returns the application path. * * Side effects: * None. * *---------------------------------------------------------------------- */ static int TkMacOSXGetAppPathCmd( ClientData ignored, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } /* * Get the application path URL and convert it to a string path reference. */ CFURLRef mainBundleURL = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFStringRef appPath = CFURLCopyFileSystemPath(mainBundleURL, kCFURLPOSIXPathStyle); /* * Convert (and copy) the string reference into a Tcl result. */ Tcl_SetObjResult(interp, Tcl_NewStringObj( CFStringGetCStringPtr(appPath, CFStringGetSystemEncoding()), -1)); CFRelease(mainBundleURL); CFRelease(appPath); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpDisplayWarning -- * * This routines is called from Tk_Main to display warning messages that |
︙ | ︙ | |||
479 480 481 482 483 484 485 | CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef, CFSTR("AppMain"), CFSTR("tcl"), CFSTR("Scripts")); if (appMainURL != NULL) { CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; | | | 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 | CFURLRef appMainURL = CFBundleCopyResourceURL(bundleRef, CFSTR("AppMain"), CFSTR("tcl"), CFSTR("Scripts")); if (appMainURL != NULL) { CFURLRef scriptFldrURL; char startupScript[PATH_MAX + 1]; if (CFURLGetFileSystemRepresentation(appMainURL, true, (unsigned char *) startupScript, PATH_MAX)) { Tcl_SetStartupScript(Tcl_NewStringObj(startupScript,-1), NULL); scriptFldrURL = CFURLCreateCopyDeletingLastPathComponent(NULL, appMainURL); if (scriptFldrURL != NULL) { CFURLGetFileSystemRepresentation(scriptFldrURL, true, (unsigned char *) scriptPath, PATH_MAX); |
︙ | ︙ |
Changes to macosx/tkMacOSXInt.h.
︙ | ︙ | |||
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | HIShapeRef visRgn; /* Visible region of window */ HIShapeRef aboveVisRgn; /* Visible region of window & its children */ HIShapeRef drawRgn; /* Clipped drawing region */ int referenceCount; /* Don't delete toplevel until children are * gone. */ struct TkWindowPrivate *toplevel; /* Pointer to the toplevel datastruct. */ int flags; /* Various state see defines below. */ }; typedef struct TkWindowPrivate MacDrawable; /* * Defines use for the flags field of the MacDrawable data structure. */ #define TK_SCROLLBAR_GROW 0x01 #define TK_CLIP_INVALID 0x02 #define TK_HOST_EXISTS 0x04 #define TK_DRAWN_UNDER_MENU 0x08 #define TK_IS_PIXMAP 0x10 #define TK_IS_BW_PIXMAP 0x20 #define TK_DO_NOT_DRAW 0x40 /* * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to | > > | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | HIShapeRef visRgn; /* Visible region of window */ HIShapeRef aboveVisRgn; /* Visible region of window & its children */ HIShapeRef drawRgn; /* Clipped drawing region */ int referenceCount; /* Don't delete toplevel until children are * gone. */ struct TkWindowPrivate *toplevel; /* Pointer to the toplevel datastruct. */ CGFloat fillRGBA[4]; /* Background used by the ttk FillElement */ int flags; /* Various state see defines below. */ }; typedef struct TkWindowPrivate MacDrawable; /* * Defines use for the flags field of the MacDrawable data structure. */ #define TK_SCROLLBAR_GROW 0x01 #define TK_CLIP_INVALID 0x02 #define TK_HOST_EXISTS 0x04 #define TK_DRAWN_UNDER_MENU 0x08 #define TK_IS_PIXMAP 0x10 #define TK_IS_BW_PIXMAP 0x20 #define TK_DO_NOT_DRAW 0x40 #define TTK_HAS_CONTRASTING_BG 0x80 /* * I am reserving TK_EMBEDDED = 0x100 in the MacDrawable flags * This is defined in tk.h. We need to duplicate the TK_EMBEDDED flag in the * TkWindow structure for the window, but in the MacWin. This way we can * still tell what the correct port is after the TKWindow structure has been * freed. This actually happens when you bind destroy of a toplevel to |
︙ | ︙ | |||
196 197 198 199 200 201 202 | MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); MODULE_SCOPE void TkpRetainRegion(TkRegion r); MODULE_SCOPE void TkpReleaseRegion(TkRegion r); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkpAppIsDrawing(void); MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin); | | > > > > > > > > > > | 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | MODULE_SCOPE void TkpClipDrawableToRect(Display *display, Drawable d, int x, int y, int width, int height); MODULE_SCOPE void TkpRetainRegion(TkRegion r); MODULE_SCOPE void TkpReleaseRegion(TkRegion r); MODULE_SCOPE void TkpShiftButton(NSButton *button, NSPoint delta); MODULE_SCOPE Bool TkpAppIsDrawing(void); MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin); MODULE_SCOPE Bool TkTestLogDisplay(void); MODULE_SCOPE Bool TkMacOSXInDarkMode(Tk_Window tkwin); /* * Include the stubbed internal platform-specific API. */ #include "tkIntPlatDecls.h" #endif /* _TKMACINT */ /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXKeyEvent.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_KEYBOARD #endif */ #define NS_KEYLOG 0 | < < < | > < < | > | | | | | | | | < | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | /* #ifdef TK_MAC_DEBUG #define TK_MAC_DEBUG_KEYBOARD #endif */ #define NS_KEYLOG 0 static Tk_Window keyboardGrabWinPtr = NULL; /* Current keyboard grab window. */ static NSWindow *keyboardGrabNSWindow = nil; /* NSWindow for the current keyboard grab * window. */ static NSModalSession modalSession = nil; static BOOL processingCompose = NO; static BOOL finishedCompose = NO; static int caret_x = 0, caret_y = 0, caret_height = 0; static void setupXEvent(XEvent *xEvent, NSWindow *w, unsigned int state); static unsigned isFunctionKey(unsigned int code); unsigned short releaseCode; #pragma mark TKApplication(TKKeyEvent) @implementation TKApplication(TKKeyEvent) - (NSEvent *) tkProcessKeyEvent: (NSEvent *) theEvent { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif NSWindow *w; NSEventType type = [theEvent type]; NSUInteger modifiers = ([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask); NSUInteger len = 0; BOOL repeat = NO; unsigned short keyCode = [theEvent keyCode]; NSString *characters = nil, *charactersIgnoringModifiers = nil; static NSUInteger savedModifiers = 0; static NSMutableArray *nsEvArray; if (nsEvArray == nil) { nsEvArray = [[NSMutableArray alloc] initWithCapacity: 1]; processingCompose = NO; } w = [theEvent window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window) winPtr; XEvent xEvent; if (!winPtr) { |
︙ | ︙ | |||
108 109 110 111 112 113 114 | #endif break; default: return theEvent; /* Unrecognized key event. */ } | > | > > | | | | | | | | | | < > | | | | | | | | > | | | < < > | | | | | | | | | | | | | | | | | | | | > | | > > | | | | | | | | | | | | | | | | | | | | | | | < | | | | > | < | | > > > > > > > > | | | | | > | | > | > > | | | > > | > > | | | < | | | | | | | | | | | | | | | > | | > | | | > | | | | | | > > | | > | | | > | | | | | | | | | | | | | | | | > | | < > | | > > | > | | | | | | | | > | > > | | | | > | | | > | | > | > | | > | > > | | > | | | > | | | | < < | > | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | #endif break; default: return theEvent; /* Unrecognized key event. */ } /* * Create an Xevent to add to the Tk queue. */ if (!processingCompose) { unsigned int state = 0; if (modifiers & NSAlphaShiftKeyMask) { state |= LockMask; } if (modifiers & NSShiftKeyMask) { state |= ShiftMask; } if (modifiers & NSControlKeyMask) { state |= ControlMask; } if (modifiers & NSCommandKeyMask) { state |= Mod1Mask; /* command key */ } if (modifiers & NSAlternateKeyMask) { state |= Mod2Mask; /* option key */ } if (modifiers & NSNumericPadKeyMask) { state |= Mod3Mask; } if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } /* * Events are only received for the front Window on the Macintosh. So * to build an XEvent we look up the Tk window associated to the Front * window. If a different window has a local grab we ignore the event. */ TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window) winPtr; if (tkwin) { TkWindow *grabWinPtr = winPtr->dispPtr->grabWinPtr; if (grabWinPtr && grabWinPtr != winPtr && !winPtr->dispPtr->grabFlags /* this means the grab is local. */ && grabWinPtr->mainPtr == winPtr->mainPtr) { return theEvent; } } else { tkwin = (Tk_Window) winPtr->dispPtr->focusPtr; } if (!tkwin) { TkMacOSXDbgMsg("tkwin == NULL"); return theEvent; /* Give up. No window for this event. */ } /* * If it's a function key, or we have modifiers other than Shift or * Alt, pass it straight to Tk. Otherwise we'll send for input * processing. */ int code = (len == 0) ? 0 : [charactersIgnoringModifiers characterAtIndex: 0]; if (type != NSKeyDown || isFunctionKey(code) || (len > 0 && state & (ControlMask | Mod1Mask | Mod3Mask | Mod4Mask))) { XEvent xEvent; setupXEvent(&xEvent, w, state); if (type == NSFlagsChanged) { if (savedModifiers > modifiers) { xEvent.xany.type = KeyRelease; } else { xEvent.xany.type = KeyPress; } /* * Use special '-1' to signify a special keycode to our * platform specific code in tkMacOSXKeyboard.c. This is rather * like what happens on Windows. */ xEvent.xany.send_event = -1; /* * Set keycode (which was zero) to the changed modifier */ xEvent.xkey.keycode = (modifiers ^ savedModifiers); } else { if (type == NSKeyUp || repeat) { xEvent.xany.type = KeyRelease; } else { xEvent.xany.type = KeyPress; } /* * For command key, take input manager's word so things like * dvorak / qwerty layout work. */ if ((modifiers & NSCommandKeyMask) == NSCommandKeyMask && (modifiers & NSAlternateKeyMask) != NSAlternateKeyMask && len > 0 && !isFunctionKey(code)) { // head off keycode-based translation in tkMacOSXKeyboard.c xEvent.xkey.nbytes = [characters length]; //len } if ([characters length] > 0) { xEvent.xkey.keycode = (keyCode << 16) | (UInt16) [characters characterAtIndex:0]; if (![characters getCString:xEvent.xkey.trans_chars maxLength:XMaxTransChars encoding:NSUTF8StringEncoding]) { /* prevent SF bug 2907388 (crash on some composite chars) */ //PENDING: we might not need this anymore TkMacOSXDbgMsg("characters too long"); return theEvent; } } if (repeat) { Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); xEvent.xany.type = KeyPress; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); } } Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); savedModifiers = modifiers; return theEvent; } /* if send straight to TK */ } /* if not processing compose */ if (type == NSKeyDown) { if (NS_KEYLOG) { TKLog(@"keyDown: %s compose sequence.\n", processingCompose == YES ? "Continue" : "Begin"); } processingCompose = YES; [nsEvArray addObject: theEvent]; [[w contentView] interpretKeyEvents: nsEvArray]; [nsEvArray removeObject: theEvent]; } savedModifiers = modifiers; return theEvent; } @end @implementation TKContentView -(id)init { self = [super init]; if (self) { _needsRedisplay = NO; } return self; } /* <NSTextInput> implementation (called through interpretKeyEvents:]). */ /* <NSTextInput>: called when done composing; NOTE: also called when we delete over working text, followed immed. by doCommandBySelector: deleteBackward: */ - (void)insertText: (id)aString { int i, len = [(NSString *) aString length]; XEvent xEvent; if (NS_KEYLOG) { TKLog(@"insertText '%@'\tlen = %d", aString, len); } processingCompose = NO; finishedCompose = YES; /* * First, clear any working text. */ if (privateWorkingText != nil) { [self deleteWorkingText]; } /* * Now insert the string as keystrokes. */ setupXEvent(&xEvent, [self window], 0); xEvent.xany.type = KeyPress; for (i =0; i<len; i++) { xEvent.xkey.keycode = (UInt16) [aString characterAtIndex: i]; [[aString substringWithRange: NSMakeRange(i,1)] getCString: xEvent.xkey.trans_chars maxLength: XMaxTransChars encoding: NSUTF8StringEncoding]; xEvent.xkey.nbytes = strlen(xEvent.xkey.trans_chars); xEvent.xany.type = KeyPress; releaseCode = (UInt16) [aString characterAtIndex: 0]; Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } releaseCode = (UInt16) [aString characterAtIndex: 0]; } /* <NSTextInput>: inserts display of composing characters */ - (void)setMarkedText: (id)aString selectedRange: (NSRange)selRange { NSString *str = [aString respondsToSelector: @selector (string)] ? [aString string] : aString; if (NS_KEYLOG) { TKLog(@"setMarkedText '%@' len =%lu range %lu from %lu", str, (unsigned long) [str length], (unsigned long) selRange.length, (unsigned long) selRange.location); } if (privateWorkingText != nil) { [self deleteWorkingText]; } if ([str length] == 0) { return; } processingCompose = YES; privateWorkingText = [str copy]; //PENDING: insert workingText underlined } - (BOOL)hasMarkedText { return privateWorkingText != nil; } - (NSRange)markedRange { NSRange rng = privateWorkingText != nil ? NSMakeRange(0, [privateWorkingText length]) : NSMakeRange(NSNotFound, 0); if (NS_KEYLOG) { TKLog(@"markedRange request"); } return rng; } - (void)unmarkText { if (NS_KEYLOG) { TKLog(@"unmark (accept) text"); } [self deleteWorkingText]; processingCompose = NO; } /* used to position char selection windows, etc. */ - (NSRect)firstRectForCharacterRange: (NSRange)theRange { NSRect rect; NSPoint pt; pt.x = caret_x; pt.y = caret_y; pt = [self convertPoint: pt toView: nil]; pt = [[self window] tkConvertPointToScreen: pt]; pt.y -= caret_height; rect.origin = pt; rect.size.width = caret_height; rect.size.height = caret_height; return rect; } - (NSInteger)conversationIdentifier { return (NSInteger) self; } - (void)doCommandBySelector: (SEL)aSelector { if (NS_KEYLOG) { TKLog(@"doCommandBySelector: %@", NSStringFromSelector(aSelector)); } processingCompose = NO; if (aSelector == @selector (deleteBackward:)) { /* * Happens when user backspaces over an ongoing composition: * throw a 'delete' into the event queue. */ XEvent xEvent; setupXEvent(&xEvent, [self window], 0); xEvent.xany.type = KeyPress; xEvent.xkey.nbytes = 1; xEvent.xkey.keycode = (0x33 << 16) | 0x7F; xEvent.xkey.trans_chars[0] = 0x7F; xEvent.xkey.trans_chars[1] = 0x0; Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } - (NSArray *)validAttributesForMarkedText { static NSArray *arr = nil; if (arr == nil) { arr = [NSArray new]; } /* [[NSArray arrayWithObject: NSUnderlineStyleAttributeName] retain]; */ return arr; } - (NSRange)selectedRange { if (NS_KEYLOG) { TKLog(@"selectedRange request"); } return NSMakeRange(NSNotFound, 0); } - (NSUInteger)characterIndexForPoint: (NSPoint)thePoint { if (NS_KEYLOG) { TKLog(@"characterIndexForPoint request"); } return 0; } - (NSAttributedString *)attributedSubstringFromRange: (NSRange)theRange { static NSAttributedString *str = nil; if (str == nil) { str = [NSAttributedString new]; } if (NS_KEYLOG) { TKLog(@"attributedSubstringFromRange request"); } return str; } /* End <NSTextInput> impl. */ @synthesize needsRedisplay = _needsRedisplay; @end @implementation TKContentView(TKKeyEvent) /* delete display of composing characters [not in <NSTextInput>] */ - (void)deleteWorkingText { if (privateWorkingText == nil) { return; } if (NS_KEYLOG) { TKLog(@"deleteWorkingText len = %lu\n", (unsigned long)[privateWorkingText length]); } [privateWorkingText release]; privateWorkingText = nil; processingCompose = NO; //PENDING: delete working text } @end /* * Set up basic fields in xevent for keyboard input. */ static void setupXEvent(XEvent *xEvent, NSWindow *w, unsigned int state) { TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window) winPtr; if (!winPtr) { return; } memset(xEvent, 0, sizeof(XEvent)); xEvent->xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); xEvent->xany.send_event = false; |
︙ | ︙ | |||
496 497 498 499 500 501 502 | Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, Time time) { keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window); | > > | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, Time time) { keyboardGrabWinPtr = Tk_IdToWindow(display, grab_window); TkWindow *captureWinPtr = (TkWindow *) TkMacOSXGetCapture(); if (keyboardGrabWinPtr && captureWinPtr) { NSWindow *w = TkMacOSXDrawableWindow(grab_window); MacDrawable *macWin = (MacDrawable *) grab_window; if (w && macWin->toplevel->winPtr == (TkWindow *) captureWinPtr) { if (modalSession) { Tcl_Panic("XGrabKeyboard: already grabbed"); } keyboardGrabNSWindow = w; [w retain]; modalSession = [NSApp beginModalSessionForWindow:w]; } |
︙ | ︙ | |||
547 548 549 550 551 552 553 | } keyboardGrabWinPtr = NULL; } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | } keyboardGrabWinPtr = NULL; } /* *---------------------------------------------------------------------- * * TkMacOSXGetModalSession -- * * Results: * Returns the current modal session * * Side effects: * None. * *---------------------------------------------------------------------- */ MODULE_SCOPE NSModalSession TkMacOSXGetModalSession(void) { return modalSession; } /* *---------------------------------------------------------------------- * * Tk_SetCaretPos -- * * This enables correct placement of the XIM caret. This is called by |
︙ | ︙ | |||
667 668 669 670 671 672 673 | y += Tk_Y(tkwin); tkwin = Tk_Parent(tkwin); if (tkwin == NULL) { return; } } | > | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | > | | | > > | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 | y += Tk_Y(tkwin); tkwin = Tk_Parent(tkwin); if (tkwin == NULL) { return; } } /* * But adjust for fact that NS uses flipped view. */ y = Tk_Height(tkwin) - y; caret_x = x; caret_y = y; caret_height = height; } static unsigned convert_ns_to_X_keysym[] = { NSHomeFunctionKey, 0x50, NSLeftArrowFunctionKey, 0x51, NSUpArrowFunctionKey, 0x52, NSRightArrowFunctionKey, 0x53, NSDownArrowFunctionKey, 0x54, NSPageUpFunctionKey, 0x55, NSPageDownFunctionKey, 0x56, NSEndFunctionKey, 0x57, NSBeginFunctionKey, 0x58, NSSelectFunctionKey, 0x60, NSPrintFunctionKey, 0x61, NSExecuteFunctionKey, 0x62, NSInsertFunctionKey, 0x63, NSUndoFunctionKey, 0x65, NSRedoFunctionKey, 0x66, NSMenuFunctionKey, 0x67, NSFindFunctionKey, 0x68, NSHelpFunctionKey, 0x6A, NSBreakFunctionKey, 0x6B, NSF1FunctionKey, 0xBE, NSF2FunctionKey, 0xBF, NSF3FunctionKey, 0xC0, NSF4FunctionKey, 0xC1, NSF5FunctionKey, 0xC2, NSF6FunctionKey, 0xC3, NSF7FunctionKey, 0xC4, NSF8FunctionKey, 0xC5, NSF9FunctionKey, 0xC6, NSF10FunctionKey, 0xC7, NSF11FunctionKey, 0xC8, NSF12FunctionKey, 0xC9, NSF13FunctionKey, 0xCA, NSF14FunctionKey, 0xCB, NSF15FunctionKey, 0xCC, NSF16FunctionKey, 0xCD, NSF17FunctionKey, 0xCE, NSF18FunctionKey, 0xCF, NSF19FunctionKey, 0xD0, NSF20FunctionKey, 0xD1, NSF21FunctionKey, 0xD2, NSF22FunctionKey, 0xD3, NSF23FunctionKey, 0xD4, NSF24FunctionKey, 0xD5, NSBackspaceCharacter, 0x08, /* 8: Not on some KBs. */ NSDeleteCharacter, 0xFF, /* 127: Big 'delete' key upper right. */ NSDeleteFunctionKey, 0x9F, /* 63272: Del forw key off main array. */ NSTabCharacter, 0x09, 0x19, 0x09, /* left tab->regular since pass shift */ NSCarriageReturnCharacter, 0x0D, NSNewlineCharacter, 0x0D, NSEnterCharacter, 0x8D, 0x1B, 0x1B /* escape */ }; static unsigned isFunctionKey( unsigned code) { const unsigned last_keysym = (sizeof(convert_ns_to_X_keysym) / sizeof(convert_ns_to_X_keysym[0])); unsigned keysym; for (keysym = 0; keysym < last_keysym; keysym += 2) { if (code == convert_ns_to_X_keysym[keysym]) { return 0xFF00 | convert_ns_to_X_keysym[keysym + 1]; } } return 0; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXKeyboard.c.
︙ | ︙ | |||
176 177 178 179 180 181 182 | KeyInfo *kPtr; int dummy; Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) { hPtr = Tcl_CreateHashEntry(&keycodeTable, INT2PTR(kPtr->keycode), &dummy); | | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | KeyInfo *kPtr; int dummy; Tcl_InitHashTable(&keycodeTable, TCL_ONE_WORD_KEYS); for (kPtr = keyArray; kPtr->keycode != 0; kPtr++) { hPtr = Tcl_CreateHashEntry(&keycodeTable, INT2PTR(kPtr->keycode), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(kPtr->keysym)); } Tcl_InitHashTable(&vkeyTable, TCL_ONE_WORD_KEYS); for (kPtr = virtualkeyArray; kPtr->keycode != 0; kPtr++) { hPtr = Tcl_CreateHashEntry(&vkeyTable, INT2PTR(kPtr->keycode), &dummy); Tcl_SetHashValue(hPtr, INT2PTR(kPtr->keysym)); } initialized = 1; } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
Changes to macosx/tkMacOSXMenu.c.
︙ | ︙ | |||
189 190 191 192 193 194 195 | [super insertItem:newItem atIndex:index + _tkOffset]; _tkItemCount++; } - (void) insertItem: (NSMenuItem *) newItem atIndex: (NSInteger) index { if (_tkMenu && index >= 0) { | | | | | | | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | [super insertItem:newItem atIndex:index + _tkOffset]; _tkItemCount++; } - (void) insertItem: (NSMenuItem *) newItem atIndex: (NSInteger) index { if (_tkMenu && index >= 0) { if ((NSUInteger) index <= _tkOffset) { _tkOffset++; } else { NSAssert((NSUInteger) index >= _tkItemCount + _tkOffset, @"Cannot insert in the middle of Tk menu"); } } [super insertItem:newItem atIndex:index]; } - (void) removeItemAtIndex: (NSInteger) index { if (_tkMenu && index >= 0) { if ((NSUInteger) index < _tkOffset) { _tkOffset--; } else if ((NSUInteger) index < _tkItemCount + _tkOffset) { _tkItemCount--; } } [super removeItemAtIndex:index]; } - (NSMenuItem *) newTkMenuItem: (TkMenuEntry *) mePtr { NSMenuItem *menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:@selector(tkMenuItemInvoke:) keyEquivalent:@""]; [menuItem setTarget:self]; [menuItem setTag:(NSInteger) mePtr]; return menuItem; } @end @implementation TKMenu(TKMenuActions) - (BOOL) validateMenuItem: (NSMenuItem *) menuItem |
︙ | ︙ | |||
248 249 250 251 252 253 254 | * With the delegate matching key equivalents, when a menu action is sent * in response to a key equivalent, the sender is the whole menu and not the * specific menu item. We use this to ignore key equivalents for Tk * menus (as Tk handles them directly via bindings). */ if ([sender isKindOfClass:[NSMenuItem class]]) { | | | | > | | | 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | * With the delegate matching key equivalents, when a menu action is sent * in response to a key equivalent, the sender is the whole menu and not the * specific menu item. We use this to ignore key equivalents for Tk * menus (as Tk handles them directly via bindings). */ if ([sender isKindOfClass:[NSMenuItem class]]) { NSMenuItem *menuItem = (NSMenuItem *) sender; TkMenu *menuPtr = (TkMenu *) _tkMenu; TkMenuEntry *mePtr = (TkMenuEntry *) [menuItem tag]; if (menuPtr && mePtr) { Tcl_Interp *interp = menuPtr->interp; /* * Add time for errors to fire if necessary. This is sub-optimal * but avoids issues with Tcl/Cocoa event loop integration. */ //Tcl_Sleep(100); Tcl_Preserve(interp); Tcl_Preserve(menuPtr); int result = TkInvokeMenu(interp, menuPtr, mePtr->index); |
︙ | ︙ | |||
301 302 303 304 305 306 307 | * Command-Shift-? has not been allowed as a keyboard equivalent since * the first aqua port, for some mysterious reason. */ return NO; } else if (modifiers == (NSControlKeyMask | NSShiftKeyMask) && [event keyCode] == 48) { | | | < | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | * Command-Shift-? has not been allowed as a keyboard equivalent since * the first aqua port, for some mysterious reason. */ return NO; } else if (modifiers == (NSControlKeyMask | NSShiftKeyMask) && [event keyCode] == 48) { /* * Starting with OSX 10.12 Control-Tab and Control-Shift-Tab are used * to select window tabs. But for some even more mysterious reason the * Control-Shift-Tab event has character 0x19 = NSBackTabCharacter * rather than 0x09 = NSTabCharacter. At the same time, the * keyEquivalent must be \0x09 in order for it to be displayed * correctly in the menu. This makes it impossible for the standard * "Select Previous Tab" to work correctly, unless we intervene. */ key = @"\t"; } else if (([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask) { /* * If the command modifier is set, use the full character string so * things like the dvorak / qwerty layout will work. */ key = [event characters]; } |
︙ | ︙ | |||
646 647 648 649 650 651 652 | attributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( mePtr->menuPtr->tkwin, fontPtr)); if (gc->foreground != defaultFg || gc->background != defaultBg) { NSColor *color = TkMacOSXGetNSColor(gc, gc->foreground!=defaultFg? gc->foreground:gc->background); attributes = [[attributes mutableCopy] autorelease]; | | | 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | attributes = TkMacOSXNSFontAttributesForFont(Tk_GetFontFromObj( mePtr->menuPtr->tkwin, fontPtr)); if (gc->foreground != defaultFg || gc->background != defaultBg) { NSColor *color = TkMacOSXGetNSColor(gc, gc->foreground!=defaultFg? gc->foreground:gc->background); attributes = [[attributes mutableCopy] autorelease]; [(NSMutableDictionary *) attributes setObject:color forKey:NSForegroundColorAttributeName]; } if (attributes) { attributedTitle = [[[NSAttributedString alloc] initWithString:title attributes:attributes] autorelease]; } } |
︙ | ︙ | |||
686 687 688 689 690 691 692 | */ submenu = nil; } else { [submenu setTitle:title]; if ([menuItem isEnabled]) { | > > | | | > > | | > | | > > | | > > | > > | | | < | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | */ submenu = nil; } else { [submenu setTitle:title]; if ([menuItem isEnabled]) { /* * This menuItem might have been previously disabled (XXX: * track this), which would have disabled entries; we must * re-enable the entries here. */ int i = 0; NSArray *itemArray = [submenu itemArray]; for (NSMenuItem *item in itemArray) { TkMenuEntry *submePtr = menuRefPtr->menuPtr->entries[i]; /* * Work around an apparent bug where itemArray can have * more items than the menu's entries[] array. */ if (i >= (int) menuRefPtr->menuPtr->numEntries) { break; } [item setEnabled: !(submePtr->state == ENTRY_DISABLED)]; i++; } } } } } [menuItem setSubmenu:submenu]; return TCL_OK; } |
︙ | ︙ | |||
751 752 753 754 755 756 757 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * | | > > > | | | | | | < < | | < > > > > > | < > > | < > | < | | < > > > > | < < > | | | < > | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * * Posts a menu on the screen. If entry is < 0 then the menu is drawn so * its top left corner is located at the point with screen coordinates * (x,y). Otherwise the top left corner of the specified entry is located * at that point. * * Results: * Returns a standard Tcl result. * * Side effects: * The menu is posted and handled. * *---------------------------------------------------------------------- */ int TkpPostMenu( Tcl_Interp *interp, /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ int index) { int result; Tk_Window root = Tk_MainWindow(interp); if (root == NULL) { return TCL_ERROR; } Drawable d = Tk_WindowId(root); NSView *rootview = TkMacOSXGetRootControl(d); NSWindow *win = [rootview window]; NSView *view = [win contentView]; NSMenu *menu = (NSMenu *) menuPtr->platformData; NSInteger itemIndex = index; NSInteger numItems = [menu numberOfItems]; NSMenuItem *item = nil; NSPoint location = NSMakePoint(x, tkMacOSXZeroScreenHeight - y); inPostMenu = 1; result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { inPostMenu = 0; return result; } if (itemIndex >= numItems) { itemIndex = numItems - 1; } if (itemIndex >= 0) { item = [menu itemAtIndex:itemIndex]; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } [menu popUpMenuPositioningItem:item atLocation:[win tkConvertPointFromScreen:location] inView:view]; inPostMenu = 0; return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpPostTearoffMenu -- * * Tearoff menus are not supported on the Mac. This placeholder function, * which is simply a copy of the unix function, posts a completely useless * window with a black background on the screen. If entry is < 0 then the * window is positioned so that its top left corner is located at the * point with screen coordinates (x, y). Otherwise the window position is * offset so that top left corner of the specified entry would be located * at that point, if there actually were a menu. * * Mac menus steal all mouse or keyboard input from the application until * the menu is dismissed, with or without a selection, by a mouse or key * event. Posting a Mac menu in a regression test will cause the test to * halt waiting for user input. This is why the TkpPostMenu function is * not being used as the placeholder. * * Results: * None. * * Side effects: * A useless window is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( Tcl_Interp *interp, /* The interpreter this menu lives in */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The screen coordinates where the top left * corner of the menu, or of the specified * entry, will be located. */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; if (index >= (int) menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu * uses override-redirect mode it will be in the *real* root window for * the screen, so we have to map the coordinates from the virtual root * (if any) to the real root. Can't get the virtual root from the menu * itself (it will never be seen by the wm) so use its parent instead * (it would be better to have an an option that names a window to use * for this...). * 2. The menu may not have been mapped yet, so its current size might be * the default 1x1. To compute how much space it needs, use its * requested size, not its actual size. */ Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY, &vRootWidth, &vRootHeight); vRootWidth -= Tk_ReqWidth(menuPtr->tkwin); if (x > vRootX + vRootWidth) { x = vRootX + vRootWidth; } if (x < vRootX) { x = vRootX; } vRootHeight -= Tk_ReqHeight(menuPtr->tkwin); if (y > vRootY + vRootHeight) { y = vRootY + vRootHeight; } if (y < vRootY) { y = vRootY; } Tk_MoveToplevelWindow(menuPtr->tkwin, x, y); if (!Tk_IsMapped(menuPtr->tkwin)) { Tk_MapWindow(menuPtr->tkwin); } TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpSetWindowMenuBar -- * * Associates a given menu with a window. |
︙ | ︙ | |||
848 849 850 851 852 853 854 | } /* *---------------------------------------------------------------------- * * TkpSetMainMenubar -- * | | | | | > > > > > > > > > > | | | | < | > > > > > > > > > > > > > > | | | 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 | } /* *---------------------------------------------------------------------- * * TkpSetMainMenubar -- * * Puts the menu associated with a window into the menubar. Should only be * called when the window is in front. * * This is a no-op on all other platforms. On OS X it is a no-op when * passed a NULL menuName or a nonexistent menuName, with an exception for * the first call in a new interpreter. In that special case, passing a * NULL menuName installs the default menu. * * Results: * None. * * Side effects: * The menubar may be changed. * *---------------------------------------------------------------------- */ void TkpSetMainMenubar( Tcl_Interp *interp, /* The interpreter of the application */ Tk_Window tkwin, /* The frame we are setting up */ const char *menuName) /* The name of the menu to put in front. */ { static Tcl_Interp *currentInterp = NULL; TKMenu *menu = nil; TkWindow *winPtr = (TkWindow *) tkwin; /* * We will be called when an embedded window receives an ActivationNotify * event, but we should not change the menubar in that case. */ if (Tk_IsEmbedded(winPtr)) { return; } if (menuName) { Tk_Window menubar = NULL; if (winPtr->wmInfoPtr && winPtr->wmInfoPtr->menuPtr && winPtr->wmInfoPtr->menuPtr->masterMenuPtr) { menubar = winPtr->wmInfoPtr->menuPtr->masterMenuPtr->tkwin; } /* * Attempt to find the NSMenu directly. If that fails, ask Tk to find * it. */ if (menubar != NULL && strcmp(menuName, Tk_PathName(menubar)) == 0) { menu = (TKMenu *) winPtr->wmInfoPtr->menuPtr->platformData; } else { TkMenuReferences *menuRefPtr = TkFindMenuReferences(interp, menuName); if (menuRefPtr && menuRefPtr->menuPtr && menuRefPtr->menuPtr->platformData) { menu = (TKMenu *) menuRefPtr->menuPtr->platformData; } } } /* * If we couldn't find a menu, do nothing unless the window belongs to a * different application. In that case, install the default menubar. */ if (menu || interp != currentInterp) { [NSApp tkSetMainMenu:menu]; } currentInterp = interp; } /* *---------------------------------------------------------------------- * * CheckForSpecialMenu -- * * Given a menu, check to see whether or not it is a cascade in a menubar * with one of the special names ".apple", ".help" or ".window". If it is, * the entry that points to this menu will be marked. * * Results: * None. * * Side effects: * Will set entryFlags appropriately. * |
︙ | ︙ | |||
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 | *-------------------------------------------------------------- */ void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int modifierCharWidth, menuModifierCharWidth; int x, y, modifierWidth, labelWidth, indicatorSpace; int windowWidth, windowHeight, accelWidth; | > | | > > > > | > | | | | | | > > > < < < < < < < < < < < < < < < < < < | > > | < < | < > > > < | 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 | *-------------------------------------------------------------- */ void TkpComputeStandardMenuGeometry( TkMenu *menuPtr) /* Structure describing menu. */ { NSSize menuSize; Tk_Font tkfont, menuFont; Tk_FontMetrics menuMetrics, entryMetrics, *fmPtr; int modifierCharWidth, menuModifierCharWidth; int x, y, modifierWidth, labelWidth, indicatorSpace; int windowWidth, windowHeight, accelWidth; int i, maxWidth; int entryWidth, maxIndicatorSpace, borderWidth, activeBorderWidth; TkMenuEntry *mePtr; int haveAccel = 0; /* * Do nothing if this menu is a clone. */ if (menuPtr->tkwin == NULL || menuPtr->masterMenuPtr != menuPtr) { return; } menuSize = [(NSMenu *) menuPtr->platformData size]; Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->borderWidthPtr, &borderWidth); Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); x = y = borderWidth; windowHeight = maxWidth = 0; maxIndicatorSpace = 0; /* * On the Mac especially, getting font metrics can be quite slow, so we * want to do it intelligently. We are going to precalculate them and pass * them down to all of the measuring and drawing routines. We will measure * the font metrics of the menu once. If an entry does not have its own * font set, then we give the geometry/drawing routines the menu's font and * metrics. If an entry has its own font, we will measure that font and * give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); menuModifierCharWidth = ModifierCharWidth(menuFont); for (i = 0; i < (int) menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->type == CASCADE_ENTRY || mePtr->accelLength > 0) { haveAccel = 1; break; } } for (i = 0; i < (int) menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->type == TEAROFF_ENTRY) { continue; } if (mePtr->fontPtr == NULL) { tkfont = menuFont; fmPtr = &menuMetrics; modifierCharWidth = menuModifierCharWidth; } else { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); fmPtr = &entryMetrics; modifierCharWidth = ModifierCharWidth(tkfont); } accelWidth = modifierWidth = indicatorSpace = 0; if (mePtr->type == SEPARATOR_ENTRY) { mePtr->height = menuSeparatorHeight; } else { /* * For each entry, compute the height required by that particular * entry, plus three widths: the width of the label, the width to * allow for an indicator to be displayed to the left of the label * (if any), and the width of the accelerator to be displayed to * the right of the label (if any). These sizes depend, of course, * on the type of the entry. */ NSMenuItem *menuItem = (NSMenuItem *) mePtr->platformEntryData; int haveImage = 0, width = 0, height = 0; if (mePtr->image) { Tk_SizeOfImage(mePtr->image, &width, &height); haveImage = 1; height += 2; /* tweak */ } else if (mePtr->bitmapPtr) { Pixmap bitmap = Tk_GetBitmapFromObj(menuPtr->tkwin, mePtr->bitmapPtr); Tk_SizeOfBitmap(menuPtr->display, bitmap, &width, &height); haveImage = 1; height += 2; /* tweak */ } if (!haveImage || (mePtr->compound != COMPOUND_NONE)) { NSAttributedString *attrTitle = [menuItem attributedTitle]; NSSize size; if (attrTitle) { size = [attrTitle size]; } else { size = [[menuItem title] sizeWithAttributes: TkMacOSXNSFontAttributesForFont(tkfont)]; } size.width += menuTextLeadingEdgeMargin + menuTextTrailingEdgeMargin; size.height -= 1; /* tweak */ if (haveImage && (mePtr->compound != COMPOUND_NONE)) { int margin = width + menuIconTrailingEdgeMargin; if (margin > menuTextLeadingEdgeMargin) { margin = menuTextLeadingEdgeMargin; } width += size.width + menuIconTrailingEdgeMargin - margin; if (size.height > height) { height = size.height; } } else { width = size.width; height = size.height; } } else { /* image only. */ } labelWidth = width + menuItemExtraWidth; mePtr->height = height + menuItemExtraHeight; if (mePtr->type == CASCADE_ENTRY) { modifierWidth = modifierCharWidth; } else if (mePtr->accelLength == 0) { if (haveAccel && !mePtr->hideMargin) { modifierWidth = modifierCharWidth; } } else { |
︙ | ︙ | |||
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 | if (indicatorSpace > maxIndicatorSpace) { maxIndicatorSpace = indicatorSpace; } entryWidth = labelWidth + modifierWidth + accelWidth; if (entryWidth > maxWidth) { maxWidth = entryWidth; } mePtr->height += 2 * activeBorderWidth; } mePtr->y = y; y += menuPtr->entries[i]->height + borderWidth; | > > < < | < < < < < < < < < < | < < < > | 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 | if (indicatorSpace > maxIndicatorSpace) { maxIndicatorSpace = indicatorSpace; } entryWidth = labelWidth + modifierWidth + accelWidth; if (entryWidth > maxWidth) { maxWidth = entryWidth; } menuPtr->entries[i]->width = entryWidth; mePtr->height += 2 * activeBorderWidth; } mePtr->x = x; mePtr->y = y; y += menuPtr->entries[i]->height + borderWidth; } windowWidth = menuSize.width; if (windowWidth <= 0) { windowWidth = 1; } windowHeight = menuSize.height; if (windowHeight <= 0) { windowHeight = 1; } menuPtr->totalWidth = windowWidth; menuPtr->totalHeight = windowHeight; } |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | NSMenuItem *menuItem) { TkMenu *menuPtr = [menu tkMenu]; if (menuPtr) { int index = [menu tkIndexOfItem:menuItem]; | | | 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | NSMenuItem *menuItem) { TkMenu *menuPtr = [menu tkMenu]; if (menuPtr) { int index = [menu tkIndexOfItem:menuItem]; if (index < 0 || index >= (int) menuPtr->numEntries || (menuPtr->entries[index])->state == ENTRY_DISABLED) { TkActivateMenuEntry(menuPtr, -1); } else { TkActivateMenuEntry(menuPtr, index); MenuSelectEvent(menuPtr); return true; } |
︙ | ︙ | |||
1382 1383 1384 1385 1386 1387 1388 | void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { int i; TkActivateMenuEntry(menuPtr, -1); | | | 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 | void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { int i; TkActivateMenuEntry(menuPtr, -1); for (i = 0; i < (int) menuPtr->numEntries; i++) { TkMenuEntry *mePtr = menuPtr->entries[i]; if (mePtr->type == CASCADE_ENTRY && (mePtr->childMenuRefPtr != NULL) && (mePtr->childMenuRefPtr->menuPtr != NULL)) { RecursivelyClearActiveMenu(mePtr->childMenuRefPtr->menuPtr); } |
︙ | ︙ | |||
1671 1672 1673 1674 1675 1676 1677 | /* *---------------------------------------------------------------------- * * TkMacOSXUseID -- * * Take the ID out of the available list for new menus. Used by the | | | 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 | /* *---------------------------------------------------------------------- * * TkMacOSXUseID -- * * Take the ID out of the available list for new menus. Used by the * default menu bar's menus so that they do not get created at the Tk * level. See TkMacOSXGetNewMenuID for more information. * * Results: * Returns TCL_OK if the id was not in use. Returns TCL_ERROR if the id * was in use. * * Side effects: |
︙ | ︙ | |||
1696 1697 1698 1699 1700 1701 1702 | } /* *---------------------------------------------------------------------- * * TkMacOSXDispatchMenuEvent -- * | | < | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 | } /* *---------------------------------------------------------------------- * * TkMacOSXDispatchMenuEvent -- * * Given a menu id and an item, dispatches the command associated with it. * * Results: * None. * * Side effects: * Commands for the event are scheduled for execution at idle time. * |
︙ | ︙ | |||
1747 1748 1749 1750 1751 1752 1753 | } /* *---------------------------------------------------------------------- * * TkMacOSXSetHelpMenuItemCount -- * | | | > | | 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 | } /* *---------------------------------------------------------------------- * * TkMacOSXSetHelpMenuItemCount -- * * Has to be called after the first call to InsertMenu. Sets up the global * variable for the number of items in the unmodified help menu. * * NB: Nobody uses this any more, since you can get the number of system * help items from HMGetHelpMenu trivially. But it is in the stubs * table... * * Results: * None. * * Side effects: |
︙ | ︙ |
Changes to macosx/tkMacOSXMenubutton.c.
1 2 3 | /* * tkMacOSXMenubutton.c -- * | | | | 1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkMacOSXMenubutton.c -- * * This file implements the Macintosh specific portion of the menubutton * widget. * * Copyright (c) 1996 by Sun Microsystems, Inc. * Copyright 2001, Apple Computer, Inc. * Copyright (c) 2006-2007 Daniel A. Steffen <[email protected]> * Copyright 2007 Revar Desmera. * Copyright 2015 Kevin Walzer/WordTech Communications LLC. * |
︙ | ︙ | |||
28 29 30 31 32 33 34 | typedef struct { Tk_3DBorder border; int relief; GC gc; int hasImageOrBitmap; } DrawParams; | < | | > > | > > | > > | | > > | | > | | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < < | < | | | | | | > | > > > | > > | | < | | | > | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | typedef struct { Tk_3DBorder border; int relief; GC gc; int hasImageOrBitmap; } DrawParams; /* * Declaration of Mac specific button structure. */ typedef struct MacMenuButton { TkMenuButton info; /* Generic button info. */ int flags; ThemeButtonKind btnkind; HIThemeButtonDrawInfo drawinfo; HIThemeButtonDrawInfo lastdrawinfo; DrawParams drawParams; } MacMenuButton; /* * Forward declarations for static functions defined later in this file: */ static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr); static void MenuButtonBackgroundDrawCB(MacMenuButton *ptr, SInt16 depth, Boolean isColorDev); static void MenuButtonContentDrawCB(ThemeButtonKind kind, const HIThemeButtonDrawInfo *info, MacMenuButton *ptr, SInt16 depth, Boolean isColorDev); static void MenuButtonEventProc(ClientData clientData, XEvent *eventPtr); static void TkMacOSXComputeMenuButtonParams(TkMenuButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo); static void TkMacOSXComputeMenuButtonDrawParams( TkMenuButton *butPtr, DrawParams *dpPtr); static void TkMacOSXDrawMenuButton(MacMenuButton *butPtr, GC gc, Pixmap pixmap); static void DrawMenuButtonImageAndText(TkMenuButton *butPtr); /* * The structure below defines menubutton class behavior by means of * procedures that can be invoked from generic window code. */ Tk_ClassProcs tkpMenubuttonClass = { sizeof(Tk_ClassProcs), /* size */ TkMenuButtonWorldChanged, /* worldChangedProc */ }; /* * We use Apple's Pop-Up Button widget to represent the Tk Menubutton. * However, we do not use the NSPopUpButton class for this control. Instead we * render the Pop-Up Button using the HITheme library. This imposes some * constraints on what can be done. The HITheme renderer allows only specific * dimensions for the button. * * The HITheme library allows drawing a Pop-Up Button with an arbitrary bounds * rectangle. However the button is always drawn as a rounded box which is 22 * pixels high. If the bounds rectangle is less than 22 pixels high, the * button is drawn at the top of the rectangle and the bottom of the button is * clipped away. So we set a minimum height of 22 pixels for a Menubutton. If * the bounds rectangle is more than 22 pixels high, then the button is drawn * centered vertically in the bounds rectangle. * * The content rectangle of the button is inset by 14 pixels on the left and 28 * pixels on the right. The rightmost part of the button contains the blue * double-arrow symbol which is 28 pixels wide. * * To maintain compatibility with code that runs on multiple operating systems, * the width and height of the content rectangle includes the borderWidth, the * highlightWidth and the padX and padY dimensions of the Menubutton. However, * to be consistent with the standard Apple appearance, the content is always * be drawn at the left side of the content rectangle. All of the excess space * appears on the right side of the content, and the anchor property is * ignored. The easiest way to comply with Apple's Human Interface Guidelines * would be to set bd = highlightthickness = padx = 0 and to specify an * explicit width for the button. Apple also recommends using the same width * for all Pop-Up Buttons in a given window. */ #define LEFT_INSET 8 #define RIGHT_INSET 28 #define MIN_HEIGHT 22 /* *---------------------------------------------------------------------- * * TkpCreateMenuButton -- * * Allocate a new TkMenuButton structure. * * Results: * Returns a newly allocated TkMenuButton structure. * * Side effects: * Registers an event handler for the widget. * *---------------------------------------------------------------------- */ TkMenuButton * TkpCreateMenuButton( Tk_Window tkwin) { MacMenuButton *mbPtr = (MacMenuButton *) ckalloc(sizeof(MacMenuButton)); Tk_CreateEventHandler(tkwin, ActivateMask, MenuButtonEventProc, mbPtr); mbPtr->flags = FIRST_DRAW; mbPtr->btnkind = kThemePopupButton; bzero(&mbPtr->drawinfo, sizeof(mbPtr->drawinfo)); bzero(&mbPtr->lastdrawinfo, sizeof(mbPtr->lastdrawinfo)); return (TkMenuButton *) mbPtr; } /* *---------------------------------------------------------------------- * * TkpDisplayMenuButton -- * * This procedure is invoked to display a menubutton widget. * * Results: * None. * * Side effects: * Commands are output to X to display the menubutton in its current mode. * *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { MacMenuButton *mbPtr = clientData; TkMenuButton *butPtr = clientData; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; DrawParams *dpPtr = &mbPtr->drawParams; butPtr->flags &= ~REDRAW_PENDING; if ((butPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } pixmap = (Pixmap) Tk_WindowId(tkwin); TkMacOSXComputeMenuButtonDrawParams(butPtr, dpPtr); /* * Set up clipping region. Make sure the we are using the port for this * button, or we will set the wrong window's clip. */ TkMacOSXSetUpClippingRgn(pixmap); /* * Draw the native portion of the buttons. */ TkMacOSXDrawMenuButton(mbPtr, dpPtr->gc, pixmap); /* * Draw highlight border, if needed. */ if (butPtr->highlightWidth < 3) { if (butPtr->flags & GOT_FOCUS) { GC gc = Tk_GCForColor(butPtr->highlightColorPtr, pixmap); TkMacOSXDrawSolidBorder(tkwin, gc, 0, butPtr->highlightWidth); } } } /* *---------------------------------------------------------------------- * * TkpDestroyMenuButton -- * * Free data structures associated with the menubutton control. This is a * no-op on the Mac. * * Results: * None. * * Side effects: * None. * *---------------------------------------------------------------------- */ void TkpDestroyMenuButton( TkMenuButton *mbPtr) |
︙ | ︙ | |||
200 201 202 203 204 205 206 | */ void TkpComputeMenuButtonGeometry(butPtr) register TkMenuButton *butPtr; /* Widget record for menu button. */ { int width, height, avgWidth, haveImage = 0, haveText = 0; | < < < < > | < < | > < < | | | | | | | | | | | | | < | | | | | | | | < | | | | | | | < | > | | | | < < < < < < < < < < < < | < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | < < < < | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | */ void TkpComputeMenuButtonGeometry(butPtr) register TkMenuButton *butPtr; /* Widget record for menu button. */ { int width, height, avgWidth, haveImage = 0, haveText = 0; int txtWidth, txtHeight; Tk_FontMetrics fm; int highlightWidth = butPtr->highlightWidth > 0 ? butPtr->highlightWidth : 0; /* * First compute the size of the contents of the button. */ width = 0; height = 0; txtWidth = 0; txtHeight = 0; avgWidth = 0; if (butPtr->image != NULL) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } if (butPtr->text && strlen(butPtr->text) > 0) { haveText = 1; Tk_FreeTextLayout(butPtr->textLayout); butPtr->textLayout = Tk_ComputeTextLayout(butPtr->tkfont, butPtr->text, -1, butPtr->wrapLength, butPtr->justify, 0, &butPtr->textWidth, &butPtr->textHeight); txtWidth = butPtr->textWidth; txtHeight = butPtr->textHeight; avgWidth = Tk_TextWidth(butPtr->tkfont, "0", 1); Tk_GetFontMetrics(butPtr->tkfont, &fm); } /* * If the button is compound (ie, it shows both an image and text), the new * geometry is a combination of the image and text geometry. We only honor * the compound bit if the button has both text and an image, because * otherwise it is not really a compound button. */ if (haveImage && haveText) { switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* * Image is above or below text */ height += txtHeight + butPtr->padY; width = (width > txtWidth ? width : txtWidth); break; case COMPOUND_LEFT: case COMPOUND_RIGHT: /* * Image is left or right of text */ width += txtWidth + butPtr->padX; height = (height > txtHeight ? height : txtHeight); break; case COMPOUND_CENTER: /* * Image and text are superimposed */ width = (width > txtWidth ? width : txtWidth); height = (height > txtHeight ? height : txtHeight); break; case COMPOUND_NONE: break; } if (butPtr->width > 0) { width = butPtr->width; } if (butPtr->height > 0) { height = butPtr->height; } } else { if (haveImage) { /* Image only */ if (butPtr->width > 0) { width = butPtr->width; } if (butPtr->height > 0) { height = butPtr->height; } } else { /* Text only */ width = txtWidth; height = txtHeight; if (butPtr->width > 0) { width = butPtr->width * avgWidth + 2*butPtr->padX; } if (butPtr->height > 0) { height = butPtr->height * fm.linespace + 2*butPtr->padY; } } } butPtr->inset = highlightWidth + butPtr->borderWidth; width += LEFT_INSET + RIGHT_INSET + 2*butPtr->inset; height += 2*butPtr->inset; height = height < MIN_HEIGHT ? MIN_HEIGHT : height; Tk_GeometryRequest(butPtr->tkwin, width, height); Tk_SetInternalBorder(butPtr->tkwin, butPtr->inset); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
380 381 382 383 384 385 386 | * Side effects: * The image and text are drawn. * *---------------------------------------------------------------------- */ void DrawMenuButtonImageAndText( | | | | | | < | < | < | < | < | < < | | < | < < < < < | | | | | | > | > > | | | | | | | | | | | < | | | | | | | | | | | | | | | | < | | | | | < | | | | | | | < | > | < | | | | < > > < < | | < | | | | | | | < < < | | | | | < < | | | > | | | | | < | | | | < < | | < < | < < | > > > > > > | > > | > > > | | < < | | | | > | | > | < | | | | > | | < | | | | | | 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 | * Side effects: * The image and text are drawn. * *---------------------------------------------------------------------- */ void DrawMenuButtonImageAndText( TkMenuButton *butPtr) { MacMenuButton *mbPtr = (MacMenuButton *) butPtr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; int haveImage = 0, haveText = 0; int imageWidth = 0, imageHeight = 0; int imageXOffset = 0, imageYOffset = 0; int textXOffset = 0, textYOffset = 0; int width = 0, height = 0; int fullWidth = 0, fullHeight = 0; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } DrawParams *dpPtr = &mbPtr->drawParams; pixmap = (Pixmap) Tk_WindowId(tkwin); if (butPtr->image != None) { Tk_SizeOfImage(butPtr->image, &width, &height); haveImage = 1; } else if (butPtr->bitmap != None) { Tk_SizeOfBitmap(butPtr->display, butPtr->bitmap, &width, &height); haveImage = 1; } imageWidth = width; imageHeight = height; haveText = (butPtr->textWidth != 0 && butPtr->textHeight != 0); if (butPtr->compound != COMPOUND_NONE && haveImage && haveText) { int x = 0, y = 0; textXOffset = 0; textYOffset = 0; fullWidth = 0; fullHeight = 0; switch ((enum compound) butPtr->compound) { case COMPOUND_TOP: case COMPOUND_BOTTOM: /* * Image is above or below text. */ if (butPtr->compound == COMPOUND_TOP) { textYOffset = height + butPtr->padY; } else { imageYOffset = butPtr->textHeight + butPtr->padY; } fullHeight = height + butPtr->textHeight + butPtr->padY; fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth); textXOffset = (fullWidth - butPtr->textWidth)/2; imageXOffset = (fullWidth - width)/2; break; case COMPOUND_LEFT: case COMPOUND_RIGHT: /* * Image is left or right of text */ if (butPtr->compound == COMPOUND_LEFT) { textXOffset = width + butPtr->padX - 2; } else { imageXOffset = butPtr->textWidth + butPtr->padX; } fullWidth = butPtr->textWidth + butPtr->padX + width; fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); textYOffset = (fullHeight - butPtr->textHeight)/2; imageYOffset = (fullHeight - height)/2; break; case COMPOUND_CENTER: /* * Image and text are superimposed */ fullWidth = (width > butPtr->textWidth ? width : butPtr->textWidth); fullHeight = (height > butPtr->textHeight ? height : butPtr->textHeight); textXOffset = (fullWidth - butPtr->textWidth) / 2; imageXOffset = (fullWidth - width) / 2; textYOffset = (fullHeight - butPtr->textHeight) / 2; imageYOffset = (fullHeight - height) / 2; break; case COMPOUND_NONE: break; } TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->inset, butPtr->padY + butPtr->inset, fullWidth, fullHeight, &x, &y); imageXOffset = LEFT_INSET; imageYOffset += y; textYOffset -= 1; if (butPtr->image != NULL) { Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else { XSetClipOrigin(butPtr->display, dpPtr->gc, imageXOffset, imageYOffset); XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, 0, -1); Tk_UnderlineTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, x + textXOffset, y + textYOffset, butPtr->underline); } else { int x, y; if (haveImage) { TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX + butPtr->borderWidth, butPtr->padY + butPtr->borderWidth, width, height, &x, &y); imageXOffset = LEFT_INSET; imageYOffset += y; if (butPtr->image != NULL) { Tk_RedrawImage(butPtr->image, 0, 0, width, height, pixmap, imageXOffset, imageYOffset); } else { XSetClipOrigin(butPtr->display, dpPtr->gc, x, y); XCopyPlane(butPtr->display, butPtr->bitmap, pixmap, dpPtr->gc, 0, 0, (unsigned int) width, (unsigned int) height, imageXOffset, imageYOffset, 1); XSetClipOrigin(butPtr->display, dpPtr->gc, 0, 0); } } else { textXOffset = LEFT_INSET; TkComputeAnchor(butPtr->anchor, tkwin, butPtr->padX, butPtr->padY, butPtr->textWidth, butPtr->textHeight, &x, &y); Tk_DrawTextLayout(butPtr->display, pixmap, dpPtr->gc, butPtr->textLayout, textXOffset, y, 0, -1); y += butPtr->textHeight/2; } } } /* *-------------------------------------------------------------- * * TkMacOSXDrawMenuButton -- * * This function draws the tk menubutton using Mac controls. In * addition, this code may apply custom colors passed in the * TkMenubutton. * * Results: * None. * * Side effects: * None. * *-------------------------------------------------------------- */ static void TkMacOSXDrawMenuButton( MacMenuButton *mbPtr, /* Mac menubutton. */ GC gc, /* The GC we are drawing into - needed for the bevel * button */ Pixmap pixmap) /* The pixmap we are drawing into - needed for the * bevel button */ { TkMenuButton *butPtr = (TkMenuButton *) mbPtr; TkWindow *winPtr = (TkWindow *) butPtr->tkwin; HIRect cntrRect; TkMacOSXDrawingContext dc; DrawParams *dpPtr = &mbPtr->drawParams; int useNewerHITools = 1; TkMacOSXComputeMenuButtonParams(butPtr, &mbPtr->btnkind, &mbPtr->drawinfo); cntrRect = CGRectMake(winPtr->privatePtr->xOff, winPtr->privatePtr->yOff, Tk_Width(butPtr->tkwin), Tk_Height(butPtr->tkwin)); if (useNewerHITools == 1) { HIRect contHIRec; static HIThemeButtonDrawInfo hiinfo; MenuButtonBackgroundDrawCB(mbPtr, 32, true); if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } hiinfo.version = 0; hiinfo.state = mbPtr->drawinfo.state; hiinfo.kind = mbPtr->btnkind; hiinfo.value = mbPtr->drawinfo.value; hiinfo.adornment = mbPtr->drawinfo.adornment; hiinfo.animation.time.current = CFAbsoluteTimeGetCurrent(); if (hiinfo.animation.time.start == 0) { hiinfo.animation.time.start = hiinfo.animation.time.current; } /* * To avoid menubuttons with white text on a white background, we * always set the state to inactive in Dark Mode. It isn't perfect but * it is usable. Using a ttk::menubutton would be a better choice, * however. */ if (TkMacOSXInDarkMode(butPtr->tkwin)) { hiinfo.state = kThemeStateInactive; } HIThemeDrawButton(&cntrRect, &hiinfo, dc.context, kHIThemeOrientationNormal, &contHIRec); TkMacOSXRestoreDrawingContext(&dc); MenuButtonContentDrawCB(mbPtr->btnkind, &mbPtr->drawinfo, mbPtr, 32, true); } else { if (!TkMacOSXSetupDrawingContext(pixmap, dpPtr->gc, 1, &dc)) { return; } TkMacOSXRestoreDrawingContext(&dc); } mbPtr->lastdrawinfo = mbPtr->drawinfo; } /* *-------------------------------------------------------------- * * MenuButtonBackgroundDrawCB -- * * This function draws the background that lies under checkboxes and * radiobuttons. * * Results: * None. * * Side effects: * The background gets updated to the current color. * *-------------------------------------------------------------- */ static void MenuButtonBackgroundDrawCB ( MacMenuButton *ptr, SInt16 depth, Boolean isColorDev) { TkMenuButton* butPtr = (TkMenuButton *) ptr; Tk_Window tkwin = butPtr->tkwin; Pixmap pixmap; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } pixmap = (Pixmap) Tk_WindowId(tkwin); Tk_Fill3DRectangle(tkwin, pixmap, butPtr->normalBorder, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), 0, TK_RELIEF_FLAT); } /* *-------------------------------------------------------------- * * MenuButtonContentDrawCB -- * * This function draws the label and image for the button. * * Results: * None. * * Side effects: * The content of the button gets updated. * *-------------------------------------------------------------- */ static void MenuButtonContentDrawCB ( ThemeButtonKind kind, const HIThemeButtonDrawInfo *drawinfo, MacMenuButton *ptr, SInt16 depth, Boolean isColorDev) { TkMenuButton *butPtr = (TkMenuButton *) ptr; Tk_Window tkwin = butPtr->tkwin; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } DrawMenuButtonImageAndText(butPtr); } /* *-------------------------------------------------------------- * * MenuButtonEventProc -- * * This procedure is invoked by the Tk dispatcher for various events on * buttons. * * Results: * None. * * Side effects: * When it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MenuButtonEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkMenuButton *buttonPtr = clientData; MacMenuButton *mbPtr = clientData; if (eventPtr->type == ActivateNotify || eventPtr->type == DeactivateNotify) { if ((buttonPtr->tkwin == NULL) || (!Tk_IsMapped(buttonPtr->tkwin))) { return; } if (eventPtr->type == ActivateNotify) { |
︙ | ︙ | |||
743 744 745 746 747 748 749 | } /* *---------------------------------------------------------------------- * * TkMacOSXComputeMenuButtonParams -- * | | | | | > > > | | | < | < < < | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | } /* *---------------------------------------------------------------------- * * TkMacOSXComputeMenuButtonParams -- * * This procedure computes the various parameters used when creating a * Carbon Appearance control. These are determined by the various Tk * button parameters * * Results: * None. * * Side effects: * Sets the btnkind and drawinfo parameters * *---------------------------------------------------------------------- */ static void TkMacOSXComputeMenuButtonParams( TkMenuButton *butPtr, ThemeButtonKind *btnkind, HIThemeButtonDrawInfo *drawinfo) { MacMenuButton *mbPtr = (MacMenuButton *) butPtr; if (butPtr->image || butPtr->bitmap || butPtr->text) { /* TODO: allow for Small and Mini menubuttons. */ *btnkind = kThemePopupButton; } else { /* This should never happen. */ *btnkind = kThemeArrowButton; } drawinfo->value = kThemeButtonOff; if ((mbPtr->flags & FIRST_DRAW) != 0) { mbPtr->flags &= ~FIRST_DRAW; if (Tk_MacOSXIsAppInFront()) { |
︙ | ︙ | |||
808 809 810 811 812 813 814 | } /* *---------------------------------------------------------------------- * * TkMacOSXComputeMenuButtonDrawParams -- * | | | < | | | | > > | | | < | < | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | } /* *---------------------------------------------------------------------- * * TkMacOSXComputeMenuButtonDrawParams -- * * This procedure selects an appropriate drawing context for drawing a * menubutton. * * Results: * None. * * Side effects: * Sets the button draw parameters. * *---------------------------------------------------------------------- */ static void TkMacOSXComputeMenuButtonDrawParams( TkMenuButton *butPtr, DrawParams *dpPtr) { dpPtr->hasImageOrBitmap = ((butPtr->image != NULL) || (butPtr->bitmap != None)); dpPtr->border = butPtr->normalBorder; if ((butPtr->state == STATE_DISABLED) && (butPtr->disabledFg != NULL)) { dpPtr->gc = butPtr->disabledGC; } else if (butPtr->state == STATE_ACTIVE) { dpPtr->gc = butPtr->activeTextGC; dpPtr->border = butPtr->activeBorder; } else { dpPtr->gc = butPtr->normalTextGC; } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXMenus.c.
︙ | ︙ | |||
173 174 175 176 177 178 179 | } - (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>) anItem { SEL action = [anItem action]; if (sel_isEqual(action, @selector(preferences:))) { | < | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | } - (BOOL) validateUserInterfaceItem: (id <NSValidatedUserInterfaceItem>) anItem { SEL action = [anItem action]; if (sel_isEqual(action, @selector(preferences:))) { return (_eventInterp && Tcl_FindCommand(_eventInterp, "::tk::mac::ShowPreferences", NULL, 0)); } else if (sel_isEqual(action, @selector(tkDemo:))) { BOOL haveDemo = NO; if (_eventInterp) { Tcl_Obj *path = GetWidgetDemoPath(_eventInterp); |
︙ | ︙ | |||
318 319 320 321 322 323 324 | *---------------------------------------------------------------------- */ static Tcl_Obj * GetWidgetDemoPath( Tcl_Interp *interp) { | | | | < | > | < < > | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | *---------------------------------------------------------------------- */ static Tcl_Obj * GetWidgetDemoPath( Tcl_Interp *interp) { Tcl_Obj *result = NULL; if (Tcl_EvalEx(interp, "::tk::pkgconfig get demodir,runtime", -1, TCL_EVAL_GLOBAL) == TCL_OK) { Tcl_Obj *libpath, *demo[1] = { Tcl_NewStringObj("widget", 6) }; libpath = Tcl_GetObjResult(interp); Tcl_IncrRefCount(libpath); result = Tcl_FSJoinToPath(libpath, 1, demo); Tcl_DecrRefCount(libpath); } Tcl_ResetResult(interp); return result; } /* *---------------------------------------------------------------------- * * TkMacOSXHandleMenuSelect -- |
︙ | ︙ |
Changes to macosx/tkMacOSXMouseEvent.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 | typedef struct { unsigned int state; long delta; Window window; Point global; Point local; } MouseEventData; static int GenerateButtonEvent(MouseEventData *medPtr); static unsigned int ButtonModifiers2State(UInt32 buttonState, | > > | > > > > > > > > > > < < < < < < | > > > > > | | > > > | > > | > > > | > | > | | > > > < | > | | | < | | > | < > > | | | < < < | | > > > > | | | | > > > > > > > > > > | | | | < < | < < > | < | < > > > > > > > > > > > > > | | | > > | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | typedef struct { unsigned int state; long delta; Window window; Point global; Point local; } MouseEventData; static Tk_Window captureWinPtr = NULL; /* Current capture window; may be * NULL. */ static int GenerateButtonEvent(MouseEventData *medPtr); static unsigned int ButtonModifiers2State(UInt32 buttonState, UInt32 keyModifiers); #pragma mark TKApplication(TKMouseEvent) enum { NSWindowWillMoveEventType = 20 }; /* * In OS X 10.6 an NSEvent of type NSMouseMoved would always have a non-Nil * window attribute pointing to the active window. As of 10.8 this behavior * had changed. The new behavior was that if the mouse were ever moved outside * of a window, all subsequent NSMouseMoved NSEvents would have a Nil window * attribute. To work around this the TKApplication remembers the last non-Nil * window that it received in a mouse event. If it receives an NSEvent with a * Nil window attribute then the saved window is used. */ @implementation TKApplication(TKMouseEvent) - (NSEvent *) tkProcessMouseEvent: (NSEvent *) theEvent { NSWindow *eventWindow = [theEvent window]; NSEventType eventType = [theEvent type]; TkWindow *winPtr = NULL, *grabWinPtr; Tk_Window tkwin; NSPoint local, global; #if 0 NSTrackingArea *trackingArea = nil; NSInteger eventNumber, clickCount, buttonNumber; #endif #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, theEvent); #endif switch (eventType) { case NSMouseEntered: case NSMouseExited: case NSCursorUpdate: case NSLeftMouseDown: case NSLeftMouseUp: case NSRightMouseDown: case NSRightMouseUp: case NSOtherMouseDown: case NSOtherMouseUp: case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDragged: case NSMouseMoved: case NSTabletPoint: case NSTabletProximity: case NSScrollWheel: break; default: /* Unrecognized mouse event. */ return theEvent; } /* * Compute the mouse position in Tk screen coordinates (global) and in the * Tk coordinates of its containing Tk Window (local). If a grab is in effect, * the local coordinates should be relative to the grab window. */ if (eventWindow) { local = [theEvent locationInWindow]; global = [eventWindow tkConvertPointToScreen: local]; tkwin = TkMacOSXGetCapture(); if (tkwin) { winPtr = (TkWindow *) tkwin; eventWindow = TkMacOSXDrawableWindow(winPtr->window); if (eventWindow) { local = [eventWindow tkConvertPointFromScreen: global]; } else { return theEvent; } } local.y = [eventWindow frame].size.height - local.y; global.y = tkMacOSXZeroScreenHeight - global.y; } else { /* * If the event has no NSWindow, the location is in screen coordinates. */ global = [theEvent locationInWindow]; tkwin = TkMacOSXGetCapture(); if (tkwin) { winPtr = (TkWindow *) tkwin; eventWindow = TkMacOSXDrawableWindow(winPtr->window); } else { eventWindow = [NSApp mainWindow]; } if (!eventWindow) { return theEvent; } local = [eventWindow tkConvertPointFromScreen: global]; local.y = [eventWindow frame].size.height - local.y; global.y = tkMacOSXZeroScreenHeight - global.y; } /* * Make sure tkwin is the toplevel which should receive the event. */ if (!tkwin) { winPtr = TkMacOSXGetTkWindow(eventWindow); tkwin = (Tk_Window) winPtr; } if (!tkwin) { #ifdef TK_MAC_DEBUG_EVENTS TkMacOSXDbgMsg("tkwin == NULL"); #endif return theEvent; /* Give up. No window for this event. */ } /* * If another toplevel has a grab, we ignore the event. */ grabWinPtr = winPtr->dispPtr->grabWinPtr; if (grabWinPtr && grabWinPtr != winPtr && !winPtr->dispPtr->grabFlags && /* this means the grab is local. */ grabWinPtr->mainPtr == winPtr->mainPtr) { return theEvent; } /* * Convert local from NSWindow flipped coordinates to the toplevel's * coordinates. */ local.x -= winPtr->wmInfoPtr->xInParent; local.y -= winPtr->wmInfoPtr->yInParent; /* * Find the containing Tk window, and convert local into the coordinates * of the Tk window. (The converted local coordinates are only needed * for scrollwheel events.) */ int win_x, win_y; tkwin = Tk_TopCoordsToWindow(tkwin, local.x, local.y, &win_x, &win_y); local.x = win_x; local.y = win_y; /* * Generate an XEvent for this mouse event. */ unsigned int state = 0; int button = [theEvent buttonNumber] + Button1; EventRef eventRef = (EventRef)[theEvent eventRef]; UInt32 buttons; OSStatus err = GetEventParameter(eventRef, kEventParamMouseChord, typeUInt32, NULL, sizeof(UInt32), NULL, &buttons); if (err == noErr) { state |= (buttons & 0x7F) * Button1Mask; /* Handle buttons 8/9 */ state |= (buttons & 0x180) * (Button8Mask >> 7); } else if (button <= Button9) { switch (eventType) { case NSLeftMouseDown: case NSRightMouseDown: case NSLeftMouseDragged: case NSRightMouseDragged: case NSOtherMouseDown: state |= TkGetButtonMask(button); break; default: break; } } NSUInteger modifiers = [theEvent modifierFlags]; |
︙ | ︙ | |||
177 178 179 180 181 182 183 184 | state |= Mod3Mask; } if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } if (eventType != NSScrollWheel) { #ifdef TK_MAC_DEBUG_EVENTS | > > > > | > | > > > > | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | state |= Mod3Mask; } if (modifiers & NSFunctionKeyMask) { state |= Mod4Mask; } if (eventType != NSScrollWheel) { /* * For normal mouse events, Tk_UpdatePointer will send the XEvent. */ #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"UpdatePointer %p x %f.0 y %f.0 %d", tkwin, global.x, global.y, state); #endif Tk_UpdatePointer(tkwin, global.x, global.y, state); } else { /* * For scroll wheel events we need to send the XEvent here. */ CGFloat delta; int coarseDelta; XEvent xEvent; xEvent.type = MouseWheelEvent; xEvent.xbutton.x = local.x; xEvent.xbutton.y = local.y; xEvent.xbutton.x_root = global.x; xEvent.xbutton.y_root = global.y; xEvent.xany.send_event = false; xEvent.xany.display = Tk_Display(tkwin); xEvent.xany.window = Tk_WindowId(tkwin); delta = [theEvent deltaY]; if (delta != 0.0) { coarseDelta = (delta > -1.0 && delta < 1.0) ? (signbit(delta) ? -1 : 1) : lround(delta); xEvent.xbutton.state = state; xEvent.xkey.keycode = coarseDelta; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } delta = [theEvent deltaX]; if (delta != 0.0) { coarseDelta = (delta > -1.0 && delta < 1.0) ? (signbit(delta) ? -1 : 1) : lround(delta); xEvent.xbutton.state = state | ShiftMask; xEvent.xkey.keycode = coarseDelta; xEvent.xany.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); Tk_QueueWindowEvent(&xEvent, TCL_QUEUE_TAIL); } } return theEvent; |
︙ | ︙ | |||
304 305 306 307 308 309 310 | ButtonModifiers2State( UInt32 buttonState, UInt32 keyModifiers) { unsigned int state; /* | | | > > | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | ButtonModifiers2State( UInt32 buttonState, UInt32 keyModifiers) { unsigned int state; /* * Tk on OSX supports at most 9 buttons. */ state = (buttonState & 0x7F) * Button1Mask; /* Handle buttons 8/9 */ state |= (buttonState & 0x180) * (Button8Mask >> 7); if (keyModifiers & alphaLock) { state |= LockMask; } if (keyModifiers & shiftKey) { state |= ShiftMask; } |
︙ | ︙ | |||
567 568 569 570 571 572 573 | /* * Tell the OSX core to generate the events to make it happen. */ buttonState = [NSEvent pressedMouseButtons]; CGEventType type = kCGEventMouseMoved; | | < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 | /* * Tell the OSX core to generate the events to make it happen. */ buttonState = [NSEvent pressedMouseButtons]; CGEventType type = kCGEventMouseMoved; CGEventRef theEvent = CGEventCreateMouseEvent(NULL, type, pt, buttonState); CGWarpMouseCursorPosition(pt); CGEventPost(kCGHIDEventTap, theEvent); CFRelease(theEvent); } /* *---------------------------------------------------------------------- * * TkpSetCapture -- * * This function captures the mouse so that all future events will be * reported to this window, even if the mouse is outside the window. If * the specified window is NULL, then the mouse is released. * * Results: * None. * * Side effects: * Sets the capture flag and captures the mouse. * *---------------------------------------------------------------------- */ void TkpSetCapture( TkWindow *winPtr) /* Capture window, or NULL. */ { while (winPtr && !Tk_IsTopLevel(winPtr)) { winPtr = winPtr->parentPtr; } captureWinPtr = (Tk_Window) winPtr; } /* *---------------------------------------------------------------------- * * TkMacOSXGetCapture -- * * Results: * Returns the current grab window * * Side effects: * None. * *---------------------------------------------------------------------- */ Tk_Window TkMacOSXGetCapture(void) { return captureWinPtr; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXNotify.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)) static void TkMacOSXNotifyExitHandler(ClientData clientData); static void TkMacOSXEventsSetupProc(ClientData clientData, int flags); static void TkMacOSXEventsCheckProc(ClientData clientData, int flags); #ifdef TK_MAC_DEBUG_EVENTS | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)) static void TkMacOSXNotifyExitHandler(ClientData clientData); static void TkMacOSXEventsSetupProc(ClientData clientData, int flags); static void TkMacOSXEventsCheckProc(ClientData clientData, int flags); #ifdef TK_MAC_DEBUG_EVENTS static const char *Tk_EventName[39] = { "", "", "KeyPress", /*2*/ "KeyRelease", /*3*/ "ButtonPress", /*4*/ "ButtonRelease", /*5*/ "MotionNotify", /*6*/ |
︙ | ︙ | |||
132 133 134 135 136 137 138 | * no longer, and perhaps never did need to set autoDisplay to NO, nor call * displayIfNeeded on our windows. We can just leave all of that to the window * manager. */ /* * Since the contentView is the first responder for a Tk Window, it is | | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | * no longer, and perhaps never did need to set autoDisplay to NO, nor call * displayIfNeeded on our windows. We can just leave all of that to the window * manager. */ /* * Since the contentView is the first responder for a Tk Window, it is * responsible for sending events up the responder chain. We also check the * pasteboard here. */ - (void) sendEvent: (NSEvent *) theEvent { [super sendEvent:theEvent]; [NSApp tkCheckPasteboard]; #ifdef TK_MAC_DEBUG_EVENTS fprintf(stderr, "Sending event of type %d\n", (int)[theEvent type]); |
︙ | ︙ | |||
186 187 188 189 190 191 192 | } /* *---------------------------------------------------------------------- * * Tk_MacOSXSetupTkNotifier -- * | | | | 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | } /* *---------------------------------------------------------------------- * * Tk_MacOSXSetupTkNotifier -- * * This procedure is called during Tk initialization to create the event * source for TkAqua events. * * Results: * None. * * Side effects: * A new event source is created. * |
︙ | ︙ | |||
220 221 222 223 224 225 226 | * Panic if main runloop is not on the main application thread. */ Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } Tcl_CreateEventSource(TkMacOSXEventsSetupProc, | | < | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | * Panic if main runloop is not on the main application thread. */ Tcl_Panic("Tk_MacOSXSetupTkNotifier: %s", "first [load] of TkAqua has to occur in the main thread!"); } Tcl_CreateEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); TkCreateExitHandler(TkMacOSXNotifyExitHandler, NULL); Tcl_SetServiceMode(TCL_SERVICE_ALL); TclMacOSXNotifierAddRunLoopMode(NSEventTrackingRunLoopMode); TclMacOSXNotifierAddRunLoopMode(NSModalPanelRunLoopMode); } } } |
︙ | ︙ | |||
254 255 256 257 258 259 260 | static void TkMacOSXNotifyExitHandler( ClientData clientData) /* Not used. */ { TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, | | < | | | | | | | > > | > > > > | > > > | | | | | | | | > > | > > > > | > | | | | > > | > > | | | > | > > < > > | > > < | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | static void TkMacOSXNotifyExitHandler( ClientData clientData) /* Not used. */ { TSD_INIT(); Tcl_DeleteEventSource(TkMacOSXEventsSetupProc, TkMacOSXEventsCheckProc, NULL); tsdPtr->initialized = 0; } /* *---------------------------------------------------------------------- * * TkMacOSXEventsSetupProc -- * * This procedure implements the setup part of the MacOSX event source. It * is invoked by Tcl_DoOneEvent before calling TkMacOSXEventsProc to * process all queued NSEvents. In our case, all we need to do is to set * the Tcl MaxBlockTime to 0 before starting the loop to process all * queued NSEvents. * * Results: * None. * * Side effects: * * If NSEvents are queued, then the maximum block time will be set to 0 to * ensure that control returns immediately to Tcl. * *---------------------------------------------------------------------- */ static void TkMacOSXEventsSetupProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; /* * runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { static const Tcl_Time zeroBlockTime = { 0, 0 }; [NSApp _resetAutoreleasePool]; /* * Call this with dequeue=NO -- just checking if the queue is empty. */ NSEvent *currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(TkMacOSXGetModalSession()) dequeue:NO]; if (currentEvent) { if (currentEvent.type > 0) { Tcl_SetMaxBlockTime(&zeroBlockTime); } } } } /* *---------------------------------------------------------------------- * * TkMacOSXEventsCheckProc -- * * This procedure loops through all NSEvents waiting in the TKApplication * event queue, generating X events from them. * * Results: * None. * * Side effects: * NSevents are used to generate X events, which are added to the Tcl * event queue. * *---------------------------------------------------------------------- */ static void TkMacOSXEventsCheckProc( ClientData clientData, int flags) { NSString *runloopMode = [[NSRunLoop currentRunLoop] currentMode]; /* * runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { NSEvent *currentEvent = nil; NSEvent *testEvent = nil; NSModalSession modalSession; /* * It is possible for the SetupProc to be called before this function * returns. This happens, for example, when we process an event which * opens a modal window. To prevent premature release of our * application-wide autorelease pool by a nested call to the SetupProc, * we must lock it here. */ [NSApp _lockAutoreleasePool]; do { modalSession = TkMacOSXGetModalSession(); testEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) dequeue:NO]; /* * We must not steal any events during LiveResize. */ if (testEvent && [[testEvent window] inLiveResize]) { break; } currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) dequeue:YES]; if (currentEvent) { /* * Generate Xevents. */ int oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); NSEvent *processedEvent = [NSApp tkProcessEvent:currentEvent]; Tcl_SetServiceMode(oldServiceMode); if (processedEvent) { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@" event: %@", currentEvent); #endif if (modalSession) { [NSApp _modalSession:modalSession sendEvent:currentEvent]; } else { [NSApp sendEvent:currentEvent]; } } } else { break; } } while (1); /* * Now we can unlock the pool. */ [NSApp _unlockAutoreleasePool]; } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXPort.h.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <stdio.h> #include <ctype.h> #include <fcntl.h> #include <limits.h> #include <math.h> #include <pwd.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <stdio.h> #include <ctype.h> #include <fcntl.h> #include <limits.h> #include <math.h> #include <pwd.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <sys/types.h> #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> |
︙ | ︙ | |||
123 124 125 126 127 128 129 | */ #define TkpCmapStressed(tkwin,colormap) (0) #define TkpFreeColor(tkColPtr) #define TkSetPixmapColormap(p,c) {} #define TkpSync(display) | < < < < < < < < < < < | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | */ #define TkpCmapStressed(tkwin,colormap) (0) #define TkpFreeColor(tkColPtr) #define TkSetPixmapColormap(p,c) {} #define TkpSync(display) /* * This macro stores a representation of the window handle in a string. */ #define TkpPrintWindowId(buf,w) \ sprintf((buf), "0x%lx", (unsigned long) (w)) |
︙ | ︙ | |||
155 156 157 158 159 160 161 | * Magic pixel code values for system colors. * * NOTE: values must be kept in sync with indices into the * systemColorMap array in tkMacOSXColor.c ! */ #define TRANSPARENT_PIXEL 30 | | < | | > | | | | > | | < | | > | | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | * Magic pixel code values for system colors. * * NOTE: values must be kept in sync with indices into the * systemColorMap array in tkMacOSXColor.c ! */ #define TRANSPARENT_PIXEL 30 #define APPEARANCE_PIXEL 52 #define PIXEL_MAGIC ((unsigned char) 0x69) /* * The following macro returns the pixel value that corresponds to the * 16-bit RGB values in the given XColor structure. * The format is: (PIXEL_MAGIC <<< 24) | (R << 16) | (G << 8) | B * where each of R, G and B is the high order byte of a 16-bit component. */ #define TkpGetPixel(p) ((((((PIXEL_MAGIC << 8) \ | (((p)->red >> 8) & 0xff)) << 8) \ | (((p)->green >> 8) & 0xff)) << 8) \ | (((p)->blue >> 8) & 0xff)) #endif /* _TKMACPORT */ |
Changes to macosx/tkMacOSXPrivate.h.
︙ | ︙ | |||
111 112 113 114 115 116 117 118 | #define ChkErr(f, ...) ({f(__VA_ARGS__);}) #endif /* TK_MAC_DEBUG */ /* * Macro abstracting use of TkMacOSXGetNamedSymbol to init named symbols. */ #define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \ | > | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #define ChkErr(f, ...) ({f(__VA_ARGS__);}) #endif /* TK_MAC_DEBUG */ /* * Macro abstracting use of TkMacOSXGetNamedSymbol to init named symbols. */ #define UNINITIALISED_SYMBOL ((void*)(-1L)) #define TkMacOSXInitNamedSymbol(module, ret, symbol, ...) \ static ret (* symbol)(__VA_ARGS__) = UNINITIALISED_SYMBOL; \ if (symbol == UNINITIALISED_SYMBOL) { \ symbol = TkMacOSXGetNamedSymbol(STRINGIFY(module), \ STRINGIFY(symbol)); \ } /* * Structure encapsulating current drawing environment. */ |
︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 | NSWindow *macWindow); MODULE_SCOPE int TkMacOSXStandardAboutPanelObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #pragma mark Private Objective-C Classes #define VISIBILITY_HIDDEN __attribute__((visibility("hidden"))) enum { tkMainMenu = 1, tkApplicationMenu, tkWindowsMenu, tkHelpMenu}; | > > > > > > | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | NSWindow *macWindow); MODULE_SCOPE int TkMacOSXStandardAboutPanelObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE int TkMacOSXIconBitmapObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); MODULE_SCOPE void TkMacOSXDrawSolidBorder(Tk_Window tkwin, GC gc, int inset, int thickness); MODULE_SCOPE int TkMacOSXServices_Init(Tcl_Interp *interp); MODULE_SCOPE int TkMacOSXRegisterServiceWidgetObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #pragma mark Private Objective-C Classes #define VISIBILITY_HIDDEN __attribute__((visibility("hidden"))) enum { tkMainMenu = 1, tkApplicationMenu, tkWindowsMenu, tkHelpMenu}; |
︙ | ︙ | |||
257 258 259 260 261 262 263 | @interface TKApplication : NSApplication { @private Tcl_Interp *_eventInterp; NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems; | < | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | @interface TKApplication : NSApplication { @private Tcl_Interp *_eventInterp; NSMenu *_servicesMenu; TKMenu *_defaultMainMenu, *_defaultApplicationMenu; NSArray *_defaultApplicationMenuItems, *_defaultWindowsMenuItems; NSArray *_defaultHelpMenuItems; NSAutoreleasePool *_mainPool; #ifdef __i386__ /* The Objective C runtime used on i386 requires this. */ int _poolLock; int _macMinorVersion; Bool _isDrawing; #endif |
︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleOpenDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; @end VISIBILITY_HIDDEN @interface TKContentView : NSView <NSTextInput> { NSString *privateWorkingText; } @end @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; @end @interface TKContentView(TKWindowEvent) | > > > > > | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleOpenDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handlePrintDocumentsEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void) handleDoScriptEvent: (NSAppleEventDescriptor *)event withReplyEvent: (NSAppleEventDescriptor *)replyEvent; - (void)handleURLEvent: (NSAppleEventDescriptor*)event withReplyEvent: (NSAppleEventDescriptor*)replyEvent; @end VISIBILITY_HIDDEN @interface TKContentView : NSView <NSTextInput> { @private NSString *privateWorkingText; Bool _needsRedisplay; } @property Bool needsRedisplay; @end @interface TKContentView(TKKeyEvent) - (void) deleteWorkingText; @end @interface TKContentView(TKWindowEvent) |
︙ | ︙ | |||
413 414 415 416 417 418 419 | */ @interface NSApplication(TKMenu) - (void) setAppleMenu: (NSMenu *) menu; @end #endif /* _TKMACPRIV */ | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | */ @interface NSApplication(TKMenu) - (void) setAppleMenu: (NSMenu *) menu; @end #endif /* _TKMACPRIV */ /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXRegion.c.
︙ | ︙ | |||
183 184 185 186 187 188 189 | * * TkRectInRegion -- * * Implements the equivelent of the X window function XRectInRegion. See * Xwindow documentation for more details. * * Results: | | | | | < | > | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | * * TkRectInRegion -- * * Implements the equivelent of the X window function XRectInRegion. See * Xwindow documentation for more details. * * Results: * Returns RectanglePart or RectangleOut. Note that this is not a complete * implementation since it doesn't test for RectangleIn. * * Side effects: * None. * *---------------------------------------------------------------------- */ int TkRectInRegion( TkRegion region, int x, int y, unsigned int width, unsigned int height) { if (TkMacOSXIsEmptyRegion(region)) { return RectangleOut; } else { const CGRect r = CGRectMake(x, y, width, height); return HIShapeIntersectsRect((HIShapeRef) region, &r) ? RectanglePart : RectangleOut; } } /* *---------------------------------------------------------------------- * * TkClipBox -- |
︙ | ︙ | |||
230 231 232 233 234 235 236 | * *---------------------------------------------------------------------- */ void TkClipBox( TkRegion r, | | | 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | * *---------------------------------------------------------------------- */ void TkClipBox( TkRegion r, XRectangle *rect_return) { CGRect rect; HIShapeGetBounds((HIShapeRef) r, &rect); rect_return->x = rect.origin.x; rect_return->y = rect.origin.y; rect_return->width = rect.size.width; |
︙ | ︙ |
Changes to macosx/tkMacOSXScale.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | */ static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */ /* * Forward declarations for procedures defined later in this file: */ | | > | | < | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | */ static ControlActionUPP scaleActionProc = NULL; /* Pointer to func. */ /* * Forward declarations for procedures defined later in this file: */ static void MacScaleEventProc(ClientData clientData, XEvent *eventPtr); static pascal void ScaleActionProc(ControlRef theControl, ControlPartCode partCode); /* *---------------------------------------------------------------------- * * TkpCreateScale -- * * Allocate a new TkScale structure. |
︙ | ︙ | |||
80 81 82 83 84 85 86 | macScalePtr->scaleHandle = NULL; if (scaleActionProc == NULL) { scaleActionProc = NewControlActionUPP(ScaleActionProc); } Tk_CreateEventHandler(tkwin, ButtonPressMask, | | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | macScalePtr->scaleHandle = NULL; if (scaleActionProc == NULL) { scaleActionProc = NewControlActionUPP(ScaleActionProc); } Tk_CreateEventHandler(tkwin, ButtonPressMask, MacScaleEventProc, macScalePtr); return (TkScale *) macScalePtr; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
121 122 123 124 125 126 127 | } /* *---------------------------------------------------------------------- * * TkpDisplayScale -- * | | | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | } /* *---------------------------------------------------------------------- * * TkpDisplayScale -- * * This procedure is invoked as an idle handler to redisplay the contents * of a scale widget. * * Results: * None. * * Side effects: * The scale gets redisplayed. * *---------------------------------------------------------------------- */ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { TkScale *scalePtr = clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; int result; char string[TCL_DOUBLE_SPACE]; MacScale *macScalePtr = clientData; Rect r; WindowRef windowRef; CGrafPtr destPort, savePort; Boolean portChanged; MacDrawable *macDraw; SInt32 initialValue, minValue, maxValue; UInt16 numTicks; |
︙ | ︙ | |||
164 165 166 167 168 169 170 | goto done; } /* * Invoke the scale's command if needed. */ | | | | | | | | < | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | goto done; } /* * Invoke the scale's command if needed. */ Tcl_Preserve(scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->format, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, -1); Tcl_DStringAppend(&buf, " ", -1); Tcl_DStringAppend(&buf, string, -1); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0); Tcl_DStringFree(&buf); if (result != TCL_OK) { Tcl_AddErrorInfo(interp, "\n (command executed by scale)"); Tcl_BackgroundException(interp, result); } Tcl_Release(interp); } scalePtr->flags &= ~INVOKE_COMMAND; if (scalePtr->flags & SCALE_DELETED) { Tcl_Release(scalePtr); return; } Tcl_Release(scalePtr); /* * Now handle the part of redisplay that is the same for horizontal and * vertical scales: border and traversal highlight. */ if (scalePtr->highlightWidth != 0) { GC gc = Tk_GCForColor(scalePtr->highlightColorPtr, Tk_WindowId(tkwin)); Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, Tk_WindowId(tkwin)); |
︙ | ︙ | |||
225 226 227 228 229 230 231 | /* * Create Macintosh control. */ #define MAC_OSX_SCROLL_WIDTH 10 if (scalePtr->orient == ORIENT_HORIZONTAL) { | | | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | /* * Create Macintosh control. */ #define MAC_OSX_SCROLL_WIDTH 10 if (scalePtr->orient == ORIENT_HORIZONTAL) { int offset = (Tk_Height(tkwin) - MAC_OSX_SCROLL_WIDTH) / 2; if (offset < 0) { offset = 0; } r.left = macDraw->xOff + scalePtr->inset; r.top = macDraw->yOff + offset; r.right = macDraw->xOff+Tk_Width(tkwin) - scalePtr->inset; r.bottom = macDraw->yOff + offset + MAC_OSX_SCROLL_WIDTH/2; } else { int offset = (Tk_Width(tkwin) - MAC_OSX_SCROLL_WIDTH) / 2; if (offset < 0) { offset = 0; } r.left = macDraw->xOff + offset; r.top = macDraw->yOff + scalePtr->inset; r.right = macDraw->xOff + offset + MAC_OSX_SCROLL_WIDTH/2; r.bottom = macDraw->yOff + Tk_Height(tkwin) - scalePtr->inset; } if (macScalePtr->scaleHandle == NULL) { #ifdef TK_MAC_DEBUG_SCALE TkMacOSXDbgMsg("Initialising scale"); #endif initialValue = scalePtr->value; |
︙ | ︙ | |||
269 270 271 272 273 274 275 | numTicks = 0; } else { numTicks = (maxValue - minValue)/scalePtr->tickInterval; } CreateSliderControl(windowRef, &r, initialValue, minValue, maxValue, kControlSliderPointsDownOrRight, numTicks, 1, scaleActionProc, | | | | | < | | | | 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 | numTicks = 0; } else { numTicks = (maxValue - minValue)/scalePtr->tickInterval; } CreateSliderControl(windowRef, &r, initialValue, minValue, maxValue, kControlSliderPointsDownOrRight, numTicks, 1, scaleActionProc, &macScalePtr->scaleHandle); SetControlReference(macScalePtr->scaleHandle, (UInt32) scalePtr); if (IsWindowActive(windowRef)) { macScalePtr->flags |= ACTIVE; } } else { SetControlBounds(macScalePtr->scaleHandle, &r); SetControl32BitValue(macScalePtr->scaleHandle, scalePtr->value); SetControl32BitMinimum(macScalePtr->scaleHandle, scalePtr->fromValue); SetControl32BitMaximum(macScalePtr->scaleHandle, scalePtr->toValue); } /* * Finally draw the control. */ SetControlVisibility(macScalePtr->scaleHandle, true, true); HiliteControl(macScalePtr->scaleHandle, 0); Draw1Control(macScalePtr->scaleHandle); if (portChanged) { QDSwapPort(savePort, NULL); } done: scalePtr->flags &= ~REDRAW_ALL; } /* *---------------------------------------------------------------------- * * TkpScaleElement -- * * Determine which part of a scale widget lies under a given point. * * Results: * The return value is either TROUGH1, SLIDER, TROUGH2, or OTHER, * depending on which of the scale's active elements (if any) is under the * point at (x,y). * * Side effects: * None. * *---------------------------------------------------------------------- */ |
︙ | ︙ | |||
353 354 355 356 357 358 359 | } #ifdef TK_MAC_DEBUG_SCALE fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v ); #endif switch (part) { | | | | | | | | | | | | | | | | | | | | | | 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | } #ifdef TK_MAC_DEBUG_SCALE fprintf (stderr,"ScalePart %d, pos ( %d %d )\n", part, where.h, where.v ); #endif switch (part) { case inSlider: return SLIDER; case inInc: if (scalePtr->orient == ORIENT_VERTICAL) { return TROUGH1; } else { return TROUGH2; } case inDecr: if (scalePtr->orient == ORIENT_VERTICAL) { return TROUGH2; } else { return TROUGH1; } default: return OTHER; } } /* *-------------------------------------------------------------- * * MacScaleEventProc -- * * This procedure is invoked by the Tk dispatcher for ButtonPress events * on scales. * * Results: * None. * * Side effects: * When the window gets deleted, internal structures get cleaned up. When * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void MacScaleEventProc( ClientData clientData, /* Information about window. */ |
︙ | ︙ | |||
407 408 409 410 411 412 413 | Boolean portChanged; #ifdef TK_MAC_DEBUG_SCALE fprintf(stderr,"MacScaleEventProc\n" ); #endif /* | | | | | 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | Boolean portChanged; #ifdef TK_MAC_DEBUG_SCALE fprintf(stderr,"MacScaleEventProc\n" ); #endif /* * To call Macintosh control routines we must have the port set to the * window containing the control. We will then test which part of the * control was hit and act accordingly. */ destPort = TkMacOSXGetDrawablePort(Tk_WindowId(macScalePtr->info.tkwin)); portChanged = QDSwapPort(destPort, &savePort); TkMacOSXSetUpClippingRgn(Tk_WindowId(macScalePtr->info.tkwin)); TkMacOSXWinBounds((TkWindow *) macScalePtr->info.tkwin, &bounds); |
︙ | ︙ | |||
457 458 459 460 461 462 463 | /* *-------------------------------------------------------------- * * ScaleActionProc -- * * Callback procedure used by the Macintosh toolbox call | | | | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | /* *-------------------------------------------------------------- * * ScaleActionProc -- * * Callback procedure used by the Macintosh toolbox call * HandleControlClick. This call will update the display while the * scrollbar is being manipulated by the user. * * Results: * None. * * Side effects: * May change the display. * |
︙ | ︙ | |||
482 483 484 485 486 487 488 | TkScale *scalePtr = (TkScale *) GetControlReference(theControl); #ifdef TK_MAC_DEBUG_SCALE TkMacOSXDbgMsg("ScaleActionProc"); #endif value = GetControlValue(theControl); TkScaleSetValue(scalePtr, value, 1, 1); | | | | 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | TkScale *scalePtr = (TkScale *) GetControlReference(theControl); #ifdef TK_MAC_DEBUG_SCALE TkMacOSXDbgMsg("ScaleActionProc"); #endif value = GetControlValue(theControl); TkScaleSetValue(scalePtr, value, 1, 1); Tcl_Preserve(scalePtr); TkMacOSXRunTclEventLoop(); Tcl_Release(scalePtr); } #endif /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXScrlbr.c.
1 2 3 4 5 6 7 8 9 10 | /* * tkMacOSXScrollbar.c -- * * This file implements the Macintosh specific portion of the scrollbar * widget. * * Copyright (c) 1996 by Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2015 Kevin Walzer/WordTech Commununications LLC. | | > < < < | > > | > > | | | | | | | | | > > < | > < | > | > | | | < | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | > | | | > > > > | > > | > > > | > > | | | | | | | | > | > > > | > > > > | > > > | | > > | > | < < | | < | | | | | | | | | | | | | | | | | | < | < > | | > | > | | | | | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | /* * tkMacOSXScrollbar.c -- * * This file implements the Macintosh specific portion of the scrollbar * widget. * * Copyright (c) 1996 by Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2015 Kevin Walzer/WordTech Commununications LLC. * Copyright (c) 2018-2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkInt.h" #include "tkScrollbar.h" #include "tkMacOSXPrivate.h" /* * Minimum slider length, in pixels (designed to make sure that the slider is * always easy to grab with the mouse). */ #define MIN_SLIDER_LENGTH 18 #define MIN_GAP 4 /* * Borrowed from ttkMacOSXTheme.c to provide appropriate scaling. */ #ifdef __LP64__ #define RangeToFactor(maximum) (((double) (INT_MAX >> 1)) / (maximum)) #else #define RangeToFactor(maximum) (((double) (LONG_MAX >> 1)) / (maximum)) #endif /* __LP64__ */ /* * Apple reversed the scroll direction with the release of OSX 10.7 Lion. */ #define SNOW_LEOPARD_STYLE (NSAppKitVersionNumber < 1138) /* * Declaration of an extended scrollbar structure with Mac specific additions. */ typedef struct MacScrollbar { TkScrollbar information; /* Generic scrollbar info. */ GC troughGC; /* For drawing trough. */ GC copyGC; /* Used for copying from pixmap onto screen. */ Bool buttonDown; /* Is the mouse button down? */ Bool mouseOver; /* Is the pointer over the scrollbar. */ HIThemeTrackDrawInfo info; /* Controls how the scrollbar is drawn. */ } MacScrollbar; /* Used to initialize a MacScrollbar's info field. */ HIThemeTrackDrawInfo defaultInfo = { .version = 0, .min = 0.0, .max = 100.0, .attributes = kThemeTrackShowThumb, }; /* * The class procedure table for the scrollbar widget. All fields except size * are left initialized to NULL, which should happen automatically since the * variable is declared at this scope. */ const Tk_ClassProcs tkpScrollbarProcs = { sizeof(Tk_ClassProcs), /* size */ NULL, /* worldChangedProc */ NULL, /* createProc */ NULL /* modalProc */ }; /* * Information on scrollbar layout, metrics, and draw info. */ typedef struct ScrollbarMetrics { SInt32 width, minThumbHeight; int minHeight, topArrowHeight, bottomArrowHeight; NSControlSize controlSize; } ScrollbarMetrics; static ScrollbarMetrics metrics = { /* kThemeScrollBarMedium */ 15, MIN_SLIDER_LENGTH, 26, 14, 14, kControlSizeNormal }; /* * Declarations of static functions defined later in this file: */ static void ScrollbarEventProc(ClientData clientData, XEvent *eventPtr); static int ScrollbarEvent(TkScrollbar *scrollPtr, XEvent *eventPtr); static void UpdateControlValues(TkScrollbar *scrollPtr); /* *---------------------------------------------------------------------- * * TkpCreateScrollbar -- * * Allocate a new TkScrollbar structure. * * Results: * Returns a newly allocated TkScrollbar structure. * * Side effects: * Registers an event handler for the widget. * *---------------------------------------------------------------------- */ TkScrollbar * TkpCreateScrollbar( Tk_Window tkwin) { MacScrollbar *scrollPtr = ckalloc(sizeof(MacScrollbar)); scrollPtr->troughGC = NULL; scrollPtr->copyGC = NULL; scrollPtr->info = defaultInfo; scrollPtr->buttonDown = false; Tk_CreateEventHandler(tkwin, ExposureMask | StructureNotifyMask | FocusChangeMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | VisibilityChangeMask, ScrollbarEventProc, scrollPtr); return (TkScrollbar *) scrollPtr; } /* *-------------------------------------------------------------- * * TkpDisplayScrollbar -- * * This procedure redraws the contents of a scrollbar window. It is * invoked as a do-when-idle handler, so it only runs when there's nothing * else for the application to do. * * Results: * None. * * Side effects: * Draws a scrollbar on the screen. * *-------------------------------------------------------------- */ #if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 /* * This stand-alone drawing function is used on macOS 10.9 and newer because * the HIToolbox does not draw the scrollbar thumb at the expected size on * those systems. The thumb is drawn too large, causing a mouse click on the * thumb to be interpreted as a mouse click in the trough. */ static void drawMacScrollbar( TkScrollbar *scrollPtr, MacScrollbar *msPtr, CGContextRef context) { MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin); NSView *view = TkMacOSXDrawableView(macWin); CGPathRef path; CGPoint inner[2], outer[2], thumbOrigin; CGSize thumbSize; CGRect troughBounds = msPtr->info.bounds; troughBounds.origin.y = [view bounds].size.height - (troughBounds.origin.y + troughBounds.size.height); if (scrollPtr->vertical) { thumbOrigin.x = troughBounds.origin.x + MIN_GAP; thumbOrigin.y = troughBounds.origin.y + scrollPtr->sliderFirst; thumbSize.width = troughBounds.size.width - 2*MIN_GAP + 1; thumbSize.height = scrollPtr->sliderLast - scrollPtr->sliderFirst; inner[0] = troughBounds.origin; inner[1] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height); outer[0] = CGPointMake(inner[0].x + troughBounds.size.width - 1, inner[0].y); outer[1] = CGPointMake(outer[0].x, inner[1].y); } else { thumbOrigin.x = troughBounds.origin.x + scrollPtr->sliderFirst; thumbOrigin.y = troughBounds.origin.y + MIN_GAP; thumbSize.width = scrollPtr->sliderLast - scrollPtr->sliderFirst; thumbSize.height = troughBounds.size.height - 2*MIN_GAP + 1; inner[0] = troughBounds.origin; inner[1] = CGPointMake(inner[0].x + troughBounds.size.width, inner[0].y + 1); outer[0] = CGPointMake(inner[0].x, inner[0].y + troughBounds.size.height); outer[1] = CGPointMake(inner[1].x, outer[0].y); } CGContextSetShouldAntialias(context, false); CGContextSetGrayFillColor(context, 250.0 / 255, 1.0); CGContextFillRect(context, troughBounds); CGContextSetGrayStrokeColor(context, 232.0 / 255, 1.0); CGContextStrokeLineSegments(context, inner, 2); CGContextSetGrayStrokeColor(context, 238.0 / 255, 1.0); CGContextStrokeLineSegments(context, outer, 2); /* * Do not display the thumb unless scrolling is possible. */ if (scrollPtr->firstFraction > 0.0 || scrollPtr->lastFraction < 1.0) { CGRect thumbBounds = {thumbOrigin, thumbSize}; path = CGPathCreateWithRoundedRect(thumbBounds, 4, 4, NULL); CGContextBeginPath(context); CGContextAddPath(context, path); if (msPtr->info.trackInfo.scrollbar.pressState != 0) { CGContextSetGrayFillColor(context, 133.0 / 255, 1.0); } else { CGContextSetGrayFillColor(context, 200.0 / 255, 1.0); } CGContextSetShouldAntialias(context, true); CGContextFillPath(context); CFRelease(path); } } #endif void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { register TkScrollbar *scrollPtr = clientData; MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; register Tk_Window tkwin = scrollPtr->tkwin; TkWindow *winPtr = (TkWindow *) tkwin; TkMacOSXDrawingContext dc; scrollPtr->flags &= ~REDRAW_PENDING; if (tkwin == NULL || !Tk_IsMapped(tkwin)) { return; } MacDrawable *macWin = (MacDrawable *) winPtr->window; NSView *view = TkMacOSXDrawableView(macWin); if ((view == NULL) || (macWin->flags & TK_DO_NOT_DRAW) || !TkMacOSXSetupDrawingContext((Drawable) macWin, NULL, 1, &dc)) { return; } /* * Transform NSView coordinates to CoreGraphics coordinates. */ CGFloat viewHeight = [view bounds].size.height; CGAffineTransform t = { .a = 1, .b = 0, .c = 0, .d = -1, .tx = 0, .ty = viewHeight }; CGContextConcatCTM(dc.context, t); /* * Draw a 3D rectangle to provide a base for the native scrollbar. */ if (scrollPtr->highlightWidth != 0) { GC fgGC, bgGC; bgGC = Tk_GCForColor(scrollPtr->highlightBgColorPtr, (Pixmap) macWin); if (scrollPtr->flags & GOT_FOCUS) { fgGC = Tk_GCForColor(scrollPtr->highlightColorPtr, (Pixmap) macWin); } else { fgGC = bgGC; } TkpDrawHighlightBorder(tkwin, fgGC, bgGC, scrollPtr->highlightWidth, (Pixmap) macWin); } Tk_Draw3DRectangle(tkwin, (Pixmap) macWin, scrollPtr->bgBorder, scrollPtr->highlightWidth, scrollPtr->highlightWidth, Tk_Width(tkwin) - 2*scrollPtr->highlightWidth, Tk_Height(tkwin) - 2*scrollPtr->highlightWidth, scrollPtr->borderWidth, scrollPtr->relief); Tk_Fill3DRectangle(tkwin, (Pixmap) macWin, scrollPtr->bgBorder, scrollPtr->inset, scrollPtr->inset, Tk_Width(tkwin) - 2*scrollPtr->inset, Tk_Height(tkwin) - 2*scrollPtr->inset, 0, TK_RELIEF_FLAT); /* * Update values and then draw the native scrollbar over the rectangle. */ UpdateControlValues(scrollPtr); if (SNOW_LEOPARD_STYLE) { HIThemeDrawTrack(&msPtr->info, 0, dc.context, kHIThemeOrientationInverted); } else if ([NSApp macMinorVersion] <= 8) { HIThemeDrawTrack(&msPtr->info, 0, dc.context, kHIThemeOrientationNormal); } else { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1080 /* * Switch back to NSView coordinates and draw a modern scrollbar. */ CGContextConcatCTM(dc.context, t); drawMacScrollbar(scrollPtr, msPtr, dc.context); #endif } TkMacOSXRestoreDrawingContext(&dc); scrollPtr->flags &= ~REDRAW_PENDING; } /* *---------------------------------------------------------------------- * * TkpComputeScrollbarGeometry -- * * After changes in a scrollbar's size or configuration, this procedure * recomputes various geometry information used in displaying the * scrollbar. * * Results: * None. * * Side effects: * The scrollbar will be displayed differently. * *---------------------------------------------------------------------- */ extern void TkpComputeScrollbarGeometry( register TkScrollbar *scrollPtr) /* Scrollbar whose geometry may have * changed. */ { /* * The code below is borrowed from tkUnixScrlbr.c but has been adjusted to * account for some differences between macOS and X11. The Unix scrollbar * has an arrow button on each end. On macOS 10.6 (Snow Leopard) the * scrollbars by default have both arrow buttons at the bottom or right. * (There is a preferences setting to use the Unix layout, but we are not * supporting that!) On more recent versions of macOS there are no arrow * buttons at all. The case of no arrow buttons can be handled as a special * case of having both buttons at the end, but where scrollPtr->arrowLength * happens to be zero. To adjust for having both arrows at the same end we * shift the scrollbar up by the arrowLength. */ int fieldLength; if (scrollPtr->highlightWidth < 0) { scrollPtr->highlightWidth = 0; } scrollPtr->inset = scrollPtr->highlightWidth + scrollPtr->borderWidth; if ([NSApp macMinorVersion] == 6) { scrollPtr->arrowLength = scrollPtr->width; } else { scrollPtr->arrowLength = 0; } fieldLength = (scrollPtr->vertical ? Tk_Height(scrollPtr->tkwin) : Tk_Width(scrollPtr->tkwin)) - 2*(scrollPtr->arrowLength + scrollPtr->inset); if (fieldLength < 0) { fieldLength = 0; } scrollPtr->sliderFirst = fieldLength*scrollPtr->firstFraction; scrollPtr->sliderLast = fieldLength*scrollPtr->lastFraction; /* * Adjust the slider so that it has at least a minimal size and so there * is a small gap on either end which can be used to scroll by one page. */ if (scrollPtr->sliderFirst < MIN_GAP) { scrollPtr->sliderFirst = MIN_GAP; scrollPtr->sliderLast += MIN_GAP; } if (scrollPtr->sliderLast > fieldLength - MIN_GAP) { scrollPtr->sliderLast = fieldLength - MIN_GAP; scrollPtr->sliderFirst -= MIN_GAP; } if (scrollPtr->sliderFirst > fieldLength - MIN_SLIDER_LENGTH) { scrollPtr->sliderFirst = fieldLength - MIN_SLIDER_LENGTH; } if (scrollPtr->sliderLast < scrollPtr->sliderFirst + MIN_SLIDER_LENGTH) { scrollPtr->sliderLast = scrollPtr->sliderFirst + MIN_SLIDER_LENGTH; } scrollPtr->sliderFirst += -scrollPtr->arrowLength + scrollPtr->inset; scrollPtr->sliderLast += scrollPtr->inset; /* * Register the desired geometry for the window. Leave enough space for the * two arrows, if there are any arrows, plus a minimum-size slider, plus * border around the whole window, if any. Then arrange for the window to * be redisplayed. */ if (scrollPtr->vertical) { Tk_GeometryRequest(scrollPtr->tkwin, scrollPtr->width + 2*scrollPtr->inset, 2*(scrollPtr->arrowLength + scrollPtr->borderWidth + scrollPtr->inset) + metrics.minThumbHeight); } else { Tk_GeometryRequest(scrollPtr->tkwin, 2*(scrollPtr->arrowLength + scrollPtr->borderWidth + scrollPtr->inset) + metrics.minThumbHeight, scrollPtr->width + 2*scrollPtr->inset); } Tk_SetInternalBorder(scrollPtr->tkwin, scrollPtr->inset); } /* *---------------------------------------------------------------------- * * TkpDestroyScrollbar -- * * Free data structures associated with the scrollbar control. * * Results: * None. * * Side effects: * Frees the GCs associated with the scrollbar. * *---------------------------------------------------------------------- */ void TkpDestroyScrollbar( TkScrollbar *scrollPtr) { MacScrollbar *macScrollPtr = (MacScrollbar *) scrollPtr; if (macScrollPtr->troughGC != None) { Tk_FreeGC(scrollPtr->display, macScrollPtr->troughGC); } if (macScrollPtr->copyGC != None) { Tk_FreeGC(scrollPtr->display, macScrollPtr->copyGC); } } /* *---------------------------------------------------------------------- * * TkpConfigureScrollbar -- * * This procedure is called after the generic code has finished processing * configuration options, in order to configure platform specific options. * There are no such option on the Mac, however. * * Results: * None. * * Side effects: * Currently, none. * *---------------------------------------------------------------------- */ void TkpConfigureScrollbar( register TkScrollbar *scrollPtr) { /* empty */ } /* *-------------------------------------------------------------- * * TkpScrollbarPosition -- * * Determine the scrollbar element corresponding to a given position. * |
︙ | ︙ | |||
399 400 401 402 403 404 405 | int TkpScrollbarPosition( register TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { | < | | | | | | | | | | | | | | | | | | | | | > > | > > | | | | | | | | | < | | | > | | | | < | | < < | | | | | > | | | | | > | | < | | | | > > | > | | | | | | | | | | > | | | | > > > | > > | > | > | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 | int TkpScrollbarPosition( register TkScrollbar *scrollPtr, /* Scrollbar widget record. */ int x, int y) /* Coordinates within scrollPtr's window. */ { /* * The code below is borrowed from tkUnixScrlbr.c and needs no adjustment * since it does not involve the arrow buttons. */ int length, width, tmp; register const int inset = scrollPtr->inset; if (scrollPtr->vertical) { length = Tk_Height(scrollPtr->tkwin); width = Tk_Width(scrollPtr->tkwin); } else { tmp = x; x = y; y = tmp; length = Tk_Width(scrollPtr->tkwin); width = Tk_Height(scrollPtr->tkwin); } if (x < inset || x >= width - inset || y < inset || y >= length - inset) { return OUTSIDE; } /* * Here we assume that the scrollbar is layed out with both arrow buttons * at the bottom (or right). Except on 10.6, however, the arrows do not * actually exist, i.e. the arrowLength is 0. These are the same * assumptions which are being made in TkpComputeScrollbarGeometry. */ if (y < scrollPtr->sliderFirst + scrollPtr->arrowLength) { return TOP_GAP; } if (y < scrollPtr->sliderLast) { return SLIDER; } if (y < length - (2*scrollPtr->arrowLength + inset)) { return BOTTOM_GAP; } /* * On systems newer than 10.6 we have already returned. */ if (y < length - (scrollPtr->arrowLength + inset)) { return TOP_ARROW; } return BOTTOM_ARROW; } /* *-------------------------------------------------------------- * * UpdateControlValues -- * * This procedure updates the Macintosh scrollbar control to display the * values defined by the Tk scrollbar. This is the key interface to the * Mac-native scrollbar; the Unix bindings drive scrolling in the Tk * window and all the Mac scrollbar has to do is redraw itself. * * Results: * None. * * Side effects: * The Macintosh control is updated. * *-------------------------------------------------------------- */ static void UpdateControlValues( TkScrollbar *scrollPtr) /* Scrollbar data struct. */ { MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; Tk_Window tkwin = scrollPtr->tkwin; MacDrawable *macWin = (MacDrawable *) Tk_WindowId(scrollPtr->tkwin); double dViewSize; HIRect contrlRect; short width, height; NSView *view = TkMacOSXDrawableView(macWin); CGFloat viewHeight = [view bounds].size.height; NSRect frame; frame = NSMakeRect(macWin->xOff, macWin->yOff, Tk_Width(tkwin), Tk_Height(tkwin)); frame = NSInsetRect(frame, scrollPtr->inset, scrollPtr->inset); frame.origin.y = viewHeight - (frame.origin.y + frame.size.height); contrlRect = NSRectToCGRect(frame); msPtr->info.bounds = contrlRect; width = contrlRect.size.width; height = contrlRect.size.height - scrollPtr->arrowLength; /* * Ensure we set scrollbar control bounds only once all size adjustments * have been computed. */ msPtr->info.bounds = contrlRect; if (scrollPtr->vertical) { msPtr->info.attributes &= ~kThemeTrackHorizontal; } else { msPtr->info.attributes |= kThemeTrackHorizontal; } /* * Given the Tk parameters for the fractions of the start and end of the * thumb, the following calculation determines the location for the * Macintosh thumb. The Aqua scroll control works as follows. The * scrollbar's value is the position of the left (or top) side of the view * area in the content area being scrolled. The maximum value of the * control is therefore the dimension of the content area less the size of * the view area. */ double factor = RangeToFactor(100.0); dViewSize = (scrollPtr->lastFraction - scrollPtr->firstFraction) * factor; msPtr->info.max = factor - dViewSize; msPtr->info.trackInfo.scrollbar.viewsize = dViewSize; if (scrollPtr->vertical) { if (SNOW_LEOPARD_STYLE) { msPtr->info.value = factor * scrollPtr->firstFraction; } else { msPtr->info.value = msPtr->info.max - factor * scrollPtr->firstFraction; } } else { msPtr->info.value = factor * scrollPtr->firstFraction; } if ((scrollPtr->firstFraction <= 0.0 && scrollPtr->lastFraction >= 1.0) || height <= metrics.minHeight) { msPtr->info.enableState = kThemeTrackHideTrack; } else { msPtr->info.enableState = kThemeTrackActive; msPtr->info.attributes = kThemeTrackShowThumb | kThemeTrackThumbRgnIsNotGhost; } } /* *-------------------------------------------------------------- * * ScrollbarEvent -- * * This procedure is invoked in response to <ButtonPress>, * <ButtonRelease>, <EnterNotify>, and <LeaveNotify> events. The * Scrollbar appearance is modified for each event. * *-------------------------------------------------------------- */ static int ScrollbarEvent( TkScrollbar *scrollPtr, XEvent *eventPtr) { MacScrollbar *msPtr = (MacScrollbar *) scrollPtr; /* * The pressState does not indicate whether the moused button was pressed * at some location in the Scrollbar. Rather, it indicates that the * scrollbar should appear as if it were pressed in that location. The * standard Mac behavior is that once the button is pressed inside the * Scrollbar the appearance should not change until the button is released, * even if the mouse moves outside of the scrollbar. However, if the mouse * lies over the scrollbar but the button is not pressed then the * appearance should be the same as if the button had been pressed on the * slider, i.e. kThemeThumbPressed. See the file Appearance.r, or * HIToolbox.bridgesupport on 10.14. */ if (eventPtr->type == ButtonPress) { msPtr->buttonDown = true; UpdateControlValues(scrollPtr); int where = TkpScrollbarPosition(scrollPtr, eventPtr->xbutton.x, eventPtr->xbutton.y); switch (where) { case OUTSIDE: msPtr->info.trackInfo.scrollbar.pressState = 0; break; case TOP_GAP: msPtr->info.trackInfo.scrollbar.pressState = kThemeTopTrackPressed; break; case SLIDER: msPtr->info.trackInfo.scrollbar.pressState = kThemeThumbPressed; break; case BOTTOM_GAP: msPtr->info.trackInfo.scrollbar.pressState = kThemeBottomTrackPressed; break; case TOP_ARROW: /* * This looks wrong and the docs say it is wrong but it works. */ msPtr->info.trackInfo.scrollbar.pressState = kThemeTopInsideArrowPressed; break; case BOTTOM_ARROW: msPtr->info.trackInfo.scrollbar.pressState = kThemeBottomOutsideArrowPressed; break; } } if (eventPtr->type == ButtonRelease) { msPtr->buttonDown = false; if (!msPtr->mouseOver) { msPtr->info.trackInfo.scrollbar.pressState = 0; |
︙ | ︙ | |||
616 617 618 619 620 621 622 623 624 | } if (eventPtr->type == LeaveNotify) { msPtr->mouseOver = false; if (!msPtr->buttonDown) { msPtr->info.trackInfo.scrollbar.pressState = 0; } } return TCL_OK; } | > | < < | | | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | } if (eventPtr->type == LeaveNotify) { msPtr->mouseOver = false; if (!msPtr->buttonDown) { msPtr->info.trackInfo.scrollbar.pressState = 0; } } TkScrollbarEventuallyRedraw(scrollPtr); return TCL_OK; } /* *-------------------------------------------------------------- * * ScrollbarEventProc -- * * This procedure is invoked by the Tk dispatcher for various events on * scrollbars. * * Results: * None. * * Side effects: * When the window gets deleted, internal structures get cleaned up. When * it gets exposed, it is redisplayed. * *-------------------------------------------------------------- */ static void ScrollbarEventProc( ClientData clientData, /* Information about window. */ XEvent *eventPtr) /* Information about event. */ { TkScrollbar *scrollPtr = clientData; switch (eventPtr->type) { case UnmapNotify: TkMacOSXSetScrollbarGrow((TkWindow *) scrollPtr->tkwin, false); break; |
︙ | ︙ | |||
664 665 666 667 668 669 670 | case LeaveNotify: ScrollbarEvent(clientData, eventPtr); break; default: TkScrollbarEventProc(clientData, eventPtr); } } | | | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | case LeaveNotify: ScrollbarEvent(clientData, eventPtr); break; default: TkScrollbarEventProc(clientData, eventPtr); } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXSend.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 | * list. */ } RegisteredInterp; /* * A registry of all interpreters for a display is kept in a property * "InterpRegistry" on the root window of the display. It is organized as a * series of zero or more concatenated strings (in no particular order), each | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | * list. */ } RegisteredInterp; /* * A registry of all interpreters for a display is kept in a property * "InterpRegistry" on the root window of the display. It is organized as a * series of zero or more concatenated strings (in no particular order), each * of the form: * window space name '\0' * where "window" is the hex id of the comm. window to use to talk to an * interpreter named "name". * * When the registry is being manipulated by an application (e.g. to add or * remove an entry), it is loaded into memory using a structure of the * following type: |
︙ | ︙ | |||
74 75 76 77 78 79 80 | * none. See format description above; this is * *not* terminated by the first null * character. Dynamically allocated. */ int allocedByX; /* Non-zero means must free property with * XFree; zero means use ckfree. */ } NameRegistry; | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | * none. See format description above; this is * *not* terminated by the first null * character. Dynamically allocated. */ int allocedByX; /* Non-zero means must free property with * XFree; zero means use ckfree. */ } NameRegistry; static int initialized = 0; /* A flag to denote if we have initialized * yet. */ static RegisteredInterp *interpListPtr = NULL; /* List of all interpreters registered by this * process. */ /* |
︙ | ︙ | |||
321 322 323 324 325 326 327 | int Tk_SendObjCmd( ClientData clientData, /* Used only for deletion */ Tcl_Interp *interp, /* The interp we are sending from */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* The arguments */ { | | | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 | int Tk_SendObjCmd( ClientData clientData, /* Used only for deletion */ Tcl_Interp *interp, /* The interp we are sending from */ int objc, /* Number of arguments */ Tcl_Obj *const objv[]) /* The arguments */ { const char *const sendOptions[] = {"-async", "-displayof", "--", NULL}; char *stringRep, *destName; /*int async = 0;*/ int i, index, firstArg; RegisteredInterp *riPtr; Tcl_Obj *listObjPtr; int result = TCL_OK; |
︙ | ︙ |
Added macosx/tkMacOSXServices.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | /* * tkMacOSXServices.c -- *\ * This file allows the integration of Tk and the Cocoa NSServices API. * * Copyright (c) 2010-2019 Kevin Walzer/WordTech Communications LLC. * Copyright (c) 2010 Adrian Robert. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include <CoreServices/CoreServices.h> #include <tkInt.h> #include <tkMacOSXInt.h> static Tcl_Interp *ServicesInterp; /* * Event proc which calls the PerformService procedure */ static int ServicesEventProc( Tcl_Event *event, int flags) { Tcl_GlobalEval(ServicesInterp, "::tk::mac::PerformService"); return 1; } /* * Class declarations for TkService class. */ @interface TkService : NSView { } + (void) initialize; - (void)provideService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error; - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType; - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types; @end /* * Class methods. */ @implementation TkService + (void) initialize { NSArray *sendTypes = [NSArray arrayWithObjects:@"NSStringPboardType", @"NSPasteboardTypeString", nil]; [NSApp registerServicesMenuSendTypes:sendTypes returnTypes:sendTypes]; return; } - (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType { if ([sendType isEqualToString:@"NSStringPboardType"] || [sendType isEqualToString:@"NSPasteboardTypeString"]) { return self; } return [super validRequestorForSendType:sendType returnType:returnType]; } /* * Make sure the view accepts events. */ - (BOOL)acceptsFirstResponder { return YES; } - (BOOL)becomeFirstResponder { return YES; } /* * Get selected text, copy to pasteboard. */ - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types { NSArray *typesDeclared = nil; NSString *pboardType = nil; for (NSString *typeString in types) { if ([typeString isEqualToString:@"NSStringPboardType"] || [typeString isEqualToString:@"NSPasteboardTypeString"]) { typesDeclared = [NSArray arrayWithObject:typeString]; pboardType = typeString; break; } } if (!typesDeclared) { return NO; } Tcl_Eval(ServicesInterp, "selection get"); char *copystring = Tcl_GetString(Tcl_GetObjResult(ServicesInterp)); NSString *writestring = [NSString stringWithUTF8String:copystring]; [pboard declareTypes:typesDeclared owner:nil]; return [pboard setString:writestring forType:pboardType]; } /* * This is the method that actually calls the Tk service; this is the method * that must be defined in info.plist. */ - (void)provideService:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error { NSString *pboardString = nil, *pboardType = nil; NSArray *types = [pboard types]; Tcl_Event *event; /* * Get string from private pasteboard, write to general pasteboard to make * available to Tcl service. */ for (NSString *typeString in types) { if ([typeString isEqualToString:@"NSStringPboardType"] || [typeString isEqualToString:@"NSPasteboardTypeString"]) { pboardString = [pboard stringForType:typeString]; pboardType = typeString; break; } } if (pboardString) { NSPasteboard *generalpasteboard = [NSPasteboard generalPasteboard]; [generalpasteboard declareTypes:[NSArray arrayWithObjects:pboardType, nil] owner:nil]; [generalpasteboard setString:pboardString forType:pboardType]; event = ckalloc(sizeof(Tcl_Event)); event->proc = ServicesEventProc; Tcl_QueueEvent((Tcl_Event *)event, TCL_QUEUE_TAIL); } } @end /* * Register a specific widget to access the Services menu. */ int TkMacOSXRegisterServiceWidgetObjCmd( ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { /* * Need proper number of args. */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "path?"); return TCL_ERROR; } /* * Get the object that holds this Tk Window... */ Rect bounds; NSRect frame; Tk_Window path = Tk_NameToWindow(interp, Tcl_GetString(objv[1]), Tk_MainWindow(interp)); if (path == NULL) { return TCL_ERROR; } Tk_MakeWindowExist(path); Tk_MapWindow(path); Drawable d = Tk_WindowId(path); /* * Get NSView from Tk window and add subview. */ TkService *serviceview = [[TkService alloc] init]; NSView *view = TkMacOSXGetRootControl(d); if ([serviceview superview] != view) { [view addSubview:serviceview]; } TkMacOSXWinBounds((TkWindow*)path, &bounds); /* * Hack to make sure subview is set to take up entire geometry of window. */ frame = NSMakeRect(bounds.left, bounds.top, 100000, 100000); frame.origin.y = 0; if (!NSEqualRects(frame, [serviceview frame])) { [serviceview setFrame:frame]; } [serviceview release]; return TCL_OK; } /* * Initalize the package in the Tcl interpreter, create Tcl commands. */ int TkMacOSXServices_Init( Tcl_Interp *interp) { /* * Initialize instance of TclServices to provide service functionality. */ TkService *service = [[TkService alloc] init]; ServicesInterp = interp; [NSApp setServicesProvider:service]; return TCL_OK; } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXSubwindows.c.
︙ | ︙ | |||
61 62 63 64 65 66 67 | * deleting is being tracked by the grab code. */ TkPointerDeadWindow(macWin->winPtr); TkMacOSXSelDeadWindow(macWin->winPtr); macWin->toplevel->referenceCount--; | | > > > > > > | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | * deleting is being tracked by the grab code. */ TkPointerDeadWindow(macWin->winPtr); TkMacOSXSelDeadWindow(macWin->winPtr); macWin->toplevel->referenceCount--; if (!Tk_IsTopLevel(macWin->winPtr)) { TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); if (macWin->winPtr->parentPtr != NULL) { TkMacOSXInvalClipRgns((Tk_Window) macWin->winPtr->parentPtr); } if (macWin->visRgn) { CFRelease(macWin->visRgn); macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } if (macWin->toplevel->referenceCount == 0) { ckfree(macWin->toplevel); } ckfree(macWin); return; } if (macWin->visRgn) { CFRelease(macWin->visRgn); macWin->visRgn = NULL; } if (macWin->aboveVisRgn) { CFRelease(macWin->aboveVisRgn); macWin->aboveVisRgn = NULL; } if (macWin->drawRgn) { CFRelease(macWin->drawRgn); macWin->drawRgn = NULL; } macWin->view = nil; /* * Delay deletion of a toplevel data structure untill all children have * been deleted. */ |
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | void XMapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; XEvent event; /* * Under certain situations it's possible for this function to be called * before the toplevel window it's associated with has actually been * mapped. In that case we need to create the real Macintosh window now as * this function as well as other X functions assume that the portPtr is * valid. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } display->request++; | > > | | | | | | < | | | > | | > > | | > | | > | < > | > | > > > > | < < < < < < < | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | void XMapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; NSWindow *win = TkMacOSXDrawableWindow(window); XEvent event; /* * Under certain situations it's possible for this function to be called * before the toplevel window it's associated with has actually been * mapped. In that case we need to create the real Macintosh window now as * this function as well as other X functions assume that the portPtr is * valid. */ if (!TkMacOSXHostToplevelExists(macWin->toplevel->winPtr)) { TkMacOSXMakeRealWindowExist(macWin->toplevel->winPtr); } display->request++; winPtr->flags |= TK_MAPPED; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr)) { /* * We want to activate Tk when a toplevel is mapped but we must not * supply YES here. This is because during Tk initialization the * root window is mapped before applicationDidFinishLaunching * returns. Forcing the app to activate too early can make the menu * bar unresponsive. */ TkMacOSXApplyWindowAttributes(winPtr, win); [win setExcludedFromWindowsMenu:NO]; [NSApp activateIgnoringOtherApps:NO]; [[win contentView] setNeedsDisplay:YES]; if ([win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } else { [win orderFrontRegardless]; } } else { TkWindow *contWinPtr = TkpGetOtherWindow(winPtr); /* * Rebuild the container's clipping region and display * the window. */ TkMacOSXInvalClipRgns((Tk_Window) contWinPtr); TkMacOSXInvalidateWindow(macWin, TK_PARENT_WINDOW); } TkMacOSXInvalClipRgns((Tk_Window) winPtr); /* * We only need to send the MapNotify event for toplevel windows. */ event.xany.serial = LastKnownRequestProcessed(display); event.xany.send_event = False; event.xany.display = display; event.xmap.window = window; event.xmap.type = MapNotify; event.xmap.event = window; event.xmap.override_redirect = winPtr->atts.override_redirect; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { /* * For non-toplevel windows, rebuild the parent's clipping region * and redisplay the window. */ TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); } if ([NSApp isDrawing]) { [[win contentView] setNeedsRedisplay:YES]; } else { [[win contentView] setNeedsDisplay:YES]; } /* * Generate VisibilityNotify events for window and all mapped children. */ event.xany.send_event = False; event.xany.display = display; event.xvisibility.type = VisibilityNotify; event.xvisibility.state = VisibilityUnobscured; NotifyVisibility(winPtr, &event); } /* *---------------------------------------------------------------------- * * NotifyVisibility -- * |
︙ | ︙ | |||
273 274 275 276 277 278 279 280 281 282 283 284 285 | XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; XEvent event; display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && winPtr->wmInfoPtr->hints.initial_state!=IconicState) { | > < < < < | < < | > | > | > > > > > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | XUnmapWindow( Display *display, /* Display. */ Window window) /* Window. */ { MacDrawable *macWin = (MacDrawable *) window; TkWindow *winPtr = macWin->winPtr; TkWindow *parentPtr = winPtr->parentPtr; NSWindow *win = TkMacOSXDrawableWindow(window); XEvent event; display->request++; if (Tk_IsTopLevel(winPtr)) { if (!Tk_IsEmbedded(winPtr) && winPtr->wmInfoPtr->hints.initial_state!=IconicState) { [win orderOut:nil]; } TkMacOSXInvalClipRgns((Tk_Window) winPtr); /* * We only need to send the UnmapNotify event for toplevel windows. */ event.xany.serial = LastKnownRequestProcessed(display); event.xany.send_event = False; event.xany.display = display; event.xunmap.type = UnmapNotify; event.xunmap.window = window; event.xunmap.event = window; event.xunmap.from_configure = false; Tk_QueueWindowEvent(&event, TCL_QUEUE_TAIL); } else { /* * Rebuild the visRgn clip region for the parent so it will be allowed * to draw in the space from which this subwindow was removed and then * redraw the window. */ if (parentPtr && parentPtr->privatePtr->visRgn) { TkMacOSXInvalidateViewRegion( TkMacOSXDrawableView(parentPtr->privatePtr), parentPtr->privatePtr->visRgn); } TkMacOSXInvalClipRgns((Tk_Window) parentPtr); TkMacOSXUpdateClipRgn(parentPtr); } winPtr->flags &= ~TK_MAPPED; if ([NSApp isDrawing]) { [[win contentView] setNeedsRedisplay:YES]; } else { [[win contentView] setNeedsDisplay:YES]; } } /* *---------------------------------------------------------------------- * * XResizeWindow -- * |
︙ | ︙ | |||
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | XResizeWindow( Display *display, /* Display. */ Window window, /* Window. */ unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { NSRect r = [w contentRectForFrameRect:[w frame]]; r.origin.y += r.size.height - height; r.size.width = width; r.size.height = height; [w setFrame:[w frameRectForContentRect:r] display:YES]; } } else { MoveResizeWindow(macWin); } } /* *---------------------------------------------------------------------- * * XMoveResizeWindow -- * | > > > | | | 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | XResizeWindow( Display *display, /* Display. */ Window window, /* Window. */ unsigned int width, unsigned int height) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { NSRect r = [w contentRectForFrameRect:[w frame]]; r.origin.y += r.size.height - height; r.size.width = width; r.size.height = height; [w setFrame:[w frameRectForContentRect:r] display:YES]; } } else { MoveResizeWindow(macWin); } } /* *---------------------------------------------------------------------- * * XMoveResizeWindow -- * * Move or resize a given X window. See X windows documentation for * further details. * * Results: * None. * * Side effects: * None. * |
︙ | ︙ | |||
388 389 390 391 392 393 394 395 | unsigned int height) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { | > | | | | | | | | | | | > | < | 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | unsigned int height) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { /* * We explicitly convert everything to doubles so we don't get * surprised (again) by what happens when you do arithmetic with * unsigned ints. */ CGFloat X = (CGFloat) x; CGFloat Y = (CGFloat) y; CGFloat Width = (CGFloat) width; CGFloat Height = (CGFloat) height; CGFloat XOff = (CGFloat) macWin->winPtr->wmInfoPtr->xInParent; CGFloat YOff = (CGFloat) macWin->winPtr->wmInfoPtr->yInParent; NSRect r = NSMakeRect( X + XOff, tkMacOSXZeroScreenHeight - Y - YOff - Height, Width, Height); [w setFrame:[w frameRectForContentRect:r] display:YES]; } } else { MoveResizeWindow(macWin); } } /* *---------------------------------------------------------------------- * * XMoveWindow -- * * Move a given X window. See X windows documentation for further details. * * Results: * None. * * Side effects: * None. * |
︙ | ︙ | |||
439 440 441 442 443 444 445 446 | int x, int y) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { | > | > | 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | int x, int y) { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { NSWindow *w = macWin->winPtr->wmInfoPtr->window; if (w) { [w setFrameTopLeftPoint: NSMakePoint( x, tkMacOSXZeroScreenHeight - y)]; } } else { MoveResizeWindow(macWin); } } /* |
︙ | ︙ | |||
481 482 483 484 485 486 487 | if (Tk_IsEmbedded(macWin->winPtr)) { TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr); if (contWinPtr) { macParent = contWinPtr->privatePtr; } else { | < < | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | if (Tk_IsEmbedded(macWin->winPtr)) { TkWindow *contWinPtr = TkpGetOtherWindow(macWin->winPtr); if (contWinPtr) { macParent = contWinPtr->privatePtr; } else { /* * Here we should handle out of process embedding. At this point, * we are assuming that the changes.x,y is not maintained, if you * need the info get it from Tk_GetRootCoords, and that the * toplevel sits at 0,0 when it is drawn. */ } } else { /* * TODO: update all xOff & yOffs */ macParent = macWin->winPtr->parentPtr->privatePtr; parentBorderwidth = macWin->winPtr->parentPtr->changes.border_width; } |
︙ | ︙ | |||
582 583 584 585 586 587 588 | { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Above, NULL); } else { | < | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 | { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Above, NULL); } else { /* * TODO: this should generate damage */ } } #if 0 |
︙ | ︙ | |||
617 618 619 620 621 622 623 | { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Below, NULL); } else { | < | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | { MacDrawable *macWin = (MacDrawable *) window; display->request++; if (Tk_IsTopLevel(macWin->winPtr) && !Tk_IsEmbedded(macWin->winPtr)) { TkWmRestackToplevel(macWin->winPtr, Below, NULL); } else { /* * TODO: this should generate damage */ } } #endif |
︙ | ︙ | |||
680 681 682 683 684 685 686 | Rect bounds; NSRect r; if (view) { TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); TkMacOSXWinBounds(winPtr, &bounds); r = NSMakeRect(bounds.left, | | | > | | > | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 | Rect bounds; NSRect r; if (view) { TkMacOSXInvalClipRgns((Tk_Window) winPtr->parentPtr); TkMacOSXWinBounds(winPtr, &bounds); r = NSMakeRect(bounds.left, [view bounds].size.height - bounds.bottom, bounds.right - bounds.left, bounds.bottom - bounds.top); [view setNeedsDisplayInRect:r]; } } #if 0 TkGenWMMoveRequestEvent(macWin->winPtr, macWin->winPtr->changes.x, macWin->winPtr->changes.y); #endif } /* *---------------------------------------------------------------------- * * TkMacOSXSetDrawingEnabled -- * |
︙ | ︙ | |||
709 710 711 712 713 714 715 | * The clipping regions for the window and its children are cleared. * *---------------------------------------------------------------------- */ void TkMacOSXSetDrawingEnabled( | | | | | | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | * The clipping regions for the window and its children are cleared. * *---------------------------------------------------------------------- */ void TkMacOSXSetDrawingEnabled( TkWindow *winPtr, int flag) { TkWindow *childPtr; MacDrawable *macWin = winPtr->privatePtr; if (macWin) { if (flag) { macWin->flags &= ~TK_DO_NOT_DRAW; } else { macWin->flags |= TK_DO_NOT_DRAW; } } /* * Set the flag for all children & their descendants, excluding Toplevels. * (??? Do we need to exclude Toplevels?) */ childPtr = winPtr->childList; while (childPtr) { if (!Tk_IsTopLevel(childPtr)) { TkMacOSXSetDrawingEnabled(childPtr, flag); } |
︙ | ︙ | |||
889 890 891 892 893 894 895 | if (!HIShapeIsEmpty(diffRgn)) { macWin->visRgn = HIShapeCreateCopy(rgn); } CFRelease(diffRgn); } CFRelease(rgn); } else { | < | 905 906 907 908 909 910 911 912 913 914 915 916 917 918 | if (!HIShapeIsEmpty(diffRgn)) { macWin->visRgn = HIShapeCreateCopy(rgn); } CFRelease(diffRgn); } CFRelease(rgn); } else { /* * An unmapped window has empty clip regions to prevent any * (erroneous) drawing into it or its children from becoming * visible. [Bug 940117] */ if (!Tk_IsTopLevel(winPtr)) { |
︙ | ︙ | |||
919 920 921 922 923 924 925 | /* *---------------------------------------------------------------------- * * TkMacOSXVisableClipRgn -- * * This function returns the Macintosh clipping region for the given | | | | | > > > > > | 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 | /* *---------------------------------------------------------------------- * * TkMacOSXVisableClipRgn -- * * This function returns the Macintosh clipping region for the given * window. The caller is responsible for disposing of the returned region * via TkDestroyRegion(). * * Results: * The region. * * Side effects: * None. * *---------------------------------------------------------------------- */ TkRegion TkMacOSXVisableClipRgn( TkWindow *winPtr) { if (winPtr->privatePtr->flags & TK_CLIP_INVALID) { TkMacOSXUpdateClipRgn(winPtr); } return (TkRegion) HIShapeCreateMutableCopy(winPtr->privatePtr->visRgn); } /* *---------------------------------------------------------------------- * * TkMacOSXInvalidateViewRegion -- * * This function invalidates the given region of a view. * * Results: * None. * * Side effects: * Damage is created. * *---------------------------------------------------------------------- */ static OSStatus InvalViewRect( int msg, HIShapeRef rgn, const CGRect *rect, void *ref) { static CGAffineTransform t; NSView *view = ref; if (!view) { return paramErr; } switch (msg) { |
︙ | ︙ | |||
1038 1039 1040 1041 1042 1043 1044 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | > | 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | * * Side effects: * None. * *---------------------------------------------------------------------- */ NSWindow * TkMacOSXDrawableWindow( Drawable drawable) { MacDrawable *macWin = (MacDrawable *) drawable; NSWindow *result = nil; if (!macWin || macWin->flags & TK_IS_PIXMAP) { result = nil; } else if (macWin->toplevel && macWin->toplevel->winPtr && macWin->toplevel->winPtr->wmInfoPtr && macWin->toplevel->winPtr->wmInfoPtr->window) { result = macWin->toplevel->winPtr->wmInfoPtr->window; } else if (macWin->winPtr && macWin->winPtr->wmInfoPtr && macWin->winPtr->wmInfoPtr->window) { result = macWin->winPtr->wmInfoPtr->window; } else if (macWin->toplevel && (macWin->toplevel->flags & TK_EMBEDDED)) { TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { result = TkMacOSXDrawableWindow((Drawable) contWinPtr->privatePtr); } } return result; } |
︙ | ︙ | |||
1109 1110 1111 1112 1113 1114 1115 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | > | 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 | * * Side effects: * None. * *---------------------------------------------------------------------- */ NSView * TkMacOSXDrawableView( MacDrawable *macWin) { NSView *result = nil; if (!macWin) { result = nil; } else if (!macWin->toplevel) { result = macWin->view; } else if (!(macWin->toplevel->flags & TK_EMBEDDED)) { result = macWin->toplevel->view; } else { TkWindow *contWinPtr = TkpGetOtherWindow(macWin->toplevel->winPtr); if (contWinPtr) { result = TkMacOSXDrawableView(contWinPtr->privatePtr); } } return result; } |
︙ | ︙ | |||
1150 1151 1152 1153 1154 1155 1156 | *---------------------------------------------------------------------- */ void * TkMacOSXGetRootControl( Drawable drawable) { | < | 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 | *---------------------------------------------------------------------- */ void * TkMacOSXGetRootControl( Drawable drawable) { /* * will probably need to fix this up for embedding */ return TkMacOSXDrawableView((MacDrawable *) drawable); } |
︙ | ︙ | |||
1267 1268 1269 1270 1271 1272 1273 | */ void TkMacOSXWinBounds( TkWindow *winPtr, void *bounds) { | | > | 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | */ void TkMacOSXWinBounds( TkWindow *winPtr, void *bounds) { Rect *b = (Rect *) bounds; b->left = winPtr->privatePtr->xOff; b->top = winPtr->privatePtr->yOff; b->right = b->left + winPtr->changes.width; b->bottom = b->top + winPtr->changes.height; } /* |
︙ | ︙ | |||
1310 1311 1312 1313 1314 1315 1316 | /* *---------------------------------------------------------------------- * * UpdateOffsets -- * * Updates the X & Y offsets of the given TkWindow from the TopLevel it is | | < | 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | /* *---------------------------------------------------------------------- * * UpdateOffsets -- * * Updates the X & Y offsets of the given TkWindow from the TopLevel it is * a descendant of. * * Results: * None. * * Side effects: * The xOff & yOff fields for the Mac window datastructure is updated to * the proper offset. * *---------------------------------------------------------------------- */ static void UpdateOffsets( TkWindow *winPtr, int deltaX, int deltaY) { TkWindow *childPtr; if (winPtr->privatePtr == NULL) { /* * We haven't called Tk_MakeWindowExist for this window yet. The offset * information will be postponed and calulated at that time. (This will * usually only happen when a mapped parent is being moved but has * child windows that have yet to be mapped.) */ |
︙ | ︙ |
Changes to macosx/tkMacOSXTest.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 21 | #include "tkMacOSXPrivate.h" /* * Forward declarations of procedures defined later in this file: */ static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp, | > | > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include "tkMacOSXPrivate.h" /* * Forward declarations of procedures defined later in this file: */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 static int DebuggerObjCmd (ClientData dummy, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); #endif /* *---------------------------------------------------------------------- * * TkplatformtestInit -- * * Defines commands that test platform specific functionality for |
︙ | ︙ | |||
42 43 44 45 46 47 48 | TkplatformtestInit( Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ | > | < > | > > > | | | | | > | > | < | > > | > | > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | TkplatformtestInit( Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 Tcl_CreateObjCommand(interp, "debugger", DebuggerObjCmd, NULL, NULL); #endif return TCL_OK; } /* *---------------------------------------------------------------------- * * DebuggerObjCmd -- * * This procedure simply calls the low level debugger, which was * deprecated in OSX 10.8. * * Results: * A standard Tcl result. * * Side effects: * None. * *---------------------------------------------------------------------- */ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1080 static int DebuggerObjCmd( ClientData clientData, /* Not used. */ Tcl_Interp *interp, /* Not used. */ int objc, /* Not used. */ Tcl_Obj *const objv[]) /* Not used. */ { Debugger(); return TCL_OK; } #endif /* *---------------------------------------------------------------------- * * TkTestLogDisplay -- * * The test image display procedure calls this to determine whether it * should write a log message recording that it has being run. On OSX * 10.14 and later, only calls to the display procedure which occur inside * of the drawRect method should be logged, since those are the only ones * which actually draw anything. On earlier systems the opposite is true. * The calls from within the drawRect method are redundant, since the * first time the display procedure is run it will do the drawing and that * first call will usually not occur inside of drawRect. * * Results: * On OSX 10.14 and later, returns true if and only if called from * within [NSView drawRect]. On earlier systems returns false if * and only if called from with [NSView drawRect]. * * Side effects: * None * *---------------------------------------------------------------------- */ MODULE_SCOPE Bool TkTestLogDisplay(void) { if ([NSApp macMinorVersion] >= 14) { return [NSApp isDrawing]; } else { return ![NSApp isDrawing]; } } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to macosx/tkMacOSXWindowEvent.c.
︙ | ︙ | |||
64 65 66 67 68 69 70 | - (void) windowBoundsChanged: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif BOOL movedOnly = [[notification name] | | < < | < < < < < < < < < < < < < < < | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | - (void) windowBoundsChanged: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif BOOL movedOnly = [[notification name] isEqualToString:NSWindowDidMoveNotification]; NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect bounds = [w frame]; int x, y, width = -1, height = -1, flags = 0; x = bounds.origin.x; y = tkMacOSXZeroScreenHeight - (bounds.origin.y + bounds.size.height); if (winPtr->changes.x != x || winPtr->changes.y != y) { flags |= TK_LOCATION_CHANGED; } else { x = y = -1; } if (!movedOnly && (winPtr->changes.width != bounds.size.width || winPtr->changes.height != bounds.size.height)) { width = bounds.size.width - wmPtr->xInParent; height = bounds.size.height - wmPtr->yInParent; flags |= TK_SIZE_CHANGED; } if (Tcl_GetServiceMode() != TCL_SERVICE_NONE) { /* * Propagate geometry changes immediately. */ flags |= TK_MACOSX_HANDLE_EVENT_IMMEDIATELY; } TkGenWMConfigureEvent((Tk_Window) winPtr, x, y, width, height, flags); } } - (void) windowExpanded: (NSNotification *) notification { |
︙ | ︙ | |||
152 153 154 155 156 157 158 | } } } - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame { | < | | | < | | | < > | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | } } } - (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame { /* * This method needs to be implemented in order for [NSWindow isZoomed] to * give the correct answer. But it suffices to always validate every * request. */ return newFrame; } - (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize { /* * We don't need to change the proposed size, but we do need to implement * this method. Otherwise the full screen window will be sized to the * screen's visibleFrame, leaving black bands at the top and bottom. */ return proposedSize; } - (void) windowEnteredFullScreen: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); |
︙ | ︙ | |||
213 214 215 216 217 218 219 | #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w); #endif TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { TkGenWMDestroyEvent((Tk_Window) winPtr); | < < < < | | < | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, w); #endif TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { TkGenWMDestroyEvent((Tk_Window) winPtr); } /* * If necessary, TkGenWMDestroyEvent() handles [close]ing the window, so * can always return NO from -windowShouldClose: for a Tk window. */ return (winPtr ? NO : YES); } #ifdef TK_MAC_DEBUG_NOTIFICATIONS - (void) windowDragStart: (NSNotification *) notification { TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); } |
︙ | ︙ | |||
267 268 269 270 271 272 273 | NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { //Tk_UnmapWindow((Tk_Window) winPtr); } } | < | 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | NSWindow *w = [notification object]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { //Tk_UnmapWindow((Tk_Window) winPtr); } } #endif /* TK_MAC_DEBUG_NOTIFICATIONS */ - (void) _setupWindowNotifications { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; |
︙ | ︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 | - (void) applicationActivate: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [NSApp tkCheckPasteboard]; } - (void) applicationDeactivate: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif | > > > > > > > > > > > > > > > > | 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | - (void) applicationActivate: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif [NSApp tkCheckPasteboard]; /* * When the application is activated with Command-Tab it will create a * zombie window for every Tk window which has been withdrawn. So iterate * through the list of windows and order out any withdrawn window. */ for (NSWindow *win in [NSApp windows]) { TkWindow *winPtr = TkMacOSXGetTkWindow(win); if (!winPtr || !winPtr->wmInfoPtr) { continue; } if (winPtr->wmInfoPtr->hints.initial_state == WithdrawnState) { [win orderOut:nil]; } } } - (void) applicationDeactivate: (NSNotification *) notification { #ifdef TK_MAC_DEBUG_NOTIFICATIONS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd, notification); #endif |
︙ | ︙ | |||
375 376 377 378 379 380 381 | #pragma mark - /* *---------------------------------------------------------------------- * * TkpAppIsDrawing -- * | | | | | | > < | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | #pragma mark - /* *---------------------------------------------------------------------- * * TkpAppIsDrawing -- * * A widget display procedure can call this to determine whether it is * being run inside of the drawRect method. This is needed for some tests, * especially of the Text widget, which record data in a global Tcl * variable and assume that display procedures will be run in a * predictable sequence as Tcl idle tasks. * * Results: * True only while running the drawRect method of a TKContentView; * * Side effects: * None * *---------------------------------------------------------------------- */ MODULE_SCOPE Bool TkpAppIsDrawing(void) { return [NSApp isDrawing]; } /* *---------------------------------------------------------------------- * * GenerateUpdates -- * * Given a Macintosh update region and a Tk window this function geneates |
︙ | ︙ | |||
519 520 521 522 523 524 525 | int GenerateActivateEvents( TkWindow *winPtr, int activeFlag) { TkGenerateActivateEvents(winPtr, activeFlag); | > | > | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | int GenerateActivateEvents( TkWindow *winPtr, int activeFlag) { TkGenerateActivateEvents(winPtr, activeFlag); if (activeFlag || ![NSApp isActive]) { TkMacOSXGenerateFocusEvent(winPtr, activeFlag); } return true; } /* *---------------------------------------------------------------------- * * DoWindowActivate -- |
︙ | ︙ | |||
676 677 678 679 680 681 682 | */ if (Tk_IsTopLevel(winPtr)) { wmPtr = winPtr->wmInfoPtr; if (flags & TK_LOCATION_CHANGED) { wmPtr->x = x; wmPtr->y = y; | < < < < < < | 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | */ if (Tk_IsTopLevel(winPtr)) { wmPtr = winPtr->wmInfoPtr; if (flags & TK_LOCATION_CHANGED) { wmPtr->x = x; wmPtr->y = y; } if ((flags & TK_SIZE_CHANGED) && !(wmPtr->flags & WM_SYNC_PENDING) && ((width != Tk_Width(tkwin)) || (height != Tk_Height(tkwin)))) { if ((wmPtr->width == -1) && (width == winPtr->reqWidth)) { /* * Don't set external width, since the user didn't change it * from what the widgets asked for. */ } else if (wmPtr->gridWin != NULL) { wmPtr->width = wmPtr->reqGridWidth + (width - winPtr->reqWidth)/wmPtr->widthInc; if (wmPtr->width < 0) { wmPtr->width = 0; } } else { wmPtr->width = width; } if ((wmPtr->height == -1) && (height == winPtr->reqHeight)) { /* * Don't set external height, since the user didn't change it * from what the widgets asked for. */ } else if (wmPtr->gridWin != NULL) { wmPtr->height = wmPtr->reqGridHeight + (height - winPtr->reqHeight)/wmPtr->heightInc; if (wmPtr->height < 0) { wmPtr->height = 0; } } else { wmPtr->height = height; } wmPtr->configWidth = width; wmPtr->configHeight = height; } } /* * Now set up the changes structure. Under X we wait for the * ConfigureNotify to set these values. On the Mac we know imediatly that * this is what we want - so we just set them. However, we need to make * sure the windows clipping region is marked invalid so the change is * visible to the subwindow. |
︙ | ︙ | |||
877 878 879 880 881 882 883 | * Widgets it was necessary to use Apple private API calls. In order to avoid * using private API calls, the NSView-based widgets have been replaced with * normal Tk widgets which draw themselves as native widgets by using the * HITheme API. * */ | > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 | * Widgets it was necessary to use Apple private API calls. In order to avoid * using private API calls, the NSView-based widgets have been replaced with * normal Tk widgets which draw themselves as native widgets by using the * HITheme API. * */ /* * Restrict event processing to Expose events. */ static Tk_RestrictAction ExposeRestrictProc( ClientData arg, XEvent *eventPtr) { return (eventPtr->type==Expose && eventPtr->xany.serial==PTR2UINT(arg) ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } /* * Restrict event processing to ConfigureNotify events. */ static Tk_RestrictAction ConfigureRestrictProc( ClientData arg, XEvent *eventPtr) { return (eventPtr->type==ConfigureNotify ? TK_PROCESS_EVENT : TK_DEFER_EVENT); } /* * If a window gets mapped inside the drawRect method, this will be run as an * idle task, after drawRect returns, to clean up the mess. */ static void RedisplayView( ClientData clientdata) { NSView *view = (NSView *) clientdata; /* * Make sure that we are not trying to displaying a view that no longer * exists. */ for (NSWindow *w in [NSApp orderedWindows]) { if ([w contentView] == view) { [view setNeedsDisplay:YES]; break; } } } @implementation TKContentView(TKWindowEvent) - (void) drawRect: (NSRect) rect { const NSRect *rectsBeingDrawn; NSInteger rectsBeingDrawnCount; #ifdef TK_MAC_DEBUG_DRAWING TkWindow *winPtr = TkMacOSXGetTkWindow([self window]); if (winPtr) fprintf(stderr, "drawRect: drawing %s\n", Tk_PathName(winPtr)); #endif /* * We do not allow recursive calls to drawRect, but we only log them on OSX * > 10.13, where they should never happen. */ if ([NSApp isDrawing]) { if ([NSApp macMinorVersion] > 13) { TKLog(@"WARNING: a recursive call to drawRect was aborted."); } return; |
︙ | ︙ | |||
941 942 943 944 945 946 947 948 949 950 951 952 953 954 | r.origin.y = height - (r.origin.y + r.size.height); HIShapeUnionWithRect(drawShape, &r); } [self generateExposeEvents:(HIShapeRef)drawShape]; CFRelease(drawShape); [NSApp setIsDrawing: NO]; #ifdef TK_MAC_DEBUG_DRAWING fprintf(stderr, "drawRect: done.\n"); #endif } -(void) setFrameSize: (NSSize)newsize | > > > > > | 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 | r.origin.y = height - (r.origin.y + r.size.height); HIShapeUnionWithRect(drawShape, &r); } [self generateExposeEvents:(HIShapeRef)drawShape]; CFRelease(drawShape); [NSApp setIsDrawing: NO]; if ([self needsRedisplay]) { [self setNeedsRedisplay:NO]; Tcl_DoWhenIdle(RedisplayView, self); } #ifdef TK_MAC_DEBUG_DRAWING fprintf(stderr, "drawRect: done.\n"); #endif } -(void) setFrameSize: (NSSize)newsize |
︙ | ︙ | |||
966 967 968 969 970 971 972 | if (winPtr) { unsigned int width = (unsigned int)newsize.width; unsigned int height=(unsigned int)newsize.height; ClientData oldArg; Tk_RestrictProc *oldProc; /* | | | | | | 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 | if (winPtr) { unsigned int width = (unsigned int)newsize.width; unsigned int height=(unsigned int)newsize.height; ClientData oldArg; Tk_RestrictProc *oldProc; /* * This can be called from outside the Tk event loop. Since it calls * Tcl_DoOneEvent, we need to make sure we don't clobber the * AutoreleasePool set up by the caller. */ [NSApp _lockAutoreleasePool]; /* * Disable Tk drawing until the window has been completely configured. */ TkMacOSXSetDrawingEnabled(winPtr, 0); /* * Generate and handle a ConfigureNotify event for the new size. */ TkGenWMConfigureEvent(tkwin, Tk_X(tkwin), Tk_Y(tkwin), width, height, TK_SIZE_CHANGED | TK_MACOSX_HANDLE_EVENT_IMMEDIATELY); oldProc = Tk_RestrictEvents(ConfigureRestrictProc, NULL, &oldArg); Tk_RestrictEvents(oldProc, oldArg, &oldArg); /* * Now that Tk has configured all subwindows, create the clip regions. */ |
︙ | ︙ | |||
1072 1073 1074 1075 1076 1077 1078 | * were created when the expose events were processed. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } } /* | | | | < | | < < | < | < < > | | | 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 | * were created when the expose events were processed. */ while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) {} } } /* * This method is called when a user changes between light and dark mode. The * implementation here generates a Tk virtual event which can be bound to a * function that redraws the window in an appropriate style. */ - (void) viewDidChangeEffectiveAppearance { XVirtualEvent event; int x, y; NSWindow *w = [self window]; TkWindow *winPtr = TkMacOSXGetTkWindow(w); Tk_Window tkwin = (Tk_Window) winPtr; if (!winPtr) { return; } bzero(&event, sizeof(XVirtualEvent)); event.type = VirtualEvent; event.serial = LastKnownRequestProcessed(Tk_Display(tkwin)); event.send_event = false; event.display = Tk_Display(tkwin); event.event = Tk_WindowId(tkwin); event.root = XRootWindow(Tk_Display(tkwin), 0); event.subwindow = None; event.time = TkpGetMS(); XQueryPointer(NULL, winPtr->window, NULL, NULL, &event.x_root, &event.y_root, &x, &y, &event.state); Tk_TopCoordsToWindow(tkwin, x, y, &event.x, &event.y); event.same_screen = true; if (TkMacOSXInDarkMode(tkwin)) { event.name = Tk_GetUid("DarkAqua"); } else { event.name = Tk_GetUid("LightAqua"); } Tk_QueueWindowEvent((XEvent *) &event, TCL_QUEUE_TAIL); } /* * This is no-op on 10.7 and up because Apple has removed this widget, but we * are leaving it here for backwards compatibility. */ - (void) tkToolbarButton: (id) sender { #ifdef TK_MAC_DEBUG_EVENTS TKLog(@"-[%@(%p) %s] %@", [self class], self, _cmd); #endif |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.c.
1 2 3 4 5 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements | | < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkMacOSXWm.c -- * * This module takes care of the interactions between a Tk-based * application and the window manager. Among other things, it implements * the "wm" command and passes geometry information to the window manager. * * Copyright (c) 1994-1997 Sun Microsystems, Inc. * Copyright 2001-2009, Apple Inc. * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright (c) 2010 Kevin Walzer/WordTech Communications LLC. * Copyright (c) 2017-2019 Marc Culler. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkMacOSXPrivate.h" #include "tkScrollbar.h" |
︙ | ︙ | |||
50 51 52 53 54 55 56 | | kWindowNoActivatesAttribute | kWindowHideOnSuspendAttribute \ | kWindowHideOnFullScreenAttribute | kWindowNoConstrainAttribute \ | kWindowNoShadowAttribute | kWindowLiveResizeAttribute \ | kWindowOpaqueForEventsAttribute | kWindowIgnoreClicksAttribute \ | kWindowDoesNotCycleAttribute | tkWindowDoesNotHideAttribute \ | tkCanJoinAllSpacesAttribute | tkMoveToActiveSpaceAttribute \ | tkNonactivatingPanelAttribute | tkHUDWindowAttribute) | < | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | | kWindowNoActivatesAttribute | kWindowHideOnSuspendAttribute \ | kWindowHideOnFullScreenAttribute | kWindowNoConstrainAttribute \ | kWindowNoShadowAttribute | kWindowLiveResizeAttribute \ | kWindowOpaqueForEventsAttribute | kWindowIgnoreClicksAttribute \ | kWindowDoesNotCycleAttribute | tkWindowDoesNotHideAttribute \ | tkCanJoinAllSpacesAttribute | tkMoveToActiveSpaceAttribute \ | tkNonactivatingPanelAttribute | tkHUDWindowAttribute) static const struct { const UInt64 validAttrs, defaultAttrs, forceOnAttrs, forceOffAttrs; int flags; NSUInteger styleMask; } macClassAttrs[] = { [kAlertWindowClass] = { .defaultAttrs = kWindowDoesNotCycleAttribute, }, |
︙ | ︙ | |||
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); static int WmWinStyle(Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj *const objv[]); static int WmWinTabbingId(Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj *const objv[]); static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr, NSWindow *macWindow, UInt64 oldAttributes, int oldFlags, int create, int initial); static void ApplyMasterOverrideChanges(TkWindow *winPtr, NSWindow *macWindow); static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr); static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); #pragma mark NSWindow(TKWm) @implementation NSWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - (NSPoint) tkConvertPointToScreen: (NSPoint) point { return [self convertBaseToScreen:point]; } - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { return [self convertScreenToBase:point]; } #else - (NSPoint) tkConvertPointToScreen: (NSPoint) point { | > > > | < < < | < < < | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 | Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]); static void WmUpdateGeom(WmInfo *wmPtr, TkWindow *winPtr); static int WmWinStyle(Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj *const objv[]); static int WmWinTabbingId(Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj *const objv[]); static int WmWinAppearance(Tcl_Interp *interp, TkWindow *winPtr, int objc, Tcl_Obj *const objv[]); static void ApplyWindowAttributeFlagChanges(TkWindow *winPtr, NSWindow *macWindow, UInt64 oldAttributes, int oldFlags, int create, int initial); static void ApplyMasterOverrideChanges(TkWindow *winPtr, NSWindow *macWindow); static void GetMinSize(TkWindow *winPtr, int *minWidthPtr, int *minHeightPtr); static void GetMaxSize(TkWindow *winPtr, int *maxWidthPtr, int *maxHeightPtr); static void RemapWindows(TkWindow *winPtr, MacDrawable *parentWin); static void RemoveTransient(TkWindow *winPtr); #pragma mark NSWindow(TKWm) @implementation NSWindow(TKWm) #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 - (NSPoint) tkConvertPointToScreen: (NSPoint) point { return [self convertBaseToScreen:point]; } - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { return [self convertScreenToBase:point]; } #else - (NSPoint) tkConvertPointToScreen: (NSPoint) point { NSRect pointrect = {point, {0,0}}; return [self convertRectToScreen:pointrect].origin; } - (NSPoint) tkConvertPointFromScreen: (NSPoint)point { NSRect pointrect = {point, {0,0}}; return [self convertRectFromScreen:pointrect].origin; } #endif @end #pragma mark - |
︙ | ︙ | |||
386 387 388 389 390 391 392 | /* * This avoids including the title bar for full screen windows * but does include it for normal windows. */ if ([self styleMask] & NSFullScreenWindowMask) { frameRect = [NSWindow frameRectForContentRect:NSZeroRect | | > > | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | /* * This avoids including the title bar for full screen windows * but does include it for normal windows. */ if ([self styleMask] & NSFullScreenWindowMask) { frameRect = [NSWindow frameRectForContentRect:NSZeroRect styleMask:[self styleMask]]; } else { frameRect = [self frameRectForContentRect:NSZeroRect]; } WmInfo *wmPtr = winPtr->wmInfoPtr; wmPtr->xInParent = -frameRect.origin.x; wmPtr->yInParent = frameRect.origin.y + frameRect.size.height; wmPtr->parentWidth = winPtr->changes.width + frameRect.size.width; wmPtr->parentHeight = winPtr->changes.height + frameRect.size.height; } } |
︙ | ︙ | |||
446 447 448 449 450 451 452 | - (id) retain { id result = [super retain]; const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } | | | | | < | 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | - (id) retain { id result = [super retain]; const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 1) { fprintf(stderr, "Retained <%s>. Count is: %lu\n", title, [self retainCount]); } return result; } - (id) autorelease { id result = [super autorelease]; const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 1) { fprintf(stderr, "Autoreleased <%s>. Count is %lu\n", title, [self retainCount]); } return result; } - (oneway void) release { const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 1) { fprintf(stderr, "Releasing <%s>. Count is %lu\n", title, [self retainCount]); } [super release]; } - (void) dealloc { const char *title = [[self title] UTF8String]; if (title == nil) { title = "unnamed window"; } if (DEBUG_ZOMBIES > 0) { fprintf(stderr, ">>>> Freeing <%s>. Count is %lu\n", title, [self retainCount]); } [super dealloc]; } #endif @end #pragma mark - /* |
︙ | ︙ | |||
617 618 619 620 621 622 623 | for (NSWindow *w in windows) { winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect windowFrame = [w frame]; NSRect contentFrame = [w frame]; | > | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | for (NSWindow *w in windows) { winPtr = TkMacOSXGetTkWindow(w); if (winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr; NSRect windowFrame = [w frame]; NSRect contentFrame = [w frame]; contentFrame.size.height = [[w contentView] frame].size.height; /* * For consistency with other platforms, points in the * title bar are not considered to be contained in the * window. */ if ((wmPtr->hints.initial_state == NormalState || wmPtr->hints.initial_state == ZoomState)) { if (NSMouseInRect(p, contentFrame, NO)) { return winPtr; } else if (NSMouseInRect(p, windowFrame, NO)) { return NULL; } } } |
︙ | ︙ | |||
664 665 666 667 668 669 670 | { WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; wmPtr->titleUid = NULL; wmPtr->iconName = NULL; | | < > | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 | { WmInfo *wmPtr = ckalloc(sizeof(WmInfo)); wmPtr->winPtr = winPtr; wmPtr->reparent = None; wmPtr->titleUid = NULL; wmPtr->iconName = NULL; wmPtr->master = NULL; wmPtr->hints.flags = InputHint | StateHint; wmPtr->hints.input = True; wmPtr->hints.initial_state = NormalState; wmPtr->hints.icon_pixmap = None; wmPtr->hints.icon_window = None; wmPtr->hints.icon_x = wmPtr->hints.icon_y = 0; wmPtr->hints.icon_mask = None; wmPtr->hints.window_group = None; wmPtr->leaderName = NULL; wmPtr->icon = NULL; wmPtr->iconFor = NULL; wmPtr->transientPtr = NULL; wmPtr->sizeHintsFlags = 0; wmPtr->minWidth = wmPtr->minHeight = 1; wmPtr->maxWidth = 0; wmPtr->maxHeight = 0; wmPtr->gridWin = NULL; wmPtr->widthInc = wmPtr->heightInc = 1; wmPtr->minAspect.x = wmPtr->minAspect.y = 1; |
︙ | ︙ | |||
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 | TkWindow *winPtr) /* Top-level window that's being deleted. */ { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; if (wmPtr == NULL) { return; } Tk_ManageGeometry((Tk_Window) winPtr, NULL, NULL); Tk_DeleteEventHandler((Tk_Window) winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); if (wmPtr->hints.flags & IconPixmapHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); } if (wmPtr->hints.flags & IconMaskHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask); } if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } | > > > > > > < < < < > > > > > > > > > > > > > > > > > > > > > > > | > | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | TkWindow *winPtr) /* Top-level window that's being deleted. */ { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; if (wmPtr == NULL) { return; } /* *If the dead window is a transient, remove it from the master's list. */ RemoveTransient(winPtr); Tk_ManageGeometry((Tk_Window) winPtr, NULL, NULL); Tk_DeleteEventHandler((Tk_Window) winPtr, StructureNotifyMask, TopLevelEventProc, winPtr); if (wmPtr->hints.flags & IconPixmapHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_pixmap); } if (wmPtr->hints.flags & IconMaskHint) { Tk_FreeBitmap(winPtr->display, wmPtr->hints.icon_mask); } if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } if (wmPtr->icon != NULL) { wmPtr2 = ((TkWindow *) wmPtr->icon)->wmInfoPtr; wmPtr2->iconFor = NULL; } if (wmPtr->iconFor != NULL) { wmPtr2 = ((TkWindow *) wmPtr->iconFor)->wmInfoPtr; wmPtr2->icon = NULL; wmPtr2->hints.flags &= ~IconWindowHint; } while (wmPtr->protPtr != NULL) { ProtocolHandler *protPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr->nextPtr; Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); } if (wmPtr->commandObj != NULL) { Tcl_DecrRefCount(wmPtr->commandObj); } if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } if (wmPtr->flags & WM_UPDATE_PENDING) { Tcl_CancelIdleCall(UpdateGeometryInfo, winPtr); } /* * If the dead window has a transient, remove references to it from * the transient. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); if (masterPtr == winPtr) { wmPtr2 = winPtr2->wmInfoPtr; wmPtr2->master = NULL; } } while (wmPtr->transientPtr != NULL) { Transient *transientPtr = wmPtr->transientPtr; wmPtr->transientPtr = transientPtr->nextPtr; ckfree(transientPtr); } /* * Delete the Mac window and remove it from the windowTable. The window * could be nil if the window was never mapped. However, we don't do this * for embedded windows, they don't go in the window list, and they do not * own their portPtr's. */ NSWindow *window = wmPtr->window; if (window && !Tk_IsEmbedded(winPtr)) { NSWindow *parent = [window parentWindow]; if (parent) { [parent removeChildWindow:window]; } #if DEBUG_ZOMBIES > 0 { const char *title = [[window title] UTF8String]; if (title == nil) { |
︙ | ︙ | |||
961 962 963 964 965 966 967 968 969 | wmPtr->window = NULL; [window release]; /* Activate the highest window left on the screen. */ NSArray *windows = [NSApp orderedWindows]; for (id nswindow in windows) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(nswindow); if (winPtr2 && nswindow != window) { WmInfo *wmPtr = winPtr2->wmInfoPtr; | > | | > | | | | > > > | < | 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 | wmPtr->window = NULL; [window release]; /* Activate the highest window left on the screen. */ NSArray *windows = [NSApp orderedWindows]; for (id nswindow in windows) { TkWindow *winPtr2 = TkMacOSXGetTkWindow(nswindow); if (winPtr2 && nswindow != window) { WmInfo *wmPtr = winPtr2->wmInfoPtr; BOOL minimized = (wmPtr->hints.initial_state == IconicState || wmPtr->hints.initial_state == WithdrawnState); /* * If no windows are left on the screen and the next window is * iconified or withdrawn, we don't want to make it be the * KeyWindow because that would cause it to be displayed on the * screen. */ if ([nswindow canBecomeKeyWindow] && !minimized) { [nswindow makeKeyAndOrderFront:NSApp]; break; } } } /* * Process all window events immediately to force the closed window to * be deallocated. But don't do this for the root window as that is * unnecessary and can lead to segfaults. */ if (winPtr->parentPtr) { while (Tcl_DoOneEvent(TCL_WINDOW_EVENTS|TCL_DONT_WAIT)) {} } [NSApp _resetAutoreleasePool]; #if DEBUG_ZOMBIES > 0 fprintf(stderr, "================= Pool dump ===================\n"); [NSAutoreleasePool showPools]; #endif } ckfree(wmPtr); winPtr->wmInfoPtr = NULL; |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0) && (length >= 3)) { if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } if (objc == 2) { | | | 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 | if ((argv1[0] == 't') && (strncmp(argv1, "tracing", length) == 0) && (length >= 3)) { if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } if (objc == 2) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(wmTracing != 0)); return TCL_OK; } return Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing); } if (Tcl_GetIndexFromObjStruct(interp, objv[1], optionStrings, sizeof(char *), "option", 0, &index) != TCL_OK) { |
︙ | ︙ | |||
1222 1223 1224 1225 1226 1227 1228 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; | | | | | | 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x); results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y); results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x); results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~PAspect; } else { |
︙ | ︙ | |||
1425 1426 1427 1428 1429 1430 1431 | WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_FULLSCREEN: | | | | | | | 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: result = Tcl_NewDoubleObj([macWindow alphaValue]); break; case WMATT_FULLSCREEN: result = Tcl_NewWideIntObj((wmPtr->flags & WM_FULLSCREEN) != 0); break; case WMATT_MODIFIED: result = Tcl_NewWideIntObj([macWindow isDocumentEdited] != 0); break; case WMATT_NOTIFY: result = Tcl_NewWideIntObj(tkMacOSXWmAttrNotifyVal != 0); break; case WMATT_TITLEPATH: result = Tcl_NewStringObj([[macWindow representedFilename] UTF8String], -1); break; case WMATT_TOPMOST: result = Tcl_NewWideIntObj((wmPtr->flags & WM_TOPMOST) != 0); break; case WMATT_TRANSPARENT: result = Tcl_NewWideIntObj((wmPtr->flags & WM_TRANSPARENT) != 0); break; case WMATT_TYPE: result = Tcl_NewStringObj("unsupported", -1); break; case _WMATT_LAST_ATTRIBUTE: default: break; |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(NULL, result, WmGetAttribute(winPtr, macWindow, attribute)); } Tcl_SetObjResult(interp, result); | | | 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 | for (attribute = 0; attribute < _WMATT_LAST_ATTRIBUTE; ++attribute) { Tcl_ListObjAppendElement(NULL, result, Tcl_NewStringObj(WmAttributeNames[attribute], -1)); Tcl_ListObjAppendElement(NULL, result, WmGetAttribute(winPtr, macWindow, attribute)); } Tcl_SetObjResult(interp, result); } else if (objc == 4) { /* wm attributes $win -attribute */ if (Tcl_GetIndexFromObjStruct(interp, objv[3], WmAttributeNames, sizeof(char *), "attribute", 0, &attribute) != TCL_OK) { return TCL_ERROR; } Tcl_SetObjResult(interp, WmGetAttribute(winPtr, macWindow, attribute)); } else if ((objc - 3) % 2 == 0) { /* wm attributes $win -att value... */ int i; |
︙ | ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | } if (objc == 3) { if (wmPtr->commandObj != NULL) { Tcl_SetObjResult(interp, wmPtr->commandObj); } return TCL_OK; } | | | 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 | } if (objc == 3) { if (wmPtr->commandObj != NULL) { Tcl_SetObjResult(interp, wmPtr->commandObj); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { if (wmPtr->commandObj != NULL) { Tcl_DecrRefCount(wmPtr->commandObj); wmPtr->commandObj = NULL; } return TCL_OK; } if (Tcl_ListObjLength(interp, objv[3], &len) != TCL_OK) { |
︙ | ︙ | |||
1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 | ZoomState : NormalState); [win setExcludedFromWindowsMenu:NO]; TkMacOSXApplyWindowAttributes(winPtr, win); [win orderFront:nil]; if (wmPtr->icon) { Tk_UnmapWindow((Tk_Window)wmPtr->icon); } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmFocusmodelCmd -- | > > > > > > > > > > > > > > > > > > > > > | 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | ZoomState : NormalState); [win setExcludedFromWindowsMenu:NO]; TkMacOSXApplyWindowAttributes(winPtr, win); [win orderFront:nil]; if (wmPtr->icon) { Tk_UnmapWindow((Tk_Window)wmPtr->icon); } /* * If this window has a transient, the transient must also be deiconified if * it was withdrawn by the master. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; WmInfo *wmPtr2 = winPtr2->wmInfoPtr; TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); if (masterPtr == winPtr) { if ((wmPtr2->hints.initial_state == WithdrawnState) && ((transientPtr->flags & WITHDRAWN_BY_MASTER) != 0)) { TkpWmSetState(winPtr2, NormalState); transientPtr->flags &= ~WITHDRAWN_BY_MASTER; } } } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmFocusmodelCmd -- |
︙ | ︙ | |||
2054 2055 2056 2057 2058 2059 2060 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; | | | | | | 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth); results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight); results[2] = Tcl_NewWideIntObj(wmPtr->widthInc); results[3] = Tcl_NewWideIntObj(wmPtr->heightInc); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as |
︙ | ︙ | |||
2281 2282 2283 2284 2285 2286 2287 | if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; | | | 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 | if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; } else if (wmPtr->master != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONIFY", "TRANSIENT", NULL); return TCL_ERROR; } else if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify %s: it is an icon for %s", |
︙ | ︙ | |||
2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 | return TCL_ERROR; } TkpWmSetState(winPtr, IconicState); if (wmPtr->icon) { Tk_MapWindow((Tk_Window)wmPtr->icon); } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconmaskCmd -- | > > > > > > > > > > > > > > > > > | 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 | return TCL_ERROR; } TkpWmSetState(winPtr, IconicState); if (wmPtr->icon) { Tk_MapWindow((Tk_Window)wmPtr->icon); } /* * If this window has a transient the transient must be withdrawn when * the master is iconified. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); if (masterPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); transientPtr->flags |= WITHDRAWN_BY_MASTER; } } return TCL_OK; } /* *---------------------------------------------------------------------- * * WmIconmaskCmd -- |
︙ | ︙ | |||
2454 2455 2456 2457 2458 2459 2460 | if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } | > | > > | > | | > > | > | > > | > | 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 | if (objc < 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } /* * Parse args. */ if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { isDefault = 1; if (objc == 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?-default? image1 ?image2 ...?"); return TCL_ERROR; } } /* * Get icon name. We only use the first icon name because macOS does not * support multiple images in Tk photos. */ char *icon; if (strcmp(Tcl_GetString(objv[3]), "-default") == 0) { icon = Tcl_GetString(objv[4]); } else { icon = Tcl_GetString(objv[3]); } /* * Get image and convert to NSImage that can be displayed as icon. */ tk_icon = Tk_GetImage(interp, tkwin, icon, NULL, NULL); if (tk_icon == NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't use \"%s\" as iconphoto: not a photo image", icon)); Tcl_SetErrorCode(interp, "TK", "WM", "ICONPHOTO", "PHOTO", NULL); return TCL_ERROR; } NSImage *newIcon; Tk_SizeOfImage(tk_icon, &width, &height); newIcon = TkMacOSXGetNSImageWithTkImage(winPtr->display, tk_icon, width, height); Tk_FreeImage(tk_icon); if (newIcon == NULL) { return TCL_ERROR; } [NSApp setApplicationIconImage: newIcon]; return TCL_OK; } |
︙ | ︙ | |||
2531 2532 2533 2534 2535 2536 2537 | return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; | | | | | 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 | return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x); results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->hints.flags &= ~IconPositionHint; } else { if ((Tcl_GetIntFromObj(interp, objv[3], &x) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &y) != TCL_OK)) { return TCL_ERROR; } wmPtr->hints.icon_x = x; wmPtr->hints.icon_y = y; wmPtr->hints.flags |= IconPositionHint; } return TCL_OK; |
︙ | ︙ | |||
2641 2642 2643 2644 2645 2646 2647 | } Tk_MakeWindowExist(tkwin2); wmPtr->hints.icon_window = Tk_WindowId(tkwin2); wmPtr->hints.flags |= IconWindowHint; wmPtr->icon = tkwin2; wmPtr2->iconFor = (Tk_Window) winPtr; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { | < | | 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 | } Tk_MakeWindowExist(tkwin2); wmPtr->hints.icon_window = Tk_WindowId(tkwin2); wmPtr->hints.flags |= IconWindowHint; wmPtr->icon = tkwin2; wmPtr2->iconFor = (Tk_Window) winPtr; if (!(wmPtr2->flags & WM_NEVER_MAPPED)) { /* * If the window is in normal or zoomed state, the icon should be * unmapped. */ if (wmPtr->hints.initial_state == NormalState || wmPtr->hints.initial_state == ZoomState) { Tk_UnmapWindow(tkwin2); } } } return TCL_OK; } |
︙ | ︙ | |||
2703 2704 2705 2706 2707 2708 2709 | Tk_UnmapWindow(frameWin); if (wmPtr == NULL) { TkWmNewWindow(winPtr); if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr); macWin = (MacDrawable *) winPtr->window; } | < < > | 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 | Tk_UnmapWindow(frameWin); if (wmPtr == NULL) { TkWmNewWindow(winPtr); if (winPtr->window == None) { Tk_MakeWindowExist((Tk_Window) winPtr); macWin = (MacDrawable *) winPtr->window; } } wmPtr = winPtr->wmInfoPtr; winPtr->flags &= ~TK_MAPPED; macWin->toplevel->referenceCount--; macWin->toplevel = macWin; macWin->toplevel->referenceCount++; RemapWindows(winPtr, macWin); winPtr->flags |= (TK_TOP_HIERARCHY|TK_TOP_LEVEL|TK_HAS_WRAPPER|TK_WIN_MANAGED); TkMapTopFrame(frameWin); TkWmMapWindow(winPtr); } else if (Tk_IsTopLevel(frameWin)) { /* Already managed by wm - ignore it */ } return TCL_OK; } /* |
︙ | ︙ | |||
2758 2759 2760 2761 2762 2763 2764 | return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(winPtr, &width, &height); | | | | 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(winPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; |
︙ | ︙ | |||
2812 2813 2814 2815 2816 2817 2818 | return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMinSize(winPtr, &width, &height); | | | | 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 | return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMinSize(winPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; |
︙ | ︙ | |||
2864 2865 2866 2867 2868 2869 2870 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } if (objc == 3) { | | | | 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( Tk_Attributes((Tk_Window) winPtr)->override_redirect != 0)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &flag) != TCL_OK) { return TCL_ERROR; } atts.override_redirect = flag ? True : False; |
︙ | ︙ | |||
3019 3020 3021 3022 3023 3024 3025 | /* * Delete any current protocol handler, then create a new one with the * specified command, unless the command is empty. */ for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL; | | | 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 | /* * Delete any current protocol handler, then create a new one with the * specified command, unless the command is empty. */ for (protPtr = wmPtr->protPtr, prevPtr = NULL; protPtr != NULL; prevPtr = protPtr, protPtr = protPtr->nextPtr) { if (protPtr->protocol == protocol) { if (prevPtr == NULL) { wmPtr->protPtr = protPtr->nextPtr; } else { prevPtr->nextPtr = protPtr->nextPtr; } if (protPtr->command) |
︙ | ︙ | |||
3083 3084 3085 3086 3087 3088 3089 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; | > | > | | 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj( (wmPtr->flags & WM_WIDTH_NOT_RESIZABLE) == 0); results[1] = Tcl_NewWideIntObj( (wmPtr->flags & WM_HEIGHT_NOT_RESIZABLE) == 0); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; |
︙ | ︙ | |||
3309 3310 3311 3312 3313 3314 3315 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } | | | 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result != 0)); return TCL_OK; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
3372 3373 3374 3375 3376 3377 3378 | } if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } | > | > > | | > | > | > | 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 | } if (Tcl_GetIndexFromObjStruct(interp, objv[3], optionStrings, sizeof(char *), "argument", 0, &index) != TCL_OK) { return TCL_ERROR; } switch (index) { case OPT_NORMAL: TkpWmSetState(winPtr, NormalState); /* * This varies from 'wm deiconify' because it does not force the * window to be raised and receive focus */ break; case OPT_ICONIC: if (Tk_Attributes((Tk_Window) winPtr)->override_redirect) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": override-redirect flag is set", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "OVERRIDE_REDIRECT", NULL); return TCL_ERROR; } if (wmPtr->master != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't iconify \"%s\": it is a transient", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WM", "STATE", "TRANSIENT", NULL); return TCL_ERROR; } TkpWmSetState(winPtr, IconicState); break; case OPT_WITHDRAWN: TkpWmSetState(winPtr, WithdrawnState); break; default: /* OPT_ZOOMED */ TkpWmSetState(winPtr, ZoomState); break; } } else if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("icon", -1)); } else { if (wmPtr->hints.initial_state == NormalState || wmPtr->hints.initial_state == ZoomState) { wmPtr->hints.initial_state = (TkMacOSXIsWindowZoomed(winPtr) ? |
︙ | ︙ | |||
3503 3504 3505 3506 3507 3508 3509 3510 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window master; WmInfo *wmPtr2; | > < | | | | | < < < < | < > > | > > > > | | > | | | | | | > > > | > > > > > > > > > > | > > > | > > | > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window master; TkWindow *masterPtr, *w; WmInfo *wmPtr2; Transient *transient; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?master?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->master != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(Tk_PathName(wmPtr->master), -1)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { RemoveTransient(winPtr); } else { if (TkGetWindowFromObj(interp, tkwin, objv[3], &master) != TCL_OK) { return TCL_ERROR; } masterPtr = (TkWindow*) master; while (!Tk_TopWinHierarchy(masterPtr)) { /* * Ensure that the master window is actually a Tk toplevel. */ masterPtr = masterPtr->parentPtr; } Tk_MakeWindowExist((Tk_Window)masterPtr); if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a transient: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } wmPtr2 = masterPtr->wmInfoPtr; /* * Under some circumstances, wmPtr2 is NULL here. */ if (wmPtr2 != NULL && wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a master: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->master) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", Tk_PathName(masterPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } /* * Add the transient to the master's list, if it not already there. */ for (transient = wmPtr2->transientPtr; transient != NULL && transient->winPtr != winPtr; transient = transient->nextPtr) {} if (transient == NULL) { transient = ckalloc(sizeof(Transient)); transient->winPtr = winPtr; transient->flags = 0; transient->nextPtr = wmPtr2->transientPtr; wmPtr2->transientPtr = transient; } /* * If the master is withdrawn or iconic then withdraw the transient. */ if ((wmPtr2->hints.initial_state == WithdrawnState || wmPtr2->hints.initial_state == IconicState) && wmPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr, WithdrawnState); transient->flags |= WITHDRAWN_BY_MASTER; } wmPtr->master = (Tk_Window) masterPtr; } ApplyMasterOverrideChanges(winPtr, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * RemoveTransient -- * * Clears the transient's master record and removes the transient from the * master's list. * * Results: * None * * Side effects: * References to a master are removed from the transient's wmInfo * structure and references to the transient are removed from its master's * wmInfo. * *---------------------------------------------------------------------- */ static void RemoveTransient( TkWindow *winPtr) { WmInfo *wmPtr = winPtr->wmInfoPtr, *wmPtr2; TkWindow *masterPtr; Transient *transPtr, *temp; if (wmPtr == NULL || wmPtr->master == NULL) { return; } masterPtr = (TkWindow *) wmPtr->master; wmPtr2 = masterPtr->wmInfoPtr; if (wmPtr2 == NULL) { return; } wmPtr->master = NULL; transPtr = wmPtr2->transientPtr; while (transPtr != NULL) { if (transPtr->winPtr != winPtr) { break; } temp = transPtr->nextPtr; ckfree(transPtr); transPtr = temp; } wmPtr2->transientPtr = transPtr; while (transPtr != NULL) { if (transPtr->nextPtr && transPtr->nextPtr->winPtr == winPtr) { temp = transPtr->nextPtr; transPtr->nextPtr = temp->nextPtr; ckfree(temp); } else { transPtr = transPtr->nextPtr; } } } /* *---------------------------------------------------------------------- * * WmWithdrawCmd -- * * This procedure is invoked to process the "wm withdraw" Tcl command. |
︙ | ︙ | |||
3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 | if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL); return TCL_ERROR; } TkpWmSetState(winPtr, WithdrawnState); NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); [win orderOut:nil]; [win setExcludedFromWindowsMenu:YES]; return TCL_OK; } | > > > > > > > > > > > > > > > > > > | | | | 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 | if (wmPtr->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't withdraw %s: it is an icon for %s", Tcl_GetString(objv[2]), Tk_PathName(wmPtr->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "WITHDRAW", "ICON", NULL); return TCL_ERROR; } TkpWmSetState(winPtr, WithdrawnState); NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); [win orderOut:nil]; [win setExcludedFromWindowsMenu:YES]; /* * If this window has a transient, the transient must also be withdrawn. */ for (Transient *transientPtr = wmPtr->transientPtr; transientPtr != NULL; transientPtr = transientPtr->nextPtr) { TkWindow *winPtr2 = transientPtr->winPtr; TkWindow *masterPtr = (TkWindow *) TkGetTransientMaster(winPtr2); if (masterPtr == winPtr && winPtr2->wmInfoPtr->hints.initial_state != WithdrawnState) { TkpWmSetState(winPtr2, WithdrawnState); transientPtr->flags |= WITHDRAWN_BY_MASTER; } } return TCL_OK; } /* * Invoked by those wm subcommands that affect geometry. Schedules a geometry * update. */ static void WmUpdateGeom( WmInfo *wmPtr, TkWindow *winPtr) { |
︙ | ︙ | |||
3713 3714 3715 3716 3717 3718 3719 | && ((wmPtr->sizeHintsFlags & (PBaseSize|PResizeInc)) == (PBaseSize|PResizeInc))) { return; } /* * If gridding was previously off, then forget about any window size | | | | | | | | < | 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 | && ((wmPtr->sizeHintsFlags & (PBaseSize|PResizeInc)) == (PBaseSize|PResizeInc))) { return; } /* * If gridding was previously off, then forget about any window size * requests made by the user or via "wm geometry": these are in pixel units * and there's no easy way to translate them to grid units since the new * requested size of the top-level window in pixels may not yet have been * registered yet (it may filter up the hierarchy in DoWhenIdle handlers). * However, if the window has never been mapped yet then just leave the * window size alone: assume that it is intended to be in grid units but * just happened to have been specified before this procedure was called. */ if ((wmPtr->gridWin == NULL) && !(wmPtr->flags & WM_NEVER_MAPPED)) { wmPtr->width = -1; wmPtr->height = -1; } |
︙ | ︙ | |||
4241 4242 4243 4244 4245 4246 4247 4248 | */ wmPtr->width = width; wmPtr->height = height; if (flags & WM_NEGATIVE_X) { int borderwidth = wmPtr->parentWidth - winPtr->changes.width; int newWidth = width == -1 ? winPtr->changes.width : width; x = (x == -1) ? | > | | > | | | 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 | */ wmPtr->width = width; wmPtr->height = height; if (flags & WM_NEGATIVE_X) { int borderwidth = wmPtr->parentWidth - winPtr->changes.width; int newWidth = width == -1 ? winPtr->changes.width : width; x = (x == -1) ? wmPtr->x + winPtr->changes.width - newWidth : wmPtr->vRootWidth - x - newWidth - borderwidth; } if (x == -1) { x = wmPtr->x; } if (flags & WM_NEGATIVE_Y) { int borderheight = wmPtr->parentHeight - winPtr->changes.height; int newHeight = height == -1 ? winPtr->changes.height : height; y = (y == -1) ? wmPtr->y + winPtr->changes.height - newHeight : wmPtr->vRootHeight - y - newHeight - borderheight; } if (y == -1) { y = wmPtr->y; } if (wmPtr->flags & WM_FULLSCREEN) { wmPtr->configX = x; wmPtr->configY = y; |
︙ | ︙ | |||
4380 4381 4382 4383 4384 4385 4386 | * This is a Macintosh specific implementation of this function. Given * the root coordinates of a point, this procedure returns the token for * the top-most window covering that point, if there exists such a window * in this application. * * Results: * The return result is either a token for the window corresponding to | | < | 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 | * This is a Macintosh specific implementation of this function. Given * the root coordinates of a point, this procedure returns the token for * the top-most window covering that point, if there exists such a window * in this application. * * Results: * The return result is either a token for the window corresponding to * rootX and rootY, or else NULL to indicate that there is no such window. * * Side effects: * None. * *---------------------------------------------------------------------- */ |
︙ | ︙ | |||
4730 4731 4732 4733 4734 4735 4736 | if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); } wmPtr->x = x; wmPtr->y = y; wmPtr->flags |= WM_MOVE_PENDING; | < | 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 | if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_Panic("Tk_MoveToplevelWindow called with non-toplevel window"); } wmPtr->x = x; wmPtr->y = y; wmPtr->flags |= WM_MOVE_PENDING; if (!(wmPtr->sizeHintsFlags & (USPosition|PPosition))) { wmPtr->sizeHintsFlags |= USPosition; wmPtr->flags |= WM_UPDATE_SIZE_HINTS; } /* * If the window has already been mapped, must bring its geometry |
︙ | ︙ | |||
4786 4787 4788 4789 4790 4791 4792 4793 | WmInfo *wmPtr = winPtr->wmInfoPtr; int macAboveBelow = (aboveBelow == Above ? NSWindowAbove : NSWindowBelow); int otherNumber = 0; /* 0 will be used when otherPtr is NULL. */ /* * If the Tk windows has no drawable, or is withdrawn do nothing. */ if (winPtr->window == None || | > | | | | > | | | > | | | | < | > | | > | 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 | WmInfo *wmPtr = winPtr->wmInfoPtr; int macAboveBelow = (aboveBelow == Above ? NSWindowAbove : NSWindowBelow); int otherNumber = 0; /* 0 will be used when otherPtr is NULL. */ /* * If the Tk windows has no drawable, or is withdrawn do nothing. */ if (winPtr->window == None || wmPtr == NULL || wmPtr->hints.initial_state == WithdrawnState) { return; } macWindow = TkMacOSXDrawableWindow(winPtr->window); if (macWindow == nil) { return; } if (otherPtr) { /* * When otherPtr is non-NULL, if the other window has no drawable or is * withdrawn, do nothing. */ WmInfo *otherWmPtr = otherPtr->wmInfoPtr; if (winPtr->window == None || otherWmPtr == NULL || otherWmPtr->hints.initial_state == WithdrawnState) { return; } otherMacWindow = TkMacOSXDrawableWindow(otherPtr->window); if (otherMacWindow == nil) { return; } /* * If the other window is OK, get its number. */ otherNumber = [otherMacWindow windowNumber]; } /* * Just let the Mac window manager deal with all the subtleties of keeping * track of off-screen windows, etc. */ [macWindow orderWindow:macAboveBelow relativeTo:otherNumber]; } /* *---------------------------------------------------------------------- * * TkWmAddToColormapWindows -- |
︙ | ︙ | |||
5019 5020 5021 5022 5023 5024 5025 | /* *---------------------------------------------------------------------- * * InitialWindowBounds -- * * This function calculates the initial bounds for a new Mac toplevel * window. Unless the geometry is specified by the user this code will | | | | 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 | /* *---------------------------------------------------------------------- * * InitialWindowBounds -- * * This function calculates the initial bounds for a new Mac toplevel * window. Unless the geometry is specified by the user this code will * auto place the windows in a cascade diagonially across the main monitor * of the Mac. * * Results: * Window bounds. * * Side effects: * None. * |
︙ | ︙ | |||
5167 5168 5169 5170 5171 5172 5173 | * * Side effects: * None. * *---------------------------------------------------------------------- */ | | | | | 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 | * * Side effects: * None. * *---------------------------------------------------------------------- */ Tk_Window TkGetTransientMaster( TkWindow *winPtr) { if (winPtr->wmInfoPtr != NULL) { return (Tk_Window)winPtr->wmInfoPtr->master; } return NULL; } /* *---------------------------------------------------------------------- * * TkMacOSXGetXWindow -- * |
︙ | ︙ | |||
5261 5262 5263 5264 5265 5266 5267 | MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); return [macWindow isZoomed]; } | < | 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 | MODULE_SCOPE int TkMacOSXIsWindowZoomed( TkWindow *winPtr) { NSWindow *macWindow = TkMacOSXDrawableWindow(winPtr->window); return [macWindow isZoomed]; } /* *---------------------------------------------------------------------- * * TkMacOSXZoomToplevel -- * * The function is invoked when the user clicks in the zoom region of a |
︙ | ︙ | |||
5341 5342 5343 5344 5345 5346 5347 | TkUnsupported1ObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const subcmds[] = { | | | < | > | | | > > > > > > > | > > > > > > | > > | > > > > > > > > > > > > | 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 | TkUnsupported1ObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { static const char *const subcmds[] = { "style", "tabbingid", "appearance", "isdark", NULL }; enum SubCmds { TKMWS_STYLE, TKMWS_TABID, TKMWS_APPEARANCE, TKMWS_ISDARK }; Tk_Window tkwin = clientData; TkWindow *winPtr; int index; if (objc < 3) { Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } winPtr = (TkWindow *) Tk_NameToWindow(interp, Tcl_GetString(objv[2]), tkwin); if (winPtr == NULL) { return TCL_ERROR; } if (!(winPtr->flags & TK_TOP_LEVEL)) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "window \"%s\" isn't a top-level window", winPtr->pathName)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "TOPLEVEL", NULL); return TCL_ERROR; } if (Tcl_GetIndexFromObjStruct(interp, objv[1], subcmds, sizeof(char *), "option", 0, &index) != TCL_OK) { return TCL_ERROR; } switch((enum SubCmds) index) { case TKMWS_STYLE: if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?class attributes?"); return TCL_ERROR; } return WmWinStyle(interp, winPtr, objc, objv); case TKMWS_TABID: if ([NSApp macMinorVersion] < 12) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Tabbing identifiers did not exist until OSX 10.12.", -1)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "TABBINGID", NULL); return TCL_ERROR; } if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "tabbingid window ?newid?"); return TCL_ERROR; } return WmWinTabbingId(interp, winPtr, objc, objv); case TKMWS_APPEARANCE: if ([NSApp macMinorVersion] < 9) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Window appearances did not exist until OSX 10.9.", -1)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL); return TCL_ERROR; } if ((objc < 3) || (objc > 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?appearancename?"); return TCL_ERROR; } if (objc == 4 && [NSApp macMinorVersion] < 14) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Window appearances cannot be changed before OSX 10.14.", -1)); Tcl_SetErrorCode(interp, "TK", "WINDOWSTYLE", "APPEARANCE", NULL); return TCL_ERROR; } return WmWinAppearance(interp, winPtr, objc, objv); case TKMWS_ISDARK: if ((objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "isdark window"); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewBooleanObj(TkMacOSXInDarkMode(tkwin))); return TCL_OK; default: return TCL_ERROR; } } /* *---------------------------------------------------------------------- * * WmWinStyle -- * |
︙ | ︙ | |||
5585 5586 5587 5588 5589 5590 5591 | *---------------------------------------------------------------------- * * WmWinTabbingId -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle tabbingid" subcommand. The command * allows you to get or set the tabbingIdentifier for the NSWindow | | > | < | 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 | *---------------------------------------------------------------------- * * WmWinTabbingId -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle tabbingid" subcommand. The command * allows you to get or set the tabbingIdentifier for the NSWindow * associated with a Tk Window. The syntax is: * * tk::unsupported::MacWindowStyle tabbingid window ?newId? * * Results: * Returns the tabbingIdentifier of the window prior to calling this * function. If the optional newId argument is omitted, the window's * tabbingIdentifier is not changed. * * Side effects: * Windows may only be grouped together as tabs if they all have the same * tabbingIdentifier. In particular, by giving a window a unique * tabbingIdentifier one can prevent it from becoming a tab in any other * window. Note, however, that changing the tabbingIdentifier of a window * which is already a tab does not cause it to become a separate window. * *---------------------------------------------------------------------- */ static int WmWinTabbingId( Tcl_Interp *interp, /* Current interpreter. */ |
︙ | ︙ | |||
5637 5638 5639 5640 5641 5642 5643 | /* * If the tabbingIdentifier of a tab is changed we also turn it into a * separate window so we don't violate the rule that all tabs in the * same frame must have the same tabbingIdentifier. */ | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 | /* * If the tabbingIdentifier of a tab is changed we also turn it into a * separate window so we don't violate the rule that all tabs in the * same frame must have the same tabbingIdentifier. */ if ([idString compare:newIdString] != NSOrderedSame #if MAC_OS_X_VERSION_MIN_REQUIRED > 101200 && [win tab] #endif ) { [win moveTabToNewWindow:nil]; } return TCL_OK; } #endif return TCL_ERROR; } /* *---------------------------------------------------------------------- * * WmWinAppearance -- * * This procedure is invoked to process the * "::tk::unsupported::MacWindowStyle appearance" subcommand. The command * allows you to get or set the appearance for the NSWindow associated * with a Tk Window. The syntax is: * * tk::unsupported::MacWindowStyle tabbingid window ?newAppearance? * * Allowed appearance names are "aqua", "darkaqua", and "auto". * * Results: * Returns the appearance setting of the window prior to calling this * function. * * Side effects: * The underlying NSWindow's appearance property is set to the specified * value if the optional newAppearance argument is supplied. Otherwise the * window's appearance property is not changed. If the appearance is set * to aqua or darkaqua then the window will use the associated * NSAppearance even if the user has selected a different appearance with * the system preferences. If it is set to auto then the appearance * property is set to nil, meaning that the preferences will determine the * appearance. * *---------------------------------------------------------------------- */ static int WmWinAppearance( Tcl_Interp *interp, /* Current interpreter. */ TkWindow *winPtr, /* Window to be manipulated. */ int objc, /* Number of arguments. */ Tcl_Obj * const objv[]) /* Argument objects. */ { #if MAC_OS_X_VERSION_MAX_ALLOWED > 1090 static const char *const appearanceStrings[] = { "aqua", "darkaqua", "auto", NULL }; enum appearances { APPEARANCE_AQUA, APPEARANCE_DARKAQUA, APPEARANCE_AUTO }; Tcl_Obj *result = NULL; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 NSAppearanceName appearance; #else NSString *appearance; #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101300 const char *resultString = "unrecognized"; NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); if (win) { appearance = win.appearance.name; if (appearance == nil) { resultString = appearanceStrings[APPEARANCE_AUTO]; } else if (appearance == NSAppearanceNameAqua) { resultString = appearanceStrings[APPEARANCE_AQUA]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 } else if (@available(macOS 10.14, *)) { if (appearance == NSAppearanceNameDarkAqua) { resultString = appearanceStrings[APPEARANCE_DARKAQUA]; } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 } result = Tcl_NewStringObj(resultString, strlen(resultString)); } if (result == NULL) { Tcl_Panic("Failed to read appearance name."); } if (objc == 4) { int index; if (Tcl_GetIndexFromObjStruct(interp, objv[3], appearanceStrings, sizeof(char *), "appearancename", 0, &index) != TCL_OK) { return TCL_ERROR; } switch ((enum appearances) index) { case APPEARANCE_AQUA: win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua]; break; case APPEARANCE_DARKAQUA: #if MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 if (@available(macOS 10.14, *)) { win.appearance = [NSAppearance appearanceNamed: NSAppearanceNameDarkAqua]; } #endif // MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 break; default: win.appearance = nil; } } Tcl_SetObjResult(interp, result); return TCL_OK; #else // MAC_OS_X_VERSION_MAX_ALLOWED > 1090 return TCL_ERROR; #endif } /* *---------------------------------------------------------------------- * * TkpMakeMenuWindow -- * * Configure the window to be either a undecorated pull-down (or pop-up) |
︙ | ︙ | |||
5717 5718 5719 5720 5721 5722 5723 | if (TkMacOSXHostToplevelExists(winPtr)) { return; } macWin = (MacDrawable *) winPtr->window; /* | | | | 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 | if (TkMacOSXHostToplevelExists(winPtr)) { return; } macWin = (MacDrawable *) winPtr->window; /* * If this is embedded, make sure its container's toplevel exists, then * return... */ if (Tk_IsEmbedded(winPtr)) { TkWindow *contWinPtr = TkpGetOtherWindow(winPtr); if (contWinPtr != NULL) { TkMacOSXMakeRealWindowExist( |
︙ | ︙ | |||
5747 5748 5749 5750 5751 5752 5753 | /* * TODO: Here we should handle out of process embedding. */ } /* | | | | 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 | /* * TODO: Here we should handle out of process embedding. */ } /* * If this is an override-redirect window, the NSWindow is created first as * a document window then converted to a simple window. */ if (overrideRedirect) { wmPtr->macClass = kDocumentWindowClass; } macClass = wmPtr->macClass; wmPtr->attributes &= (tkAlwaysValidAttributes | |
︙ | ︙ | |||
5802 5803 5804 5805 5806 5807 5808 | [window setReleasedWhenClosed:NO]; if (styleMask & NSUtilityWindowMask) { [(NSPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { /* | | | | > | | | | > | | | 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 | [window setReleasedWhenClosed:NO]; if (styleMask & NSUtilityWindowMask) { [(NSPanel*)window setFloatingPanel:YES]; } if ((styleMask & (NSTexturedBackgroundWindowMask|NSHUDWindowMask)) && !(styleMask & NSDocModalWindowMask)) { /* * Workaround for [Bug 2824538]: Textured windows are draggable from * opaque content. */ [window setMovableByWindowBackground:NO]; } [window setDocumentEdited:NO]; wmPtr->window = window; macWin->view = window.contentView; TkMacOSXApplyWindowAttributes(winPtr, window); NSRect geometry = InitialWindowBounds(winPtr, window); geometry.size.width += structureRect.size.width; geometry.size.height += structureRect.size.height; geometry.origin.y = tkMacOSXZeroScreenHeight - (geometry.origin.y + geometry.size.height); [window setFrame:geometry display:YES]; TkMacOSXRegisterOffScreenWindow((Window) macWin, window); macWin->flags |= TK_HOST_EXISTS; if (overrideRedirect) { XSetWindowAttributes atts; atts.override_redirect = True; Tk_ChangeWindowAttributes((Tk_Window) winPtr, CWOverrideRedirect, &atts); ApplyMasterOverrideChanges(winPtr, NULL); } } /* *---------------------------------------------------------------------- * * TkpDisplayWindow -- * * Mark the contentView of this window as needing display so the window * will be drawn by the window manager. If this is called within the * drawRect method, do nothing. * * Results: * None. * * Side effects: * The window's contentView is marked as needing display. * *---------------------------------------------------------------------- */ MODULE_SCOPE void TkpDisplayWindow(Tk_Window tkwin) { if (![NSApp isDrawing]) { TkWindow *winPtr = (TkWindow *) tkwin; NSWindow *w = TkMacOSXDrawableWindow(winPtr->window); [[w contentView] setNeedsDisplay: YES]; } } /* *---------------------------------------------------------------------- * * TkMacOSXRegisterOffScreenWindow -- * * This function adds the passed in Off Screen Port to the hash table that * maps Mac windows to root X windows. * * Results: * None. * * Side effects: * An entry is added to the windowTable hash table. * |
︙ | ︙ | |||
6217 6218 6219 6220 6221 6222 6223 | } /* *---------------------------------------------------------------------- * * TkpChangeFocus -- * | | | > > | 6531 6532 6533 6534 6535 6536 6537 6538 6539 6540 6541 6542 6543 6544 6545 6546 6547 6548 | } /* *---------------------------------------------------------------------- * * TkpChangeFocus -- * * This function is called when Tk moves focus from one window to another. * It should be passed a non-embedded TopLevel. That toplevel gets raised * to the top of the Tk stacking order and the associated NSWindow is * ordered Front. * * Results: * The return value is the serial number of the command that changed the * focus. It may be needed by the caller to filter out focus change * events that were queued before the command. If the procedure doesn't * actually change the focus then it returns 0. * |
︙ | ︙ | |||
6243 6244 6245 6246 6247 6248 6249 | * didn't originally belong to topLevelPtr's * application. */ { if (winPtr->atts.override_redirect) { return 0; } | | > | | | 6559 6560 6561 6562 6563 6564 6565 6566 6567 6568 6569 6570 6571 6572 6573 6574 6575 6576 6577 6578 6579 6580 | * didn't originally belong to topLevelPtr's * application. */ { if (winPtr->atts.override_redirect) { return 0; } if (Tk_IsTopLevel(winPtr) && !Tk_IsEmbedded(winPtr)) { NSWindow *win = TkMacOSXDrawableWindow(winPtr->window); TkWmRestackToplevel(winPtr, Above, NULL); if (force) { [NSApp activateIgnoringOtherApps:YES]; } if (win && [win canBecomeKeyWindow]) { [win makeKeyAndOrderFront:NSApp]; } } /* * Remember the current serial number for the X server and issue a dummy * server request. This marks the position at which we changed the focus, |
︙ | ︙ | |||
6408 6409 6410 6411 6412 6413 6414 6415 | void TkMacOSXApplyWindowAttributes( TkWindow *winPtr, NSWindow *macWindow) { WmInfo *wmPtr = winPtr->wmInfoPtr; ApplyWindowAttributeFlagChanges(winPtr, macWindow, 0, 0, 0, 1); | > | | 6725 6726 6727 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 | void TkMacOSXApplyWindowAttributes( TkWindow *winPtr, NSWindow *macWindow) { WmInfo *wmPtr = winPtr->wmInfoPtr; ApplyWindowAttributeFlagChanges(winPtr, macWindow, 0, 0, 0, 1); if (wmPtr->master != NULL || winPtr->atts.override_redirect) { ApplyMasterOverrideChanges(winPtr, macWindow); } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
6447 6448 6449 6450 6451 6452 6453 | UInt64 newAttributes = ForceAttributes(wmPtr->attributes, wmPtr->macClass); UInt64 changedAttributes = newAttributes ^ ForceAttributes(oldAttributes, wmPtr->macClass); if (changedAttributes || wmPtr->flags != oldFlags || initial) { if (!macWindow) { if (winPtr->window == None) { | | < < > | < < > | 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 6776 6777 6778 6779 6780 6781 6782 6783 6784 6785 6786 6787 6788 | UInt64 newAttributes = ForceAttributes(wmPtr->attributes, wmPtr->macClass); UInt64 changedAttributes = newAttributes ^ ForceAttributes(oldAttributes, wmPtr->macClass); if (changedAttributes || wmPtr->flags != oldFlags || initial) { if (!macWindow) { if (winPtr->window == None) { if (!create) { return; } Tk_MakeWindowExist((Tk_Window) winPtr); } if (!TkMacOSXHostToplevelExists(winPtr)) { if (!create) { return; } TkMacOSXMakeRealWindowExist(winPtr); } macWindow = TkMacOSXDrawableWindow(winPtr->window); } if ((changedAttributes & kWindowCloseBoxAttribute) || initial) { [[macWindow standardWindowButton:NSWindowCloseButton] setEnabled:!!(newAttributes & kWindowCloseBoxAttribute)]; } |
︙ | ︙ | |||
6495 6496 6497 6498 6499 6500 6501 6502 6503 6504 6505 6506 6507 6508 | } if ((changedAttributes & kWindowToolbarButtonAttribute) || initial) { [macWindow setShowsToolbarButton: !!(newAttributes & kWindowToolbarButtonAttribute)]; if ((newAttributes & kWindowToolbarButtonAttribute) && ![macWindow toolbar]) { NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@""]; [toolbar setVisible:NO]; [macWindow setToolbar:toolbar]; [toolbar release]; NSCell *toolbarButtonCell = [[macWindow standardWindowButton: NSWindowToolbarButton] cell]; [toolbarButtonCell setTarget:[macWindow contentView]]; [toolbarButtonCell setAction:@selector(tkToolbarButton:)]; | > | 6811 6812 6813 6814 6815 6816 6817 6818 6819 6820 6821 6822 6823 6824 6825 | } if ((changedAttributes & kWindowToolbarButtonAttribute) || initial) { [macWindow setShowsToolbarButton: !!(newAttributes & kWindowToolbarButtonAttribute)]; if ((newAttributes & kWindowToolbarButtonAttribute) && ![macWindow toolbar]) { NSToolbar *toolbar = [[NSToolbar alloc] initWithIdentifier:@""]; [toolbar setVisible:NO]; [macWindow setToolbar:toolbar]; [toolbar release]; NSCell *toolbarButtonCell = [[macWindow standardWindowButton: NSWindowToolbarButton] cell]; [toolbarButtonCell setTarget:[macWindow contentView]]; [toolbarButtonCell setAction:@selector(tkToolbarButton:)]; |
︙ | ︙ | |||
6538 6539 6540 6541 6542 6543 6544 | * full screen, was included in the default as of OSX 10.13. For * uniformity we use the new default in all versions of the OS * after 10.10. */ #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000) if (!(macWindow.styleMask & NSUtilityWindowMask)) { | < < | | | | > | | | | > | | > | 6855 6856 6857 6858 6859 6860 6861 6862 6863 6864 6865 6866 6867 6868 6869 6870 6871 6872 6873 6874 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 6890 6891 6892 | * full screen, was included in the default as of OSX 10.13. For * uniformity we use the new default in all versions of the OS * after 10.10. */ #if !(MAC_OS_X_VERSION_MAX_ALLOWED < 101000) if (!(macWindow.styleMask & NSUtilityWindowMask)) { /* * Exclude overrideredirect, transient, and "help"-styled * windows from moving into their own fullscreen space. */ if ((winPtr->atts.override_redirect) || (wmPtr->master != NULL) || (winPtr->wmInfoPtr->macClass == kHelpWindowClass)) { b |= (NSWindowCollectionBehaviorCanJoinAllSpaces | NSWindowCollectionBehaviorFullScreenAuxiliary); } else { NSSize screenSize = [[macWindow screen] frame].size; b |= NSWindowCollectionBehaviorFullScreenPrimary; /* * The default max size has height less than the screen * height. This causes the window manager to refuse to * allow the window to be resized when it is a split * window. To work around this we make the max size equal * to the screen size. (For 10.11 and up, only) */ if ([NSApp macMinorVersion] > 10) { [macWindow setMaxFullScreenContentSize:screenSize]; } } } #endif if (newAttributes & tkCanJoinAllSpacesAttribute) { b |= NSWindowCollectionBehaviorCanJoinAllSpaces; } else if (newAttributes & tkMoveToActiveSpaceAttribute) { |
︙ | ︙ | |||
6590 6591 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 | /* * The change of window class/attributes might have changed the window * frame geometry: */ NSRect structureRect = [macWindow frameRectForContentRect:NSZeroRect]; wmPtr->xInParent = -structureRect.origin.x; wmPtr->yInParent = structureRect.origin.y + structureRect.size.height; wmPtr->parentWidth = winPtr->changes.width + structureRect.size.width; wmPtr->parentHeight = winPtr->changes.height + structureRect.size.height; } } | > | 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 | /* * The change of window class/attributes might have changed the window * frame geometry: */ NSRect structureRect = [macWindow frameRectForContentRect:NSZeroRect]; wmPtr->xInParent = -structureRect.origin.x; wmPtr->yInParent = structureRect.origin.y + structureRect.size.height; wmPtr->parentWidth = winPtr->changes.width + structureRect.size.width; wmPtr->parentHeight = winPtr->changes.height + structureRect.size.height; } } |
︙ | ︙ | |||
6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 | NSWindow *macWindow) { WmInfo *wmPtr = winPtr->wmInfoPtr; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; unsigned long styleMask; NSRect structureRect; if (!macWindow && winPtr->window != None && TkMacOSXHostToplevelExists(winPtr)) { macWindow = TkMacOSXDrawableWindow(winPtr->window); } styleMask = [macWindow styleMask]; | > | 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 | NSWindow *macWindow) { WmInfo *wmPtr = winPtr->wmInfoPtr; UInt64 oldAttributes = wmPtr->attributes; int oldFlags = wmPtr->flags; unsigned long styleMask; NSRect structureRect; NSWindow *parentWindow; if (!macWindow && winPtr->window != None && TkMacOSXHostToplevelExists(winPtr)) { macWindow = TkMacOSXDrawableWindow(winPtr->window); } styleMask = [macWindow styleMask]; |
︙ | ︙ | |||
6663 6664 6665 6666 6667 6668 6669 | NSMiniaturizableWindowMask | NSResizableWindowMask; } else { styleMask |= NSTitledWindowMask; } } if (macWindow) { | < | | > < | < | | | | > > > > > > > > > | | > > > > > > | > | < < | | | > | | > > > > | 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 7049 7050 7051 7052 7053 7054 7055 7056 7057 7058 7059 7060 7061 7062 7063 7064 7065 7066 7067 7068 7069 7070 7071 | NSMiniaturizableWindowMask | NSResizableWindowMask; } else { styleMask |= NSTitledWindowMask; } } if (macWindow) { structureRect = [NSWindow frameRectForContentRect:NSZeroRect styleMask:styleMask]; /* * Synchronize the wmInfoPtr to match the new window configuration * so windowBoundsChanged won't corrupt the window manager info. */ wmPtr->xInParent = -structureRect.origin.x; wmPtr->yInParent = structureRect.origin.y + structureRect.size.height; wmPtr->parentWidth = winPtr->changes.width + structureRect.size.width; wmPtr->parentHeight = winPtr->changes.height + structureRect.size.height; if (winPtr->atts.override_redirect) { [macWindow setExcludedFromWindowsMenu:YES]; [macWindow setStyleMask:styleMask]; if (wmPtr->hints.initial_state == NormalState) { [macWindow orderFront:nil]; } if (wmPtr->master != NULL) { wmPtr->flags |= WM_TOPMOST; } else { wmPtr->flags &= ~WM_TOPMOST; } } else { const char *title = winPtr->wmInfoPtr->titleUid; if (!title) { title = winPtr->nameUid; } [macWindow setStyleMask:styleMask]; [macWindow setTitle:[NSString stringWithUTF8String:title]]; [macWindow setExcludedFromWindowsMenu:NO]; wmPtr->flags &= ~WM_TOPMOST; } if (wmPtr->master != None) { TkWindow *masterWinPtr = (TkWindow *) wmPtr->master; if (masterWinPtr && (masterWinPtr->window != None) && TkMacOSXHostToplevelExists(masterWinPtr)) { NSWindow *masterMacWin = TkMacOSXDrawableWindow( masterWinPtr->window); /* * Try to add the transient window as a child window of the * master. A child NSWindow retains its relative position with * respect to the parent when the parent is moved. This is * pointless if the parent is offscreen, and adding a child to * an offscreen window causes the parent to be displayed as a * zombie. So we only do this if the parent is visible. */ if (masterMacWin && [masterMacWin isVisible] && (winPtr->flags & TK_MAPPED)) { /* * If the transient is already a child of some other window, * remove it. */ parentWindow = [macWindow parentWindow]; if (parentWindow && parentWindow != masterMacWin) { [parentWindow removeChildWindow:macWindow]; } [masterMacWin addChildWindow:macWindow ordered:NSWindowAbove]; } } } else { parentWindow = [macWindow parentWindow]; if (parentWindow) { [parentWindow removeChildWindow:macWindow]; } } if (wmPtr->flags & WM_TOPMOST) { [macWindow setLevel:kCGUtilityWindowLevel]; } ApplyWindowAttributeFlagChanges(winPtr, macWindow, oldAttributes, oldFlags, 0, 0); } } /* |
︙ | ︙ | |||
6902 6903 6904 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 6923 6924 6925 | static void RemapWindows( TkWindow *winPtr, MacDrawable *parentWin) { TkWindow *childPtr; /* * Remove the OS specific window. It will get rebuilt when the window gets * Mapped. */ if (winPtr->window != None) { MacDrawable *macWin = (MacDrawable *) winPtr->window; macWin->toplevel->referenceCount--; macWin->toplevel = parentWin->toplevel; macWin->toplevel->referenceCount++; winPtr->flags &= ~TK_MAPPED; #ifdef TK_REBUILD_TOPLEVEL winPtr->flags |= TK_REBUILD_TOPLEVEL; #endif } | > > | > > | 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 7267 7268 7269 7270 7271 7272 7273 7274 | static void RemapWindows( TkWindow *winPtr, MacDrawable *parentWin) { TkWindow *childPtr; /* * Remove the OS specific window. It will get rebuilt when the window gets * Mapped. */ if (winPtr->window != None) { MacDrawable *macWin = (MacDrawable *) winPtr->window; macWin->toplevel->referenceCount--; macWin->toplevel = parentWin->toplevel; macWin->toplevel->referenceCount++; winPtr->flags &= ~TK_MAPPED; #ifdef TK_REBUILD_TOPLEVEL winPtr->flags |= TK_REBUILD_TOPLEVEL; #endif } /* * Repeat for all the children. */ for (childPtr = winPtr->childList; childPtr != NULL; childPtr = childPtr->nextPtr) { RemapWindows(childPtr, (MacDrawable *) winPtr->window); } } /* |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.h.
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | char* command; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; /* * A data structure of the following type holds window-manager-related * information for each top-level window in an application. */ typedef struct TkWmInfo { TkWindow *winPtr; /* Pointer to main Tk information for this * window. */ Window reparent; /* If the window has been reparented, this * gives the ID of the ancestor of the window * that is a child of the root window (may not * be window's immediate parent). If the window * isn't reparented, this has the value * None. */ Tk_Uid titleUid; /* Title to display in window caption. If NULL, * use name of widget. */ char *iconName; /* Name to display in icon. */ | > > > > > > > > > > > | < < < < > > > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | char* command; /* Tcl command to invoke when a client message * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; /* The following data structure is used in the TkWmInfo to maintain a list of all of the * transient windows belonging to a given master. */ typedef struct Transient { TkWindow *winPtr; int flags; struct Transient *nextPtr; } Transient; #define WITHDRAWN_BY_MASTER 0x1 /* * A data structure of the following type holds window-manager-related * information for each top-level window in an application. */ typedef struct TkWmInfo { TkWindow *winPtr; /* Pointer to main Tk information for this * window. */ Window reparent; /* If the window has been reparented, this * gives the ID of the ancestor of the window * that is a child of the root window (may not * be window's immediate parent). If the window * isn't reparented, this has the value * None. */ Tk_Uid titleUid; /* Title to display in window caption. If NULL, * use name of widget. */ char *iconName; /* Name to display in icon. */ Tk_Window master; /* Master window for TRANSIENT_FOR property, or * None. */ XWMHints hints; /* Various pieces of information for window * manager. */ char *leaderName; /* Path name of leader of window group * (corresponds to hints.window_group). * Malloc-ed. Note: this field doesn't get * updated if leader is destroyed. */ Tk_Window icon; /* Window to use as icon for this window, or * NULL. */ Tk_Window iconFor; /* Window for which this window is icon, or * NULL if this isn't an icon for anyone. */ Transient *transientPtr; /* First item in a list of all transient windows * belonging to this window, or NULL if there * are no transients. */ /* * Information used to construct an XSizeHints structure for the window * manager: */ int sizeHintsFlags; /* Flags word for XSizeHints structure. If the |
︙ | ︙ |
Changes to macosx/tkMacOSXXStubs.c.
︙ | ︙ | |||
174 175 176 177 178 179 180 | snprintf(vendor, sizeof(vendor), "Apple AppKit %g", NSAppKitVersionNumber); } display->vendor = vendor; { int major, minor, patch; | | | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | snprintf(vendor, sizeof(vendor), "Apple AppKit %g", NSAppKitVersionNumber); } display->vendor = vendor; { int major, minor, patch; #if MAC_OS_X_VERSION_MAX_ALLOWED < 101000 Gestalt(gestaltSystemVersionMajor, (SInt32*)&major); Gestalt(gestaltSystemVersionMinor, (SInt32*)&minor); Gestalt(gestaltSystemVersionBugFix, (SInt32*)&patch); #else NSOperatingSystemVersion systemVersion = [[NSProcessInfo processInfo] operatingSystemVersion]; major = systemVersion.majorVersion; minor = systemVersion.minorVersion; |
︙ | ︙ | |||
671 672 673 674 675 676 677 | * However, there is no real way to do this on a Mac. Let me know if there * is! */ display->request++; } | < < < < < < < < | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 | * However, there is no real way to do this on a Mac. Let me know if there * is! */ display->request++; } int XSync( Display *display, Bool flag) { TkMacOSXFlushWindows(); display->request++; |
︙ | ︙ |
Changes to macosx/ttkMacOSXTheme.c.
1 2 3 | /* * ttkMacOSXTheme.c -- * | | > | | | | | < | | | < > < > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | > > | | | | | > | | | | | > | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > < < < < | | | | | > | > | | | | | > > | < > > > | | | > | | < > | > | > | > > > > > > > > > > > > > > > > > > > > | > > > > | | > > > > | > | > > > > > > | > > > > > > | > | > > > > | | > | > < | | > > > > > > > > > > | | | > > | > | | | < | < < < < | < < < | > > | > > | | > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < | | | | | | | < | < | | | < | < | | | | > > | > > > > | | | > > | > > > > > | > > > | > > > > | | > > | > > < < < < < < < < > > > > > > > > > > > > > | > | | > | | < | | | > | > > > > | | > > | > > > > > > > | | | | | < < | > | > | | | > > > | | > > | > > > > | | | > > | > > < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | > > > > > | | > > > > > > > > | | | | | > > > > > > > > > | < < < | > | > > | < > > > > > > > > > > > | < | > > > > | | | | | > > | > > | > > > > > > > > > > > | > > < < < < | | | | > > > > > > > > > > > > > | > | | > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > | > > > | < < > > > > > > > | > > > | > > | | | < > | > > > > > | | | | | | < | | | | | | | | | < | > > > > | | | | > > | > > | | | > | | > | | > > > > > > > > > > > > > | | > < < < > | > > > > | | | | | | | | | | | | | | | | | | | < | > > > > | | | | > > | > > > > | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | > > > > | | | > > > > | | | > > > > | > > | > | | > > > > | | | | > > > > | | | > | > | > | > > | > > > > > > > > > > > > > > > > > > > | > > > > > > > > | | > | > | > > | > > > > > > > > > > > > > > > > | < | | | | | > | > > > > | < | | < | | | | | | | > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > < | | | > | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > | > > | | | > | | | | < | > > > > | | | | > > | > > > > | | > | | | | | | | | | | | | | | | > | > | | > | > > > > > > | | | | | > > > > > > > > > > > > > > > > | | > > | > > | | > > > > | > | | | | | | > > > > | > > | > > > | > > > > > > > > > > > > > | | | > | > > > > | > | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 | /* * ttkMacOSXTheme.c -- * * Tk theme engine for Mac OSX, using the Appearance Manager API. * * Copyright (c) 2004 Joe English * Copyright (c) 2005 Neil Madden * Copyright (c) 2006-2009 Daniel A. Steffen <[email protected]> * Copyright 2008-2009, Apple Inc. * Copyright 2009 Kevin Walzer/WordTech Communications LLC. * Copyright 2019 Marc Culler * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * See also: * * <URL: http://developer.apple.com/documentation/Carbon/Reference/ * Appearance_Manager/appearance_manager/APIIndex.html > * * Notes: * "Active" means different things in Mac and Tk terminology -- * On Aqua, widgets are "Active" if they belong to the foreground window, * "Inactive" if they are in a background window. Tk uses the term * "active" to mean that the mouse cursor is over a widget; aka "hover", * "prelight", or "hot-tracked". Aqua doesn't use this kind of feedback. * * The QuickDraw/Carbon coordinate system is relative to the top-level * window, not to the Tk_Window. BoxToRect() accounts for this. */ #include "tkMacOSXPrivate.h" #include "ttk/ttkTheme.h" #include <math.h> /* * Macros for handling drawing contexts. */ #define BEGIN_DRAWING(d) { \ TkMacOSXDrawingContext dc; \ if (!TkMacOSXSetupDrawingContext((d), NULL, 1, &dc)) {return;} #define END_DRAWING \ TkMacOSXRestoreDrawingContext(&dc);} #define HIOrientation kHIThemeOrientationNormal #define NoThemeMetric 0xFFFFFFFF #ifdef __LP64__ #define RangeToFactor(maximum) (((double) (INT_MAX >> 1)) / (maximum)) #else #define RangeToFactor(maximum) (((double) (LONG_MAX >> 1)) / (maximum)) #endif /* __LP64__ */ #define TTK_STATE_FIRST_TAB TTK_STATE_USER1 #define TTK_STATE_LAST_TAB TTK_STATE_USER2 #define TTK_TREEVIEW_STATE_SORTARROW TTK_STATE_USER1 /* * Colors and gradients used in Dark Mode. */ static CGFloat darkButtonFace[4] = { 112.0 / 255, 113.0 / 255, 115.0 / 255, 1.0 }; static CGFloat darkPressedBevelFace[4] = { 135.0 / 255, 136.0 / 255, 138.0 / 255, 1.0 }; static CGFloat darkSelectedBevelFace[4] = { 162.0 / 255, 163.0 / 255, 165.0 / 255, 1.0 }; static CGFloat darkDisabledButtonFace[4] = { 86.0 / 255, 87.0 / 255, 89.0 / 255, 1.0 }; static CGFloat darkInactiveSelectedTab[4] = { 159.0 / 255, 160.0 / 255, 161.0 / 255, 1.0 }; static CGFloat darkFocusRing[4] = { 38.0 / 255, 113.0 / 255, 159.0 / 255, 1.0 }; static CGFloat darkFocusRingTop[4] = { 50.0 / 255, 124.0 / 255, 171.0 / 255, 1.0 }; static CGFloat darkFocusRingBottom[4] = { 57.0 / 255, 130.0 / 255, 176.0 / 255, 1.0 }; static CGFloat darkTabSeparator[4] = {0.0, 0.0, 0.0, 0.25}; static CGFloat darkTrack[4] = {1.0, 1.0, 1.0, 0.25}; static CGFloat darkFrameTop[4] = {1.0, 1.0, 1.0, 0.0625}; static CGFloat darkFrameBottom[4] = {1.0, 1.0, 1.0, 0.125}; static CGFloat darkFrameAccent[4] = {0.0, 0.0, 0.0, 0.0625}; static CGFloat darkTopGradient[8] = { 1.0, 1.0, 1.0, 0.3, 1.0, 1.0, 1.0, 0.0 }; static CGFloat darkBackgroundGradient[8] = { 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.25 }; static CGFloat darkInactiveGradient[8] = { 89.0 / 255, 90.0 / 255, 93.0 / 255, 1.0, 119.0 / 255, 120.0 / 255, 122.0 / 255, 1.0 }; static CGFloat darkSelectedGradient[8] = { 23.0 / 255, 111.0 / 255, 232.0 / 255, 1.0, 20.0 / 255, 94.0 / 255, 206.0 / 255, 1.0 }; /* * When building on systems earlier than 10.8 there is no reasonable way to * convert an NSColor to a CGColor. We do run-time checking of the OS version, * and never need the CGColor property on older systems, so we can use this * CGCOLOR macro, which evaluates to NULL without raising compiler warnings. * Similarly, we never draw rounded rectangles on older systems which did not * have CGPathCreateWithRoundedRect, so we just redefine it to return NULL. */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 #define CGCOLOR(nscolor) nscolor.CGColor #else #define CGCOLOR(nscolor) (0 ? (CGColorRef) nscolor : NULL) #define CGPathCreateWithRoundedRect(w, x, y, z) NULL #endif /*---------------------------------------------------------------------- * +++ Utilities. */ /* * BoxToRect -- * Convert a Ttk_Box in Tk coordinates relative to the given Drawable * to a native Rect relative to the containing port. */ static inline CGRect BoxToRect( Drawable d, Ttk_Box b) { MacDrawable *md = (MacDrawable *) d; CGRect rect; rect.origin.y = b.y + md->yOff; rect.origin.x = b.x + md->xOff; rect.size.height = b.height; rect.size.width = b.width; return rect; } /* * Table mapping Tk states to Appearance manager ThemeStates */ static Ttk_StateTable ThemeStateTable[] = { {kThemeStateUnavailable, TTK_STATE_DISABLED, 0}, {kThemeStatePressed, TTK_STATE_PRESSED, 0}, {kThemeStateInactive, TTK_STATE_BACKGROUND, 0}, {kThemeStateActive, 0, 0} /* Others: Not sure what these are supposed to mean. Up/Down have * something to do with "little arrow" increment controls... Dunno what * a "Rollover" is. * NEM: Rollover is TTK_STATE_ACTIVE... but we don't handle that yet, by * the looks of things * * {kThemeStateRollover, 0, 0}, * {kThemeStateUnavailableInactive, 0, 0} * {kThemeStatePressedUp, 0, 0}, * {kThemeStatePressedDown, 0, 0} */ }; /*---------------------------------------------------------------------- * NormalizeButtonBounds -- * * Apple's Human Interface Guidelines only allow three specific heights * for most buttons: Regular, small and mini. We always use the regular * size. However, Ttk may provide an arbitrary bounding rectangle. We * always draw the button centered vertically on the rectangle, and * having the same width as the rectangle. This function returns the * actual bounding rectangle that will be used in drawing the button. * * The BevelButton is allowed to have arbitrary size, and also has * external padding. This is handled separately here. */ static CGRect NormalizeButtonBounds( SInt32 heightMetric, CGRect bounds) { SInt32 height; if (heightMetric != (SInt32) NoThemeMetric) { ChkErr(GetThemeMetric, heightMetric, &height); bounds.origin.y += (bounds.size.height - height) / 2; bounds.size.height = height; } return bounds; } /*---------------------------------------------------------------------- * +++ Backgrounds * * Support for contrasting background colors when GroupBoxes or Tabbed * panes are nested inside each other. Early versions of macOS used ridged * borders, so do not need contrasting backgrounds. */ /* * For systems older than 10.14, [NSColor windowBackGroundColor] generates * garbage when called from this function. In 10.14 it works correctly, and * must be used in order to have a background color which responds to Dark * Mode. So we use this hard-wired RGBA color on the older systems which don't * support Dark Mode anyway. */ static CGFloat windowBackground[4] = { 235.0 / 255, 235.0 / 255, 235.0 / 255, 1.0 }; static CGFloat whiteRGBA[4] = {1.0, 1.0, 1.0, 1.0}; static CGFloat blackRGBA[4] = {0.0, 0.0, 0.0, 1.0}; /*---------------------------------------------------------------------- * GetBackgroundColor -- * * Fills the array rgba with the color coordinates for a background color. * Start with the background color of a window's geometry master, or the * standard ttk window background if there is no master. If the contrast * parameter is nonzero, modify this color to be darker, for the aqua * appearance, or lighter for the DarkAqua appearance. This is primarily * used by the Fill and Background elements. */ static void GetBackgroundColor( CGContextRef context, Tk_Window tkwin, int contrast, CGFloat *rgba) { TkWindow *winPtr = (TkWindow *) tkwin; TkWindow *masterPtr = (TkWindow *) TkGetGeomMaster(tkwin); while (masterPtr != NULL) { if (masterPtr->privatePtr->flags & TTK_HAS_CONTRASTING_BG) { break; } masterPtr = (TkWindow *) TkGetGeomMaster(masterPtr); } if (masterPtr) { for (int i = 0; i < 4; i++) { rgba[i] = masterPtr->privatePtr->fillRGBA[i]; } } else { if ([NSApp macMinorVersion] > 13) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *windowColor = [[NSColor windowBackgroundColor] colorUsingColorSpace: deviceRGB]; [windowColor getComponents: rgba]; } else { for (int i = 0; i < 4; i++) { rgba[i] = windowBackground[i]; } } } if (contrast) { int isDark = (rgba[0] + rgba[1] + rgba[2] < 1.5); if (isDark) { for (int i = 0; i < 3; i++) { rgba[i] += 8.0 / 255.0; } } else { for (int i = 0; i < 3; i++) { rgba[i] -= 8.0 / 255.0; } } winPtr->privatePtr->flags |= TTK_HAS_CONTRASTING_BG; for (int i = 0; i < 4; i++) { winPtr->privatePtr->fillRGBA[i] = rgba[i]; } } } /*---------------------------------------------------------------------- * +++ Single Arrow Buttons -- * * Used in ListHeaders and Comboboxes. */ static void DrawDownArrow( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) { CGFloat x, y; CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2); CGContextBeginPath(context); CGPoint arrow[3] = { {x, y - size / 4}, {x + size / 2, y + size / 4}, {x + size, y - size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } static void DrawUpArrow( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) { CGFloat x, y; CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2); CGContextBeginPath(context); CGPoint arrow[3] = { {x, y + size / 4}, {x + size / 2, y - size / 4}, {x + size, y + size / 4} }; CGContextAddLines(context, arrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * +++ Double Arrow Buttons -- * * Used in MenuButtons and SpinButtons. */ static void DrawUpDownArrows( CGContextRef context, CGRect bounds, CGFloat inset, CGFloat size, CGFloat *rgba) { CGFloat x, y; CGContextSetRGBStrokeColor(context, rgba[0], rgba[1], rgba[2], rgba[3]); CGContextSetLineWidth(context, 1.5); x = bounds.origin.x + inset; y = bounds.origin.y + trunc(bounds.size.height / 2); CGContextBeginPath(context); CGPoint bottomArrow[3] = {{x, y + 2}, {x + size / 2, y + 2 + size / 2}, {x + size, y + 2}}; CGContextAddLines(context, bottomArrow, 3); CGPoint topArrow[3] = {{x, y - 2}, {x + size / 2, y - 2 - size / 2}, {x + size, y - 2}}; CGContextAddLines(context, topArrow, 3); CGContextStrokePath(context); } /*---------------------------------------------------------------------- * +++ FillButtonBackground -- * * Fills a rounded rectangle with a transparent black gradient. * This is a no-op if building on 10.8 or older. */ static void FillButtonBackground( CGContextRef context, CGRect bounds, CGFloat radius) { CGPathRef path; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGGradientRef backgroundGradient = CGGradientCreateWithColorComponents( deviceRGB.CGColorSpace, darkBackgroundGradient, NULL, 2); CGPoint backgroundEnd = { bounds.origin.x, bounds.origin.y + bounds.size.height }; CGContextBeginPath(context); path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); CGContextAddPath(context, path); CGContextClip(context); CGContextDrawLinearGradient(context, backgroundGradient, bounds.origin, backgroundEnd, 0); CFRelease(path); CFRelease(backgroundGradient); } /*---------------------------------------------------------------------- * +++ HighlightButtonBorder -- * * Accent the top border of a rounded rectangle with a transparent * white gradient. */ static void HighlightButtonBorder( CGContextRef context, CGRect bounds) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGPoint topEnd = {bounds.origin.x, bounds.origin.y + 3}; CGGradientRef topGradient = CGGradientCreateWithColorComponents( deviceRGB.CGColorSpace, darkTopGradient, NULL, 2); CGContextSaveGState(context); CGContextBeginPath(context); CGContextAddArc(context, bounds.origin.x + 4, bounds.origin.y + 4, 4, PI, 3 * PI / 2, 0); CGContextAddArc(context, bounds.origin.x + bounds.size.width - 4, bounds.origin.y + 4, 4, 3 * PI / 2, 0, 0); CGContextReplacePathWithStrokedPath(context); CGContextClip(context); CGContextDrawLinearGradient(context, topGradient, bounds.origin, topEnd, 0.0); CGContextRestoreGState(context); CFRelease(topGradient); } /*---------------------------------------------------------------------- * DrawGroupBox -- * * This is a standalone drawing procedure which draws the contrasting * rounded rectangular box for LabelFrames and Notebook panes used in * more recent versions of macOS. */ static void DrawGroupBox( CGRect bounds, CGContextRef context, Tk_Window tkwin) { CGPathRef path; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *borderColor, *bgColor; static CGFloat border[4] = {1.0, 1.0, 1.0, 0.25}; CGFloat fill[4]; GetBackgroundColor(context, tkwin, 1, fill); bgColor = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; CGContextSetFillColorSpace(context, deviceRGB.CGColorSpace); CGContextSetFillColorWithColor(context, CGCOLOR(bgColor)); path = CGPathCreateWithRoundedRect(bounds, 4, 4, NULL); CGContextClipToRect(context, bounds); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextFillPath(context); borderColor = [NSColor colorWithColorSpace: deviceRGB components: border count: 4]; CGContextSetFillColorWithColor(context, CGCOLOR(borderColor)); [borderColor getComponents: fill]; CGContextSetRGBFillColor(context, fill[0], fill[1], fill[2], fill[3]); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextReplacePathWithStrokedPath(context); CGContextFillPath(context); CFRelease(path); } /*---------------------------------------------------------------------- * SolidFillRoundedRectangle -- * * Fill a rounded rectangle with a specified solid color. */ static void SolidFillRoundedRectangle( CGContextRef context, CGRect bounds, CGFloat radius, NSColor *color) { CGPathRef path; CGContextSetFillColorWithColor(context, CGCOLOR(color)); path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextFillPath(context); CFRelease(path); } /*---------------------------------------------------------------------- * +++ DrawListHeader -- * * This is a standalone drawing procedure which draws column headers for * a Treeview in the Aqua appearance. The HITheme headers have not * matched the native ones since OSX 10.8. Note that the header image is * ignored, but we draw arrows according to the state. */ static void DrawListHeader( CGRect bounds, CGContextRef context, Tk_Window tkwin, int state) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *strokeColor, *bgColor; static CGFloat borderRGBA[4] = { 200.0 / 255, 200.0 / 255, 200.0 / 255, 1.0 }; static CGFloat separatorRGBA[4] = { 220.0 / 255, 220.0 / 255, 220.0 / 255, 1.0 }; static CGFloat activeBgRGBA[4] = { 238.0 / 255, 238.0 / 255, 238.0 / 255, 1.0 }; static CGFloat inactiveBgRGBA[4] = { 246.0 / 255, 246.0 / 255, 246.0 / 255, 1.0 }; /* * Apple changes the background of a list header when the window is not * active. But Ttk does not indicate that in the state of a TreeHeader. * So we have to query the Apple window manager. */ NSWindow *win = TkMacOSXDrawableWindow(Tk_WindowId(tkwin)); CGFloat *bgRGBA = [win isKeyWindow] ? activeBgRGBA : inactiveBgRGBA; CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint top[2] = {{x, y + 1}, {x + w, y + 1}}; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGPoint separator[2] = {{x + w - 1, y + 3}, {x + w - 1, y + h - 3}}; bgColor = [NSColor colorWithColorSpace: deviceRGB components: bgRGBA count: 4]; CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); CGContextSetFillColorSpace(context, deviceRGB.CGColorSpace); CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGContextBeginPath(context); CGContextSetFillColorWithColor(context, CGCOLOR(bgColor)); CGContextAddRect(context, bounds); CGContextFillPath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: separatorRGBA count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, separator, 2); CGContextStrokePath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: borderRGBA count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, top, 2); CGContextStrokePath(context); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); CGContextRestoreGState(context); if (state & TTK_TREEVIEW_STATE_SORTARROW) { CGRect arrowBounds = bounds; arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { DrawUpArrow(context, arrowBounds, 3, 8, blackRGBA); } else if (state & TTK_STATE_SELECTED) { DrawDownArrow(context, arrowBounds, 3, 8, blackRGBA); } } } /*---------------------------------------------------------------------- * +++ Drawing procedures for widgets in Apple's "Dark Mode" (10.14 and up). * * The HIToolbox does not support Dark Mode, and apparently never will, * so to make widgets look "native" we have to provide analogues of the * HITheme drawing functions to be used in DarkAqua. We continue to use * HITheme in Aqua, since it understands earlier versions of the OS. * * Drawing the dark widgets requires NSColors that were introduced in OSX * 10.14, so we make some of these functions be no-ops when building on * systems older than 10.14. */ /*---------------------------------------------------------------------- * GradientFillRoundedRectangle -- * * Fill a rounded rectangle with a specified gradient. */ static void GradientFillRoundedRectangle( CGContextRef context, CGRect bounds, CGFloat radius, CGFloat *colors, int numColors) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGPathRef path; CGPoint end = { bounds.origin.x, bounds.origin.y + bounds.size.height }; CGGradientRef gradient = CGGradientCreateWithColorComponents( deviceRGB.CGColorSpace, colors, NULL, numColors); path = CGPathCreateWithRoundedRect(bounds, radius, radius, NULL); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextClip(context); CGContextDrawLinearGradient(context, gradient, bounds.origin, end, 0); CFRelease(path); CFRelease(gradient); } /*---------------------------------------------------------------------- * +++ DrawDarkButton -- * * This is a standalone drawing procedure which draws PushButtons and * PopupButtons in the Dark Mode style. */ static void DrawDarkButton( CGRect bounds, ThemeButtonKind kind, Ttk_State state, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *faceColor; /* * To match the appearance of Apple's buttons we need to increase the * height by 1 pixel. */ bounds.size.height += 1; CGContextClipToRect(context, bounds); FillButtonBackground(context, bounds, 5); /* * Fill the button face with the appropriate color. */ bounds = CGRectInset(bounds, 1, 1); if (kind == kThemePushButton && (state & TTK_STATE_PRESSED)) { GradientFillRoundedRectangle(context, bounds, 4, darkSelectedGradient, 2); } else { if (state & TTK_STATE_DISABLED) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkDisabledButtonFace count: 4]; } else { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkButtonFace count: 4]; } SolidFillRoundedRectangle(context, bounds, 4, faceColor); } /* * If this is a popup, draw the arrow button. */ if ((kind == kThemePopupButton) | (kind == kThemeComboBox)) { CGRect arrowBounds = bounds; arrowBounds.size.width = 16; arrowBounds.origin.x += bounds.size.width - 16; /* * If the toplevel is front, paint the button blue. */ if (!(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED)) { GradientFillRoundedRectangle(context, arrowBounds, 4, darkSelectedGradient, 2); } if (kind == kThemePopupButton) { DrawUpDownArrows(context, arrowBounds, 3, 7, whiteRGBA); } else { DrawDownArrow(context, arrowBounds, 4, 8, whiteRGBA); } } HighlightButtonBorder(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkIncDecButton -- * * This is a standalone drawing procedure which draws an IncDecButton * (as used in a Spinbox) in the Dark Mode style. */ static void DrawDarkIncDecButton( CGRect bounds, ThemeDrawState drawState, Ttk_State state, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *faceColor; bounds = CGRectInset(bounds, 0, -1); CGContextClipToRect(context, bounds); FillButtonBackground(context, bounds, 6); /* * Fill the button face with the appropriate color. */ bounds = CGRectInset(bounds, 1, 1); if (state & TTK_STATE_DISABLED) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkDisabledButtonFace count: 4]; } else { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkButtonFace count: 4]; } SolidFillRoundedRectangle(context, bounds, 4, faceColor); /* * If pressed, paint the appropriate half blue. */ if (state & TTK_STATE_PRESSED) { CGRect clip = bounds; clip.size.height /= 2; CGContextSaveGState(context); if (drawState == kThemeStatePressedDown) { clip.origin.y += clip.size.height; } CGContextClipToRect(context, clip); GradientFillRoundedRectangle(context, bounds, 5, darkSelectedGradient, 2); CGContextRestoreGState(context); } DrawUpDownArrows(context, bounds, 3, 5, whiteRGBA); HighlightButtonBorder(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkBevelButton -- * * This is a standalone drawing procedure which draws RoundedBevelButtons * in the Dark Mode style. */ static void DrawDarkBevelButton( CGRect bounds, Ttk_State state, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *faceColor; CGContextClipToRect(context, bounds); FillButtonBackground(context, bounds, 5); /* * Fill the button face with the appropriate color. */ bounds = CGRectInset(bounds, 1, 1); if (state & TTK_STATE_PRESSED) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkPressedBevelFace count: 4]; } else if ((state & TTK_STATE_DISABLED) || (state & TTK_STATE_ALTERNATE)) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkDisabledButtonFace count: 4]; } else if (state & TTK_STATE_SELECTED) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkSelectedBevelFace count: 4]; } else { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkButtonFace count: 4]; } SolidFillRoundedRectangle(context, bounds, 4, faceColor); HighlightButtonBorder(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkCheckBox -- * * This is a standalone drawing procedure which draws Checkboxes in the * Dark Mode style. */ static void DrawDarkCheckBox( CGRect bounds, Ttk_State state, CGContextRef context) { CGRect checkbounds = {{0, bounds.size.height / 2 - 8}, {16, 16}}; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; CGFloat x, y; bounds = CGRectOffset(checkbounds, bounds.origin.x, bounds.origin.y); x = bounds.origin.x; y = bounds.origin.y; CGContextClipToRect(context, bounds); FillButtonBackground(context, bounds, 4); bounds = CGRectInset(bounds, 1, 1); if (!(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED) && ((state & TTK_STATE_SELECTED) || (state & TTK_STATE_ALTERNATE))) { GradientFillRoundedRectangle(context, bounds, 3, darkSelectedGradient, 2); } else { GradientFillRoundedRectangle(context, bounds, 3, darkInactiveGradient, 2); } HighlightButtonBorder(context, bounds); if ((state & TTK_STATE_SELECTED) || (state & TTK_STATE_ALTERNATE)) { CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); if (state & TTK_STATE_DISABLED) { stroke = [NSColor disabledControlTextColor]; } else { stroke = [NSColor controlTextColor]; } CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); } if (state & TTK_STATE_SELECTED) { CGContextSetLineWidth(context, 1.5); CGContextBeginPath(context); CGPoint check[3] = {{x + 4, y + 8}, {x + 7, y + 11}, {x + 11, y + 4}}; CGContextAddLines(context, check, 3); CGContextStrokePath(context); } else if (state & TTK_STATE_ALTERNATE) { CGContextSetLineWidth(context, 2.0); CGContextBeginPath(context); CGPoint bar[2] = {{x + 4, y + 8}, {x + 12, y + 8}}; CGContextAddLines(context, bar, 2); CGContextStrokePath(context); } } /*---------------------------------------------------------------------- * +++ DrawDarkRadioButton -- * * This is a standalone drawing procedure which draws RadioButtons * in the Dark Mode style. */ static void DrawDarkRadioButton( CGRect bounds, Ttk_State state, CGContextRef context) { CGRect checkbounds = {{0, bounds.size.height / 2 - 9}, {18, 18}}; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *fill; CGFloat x, y; bounds = CGRectOffset(checkbounds, bounds.origin.x, bounds.origin.y); x = bounds.origin.x; y = bounds.origin.y; CGContextClipToRect(context, bounds); FillButtonBackground(context, bounds, 9); bounds = CGRectInset(bounds, 1, 1); if (!(state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED) && ((state & TTK_STATE_SELECTED) || (state & TTK_STATE_ALTERNATE))) { GradientFillRoundedRectangle(context, bounds, 8, darkSelectedGradient, 2); } else { GradientFillRoundedRectangle(context, bounds, 8, darkInactiveGradient, 2); } HighlightButtonBorder(context, bounds); if ((state & TTK_STATE_SELECTED) || (state & TTK_STATE_ALTERNATE)) { CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); if (state & TTK_STATE_DISABLED) { fill = [NSColor disabledControlTextColor]; } else { fill = [NSColor controlTextColor]; } CGContextSetFillColorWithColor(context, CGCOLOR(fill)); } if (state & TTK_STATE_SELECTED) { CGContextBeginPath(context); CGRect dot = {{x + 6, y + 6}, {6, 6}}; CGContextAddEllipseInRect(context, dot); CGContextFillPath(context); } else if (state & TTK_STATE_ALTERNATE) { CGRect bar = {{x + 5, y + 8}, {8, 2}}; CGContextFillRect(context, bar); } } /*---------------------------------------------------------------------- * +++ DrawDarkTab -- * * This is a standalone drawing procedure which draws Tabbed Pane * Tabs in the Dark Mode style. */ static void DrawDarkTab( CGRect bounds, Ttk_State state, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *faceColor, *stroke; CGRect originalBounds = bounds; CGContextSetLineWidth(context, 1.0); CGContextClipToRect(context, bounds); /* * Extend the bounds to one or both sides so the rounded part will be * clipped off. */ if (!(state & TTK_STATE_FIRST_TAB)) { bounds.origin.x -= 10; bounds.size.width += 10; } if (!(state & TTK_STATE_LAST_TAB)) { bounds.size.width += 10; } /* * Fill the tab face with the appropriate color or gradient. Use a solid * color if the tab is not selected, otherwise use a blue or gray * gradient. */ bounds = CGRectInset(bounds, 1, 1); if (!(state & TTK_STATE_SELECTED)) { if (state & TTK_STATE_DISABLED) { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkDisabledButtonFace count: 4]; } else { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkButtonFace count: 4]; } SolidFillRoundedRectangle(context, bounds, 4, faceColor); /* * Draw a separator line on the left side of the tab if it * not first. */ if (!(state & TTK_STATE_FIRST_TAB)) { CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); stroke = [NSColor colorWithColorSpace: deviceRGB components: darkTabSeparator count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); CGContextBeginPath(context); CGContextMoveToPoint(context, originalBounds.origin.x, originalBounds.origin.y + 1); CGContextAddLineToPoint(context, originalBounds.origin.x, originalBounds.origin.y + originalBounds.size.height - 1); CGContextStrokePath(context); CGContextRestoreGState(context); } } else { /* * This is the selected tab; paint it blue. If it is first, cover up * the separator line drawn by the second one. (The selected tab is * always drawn last.) */ if ((state & TTK_STATE_FIRST_TAB) && !(state & TTK_STATE_LAST_TAB)) { bounds.size.width += 1; } if (!(state & TTK_STATE_BACKGROUND)) { GradientFillRoundedRectangle(context, bounds, 4, darkSelectedGradient, 2); } else { faceColor = [NSColor colorWithColorSpace: deviceRGB components: darkInactiveSelectedTab count: 4]; SolidFillRoundedRectangle(context, bounds, 4, faceColor); } HighlightButtonBorder(context, bounds); } } /*---------------------------------------------------------------------- * +++ DrawDarkSeparator -- * * This is a standalone drawing procedure which draws a separator widget * in Dark Mode. */ static void DrawDarkSeparator( CGRect bounds, CGContextRef context, Tk_Window tkwin) { static CGFloat fill[4] = {1.0, 1.0, 1.0, 0.3}; NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *fillColor = [NSColor colorWithColorSpace: deviceRGB components: fill count:4]; CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGContextFillRect(context, bounds); } /*---------------------------------------------------------------------- * +++ DrawDarkFocusRing -- * * This is a standalone drawing procedure which draws a focus ring around * an Entry widget in Dark Mode. */ static void DrawDarkFocusRing( CGRect bounds, CGContextRef context) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *strokeColor; NSColor *fillColor = [NSColor colorWithColorSpace:deviceRGB components:darkFocusRing count:4]; CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint topPart[4] = { {x, y + h}, {x, y + 1}, {x + w - 1, y + 1}, {x + w - 1, y + h} }; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); CGContextBeginPath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: darkFocusRingTop count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, topPart, 4); CGContextStrokePath(context); strokeColor = [NSColor colorWithColorSpace: deviceRGB components: darkFocusRingBottom count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(strokeColor)); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); CGContextSetShouldAntialias(context, true); CGContextSetFillColorWithColor(context, CGCOLOR(fillColor)); CGPathRef path = CGPathCreateWithRoundedRect(CGRectInset(bounds, -3, -3), 4, 4, NULL); CGContextBeginPath(context); CGContextAddPath(context, path); CGContextAddRect(context, bounds); CGContextEOFillPath(context); CGContextRestoreGState(context); } /*---------------------------------------------------------------------- * +++ DrawDarkFrame -- * * This is a standalone drawing procedure which draws various * types of borders in Dark Mode. */ static void DrawDarkFrame( CGRect bounds, CGContextRef context, HIThemeFrameKind kind) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint topPart[4] = { {x, y + h - 1}, {x, y + 1}, {x + w, y + 1}, {x + w, y + h - 1} }; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGPoint accent[2] = {{x, y + 1}, {x + w, y + 1}}; switch (kind) { case kHIThemeFrameTextFieldSquare: CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); CGContextBeginPath(context); stroke = [NSColor colorWithColorSpace: deviceRGB components: darkFrameTop count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); CGContextAddLines(context, topPart, 4); CGContextStrokePath(context); stroke = [NSColor colorWithColorSpace: deviceRGB components: darkFrameBottom count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); stroke = [NSColor colorWithColorSpace: deviceRGB components: darkFrameAccent count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); CGContextAddLines(context, accent, 2); CGContextStrokePath(context); CGContextRestoreGState(context); break; default: break; } } /*---------------------------------------------------------------------- * +++ DrawListHeader -- * * This is a standalone drawing procedure which draws column * headers for a Treeview in the Dark Mode. */ static void DrawDarkListHeader( CGRect bounds, CGContextRef context, Tk_Window tkwin, int state) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *stroke; CGContextSetStrokeColorSpace(context, deviceRGB.CGColorSpace); CGFloat x = bounds.origin.x, y = bounds.origin.y; CGFloat w = bounds.size.width, h = bounds.size.height; CGPoint top[2] = {{x, y}, {x + w, y}}; CGPoint bottom[2] = {{x, y + h}, {x + w, y + h}}; CGPoint separator[2] = {{x + w, y + 3}, {x + w, y + h - 3}}; CGContextSaveGState(context); CGContextSetShouldAntialias(context, false); stroke = [NSColor colorWithColorSpace: deviceRGB components: darkFrameBottom count: 4]; CGContextSetStrokeColorWithColor(context, CGCOLOR(stroke)); CGContextBeginPath(context); CGContextAddLines(context, top, 2); CGContextStrokePath(context); CGContextAddLines(context, bottom, 2); CGContextStrokePath(context); CGContextAddLines(context, separator, 2); CGContextStrokePath(context); CGContextRestoreGState(context); if (state & TTK_TREEVIEW_STATE_SORTARROW) { CGRect arrowBounds = bounds; arrowBounds.origin.x = bounds.origin.x + bounds.size.width - 16; arrowBounds.size.width = 16; if (state & TTK_STATE_ALTERNATE) { DrawUpArrow(context, arrowBounds, 3, 8, whiteRGBA); } else if (state & TTK_STATE_SELECTED) { DrawDownArrow(context, arrowBounds, 3, 8, whiteRGBA); } } } /*---------------------------------------------------------------------- * +++ Button element: Used for elements drawn with DrawThemeButton. */ /* * When Ttk draws the various types of buttons, a pointer to one of these * is passed as the clientData. */ typedef struct { ThemeButtonKind kind; ThemeMetric heightMetric; } ThemeButtonParams; static ThemeButtonParams PushButtonParams = {kThemePushButton, kThemeMetricPushButtonHeight}, CheckBoxParams = {kThemeCheckBox, kThemeMetricCheckBoxHeight}, RadioButtonParams = {kThemeRadioButton, kThemeMetricRadioButtonHeight}, BevelButtonParams = {kThemeRoundedBevelButton, NoThemeMetric}, PopupButtonParams = {kThemePopupButton, kThemeMetricPopupButtonHeight}, DisclosureParams = { kThemeDisclosureButton, kThemeMetricDisclosureTriangleHeight }, ListHeaderParams = {kThemeListHeaderButton, kThemeMetricListHeaderHeight}; static Ttk_StateTable ButtonValueTable[] = { {kThemeButtonMixed, TTK_STATE_ALTERNATE, 0}, {kThemeButtonOn, TTK_STATE_SELECTED, 0}, {kThemeButtonOff, 0, 0} /* * Others: kThemeDisclosureRight, kThemeDisclosureDown, * kThemeDisclosureLeft */ }; static Ttk_StateTable ButtonAdornmentTable[] = { {kThemeAdornmentDefault | kThemeAdornmentFocus, TTK_STATE_ALTERNATE | TTK_STATE_FOCUS, 0}, {kThemeAdornmentDefault, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentNone, TTK_STATE_ALTERNATE, 0}, {kThemeAdornmentFocus, TTK_STATE_FOCUS, 0}, {kThemeAdornmentNone, 0, 0} }; /*---------------------------------------------------------------------- * +++ computeButtonDrawInfo -- * * Fill in an appearance manager HIThemeButtonDrawInfo record. */ static inline HIThemeButtonDrawInfo computeButtonDrawInfo( ThemeButtonParams *params, Ttk_State state, Tk_Window tkwin) { /* * See ButtonElementDraw for the explanation of why we always draw * PushButtons in the active state. */ SInt32 HIThemeState; HIThemeState = Ttk_StateTableLookup(ThemeStateTable, state); switch (params->kind) { case kThemePushButton: HIThemeState &= ~kThemeStateInactive; HIThemeState |= kThemeStateActive; break; default: break; } const HIThemeButtonDrawInfo info = { .version = 0, .state = HIThemeState, .kind = params ? params->kind : 0, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state), }; return info; } /*---------------------------------------------------------------------- * +++ Button elements. */ static void ButtonElementMinSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ThemeButtonParams *params = clientData; if (params->heightMetric != NoThemeMetric) { ChkErr(GetThemeMetric, params->heightMetric, minHeight); /* * The theme height does not include the 1-pixel border around * the button, although it does include the 1-pixel shadow at * the bottom. */ *minHeight += 2; /* * The minwidth must be 0 to force the generic ttk code to compute the * correct text layout. For example, a non-zero value will cause the * text to be left justified, no matter what -anchor setting is used in * the style. */ *minWidth = 0; } } static void ButtonElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ThemeButtonParams *params = clientData; const HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, 0, tkwin); static const CGRect scratchBounds = {{0, 0}, {100, 100}}; CGRect contentBounds, backgroundBounds; int verticalPad; ButtonElementMinSize(clientData, elementRecord, tkwin, minWidth, minHeight, paddingPtr); /* * Given a hypothetical bounding rectangle for a button, HIToolbox will * compute a bounding rectangle for the button contents and a bounding * rectangle for the button background. The background bounds are large * enough to contain the image of the button in any state, which might * include highlight borders, shadows, etc. The content rectangle is not * centered vertically within the background rectangle, presumably because * shadows only appear on the bottom. Nonetheless, when HITools is asked * to draw a button with a certain bounding rectangle it draws the button * centered within the rectangle. * * To compute the effective padding around a button we request the * content and bounding rectangles for a 100x100 button and use the * padding between those. However, we symmetrize the padding on the * top and bottom, because that is how the button will be drawn. */ ChkErr(HIThemeGetButtonContentBounds, &scratchBounds, &info, &contentBounds); ChkErr(HIThemeGetButtonBackgroundBounds, &scratchBounds, &info, &backgroundBounds); paddingPtr->left = contentBounds.origin.x - backgroundBounds.origin.x; paddingPtr->right = CGRectGetMaxX(backgroundBounds) - CGRectGetMaxX(contentBounds); verticalPad = backgroundBounds.size.height - contentBounds.size.height; paddingPtr->top = paddingPtr->bottom = verticalPad / 2; } static void ButtonElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParams *params = clientData; CGRect bounds = BoxToRect(d, b); HIThemeButtonDrawInfo info = computeButtonDrawInfo(params, state, tkwin); bounds = NormalizeButtonBounds(params->heightMetric, bounds); BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { switch (info.kind) { case kThemePushButton: case kThemePopupButton: DrawDarkButton(bounds, info.kind, state, dc.context); break; case kThemeCheckBox: DrawDarkCheckBox(bounds, state, dc.context); break; case kThemeRadioButton: DrawDarkRadioButton(bounds, state, dc.context); break; case kThemeRoundedBevelButton: DrawDarkBevelButton(bounds, state, dc.context); break; default: ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } } else { /* * Apple's PushButton and PopupButton do not change their fill color * when the window is inactive. However, except in 10.7 (Lion), the * color of the arrow button on a PopupButton does change. For some * reason HITheme fills inactive buttons with a transparent color that * allows the window background to show through, leading to * inconsistent behavior. We work around this by filling behind an * inactive PopupButton with a text background color before asking * HIToolbox to draw it. For PushButtons, we simply draw them in the * active state. */ if (info.kind == kThemePopupButton && (state & TTK_STATE_BACKGROUND)) { CGRect innerBounds = CGRectInset(bounds, 1, 1); NSColor *whiteRGBA = [NSColor whiteColor]; SolidFillRoundedRectangle(dc.context, innerBounds, 4, whiteRGBA); } /* * A BevelButton with mixed value is drawn borderless, which does make * much sense for us. */ if (info.kind == kThemeRoundedBevelButton && info.value == kThemeButtonMixed) { info.value = kThemeButtonOff; info.state = kThemeStateInactive; } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec ButtonElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ButtonElementSize, ButtonElementDraw }; /*---------------------------------------------------------------------- * +++ Notebook elements. */ /* Tab position logic, c.f. ttkNotebook.c TabState() */ static Ttk_StateTable TabStyleTable[] = { {kThemeTabFrontInactive, TTK_STATE_SELECTED | TTK_STATE_BACKGROUND}, {kThemeTabNonFrontInactive, TTK_STATE_BACKGROUND}, {kThemeTabFrontUnavailable, TTK_STATE_DISABLED | TTK_STATE_SELECTED}, {kThemeTabNonFrontUnavailable, TTK_STATE_DISABLED}, {kThemeTabFront, TTK_STATE_SELECTED}, {kThemeTabNonFrontPressed, TTK_STATE_PRESSED}, {kThemeTabNonFront, 0} }; static Ttk_StateTable TabAdornmentTable[] = { {kHIThemeTabAdornmentNone, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, {kHIThemeTabAdornmentTrailingSeparator, TTK_STATE_FIRST_TAB}, {kHIThemeTabAdornmentNone, TTK_STATE_LAST_TAB}, {kHIThemeTabAdornmentTrailingSeparator, 0}, }; static Ttk_StateTable TabPositionTable[] = { {kHIThemeTabPositionOnly, TTK_STATE_FIRST_TAB | TTK_STATE_LAST_TAB}, {kHIThemeTabPositionFirst, TTK_STATE_FIRST_TAB}, {kHIThemeTabPositionLast, TTK_STATE_LAST_TAB}, {kHIThemeTabPositionMiddle, 0}, }; /* * Apple XHIG Tab View Specifications: * * Control sizes: Tab views are available in regular, small, and mini sizes. * The tab height is fixed for each size, but you control the size of the pane * area. The tab heights for each size are listed below: * - Regular size: 20 pixels. * - Small: 17 pixels. * - Mini: 15 pixels. * * Label spacing and fonts: The tab labels should be in a font that’s * proportional to the size of the tab view control. In addition, the label * should be placed so that there are equal margins of space before and after * it. The guidelines below provide the specifications you should use for tab * labels: * - Regular size: System font. Center in tab, leaving 12 pixels on each *side. * - Small: Small system font. Center in tab, leaving 10 pixels on each side. * - Mini: Mini system font. Center in tab, leaving 8 pixels on each side. * * Control spacing: Whether you decide to inset a tab view in a window or * extend its edges to the window sides and bottom, you should place the top * edge of the tab view 12 or 14 pixels below the bottom edge of the title bar * (or toolbar, if there is one). If you choose to inset a tab view in a * window, you should leave a margin of 20 pixels between the sides and bottom * of the tab view and the sides and bottom of the window (although 16 pixels * is also an acceptable margin-width). If you need to provide controls below * the tab view, leave enough space below the tab view so the controls are 20 * pixels above the bottom edge of the window and 12 pixels between the tab * view and the controls. * * If you choose to extend the tab view sides and bottom so that they meet the * window sides and bottom, you should leave a margin of at least 20 pixels * between the content in the tab view and the tab-view edges. * * <URL: http://developer.apple.com/documentation/userexperience/Conceptual/ * AppleHIGuidelines/XHIGControls/XHIGControls.html#//apple_ref/doc/uid/ * TP30000359-TPXREF116> */ static void TabElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { GetThemeMetric(kThemeMetricLargeTabHeight, (SInt32 *) minHeight); *paddingPtr = Ttk_MakePadding(0, 0, 0, 2); } static void TabElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); HIThemeTabDrawInfo info = { .version = 1, .style = Ttk_StateTableLookup(TabStyleTable, state), .direction = kThemeTabNorth, .size = kHIThemeTabSizeNormal, .adornment = Ttk_StateTableLookup(TabAdornmentTable, state), .kind = kHIThemeTabKindNormal, .position = Ttk_StateTableLookup(TabPositionTable, state), }; BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkTab(bounds, state, dc.context); } else { ChkErr(HIThemeDrawTab, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec TabElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TabElementSize, TabElementDraw }; /* * Notebook panes: */ static void PaneElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(9, 5, 9, 9); } static void PaneElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); bounds.origin.y -= kThemeMetricTabFrameOverlap; bounds.size.height += kThemeMetricTabFrameOverlap; BEGIN_DRAWING(d) if ([NSApp macMinorVersion] > 8) { DrawGroupBox(bounds, dc.context, tkwin); } else { HIThemeTabPaneDrawInfo info = { .version = 1, .state = Ttk_StateTableLookup(ThemeStateTable, state), .direction = kThemeTabNorth, .size = kHIThemeTabSizeNormal, .kind = kHIThemeTabKindNormal, .adornment = kHIThemeTabPaneAdornmentNormal, }; bounds.origin.y -= kThemeMetricTabFrameOverlap; bounds.size.height += kThemeMetricTabFrameOverlap; ChkErr(HIThemeDrawTabPane, &bounds, &info, dc.context, HIOrientation); } END_DRAWING } static Ttk_ElementSpec PaneElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, PaneElementSize, PaneElementDraw }; /*---------------------------------------------------------------------- * +++ Labelframe elements -- * * Labelframe borders: Use "primary group box ..." Quoth * DrawThemePrimaryGroup reference: "The primary group box frame is drawn * inside the specified rectangle and is a maximum of 2 pixels thick." * * "Maximum of 2 pixels thick" is apparently a lie; looks more like 4 to me * with shading. */ static void GroupElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_UniformPadding(4); } static void GroupElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); BEGIN_DRAWING(d) if ([NSApp macMinorVersion] > 8) { DrawGroupBox(bounds, dc.context, tkwin); } else { const HIThemeGroupBoxDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = kHIThemeGroupBoxKindPrimaryOpaque, }; ChkErr(HIThemeDrawGroupBox, &bounds, &info, dc.context, HIOrientation); } END_DRAWING } static Ttk_ElementSpec GroupElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, GroupElementSize, GroupElementDraw }; /*---------------------------------------------------------------------- * +++ Entry elements -- * * 3 pixels padding for focus rectangle * 2 pixels padding for EditTextFrame */ typedef struct { Tcl_Obj *backgroundObj; Tcl_Obj *fieldbackgroundObj; } EntryElement; #define ENTRY_DEFAULT_BACKGROUND "systemTextBackgroundColor" static Ttk_ElementOptionSpec EntryElementOptions[] = { {"-background", TK_OPTION_BORDER, offsetof(EntryElement, backgroundObj), ENTRY_DEFAULT_BACKGROUND}, {"-fieldbackground", TK_OPTION_BORDER, offsetof(EntryElement, fieldbackgroundObj), ENTRY_DEFAULT_BACKGROUND}, {0} }; static void EntryElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *paddingPtr = Ttk_MakePadding(7, 5, 7, 6); } static void EntryElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { EntryElement *e = elementRecord; Ttk_Box inner = Ttk_PadBox(b, Ttk_UniformPadding(3)); CGRect bounds = BoxToRect(d, inner); NSColor *background; Tk_3DBorder backgroundPtr = NULL; static const char *defaultBG = ENTRY_DEFAULT_BACKGROUND; if (TkMacOSXInDarkMode(tkwin)) { BEGIN_DRAWING(d) NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; CGFloat fill[4]; GetBackgroundColor(dc.context, tkwin, 1, fill); /* * Lighten the background to provide contrast. */ for (int i = 0; i < 3; i++) { fill[i] += 9.0 / 255.0; } background = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; CGContextSetFillColorWithColor(dc.context, CGCOLOR(background)); CGContextFillRect(dc.context, bounds); if (state & TTK_STATE_FOCUS) { DrawDarkFocusRing(bounds, dc.context); } else { DrawDarkFrame(bounds, dc.context, kHIThemeFrameTextFieldSquare); } END_DRAWING } else { const HIThemeFrameDrawInfo info = { .version = 0, .kind = kHIThemeFrameTextFieldSquare, .state = Ttk_StateTableLookup(ThemeStateTable, state), .isFocused = state & TTK_STATE_FOCUS, }; /* * Earlier versions of the Aqua theme ignored the -fieldbackground * option and used the -background as if it were -fieldbackground. * Here we are enabling -fieldbackground. For backwards * compatibility, if -fieldbackground is set to the default color and * -background is set to a different color then we use -background as * -fieldbackground. */ if (0 != strcmp(Tcl_GetString(e->fieldbackgroundObj), defaultBG)) { backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->fieldbackgroundObj); } else if (0 != strcmp(Tcl_GetString(e->backgroundObj), defaultBG)) { backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); } if (backgroundPtr != NULL) { XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), inner.x, inner.y, inner.width, inner.height); } BEGIN_DRAWING(d) if (backgroundPtr == NULL) { if ([NSApp macMinorVersion] > 8) { background = [NSColor textBackgroundColor]; CGContextSetFillColorWithColor(dc.context, CGCOLOR(background)); } else { CGContextSetRGBFillColor(dc.context, 1.0, 1.0, 1.0, 1.0); } CGContextFillRect(dc.context, bounds); } ChkErr(HIThemeDrawFrame, &bounds, &info, dc.context, HIOrientation); END_DRAWING } } static Ttk_ElementSpec EntryElementSpec = { TK_STYLE_VERSION_2, sizeof(EntryElement), EntryElementOptions, EntryElementSize, EntryElementDraw }; /*---------------------------------------------------------------------- * +++ Combobox elements -- * * NOTES: * The HIToolbox has incomplete and inconsistent support for ComboBoxes. * There is no constant available to get the height of a ComboBox with * GetThemeMetric. In fact, ComboBoxes are the same (fixed) height as * PopupButtons and PushButtons, but they have no shadow at the bottom. * As a result, they are drawn 1 pixel above the center of the bounds * rectangle rather than being centered like the other buttons. One can * request background bounds for a ComboBox, and it is reported with * height 23, while the actual button face, including its 1-pixel border * has height 21. Attempting to request the content bounds returns a 0x0 * rectangle. Measurement indicates that the arrow button has width 18. * * With no help available from HIToolbox, we have to use hard-wired * constants for the padding. We shift the bounding rectangle downward by * 1 pixel to account for the fact that the button is not centered. */ static Ttk_Padding ComboboxPadding = {4, 2, 20, 2}; static void ComboboxElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *minWidth = 24; *minHeight = 23; *paddingPtr = ComboboxPadding; } static void ComboboxElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = kThemeComboBox, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = Ttk_StateTableLookup(ButtonAdornmentTable, state), }; BEGIN_DRAWING(d) bounds.origin.y += 1; if (TkMacOSXInDarkMode(tkwin)) { bounds.size.height += 1; DrawDarkButton(bounds, info.kind, state, dc.context); } else if ([NSApp macMinorVersion] > 8) { if ((state & TTK_STATE_BACKGROUND) && !(state & TTK_STATE_DISABLED)) { NSColor *background = [NSColor textBackgroundColor]; CGRect innerBounds = CGRectInset(bounds, 1, 2); SolidFillRoundedRectangle(dc.context, innerBounds, 4, background); } ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec ComboboxElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, ComboboxElementSize, ComboboxElementDraw }; /*---------------------------------------------------------------------- * +++ Spinbutton elements -- * * From Apple HIG, part III, section "Controls", "The Stepper Control": * there should be 2 pixels of space between the stepper control (AKA * IncDecButton, AKA "little arrows") and the text field it modifies. * * Ttk expects the up and down arrows to be distinct elements but * HIToolbox draws them as one widget with two different pressed states. * We work around this by defining them as separate elements in the * layout, but making each one have a drawing method which also draws the * other one. The down button does no drawing when not pressed, and when * pressed draws the entire IncDecButton in its "pressed down" state. * The up button draws the entire IncDecButton when not pressed and when * pressed draws the IncDecButton in its "pressed up" state. NOTE: This * means that when the down button is pressed the IncDecButton will be * drawn twice, first in unpressed state by the up arrow and then in * "pressed down" state by the down button. The drawing must be done in * that order. So the up button must be listed first in the layout. */ static Ttk_Padding SpinbuttonMargins = {0, 0, 2, 0}; static void SpinButtonUpElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { SInt32 s; ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s); *minWidth = s + Ttk_PaddingWidth(SpinbuttonMargins); ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s); *minHeight = (s + Ttk_PaddingHeight(SpinbuttonMargins)) / 2; } static void SpinButtonUpElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins)); int infoState; bounds.size.height *= 2; if (state & TTK_STATE_PRESSED) { infoState = kThemeStatePressedUp; } else { infoState = Ttk_StateTableLookup(ThemeStateTable, state); } const HIThemeButtonDrawInfo info = { .version = 0, .state = infoState, .kind = kThemeIncDecButton, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = kThemeAdornmentNone, }; BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkIncDecButton(bounds, infoState, state, dc.context); } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec SpinButtonUpElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SpinButtonUpElementSize, SpinButtonUpElementDraw }; static void SpinButtonDownElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { SInt32 s; ChkErr(GetThemeMetric, kThemeMetricLittleArrowsWidth, &s); *minWidth = s + Ttk_PaddingWidth(SpinbuttonMargins); ChkErr(GetThemeMetric, kThemeMetricLittleArrowsHeight, &s); *minHeight = (s + Ttk_PaddingHeight(SpinbuttonMargins)) / 2; } static void SpinButtonDownElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, Ttk_PadBox(b, SpinbuttonMargins)); int infoState = 0; bounds.origin.y -= bounds.size.height; bounds.size.height *= 2; if (state & TTK_STATE_PRESSED) { infoState = kThemeStatePressedDown; } else { return; } const HIThemeButtonDrawInfo info = { .version = 0, .state = infoState, .kind = kThemeIncDecButton, .value = Ttk_StateTableLookup(ButtonValueTable, state), .adornment = kThemeAdornmentNone, }; BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkIncDecButton(bounds, infoState, state, dc.context); } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec SpinButtonDownElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SpinButtonDownElementSize, SpinButtonDownElementDraw }; /*---------------------------------------------------------------------- * +++ DrawThemeTrack-based elements -- * * Progress bars and scales. (See also: <<NOTE-TRACKS>>) */ /* * Apple does not change the appearance of a slider when the window becomes * inactive. So we shouldn't either. */ static Ttk_StateTable ThemeTrackEnableTable[] = { {kThemeTrackDisabled, TTK_STATE_DISABLED, 0}, {kThemeTrackActive, TTK_STATE_BACKGROUND, 0}, {kThemeTrackActive, 0, 0} /* { kThemeTrackNothingToScroll, ?, ? }, */ }; typedef struct { /* TrackElement client data */ ThemeTrackKind kind; SInt32 thicknessMetric; } TrackElementData; static TrackElementData ScaleData = { kThemeSlider, kThemeMetricHSliderHeight }; typedef struct { Tcl_Obj *fromObj; /* minimum value */ Tcl_Obj *toObj; /* maximum value */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *orientObj; /* horizontal / vertical */ } TrackElement; static Ttk_ElementOptionSpec TrackElementOptions[] = { {"-from", TK_OPTION_DOUBLE, offsetof(TrackElement, fromObj)}, {"-to", TK_OPTION_DOUBLE, offsetof(TrackElement, toObj)}, {"-value", TK_OPTION_DOUBLE, offsetof(TrackElement, valueObj)}, {"-orient", TK_OPTION_STRING, offsetof(TrackElement, orientObj)}, {0, 0, 0} }; static void TrackElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { TrackElementData *data = clientData; SInt32 size = 24; /* reasonable default ... */ ChkErr(GetThemeMetric, data->thicknessMetric, &size); *minWidth = *minHeight = size; } static void TrackElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { TrackElementData *data = clientData; TrackElement *elem = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; double from = 0, to = 100, value = 0, factor; Ttk_GetOrientFromObj(NULL, elem->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, elem->fromObj, &from); Tcl_GetDoubleFromObj(NULL, elem->toObj, &to); Tcl_GetDoubleFromObj(NULL, elem->valueObj, &value); factor = RangeToFactor(to - from); HIThemeTrackDrawInfo info = { .version = 0, .kind = data->kind, .bounds = BoxToRect(d, b), .min = from * factor, .max = to * factor, .value = value * factor, .attributes = kThemeTrackShowThumb | (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), .trackInfo.progress.phase = 0, }; if (info.kind == kThemeSlider) { info.trackInfo.slider.pressState = state & TTK_STATE_PRESSED ? kThemeThumbPressed : 0; if (state & TTK_STATE_ALTERNATE) { info.trackInfo.slider.thumbDir = kThemeThumbDownward; } else { info.trackInfo.slider.thumbDir = kThemeThumbPlain; } } BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack count: 4]; if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 1, bounds.size.height / 2 - 2); } else { bounds = CGRectInset(bounds, bounds.size.width / 2 - 3, 2); } SolidFillRoundedRectangle(dc.context, bounds, 2, trackColor); } ChkErr(HIThemeDrawTrack, &info, NULL, dc.context, HIOrientation); END_DRAWING } static Ttk_ElementSpec TrackElementSpec = { TK_STYLE_VERSION_2, sizeof(TrackElement), TrackElementOptions, TrackElementSize, TrackElementDraw }; /*---------------------------------------------------------------------- * Slider elements -- <<NOTE-TRACKS>> * * Has geometry only. The Scale widget adjusts the position of this element, * and uses it for hit detection. In the Aqua theme, the slider is actually * drawn as part of the trough element. * */ static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *minWidth = *minHeight = 24; } static Ttk_ElementSpec SliderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SliderElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Progress bar elements -- * * @@@ NOTE: According to an older revision of the Aqua reference docs, * @@@ the 'phase' field is between 0 and 4. Newer revisions say * @@@ that it can be any UInt8 value. */ typedef struct { Tcl_Obj *orientObj; /* horizontal / vertical */ Tcl_Obj *valueObj; /* current value */ Tcl_Obj *maximumObj; /* maximum value */ Tcl_Obj *phaseObj; /* animation phase */ Tcl_Obj *modeObj; /* progress bar mode */ } PbarElement; static Ttk_ElementOptionSpec PbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(PbarElement, orientObj), "horizontal"}, {"-value", TK_OPTION_DOUBLE, offsetof(PbarElement, valueObj), "0"}, {"-maximum", TK_OPTION_DOUBLE, offsetof(PbarElement, maximumObj), "100"}, {"-phase", TK_OPTION_INT, offsetof(PbarElement, phaseObj), "0"}, {"-mode", TK_OPTION_STRING, offsetof(PbarElement, modeObj), "determinate"}, {0, 0, 0, 0} }; static void PbarElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { SInt32 size = 24; /* @@@ Check HIG for correct default */ ChkErr(GetThemeMetric, kThemeMetricLargeProgressBarThickness, &size); *minWidth = *minHeight = size; } static void PbarElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { PbarElement *pbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL, phase = 0; double value = 0, maximum = 100, factor; Ttk_GetOrientFromObj(NULL, pbar->orientObj, &orientation); Tcl_GetDoubleFromObj(NULL, pbar->valueObj, &value); Tcl_GetDoubleFromObj(NULL, pbar->maximumObj, &maximum); Tcl_GetIntFromObj(NULL, pbar->phaseObj, &phase); factor = RangeToFactor(maximum); HIThemeTrackDrawInfo info = { .version = 0, .kind = (!strcmp("indeterminate", Tcl_GetString(pbar->modeObj)) && value) ? kThemeIndeterminateBar : kThemeProgressBar, .bounds = BoxToRect(d, b), .min = 0, .max = maximum * factor, .value = value * factor, .attributes = kThemeTrackShowThumb | (orientation == TTK_ORIENT_HORIZONTAL ? kThemeTrackHorizontal : 0), .enableState = Ttk_StateTableLookup(ThemeTrackEnableTable, state), .trackInfo.progress.phase = phase, }; BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *trackColor = [NSColor colorWithColorSpace: deviceRGB components: darkTrack count: 4]; if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 1, bounds.size.height / 2 - 3); } else { bounds = CGRectInset(bounds, bounds.size.width / 2 - 3, 1); } SolidFillRoundedRectangle(dc.context, bounds, 3, trackColor); } ChkErr(HIThemeDrawTrack, &info, NULL, dc.context, HIOrientation); END_DRAWING } static Ttk_ElementSpec PbarElementSpec = { TK_STYLE_VERSION_2, sizeof(PbarElement), PbarElementOptions, PbarElementSize, PbarElementDraw }; /*---------------------------------------------------------------------- * +++ Scrollbar elements */ typedef struct { Tcl_Obj *orientObj; } ScrollbarElement; static Ttk_ElementOptionSpec ScrollbarElementOptions[] = { {"-orient", TK_OPTION_STRING, offsetof(ScrollbarElement, orientObj), "horizontal"}, {0, 0, 0, 0} }; static void TroughElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; SInt32 thickness = 15; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); ChkErr(GetThemeMetric, kThemeMetricScrollBarWidth, &thickness); if (orientation == TTK_ORIENT_HORIZONTAL) { *minHeight = thickness; if ([NSApp macMinorVersion] > 7) { *paddingPtr = Ttk_MakePadding(4, 4, 4, 3); } } else { *minWidth = thickness; if ([NSApp macMinorVersion] > 7) { *paddingPtr = Ttk_MakePadding(4, 4, 3, 4); } } } static CGFloat lightTrough[4] = {250.0 / 255, 250.0 / 255, 250.0 / 255, 1.0}; static CGFloat darkTrough[4] = {45.0 / 255, 46.0 / 255, 49.0 / 255, 1.0}; static CGFloat lightInactiveThumb[4] = { 200.0 / 255, 200.0 / 255, 200.0 / 255, 1.0 }; static CGFloat lightActiveThumb[4] = { 133.0 / 255, 133.0 / 255, 133.0 / 255, 1.0 }; static CGFloat darkInactiveThumb[4] = { 116.0 / 255, 117.0 / 255, 118.0 / 255, 1.0 }; static CGFloat darkActiveThumb[4] = { 158.0 / 255, 158.0 / 255, 159.0 / 255, 1.0 }; static void TroughElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; CGRect bounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *troughColor; CGFloat *rgba = TkMacOSXInDarkMode(tkwin) ? darkTrough : lightTrough; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_HORIZONTAL) { bounds = CGRectInset(bounds, 0, 1); } else { bounds = CGRectInset(bounds, 1, 0); } troughColor = [NSColor colorWithColorSpace: deviceRGB components: rgba count: 4]; BEGIN_DRAWING(d) if ([NSApp macMinorVersion] > 8) { CGContextSetFillColorWithColor(dc.context, CGCOLOR(troughColor)); } else { ChkErr(HIThemeSetFill, kThemeBrushDocumentWindowBackground, NULL, dc.context, HIOrientation); } CGContextFillRect(dc.context, bounds); END_DRAWING } static Ttk_ElementSpec TroughElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, TroughElementSize, TroughElementDraw }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); if (orientation == TTK_ORIENT_VERTICAL) { *minHeight = 18; *minWidth = 8; } else { *minHeight = 8; *minWidth = 18; } } static void ThumbElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ScrollbarElement *scrollbar = elementRecord; int orientation = TTK_ORIENT_HORIZONTAL; Ttk_GetOrientFromObj(NULL, scrollbar->orientObj, &orientation); /* * In order to make ttk scrollbars work correctly it is necessary to be * able to display the thumb element at the size and location which the ttk * scrollbar widget requests. The algorithm that HIToolbox uses to * determine the thumb geometry from the input values of min, max, value * and viewSize is undocumented. A seemingly natural algorithm is * implemented below. This code uses that algorithm for older OS versions, * because using HITools also handles drawing the buttons and 3D thumb used * on those systems. For newer systems the cleanest approach is to just * draw the thumb directly. */ if ([NSApp macMinorVersion] > 8) { CGRect thumbBounds = BoxToRect(d, b); NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *thumbColor; CGFloat *rgba; if ((orientation == TTK_ORIENT_HORIZONTAL && thumbBounds.size.width >= Tk_Width(tkwin) - 8) || (orientation == TTK_ORIENT_VERTICAL && thumbBounds.size.height >= Tk_Height(tkwin) - 8)) { return; } int isDark = TkMacOSXInDarkMode(tkwin); if ((state & TTK_STATE_PRESSED) || (state & TTK_STATE_HOVER)) { rgba = isDark ? darkActiveThumb : lightActiveThumb; } else { rgba = isDark ? darkInactiveThumb : lightInactiveThumb; } thumbColor = [NSColor colorWithColorSpace: deviceRGB components: rgba count: 4]; BEGIN_DRAWING(d) SolidFillRoundedRectangle(dc.context, thumbBounds, 4, thumbColor); END_DRAWING } else { double thumbSize, trackSize, visibleSize, factor, fraction; MacDrawable *macWin = (MacDrawable *) Tk_WindowId(tkwin); CGRect troughBounds = {{macWin->xOff, macWin->yOff}, {Tk_Width(tkwin), Tk_Height(tkwin)}}; /* * The info struct has integer fields, which will be converted to * floats in the drawing routine. All of values provided in the info * struct, namely min, max, value, and viewSize are only defined up to * an arbitrary scale factor. To avoid roundoff error we scale so * that the viewSize is a large float which is smaller than the * largest int. */ HIThemeTrackDrawInfo info = { .version = 0, .bounds = troughBounds, .min = 0, .attributes = kThemeTrackShowThumb | kThemeTrackThumbRgnIsNotGhost, .enableState = kThemeTrackActive }; factor = RangeToFactor(100.0); if (orientation == TTK_ORIENT_HORIZONTAL) { trackSize = troughBounds.size.width; thumbSize = b.width; fraction = b.x / trackSize; } else { trackSize = troughBounds.size.height; thumbSize = b.height; fraction = b.y / trackSize; } visibleSize = (thumbSize / trackSize) * factor; info.max = factor - visibleSize; info.trackInfo.scrollbar.viewsize = visibleSize; if ([NSApp macMinorVersion] < 8 || orientation == TTK_ORIENT_HORIZONTAL) { info.value = factor * fraction; } else { info.value = info.max - factor * fraction; } if ((state & TTK_STATE_PRESSED) || (state & TTK_STATE_HOVER)) { info.trackInfo.scrollbar.pressState = kThemeThumbPressed; } else { info.trackInfo.scrollbar.pressState = 0; } if (orientation == TTK_ORIENT_HORIZONTAL) { info.attributes |= kThemeTrackHorizontal; } else { info.attributes &= ~kThemeTrackHorizontal; } BEGIN_DRAWING(d) HIThemeDrawTrack(&info, 0, dc.context, kHIThemeOrientationNormal); END_DRAWING } } static Ttk_ElementSpec ThumbElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ThumbElementSize, ThumbElementDraw }; static void ArrowElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { if ([NSApp macMinorVersion] < 8) { *minHeight = *minWidth = 14; } else { *minHeight = *minWidth = -1; } } static Ttk_ElementSpec ArrowElementSpec = { TK_STYLE_VERSION_2, sizeof(ScrollbarElement), ScrollbarElementOptions, ArrowElementSize, TtkNullElementDraw }; /*---------------------------------------------------------------------- * +++ Separator element. * * DrawThemeSeparator() guesses the orientation of the line from the width * and height of the rectangle, so the same element can can be used for * horizontal, vertical, and general separators. */ static void SeparatorElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { *minWidth = *minHeight = 1; } static void SeparatorElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { CGRect bounds = BoxToRect(d, b); const HIThemeSeparatorDrawInfo info = { .version = 0, /* Separator only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), }; BEGIN_DRAWING(d) if (TkMacOSXInDarkMode(tkwin)) { DrawDarkSeparator(bounds, dc.context, tkwin); } else { ChkErr(HIThemeDrawSeparator, &bounds, &info, dc.context, HIOrientation); } END_DRAWING } static Ttk_ElementSpec SeparatorElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SeparatorElementSize, SeparatorElementDraw }; /*---------------------------------------------------------------------- * +++ Size grip elements -- (obsolete) */ static const ThemeGrowDirection sizegripGrowDirection = kThemeGrowRight | kThemeGrowDown; static void SizegripElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { HIThemeGrowBoxDrawInfo info = { .version = 0, .state = kThemeStateActive, .kind = kHIThemeGrowBoxKindNormal, .direction = sizegripGrowDirection, .size = kHIThemeGrowBoxSizeNormal, }; CGRect bounds = CGRectZero; ChkErr(HIThemeGetGrowBoxBounds, &bounds.origin, &info, &bounds); *minWidth = bounds.size.width; *minHeight = bounds.size.height; } static void SizegripElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { CGRect bounds = BoxToRect(d, b); HIThemeGrowBoxDrawInfo info = { .version = 0, /* Grow box only supports kThemeStateActive, kThemeStateInactive */ .state = Ttk_StateTableLookup(ThemeStateTable, state & TTK_STATE_BACKGROUND), .kind = kHIThemeGrowBoxKindNormal, .direction = sizegripGrowDirection, .size = kHIThemeGrowBoxSizeNormal, }; BEGIN_DRAWING(d) ChkErr(HIThemeDrawGrowBox, &bounds.origin, &info, dc.context, HIOrientation); END_DRAWING } static Ttk_ElementSpec SizegripElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, SizegripElementSize, SizegripElementDraw }; /*---------------------------------------------------------------------- * +++ Background and fill elements -- * * Before drawing any ttk widget, its bounding rectangle is filled with a * background color. This color must match the background color of the * containing widget to avoid looking ugly. The need for care when doing * this is exacerbated by the fact that ttk enforces its "native look" by * not allowing user control of the background or highlight colors of ttk * widgets. * * This job is made more complicated in recent versions of macOS by the * fact that the Appkit GroupBox (used for ttk LabelFrames) and * TabbedPane (used for the Notebook widget) both place their content * inside a rectangle with rounded corners that has a color which * contrasts with the dialog background color. Moreover, although the * Apple human interface guidelines recommend against doing so, there are * times when one wants to nest these widgets, for example placing a * GroupBox inside of a TabbedPane. To have the right contrast, each * level of nesting requires a different color. * * Previous Tk releases used the HIThemeDrawGroupBox routine to draw * GroupBoxes and TabbedPanes. This meant that the best that could be * done was to set the GroupBox to be of kind * kHIThemeGroupBoxKindPrimaryOpaque, and set its fill color to be the * system background color. If widgets inside the box were drawn with * the system background color the backgrounds would match. But this * produces a GroupBox with no contrast, the only visual clue being a * faint highlighting around the top of the GroupBox. Moreover, the * TabbedPane does not have an Opaque version, so while it is drawn * inside a contrasting rounded rectangle, the widgets inside the pane * needed to be enclosed in a frame with the system background * color. This added a visual artifact since the frame's background color * does not match the Pane's background color. That code has now been * replaced with the standalone drawing procedure macOSXDrawGroupBox, * which draws a rounded rectangle with an appropriate contrasting * background color. * * Patterned backgrounds, which are now obsolete, should be aligned with * the coordinate system of the top-level window. Apparently failing to * do this used to cause graphics anomalies when drawing into an * off-screen graphics port. The code for handling this is currently * commented out. */ static void FillElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { CGRect bounds = BoxToRect(d, b); if ([NSApp macMinorVersion] > 8) { NSColorSpace *deviceRGB = [NSColorSpace deviceRGBColorSpace]; NSColor *bgColor; CGFloat fill[4]; BEGIN_DRAWING(d) GetBackgroundColor(dc.context, tkwin, 0, fill); bgColor = [NSColor colorWithColorSpace: deviceRGB components: fill count: 4]; CGContextSetFillColorSpace(dc.context, deviceRGB.CGColorSpace); CGContextSetFillColorWithColor(dc.context, CGCOLOR(bgColor)); CGContextFillRect(dc.context, bounds); END_DRAWING } else { ThemeBrush brush = (state & TTK_STATE_BACKGROUND) ? kThemeBrushModelessDialogBackgroundInactive : kThemeBrushModelessDialogBackgroundActive; BEGIN_DRAWING(d) ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation); //QDSetPatternOrigin(PatternOrigin(tkwin, d)); CGContextFillRect(dc.context, bounds); END_DRAWING } } static void BackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { FillElementDraw(clientData, elementRecord, tkwin, d, Ttk_WinBox(tkwin), state); } static Ttk_ElementSpec FillElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, FillElementDraw }; static Ttk_ElementSpec BackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, BackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ ToolbarBackground element -- toolbar style for frames. * * This is very similar to the normal background element, but uses a * different ThemeBrush in order to get the lighter pinstripe effect * used in toolbars. We use SetThemeBackground() rather than * ApplyThemeBackground() in order to get the right style. * * <URL: http://developer.apple.com/documentation/Carbon/Reference/ * Appearance_Manager/appearance_manager/constant_7.html#/ * /apple_ref/doc/uid/TP30000243/C005321> * */ static void ToolbarBackgroundElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeBrush brush = kThemeBrushToolbarBackground; CGRect bounds = BoxToRect(d, Ttk_WinBox(tkwin)); BEGIN_DRAWING(d) ChkErr(HIThemeSetFill, brush, NULL, dc.context, HIOrientation); //QDSetPatternOrigin(PatternOrigin(tkwin, d)); CGContextFillRect(dc.context, bounds); END_DRAWING } static Ttk_ElementSpec ToolbarBackgroundElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TtkNullElementSize, ToolbarBackgroundElementDraw }; /*---------------------------------------------------------------------- * +++ Field elements -- * * Used for the Treeview widget. This is like the BackgroundElement * except that the fieldbackground color is configureable. */ typedef struct { Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { {"-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement, backgroundObj), "white"}, {NULL, 0, 0, NULL} }; static void FieldElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { FieldElement *e = elementRecord; Tk_3DBorder backgroundPtr = Tk_Get3DBorderFromObj(tkwin, e->backgroundObj); XFillRectangle(Tk_Display(tkwin), d, Tk_3DBorderGC(tkwin, backgroundPtr, TK_3D_FLAT_GC), b.x, b.y, b.width, b.height); } static Ttk_ElementSpec FieldElementSpec = { TK_STYLE_VERSION_2, sizeof(FieldElement), FieldElementOptions, TtkNullElementSize, FieldElementDraw }; /*---------------------------------------------------------------------- * +++ Treeview headers -- * * On systems older than 10.9 The header is a kThemeListHeaderButton drawn * by HIToolbox. On newer systems those buttons do not match the Apple * buttons, so we draw them from scratch. */ static Ttk_StateTable TreeHeaderValueTable[] = { {kThemeButtonOn, TTK_STATE_ALTERNATE}, {kThemeButtonOn, TTK_STATE_SELECTED}, {kThemeButtonOff, 0} }; static Ttk_StateTable TreeHeaderAdornmentTable[] = { {kThemeAdornmentHeaderButtonSortUp, TTK_STATE_ALTERNATE | TTK_TREEVIEW_STATE_SORTARROW}, {kThemeAdornmentDefault, TTK_STATE_SELECTED | TTK_TREEVIEW_STATE_SORTARROW}, {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_ALTERNATE}, {kThemeAdornmentHeaderButtonNoSortArrow, TTK_STATE_SELECTED}, {kThemeAdornmentFocus, TTK_STATE_FOCUS}, {kThemeAdornmentNone, 0} }; static void TreeAreaElementSize ( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { /* * Padding is needed to get the heading text to align correctly, since the * widget expects the heading to be the same height as a row. */ if ([NSApp macMinorVersion] > 8) { paddingPtr->top = 4; } } static Ttk_ElementSpec TreeAreaElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TreeAreaElementSize, TtkNullElementDraw }; static void TreeHeaderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { if ([NSApp macMinorVersion] > 8) { *minHeight = 24; } else { ButtonElementSize(clientData, elementRecord, tkwin, minWidth, minHeight, paddingPtr); } } static void TreeHeaderElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { ThemeButtonParams *params = clientData; CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, .state = Ttk_StateTableLookup(ThemeStateTable, state), .kind = params->kind, .value = Ttk_StateTableLookup(TreeHeaderValueTable, state), .adornment = Ttk_StateTableLookup(TreeHeaderAdornmentTable, state), }; BEGIN_DRAWING(d) if ([NSApp macMinorVersion] > 8) { /* * Compensate for the padding added in TreeHeaderElementSize, so * the larger heading will be drawn at the top of the widget. */ bounds.origin.y -= 4; if (TkMacOSXInDarkMode(tkwin)) { DrawDarkListHeader(bounds, dc.context, tkwin, state); } else { DrawListHeader(bounds, dc.context, tkwin, state); } } else { ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); } END_DRAWING } static Ttk_ElementSpec TreeHeaderElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, TreeHeaderElementSize, TreeHeaderElementDraw }; /*---------------------------------------------------------------------- * +++ Disclosure triangles -- */ #define TTK_TREEVIEW_STATE_OPEN TTK_STATE_USER1 #define TTK_TREEVIEW_STATE_LEAF TTK_STATE_USER2 static Ttk_StateTable DisclosureValueTable[] = { {kThemeDisclosureDown, TTK_TREEVIEW_STATE_OPEN, 0}, {kThemeDisclosureRight, 0, 0}, }; static void DisclosureElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *minWidth, int *minHeight, Ttk_Padding *paddingPtr) { SInt32 s; ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleWidth, &s); *minWidth = s; ChkErr(GetThemeMetric, kThemeMetricDisclosureTriangleHeight, &s); *minHeight = s; } static void DisclosureElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, Ttk_State state) { if (!(state & TTK_TREEVIEW_STATE_LEAF)) { int triangleState = TkMacOSXInDarkMode(tkwin) ? kThemeStateInactive : kThemeStateActive; CGRect bounds = BoxToRect(d, b); const HIThemeButtonDrawInfo info = { .version = 0, .state = triangleState, .kind = kThemeDisclosureTriangle, .value = Ttk_StateTableLookup(DisclosureValueTable, state), .adornment = kThemeAdornmentDrawIndicatorOnly, }; BEGIN_DRAWING(d) ChkErr(HIThemeDrawButton, &bounds, &info, dc.context, HIOrientation, NULL); END_DRAWING } } static Ttk_ElementSpec DisclosureElementSpec = { TK_STYLE_VERSION_2, sizeof(NullElement), TtkNullElementOptions, DisclosureElementSize, DisclosureElementDraw }; /*---------------------------------------------------------------------- * +++ Widget layouts -- */ TTK_BEGIN_LAYOUT_TABLE(LayoutTable) TTK_LAYOUT("Toolbar", TTK_NODE("Toolbar.background", TTK_FILL_BOTH)) TTK_LAYOUT("TButton", TTK_GROUP("Button.button", TTK_FILL_BOTH, TTK_GROUP("Button.padding", TTK_FILL_BOTH, TTK_NODE("Button.label", TTK_FILL_BOTH)))) TTK_LAYOUT("TRadiobutton", TTK_GROUP("Radiobutton.button", TTK_FILL_BOTH, TTK_GROUP("Radiobutton.padding", TTK_FILL_BOTH, TTK_NODE("Radiobutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCheckbutton", TTK_GROUP("Checkbutton.button", TTK_FILL_BOTH, TTK_GROUP("Checkbutton.padding", TTK_FILL_BOTH, TTK_NODE("Checkbutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TMenubutton", TTK_GROUP("Menubutton.button", TTK_FILL_BOTH, TTK_GROUP("Menubutton.padding", TTK_FILL_BOTH, TTK_NODE("Menubutton.label", TTK_PACK_LEFT)))) TTK_LAYOUT("TCombobox", TTK_GROUP("Combobox.button", TTK_FILL_BOTH, TTK_GROUP("Combobox.padding", TTK_FILL_BOTH, TTK_NODE("Combobox.textarea", TTK_FILL_BOTH)))) /* Notebook tabs -- no focus ring */ TTK_LAYOUT("Tab", TTK_GROUP("Notebook.tab", TTK_FILL_BOTH, TTK_GROUP("Notebook.padding", TTK_EXPAND | TTK_FILL_BOTH, TTK_NODE("Notebook.label", TTK_EXPAND | TTK_FILL_BOTH)))) /* Spinbox -- buttons 2px to the right of the field. */ TTK_LAYOUT("TSpinbox", TTK_GROUP("Spinbox.buttons", TTK_PACK_RIGHT, TTK_NODE("Spinbox.uparrow", TTK_PACK_TOP | TTK_STICK_E) TTK_NODE("Spinbox.downarrow", TTK_PACK_BOTTOM | TTK_STICK_E)) TTK_GROUP("Spinbox.field", TTK_EXPAND | TTK_FILL_X, TTK_NODE("Spinbox.textarea", TTK_EXPAND | TTK_FILL_X))) /* Progress bars -- track only */ TTK_LAYOUT("TProgressbar", TTK_NODE("Progressbar.track", TTK_EXPAND | TTK_FILL_BOTH)) /* Treeview -- no border. */ TTK_LAYOUT("Treeview", TTK_GROUP("Treeview.field", TTK_FILL_BOTH, TTK_GROUP("Treeview.padding", TTK_FILL_BOTH, TTK_NODE("Treeview.treearea", TTK_FILL_BOTH)))) /* Tree heading -- no border, fixed height */ TTK_LAYOUT("Heading", TTK_NODE("Treeheading.cell", TTK_FILL_BOTH) TTK_NODE("Treeheading.image", TTK_PACK_RIGHT) TTK_NODE("Treeheading.text", TTK_PACK_TOP)) /* Tree items -- omit focus ring */ TTK_LAYOUT("Item", TTK_GROUP("Treeitem.padding", TTK_FILL_BOTH, TTK_NODE("Treeitem.indicator", TTK_PACK_LEFT) TTK_NODE("Treeitem.image", TTK_PACK_LEFT) TTK_NODE("Treeitem.text", TTK_PACK_LEFT))) /* Scrollbar Layout -- Buttons at the bottom (Snow Leopard and Lion only) */ TTK_LAYOUT("Vertical.TScrollbar", TTK_GROUP("Vertical.Scrollbar.trough", TTK_FILL_Y, TTK_NODE("Vertical.Scrollbar.thumb", TTK_PACK_TOP | TTK_EXPAND | TTK_FILL_BOTH) TTK_NODE("Vertical.Scrollbar.downarrow", TTK_PACK_BOTTOM) TTK_NODE("Vertical.Scrollbar.uparrow", TTK_PACK_BOTTOM))) TTK_LAYOUT("Horizontal.TScrollbar", TTK_GROUP("Horizontal.Scrollbar.trough", TTK_FILL_X, TTK_NODE("Horizontal.Scrollbar.thumb", TTK_PACK_LEFT | TTK_EXPAND | TTK_FILL_BOTH) TTK_NODE("Horizontal.Scrollbar.rightarrow", TTK_PACK_RIGHT) TTK_NODE("Horizontal.Scrollbar.leftarrow", TTK_PACK_RIGHT))) TTK_END_LAYOUT_TABLE /*---------------------------------------------------------------------- * +++ Initialization -- */ static int AquaTheme_Init( Tcl_Interp *interp) { Ttk_Theme themePtr = Ttk_CreateTheme(interp, "aqua", NULL); if (!themePtr) { return TCL_ERROR; } /* * Elements: */ Ttk_RegisterElementSpec(themePtr, "background", &BackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "fill", &FillElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "field", &FieldElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Toolbar.background", &ToolbarBackgroundElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Button.button", &ButtonElementSpec, &PushButtonParams); Ttk_RegisterElementSpec(themePtr, "Checkbutton.button", &ButtonElementSpec, &CheckBoxParams); Ttk_RegisterElementSpec(themePtr, "Radiobutton.button", &ButtonElementSpec, &RadioButtonParams); Ttk_RegisterElementSpec(themePtr, "Toolbutton.border", &ButtonElementSpec, &BevelButtonParams); Ttk_RegisterElementSpec(themePtr, "Menubutton.button", &ButtonElementSpec, &PopupButtonParams); Ttk_RegisterElementSpec(themePtr, "Spinbox.uparrow", &SpinButtonUpElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Spinbox.downarrow", &SpinButtonDownElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Combobox.button", &ComboboxElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Treeitem.indicator", &DisclosureElementSpec, &DisclosureParams); Ttk_RegisterElementSpec(themePtr, "Treeheading.cell", &TreeHeaderElementSpec, &ListHeaderParams); Ttk_RegisterElementSpec(themePtr, "Treeview.treearea", &TreeAreaElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.tab", &TabElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Notebook.client", &PaneElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Labelframe.border", &GroupElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Entry.field", &EntryElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Spinbox.field", &EntryElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "separator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "hseparator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "vseparator", &SeparatorElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "sizegrip", &SizegripElementSpec, 0); /* * <<NOTE-TRACKS>> * In some themes the Layouts for a progress bar has a trough element and a * pbar element. But in our case the appearance manager draws both parts * of the progress bar, so we just have a single element called ".track". */ Ttk_RegisterElementSpec(themePtr, "Progressbar.track", &PbarElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Scale.trough", &TrackElementSpec, &ScaleData); Ttk_RegisterElementSpec(themePtr, "Scale.slider", &SliderElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Vertical.Scrollbar.trough", &TroughElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Vertical.Scrollbar.thumb", &ThumbElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Horizontal.Scrollbar.trough", &TroughElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Horizontal.Scrollbar.thumb", &ThumbElementSpec, 0); /* * If we are not in Snow Leopard or Lion the arrows won't actually be * displayed. */ Ttk_RegisterElementSpec(themePtr, "Vertical.Scrollbar.uparrow", &ArrowElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Vertical.Scrollbar.downarrow", &ArrowElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Horizontal.Scrollbar.leftarrow", &ArrowElementSpec, 0); Ttk_RegisterElementSpec(themePtr, "Horizontal.Scrollbar.rightarrow", &ArrowElementSpec, 0); /* * Layouts: */ Ttk_RegisterLayouts(themePtr, LayoutTable); Tcl_PkgProvide(interp, "ttk::theme::aqua", TTK_VERSION); return TCL_OK; } MODULE_SCOPE int Ttk_MacOSXPlatformInit( Tcl_Interp *interp) { return AquaTheme_Init(interp); } /* * Local Variables: * mode: objc * c-basic-offset: 4 * fill-column: 79 * coding: utf-8 * End: */ |
Changes to tests/arc.tcl.
︙ | ︙ | |||
95 96 97 98 99 100 101 | bind .t.c <Shift-1> { set curx %x set cury %y } bind .t.c <Shift-B1-Motion> { | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | bind .t.c <Shift-1> { set curx %x set cury %y } bind .t.c <Shift-B1-Motion> { .t.c move circle [expr {%x-$curx}] [expr {%y-$cury}] set curx %x set cury %y } # The binding below flashes the closest item to the mouse. bind .t.c <Control-c> { |
︙ | ︙ | |||
123 124 125 126 127 128 129 | set delta -5 } if {$i <= 5} { set delta 5 } incr i $delta c -start $i | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | set delta -5 } if {$i <= 5} { set delta 5 } incr i $delta c -start $i c -extent [expr {360-2*$i}] after 20 update } } bind .t.c b {set go 0} |
︙ | ︙ |
Changes to tests/bell.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | tcltest::loadTestedCommands test bell-1.1 {bell command} -body { bell a } -returnCodes {error} -result {bad option "a": must be -displayof or -nice} test bell-1.2 {bell command} -body { | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | tcltest::loadTestedCommands test bell-1.1 {bell command} -body { bell a } -returnCodes {error} -result {bad option "a": must be -displayof or -nice} test bell-1.2 {bell command} -body { bell a b } -returnCodes {error} -result {bad option "a": must be -displayof or -nice} test bell-1.3 {bell command} -body { bell -displayof gorp } -returnCodes {error} -result {bad window path name "gorp"} test bell-1.4 {bell command} -body { |
︙ | ︙ |
Changes to tests/bind.test.
︙ | ︙ | |||
5916 5917 5918 5919 5920 5921 5922 | event generate .t.f <Key-X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} | | | 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 | event generate .t.f <Key-X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} test bind-29.1 {Tcl_BackgroundError procedure} -setup { proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] } frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f |
︙ | ︙ | |||
5940 5941 5942 5943 5944 5945 5946 | destroy .t.f rename bgerror {} } -result {{This is a test} {This is a test while executing "error "This is a test"" (command bound to event)}} | | | 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 | destroy .t.f rename bgerror {} } -result {{This is a test} {This is a test while executing "error "This is a test"" (command bound to event)}} test bind-29.2 {Tcl_BackgroundError procedure} -setup { proc do {} { event generate .t.f <Button> event generate .t.f <ButtonRelease> } proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] |
︙ | ︙ | |||
6354 6355 6356 6357 6358 6359 6360 | event generate .t.f <a> event generate .t.f <1> event generate .t.f <1> set x } -cleanup { destroy .t.f } -result {a11} | | < < < < | | < < < < | | 6354 6355 6356 6357 6358 6359 6360 6361 6362 6363 6364 6365 6366 6367 6368 6369 6370 6371 6372 6373 6374 6375 6376 6377 6378 6379 6380 6381 6382 6383 6384 6385 6386 6387 6388 6389 6390 6391 6392 6393 6394 6395 6396 6397 | event generate .t.f <a> event generate .t.f <1> event generate .t.f <1> set x } -cleanup { destroy .t.f } -result {a11} test bind-33.2 {prefer most specific event} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Double-1> { lappend x "Double" } bind .t.f <1><1> { lappend x "11" } event generate .t.f <1> event generate .t.f <1> set x } -cleanup { destroy .t.f } -result {Double} test bind-33.3 {prefer most specific event} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <a><Double-1><a> { lappend x "Double" } bind .t.f <a><1><1><a> { lappend x "11" } event generate .t.f <a> event generate .t.f <1> event generate .t.f <1> event generate .t.f <a> set x } -cleanup { destroy .t.f } -result {Double} test bind-33.4 {prefer most specific event} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <1><1> { lappend x "11" } |
︙ | ︙ | |||
6521 6522 6523 6524 6525 6526 6527 | event generate .t.f <1> event generate .t.f <1> event generate .t.f <2> event generate .t.f <2> set x } -cleanup { destroy .t.f | < < < < | | 6513 6514 6515 6516 6517 6518 6519 6520 6521 6522 6523 6524 6525 6526 6527 | event generate .t.f <1> event generate .t.f <1> event generate .t.f <2> event generate .t.f <2> set x } -cleanup { destroy .t.f } -result {first} test bind-33.12 {prefer last in case of homogeneous equal patterns} -setup { pack [frame .t.f] focus -force .t.f update set x {} } -body { bind .t.f <Control-1><1> { lappend x "first" } |
︙ | ︙ |
Changes to tests/bitmap.test.
︙ | ︙ | |||
11 12 13 14 15 16 17 | eval tcltest::configure $argv tcltest::loadTestedCommands test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} -constraints { testbitmap } -body { set x gray25 | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | eval tcltest::configure $argv tcltest::loadTestedCommands test bitmap-1.1 {Tk_AllocBitmapFromObj - converting internal reps} -constraints { testbitmap } -body { set x gray25 lindex $x 0 button .b -bitmap $x lindex $x 0 testbitmap gray25 } -cleanup { destroy .b } -result {{1 0}} test bitmap-1.2 {Tk_AllocBitmapFromObj - discard stale bitmap} -constraints { |
︙ | ︙ | |||
50 51 52 53 54 55 56 | } -cleanup { destroy .b1 .b2 } -result {{{1 1}} {{2 1}}} test bitmap-2.1 {Tk_GetBitmap procedure} -body { button .b1 -bitmap bad_name } -cleanup { | | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | } -cleanup { destroy .b1 .b2 } -result {{{1 1}} {{2 1}}} test bitmap-2.1 {Tk_GetBitmap procedure} -body { button .b1 -bitmap bad_name } -cleanup { destroy .b1 } -returnCodes error -result {bitmap "bad_name" not defined} test bitmap-2.2 {Tk_GetBitmap procedure} -body { button .b1 -bitmap @xyzzy } -cleanup { destroy .b1 } -returnCodes error -result {error reading bitmap file "xyzzy"} test bitmap-3.1 {Tk_FreeBitmapFromObj - reference counts} -constraints { testbitmap } -setup { set result {} } -body { |
︙ | ︙ |
Changes to tests/border.test.
1 2 3 4 5 6 7 8 9 10 11 12 | # This file is a Tcl script to test out the procedures in the file # tkBorder.c. It is organized in the standard fashion for Tcl tests. # # Copyright (c) 1998 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # This file is a Tcl script to test out the procedures in the file # tkBorder.c. It is organized in the standard fashion for Tcl tests. # # Copyright (c) 1998 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands test border-1.1 {Tk_AllocBorderFromObj - converting internal reps} -constraints { testborder } -body { set x orange lindex $x 0 button .b1 -bg $x -text .b1 lindex $x 0 testborder orange } -cleanup { destroy .b1 } -result {{1 0}} test border-1.2 {Tk_AllocBorderFromObj - discard stale border} -constraints { testborder } -setup { set result {} } -body { set x orange button .b1 -bg $x -text First destroy .b1 lappend result [testborder orange] button .b2 -bg $x -text Second lappend result [testborder orange] } -cleanup { destroy .b1 .b2 } -result {{} {{1 1}}} test border-1.3 {Tk_AllocBorderFromObj - reuse existing border} -constraints { testborder } -setup { set result {} } -body { set x orange button .b1 -bg $x -text First lappend result [testborder orange] button .b2 -bg $x -text Second pack .b1 .b2 -side top lappend result [testborder orange] } -cleanup { destroy .b1 .b2 } -result {{{1 1}} {{2 1}}} test border-1.4 {Tk_AllocBorderFromObj - try other borders in list} -constraints { testborder pseudocolor8 } -setup { toplevel .t -visual {pseudocolor 8} -colormap new wm geom .t +0+0 set result {} } -body { set x purple button .b1 -bg $x -text First pack .b1 -side top lappend result [testborder purple] button .t.b -bg $x -text Second pack .t.b -side top lappend result [testborder purple] button .b2 -bg $x -text Third pack .b2 -side top lappend result [testborder purple] } -cleanup { destroy .b1 .b2 .t } -result {{{1 1}} {{1 1} {1 0}} {{1 0} {2 1}}} test border-2.1 {Tk_Free3DBorder - reference counts} -constraints { testborder pseudocolor8 } -setup { toplevel .t -visual {pseudocolor 8} -colormap new wm geom .t +0+0 set result {} } -body { set x purple |
︙ | ︙ | |||
90 91 92 93 94 95 96 | destroy .b2 lappend result [testborder purple] destroy .t.b lappend result [testborder purple] } -cleanup { destroy .b1 .b2 .t } -result {{{1 0} {2 1}} {{1 0} {1 1}} {{1 0}} {}} | | | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | destroy .b2 lappend result [testborder purple] destroy .t.b lappend result [testborder purple] } -cleanup { destroy .b1 .b2 .t } -result {{{1 0} {2 1}} {{1 0} {1 1}} {{1 0}} {}} test border-2.2 {Tk_Free3DBorder - unlinking from list} -constraints { testborder pseudocolor8 } -setup { toplevel .t -visual {pseudocolor 8} -colormap new wm geom .t +0+0 toplevel .t2 -visual {pseudocolor 8} -colormap new toplevel .t3 -visual {pseudocolor 8} -colormap new set result {} |
︙ | ︙ | |||
123 124 125 126 127 128 129 | lappend result [testborder purple] destroy .t lappend result [testborder purple] } -cleanup { destroy .b .t2 .t3 .t } -result {{{4 1} {3 0} {2 0} {1 0}} {{4 1} {2 0} {1 0}} {{4 1} {2 0}} {{2 0}} {}} | > | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | lappend result [testborder purple] destroy .t lappend result [testborder purple] } -cleanup { destroy .b .t2 .t3 .t } -result {{{4 1} {3 0} {2 0} {1 0}} {{4 1} {2 0} {1 0}} {{4 1} {2 0}} {{2 0}} {}} test border-3.1 {FreeBorderObjProc} -constraints { testborder } -setup { set result {} proc copy {s} {return [string index $s 0][string range $s 1 end]} } -body { set x [copy purple] button .b -bg $x -text .b1 set y [copy purple] |
︙ | ︙ |
Changes to tests/busy.test.
︙ | ︙ | |||
19 20 21 22 23 24 25 | tk busy } -result {wrong # args: should be "tk busy options ?arg arg ...?"} test busy-2.1 {tk busy hold} -returnCodes error -body { tk busy hold } -result {wrong # args: should be "tk busy hold window ?option value ...?"} test busy-2.2 {tk busy hold root window} -body { | | > | | > | | > | | > | | > | | > | | > | | > | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | tk busy } -result {wrong # args: should be "tk busy options ?arg arg ...?"} test busy-2.1 {tk busy hold} -returnCodes error -body { tk busy hold } -result {wrong # args: should be "tk busy hold window ?option value ...?"} test busy-2.2 {tk busy hold root window} -body { set res [tk busy hold .] update set res } -cleanup { tk busy forget . } -result {._Busy} test busy-2.3 {tk busy hold root window with shortcut} -body { set res [tk busy .] update set res } -cleanup { tk busy forget . } -result {._Busy} test busy-2.4 {tk busy hold nested window} -setup { pack [frame .f] } -body { set res [tk busy hold .f] update set res } -cleanup { tk busy forget .f destroy .f } -result {.f_Busy} test busy-2.5 {tk busy hold nested window with shortcut} -setup { pack [frame .f] } -body { set res [tk busy .f] update set res } -cleanup { tk busy forget .f destroy .f } -result {.f_Busy} test busy-2.6 {tk busy hold toplevel window} -setup { toplevel .f } -body { set res [tk busy hold .f] update set res } -cleanup { tk busy forget .f destroy .f } -result {.f._Busy} test busy-2.7 {tk busy hold toplevel window with shortcut} -setup { toplevel .f } -body { set res [tk busy .f] update set res } -cleanup { tk busy forget .f destroy .f } -result {.f._Busy} test busy-2.8 {tk busy hold non existing window} -body { tk busy hold .f update } -returnCodes error -result {bad window path name ".f"} test busy-2.9 {tk busy hold (shortcut) non existing window} -body { tk busy .f update } -returnCodes {error} -result {bad window path name ".f"} test busy-2.10 {tk busy hold root window with cursor} -body { set res [tk busy hold . -cursor arrow] update set res } -cleanup { tk busy forget . } -result {._Busy} test busy-2.11 {tk busy hold (shortcut) root window, cursor} -body { set res [tk busy . -cursor arrow] update set res } -cleanup { tk busy forget . } -result {._Busy} test busy-2.12 {tk busy hold root window, invalid cursor} -body { tk busy hold . -cursor nonExistingCursor update } -returnCodes error -cleanup { tk busy forget . } -result {bad cursor spec "nonExistingCursor"} test busy-2.13 {tk busy hold (shortcut) root window, invalid cursor} -body { |
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 | tk busy forget .f1 } -body { lsort [tk busy current *3*] } -cleanup { tk busy forget .f2 destroy .f1 .f2 } -result {} ::tcltest::cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | tk busy forget .f1 } -body { lsort [tk busy current *3*] } -cleanup { tk busy forget .f2 destroy .f1 .f2 } -result {} test busy-8.1 {tk busy busywindow with a busy toplevel} -body { toplevel .top tk busy .top tk busy busywindow .top } -cleanup { tk busy forget .top destroy .top } -result {.top._Busy} test busy-8.2 {tk busy busywindow with a busy widget} -body { pack [frame .f] tk busy .f tk busy busywindow .f } -cleanup { tk busy forget .f destroy .f } -result {.f_Busy} test busy-8.3 {tk busy busywindow with a nonexisting widget} -body { tk busy . tk busy busywindow .nonExistingWidget } -cleanup { tk busy forget . } -result {} ::tcltest::cleanupTests return |
Changes to tests/button.test.
︙ | ︙ | |||
558 559 560 561 562 563 564 | test button-1.57 {configuration option: "borderwidth" for label} -setup { label .l -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -borderwidth 1.3 | | | | | | 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | test button-1.57 {configuration option: "borderwidth" for label} -setup { label .l -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -borderwidth 1.3 .l cget -borderwidth } -cleanup { destroy .l } -result {1.3} test button-1.58 {configuration option: "borderwidth" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .l update } -body { .l configure -borderwidth badValue } -cleanup { destroy .l } -returnCodes {error} -result {bad screen distance "badValue"} test button-1.59 {configuration option: "borderwidth" for button} -setup { button .b -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -borderwidth 1.3 .b cget -borderwidth } -cleanup { destroy .b } -result {1.3} test button-1.60 {configuration option: "borderwidth" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .b update } -body { .b configure -borderwidth badValue } -cleanup { destroy .b } -returnCodes {error} -result {bad screen distance "badValue"} test button-1.61 {configuration option: "borderwidth" for checkbutton} -setup { checkbutton .c -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -borderwidth 1.3 .c cget -borderwidth } -cleanup { destroy .c } -result {1.3} test button-1.62 {configuration option: "borderwidth" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .c update } -body { .c configure -borderwidth badValue } -cleanup { destroy .c } -returnCodes {error} -result {bad screen distance "badValue"} test button-1.63 {configuration option: "borderwidth" for radiobutton} -setup { radiobutton .r -highlightthickness 2 -font {Helvetica -12 bold} pack .r update } -body { .r configure -borderwidth 1.3 .r cget -borderwidth } -cleanup { destroy .r } -result {1.3} test button-1.64 {configuration option: "borderwidth" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .r update |
︙ | ︙ | |||
999 1000 1001 1002 1003 1004 1005 | } -body { .r configure -fg non-existent } -cleanup { destroy .r } -returnCodes {error} -result {unknown color name "non-existent"} test button-1.103 {configuration option: "font" for label} -setup { | | | | | | | | | | 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 | } -body { .r configure -fg non-existent } -cleanup { destroy .r } -returnCodes {error} -result {unknown color name "non-existent"} test button-1.103 {configuration option: "font" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 pack .l update } -body { .l configure -font {Helvetica -12} .l cget -font } -cleanup { destroy .l } -result {Helvetica -12} test button-1.104 {configuration option: "activebackground" for label} -setup { label .l -borderwidth 2 -highlightthickness 2 pack .l update } -body { .l configure -font {} } -cleanup { destroy .l } -returnCodes {error} -result {font "" doesn't exist} test button-1.105 {configuration option: "font" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 pack .b update } -body { .b configure -font {Helvetica -12} .b cget -font } -cleanup { destroy .b } -result {Helvetica -12} test button-1.106 {configuration option: "activebackground" for button} -setup { button .b -borderwidth 2 -highlightthickness 2 pack .b update } -body { .b configure -font {} } -cleanup { destroy .b } -returnCodes {error} -result {font "" doesn't exist} test button-1.107 {configuration option: "font" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 pack .c update } -body { .c configure -font {Helvetica -12} .c cget -font } -cleanup { destroy .c } -result {Helvetica -12} test button-1.108 {configuration option: "activebackground" for checkbutton} -setup { checkbutton .c -borderwidth 2 -highlightthickness 2 pack .c update } -body { .c configure -font {} } -cleanup { destroy .c } -returnCodes {error} -result {font "" doesn't exist} test button-1.109 {configuration option: "font" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 pack .r update } -body { .r configure -font {Helvetica -12} .r cget -font } -cleanup { destroy .r } -result {Helvetica -12} test button-1.110 {configuration option: "activebackground" for radiobutton} -setup { radiobutton .r -borderwidth 2 -highlightthickness 2 pack .r update } -body { .r configure -font {} } -cleanup { destroy .r } -returnCodes {error} -result {font "" doesn't exist} |
︙ | ︙ | |||
2665 2666 2667 2668 2669 2670 2671 | checkbutton .c .c configure -selectcolor {} } -cleanup { destroy .c } -result {} # ex-tests 3.* | | | 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 | checkbutton .c .c configure -selectcolor {} } -cleanup { destroy .c } -result {} # ex-tests 3.* test button-2.1 {ButtonCreate - not enough arguments} -body { button } -returnCodes {error} -result {wrong # args: should be "button pathName ?-option value ...?"} test button-2.2 {ButtonCreate procedure - setting label class} -body { label .x winfo class .x } -cleanup { |
︙ | ︙ | |||
2705 2706 2707 2708 2709 2710 2711 | destroy .x rename gorp button } -result {Button} test button-2.7 {ButtonCreate - bad window name} -body { button foo } -cleanup { | | | | | | | | | 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 | destroy .x rename gorp button } -result {Button} test button-2.7 {ButtonCreate - bad window name} -body { button foo } -cleanup { destroy foo } -returnCodes {error} -result {bad window path name "foo"} ######### test ex 3.8 test button-2.8 {ButtonCreate procedure - error in default option value} -body { option add *funny.background bogus button .funny } -cleanup { option clear destroy .funny } -returnCodes {error} -result {unknown color name "bogus"} test button-2.9 {ButtonCreate procedure - error in default option value} -body { option add *funny.background bogus catch {button .funny} return $errorInfo } -cleanup { option clear destroy .funny } -result {unknown color name "bogus" (database entry for "-background" in widget ".funny") invoked from within "button .funny"} test button-2.10 {ButtonCreate procedure - option error} -body { button .x -gorp foo } -cleanup { destroy .x } -returnCodes {error} -result {unknown option "-gorp"} test button-2.11 {ButtonCreate procedure - option error} -body { catch {button .x -gorp foo} winfo exists .x } -cleanup { destroy .x } -result 0 ######### ex 3.10 test button-2.12 {ButtonCreate procedure - return value} -body { set x [button .abcd] |
︙ | ︙ | |||
2784 2785 2786 2787 2788 2789 2790 | #ex 4.7 test button-3.6 {ButtonWidgetCmd procedure, "cget" option} -body { label .l .l cget -disabledforeground } -cleanup { destroy .l | | | | | | | 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 | #ex 4.7 test button-3.6 {ButtonWidgetCmd procedure, "cget" option} -body { label .l .l cget -disabledforeground } -cleanup { destroy .l } -returnCodes {ok} -match {glob} -result {*} test button-3.7 {ButtonWidgetCmd procedure, "cget" option} -body { button .b .b cget -disabledforeground } -cleanup { destroy .b } -returnCodes {ok} -match {glob} -result {*} test button-3.8 {ButtonWidgetCmd procedure, "cget" option} -body { button .b .b cget -variable } -cleanup { destroy .b } -returnCodes {error} -result {unknown option "-variable"} test button-3.9 {ButtonWidgetCmd procedure, "cget" option} -body { checkbutton .c .c cget -variable } -cleanup { destroy .c } -returnCodes {ok} -match {glob} -result {*} test button-3.10 {ButtonWidgetCmd procedure, "cget" option} -body { checkbutton .c .c cget -value } -cleanup { destroy .c } -returnCodes {error} -result {unknown option "-value"} test button-3.11 {ButtonWidgetCmd procedure, "cget" option} -body { radiobutton .r .r cget -value } -cleanup { destroy .r } -returnCodes {ok} -match {glob} -result {*} test button-3.12 {ButtonWidgetCmd procedure, "cget" option} -body { radiobutton .r .r cget -onvalue } -cleanup { destroy .r } -returnCodes {error} -result {unknown option "-onvalue"} # ex 4.6 test button-3.13 {ButtonWidgetCmd procedure, "configure" option} -body { button .b -highlightthickness 3 lindex [.b configure -highlightthickness] 4 } -cleanup { destroy .b } -result {3} test button-3.14 {ButtonWidgetCmd procedure, "configure" option} -body { checkbutton .c llength [.c configure] } -cleanup { destroy .c } -result {41} test button-3.15 {ButtonWidgetCmd procedure, "configure" option} -body { button .b .b configure -gorp } -cleanup { destroy .b } -returnCodes {error} -result {unknown option "-gorp"} test button-3.16 {ButtonWidgetCmd procedure, "configure" option} -setup { |
︙ | ︙ | |||
2885 2886 2887 2888 2889 2890 2891 | test button-3.21 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 .c d return $checkvar } -cleanup { destroy .c | | | | | | | 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 | test button-3.21 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 .c d return $checkvar } -cleanup { destroy .c } -result {0} test button-3.22 {ButtonWidgetCmd procedure, "deselect" option} -body { radiobutton .r -variable radiovar -value red set radiovar green .r deselect return $radiovar } -cleanup { destroy .r } -result {green} test button-3.23 {ButtonWidgetCmd procedure, "deselect" option} -body { radiobutton .r -variable radiovar -value red set radiovar red .r deselect return $radiovar } -cleanup { destroy .r } -result {} test button-3.24 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 trace variable checkvar w bogusTrace .c deselect } -cleanup { destroy .c trace vdelete checkvar w bogusTrace } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.25 {ButtonWidgetCmd procedure, "deselect" option} -body { checkbutton .c -variable checkvar -onvalue 1 -offvalue 0 set checkvar 1 trace variable checkvar w bogusTrace catch {.c deselect} list $errorInfo $checkvar } -cleanup { |
︙ | ︙ | |||
2933 2934 2935 2936 2937 2938 2939 | radiobutton .r -variable radiovar -value red set radiovar red trace variable radiovar w bogusTrace .r deselect } -cleanup { destroy .r trace vdelete radiovar w bogusTrace | | | 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 | radiobutton .r -variable radiovar -value red set radiovar red trace variable radiovar w bogusTrace .r deselect } -cleanup { destroy .r trace vdelete radiovar w bogusTrace } -match {glob} -returnCodes {error} -result {can't set "radiovar": trace aborted} test button-3.27 {ButtonWidgetCmd procedure, "deselect" option} -body { radiobutton .r -variable radiovar -value red set radiovar red trace variable radiovar w bogusTrace catch {.r deselect} list $errorInfo $radiovar } -cleanup { |
︙ | ︙ | |||
2960 2961 2962 2963 2964 2965 2966 | } -returnCodes {error} -result {wrong # args: should be ".b flash"} test button-3.29 {ButtonWidgetCmd procedure, "flash" option} -body { label .l .l flash } -cleanup { destroy .l } -returnCodes {error} -result {bad option "flash": must be cget or configure} | | | | | 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 | } -returnCodes {error} -result {wrong # args: should be ".b flash"} test button-3.29 {ButtonWidgetCmd procedure, "flash" option} -body { label .l .l flash } -cleanup { destroy .l } -returnCodes {error} -result {bad option "flash": must be cget or configure} test button-3.30 {ButtonWidgetCmd procedure, "flash" option} -body { button .b catch {.b flash} } -cleanup { destroy .b } -returnCodes {ok} -match {glob} -result {*} test button-3.31 {ButtonWidgetCmd procedure, "flash" option} -body { checkbutton .c catch {.c flash} } -cleanup { destroy .c } -returnCodes {ok} -match {glob} -result {*} test button-3.32 {ButtonWidgetCmd procedure, "flash" option} -body { radiobutton .r catch {.r f} } -cleanup { destroy .r } -returnCodes {ok} -match {glob} -result {*} test button-3.33 {ButtonWidgetCmd procedure, "invoke" option} -body { |
︙ | ︙ | |||
3056 3057 3058 3059 3060 3061 3062 | set checkvar bogus .c s return $checkvar } -cleanup { destroy .c } -result {lovely} test button-3.43 {ButtonWidgetCmd procedure, "select" option} -body { | | | | | 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 | set checkvar bogus .c s return $checkvar } -cleanup { destroy .c } -result {lovely} test button-3.43 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar green .r select return $radiovar } -cleanup { destroy .r } -result {red} test button-3.44 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar yellow trace variable radiovar w bogusTrace .r select } -cleanup { destroy .r trace vdelete radiovar w bogusTrace } -returnCodes {error} -result {can't set "radiovar": trace aborted} test button-3.45 {ButtonWidgetCmd procedure, "select" option} -body { radiobutton .r -variable radiovar -value red set radiovar yellow trace variable radiovar w bogusTrace catch {.r select} list $errorInfo $radiovar } -cleanup { |
︙ | ︙ | |||
3124 3125 3126 3127 3128 3129 3130 | lappend result $checkvar .c toggle lappend result $checkvar return $result } -cleanup { destroy .c } -result {sunshine rain sunshine} | | | | | | | | | | | 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 | lappend result $checkvar .c toggle lappend result $checkvar return $result } -cleanup { destroy .c } -result {sunshine rain sunshine} test button-3.51 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar xyz trace variable checkvar w bogusTrace .c toggle } -cleanup { destroy .c trace vdelete checkvar w bogusTrace } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.52 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar xyz trace variable checkvar w bogusTrace catch {.c toggle} list $errorInfo $checkvar } -cleanup { trace vdelete checkvar w bogusTrace destroy .c } -match {glob} -result {{*trace aborted while executing * ".c toggle"} abc} test button-3.53 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar abc trace variable checkvar w bogusTrace .c toggle } -cleanup { trace vdelete checkvar w bogusTrace destroy .c } -returnCodes {error} -result {can't set "checkvar": trace aborted} test button-3.54 {ButtonWidgetCmd procedure, "toggle" option} -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc set checkvar abc trace variable checkvar w bogusTrace catch {.c toggle} list $errorInfo $checkvar } -cleanup { trace vdelete checkvar w bogusTrace destroy .c } -match {glob} -result {{*trace aborted while executing * ".c toggle"} xyz} test button-3.55 {ButtonWidgetCmd procedure, "toggle" option} -setup { unset -nocomplain checkvar } -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc unset checkvar set checkvar(1) 1 .c toggle } -cleanup { destroy .c } -returnCodes {error} -result {can't set "checkvar": variable is array} test button-3.56 {ButtonWidgetCmd procedure, "toggle" option} -setup { unset -nocomplain checkvar } -body { checkbutton .c -variable checkvar -onvalue xyz -offvalue abc unset checkvar set checkvar(1) 1 catch {.c toggle} return $errorInfo } -cleanup { destroy .c |
︙ | ︙ | |||
3205 3206 3207 3208 3209 3210 3211 | button .b1 -image image1 button .b2 -fg #ff0000 -text "Button 2" button .b3 -state active -text "Button 3" button .b4 -disabledforeground #0000ff -state disabled -text "Button 4" checkbutton .b5 -variable x -text "Checkbutton 5" set x 1 pack .b1 .b2 .b3 .b4 .b5 | | | | | | | 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 | button .b1 -image image1 button .b2 -fg #ff0000 -text "Button 2" button .b3 -state active -text "Button 3" button .b4 -disabledforeground #0000ff -state disabled -text "Button 4" checkbutton .b5 -variable x -text "Checkbutton 5" set x 1 pack .b1 .b2 .b3 .b4 .b5 update deleteWindows } -cleanup { destroy .b1 .b2 .b3 .b4 .b5 image delete image1 } -result {} test button-5.1 {ConfigureButton - textvariable trace} -body { button .b -bd 4 -bg green .b configure -bd 7 -bg red -fg bogus } -cleanup { destroy .b } -returnCodes {error} -result {unknown color name "bogus"} test button-5.2 {ConfigureButton - textvariable trace} -body { button .b -bd 4 -bg green catch {.b configure -bd 7 -bg red -fg bogus} list [.b cget -bd] [.b cget -bg] } -cleanup { destroy .b } -result {4 green} test button-5.3 {ConfigureButton - textvariable trace} -body { button .b -textvariable x set x From-x |
︙ | ︙ | |||
3267 3268 3269 3270 3271 3272 3273 | imageCleanup } -result {image2} test button-5.6 {ConfigureButton - default value for variable} -body { checkbutton .c .c cget -variable } -cleanup { | | | 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 | imageCleanup } -result {image2} test button-5.6 {ConfigureButton - default value for variable} -body { checkbutton .c .c cget -variable } -cleanup { destroy .c } -result {c} test button-5.7 {ConfigureButton - setting selected state from variable} -body { set x 0 set y Shiny checkbutton .c -variable x .c configure -variable y -onvalue Shiny .c toggle |
︙ | ︙ | |||
3301 3302 3303 3304 3305 3306 3307 | destroy .r } -result {} test button-5.10 {ConfigureButton - error in setting variable} -setup { unset -nocomplain x } -body { trace variable x w bogusTrace | | | 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 | destroy .r } -result {} test button-5.10 {ConfigureButton - error in setting variable} -setup { unset -nocomplain x } -body { trace variable x w bogusTrace radiobutton .r -variable x } -cleanup { destroy .r trace vdelete x w bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-5.11 {ConfigureButton - bad image name} -body { button .b -image bogus |
︙ | ︙ | |||
3338 3339 3340 3341 3342 3343 3344 | unset -nocomplain x } -body { trace variable x w bogusTrace radiobutton .r -text foo -textvariable x } -cleanup { trace vdelete x w bogusTrace destroy .r | | | | | | | | | | | | | 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 | unset -nocomplain x } -body { trace variable x w bogusTrace radiobutton .r -text foo -textvariable x } -cleanup { trace vdelete x w bogusTrace destroy .r } -returnCodes {error} -result {can't set "x": trace aborted} test button-5.15 {ConfigureButton - variable handling} -setup { unset -nocomplain x } -body { trace variable x w bogusTrace catch {radiobutton .r -text foo -textvariable x} return $x } -cleanup { trace vdelete x w bogusTrace destroy .r } -result {foo} #ex 6.14 test button-5.16 {ConfigureButton - -width option} -body { button .b -text "Button 1" .b configure -width 1i } -cleanup { destroy .b } -returnCodes {error} -result {expected integer but got "1i"} test button-5.17 {ConfigureButton - -width option} -body { button .b -text "Button 1" catch {.b configure -width 1i} return $errorInfo } -cleanup { destroy .b } -result {expected integer but got "1i" (processing -width option) invoked from within ".b configure -width 1i"} test button-5.18 {ConfigureButton - -height option} -body { button .b -text "Button 1" .b configure -height 0.5c } -cleanup { destroy .b } -returnCodes {error} -result {expected integer but got "0.5c"} test button-5.19 {ConfigureButton - -height option} -body { button .b -text "Button 1" catch {.b configure -height 0.5c} return $errorInfo } -cleanup { destroy .b } -result {expected integer but got "0.5c" (processing -height option) invoked from within ".b configure -height 0.5c"} #ex 6.16 test button-5.20 {ConfigureButton - -width option} -body { button .b -bitmap questhead .b configure -width abc } -cleanup { destroy .b } -returnCodes {error} -result {bad screen distance "abc"} test button-5.21 {ConfigureButton - -width option} -body { button .b -bitmap questhead catch {.b configure -width abc} return $errorInfo } -cleanup { destroy .b } -result {bad screen distance "abc" (processing -width option) invoked from within ".b configure -width abc"} test button-5.22 {ConfigureButton - -height option} -constraints { testImageType } -setup { image create test image1 } -body { button .b -image image1 .b configure -height 0.5x } -cleanup { destroy .b image delete image1 } -returnCodes {error} -result {bad screen distance "0.5x"} test button-5.23 {ConfigureButton - -height option} -constraints { testImageType } -setup { image create test image1 } -body { #ztestImageType button .b -image image1 catch {.b configure -height 0.5x} return $errorInfo } -cleanup { destroy .b image delete image1 } -result {bad screen distance "0.5x" (processing -height option) invoked from within |
︙ | ︙ | |||
3440 3441 3442 3443 3444 3445 3446 | # 1. button with text .b configure -text "Sample text" pack .b set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]] set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \ + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}] incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c | | | | | | 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 | # 1. button with text .b configure -text "Sample text" pack .b set textwidth [font measure [.b cget -font] -displayof .b [.b cget -text]] set expectedwidth [expr {$textwidth + 2*[.b cget -borderwidth] \ + 2*[.b cget -highlightthickness] + 2*[.b cget -padx]}] incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c set result [expr {$expectedwidth == [winfo reqwidth .b]}] set linespace [lindex [font metrics [.b cget -font] -displayof .b] 5] set expectedheight [expr {$linespace + 2*[.b cget -borderwidth] \ + 2*[.b cget -highlightthickness] + 2*[.b cget -pady]}] incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c lappend result [expr {$expectedheight == [winfo reqheight .b]}] # 2. button with a bitmap image # there is no access to characteristics the predefined bitmaps, # so define one as an image (copied from questhead.xbm) set myquesthead [image create bitmap -data { #define myquesthead_width 20 #define myquesthead_height 22 static unsigned char myquesthead_bits[] = { 0xf8, 0x1f, 0x00, 0xac, 0x2a, 0x00, 0x56, 0x55, 0x00, 0xeb, 0xaf, 0x00, 0xf5, 0x5f, 0x01, 0xfb, 0xbf, 0x00, 0x75, 0x5d, 0x01, 0xfb, 0xbe, 0x02, 0x75, 0x5d, 0x05, 0xab, 0xbe, 0x0a, 0x55, 0x5f, 0x07, 0xab, 0xaf, 0x00, 0xd6, 0x57, 0x01, 0xac, 0xab, 0x00, 0xd8, 0x57, 0x00, 0xb0, 0xaa, 0x00, 0x50, 0x55, 0x00, 0xb0, 0x0b, 0x00, 0xd0, 0x17, 0x00, 0xb0, 0x0b, 0x00, 0x58, 0x15, 0x00, 0xa8, 0x2a, 0x00}; }] .b configure -image $myquesthead set expectedwidth [expr {[image width $myquesthead] + 2*[.b cget -borderwidth] \ + 2*[.b cget -highlightthickness]}] incr expectedwidth 2 ; # added (hardcoded) in tkUnixButton.c lappend result [expr {$expectedwidth == [winfo reqwidth .b]}] set expectedheight [expr {[image height $myquesthead] + 2*[.b cget -borderwidth] \ + 2*[.b cget -highlightthickness]}] incr expectedheight 2 ; # added (hardcoded) in tkUnixButton.c lappend result [expr {$expectedheight == [winfo reqheight .b]}] } -cleanup { destroy .b } -result {1 1 1 1} test button-5.25 {ConfigureButton - computing geometry} -setup { button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} } -body { |
︙ | ︙ | |||
3519 3520 3521 3522 3523 3524 3525 | list [info command .b*] [winfo children .] } -cleanup { destroy .b } -result {{} {}} test button-8.1 {TkInvokeButton procedure} -setup { set x 0 | | | | | | | | | | | | 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 | list [info command .b*] [winfo children .] } -cleanup { destroy .b } -result {{} {}} test button-8.1 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x set result $x .c invoke lappend result $x .c invoke lappend result $x } -cleanup { destroy .c } -result {0 1 0} test button-8.2 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x trace variable x w bogusTrace .c invoke } -cleanup { destroy .c trace vdelete x w bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.3 {TkInvokeButton procedure} -setup { set x 0 } -body { checkbutton .c -variable x trace variable x w bogusTrace catch {.c invoke} return $x } -cleanup { destroy .c trace vdelete x w bogusTrace } -result {1} test button-8.4 {TkInvokeButton procedure} -setup { set x 1 } -body { checkbutton .c -variable x trace variable x w bogusTrace .c invoke } -cleanup { destroy .c trace vdelete x w bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.5 {TkInvokeButton procedure} -setup { set x 1 } -body { checkbutton .c -variable x trace variable x w bogusTrace catch {.c invoke} return $x } -cleanup { destroy .c trace vdelete x w bogusTrace } -result {0} test button-8.6 {TkInvokeButton procedure} -setup { set x 0 } -body { radiobutton .r -variable x -value red set result $x .r invoke lappend result $x .r invoke lappend result $x } -cleanup { destroy .r } -result {0 red red} test button-8.7 {TkInvokeButton procedure} -body { radiobutton .r -variable x -value red set x green trace variable x w bogusTrace .r invoke } -cleanup { destroy .r trace vdelete x w bogusTrace } -returnCodes {error} -result {can't set "x": trace aborted} test button-8.8 {TkInvokeButton procedure} -body { radiobutton .r -variable x -value red set x green trace variable x w bogusTrace catch {.r invoke} list $errorInfo $x } -cleanup { destroy .r |
︙ | ︙ | |||
3750 3751 3752 3753 3754 3755 3756 | set new [winfo reqwidth .b] expr {$old == $new} } -cleanup { destroy .b } -result {0} test button-11.1 {ButtonImageProc procedure} -constraints { | | | 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 | set new [winfo reqwidth .b] expr {$old == $new} } -cleanup { destroy .b } -result {0} test button-11.1 {ButtonImageProc procedure} -constraints { testImageType } -setup { label .l -highlightthickness 0 -font {Helvetica -12 bold} image create test image1 } -body { .l configure -image image1 -padx 0 -pady 0 -bd 0 pack .l set result "[winfo reqwidth .l] [winfo reqheight .l]" |
︙ | ︙ | |||
3784 3785 3786 3787 3788 3789 3790 | test button-13.1 {size behavior: label} -setup { label .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} label .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} label .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} set result {} } -body { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > | | | | | | | | | | | < < < < < < < < < < < < < < < < < < | < | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 | test button-13.1 {size behavior: label} -setup { label .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} label .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} label .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.2 {size behavior: label} -setup { label .a -borderwidth 2 -highlightthickness 2 -font {Arial 20} label .b -borderwidth 2 -highlightthickness 2 -font {Arial 20} label .c -borderwidth 2 -highlightthickness 2 -font {Arial 20} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.3 {size behavior: button} -setup { button .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} button .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} button .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.4 {size behavior: button} -setup { button .a -borderwidth 2 -highlightthickness 2 -font {Arial 20} button .b -borderwidth 2 -highlightthickness 2 -font {Arial 20} button .c -borderwidth 2 -highlightthickness 2 -font {Arial 20} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.5 {size behavior: radiobutton} -setup { radiobutton .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} radiobutton .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} radiobutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.6 {size behavior: radiobutton} -setup { radiobutton .a -borderwidth 2 -highlightthickness 2 -font {Arial 20} radiobutton .b -borderwidth 2 -highlightthickness 2 -font {Arial 20} radiobutton .c -borderwidth 2 -highlightthickness 2 -font {Arial 20} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.7 {size behavior: checkbutton} -setup { checkbutton .a -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} checkbutton .b -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-13.8 {size behavior: checkbutton} -setup { checkbutton .a -borderwidth 2 -highlightthickness 2 -font {Arial 20} checkbutton .b -borderwidth 2 -highlightthickness 2 -font {Arial 20} checkbutton .c -borderwidth 2 -highlightthickness 2 -font {Arial 20} set result {} } -body { .a configure -text Hej .b configure -text Hej -width 10 -height 1 .c configure -text "" -width 10 -height 1 # With -width, width should not be affected by text change lappend result [expr {[winfo reqwidth .b] == [winfo reqwidth .c]}] # With -height, height should not be affected by text change lappend result [expr {[winfo reqheight .b] == [winfo reqheight .c]}] # A one line text should be as high as -height 1 lappend result [expr {[winfo reqheight .a] == [winfo reqheight .b]}] } -cleanup { destroy .a .b .c } -result {1 1 1} test button-14.1 {bug fix: [011706ec42] tk::ButtonInvoke unsafe wrt widget destruction} -body { proc destroy_button {} { if {[winfo exists .top.b]} { destroy .top.b } } toplevel .top button .top.b -text Foo -command destroy_button bind .top.b <space> destroy_button pack .top.b focus -force .top.b update event generate .top.b <space> update ; # shall not trigger error invalid command name ".top.b" } -cleanup { destroy .top.b .top } -result {} test button-15.1 {Bug [5d991b822e]} { # Want this not to segfault set var INIT button .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b } {} test button-15.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT button .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} test button-15.3 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT checkbutton .b -variable var trace add variable var unset {apply {args { .b configure -variable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b } {} imageFinish cleanupTests return # Local variables: # mode: tcl # End: |
Changes to tests/canvImg.test.
︙ | ︙ | |||
152 153 154 155 156 157 158 | .c itemconfigure i1 -image {} update list $x [.c bbox i1] } -cleanup { .c delete all image delete foo } -result {{{foo free}} {}} | | | > > > > > > > | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | .c itemconfigure i1 -image {} update list $x [.c bbox i1] } -cleanup { .c delete all image delete foo } -result {{{foo free}} {}} test canvImg-4.2 {ConfigureImage procedure} -constraints testImageType -setup { .c delete all } -body { image create test foo -variable x image create test foo2 -variable y foo2 changed 0 0 0 0 80 60 .c create image 50 100 -image foo -tags i1 -anchor nw update set x {} set y {} set timer [after 300 {lappend y "timeout"}] .c itemconfigure i1 -image foo2 update idletasks update # On MacOS we need to wait for the test image display procedure to run. while {"timeout" ni $y && [lindex $y end 1] ne "display"} { vwait y } after cancel timer list $x $y [.c bbox i1] } -cleanup { .c delete all image delete foo image delete foo2 } -result {{{foo free}} {{foo2 get} {foo2 display 0 0 80 60}} {50 100 130 160}} test canvImg-4.3 {ConfiugreImage procedure} -constraints testImageType -setup { |
︙ | ︙ | |||
311 312 313 314 315 316 317 | .c create image 20 30 -image foo -tags i1 -anchor s .c bbox i1 } -cleanup { .c delete all imageCleanup } -result {5 15 35 30} test canvImg-6.10 {ComputeImageBbox procedure} -constraints { | | | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | .c create image 20 30 -image foo -tags i1 -anchor s .c bbox i1 } -cleanup { .c delete all imageCleanup } -result {5 15 35 30} test canvImg-6.10 {ComputeImageBbox procedure} -constraints { testImageType } -setup { image create test foo .c delete all } -body { .c delete all .c create image 20 30 -image foo -tags i1 -anchor sw .c bbox i1 } -cleanup { .c delete all image delete foo } -result {20 15 50 30} test canvImg-6.11 {ComputeImageBbox procedure} -constraints { testImageType } -setup { image create test foo .c delete all } -body { .c delete all .c create image 20 30 -image foo -tags i1 -anchor w .c bbox i1 } -cleanup { .c delete all image delete foo } -result {20 23 50 38} test canvImg-6.12 {ComputeImageBbox procedure} -constraints { testImageType } -setup { image create test foo .c delete all } -body { .c delete all .c create image 20 30 -image foo -tags i1 -anchor center .c bbox i1 |
︙ | ︙ | |||
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | .c scale image 25 0 2.0 1.5 .c bbox image } -cleanup { .c delete all image delete foo } -result {75 150 105 165} test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup { .c delete all update } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor nw update set x {} foo changed 2 4 6 8 30 15 update return $x } -cleanup { .c delete all image delete foo | > > > > > > | | > > > > > > | | | | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | .c scale image 25 0 2.0 1.5 .c bbox image } -cleanup { .c delete all image delete foo } -result {75 150 105 165} if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} { # Aqua >= 10.14 will redraw the entire image. set result_10_1 {{foo display 0 0 30 15}} } else { set result_10_1 {{foo display 2 4 6 8}} } test canvImg-10.1 {TranslateImage procedure} -constraints testImageType -setup { .c delete all update } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor nw update set x {} foo changed 2 4 6 8 30 15 update return $x } -cleanup { .c delete all image delete foo } -result $result_10_1 test canvImg-11.1 {TranslateImage procedure} -constraints testImageType -setup { .c delete all update } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor nw update set x {} foo changed 2 4 6 8 40 50 update return $x } -cleanup { .c delete all image delete foo } -result {{foo display 0 0 40 50}} test canvImg-11.2 {ImageChangedProc procedure} -constraints { testImageType } -setup { .c delete all } -body { image create test foo -variable x .c create image 50 100 -image foo -tags image -anchor center update set x {} foo changed 0 0 0 0 40 50 .c bbox image } -cleanup { .c delete all image delete foo } -result {30 75 70 125} if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} { # Aqua >= 10.14 will redraw the entire image. set result_11_3 {{foo2 display 0 0 80 60}} } else { set result_11_3 {{foo2 display 0 0 20 40}} } test canvImg-11.3 {ImageChangedProc procedure} -constraints { testImageType } -setup { .c delete all update } -body { image create test foo -variable x image create test foo2 -variable y foo changed 0 0 0 0 40 50 foo2 changed 0 0 0 0 80 60 .c create image 50 100 -image foo -tags image -anchor nw .c create image 70 110 -image foo2 -anchor nw update set y {} image create test foo -variable x update return $y } -cleanup { .c delete all image delete foo foo2 } -result $result_11_3 # cleanup imageFinish cleanupTests return # Local variables: # mode: tcl # End: |
Changes to tests/canvMoveto.test.
︙ | ︙ | |||
29 30 31 32 33 34 35 | test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { .c moveto test 12 20 -anchor } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-2.1 {Canvas "moveto" command coordinates} { .c moveto test 200 150 .c bbox test | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | test canvMoveto-1.5 {Bad args handling for "moveto" command} -body { .c moveto test 12 20 -anchor } -returnCodes error -result {wrong # args: should be ".c moveto tagOrId x y"} test canvMoveto-2.1 {Canvas "moveto" command coordinates} { .c moveto test 200 150 .c bbox test } {200 150 272 232} test canvMoveto-2.2 {Canvas "moveto" command, blank y coordinate} { .c moveto test 200 150 .c moveto test 150 {} .c bbox test } {150 150 222 232} test canvMoveto-2.3 {Canvas "moveto" command, blank x coordinate} { .c moveto test 200 150 |
︙ | ︙ |
Changes to tests/canvRect.test.
︙ | ︙ | |||
224 225 226 227 228 229 230 | set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure y -outline {} list [expr {[.c find closest 20 24.9] eq $xId}] \ [expr {[.c find closest 20 25.1] eq $yId}] \ [expr {[.c find closest 20 29.9] eq $yId}] \ [expr {[.c find closest 20 30.1] eq $xId}] | | | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure y -outline {} list [expr {[.c find closest 20 24.9] eq $xId}] \ [expr {[.c find closest 20 25.1] eq $yId}] \ [expr {[.c find closest 20 29.9] eq $yId}] \ [expr {[.c find closest 20 30.1] eq $xId}] } -cleanup { .c delete all } -result {1 1 1 1} test canvRect-6.3 {RectToPoint procedure} -body { set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure y -width 1 -outline black |
︙ | ︙ | |||
246 247 248 249 250 251 252 | test canvRect-6.4 {RectToPoint procedure} -body { set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure y -width 1 -outline black list [expr {[.c find closest 20 24.4] eq $xId}] \ [expr {[.c find closest 20 24.6] eq $yId}] \ [expr {[.c find closest 20 30.4] eq $yId}] \ | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | test canvRect-6.4 {RectToPoint procedure} -body { set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure y -width 1 -outline black list [expr {[.c find closest 20 24.4] eq $xId}] \ [expr {[.c find closest 20 24.6] eq $yId}] \ [expr {[.c find closest 20 30.4] eq $yId}] \ [expr {[.c find closest 20 30.6] eq $xId}] } -cleanup { .c delete all } -result {1 1 1 1} test canvRect-6.5 {RectToPoint procedure} -body { set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] |
︙ | ︙ | |||
271 272 273 274 275 276 277 | set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure x -fill {} -outline black -width 3 .c itemconfigure y -outline {} list [expr {[.c find closest 20 23.2] eq $xId}] \ [expr {[.c find closest 20 23.3] eq $yId}] \ [expr {[.c find closest 20 31.7] eq $yId}] \ | | | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | set xId [.c create rectangle 10 20 30 35 -tags x -fill green] set yId [.c create rectangle 15 25 25 30 -tags y -fill red] .c itemconfigure x -fill {} -outline black -width 3 .c itemconfigure y -outline {} list [expr {[.c find closest 20 23.2] eq $xId}] \ [expr {[.c find closest 20 23.3] eq $yId}] \ [expr {[.c find closest 20 31.7] eq $yId}] \ [expr {[.c find closest 20 31.8] eq $xId}] } -cleanup { .c delete all } -result {1 1 1 1} test canvRect-6.7 {RectToPoint procedure} -body { set xId [.c create rectangle 10 20 30 40 -outline {} -fill black] set yId [.c create rectangle 40 40 50 50 -outline {} -fill black] list [expr {[.c find closest 35 35] eq $xId}] \ [expr {[.c find closest 36 36] eq $yId}] \ [expr {[.c find closest 37 37] eq $yId}] \ [expr {[.c find closest 38 38] eq $yId}] } -cleanup { .c delete all } -result {1 1 1 1} test canvRect-7.1 {RectToArea procedure} -body { set xId [.c create rectangle 10 20 30 35 -fill green -outline {}] |
︙ | ︙ |
Changes to tests/canvText.test.
︙ | ︙ | |||
265 266 267 268 269 270 271 | } -body { set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*" set ay [font metrics $font -linespace] set ax [font measure $font 0] .c create text 0 0 -tag test .c itemconfig test -font $font -text 0 expr {[.c itemconfig test -anchor n; .c bbox test] \ | | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | } -body { set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*" set ay [font metrics $font -linespace] set ax [font measure $font 0] .c create text 0 0 -tag test .c itemconfig test -font $font -text 0 expr {[.c itemconfig test -anchor n; .c bbox test] \ eq "[expr {-$ax/2-1}] 0 [expr {$ax/2+1}] $ay"} } -cleanup { .c delete test } -result 1 test canvText-6.2 {ComputeTextBbox procedure} -constraints fonts -setup { .c delete test } -body { set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*" set ay [font metrics $font -linespace] set ax [font measure $font 0] .c create text 0 0 -tag test .c itemconfig test -font $font -text 0 expr {[.c itemconfig test -anchor nw; .c bbox test] \ eq "-1 0 [expr {$ax+1}] $ay"} } -cleanup { .c delete test } -result 1 test canvText-6.3 {ComputeTextBbox procedure} -constraints fonts -setup { .c delete test } -body { set font "-adobe-times-medium-r-normal--*-200-*-*-*-*-*-*" |
︙ | ︙ |
Changes to tests/canvas.test.
︙ | ︙ | |||
336 337 338 339 340 341 342 | } -body { .c create arc -100 10 100 210 -start 10 -extent 50 -style arc -tags arc1 set arcBox [.c bbox arc1] .c create arc 100 10 300 210 -start 10 -extent 50 -style chord -tags arc2 set coordBox [.c bbox arc2] .c create arc 300 10 500 210 -start 10 -extent 50 -style pieslice -tags arc3 set pieBox [.c bbox arc3] | > > | | | | | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | } -body { .c create arc -100 10 100 210 -start 10 -extent 50 -style arc -tags arc1 set arcBox [.c bbox arc1] .c create arc 100 10 300 210 -start 10 -extent 50 -style chord -tags arc2 set coordBox [.c bbox arc2] .c create arc 300 10 500 210 -start 10 -extent 50 -style pieslice -tags arc3 set pieBox [.c bbox arc3] .c create arc 100 200 300 200 -height [expr {(1-0.5*sqrt(3))*200}] -style arc -tags arc4 set arcSegBox [.c bbox arc4] list $arcBox $coordBox $pieBox $arcSegBox } -result {{48 21 100 94} {248 21 300 94} {398 21 500 112} {98 171 302 202}} test canvas-9.1 {canvas id creation and deletion} -setup { catch {destroy .c} canvas .c } -body { # With Tk 8.0.4 the ids are now stored in a hash table. You can use this # test as a performance test with older versions by changing the value of # size. set size 15 for {set i 0} {$i < $size} {incr i} { set x [expr {-10 + 3*$i}] for {set j 0; set y -10} {$j < 10} {incr j; incr y 3} { .c create rect ${x}c ${y}c [expr {$x+2}]c [expr {$y+2}]c \ -outline black -fill blue -tags rect .c create text [expr {$x+1}]c [expr {$y+1}]c -text "$i,$j" \ -anchor center -tags text } } # The actual bench mark - this code also exercises all the hash table # changes. set time [lindex [time { foreach id [.c find withtag all] { |
︙ | ︙ | |||
533 534 535 536 537 538 539 | .c coords 1 } {} test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup { destroy .c pack [canvas .c] } -body { | | | | | | | 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | .c coords 1 } {} test canvas-12.1 {canvas mm obj, patch SF-403327, 102471} -setup { destroy .c pack [canvas .c] } -body { set qx [expr {1.+1.}] # qx has type double and no string representation .c scale all $qx 0 1. 1. # qx has now type MMRep and no string representation list $qx [string length $qx] } -result {2.0 3} test canvas-12.2 {canvas mm obj, patch SF-403327, 102471} -setup { destroy .c pack [canvas .c] } -body { set val 10 incr val # qx has type double and no string representation .c scale all $val 0 1 1 # qx has now type MMRep and no string representation incr val } -result 12 # procedure used in 13.1 test case proc kill_canvas {w} { destroy $w pack [canvas $w -height 200 -width 200] -fill both -expand yes |
︙ | ︙ | |||
723 724 725 726 727 728 729 | } -returnCodes error -body { .c create window 0 } -result {wrong # coordinates: expected 2, got 1} test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup { destroy .c canvas .c } -body { | | | 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | } -returnCodes error -body { .c create window 0 } -result {wrong # coordinates: expected 2, got 1} test canvas-15.19 "basic coords check: centimeters are larger than pixels" -setup { destroy .c canvas .c } -body { set id [.c create rect 0 0 1cm 1cm] expr {[lindex [.c coords $id] 2]>1} } -result {1} destroy .c test canvas-16.1 {arc coords check} -setup { canvas .c } -body { |
︙ | ︙ | |||
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 | } -body { set id [.c create line 0 0 1 1] .c rchars $id 1 foo {2 2} } -cleanup { destroy .c } -returnCodes error -result {bad index "foo"} # cleanup imageCleanup cleanupTests return # Local Variables: # mode: tcl # End: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 | } -body { set id [.c create line 0 0 1 1] .c rchars $id 1 foo {2 2} } -cleanup { destroy .c } -returnCodes error -result {bad index "foo"} # Procedure used in test cases 20.1 20.2 20.3 proc matchPixels {pixels expected} { set matched 1 foreach pline $pixels eline $expected { foreach ppixel $pline epixel $eline { if {$ppixel != $epixel} { set matched 0 break } } } return $matched } test canvas-20.1 {canvas image} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 0 9 -fill #000080 -outline #000080 .c image testimage matchPixels [testimage data] { \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#000080 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 test canvas-20.2 {canvas image with subsample} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 1 9 -fill #008000 -outline #008000 .c image testimage 2 matchPixels [testimage data] { \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#008000 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 test canvas-20.3 {canvas image with subsample and zoom} -setup { canvas .c image create photo testimage } -body { .c configure -background #c0c0c0 -scrollregion {0 0 9 9} .c create rectangle 0 0 9 0 -fill #800000 -outline #800000 .c image testimage 1 2 matchPixels [testimage data] { \ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \ {#800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000 #800000} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0} \ {#c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0 #c0c0c0}} } -cleanup { destroy .c image delete testimage } -result 1 test canvas-21.1 {canvas very small arc} -setup { catch {destroy .c} canvas .c } -body { # no Inf or NaN must be generated even for very small arcs .c create arc 0 100 0 100 -height 100 -style arc -outline "" -tags arc1 set arcBox [.c bbox arc1] .c create arc 0 100 0 100 -height 100 -style arc -outline blue -tags arc2 set outlinedArcBox [.c bbox arc2] set coords [.c coords arc1] set start [.c itemcget arc1 -start] set extent [.c itemcget arc1 -extent] set width [.c itemcget arc1 -width] set height [.c itemcget arc1 -height] list $arcBox $outlinedArcBox $coords $start $extent $width $height } -result {{-1 99 1 101} {-2 98 2 102} {0.0 100.0 0.0 100.0} 0.0 0.0 1.0 0.0} destroy .c test canvas-21.1 {canvas rotate} -setup { pack [canvas .c] } -body { .c create line 50 50 50 100 100 100 .c rotate all 75 75 90 lmap c [.c coords all] {format %.2f $c} } -cleanup { destroy .c } -result {50.00 100.00 100.00 100.00 100.00 50.00} test canvas-21.2 {canvas rotate} -setup { pack [canvas .c] } -body { .c create line 50 50 50 100 100 100 .c rotate all 75 75 -10 lmap c [.c coords all] {format %.2f $c} } -cleanup { destroy .c } -result {54.72 46.04 46.04 95.28 95.28 103.96} test canvas-21.3 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 75 75 } -returnCodes error -cleanup { destroy .c } -result {wrong # args: should be ".c rotate tagOrId x y angle"} test canvas-21.4 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 75 75 123 123 } -returnCodes error -cleanup { destroy .c } -result {wrong # args: should be ".c rotate tagOrId x y angle"} test canvas-21.5 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate {!} 1 1 1 } -returnCodes error -cleanup { destroy .c } -result {missing tag in tag search expression} test canvas-21.6 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all x 1 1 } -returnCodes error -cleanup { destroy .c } -result {bad screen distance "x"} test canvas-21.7 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 1 x 1 } -returnCodes error -cleanup { destroy .c } -result {bad screen distance "x"} test canvas-21.8 {canvas rotate: syntax} -setup { pack [canvas .c] } -body { .c rotate all 1 1 x } -returnCodes error -cleanup { destroy .c } -result {expected floating-point number but got "x"} test canvas-21.9 {canvas rotate: nothing to rotate} -setup { pack [canvas .c] } -body { .c rotate all 75 75 10 } -cleanup { destroy .c } -result {} test canvas-21.10 {canvas rotate: multiple things to rotate} -setup { pack [canvas .c] } -body { .c create line 50 50 50 100 -tag a .c create line 50 50 100 50 -tag b .c rotate all 75 75 45 list [lmap c [.c coords a] {format %.2f $c}] [lmap c [.c coords b] {format %.2f $c}] } -cleanup { destroy .c } -result {{39.64 75.00 75.00 110.36} {39.64 75.00 75.00 39.64}} test canvas-22.1 {canvas rotate: arc item rotation behaviour} -setup { pack [canvas .c] } -body { .c create arc 50 50 75 75 -start 45 -extent 90 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {-start -extent} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 125.00 75.00 150.00} {45.0 90.0} {52 123 73 140}} test canvas-22.2 {canvas rotate: bitmap item rotation behaviour} -setup { pack [canvas .c] } -body { .c create bitmap 50 50 -bitmap info -anchor se .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {-bitmap -anchor} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 150.00} {info se} {42 129 50 150}} test canvas-22.3 {canvas rotate: image item rotation behaviour} -setup { pack [canvas .c] image create photo dummy -width 50 -height 50 } -body { .c create image 50 50 -image dummy -anchor se .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {-image -anchor} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c image delete dummy } -result {{50.00 150.00} {dummy se} {0 100 50 150}} test canvas-22.4 {canvas rotate: line item rotation behaviour} -setup { pack [canvas .c] } -body { .c create line 50 50 75 50 50 75 75 75 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 150.00 50.00 125.00 75.00 150.00 75.00 125.00} {} {48 123 77 152}} test canvas-22.5 {canvas rotate: oval item rotation behaviour} -setup { pack [canvas .c] } -body { .c create oval 50 50 65 85 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{60.00 125.00 75.00 160.00} {} {59 124 76 161}} test canvas-22.6 {canvas rotate: polygon item rotation behaviour} -setup { pack [canvas .c] } -body { .c create polygon 50 50 75 50 50 75 75 75 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 150.00 50.00 125.00 75.00 150.00 75.00 125.00} {} {49 124 76 151}} test canvas-22.7 {canvas rotate: rectangle item rotation behaviour} -setup { pack [canvas .c] } -body { .c create rectangle 50 50 75 75 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 125.00 75.00 150.00} {} {49 124 76 151}} test canvas-22.8 {canvas rotate: text item rotation behaviour} -setup { pack [canvas .c] } -body { .c create text 50 50 -text foo -angle 45 .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {-text -angle} {.c itemcget all $o}] # [.c bbox all] # No testing of text bounding box; fonts too variable! } -cleanup { destroy .c } -result {{50.00 150.00} {foo 45.0}} test canvas-22.9 {canvas rotate: window item rotation behaviour} -setup { pack [canvas .c] } -body { .c create window 50 50 -window [frame .c.f -width 25 -height 25] \ -anchor se .c rotate all 100 100 90 list [lmap c [.c coords all] {format %.2f $c}] \ [lmap o {} {.c itemcget all $o}] \ [.c bbox all] } -cleanup { destroy .c } -result {{50.00 150.00} {} {25 125 50 150}} # cleanup imageCleanup cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/clipboard.test.
︙ | ︙ | |||
176 177 178 179 180 181 182 | clipboard append "Test" clipboard append -t TEST "Test2" clipboard append "Test3" selection clear -s CLIPBOARD clipboard get } -cleanup { clipboard clear | | | 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | clipboard append "Test" clipboard append -t TEST "Test2" clipboard append "Test3" selection clear -s CLIPBOARD clipboard get } -cleanup { clipboard clear } -returnCodes error -result {CLIPBOARD selection doesn't exist or form "STRING" not defined} test clipboard-4.5 {ClipboardLostSel procedure} -setup { clipboard clear } -body { clipboard append "Test" clipboard append -t TEST "Test2" clipboard append "Test3" selection clear -s CLIPBOARD |
︙ | ︙ |
Changes to tests/clrpick.test.
︙ | ︙ | |||
74 75 76 77 78 79 80 | tk_chooseColor -initialcolor ##badbadbaadcolor } -returnCodes error -result {invalid color name "##badbadbaadcolor"} # tests 3.1 and 3.2 fail when individually run # if there is no catch {tk_chooseColor -foo 1} msg # before settin isNative | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | tk_chooseColor -initialcolor ##badbadbaadcolor } -returnCodes error -result {invalid color name "##badbadbaadcolor"} # tests 3.1 and 3.2 fail when individually run # if there is no catch {tk_chooseColor -foo 1} msg # before settin isNative catch {tk_chooseColor -foo 1} msg set isNative [expr {[info commands tk::dialog::color::] eq ""}] proc ToPressButton {parent btn} { global isNative if {!$isNative} { after 200 "SendButtonPress . $btn mouse" } |
︙ | ︙ |
Changes to tests/cmap.tcl.
︙ | ︙ | |||
15 16 17 18 19 20 21 | set red 0 set green 0 set blue 0 for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 8} {incr x} { frame $w.f$x,$y -width 40 -height 40 -bd 2 -relief raised \ -bg [format #%02x%02x%02x $red $green $blue] | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | set red 0 set green 0 set blue 0 for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 8} {incr x} { frame $w.f$x,$y -width 40 -height 40 -bd 2 -relief raised \ -bg [format #%02x%02x%02x $red $green $blue] place $w.f$x,$y -x [expr {40*$x}] -y [expr {40*$y}] incr red $redInc incr green $greenInc incr blue $blueInc } } } |
︙ | ︙ |
Changes to tests/cmds.test.
︙ | ︙ | |||
35 36 37 38 39 40 41 | frame .f button .f.b -text "Test" pack .f.b set x init } -body { after 100 {set x deleted; destroy .f} tkwait visibility .f.b | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | frame .f button .f.b -text "Test" pack .f.b set x init } -body { after 100 {set x deleted; destroy .f} tkwait visibility .f.b } -returnCodes {error} -result {window ".f.b" was deleted before its visibility changed} test cmds-1.6 {tkwait visibility, window gets deleted} -setup { frame .f button .f.b -text "Test" pack .f.b set x init } -body { after 100 {set x deleted; destroy .f} |
︙ | ︙ |
Changes to tests/color.test.
︙ | ︙ | |||
164 165 166 167 168 169 170 | set result {} while {[gets $fd line] != -1} { if {[string index $line 0] == "!"} continue set rgb [c255 [winfo rgb . [lrange $line 3 end]]] if {$rgb != [lrange $line 0 2] } { append result $line\n } | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | set result {} while {[gets $fd line] != -1} { if {[string index $line 0] == "!"} continue set rgb [c255 [winfo rgb . [lrange $line 3 end]]] if {$rgb != [lrange $line 0 2] } { append result $line\n } } return $result } {} test color-2.1 {Tk_GetColor procedure} colorsFree { c255 [winfo rgb .t #FF0000] } {255 0 0} |
︙ | ︙ |
Changes to tests/config.test.
︙ | ︙ | |||
192 193 194 195 196 197 198 | killTables option clear } -returnCodes error -result {unknown color name "non-existent"} test config-3.7 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { option add *a.color non-existent | | | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | killTables option clear } -returnCodes error -result {unknown color name "non-existent"} test config-3.7 {Tk_InitOptions - bad initial value} -constraints { testobjconfig } -body { option add *a.color non-existent catch {testobjconfig alltypes .a} return $errorInfo } -cleanup { killTables option clear } -result {unknown color name "non-existent" (database entry for "-color" in widget ".a") invoked from within |
︙ | ︙ | |||
554 555 556 557 558 559 560 | testobjconfig alltypes .foo -color {} .foo cget -color rename .foo {} } -cleanup { killTables } -returnCodes ok test config-4.42 {DoObjConfig - getting rid of old color} -constraints { | | | | | 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | testobjconfig alltypes .foo -color {} .foo cget -color rename .foo {} } -cleanup { killTables } -returnCodes ok test config-4.42 {DoObjConfig - getting rid of old color} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -color #333333 .foo configure -color #444444 } -cleanup { killTables } -returnCodes ok -result {32} test config-4.43 {DoObjConfig - getting rid of old color} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -color #333333 .foo configure -color #444444 .foo cget -color } -cleanup { killTables } -returnCodes ok -result {#444444} test config-4.44 {DoObjConfig - getting rid of old color} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -color #333333 .foo configure -color #444444 .foo cget -color rename .foo {} } -cleanup { killTables |
︙ | ︙ | |||
661 662 663 664 665 666 667 | testobjconfig alltypes .foo -bitmap gray75 .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result {gray75} test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 | | | | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 | testobjconfig alltypes .foo -bitmap gray75 .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result {gray75} test config-4.55 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 } -cleanup { killTables } -returnCodes ok -result {128} test config-4.56 {DoObjConfig - new bitmap} -constraints testobjconfig -body { testobjconfig alltypes .foo -bitmap gray75 .foo configure -bitmap gray50 .foo cget -bitmap } -cleanup { killTables } -returnCodes ok -result {gray50} test config-4.57 {DoObjConfig - invalid bitmap} -constraints { testobjconfig } -body { |
︙ | ︙ | |||
741 742 743 744 745 746 747 | } -body { testobjconfig internal .foo -border #123456 .foo cget -border } -cleanup { killTables } -result {#123456} test config-4.67 {DoObjConfig - getting rid of old border} -constraints { | | | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 | } -body { testobjconfig internal .foo -border #123456 .foo cget -border } -cleanup { killTables } -result {#123456} test config-4.67 {DoObjConfig - getting rid of old border} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -border #333333 .foo configure -border #444444 } -cleanup { killTables } -returnCodes ok -result {256} test config-4.68 {DoObjConfig - getting rid of old border} -constraints { testobjconfig } -body { testobjconfig alltypes .foo -border #333333 .foo configure -border #444444 .foo cget -border } -cleanup { killTables } -returnCodes ok -result {#444444} |
︙ | ︙ | |||
786 787 788 789 790 791 792 | testobjconfig internal .foo -relief ridge .foo cget -relief } -cleanup { killTables } -result {ridge} test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised | | | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | testobjconfig internal .foo -relief ridge .foo cget -relief } -cleanup { killTables } -result {ridge} test config-4.73 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat } -cleanup { killTables } -returnCodes ok -result {512} test config-4.74 {DoObjConfig - new relief} -constraints testobjconfig -body { testobjconfig alltypes .foo -relief raised .foo configure -relief flat .foo cget -relief } -cleanup { killTables } -returnCodes ok -result {flat} test config-4.75 {DoObjConfig - cursor} -constraints testobjconfig -body { testobjconfig alltypes .foo -cursor arrow |
︙ | ︙ | |||
911 912 913 914 915 916 917 | test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor foo } -cleanup { killTables } -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, or center} test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e | | | 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 | test config-4.91 {DoObjConfig - invalid anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor foo } -cleanup { killTables } -returnCodes error -result {bad anchor "foo": must be n, ne, e, se, s, sw, w, nw, or center} test config-4.92 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n } -cleanup { killTables } -returnCodes ok -result {4096} test config-4.93 {DoObjConfig - new anchor} -constraints testobjconfig -body { testobjconfig alltypes .foo -anchor e .foo configure -anchor n .foo cget -anchor |
︙ | ︙ | |||
989 990 991 992 993 994 995 | testobjconfig twowindows .foo -window .bar .foo cget -window } -cleanup { killTables } -returnCodes ok -result {.bar} test config-4.103 {DoObjConfig - invalid window} -constraints testobjconfig -body { toplevel .bar | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 | testobjconfig twowindows .foo -window .bar .foo cget -window } -cleanup { killTables } -returnCodes ok -result {.bar} test config-4.103 {DoObjConfig - invalid window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window foo } -cleanup { killTables } -returnCodes error -result {bad window path name "foo"} test config-4.104 {DoObjConfig - null window} -constraints testobjconfig -body { toplevel .bar testobjconfig twowindows .foo -window {} } -cleanup { |
︙ | ︙ | |||
1201 1202 1203 1204 1205 1206 1207 | test config-7.3 {Tk_SetOptions - synonym} -constraints testobjconfig -body { .a configure -synonym blue .a cget -color } -result {blue} test config-7.4 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { | | | | | | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | test config-7.3 {Tk_SetOptions - synonym} -constraints testobjconfig -body { .a configure -synonym blue .a cget -color } -result {blue} test config-7.4 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { .a configure -color green -relief } -returnCodes error -result {value for "-relief" missing} test config-7.5 {Tk_SetOptions - missing value} -constraints { testobjconfig } -body { catch {.a configure -color green -relief} .a cget -color } -result {green} test config-7.6 {Tk_SetOptions - saving old values} -constraints { testobjconfig } -body { .a configure -color red -int 7 -relief raised -double 3.14159 .a csave -color green -int 432 -relief sunken -double 2.0 -color bogus } -returnCodes error -result {unknown color name "bogus"} test config-7.7 {Tk_SetOptions - saving old values} -constraints { testobjconfig } -body { .a configure -color red -int 7 -relief raised -double 3.14159 catch {.a csave -color green -int 432 -relief sunken -double 2.0 -color bogus} list [.a cget -color] [.a cget -int] [.a cget -relief] [.a cget -double] } -result {red 7 raised 3.14159} test config-7.8 {Tk_SetOptions - error in DoObjConfig call} -constraints { testobjconfig } -body { .a configure -color bogus } -returnCodes error -result {unknown color name "bogus"} test config-7.9 {Tk_SetOptions - error in DoObjConfig call} -constraints { testobjconfig } -body { catch {.a configure -color bogus} return $errorInfo } -result {unknown color name "bogus" |
︙ | ︙ | |||
1258 1259 1260 1261 1262 1263 1264 | ".a configure -synonym bogus"} test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body { format %x [.a configure -color red -int 7 -relief raised -double 3.14159] } -result {226} test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { testobjconfig } -body { | | | 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 | ".a configure -synonym bogus"} test config-7.12 {Tk_SetOptions - returning mask} -constraints testobjconfig -body { format %x [.a configure -color red -int 7 -relief raised -double 3.14159] } -result {226} test config-7.13 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { testobjconfig } -body { .a configure -custom bad } -returnCodes error -result {expected good value, got "BAD"} test config-7.14 {Tk_SetOptions - error in DoObjConfig with custom option} -constraints { testobjconfig } -body { catch {.a configure -custom bad} return $errorInfo } -result {expected good value, got "BAD" |
︙ | ︙ |
Changes to tests/cursor.test.
︙ | ︙ | |||
104 105 106 107 108 109 110 | set wincur(file) "" } -body { setWincur wincur button .b -cursor [list @$wincur(file)] } -cleanup { destroy .b removeDirectory $wincur(dir) | | | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | set wincur(file) "" } -body { setWincur wincur button .b -cursor [list @$wincur(file)] } -cleanup { destroy .b removeDirectory $wincur(dir) unset wincur } -result {.b} test cursor-2.4 {Tk_GetCursor procedure: cursor specs are lists} -constraints { win } -setup { unset -nocomplain wincur set wincur(file) "" } -body { |
︙ | ︙ |
Changes to tests/entry.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | tcltest::loadTestedCommands # For xscrollcommand proc scroll args { global scrollInfo set scrollInfo $args } | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | tcltest::loadTestedCommands # For xscrollcommand proc scroll args { global scrollInfo set scrollInfo $args } # For trace variable proc override args { global x set x 12345 } # Procedures used in widget VALIDATION tests proc doval {W d i P s S v V} { |
︙ | ︙ | |||
102 103 104 105 106 107 108 | test entry-1.7 {configuration option: "borderwidth" for entry} -setup { entry .e -highlightthickness 2 -font {Helvetica -12 bold} pack .e update } -body { .e configure -borderwidth 1.3 | | | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | test entry-1.7 {configuration option: "borderwidth" for entry} -setup { entry .e -highlightthickness 2 -font {Helvetica -12 bold} pack .e update } -body { .e configure -borderwidth 1.3 .e cget -borderwidth } -cleanup { destroy .e } -result {1} test entry-1.8 {configuration option: "borderwidth" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .e update |
︙ | ︙ | |||
217 218 219 220 221 222 223 | } -body { .e configure -fg non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.19 {configuration option: "font" for entry} -setup { | | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | } -body { .e configure -fg non-existent } -cleanup { destroy .e } -returnCodes {error} -result {unknown color name "non-existent"} test entry-1.19 {configuration option: "font" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e configure -font {Helvetica -12} .e cget -font } -cleanup { destroy .e } -result {Helvetica -12} test entry-1.20 {configuration option: "font" for entry} -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e configure -font {} } -cleanup { destroy .e } -returnCodes {error} -result {font "" doesn't exist} |
︙ | ︙ | |||
623 624 625 626 627 628 629 630 631 632 633 634 635 636 | } -body { .e configure -xscrollcommand {Some command} .e cget -xscrollcommand } -cleanup { destroy .e } -result {Some command} test entry-2.1 {Tk_EntryCmd procedure} -body { entry } -returnCodes error -result {wrong # args: should be "entry pathName ?-option value ...?"} test entry-2.2 {Tk_EntryCmd procedure} -body { entry gorp | > > > > > > > > > > > > > > > > > | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | } -body { .e configure -xscrollcommand {Some command} .e cget -xscrollcommand } -cleanup { destroy .e } -result {Some command} test entry-1.59 {configuration option: "-placeholder"} -setup { pack [entry .e] } -body { .e configure -placeholder {Some text} .e cget -placeholder } -cleanup { destroy .e } -result {Some text} test entry-1.60 {configuration option: "-placeholderforeground"} -setup { pack [entry .e] } -body { .e configure -placeholder {Some text} -placeholderforeground red .e cget -placeholderforeground } -cleanup { destroy .e } -result {red} test entry-2.1 {Tk_EntryCmd procedure} -body { entry } -returnCodes error -result {wrong # args: should be "entry pathName ?-option value ...?"} test entry-2.2 {Tk_EntryCmd procedure} -body { entry gorp |
︙ | ︙ | |||
658 659 660 661 662 663 664 | entry .e } -cleanup { destroy .e } -result {.e} test entry-3.1 {EntryWidgetCmd procedure} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | entry .e } -cleanup { destroy .e } -result {.e} test entry-3.1 {EntryWidgetCmd procedure} -setup { entry .e pack .e update } -body { .e } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e option ?arg ...?"} test entry-3.2 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test entry-3.3 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test entry-3.4 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e pack .e update } -body { .e bbox bogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bogus"} test entry-3.5 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox 0 } -cleanup { destroy .e } -result [list 5 5 0 $cy] # Previously the result was count using previousli counted font measurements # and metrics. It was changed to less verbose solution - the result is the one # that passes fonts constraint (this concerns tests 3.6, 3.7, 3.8, 3.10) test entry-3.6 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): no utf chars .e insert 0 "abc" list [.e bbox 3] [.e bbox end] } -cleanup { destroy .e } -result {{19 5 7 13} {19 5 7 13}} test entry-3.7 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): utf at end .e insert 0 "ab\u4e4e" .e bbox end } -cleanup { destroy .e } -result {19 5 12 13} test entry-3.8 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): utf before index .e insert 0 "ab\u4e4ec" .e bbox 3 } -cleanup { destroy .e } -result {31 5 7 13} test entry-3.9 {EntryWidgetCmd procedure, "bbox" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): no chars .e bbox end } -cleanup { destroy .e } -result "5 5 0 $cy" test entry-3.10 {EntryWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert 0 "abcdefghij\u4e4eklmnop" list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end] } -cleanup { destroy .e } -result {{5 5 7 13} {12 5 7 13} {75 5 12 13} {122 5 7 13}} test entry-3.11 {EntryWidgetCmd procedure, "cget" widget command} -setup { entry .e } -body { .e cget } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test entry-3.12 {EntryWidgetCmd procedure, "cget" widget command} -setup { entry .e } -body { .e cget a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test entry-3.13 {EntryWidgetCmd procedure, "cget" widget command} -setup { entry .e } -body { .e cget -gorp } -cleanup { destroy .e } -returnCodes error -result {unknown option "-gorp"} test entry-3.14 {EntryWidgetCmd procedure, "cget" widget command} -setup { entry .e } -body { .e configure -bd 4 .e cget -bd } -cleanup { destroy .e } -result {4} test entry-3.15 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e pack .e update } -body { llength [.e configure] } -cleanup { destroy .e } -result {38} test entry-3.16 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e } -body { .e configure -foo } -cleanup { destroy .e } -returnCodes error -result {unknown option "-foo"} test entry-3.17 {EntryWidgetCmd procedure, "configure" widget command} -setup { entry .e } -body { .e configure -bd 4 .e configure -bg #ffffff lindex [.e configure -bd] 4 } -cleanup { destroy .e } -result {4} test entry-3.18 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e delete } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test entry-3.19 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e delete a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test entry-3.20 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e delete foo } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.21 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e delete 0 bar } -cleanup { destroy .e } -returnCodes error -result {bad entry index "bar"} test entry-3.22 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e delete 2 4 .e get } -cleanup { destroy .e } -result {014567890} test entry-3.23 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e } -body { .e insert end "01234567890" .e delete 6 .e get } -cleanup { destroy .e } -result {0123457890} test entry-3.24 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e update set x {} } -body { # UTF .e insert end "01234\u4e4e67890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "012345\u4e4e7890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "0123456\u4e4e890" .e delete 6 lappend x [.e get] } -cleanup { destroy .e } -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"] test entry-3.25 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e delete 6 5 .e get } -cleanup { destroy .e } -result {01234567890} test entry-3.26 {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e configure -state disabled .e delete 2 8 .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test entry-3.26a {EntryWidgetCmd procedure, "delete" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e configure -state readonly .e delete 2 8 .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test entry-3.27 {EntryWidgetCmd procedure, "get" widget command} -setup { entry .e } -body { .e get foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e get"} test entry-3.28 {EntryWidgetCmd procedure, "icursor" widget command} -setup { entry .e } -body { .e icursor } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e icursor pos"} test entry-3.29 {EntryWidgetCmd procedure, "icursor" widget command} -setup { entry .e } -body { .e icursor foo } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.30 {EntryWidgetCmd procedure, "icursor" widget command} -setup { entry .e } -body { .e insert end "01234567890" .e icursor 4 .e index insert } -cleanup { destroy .e } -result {4} test entry-3.31 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e } -body { .e in } -cleanup { destroy .e } -returnCodes error -result {ambiguous option "in": must be bbox, cget, configure, delete, get, icursor, index, insert, scan, selection, validate, or xview} test entry-3.32 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e } -body { .e index } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e index string"} test entry-3.33 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e } -body { .e index foo } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.34 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e pack .e update } -body { .e index 0 } -cleanup { destroy .e } -returnCodes {ok} -match glob -result {*} test entry-3.35 {EntryWidgetCmd procedure, "index" widget command} -setup { entry .e pack .e update } -body { # UTF .e insert 0 abc\u4e4e\u0153def list [.e index 3] [.e index 4] [.e index end] } -cleanup { destroy .e } -result {3 4 8} test entry-3.36 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { .e insert a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test entry-3.37 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test entry-3.38 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { .e insert foo Text } -cleanup { destroy .e } -returnCodes error -result {bad entry index "foo"} test entry-3.39 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e insert 3 xxx .e get } -cleanup { destroy .e } -result {012xxx34567890} test entry-3.40 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e configure -state disabled .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test entry-3.40a {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e pack .e update } -body { .e insert end "01234567890" .e configure -state readonly .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test entry-3.41 {EntryWidgetCmd procedure, "insert" widget command} -setup { entry .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test entry-3.42 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e update } -body { .e scan a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test entry-3.43 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e update } -body { .e scan a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test entry-3.44 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e update } -body { .e scan foobar 20 } -cleanup { destroy .e } -returnCodes error -result {bad scan option "foobar": must be mark or dragto} test entry-3.45 {EntryWidgetCmd procedure, "scan" widget command} -setup { entry .e pack .e update } -body { .e scan mark 20.1 } -cleanup { destroy .e } -returnCodes error -result {expected integer but got "20.1"} # This test is non-portable because character sizes vary. test entry-3.46 {EntryWidgetCmd procedure, "scan" widget command} -constraints { fonts } -setup { entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long string, in fact a " .e insert end "very very long string" .e scan mark 30 .e scan dragto 28 .e index @0 } -cleanup { destroy .e } -result {2} test entry-3.47 {EntryWidgetCmd procedure, "select" widget command} -setup { entry .e } -body { .e select } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection option ?index?"} test entry-3.48 {EntryWidgetCmd procedure, "select" widget command} -setup { entry .e } -body { .e select foo } -cleanup { destroy .e } -returnCodes error -result {bad selection option "foo": must be adjust, clear, from, present, range, or to} test entry-3.49 {EntryWidgetCmd procedure, "select clear" widget command} -setup { entry .e } -body { .e select clear gorp } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection clear"} test entry-3.50 {EntryWidgetCmd procedure, "select clear" widget command} -setup { entry .e } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test entry-3.50.1 {EntryWidgetCmd procedure, "select clear" widget command} -setup { entry .e pack .e update } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear catch {selection get} selection own } -cleanup { destroy .e } -result {.e} test entry-3.51 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e } -body { .e selection present foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection present"} test entry-3.52 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e selection present } -cleanup { destroy .e } -result {1} test entry-3.53 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e configure -exportselection false .e selection present } -cleanup { destroy .e } -result {1} test entry-3.54 {EntryWidgetCmd procedure, "selection present" widget command} -setup { entry .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e delete 0 end .e selection present } -cleanup { |
︙ | ︙ | |||
1340 1341 1342 1343 1344 1345 1346 | } -body { .e select to 2 3 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection to index"} test entry-3.65 {EntryWidgetCmd procedure, "xview" widget command} -setup { | | | | | | | | | | | | | | | | | | | | | | | 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 | } -body { .e select to 2 3 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection to index"} test entry-3.65 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 5 format {%.7f %.7f} {*}[.e xview] } -cleanup { destroy .e } -result {0.0537634 0.2688172} test entry-3.66 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview gorp } -cleanup { destroy .e } -returnCodes error -result {bad entry index "gorp"} test entry-3.67 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 .e icursor 10 .e xview insert format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.107527 0.322581} test entry-3.68 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview moveto foo bar } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview moveto fraction"} test entry-3.69 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview moveto foo } -cleanup { destroy .e } -returnCodes error -result {expected floating-point number but got "foo"} test entry-3.70 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto 0.5 format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.505376 0.720430} test entry-3.71 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview scroll 24 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview scroll number pages|units"} test entry-3.72 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll gorp units } -cleanup { destroy .e } -returnCodes error -result {expected integer but got "gorp"} test entry-3.73 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview moveto 0 .e xview scroll 1 pages format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.193548 0.408602} test entry-3.74 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto .9 update .e xview scroll -2 p format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.397849 0.612903} test entry-3.75 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll 2 units .e index @0 } -cleanup { destroy .e } -result {32} test entry-3.76 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll -1 units .e index @0 } -cleanup { destroy .e } -result {29} test entry-3.77 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll 23 foobars } -cleanup { destroy .e } -returnCodes error -result {bad argument "foobars": must be pages or units} test entry-3.78 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview eat 23 hamburgers } -cleanup { destroy .e } -returnCodes error -result {unknown option "eat": must be moveto or scroll} test entry-3.79 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 update .e xview -4 .e index @0 } -cleanup { destroy .e } -result {0} test entry-3.80 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 300 .e index @0 } -cleanup { destroy .e } -result {73} test entry-3.86 {EntryWidgetCmd procedure, "xview" widget command} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e insert 10 \u4e4e update # UTF |
︙ | ︙ | |||
1552 1553 1554 1555 1556 1557 1558 | .e xview moveto .12 lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test entry-3.82 {EntryWidgetCmd procedure} -setup { | | | 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 | .e xview moveto .12 lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test entry-3.82 {EntryWidgetCmd procedure} -setup { entry .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e gorp } -cleanup { destroy .e } -returnCodes error -result {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, index, insert, scan, selection, validate, or xview} |
︙ | ︙ | |||
1611 1612 1613 1614 1615 1616 1617 | trace variable x w override .e insert 0 "Some text" .e configure -textvariable x list $x [.e get] } -cleanup { destroy .e trace vdelete x w override | | | 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | trace variable x w override .e insert 0 "Some text" .e configure -textvariable x list $x [.e get] } -cleanup { destroy .e trace vdelete x w override unset x; } -result {12345 12345} test entry-5.5 {ConfigureEntry procedure} -setup { set x {} entry .e1 entry .e2 } -body { |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | .e1 configure -exportselection 1 lappend x [selection get] return $x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test entry-5.6 {ConfigureEntry procedure} -setup { | | | | | | | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 | .e1 configure -exportselection 1 lappend x [selection get] return $x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test entry-5.6 {ConfigureEntry procedure} -setup { entry .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test entry-5.6.1 {ConfigureEntry procedure} -setup { entry .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 catch {selection get} list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5} test entry-5.7 {ConfigureEntry procedure} -setup { entry .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll .e insert end "01234567890" update .e configure -width 5 format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 0.363636} test entry-5.8 {ConfigureEntry procedure} -constraints { fonts } -setup { entry .e -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -width 0 -font {Helvetica -12} .e insert end "0123" update .e configure -font {Helvetica -24} update |
︙ | ︙ | |||
1733 1734 1735 1736 1737 1738 1739 | } -result {} # No tests for DisplayEntry. test entry-6.1 {EntryComputeGeometry procedure} -constraints { fonts } -setup { | | | | | | | | 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | } -result {} # No tests for DisplayEntry. test entry-6.1 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -highlightthickness 3 .e insert end 012\t45 update list [.e index @61] [.e index @62] } -cleanup { destroy .e } -result {3 4} test entry-6.2 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -justify center -highlightthickness 3 .e insert end 012\t45 update list [.e index @96] [.e index @97] } -cleanup { destroy .e } -result {3 4} test entry-6.3 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 \ -justify right -highlightthickness 3 .e insert end 012\t45 update list [.e index @131] [.e index @132] } -cleanup { destroy .e } -result {3 4} test entry-6.4 {EntryComputeGeometry procedure} -setup { entry .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 6 .e index @0 } -cleanup { destroy .e } -result {6} test entry-6.5 {EntryComputeGeometry procedure} -setup { entry .e -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 7 .e index @0 } -cleanup { destroy .e } -result {6} test entry-6.6 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 10 .e insert end "01234\t67890" update .e xview 3 list [.e index @39] [.e index @40] } -cleanup { destroy .e } -result {5 6} |
︙ | ︙ | |||
1842 1843 1844 1845 1846 1847 1848 | } -result {116 39} test entry-6.9 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e } -body { | | | | 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | } -result {116 39} test entry-6.9 {EntryComputeGeometry procedure} -constraints { fonts } -setup { entry .e -highlightthickness 2 pack .e } -body { .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { destroy .e } -result {25 39} test entry-6.10 {EntryComputeGeometry procedure} -constraints { unix fonts } -setup { entry .e -highlightthickness 2 -font {Helvetica -12} pack .e } -body { .e configure -bd 1 -relief raised -width 0 -show . .e insert 0 12345 update |
︙ | ︙ | |||
1904 1905 1906 1907 1908 1909 1910 | list [.e index @80] [.e index @81] [.e index @115] [.e index @116] } -cleanup { destroy .e } -result {6 7 7 8} test entry-7.1 {InsertChars procedure} -setup { | | | | | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 | list [.e index @80] [.e index @81] [.e index @115] [.e index @116] } -cleanup { destroy .e } -result {6 7 7 8} test entry-7.1 {InsertChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e insert 2 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abXXXcde abXXXcde {0.000000 1.000000}} test entry-7.2 {InsertChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e insert 500 XXX update |
︙ | ︙ | |||
1989 1990 1991 1992 1993 1994 1995 | set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 6 2 5} test entry-7.7 {InsertChars procedure} -setup { | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > | > | | | | | | | | | | 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 | set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 6 2 5} test entry-7.7 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -xscrollcommand scroll .e insert 0 0123456789 .e icursor 4 .e insert 4 XXX .e index insert } -cleanup { destroy .e } -result {7} test entry-7.8 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789 .e icursor 4 .e insert 5 XXX .e index insert } -cleanup { destroy .e } -result {4} test entry-7.9 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 3 XXX .e index @0 } -cleanup { destroy .e } -result {7} test entry-7.10 {InsertChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 4 XXX .e index @0 } -cleanup { destroy .e } -result {4} test entry-7.11 {InsertChars procedure} -constraints { fonts } -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "xyzzy" update .e insert 2 00 winfo reqwidth .e } -cleanup { destroy .e } -result {59} test entry-8.1 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete 2 4 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abe abe {0.000000 1.000000}} test entry-8.2 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete -2 2 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {cde cde {0.000000 1.000000}} test entry-8.3 {DeleteChars procedure} -setup { unset -nocomplain contents entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete 3 1000 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abc abc {0.000000 1.000000}} test entry-8.4 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 3 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6 1 5} test entry-8.5 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 4 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5 1 4} test entry-8.6 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 2 1 5} test entry-8.7 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-8.8 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 4 3 8} test entry-8.9 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-8.10 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 5 8 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 5 5 8} test entry-8.11 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 8 10 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 8 4 8} test entry-8.12 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 4 update .e index insert } -cleanup { destroy .e } -result {1} test entry-8.13 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 5 update .e index insert } -cleanup { destroy .e } -result {1} test entry-8.14 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 4 6 update .e index insert } -cleanup { destroy .e } -result {4} test entry-8.15 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 4 update .e index @0 } -cleanup { destroy .e } -result {1} test entry-8.16 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 5 update .e index @0 } -cleanup { destroy .e } -result {1} test entry-8.17 {DeleteChars procedure} -setup { entry .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 4 6 update .e index @0 } -cleanup { destroy .e } -result {4} test entry-8.18 {DeleteChars procedure} -setup { entry .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "xyzzy" update .e delete 2 4 # To check that deletion actually happened we measure the new width # of the widget, based on the measuring width of the remaining text ("xyy") # in the widget. For that purpose we have to mirror the code in tkEntry.c # for computation of the reqwidth # note: XPAD corresponds to the hardcoded #define XPAD 1 set XPAD 1 set expected [expr { [font measure [.e cget -font] "xyy"] \ + 2 * ( [.e cget -borderwidth] + \ [.e cget -highlightthickness] + $XPAD ) } ] expr {[winfo reqwidth .e] == $expected} } -cleanup { destroy .e unset XPAD expected } -result {1} test entry-9.1 {EntryValueChanged procedure} -setup { unset -nocomplain x } -body { trace variable x w override entry .e -textvariable x -width 0 .e insert 0 foo list $x [.e get] } -cleanup { destroy .e trace vdelete x w override unset x } -result {12345 12345} test entry-10.1 {EntrySetValue procedure} -constraints fonts -body { set x abcde set y ab entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 pack .e .e configure -textvariable x .e configure -textvariable y update list [.e get] [winfo reqwidth .e] } -cleanup { destroy .e } -result {ab 24} test entry-10.2 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "a" .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-10.3 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefg" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 7} test entry-10.4 {EntrySetValue procedure, updating selection} -setup { unset -nocomplain x entry .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefghijklmn" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 10} test entry-10.5 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "abcdefg" update .e index @0 } -cleanup { destroy .e } -result {0} test entry-10.6 {EntrySetValue procedure, updating display position} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "1234567890123456789012" update .e index @0 } -cleanup { destroy .e } -result {10} test entry-10.7 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e update } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123" .e index insert } -cleanup { destroy .e } -result {3} test entry-10.8 {EntrySetValue procedure, updating insertion cursor} -setup { unset -nocomplain x entry .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123456" |
︙ | ︙ | |||
2476 2477 2478 2479 2480 2481 2482 | .e xview 4 update .e index end } -cleanup { destroy .e } -result {21} test entry-13.2 {GetEntryIndex procedure} -body { | | | 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 | .e xview 4 update .e index end } -cleanup { destroy .e } -result {21} test entry-13.2 {GetEntryIndex procedure} -body { entry .e .e index abogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "abogus"} test entry-13.3 {GetEntryIndex procedure} -setup { entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e |
︙ | ︙ | |||
2567 2568 2569 2570 2571 2572 2573 | test entry-13.10 {GetEntryIndex procedure} -constraints x11 -body { | | | | | | 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 | test entry-13.10 {GetEntryIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, entry widget's internal # selection range is reset. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test entry-13.11 {GetEntryIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sel.first } -cleanup { destroy .e } -result {1} test entry-13.12 {GetEntryIndex procedure} -constraints x11 -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} # why when string in .e index changed to not beginning with s, # it behaves differently? test entry-13.12.1 {GetEntryIndex procedure} -constraints unix -body { # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 |
︙ | ︙ | |||
2661 2662 2663 2664 2665 2666 2667 | .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "sbogus"} test entry-13.14 {GetEntryIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, entry widget remembers | | > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < | | | | 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 | .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {bad entry index "sbogus"} test entry-13.14 {GetEntryIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e selection get } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test entry-13.14.1 {GetEntryIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, entry widget remembers # last selected range. When selection ownership is restored to # entry, the old range will be rehighlighted. # Previous settings: entry .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sbogus } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test entry-13.15 {GetEntryIndex procedure} -body { entry .e selection clear .e .e index @xyz } -cleanup { destroy .e } -returnCodes error -result {bad entry index "@xyz"} test entry-13.16 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @4 } -cleanup { destroy .e |
︙ | ︙ | |||
2743 2744 2745 2746 2747 2748 2749 | update .e index @12 } -cleanup { destroy .e } -result {5} test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ | | | 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 | update .e index @12 } -cleanup { destroy .e } -result {5} test entry-13.19 {GetEntryIndex procedure} -constraints fonts -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @[expr {[winfo width .e] - 6}] } -cleanup { destroy .e |
︙ | ︙ | |||
2775 2776 2777 2778 2779 2780 2781 | .e xview 4 update .e index @1000 } -cleanup { destroy .e } -result {9} test entry-13.22 {GetEntryIndex procedure} -setup { | | | | | | 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 | .e xview 4 update .e index @1000 } -cleanup { destroy .e } -result {9} test entry-13.22 {GetEntryIndex procedure} -setup { entry .e pack .e update } -body { .e index 1xyz } -cleanup { destroy .e } -returnCodes error -result {bad entry index "1xyz"} test entry-13.23 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index -10 } -cleanup { destroy .e } -result {0} test entry-13.24 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index 12 } -cleanup { destroy .e } -result {12} test entry-13.25 {GetEntryIndex procedure} -body { entry .e -width 5 -relief sunken -highlightthickness 2 -bd 2\ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index 49 } -cleanup { destroy .e |
︙ | ︙ | |||
2856 2857 2858 2859 2860 2861 2862 | test entry-14.3 {EntryFetchSelection procedure} -setup { set x {} for {set i 1} {$i <= 500} {incr i} { append x "This is line $i, out of 500\n" } } -body { entry .e | | | 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 | test entry-14.3 {EntryFetchSelection procedure} -setup { set x {} for {set i 1} {$i <= 500} {incr i} { append x "This is line $i, out of 500\n" } } -body { entry .e .e insert end $x .e select from 0 .e select to end string compare [selection get] $x } -cleanup { destroy .e } -result {0} |
︙ | ︙ | |||
2883 2884 2885 2886 2887 2888 2889 | } -result {Text Text} # is scrollcommand needed here?? test entry-16.1 {EntryVisibleRange procedure} -constraints fonts -body { entry .e -width 10 -font {Helvetica -12} pack .e update | | | 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 | } -result {Text Text} # is scrollcommand needed here?? test entry-16.1 {EntryVisibleRange procedure} -constraints fonts -body { entry .e -width 10 -font {Helvetica -12} pack .e update .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 0.827586} test entry-16.2 {EntryVisibleRange procedure} -constraints { unix fonts } -body { |
︙ | ︙ | |||
2976 2977 2978 2979 2980 2981 2982 | } -body { set l [interp hidden] interp hide {} .e destroy .e set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} | | | 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 | } -body { set l [interp hidden] interp hide {} .e destroy .e set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} } -result {1} ## ## Entry widget VALIDATION tests ## # The validation tests build each one upon the previous, so cascading # failures aren't good # |
︙ | ︙ | |||
3330 3331 3332 3333 3334 3335 3336 | entry .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings | | | 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 | entry .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] .e validate list [.e cget -validate] [.e get] $::vVals } -cleanup { destroy .e } -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}} |
︙ | ︙ | |||
3355 3356 3357 3358 3359 3360 3361 | -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings | | | 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 | -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals } -cleanup { destroy .e } -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}} ## |
︙ | ︙ | |||
3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 | destroy .e } -body { catch {entry .e -textvariable thisnsdoesntexist::myvar} result1 set result1 } -cleanup { destroy .e } -result {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist} # Gathered comments about lacks # XXX Still need to write tests for EntryBlinkProc, EntryFocusProc, # and EntryTextVarProc. # No tests for DisplayEntry. # XXX Still need to write tests for EntryScanTo and EntrySelectTo. # No tests for EventuallyRedraw | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 | destroy .e } -body { catch {entry .e -textvariable thisnsdoesntexist::myvar} result1 set result1 } -cleanup { destroy .e } -result {can't trace "thisnsdoesntexist::myvar": parent namespace doesn't exist} test entry-25.1 {Bug [5d991b822e]} { # Want this not to segfault, or write to variable with empty name set var INIT entry .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b info exists {} } 0 test entry-25.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT entry .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} # Gathered comments about lacks # XXX Still need to write tests for EntryBlinkProc, EntryFocusProc, # and EntryTextVarProc. # No tests for DisplayEntry. # XXX Still need to write tests for EntryScanTo and EntrySelectTo. # No tests for EventuallyRedraw |
︙ | ︙ |
Changes to tests/event.test.
︙ | ︙ | |||
353 354 355 356 357 358 359 | # Click down to set the insert cursor position event generate $e <Enter> event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] | | | 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | # Click down to set the insert cursor position event generate $e <Enter> event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] # Now drag until selend is highlighted, then click up set current $anchor while {[$e compare $current <= $selend]} { foreach {current_x current_y} [_text_ind_to_x_y $e $current] break event generate $e <B1-Motion> -x $current_x -y $current_y set current [$e index [list $current + 1 char]] |
︙ | ︙ | |||
420 421 422 423 424 425 426 | # Click down to set the insert cursor position event generate $e <Enter> event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] | | | 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 | # Click down to set the insert cursor position event generate $e <Enter> event generate $e <ButtonPress-1> -x $anchor_x -y $anchor_y # Save the position of the insert cursor lappend result [$e index insert] # Now drag until selend is highlighted, then click up set current $anchor while {$current <= $selend} { foreach {current_x current_y} [_text_ind_to_x_y $e $current] break event generate $e <B1-Motion> -x $current_x -y $current_y incr current |
︙ | ︙ | |||
606 607 608 609 610 611 612 | lappend result [$e index insert] return $result } -cleanup { deleteWindows } -result {select 11 7 select 4 { select} {Word select} 2} | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | lappend result [$e index insert] return $result } -cleanup { deleteWindows } -result {select 11 7 select 4 { select} {Word select} 2} test event-5.1(triple-click-drag) {Triple click and drag across lines in a text widget, this should extend the selection to the new line} -setup { deleteWindows } -body { set t [toplevel .t] set e [text $t.e] pack $e tkwait visibility $e |
︙ | ︙ | |||
791 792 793 794 795 796 797 | _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 set result [list] lappend result [$e index insert] lappend result [_get_selection $e] | | | 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | _pause 50 event generate $e <ButtonRelease-1> -x $left_x -y $left_y _pause 50 set result [list] lappend result [$e index insert] lappend result [_get_selection $e] # Clear selection by clicking at 0,0 event generate $e <ButtonPress-1> -x 0 -y 0 _pause 50 event generate $e <ButtonRelease-1> -x 0 -y 0 _pause 50 |
︙ | ︙ | |||
819 820 821 822 823 824 825 | return $result } -cleanup { deleteWindows } -result {4 A 4 A} test event-8 {event generate with keysyms corresponding to | | | 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | return $result } -cleanup { deleteWindows } -result {4 A 4 A} test event-8 {event generate with keysyms corresponding to multi-byte virtual keycodes - bug e36963bfe8df9f5e528134707a91b9c0051de723} -constraints nonPortable -setup { deleteWindows set res [list ] } -body { set t [toplevel .t] set e [entry $t.e] pack $e |
︙ | ︙ |
Changes to tests/filebox.test.
︙ | ︙ | |||
163 164 165 166 167 168 169 | test filebox-1.1.2-$mode "tk_getOpenFile command" -constraints aqua -body { tk_getOpenFile -foo } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,aqua) catch {tk_getOpenFile -foo 1} msg regsub -all , $msg "" options regsub \"-foo\" $options "" options | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | test filebox-1.1.2-$mode "tk_getOpenFile command" -constraints aqua -body { tk_getOpenFile -foo } -returnCodes error -result $unknownOptionsMsg(tk_getOpenFile,aqua) catch {tk_getOpenFile -foo 1} msg regsub -all , $msg "" options regsub \"-foo\" $options "" options foreach option $options { if {[string index $option 0] eq "-"} { test filebox-1.2-$mode$option "tk_getOpenFile command" -body { tk_getOpenFile $option } -returnCodes error -result "value for \"$option\" missing" } } |
︙ | ︙ |
Changes to tests/focus.test.
︙ | ︙ | |||
100 101 102 103 104 105 106 | test focus-1.6 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp } -returnCodes error -result {bad window path name ".gorp"} test focus-1.7 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp a } -returnCodes error -result {bad option ".gorp": must be -displayof, -force, or -lastfor} test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | test focus-1.6 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp } -returnCodes error -result {bad window path name ".gorp"} test focus-1.7 {Tk_FocusCmd procedure} -constraints unix -body { focus .gorp a } -returnCodes error -result {bad option ".gorp": must be -displayof, -force, or -lastfor} test focus-1.8 {Tk_FocusCmd procedure, focussing on dead window} -constraints { unix } -setup { destroy .t2 } -body { focusClear toplevel .t2 wm geom .t2 +10+10 frame .t2.f -width 200 -height 100 -bd 2 -relief raised |
︙ | ︙ | |||
126 127 128 129 130 131 132 | lappend x [focus] destroy .t2 return $x } -cleanup { destroy .t2 } -result {.t2.f2 .t2 .t2} test focus-1.9 {Tk_FocusCmd procedure, -displayof option} -constraints { | | | | | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | lappend x [focus] destroy .t2 return $x } -cleanup { destroy .t2 } -result {.t2.f2 .t2 .t2} test focus-1.9 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { focus -displayof } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.10 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { focus -displayof a b } -returnCodes error -result {wrong # args: should be "focus -displayof window"} test focus-1.11 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { focus -displayof .lousy } -returnCodes error -result {bad window path name ".lousy"} test focus-1.12 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { focusClear focus .t focus -displayof .t.b3 } -result {} test focus-1.13 {Tk_FocusCmd procedure, -displayof option} -constraints { unix } -body { focusClear focus -force .t focus -displayof .t.b3 } -result {.t} test focus-1.14 {Tk_FocusCmd procedure, -displayof option} -constraints { unix altDisplay |
︙ | ︙ | |||
181 182 183 184 185 186 187 | focusClear focus .t.b1 set x [list [focus]] focus -force .t.b1 lappend x [focus] } -result {{} .t.b1} test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} -constraints { | | | | | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | focusClear focus .t.b1 set x [list [focus]] focus -force .t.b1 lappend x [focus] } -result {{} .t.b1} test focus-1.20 {Tk_FocusCmd procedure, -lastfor option} -constraints { unix } -body { focus -lastfor } -returnCodes error -result {wrong # args: should be "focus -lastfor window"} test focus-1.21 {Tk_FocusCmd procedure, -lastfor option} -constraints { unix } -body { focus -lastfor 1 2 } -returnCodes error -result {wrong # args: should be "focus -lastfor window"} test focus-1.22 {Tk_FocusCmd procedure, -lastfor option} -constraints { unix } -body { focus -lastfor who_knows? } -returnCodes error -result {bad window path name "who_knows?"} test focus-1.23 {Tk_FocusCmd procedure, -lastfor option} -constraints { unix } -body { focusClear focusSetup focus .b focus .t.b1 list [focus -lastfor .] [focus -lastfor .t.b3] } -result {.b .t.b1} test focus-1.24 {Tk_FocusCmd procedure, -lastfor option} -constraints { unix } -body { focusClear focusSetup update focus -lastfor .t.b2 } -result {.t} test focus-1.25 {Tk_FocusCmd procedure} -constraints unix -body { |
︙ | ︙ |
Changes to tests/font.test.
︙ | ︙ | |||
105 106 107 108 109 110 111 | test font-4.1 {font command: actual: arguments} -body { # (skip < 0) font actual xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-4.2 {font command: actual: arguments} -body { | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | test font-4.1 {font command: actual: arguments} -body { # (skip < 0) font actual xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-4.2 {font command: actual: arguments} -body { # (objc < 3) font actual } -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"} test font-4.3 {font command: actual: arguments} -body { # (objc - skip > 4) when skip == 0 font actual xyz abc def } -returnCodes error -result {wrong # args: should be "font actual font ?-displayof window? ?option? ?--? ?char?"} test font-4.4 {font command: actual: displayof specified, so skip to next} -body { |
︙ | ︙ | |||
137 138 139 140 141 142 143 | test font-4.9 {font command: actual} -constraints {unix noExceed} -body { # (objc > 3) so objPtr = objv[3 + skip] string tolower [font actual {-family times} -family] } -result {times} test font-4.10 {font command: actual} -constraints win -body { # (objc > 3) so objPtr = objv[3 + skip] font actual {-family times} -family | | | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | test font-4.9 {font command: actual} -constraints {unix noExceed} -body { # (objc > 3) so objPtr = objv[3 + skip] string tolower [font actual {-family times} -family] } -result {times} test font-4.10 {font command: actual} -constraints win -body { # (objc > 3) so objPtr = objv[3 + skip] font actual {-family times} -family } -result {times} test font-4.11 {font command: bad option} -body { font actual xyz -style } -returnCodes error -result {bad option "-style": must be -family, -size, -weight, -slant, -underline, or -overstrike} test font-4.12 {font command: actual} -body { font actual {-family times} -- \ud800 } -match glob -result {*} test font-4.13 {font command: actual} -body { font actual {-family times} -- \udc00 } -match glob -result {*} test font-4.14 {font command: actual} -constraints win -body { font actual {-family times} -family -- \ud800\udc00 } -result {times} test font-4.15 {font command: actual} -body { font actual {-family times} -- \udc00\ud800 } -returnCodes 1 -match glob -result {expected a single character but got "*"} test font-5.1 {font command: configure} -body { # (objc < 3) font configure } -returnCodes error -result {wrong # args: should be "font configure fontname ?-option value ...?"} test font-5.2 {font command: configure: non-existent font} -body { # (namedHashPtr == NULL) font configure xyz } -returnCodes error -result {named font "xyz" doesn't exist} test font-5.3 {font command: configure: "deleted" font} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update } -body { # (nfPtr->deletePending != 0) font create xyz .t.f configure -font xyz font delete xyz font configure xyz } -cleanup { destroy .t.f } -returnCodes error -result {named font "xyz" doesn't exist} |
︙ | ︙ | |||
259 260 261 262 263 264 265 | font configure font2 -family } -cleanup { font delete font1 font2 font3 } -result {four} test font-6.5 {font command: create: bad option creating new font} -setup { catch {font delete xyz} } -body { | | | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | font configure font2 -family } -cleanup { font delete font1 font2 font3 } -result {four} test font-6.5 {font command: create: bad option creating new font} -setup { catch {font delete xyz} } -body { # name was specified so skip = 3 font create xyz -xyz times } -returnCodes error -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike} test font-6.6 {font command: create: bad option creating new font} -setup { clearnondefaultfonts } -body { # name was not specified so skip = 2 font create -xyz times } -returnCodes error -result {bad option "-xyz": must be -family, -size, -weight, -slant, -underline, or -overstrike} test font-6.7 {font command: create: already exists} -setup { catch {font delete xyz} } -body { # (CreateNamedFont() != TCL_OK) font create xyz font create xyz } -cleanup { font delete xyz } -returnCodes error -result {named font "xyz" already exists} test font-7.1 {font command: delete: arguments} -body { # (objc < 3) font delete } -returnCodes error -result {wrong # args: should be "font delete fontname ?fontname ...?"} test font-7.2 {font command: delete: loop test} -setup { clearnondefaultfonts set x {} } -body { # for (i = 2; i < objc; i++) font create a -underline 1 font create b -underline 1 font create c -underline 1 font create d -underline 1 font create e -underline 1 lappend x [lsort [getnondefaultfonts]] font delete a e c b |
︙ | ︙ | |||
317 318 319 320 321 322 323 | lappend x [lsort [getnondefaultfonts]] } -cleanup { clearnondefaultfonts } -result {{a b c d e} {b c e}} test font-7.4 {font command: delete: non-existent} -setup { catch {font delete xyz} } -body { | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | lappend x [lsort [getnondefaultfonts]] } -cleanup { clearnondefaultfonts } -result {{a b c d e} {b c e}} test font-7.4 {font command: delete: non-existent} -setup { catch {font delete xyz} } -body { # (namedHashPtr == NULL) font delete xyz } -returnCodes error -result {named font "xyz" doesn't exist} test font-7.5 {font command: delete: mark for later deletion} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update |
︙ | ︙ | |||
384 385 386 387 388 389 390 | test font-9.1 {font command: measure: arguments} -body { # (skip < 0) expr {[font measure xyz -displayof] > 0} } -returnCodes ok -result 1 test font-9.2 {font command: measure: arguments} -body { | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | test font-9.1 {font command: measure: arguments} -body { # (skip < 0) expr {[font measure xyz -displayof] > 0} } -returnCodes ok -result 1 test font-9.2 {font command: measure: arguments} -body { # (objc - skip != 4) font measure } -returnCodes error -result {wrong # args: should be "font measure font ?-displayof window? text"} test font-9.3 {font command: measure: arguments} -body { # (objc - skip != 4) font measure xyz abc def } -returnCodes error -result {wrong # args: should be "font measure font ?-displayof window? text"} test font-9.4 {font command: measure: arguments} -constraints noExceed -body { # (tkfont == NULL) font measure "\{xyz" abc } -returnCodes error -result "font \"{xyz\" doesn't exist" test font-9.5 {font command: measure} -body { |
︙ | ︙ | |||
418 419 420 421 422 423 424 | font metrics xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-10.2 {font command: metrics: arguments} -body { # (skip < 0) font metrics xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-10.3 {font command: metrics: arguments} -body { | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | font metrics xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-10.2 {font command: metrics: arguments} -body { # (skip < 0) font metrics xyz -displayof } -returnCodes error -result {value for "-displayof" missing} test font-10.3 {font command: metrics: arguments} -body { # (objc < 3) font metrics } -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"} test font-10.4 {font command: metrics: arguments} -body { # (objc - skip) > 4) when skip == 0 font metrics xyz abc def } -returnCodes error -result {wrong # args: should be "font metrics font ?-displayof window? ?option?"} test font-10.5 {font command: metrics: arguments} -body { |
︙ | ︙ | |||
581 582 583 584 585 586 587 | test font-14.1 {Tk_GetFont procedure} -body { } -result {} test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { | | | | | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | test font-14.1 {Tk_GetFont procedure} -body { } -result {} test font-15.1 {Tk_AllocFontFromObj - converting internal reps} -constraints { testfont } -setup { destroy .b1 .b2 } -body { set x {Times 16} lindex $x 0 button .b1 -font $x lindex $x 0 testfont counts {Times 16} } -cleanup { destroy .b1 .b2 } -result {{1 0}} test font-15.2 {Tk_AllocFontFromObj - discard stale font} -constraints { testfont } -setup { destroy .b1 .b2 set result {} } -body { set x {Times 16} button .b1 -font $x destroy .b1 lappend result [testfont counts {Times 16}] button .b2 -font $x lappend result [testfont counts {Times 16}] } -cleanup { destroy .b2 } -result {{} {{1 1}}} test font-15.3 {Tk_AllocFontFromObj - reuse existing font} -constraints { testfont } -setup { destroy .b1 .b2 set result {} } -body { set x {Times 16} button .b1 -font $x lappend result [testfont counts {Times 16}] |
︙ | ︙ | |||
640 641 642 643 644 645 646 | } -result {-family} test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update } -body { | | | | | | | | | | 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | } -result {-family} test font-15.5 {Tk_AllocFontFromObj procedure: get named font} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update } -body { # (namedHashPtr != NULL) font create xyz .t.f config -font xyz } -cleanup { destroy .t.f font delete xyz } -result {} test font-15.6 {Tk_AllocFontFromObj procedure: not a named font} -setup { destroy .t.f pack [label .t.f] update } -body { # not (namedHashPtr != NULL) .t.f config -font {times 20} } -cleanup { destroy .t.f } -result {-family} -result {} test font-15.7 {Tk_AllocFontFromObj procedure: get native font} -constraints { unix } -setup { destroy .t.f pack [label .t.f] update } -body { # not (fontPtr == NULL) .t.f config -font fixed } -result {} test font-15.8 {Tk_AllocFontFromObj procedure: get native font} -constraints { win } -setup { destroy .t.f clearnondefaultfonts pack [label .t.f] update } -body { # not (fontPtr == NULL) .t.f config -font oemfixed } -cleanup { destroy .t.f } -result {} test font-15.9 {Tk_AllocFontFromObj procedure: get attribute font} -setup { destroy .t.f pack [label .t.f] update } -body { # (fontPtr == NULL) .t.f config -font {xxx yyy zzz} } -cleanup { destroy .t.f } -returnCodes error -result {expected integer but got "yyy"} test font-15.10 {Tk_AllocFontFromObj procedure: no match} -constraints noExceed -body { # (ParseFontNameObj() != TCL_OK) font actual "\{xyz" |
︙ | ︙ | |||
720 721 722 723 724 725 726 | update } -body { # (fontPtr->underlineHeight == 0) because size was < 10 .t.f config -text "underline" -font "times -8 underline" update } -cleanup { destroy .t.f | | | | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 | update } -body { # (fontPtr->underlineHeight == 0) because size was < 10 .t.f config -text "underline" -font "times -8 underline" update } -cleanup { destroy .t.f } -result {} test font-16.1 {Tk_NameOfFont procedure} -setup { destroy .t.f pack [label .t.f] update } -body { .t.f config -font -family\ fixed .t.f cget -font } -cleanup { destroy .t.f } -result {-family fixed} test font-17.1 {Tk_FreeFontFromObj - reference counts} -constraints { testfont } -setup { destroy .b1 .b2 .b3 set result {} } -body { set x {Courier 12} button .b1 -font $x button .b3 -font $x |
︙ | ︙ | |||
781 782 783 784 785 786 787 | } -result {-family fixed} test font-17.4 {Tk_FreeFont procedure: named font} -setup { destroy .t.f clearnondefaultfonts pack [label .t.f] update } -body { | | | | | 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | } -result {-family fixed} test font-17.4 {Tk_FreeFont procedure: named font} -setup { destroy .t.f clearnondefaultfonts pack [label .t.f] update } -body { # (fontPtr->namedHashPtr != NULL) font create xyz .t.f config -font xyz destroy .t.f getnondefaultfonts } -result {xyz} test font-17.5 {Tk_FreeFont procedure: named font} -setup { destroy .t.f catch {font delete xyz} pack [label .t.f] update } -body { # not (fontPtr->refCount == 0) font create xyz -underline 1 .t.f config -font xyz font delete xyz set x [font actual xyz -underline] destroy .t.f list [font actual xyz -underline] $x } -result {0 1} test font-17.6 {Tk_FreeFont procedure: named font not deleted yet} -setup { destroy .t.f .t.b catch {font delete xyz} pack [label .t.f] update } -body { font create xyz .t.f config -font xyz button .t.b -font xyz font delete xyz set x [font actual xyz] destroy .t.b list [lindex [font actual xyz] 0] [lindex $x 0] } -cleanup { |
︙ | ︙ | |||
866 867 868 869 870 871 872 | destroy .t.w1 .t.w2 } -result {} # Procedure used in 21.* tests proc psfontname {name} { destroy .t.c | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 | destroy .t.w1 .t.w2 } -result {} # Procedure used in 21.* tests proc psfontname {name} { destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update set a [.t.c itemcget text -font] .t.c itemconfig text -text "We need text" -font $name set post [.t.c postscript] .t.c itemconfig text -font $a |
︙ | ︙ | |||
892 893 894 895 896 897 898 | if {[string match *avant*garde $x]} { psfontname "{itc avant garde} 10" } else { set x {AvantGarde-Book} } } -result {AvantGarde-Book} test font-21.2 {Tk_PostscriptFontName procedure: native} -constraints { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 | if {[string match *avant*garde $x]} { psfontname "{itc avant garde} 10" } else { set x {AvantGarde-Book} } } -result {AvantGarde-Book} test font-21.2 {Tk_PostscriptFontName procedure: native} -constraints { win } -body { psfontname "arial 10" } -result {Helvetica} test font-21.3 {Tk_PostscriptFontName procedure: native} -constraints { win } -body { psfontname "{times new roman} 10" } -result {Times-Roman} test font-21.4 {Tk_PostscriptFontName procedure: native} -constraints { win } -body { psfontname "{courier new} 10" } -result {Courier} test font-21.5 {Tk_PostscriptFontName procedure: spaces} -constraints { unix } -body { set x [font actual {{lucida bright} 10} -family] if {[string match lucida*bright $x]} { psfontname "{lucida bright} 10" } else { set x {LucidaBright} } } -result {LucidaBright} test font-21.6 {Tk_PostscriptFontName procedure: spaces} -constraints { x11 } -body { psfontname "{new century schoolbook} 10" } -result {NewCenturySchlbk-Roman} test font-21.7 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {avantgarde 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "avantgarde"} { set x [psfontname avantgarde 12 roman normal] } else { set x AvantGarde-Book } } -result {AvantGarde-Book} test font-21.8 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {avantgarde 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "avantgarde"} { set x [psfontname avantgarde 12 roman normal] } else { set x AvantGarde-Demi } } -result {AvantGarde-Demi} test font-21.9 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {avantgarde 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "avantgarde"} { set x [psfontname avantgarde 12 roman normal] } else { set x AvantGarde-BookOblique } } -result {AvantGarde-BookOblique} test font-21.10 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {avantgarde 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "avantgarde"} { set x [psfontname avantgarde 12 roman normal] } else { set x AvantGarde-DemiOblique } } -result {AvantGarde-DemiOblique} test font-21.11 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {bookman 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "bookman"} { set x [psfontname avantgarde 12 roman normal] } else { set x Bookman-Light } } -result {Bookman-Light} test font-21.12 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {bookman 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "bookman"} { set x [psfontname avantgarde 12 roman normal] } else { set x Bookman-Demi } } -result {Bookman-Demi} test font-21.13 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {bookman 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "bookman"} { set x [psfontname avantgarde 12 roman normal] } else { set x Bookman-LightItalic } } -result {Bookman-LightItalic} test font-21.14 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {bookman 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "bookman"} { set x [psfontname avantgarde 12 roman normal] } else { set x Bookman-DemiItalic } } -result {Bookman-DemiItalic} test font-21.15 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {courier 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "courier"} { set x [psfontname avantgarde 12 roman normal] } else { set x Courier } } -result {Courier} test font-21.16 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {courier 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "courier"} { set x [psfontname avantgarde 12 roman normal] } else { set x Courier-Bold } } -result {Courier-Bold} test font-21.17 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {courier 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "courier"} { set x [psfontname avantgarde 12 roman normal] } else { set x Courier-Oblique } } -result {Courier-Oblique} test font-21.18 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {courier 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "courier"} { set x [psfontname avantgarde 12 roman normal] } else { set x Courier-BoldOblique } } -result {Courier-BoldOblique} test font-21.19 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {helvetica 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "helvetica"} { set x [psfontname avantgarde 12 roman normal] } else { set x Helvetica } } -result {Helvetica} test font-21.20 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {helvetica 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "helvetica"} { set x [psfontname avantgarde 12 roman normal] } else { set x Helvetica-Bold } } -result {Helvetica-Bold} test font-21.21 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {helvetica 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "helvetica"} { set x [psfontname avantgarde 12 roman normal] } else { set x Helvetica-Oblique } } -result {Helvetica-Oblique} test font-21.22 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {helvetica 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "helvetica"} { set x [psfontname avantgarde 12 roman normal] } else { set x Helvetica-BoldOblique } } -result {Helvetica-BoldOblique} test font-21.23 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {{new century schoolbook} 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "new century schoolbook"} { set x [psfontname avantgarde 12 roman normal] } else { set x NewCenturySchlbk-Roman } } -result {NewCenturySchlbk-Roman} test font-21.24 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {{new century schoolbook} 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "new century schoolbook"} { set x [psfontname avantgarde 12 roman normal] } else { set x NewCenturySchlbk-Bold } } -result {NewCenturySchlbk-Bold} test font-21.25 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {{new century schoolbook} 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "new century schoolbook"} { set x [psfontname avantgarde 12 roman normal] } else { set x NewCenturySchlbk-Italic } } -result {NewCenturySchlbk-Italic} test font-21.26 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {{new century schoolbook} 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "new century schoolbook"} { set x [psfontname avantgarde 12 roman normal] } else { set x NewCenturySchlbk-BoldItalic } } -result {NewCenturySchlbk-BoldItalic} test font-21.27 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {palatino 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "palatino"} { set x [psfontname avantgarde 12 roman normal] } else { set x Palatino-Roman } } -result {Palatino-Roman} test font-21.28 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {palatino 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "palatino"} { set x [psfontname avantgarde 12 roman normal] } else { set x Palatino-Bold } } -result {Palatino-Bold} test font-21.29 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {palatino 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "palatino"} { set x [psfontname avantgarde 12 roman normal] } else { set x Palatino-Italic } } -result {Palatino-Italic} test font-21.30 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {palatino 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "palatino"} { set x [psfontname avantgarde 12 roman normal] } else { set x Palatino-BoldItalic } } -result {Palatino-BoldItalic} test font-21.31 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {symbol 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "symbol"} { set x [psfontname avantgarde 12 roman normal] } else { set x Symbol } } -result {Symbol} test font-21.32 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {symbol 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "symbol"} { set x [psfontname avantgarde 12 roman normal] } else { set x Symbol } } -result {Symbol} test font-21.33 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {symbol 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "symbol"} { set x [psfontname avantgarde 12 roman normal] } else { set x Symbol } } -result {Symbol} test font-21.34 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {symbol 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "symbol"} { set x [psfontname avantgarde 12 roman normal] } else { set x Symbol } } -result {Symbol} test font-21.35 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {times 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "times"} { set x [psfontname avantgarde 12 roman normal] } else { set x Times-Roman } } -result {Times-Roman} test font-21.36 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {times 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "times"} { set x [psfontname avantgarde 12 roman normal] } else { set x Times-Bold } } -result {Times-Bold} test font-21.37 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {times 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "times"} { set x [psfontname avantgarde 12 roman normal] } else { set x Times-Italic } } -result {Times-Italic} test font-21.38 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {times 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "times"} { set x [psfontname avantgarde 12 roman normal] } else { set x Times-BoldItalic } } -result {Times-BoldItalic} test font-21.39 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfchancery 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "zapfchancery"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfChancery-MediumItalic } } -result {ZapfChancery-MediumItalic} test font-21.40 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfchancery 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "zapfchancery"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfChancery-MediumItalic } } -result {ZapfChancery-MediumItalic} test font-21.41 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfchancery 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "zapfchancery"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfChancery-MediumItalic } } -result {ZapfChancery-MediumItalic} test font-21.42 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfchancery 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "zapfchancery"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfChancery-MediumItalic } } -result {ZapfChancery-MediumItalic} test font-21.43 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfdingbats 12 roman normal} if {[font actual {avantgarde 12 roman normal} -family] == "zapfdingbats"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfDingbats } } -result {ZapfDingbats} test font-21.44 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfdingbats 12 roman bold} if {[font actual {avantgarde 12 roman normal} -family] == "zapfdingbats"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfDingbats } } -result {ZapfDingbats} test font-21.45 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfdingbats 12 italic normal} if {[font actual {avantgarde 12 roman normal} -family] == "zapfdingbats"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfDingbats } } -result {ZapfDingbats} test font-21.46 {Tk_PostscriptFontName procedure: exhaustive} -constraints { unix } -body { set name {zapfdingbats 12 italic bold} if {[font actual {avantgarde 12 roman normal} -family] == "zapfdingbats"} { set x [psfontname avantgarde 12 roman normal] } else { set x ZapfDingbats } |
︙ | ︙ | |||
1439 1440 1441 1442 1443 1444 1445 | win } -body { set x [psfontname {{times new roman} 12 italic bold}] } -result {Times-BoldItalic} test font-22.1 {Tk_TextWidth procedure} -setup { | | | 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 | win } -body { set x [psfontname {{times new roman} 12 italic bold}] } -result {Times-BoldItalic} test font-22.1 {Tk_TextWidth procedure} -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font "Courier -12" pack .t.l set ax [winfo reqwidth .t.l] expr {[font measure [.t.l cget -font] "000"] eq $ax*3} } -cleanup { |
︙ | ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | update } -cleanup { destroy .t.t } -result {} # Data used in 24.* tests | | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 | update } -cleanup { destroy .t.t } -result {} # Data used in 24.* tests destroy .t.l label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font "Courier -12" pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] test font-24.1 {Tk_ComputeTextLayout: empty string} -body { |
︙ | ︙ | |||
1590 1591 1592 1593 1594 1595 1596 | lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "0000\n" update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -result {1 1 1 1} | | | | 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | lappend x [expr {[winfo reqheight .t.l] eq $ay}] .t.l config -text "0000\n" update lappend x [expr {[winfo reqwidth .t.l] eq [expr {$ax * 4}]}] lappend x [expr {[winfo reqheight .t.l] eq [expr {$ay * 2}]}] return $x } -result {1 1 1 1} destroy .t.l test font-24.15 {Tk_ComputeTextLayout: justification} -setup { set x {} destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update } -body { csetup "000\n00000" .t.c itemconfig text -just left lappend x [.t.c index text @[expr $ax*2],0] |
︙ | ︙ | |||
1624 1625 1626 1627 1628 1629 1630 | update } -body { .t.f config -text foo .t.f config -text boo } -cleanup { destroy .t.f } -result {} | | | | 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 | update } -body { .t.f config -text foo .t.f config -text boo } -cleanup { destroy .t.f } -result {} # Canvas created for tests: 26.* destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update test font-26.1 {Tk_DrawTextLayout procedure: auto-detect last char} -setup { destroy .t.f pack [label .t.f] update |
︙ | ︙ | |||
1686 1687 1688 1689 1690 1691 1692 | } -result {} destroy .t.f # Canvas created for tests: 28.* destroy .t.c | | | 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 | } -result {} destroy .t.f # Canvas created for tests: 28.* destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update test font-28.1 {Tk_PointToChar procedure: above all lines} -body { csetup "000" .t.c index text @-1,0 } -result {0} |
︙ | ︙ | |||
1778 1779 1780 1781 1782 1783 1784 | } -result {} destroy .t.f # Canvas created for tests: 30.* destroy .t.c | | | 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 | } -result {} destroy .t.f # Canvas created for tests: 30.* destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update test font-30.1 {Tk_DistanceToTextLayout procedure: loop once} -body { csetup "000\n000\n000" .t.c bind all <Enter> {lappend x [.t.c index current @%x,%y]} set x {} |
︙ | ︙ | |||
1921 1922 1923 1924 1925 1926 1927 | bind all <Enter> {} } -result {1} destroy .t.c # Canvas created for tests 31.* destroy .t.c | | | 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 | bind all <Enter> {} } -result {1} destroy .t.c # Canvas created for tests 31.* destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update test font-31.1 {Tk_IntersectTextLayout procedure: loop once} -body { csetup "000\n000\n000" .t.c find overlapping 0 0 0 0 } -result [.t.c find withtag text] |
︙ | ︙ | |||
1967 1968 1969 1970 1971 1972 1973 | .t.c find overlapping 5 -7 7 -5 } -result {1} destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { destroy .t.c | | | | 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 | .t.c find overlapping 5 -7 7 -5 } -result {1} destroy .t.c test font-32.1 {Tk_TextLayoutToPostscript: ensure buffer doesn't overflow} -setup { destroy .t.c canvas .t.c -closeenough 0 .t.c create text 0 0 -tags text -anchor nw -just left -font "Courier -12" pack .t.c update } -body { # If there were a whole bunch of returns or tabs in a row, then the # temporary buffer could overflow and write on the stack. csetup "qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm\n" .t.c itemconfig text -width 800 .t.c insert text end "qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm\n" .t.c insert text end "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" .t.c insert text end "end" set x [.t.c postscript] set i [string first "(qwerty" $x] string range $x $i [expr {$i + 278}] } -cleanup { destroy .t.c } -result {(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [(qwertyuiopasdfghjklzxcvbnm1234qwertyuiopasdfghjklzxcvbnm)] [()] [()] |
︙ | ︙ | |||
2196 2197 2198 2199 2200 2201 2202 | font delete xyz } -result {italic} test font-37.6 {GetAttributeInfo procedure: underline} -setup { catch {font delete xyz} set x {} } -body { font create xyz -underline yes | | | | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 | font delete xyz } -result {italic} test font-37.6 {GetAttributeInfo procedure: underline} -setup { catch {font delete xyz} set x {} } -body { font create xyz -underline yes font config xyz -underline } -cleanup { font delete xyz } -result {1} test font-37.7 {GetAttributeInfo procedure: overstrike} -setup { catch {font delete xyz} set x {} } -body { font create xyz -overstrike no font config xyz -overstrike } -cleanup { font delete xyz } -result {0} # In tests below, one field is set to "xyz" so that font name doesn't # look like a native X font, so that ParseFontNameObj or TkParseXLFD will |
︙ | ︙ | |||
2351 2352 2353 2354 2355 2356 2357 | test font-45.1 {TkFontGetAliasList: no match} -body { font actual {snarky 10} -family } -result [font actual {-size 10} -family] test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family | | | 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 | test font-45.1 {TkFontGetAliasList: no match} -body { font actual {snarky 10} -family } -result [font actual {-size 10} -family] test font-45.2 {TkFontGetAliasList: match} -constraints win -body { font actual {times 10} -family } -result {times} test font-45.3 {TkFontGetAliasList: match} -constraints {noExceed} -body { if {[font actual {{times new roman} 10} -family] eq "Times New Roman"} { # avoid test failure on systems that have a real "times new roman" font set res 1 } else { set res [expr {[font actual {{times new roman} 10} -family] eq \ [font actual {times 10} -family]} ] |
︙ | ︙ |
Changes to tests/frame.test.
|
| | | | > > | | | | | | | | | | > | > > > > > > > > > > | > | > > > > > > > > > > | | | | < | | | < | | | < | | | | | | | | < > | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | # This file is a Tcl script to test out the "frame", "labelframe" and # "toplevel" commands of Tk. It is organized in the standard fashion for Tcl # tests. # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands tcltest::testConstraint x11 [expr {[tk windowingsystem] eq "x11"}] # eatColors -- # Creates a toplevel window and allocates enough colors in it to use up all # the slots in an 8-bit colormap. # # Arguments: # w - Name of toplevel window to create. proc eatColors {w} { catch {destroy $w} toplevel $w wm geom $w +0+0 canvas $w.c -width 400 -height 200 -bd 0 pack $w.c for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 40} {incr x} { set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0] $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \ -fill $color } } update } # colorsFree -- # # Returns 1 if there appear to be free colormap entries in a window, 0 # otherwise. # # Arguments: # w - Name of window in which to check. # red, green, blue - Intensities to use in a trial color allocation # to see if there are colormap entries free. proc colorsFree {w {red 31} {green 245} {blue 192}} { lassign [winfo rgb $w [format "#%02x%02x%02x" $red $green $blue]] r g b expr {($r/256 == $red) && ($g/256 == $green) && ($b/256 == $blue)} } # uniq -- # # Returns the unique items of a list in the order they first appear. # # Arguments: # list - The list to uniq-ify. proc uniq {list} { set d {} foreach item $list { dict set d $item {} } return [dict keys $d] } # optnames -- # # Returns the option names out of a list of option details. # # Arguments: # options - The option detail list. proc optnames {options} { lsort [lmap desc $options {lindex $desc 0}] } test frame-1.1 {frame configuration options} -setup { deleteWindows } -body { frame .f -class NewFrame .f configure -class } -cleanup { deleteWindows } -result {-class class Class Frame NewFrame} test frame-1.2 {frame configuration options} -setup { deleteWindows } -body { frame .f -class NewFrame .f configure -class Different } -returnCodes error -cleanup { deleteWindows } -result {can't modify -class option after widget is created} test frame-1.3 {frame configuration options} -setup { deleteWindows } -body { frame .f -colormap new .f configure -colormap } -cleanup { deleteWindows } -result {-colormap colormap Colormap {} new} test frame-1.4 {frame configuration options} -setup { deleteWindows } -body { frame .f -colormap new .f configure -colormap . } -returnCodes error -cleanup { deleteWindows } -result {can't modify -colormap option after widget is created} test frame-1.5 {frame configuration options} -setup { deleteWindows } -body { frame .f -visual default .f configure -visual } -cleanup { deleteWindows } -result {-visual visual Visual {} default} test frame-1.6 {frame configuration options} -setup { deleteWindows } -body { frame .f -visual default .f configure -visual best } -returnCodes error -cleanup { deleteWindows } -result {can't modify -visual option after widget is created} test frame-1.7 {frame configuration options} -setup { deleteWindows } -body { frame .f -screen bogus } -cleanup { deleteWindows } -returnCodes error -result {unknown option "-screen"} test frame-1.8 {frame configuration options} -setup { deleteWindows } -body { frame .f -container true } -cleanup { deleteWindows } -result {.f} test frame-1.9 {frame configuration options} -setup { deleteWindows } -body { frame .f -container true .f configure -container } -cleanup { deleteWindows } -result {-container container Container 0 1} test frame-1.10 {frame configuration options} -setup { deleteWindows } -body { frame .f -container bogus } -cleanup { deleteWindows } -returnCodes error -result {expected boolean value but got "bogus"} test frame-1.11 {frame configuration options} -setup { deleteWindows } -body { frame .f .f configure -container 1 } -returnCodes error -cleanup { deleteWindows } -result {can't modify -container option after widget is created} test frame-1.12 {frame configuration options} -setup { deleteWindows } -body { # Make sure all options can be set to the default value frame .f set opts {} foreach opt [.f configure] { if {[llength $opt] == 5} { lappend opts [lindex $opt 0] [lindex $opt 4] } } frame .g {*}$opts } -cleanup { destroy .f .g deleteWindows } -result .g destroy .f frame .f test frame-1.13 {frame configuration options} -body { .f configure -background #ff0000 lindex [.f configure -background] 4 } -cleanup { .f configure -background [lindex [.f configure -background] 3] } -result "#ff0000" test frame-1.14 {frame configuration options} -body { .f configure -background non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-1.15 {frame configuration options} -body { .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result {4} test frame-1.16 {frame configuration options} -body { .f configure -bd badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-1.17 {frame configuration options} -body { .f configure -bg #00ff00 lindex [.f configure -bg] 4 } -cleanup { .f configure -bg [lindex [.f configure -bg] 3] } -result "#00ff00" test frame-1.18 {frame configuration options} -body { .f configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-1.19 {frame configuration options} -body { .f configure -borderwidth 1.3 lindex [.f configure -borderwidth] 4 } -cleanup { |
︙ | ︙ | |||
215 216 217 218 219 220 221 | .f configure -height not_a_number } -returnCodes error -result {bad screen distance "not_a_number"} test frame-1.25 {frame configuration options} -body { .f configure -highlightbackground #112233 lindex [.f configure -highlightbackground] 4 } -cleanup { .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3] | | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | .f configure -height not_a_number } -returnCodes error -result {bad screen distance "not_a_number"} test frame-1.25 {frame configuration options} -body { .f configure -highlightbackground #112233 lindex [.f configure -highlightbackground] 4 } -cleanup { .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3] } -result "#112233" test frame-1.26 {frame configuration options} -body { .f configure -highlightbackground ugly } -returnCodes error -result {unknown color name "ugly"} test frame-1.27 {frame configuration options} -body { .f configure -highlightcolor #123456 lindex [.f configure -highlightcolor] 4 } -cleanup { .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3] } -result "#123456" test frame-1.28 {frame configuration options} -body { .f configure -highlightcolor non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-1.29 {frame configuration options} -body { .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { |
︙ | ︙ | |||
261 262 263 264 265 266 267 | } -returnCodes error -result {bad screen distance "badValue"} test frame-1.35 {frame configuration options} -body { .f configure -relief ridge lindex [.f configure -relief] 4 } -cleanup { .f configure -relief [lindex [.f configure -relief] 3] } -result {ridge} | | | < | | | < | | | < | | | < < | < < | < < | < | | | > > > > > > > > > | > > > > > > > < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | | < | | | > > > > | | | | | | | < | | | | | | < > | < | | | 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | } -returnCodes error -result {bad screen distance "badValue"} test frame-1.35 {frame configuration options} -body { .f configure -relief ridge lindex [.f configure -relief] 4 } -cleanup { .f configure -relief [lindex [.f configure -relief] 3] } -result {ridge} test frame-1.36 {frame configuration options} -returnCodes error -body { .f configure -relief badValue } -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test frame-1.37 {frame configuration options} -body { .f configure -takefocus {any string} lindex [.f configure -takefocus] 4 } -cleanup { .f configure -takefocus [lindex [.f configure -takefocus] 3] } -result {any string} test frame-1.38 {frame configuration options} -body { .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result {32} test frame-1.39 {frame configuration options} -body { .f configure -width badValue } -returnCodes error -result {bad screen distance "badValue"} destroy .f test frame-2.1 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -class NewClass wm geometry .t +0+0 .t configure -class } -cleanup { deleteWindows } -result {-class class Class Toplevel NewClass} test frame-2.2 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -class NewClass wm geometry .t +0+0 .t configure -class Another } -returnCodes error -cleanup { deleteWindows } -result {can't modify -class option after widget is created} test frame-2.3 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -colormap new wm geometry .t +0+0 .t configure -colormap } -cleanup { deleteWindows } -result {-colormap colormap Colormap {} new} test frame-2.4 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -colormap new wm geometry .t +0+0 .t configure -colormap . } -returnCodes error -cleanup { deleteWindows } -result {can't modify -colormap option after widget is created} test frame-2.5 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 .t configure -container 1 } -returnCodes error -cleanup { deleteWindows } -result {can't modify -container option after widget is created} test frame-2.6 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 catch {.t configure -container 1} .t configure -container } -cleanup { deleteWindows } -result {-container container Container 0 0} test frame-2.7 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -colormap bogus } -cleanup { deleteWindows } -returnCodes error -result {bad window path name "bogus"} test frame-2.8 {toplevel configuration options} -constraints win -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 .t configure -use 0x44022 } -cleanup { deleteWindows } -returnCodes error -result {window "0x44022" doesn't exist} test frame-2.9 {toplevel configuration options} -constraints win -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 catch {.t configure -use 0x44022} .t configure -use } -cleanup { deleteWindows } -result {-use use Use {} {}} test frame-2.10 {toplevel configuration options} -constraints nonwin -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 .t configure -use 0x44022 } -cleanup { deleteWindows } -returnCodes error -result {can't modify -use option after widget is created} test frame-2.11 {toplevel configuration options} -constraints nonwin -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 wm geometry .t +0+0 catch {.t configure -use 0x44022} .t configure -use } -cleanup { deleteWindows } -result {-use use Use {} {}} test frame-2.12 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -visual default wm geometry .t +0+0 .t configure -visual } -cleanup { deleteWindows } -result {-visual visual Visual {} default} test frame-2.13 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -visual default wm geometry .t +0+0 .t configure -visual best } -returnCodes error -cleanup { deleteWindows } -result {can't modify -visual option after widget is created} test frame-2.14 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -visual who_knows? } -returnCodes error -cleanup { deleteWindows } -result {unknown or ambiguous visual name "who_knows?": class must be best, directcolor, grayscale, greyscale, pseudocolor, staticcolor, staticgray, staticgrey, truecolor, or default} set expectedScreen "" if {[tcltest::testConstraint haveDISPLAY]} { set expectedScreen [list -screen screen Screen {} $env(DISPLAY)] } test frame-2.15 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -screen $env(DISPLAY) wm geometry .t +0+0 .t configure -screen } -cleanup { deleteWindows } -result $expectedScreen test frame-2.16 {toplevel configuration options} -constraints {x11 haveDISPLAY} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -screen $env(DISPLAY) wm geometry .t +0+0 .t configure -screen another } -returnCodes error -cleanup { deleteWindows } -result {can't modify -screen option after widget is created} test frame-2.17 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -width 200 -height 100 -screen bogus } -cleanup { deleteWindows } -returnCodes error -result {couldn't connect to display "bogus"} test frame-2.18 {toplevel configuration options} -setup { deleteWindows } -body { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 toplevel .x -container 1 -use [winfo id .t] } -returnCodes error -cleanup { deleteWindows } -result {windows cannot have both the -use and the -container option set} test frame-2.19 {toplevel configuration options} -setup { deleteWindows set opts {} } -body { # Make sure all options can be set to the default value toplevel .f foreach opt [.f configure] { if {[llength $opt] == 5} { lappend opts [lindex $opt 0] [lindex $opt 4] } } toplevel .g {*}$opts } -cleanup { destroy .f .g deleteWindows } -result .g destroy .t toplevel .t -width 300 -height 150 wm geometry .t +0+0 update test frame-2.20 {toplevel configuration options} -body { .t configure -background #ff0000 lindex [.t configure -background] 4 } -result "#ff0000" test frame-2.21 {toplevel configuration options} -body { .t configure -background non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-2.22 {toplevel configuration options} -body { .t configure -bd 4 lindex [.t configure -bd] 4 } -result {4} test frame-2.23 {toplevel configuration options} -body { .t configure -bd badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-2.24 {toplevel configuration options} -body { .t configure -bg #00ff00 lindex [.t configure -bg] 4 } -result "#00ff00" test frame-2.25 {toplevel configuration options} -body { .t configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-2.26 {toplevel configuration options} -body { .t configure -borderwidth 1.3 lindex [.t configure -borderwidth] 4 } -result {1} |
︙ | ︙ | |||
532 533 534 535 536 537 538 | } -result {100} test frame-2.31 {toplevel configuration options} -body { .t configure -height not_a_number } -returnCodes error -result {bad screen distance "not_a_number"} test frame-2.32 {toplevel configuration options} -body { .t configure -highlightcolor #123456 lindex [.t configure -highlightcolor] 4 | | | 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | } -result {100} test frame-2.31 {toplevel configuration options} -body { .t configure -height not_a_number } -returnCodes error -result {bad screen distance "not_a_number"} test frame-2.32 {toplevel configuration options} -body { .t configure -highlightcolor #123456 lindex [.t configure -highlightcolor] 4 } -result "#123456" test frame-2.33 {toplevel configuration options} -body { .t configure -highlightcolor non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-2.34 {toplevel configuration options} -body { .t configure -highlightthickness 3 lindex [.t configure -highlightthickness] 4 } -result {3} |
︙ | ︙ | |||
561 562 563 564 565 566 567 | test frame-2.39 {toplevel configuration options} -body { .t configure -pady badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-2.40 {toplevel configuration options} -body { .t configure -relief ridge lindex [.t configure -relief] 4 } -result {ridge} | | | < | | | | | < | | | | | > > > > > > > > < | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | < | | < | | 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 | test frame-2.39 {toplevel configuration options} -body { .t configure -pady badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-2.40 {toplevel configuration options} -body { .t configure -relief ridge lindex [.t configure -relief] 4 } -result {ridge} test frame-2.41 {toplevel configuration options} -returnCodes error -body { .t configure -relief badValue } -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test frame-2.42 {toplevel configuration options} -body { .t configure -width 32 lindex [.t configure -width] 4 } -result {32} test frame-2.43 {toplevel configuration options} -body { .t configure -width badValue } -returnCodes error -result {bad screen distance "badValue"} destroy .t test frame-3.1 {TkCreateFrame procedure} -returnCodes error -body { frame } -result {wrong # args: should be "frame pathName ?-option value ...?"} test frame-3.2 {TkCreateFrame procedure} -setup { deleteWindows frame .f } -body { .f configure -class } -cleanup { deleteWindows } -result {-class class Class Frame Frame} test frame-3.3 {TkCreateFrame procedure} -setup { deleteWindows toplevel .t wm geometry .t +0+0 } -body { .t configure -class } -cleanup { deleteWindows } -result {-class class Class Toplevel Toplevel} test frame-3.4 {TkCreateFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 350 -class NewClass -bg black -visual default -height 90 wm geometry .t +0+0 update list [lindex [.t configure -width] 4] \ [lindex [.t configure -background] 4] \ [lindex [.t configure -height] 4] } -cleanup { deleteWindows } -result {350 black 90} # Be sure that the -class, -colormap, and -visual options are processed # before configuring the widget. test frame-3.5 {TkCreateFrame procedure} -setup { deleteWindows } -body { option add *NewFrame.background #123456 frame .f -class NewFrame lindex [.f configure -background] 4 } -cleanup { deleteWindows option clear } -result {#123456} test frame-3.6 {TkCreateFrame procedure} -setup { deleteWindows } -body { option add *NewFrame.background #123456 frame .f -class NewFrame lindex [.f configure -background] 4 } -cleanup { deleteWindows option clear } -result {#123456} test frame-3.7 {TkCreateFrame procedure} -setup { deleteWindows } -body { option add *NewFrame.background #332211 option add *f.class NewFrame frame .f list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4] } -cleanup { deleteWindows option clear } -result {NewFrame #332211} test frame-3.8 {TkCreateFrame procedure} -setup { deleteWindows } -body { option add *Silly.background #122334 option add *f.Class Silly frame .f list [lindex [.f configure -class] 4] [lindex [.f configure -background] 4] } -cleanup { deleteWindows option clear } -result {Silly #122334} test frame-3.9 {TkCreateFrame procedure, -use option} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green tkwait visibility .x list [expr {[winfo rootx .x] - [winfo rootx .t]}] \ [expr {[winfo rooty .x] - [winfo rooty .t]}] \ [winfo width .t] [winfo height .t] } -cleanup { # This call to update idletasks was added to prevent a crash that was # observed on OSX 10.12 (Sierra) only. Any change, such as using the # Development version to make debugging symbols available, adding a print # statement, or calling update idletasks here, would make the test pass # with no segfault. update idletasks deleteWindows } -result {0 0 140 300} test frame-3.10 {TkCreateFrame procedure, -use option} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 option add *x.use [winfo id .t] update toplevel .x -width 140 -height 300 -bg green tkwait visibility .x update list [expr {[winfo rootx .x] - [winfo rootx .t]}] \ [expr {[winfo rooty .x] - [winfo rooty .t]}] \ [winfo width .t] [winfo height .t] } -cleanup { destroy .t option clear } -result {0 0 140 300} # The tests below require specific display characteristics (i.e. that they are # run on a pseudocolor display of depth 8). Even so, they are non-portable: # some machines don't seem to ever run out of colors. if {[testConstraint defaultPseudocolor8]} { eatColors .t1 } test frame-3.11 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 -bg #475601 wm geometry .t +0+0 update colorsFree .t } -cleanup { destroy .t } -result {0} test frame-3.12 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 -bg #475601 -colormap new wm geometry .t +0+0 update colorsFree .t } -cleanup { destroy .t } -result {1} test frame-3.13 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { option add *t.class Toplevel2 option add *Toplevel2.colormap new toplevel .t -width 300 -height 200 -bg #475601 wm geometry .t +0+0 update option clear colorsFree .t } -cleanup { destroy .t } -result {1} test frame-3.14 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { option add *t.class Toplevel3 option add *Toplevel3.Colormap new toplevel .t -width 300 -height 200 -bg #475601 -colormap new wm geometry .t +0+0 update option clear colorsFree .t } -cleanup { destroy .t } -result {1} test frame-3.15 {TkCreateFrame procedure, -use and -colormap} -constraints { defaultPseudocolor8 unix nonPortable } -setup { destroy .t } -body { toplevel .t -container 1 -width 300 -height 120 wm geometry .t +0+0 toplevel .x -width 140 -height 300 -use [winfo id .t] -bg green -colormap new tkwait visibility .x list [colorsFree .t] [colorsFree .x] } -cleanup { destroy .t } -result {0 1} test frame-3.16 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 -bg #475601 -visual default wm geometry .t +0+0 update colorsFree .t } -cleanup { destroy .t } -result {0} test frame-3.17 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 nonPortable } -setup { destroy .t } -body { toplevel .t -width 300 -height 200 -bg #475601 -visual default \ -colormap new wm geometry .t +0+0 update colorsFree .t } -cleanup { destroy .t } -result {1} test frame-3.18 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 haveGrayscale8 nonPortable } -setup { destroy .t } -body { toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343 wm geometry .t +0+0 update colorsFree .t 131 131 131 } -cleanup { destroy .t } -result {1} test frame-3.19 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 haveGrayscale8 nonPortable } -setup { destroy .t } -body { option add *t.class T4 option add *T4.visual {grayscale 8} toplevel .t -width 300 -height 200 -bg #434343 wm geometry .t +0+0 update option clear list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4] } -cleanup { destroy .t } -result {1 {grayscale 8}} test frame-3.20 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 haveGrayscale8 nonPortable } -setup { destroy .t } -body { option add *t.class T5 option add *T5.Visual {grayscale 8} toplevel .t -width 300 -height 200 -bg #434343 wm geometry .t +0+0 update option clear list [colorsFree .t 131 131 131] [lindex [.t configure -visual] 4] } -cleanup { destroy .t } -result {1 {grayscale 8}} test frame-3.21 {TkCreateFrame procedure} -constraints { defaultPseudocolor8 haveGrayscale8 nonPortable } -setup { destroy .t } -body { toplevel .t -visual {grayscale 8} -width 300 -height 200 -bg #434343 wm geometry .t +0+0 update colorsFree .t 131 131 131 } -cleanup { destroy .t } -result {1} if {[testConstraint defaultPseudocolor8]} { destroy .t1 } test frame-3.22 {TkCreateFrame procedure, default dimensions} -setup { deleteWindows } -body { toplevel .t wm geometry .t +0+0 update set result "[winfo reqwidth .t] [winfo reqheight .t]" frame .t.f -bg red pack .t.f |
︙ | ︙ | |||
869 870 871 872 873 874 875 | test frame-3.24 {TkCreateFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 300 -height 200 -colormap new -bogus option wm geometry .t +0+0 } -returnCodes error -result {unknown option "-bogus"} | < | | < | 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | test frame-3.24 {TkCreateFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 300 -height 200 -colormap new -bogus option wm geometry .t +0+0 } -returnCodes error -result {unknown option "-bogus"} test frame-4.1 {TkCreateFrame procedure} -setup { deleteWindows } -body { catch {frame .f -gorp glob} winfo exists .f } -result 0 test frame-4.2 {TkCreateFrame procedure} -setup { deleteWindows } -body { list [frame .f -width 200 -height 100] [winfo exists .f] } -cleanup { deleteWindows } -result {.f 1} frame .f -highlightcolor black test frame-5.1 {FrameWidgetCommand procedure} -body { .f } -returnCodes error -result {wrong # args: should be ".f option ?arg ...?"} test frame-5.2 {FrameWidgetCommand procedure, cget option} -body { .f cget |
︙ | ︙ | |||
912 913 914 915 916 917 918 | destroy .t } -body { toplevel .t .t cget -screen } -cleanup { destroy .t } -returnCodes ok -match glob -result * | < | | | | | | | | | | | < < | | | < | < | < < | < | | < > < | | | | < < < | | | | > | < | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 | destroy .t } -body { toplevel .t .t cget -screen } -cleanup { destroy .t } -returnCodes ok -match glob -result * test frame-5.8 {FrameWidgetCommand procedure, configure option} -body { optnames [.f configure] } -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -padx -pady -relief -takefocus -tile -visual -width} test frame-5.9 {FrameWidgetCommand procedure, configure option} -body { .f configure -gorp } -returnCodes error -result {unknown option "-gorp"} test frame-5.10 {FrameWidgetCommand procedure, configure option} -body { .f configure -gorp bogus } -returnCodes error -result {unknown option "-gorp"} test frame-5.11 {FrameWidgetCommand procedure, configure option} -body { .f configure -width 200 -height } -returnCodes error -result {value for "-height" missing} test frame-5.12 {FrameWidgetCommand procedure} -body { .f swizzle } -returnCodes error -result {bad option "swizzle": must be cget or configure} test frame-5.13 {FrameWidgetCommand procedure, configure option} -body { optnames [. configure] } -result {-background -backgroundimage -bd -bg -bgimg -borderwidth -class -colormap -container -cursor -height -highlightbackground -highlightcolor -highlightthickness -menu -padx -pady -relief -screen -takefocus -tile -use -visual -width} destroy .f test frame-6.1 {ConfigureFrame procedure} -setup { deleteWindows } -body { frame .f -width 150 list [winfo reqwidth .f] [winfo reqheight .f] } -cleanup { deleteWindows } -result {150 1} test frame-6.2 {ConfigureFrame procedure} -setup { deleteWindows } -body { frame .f -height 97 list [winfo reqwidth .f] [winfo reqheight .f] } -cleanup { deleteWindows } -result {1 97} test frame-6.3 {ConfigureFrame procedure} -setup { deleteWindows } -body { frame .f set result {} lappend result [winfo reqwidth .f] [winfo reqheight .f] .f configure -width 100 -height 180 lappend result [winfo reqwidth .f] [winfo reqheight .f] .f configure -width 0 -height 0 lappend result [winfo reqwidth .f] [winfo reqheight .f] } -cleanup { deleteWindows } -result {1 1 100 180 100 180} test frame-7.1 {FrameEventProc procedure} -setup { deleteWindows } -body { frame .frame2 set result [info commands .frame2] destroy .frame2 lappend result [info commands .frame2] } -result {.frame2 {}} test frame-7.2 {FrameEventProc procedure} -setup { deleteWindows set x {} } -body { frame .f1 -bg #543210 rename .f1 .f2 lappend x [winfo children .] lappend x [.f2 cget -bg] destroy .f1 lappend x [info command .f*] [winfo children .] } -cleanup { deleteWindows } -result {.f1 #543210 {} {}} test frame-8.1 {FrameCmdDeletedProc procedure} -setup { deleteWindows } -body { frame .f1 rename .f1 {} list [info command .f*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} test frame-8.2 {FrameCmdDeletedProc procedure} -setup { deleteWindows } -body { toplevel .f1 -menu .m wm geometry .f1 +0+0 update rename .f1 {} update list [info command .f*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} # # This one fails with the dash-patch!!!! Still don't know why :-( # #test frame-8.3 {FrameCmdDeletedProc procedure} -setup { # deleteWindows #} -body { # toplevel .f1 -menu .m # wm geometry .f1 +0+0 # menu .m # update # rename .f1 {} # update # list [info command .f*] [winfo children .] #} -cleanup { # deleteWindows #} -result {{} .m} test frame-9.1 {MapFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 100 -height 400 wm geometry .t +0+0 set result [winfo ismapped .t] update idletasks lappend result [winfo ismapped .t] } -cleanup { deleteWindows } -result {0 1} test frame-9.2 {MapFrame procedure} -setup { deleteWindows } -body { toplevel .t -width 100 -height 400 wm geometry .t +0+0 destroy .t update winfo exists .t } -result {0} test frame-9.3 {MapFrame procedure, window deleted while mapping} -setup { deleteWindows } -body { toplevel .t2 -width 200 -height 200 wm geometry .t2 +0+0 tkwait visibility .t2 toplevel .t -width 100 -height 400 wm geometry .t +0+0 frame .t2.f -width 50 -height 50 bind .t2.f <Configure> {destroy .t} pack .t2.f -side top update idletasks winfo exists .t } -cleanup { deleteWindows } -result {0} test frame-10.1 {frame widget vs hidden commands} -setup { deleteWindows } -body { frame .t interp hide {} .t destroy .t list [winfo children .] [lsort [interp hidden]] } -result [list {} [lsort [interp hidden]]] test frame-11.1 {TkInstallFrameMenu} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m1.system menu .m1.system -tearoff 0 .m1.system add command -label foo toplevel .t -menu .m1 } -cleanup { deleteWindows } -result {.t} test frame-11.2 {TkInstallFrameMenu - frame renamed} -setup { deleteWindows catch {rename foo {}} } -body { menu .m1 .m1 add cascade -menu .m1.system menu .m1.system -tearoff 0 .m1.system add command -label foo toplevel .t rename .t foo } -cleanup { deleteWindows } -result {} test frame-12.1 {FrameWorldChanged procedure} -setup { deleteWindows } -body { # Test -bd -padx and -pady frame .f -borderwidth 2 -padx 3 -pady 4 place .f -x 0 -y 0 -width 40 -height 40 pack [frame .f.f] -fill both -expand 1 update list [winfo x .f.f] [winfo y .f.f] [winfo width .f.f] [winfo height .f.f] } -cleanup { deleteWindows } -result {5 6 30 28} test frame-12.2 {FrameWorldChanged procedure} -setup { deleteWindows } -body { # Test all -labelanchor positions set font {helvetica 12} labelframe .f -highlightthickness 1 -bd 3 -padx 1 -pady 2 -font $font \ -text "Mupp" set fh [expr {max([font metrics $font -linespace] + 2 - 3, 0)}] set fw [expr {max([font measure $font "Mupp"] + 2 - 3, 0)}] place .f -x 0 -y 0 -width 100 -height 100 pack [frame .f.f] -fill both -expand 1 set result {} foreach lp {nw n ne en e es se s sw ws w wn} { .f configure -labelanchor $lp update set expx 5 set expy 6 set expw 90 set exph 88 switch -glob $lp { n* {incr expy $fh ; incr exph -$fh} s* {incr exph -$fh} w* {incr expx $fw ; incr expw -$fw} e* {incr expw -$fw} } lappend result [expr { [winfo x .f.f] == $expx && [winfo y .f.f] == $expy && [winfo width .f.f] == $expw && [winfo height .f.f] == $exph }] } return $result } -cleanup { deleteWindows } -result {1 1 1 1 1 1 1 1 1 1 1 1} test frame-12.3 {FrameWorldChanged procedure} -setup { deleteWindows } -body { # Check reaction on font change font create myfont -family courier -size 10 labelframe .f -font myfont -text Mupp place .f -x 0 -y 0 -width 40 -height 40 pack [frame .f.f] -fill both -expand 1 update set h1 [font metrics myfont -linespace] set y1 [winfo y .f.f] font configure myfont -size 20 update set h2 [font metrics myfont -linespace] set y2 [winfo y .f.f] expr {($h2 - $h1) - ($y2 - $y1)} } -cleanup { deleteWindows font delete myfont } -result {0} test frame-13.1 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -class NewFrame .f configure -class } -cleanup { deleteWindows } -result {-class class Class Labelframe NewFrame} test frame-13.2 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -class NewFrame .f configure -class Different } -returnCodes error -cleanup { deleteWindows } -result {can't modify -class option after widget is created} test frame-13.3 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -colormap new } -cleanup { deleteWindows } -result {.f} test frame-13.4 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -visual default } -cleanup { deleteWindows } -result {.f} test frame-13.5 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -screen bogus } -cleanup { deleteWindows } -returnCodes error -result {unknown option "-screen"} test frame-13.6 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -container true } -cleanup { deleteWindows } -result {.f} test frame-13.7 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -container true .f configure -container } -cleanup { deleteWindows } -result {-container container Container 0 1} test frame-13.8 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f -container bogus } -cleanup { deleteWindows } -returnCodes error -result {expected boolean value but got "bogus"} test frame-13.9 {labelframe configuration options} -setup { deleteWindows } -body { labelframe .f .f configure -container 1 } -returnCodes error -cleanup { deleteWindows } -result {can't modify -container option after widget is created} destroy .f labelframe .f test frame-13.10 {labelframe configuration options} -body { .f configure -background #ff0000 lindex [.f configure -background] 4 } -cleanup { .f configure -background [lindex [.f configure -background] 3] } -result "#ff0000" test frame-13.11 {labelframe configuration options} -body { .f configure -background non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.12 {labelframe configuration options} -body { .f configure -bd 4 lindex [.f configure -bd] 4 } -cleanup { .f configure -bd [lindex [.f configure -bd] 3] } -result {4} test frame-13.13 {labelframe configuration options} -body { .f configure -bd badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-13.14 {labelframe configuration options} -body { .f configure -bg #00ff00 lindex [.f configure -bg] 4 } -cleanup { .f configure -bg [lindex [.f configure -bg] 3] } -result "#00ff00" test frame-13.15 {labelframe configuration options} -body { .f configure -bg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.16 {labelframe configuration options} -body { .f configure -borderwidth 1.3 lindex [.f configure -borderwidth] 4 } -cleanup { .f configure -borderwidth [lindex [.f configure -borderwidth] 3] } -result {1} test frame-13.17 {labelframe configuration options} -body { .f configure -borderwidth badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-13.18 {labelframe configuration options} -body { .f configure -cursor arrow lindex [.f configure -cursor] 4 } -cleanup { .f configure -cursor [lindex [.f configure -cursor] 3] } -result {arrow} test frame-13.19 {labelframe configuration options} -body { .f configure -cursor badValue } -returnCodes error -result {bad cursor spec "badValue"} test frame-13.20 {labelframe configuration options} -body { .f configure -fg #0000ff lindex [.f configure -fg] 4 } -cleanup { .f configure -fg [lindex [.f configure -fg] 3] } -result "#0000ff" test frame-13.21 {labelframe configuration options} -body { .f configure -fg non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.22 {labelframe configuration options} -body { .f configure -font {courier 8} lindex [.f configure -font] 4 } -cleanup { .f configure -font [lindex [.f configure -font] 3] } -result {courier 8} test frame-13.23 {labelframe configuration options} -body { .f configure -foreground #ff0000 lindex [.f configure -foreground] 4 } -cleanup { .f configure -foreground [lindex [.f configure -foreground] 3] } -result "#ff0000" test frame-13.24 {labelframe configuration options} -body { .f configure -foreground non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.25 {labelframe configuration options} -body { .f configure -height 100 lindex [.f configure -height] 4 } -cleanup { .f configure -height [lindex [.f configure -height] 3] } -result {100} test frame-13.26 {labelframe configuration options} -body { .f configure -height not_a_number } -returnCodes error -result {bad screen distance "not_a_number"} test frame-13.27 {labelframe configuration options} -body { .f configure -highlightbackground #112233 lindex [.f configure -highlightbackground] 4 } -cleanup { .f configure -highlightbackground [lindex [.f configure -highlightbackground] 3] } -result "#112233" test frame-13.28 {labelframe configuration options} -body { .f configure -highlightbackground ugly } -returnCodes error -result {unknown color name "ugly"} test frame-13.29 {labelframe configuration options} -body { .f configure -highlightcolor #123456 lindex [.f configure -highlightcolor] 4 } -cleanup { .f configure -highlightcolor [lindex [.f configure -highlightcolor] 3] } -result "#123456" test frame-13.30 {labelframe configuration options} -body { .f configure -highlightcolor non-existent } -returnCodes error -result {unknown color name "non-existent"} test frame-13.31 {labelframe configuration options} -body { .f configure -highlightthickness 6 lindex [.f configure -highlightthickness] 4 } -cleanup { .f configure -highlightthickness [lindex [.f configure -highlightthickness] 3] } -result {6} test frame-13.32 {labelframe configuration options} -body { .f configure -highlightthickness badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-13.33 {labelframe configuration options} -body { .f configure -labelanchor se lindex [.f configure -labelanchor] 4 } -cleanup { .f configure -labelanchor [lindex [.f configure -labelanchor] 3] } -result {se} test frame-13.34 {labelframe configuration options} -returnCodes error -body { .f configure -labelanchor badValue } -result {bad labelanchor "badValue": must be e, en, es, n, ne, nw, s, se, sw, w, wn, or ws} test frame-13.35 {labelframe configuration options} -body { .f configure -padx 3 lindex [.f configure -padx] 4 } -cleanup { .f configure -padx [lindex [.f configure -padx] 3] } -result {3} test frame-13.36 {labelframe configuration options} -body { .f configure -padx badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-13.37 {labelframe configuration options} -body { .f configure -pady 4 lindex [.f configure -pady] 4 } -cleanup { .f configure -pady [lindex [.f configure -pady] 3] } -result {4} test frame-13.38 {labelframe configuration options} -body { .f configure -pady badValue } -returnCodes error -result {bad screen distance "badValue"} test frame-13.39 {labelframe configuration options} -body { .f configure -relief ridge lindex [.f configure -relief] 4 } -cleanup { .f configure -relief [lindex [.f configure -relief] 3] } -result {ridge} test frame-13.40 {labelframe configuration options} -returnCodes error -body { .f configure -relief badValue } -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test frame-13.41 {labelframe configuration options} -body { .f configure -takefocus {any string} lindex [.f configure -takefocus] 4 } -cleanup { .f configure -takefocus [lindex [.f configure -takefocus] 3] } -result {any string} test frame-13.42 {labelframe configuration options} -body { .f configure -text {any string} lindex [.f configure -text] 4 } -cleanup { .f configure -text [lindex [.f configure -text] 3] } -result {any string} test frame-13.43 {labelframe configuration options} -body { .f configure -width 32 lindex [.f configure -width] 4 } -cleanup { .f configure -width [lindex [.f configure -width] 3] } -result {32} test frame-13.44 {labelframe configuration options} -body { .f configure -width badValue } -returnCodes error -result {bad screen distance "badValue"} destroy .f test frame-14.1 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test that label is moved in stacking order label .l -text Mupp -font {helvetica 8} labelframe .f -labelwidget .l pack .f frame .f.f -width 50 -height 50 pack .f.f update list [winfo children .] [winfo width .f] \ [expr {[winfo height .f] - [winfo height .l]}] } -cleanup { deleteWindows } -result {{.f .l} 54 52} test frame-14.2 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test the labelframe's reaction if the label is destroyed label .l -text Aratherlonglabel labelframe .f -labelwidget .l pack .f label .f.l -text Mupp pack .f.l update set res [list [.f cget -labelwidget]] lappend res [expr {[winfo width .f] - [winfo width .l]}] destroy .l lappend res [.f cget -labelwidget] update lappend res [expr {[winfo width .f] - [winfo width .f.l]}] } -cleanup { deleteWindows } -result {.l 12 {} 4} test frame-14.3 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test the labelframe's reaction if the label is stolen label .l -text Aratherlonglabel labelframe .f -labelwidget .l pack .f label .f.l -text Mupp pack .f.l update set res [list [.f cget -labelwidget]] lappend res [expr {[winfo width .f] - [winfo width .l]}] pack .l lappend res [.f cget -labelwidget] update lappend res [expr {[winfo width .f] - [winfo width .f.l]}] } -cleanup { deleteWindows } -result {.l 12 {} 4} test frame-14.4 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test the label's reaction if the labelframe is destroyed label .l -text Mupp labelframe .f -labelwidget .l pack .f update set res [list [winfo manager .l]] destroy .f lappend res [winfo manager .l] } -cleanup { deleteWindows } -result {labelframe {}} test frame-14.5 {labelframe labelwidget option} -setup { deleteWindows } -body { # Test that the labelframe reacts on changes in label label .l -text Aratherlonglabel labelframe .f -labelwidget .l pack .f label .f.l -text Mupp pack .f.l |
︙ | ︙ | |||
1498 1499 1500 1501 1502 1503 1504 | update lappend res [expr {[winfo width .f] - [winfo width .l]}] lappend res [expr {[winfo width .f] > $first}] } -cleanup { deleteWindows } -result {12 12 1 12 1} test frame-14.6 {labelframe labelwidget option} -setup { | | | | | | > > | > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > | | | | 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 | update lappend res [expr {[winfo width .f] - [winfo width .l]}] lappend res [expr {[winfo width .f] > $first}] } -cleanup { deleteWindows } -result {12 12 1 12 1} test frame-14.6 {labelframe labelwidget option} -setup { deleteWindows } -body { # Destroying a labelframe with a child label caused a crash when not # handling mapping of the label correctly. # This test does not test anything directly, it's just ment to catch if # the same mistake is made again. labelframe .f pack .f label .f.l -text Mupp .f configure -labelwidget .f.l update } -cleanup { deleteWindows } -result {} test frame-15.1 {TIP 262: frame background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { frame .f -width 100 -height 100 pack .f list [image inuse gorp] [.f configure -backgroundimage gorp;update] \ [image inuse gorp] [winfo width .f] [winfo height .f] } -cleanup { image delete gorp deleteWindows } -result {0 {} 1 100 100} test frame-15.2 {TIP 262: frame background images} -setup { deleteWindows catch {rename gorp ""} } -body { frame .f -width 100 -height 100 pack .f update .f configure -backgroundimage gorp } -returnCodes error -cleanup { deleteWindows } -result {image "gorp" doesn't exist} test frame-15.3 {TIP 262: frame background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { frame .f -width 100 -height 100 -backgroundimage gorp pack .f .f configure -tile yes update list [.f cget -bgimg] [.f cget -tile] } -cleanup { image delete gorp deleteWindows } -result {gorp 1} test frame-15.4 {TIP 262: frame background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { frame .f -width 100 -height 100 -backgroundimage gorp pack .f .f configure -tile yes update gorp put red -to 15 15 20 20 update list [.f cget -bgimg] [.f cget -tile] } -cleanup { image delete gorp deleteWindows } -result {gorp 1} test frame-15.5 {TIP 262: frame background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 set result {} } -body { frame .f -width 100 -height 100 -backgroundimage gorp pack .f .f configure -tile yes update image delete gorp update set result [list [.f cget -bgimg] [.f cget -tile]] image create photo gorp -width 250 -height 250 update lappend result [.f cget -backgroundimage] } -cleanup { catch {image delete gorp} deleteWindows } -result {gorp 1 gorp} test frame-15.6 {TIP 262: frame background images} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 100 -height 100 -bgimg gorp] update idletasks; update return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15}} test frame-15.6a {TIP 262: frame background images (offsets)} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 10 -height 10 -bgimg gorp] update idletasks; update # On MacOS must wait for the test image display procedure to run. set timer [after 300 {lappend result "timedout"}] while {"timedout" ni $result && "gorp display 10 2 10 10" ni $result} { vwait result } after cancel $timer update idletasks; update return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 10 2 10 10}} test frame-15.7 {TIP 262: frame background images} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1] update idletasks; update # On MacOS must wait for the test image display procedure to run. set timer [after 300 {lappend result "timedout"}] while {"timedout" ni $result && "gorp display 0 0 20 10" ni $result} { vwait result } after cancel $timer if {[lindex $result end] eq "timedout"} { return [lreplace $result end end] } return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}} test frame-15.7a {TIP 262: frame background images (offsets)} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -highlightthick 1] update idletasks; update # On MacOS must wait for the test image display procedure to run. set timer [after 300 {lappend result "timedout"}] while {"timedout" ni $result && "gorp display 0 0 18 8" ni $result} { vwait result } after cancel $timer return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 8} {gorp display 0 0 18 15} {gorp display 0 0 18 8}} test frame-15.7b {TIP 262: frame background images (offsets)} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2] update idletasks; update return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 6} {gorp display 0 0 16 15} {gorp display 0 0 16 6}} test frame-15.7c {TIP 262: frame background images (offsets)} -setup { deleteWindows set result {} . configure -width 200 -height 200 } -constraints testImageType -body { image create test gorp -variable result pack [frame .f -width 50 -height 25 -bgimg gorp -tile 1 -bd 2 -highlightthick 1] update idletasks; update return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 4} {gorp display 0 0 14 15} {gorp display 0 0 14 4}} test frame-15.8 {TIP 262: toplevel background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { toplevel .t -width 100 -height 100 update # Used to verify that setting a background image doesn't change the widget size set w [winfo width .t] set h [winfo height .t] list [image inuse gorp] [.t configure -backgroundimage gorp;update] \ [image inuse gorp] \ [expr {$w-[winfo width .t]}] [expr {$h-[winfo height .t]}] } -cleanup { image delete gorp deleteWindows } -result {0 {} 1 0 0} test frame-15.9 {TIP 262: toplevel background images} -setup { deleteWindows catch {rename gorp ""} } -body { toplevel .t -width 100 -height 100 update .t configure -backgroundimage gorp } -returnCodes error -cleanup { deleteWindows } -result {image "gorp" doesn't exist} test frame-15.10 {TIP 262: toplevel background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes update list [.t cget -bgimg] [.t cget -tile] } -cleanup { image delete gorp deleteWindows } -result {gorp 1} test frame-15.11 {TIP 262: toplevel background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 } -body { toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes update gorp put red -to 15 15 20 20 update list [.t cget -bgimg] [.t cget -tile] } -cleanup { image delete gorp deleteWindows } -result {gorp 1} test frame-15.12 {TIP 262: toplevel background images} -setup { deleteWindows image create photo gorp -width 10 -height 10 gorp put black -to 2 2 7 7 set result {} } -body { toplevel .t -width 100 -height 100 -backgroundimage gorp -tile yes update image delete gorp update set result [list [.t cget -bgimg] [.t cget -tile]] image create photo gorp -width 250 -height 250 update lappend result [.t cget -backgroundimage] } -cleanup { catch {image delete gorp} deleteWindows } -result {gorp 1 gorp} test frame-15.13 {TIP 262: toplevel background images} -setup { deleteWindows set result {} } -constraints testImageType -body { image create test gorp -variable result toplevel .t -width 100 -height 100 -bgimg gorp wm overrideredirect .t 1; # Reduce trouble from window managers update idletasks; update return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15}} test frame-15.14 {TIP 262: toplevel background images} -setup { deleteWindows set result {} } -constraints testImageType -body { image create test gorp -variable result toplevel .t -width 50 -height 25 -bgimg gorp -tile 1 wm overrideredirect .t 1; # Reduce trouble from window managers update idletasks; update # On MacOS must wait for the test image display procedure to run. set timer [after 300 {lappend result "timedout"}] while {"timedout" ni $result && "gorp display 0 0 20 10" ni $result} { vwait result } after cancel $timer return [uniq $result] } -cleanup { deleteWindows catch {image delete gorp} } -result {{gorp get} {gorp display 0 0 30 15} {gorp display 0 0 30 10} {gorp display 0 0 20 15} {gorp display 0 0 20 10}} # cleanup deleteWindows apply {cmds {foreach cmd $cmds {rename $cmd {}}}} { eatColors colorsFree uniq optnames } cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/geometry.test.
︙ | ︙ | |||
266 267 268 269 270 271 272 | } destroy .t } -body { toplevel .t wm geometry .t +0+0 tkwait visibility .t update | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | } destroy .t } -body { toplevel .t wm geometry .t +0+0 tkwait visibility .t update pack [frame .t.f] button .t.quit -text Quit -command exit pack .t.quit -in .t.f wm iconify .t set x 0 after 500 {set x 1} tkwait variable x wm deiconify .t |
︙ | ︙ |
Changes to tests/grid.test.
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | } -returnCodes ok -result {} test grid-1.9 {basic argument checking} -body { button .b grid configure x .b } -cleanup { grid_reset 1.9 } -returnCodes ok -result {} test grid-2.1 {bbox} -body { grid bbox . } -result {0 0 0 0} test grid-2.2 {bbox} -body { button .b grid .b | > | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | } -returnCodes ok -result {} test grid-1.9 {basic argument checking} -body { button .b grid configure x .b } -cleanup { grid_reset 1.9 } -returnCodes ok -result {} test grid-2.1 {bbox} -body { grid bbox . } -result {0 0 0 0} test grid-2.2 {bbox} -body { button .b grid .b |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 | } -result {.b} test grid-3.9 {configure: basic argument checking} -body { button .b grid configure y .b } -cleanup { grid_reset 3.9 } -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'} test grid-4.1 {forget: basic argument checking} -body { grid forget foo } -returnCodes error -result {bad window path name "foo"} test grid-4.2 {forget} -body { button .c grid [button .b] | > > > > > > > > > > > > > > > > > > > > > > > > | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | } -result {.b} test grid-3.9 {configure: basic argument checking} -body { button .b grid configure y .b } -cleanup { grid_reset 3.9 } -returnCodes error -result {invalid window shortcut, "y" should be '-', 'x', or '^'} test grid-3.10 {ConfigureSlave procedure, bad -in option} -body { frame .f grid .f -in .f } -cleanup { grid_reset 3.10 } -returnCodes error -result {window can't be managed in itself} test grid-3.11 {prevent management loops} -body { frame .f1 frame .f2 grid .f1 -in .f2 grid .f2 -in .f1 } -cleanup { grid_reset 3.11 } -returnCodes error -result {can't put .f2 inside .f1, would cause management loop} test grid-3.12 {prevent management loops} -body { frame .f1 frame .f2 frame .f3 grid .f1 -in .f2 grid .f2 -in .f3 grid .f3 -in .f1 } -cleanup { grid_reset 3.12 } -returnCodes error -result {can't put .f3 inside .f1, would cause management loop} test grid-4.1 {forget: basic argument checking} -body { grid forget foo } -returnCodes error -result {bad window path name "foo"} test grid-4.2 {forget} -body { button .c grid [button .b] |
︙ | ︙ | |||
1796 1797 1798 1799 1800 1801 1802 | frame .t.f label .t.f.l -text foobar grid .t.f.l destroy .t set result ok } -result ok | < | 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 | frame .t.f label .t.f.l -text foobar grid .t.f.l destroy .t set result ok } -result ok test grid-18.1 {test respect for internalborder} -body { toplevel .pack wm geometry .pack 200x200 frame .pack.l -width 15 -height 10 labelframe .pack.lf -labelwidget .pack.l pack .pack.lf -fill both -expand 1 frame .pack.lf.f |
︙ | ︙ | |||
2013 2014 2015 2016 2017 2018 2019 | pack .f update pack forget .f update winfo ismapped .t ; # must return 1 } {1} grid_reset 23 | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 | pack .f update pack forget .f update winfo ismapped .t ; # must return 1 } {1} grid_reset 23 test grid-24.1 {<<NoManagedChild>> fires on last grid forget} -setup { global A unset -nocomplain A } -body { grid [frame .1] update bind . <<NoManagedChild>> {set A 1} grid forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} grid_reset 24.1 } -result {1} test grid-24.2 {<<NoManagedChild>> fires on last grid remove} -setup { global A unset -nocomplain A } -body { grid [frame .1] update bind . <<NoManagedChild>> {set A 1} grid remove .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} grid_reset 24.2 } -result {1} test grid-24.3 {<<NoManagedChild>> fires on last gridded child destruction} -setup { global A unset -nocomplain A } -body { grid [frame .1] update bind . <<NoManagedChild>> {incr A} destroy .1 update set A } -cleanup { bind . <<NoManagedChild>> {} grid_reset 24.3 } -result {1} test grid-24.4 {<Configure> does not fire on last grid forget} -setup { global A unset -nocomplain A } -body { grid [frame .1] update bind . <Configure> {set A 1} grid forget .1 update info exists A } -cleanup { bind . <Configure> {} grid_reset 24.4 } -result {0} test grid-24.5 {<Configure> fires on forelast grid forget} -setup { global A unset -nocomplain A } -body { grid [frame .1] grid [frame .2] update bind . <Configure> {set A 1} grid forget .1 update info exists A } -cleanup { bind . <Configure> {} grid_reset 24.5 } -result {1} test grid-24.6 {<<NoManagedChild>> does not fire on forelast grid forget} -setup { global A unset -nocomplain A } -body { grid [frame .1] grid [frame .2] update bind . <<NoManagedChild>> {set A 1} grid forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} grid_reset 24.6 } -result {0} test grid-24.7 {<<NoManagedChild>> does not fire on grid anchor} -setup { global A unset -nocomplain A } -body { bind . <<NoManagedChild>> {set A 1} grid anchor . w update info exists A } -cleanup { grid anchor . nw bind . <<NoManagedChild>> {} grid_reset 24.7 } -result {0} test grid-24.8 {<<NoManagedChild>> does not fire on last grid forget if propagation is off} -setup { global A unset -nocomplain A } -body { grid [frame .1] grid propagate . 0 update bind . <<NoManagedChild>> {set A 1} grid forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} grid_reset 24.8 } -result {0} # cleanup cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/image.test.
︙ | ︙ | |||
29 30 31 32 33 34 35 | test image-1.3 {Tk_ImageCmd procedure, "create" option} -body { image create } -returnCodes error -result {wrong # args: should be "image create type ?name? ?-option value ...?"} test image-1.4 {Tk_ImageCmd procedure, "create" option} -body { image c bad_type } -returnCodes error -result {image type "bad_type" doesn't exist} test image-1.5 {Tk_ImageCmd procedure, "create" option} -constraints { | | | | | > > > > > > > > > > | | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | test image-1.3 {Tk_ImageCmd procedure, "create" option} -body { image create } -returnCodes error -result {wrong # args: should be "image create type ?name? ?-option value ...?"} test image-1.4 {Tk_ImageCmd procedure, "create" option} -body { image c bad_type } -returnCodes error -result {image type "bad_type" doesn't exist} test image-1.5 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -body { list [image create test myimage] [imageNames] } -cleanup { imageCleanup } -result {myimage myimage} test image-1.6 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -setup { imageCleanup } -body { scan [image create test] image%d first image create test myimage scan [image create test -variable x] image%d second expr {$second-$first} } -cleanup { imageCleanup } -result {1} test image-1.7 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage -variable x .c create image 100 50 -image myimage .c create image 100 150 -image myimage update set x {} set timer [after 500 {lappend x "timeout"}] image create test myimage -variable x update idletasks update # On MacOS we need to wait for the test image display procedure to run. while {"timeout" ni $x && [lindex $x end 1] ne "display"} { vwait x } after cancel timer if {[lindex $x end] eq "timeout"} { return [lreplace $x end end] } return $x } -cleanup { imageCleanup } -result {{myimage free} {myimage free} {myimage delete} {myimage get} {myimage get} {myimage display 0 0 30 15} {myimage display 0 0 30 15}} test image-1.8 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -setup { .c delete all imageCleanup } -body { image create test myimage -variable x .c create image 100 50 -image myimage .c create image 100 150 -image myimage image delete myimage update set x {} image create test myimage -variable x update return $x } -cleanup { .c delete all imageCleanup } -result {{myimage get} {myimage get} {myimage display 0 0 30 15} {myimage display 0 0 30 15}} test image-1.9 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -body { image create test -badName foo } -returnCodes error -result {bad option name "-badName"} test image-1.10 {Tk_ImageCmd procedure, "create" option} -constraints { testImageType } -body { catch {image create test -badName foo} imageNames } -result {} test image-1.11 {Tk_ImageCmd procedure, "create" option with same name as main window} -body { set code [loadTkCommand] append code { |
︙ | ︙ | |||
138 139 140 141 142 143 144 | image delete $i $j } -result works test image-2.1 {Tk_ImageCmd procedure, "delete" option} -body { image delete } -result {} test image-2.2 {Tk_ImageCmd procedure, "delete" option} -constraints { | | | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | image delete $i $j } -result works test image-2.1 {Tk_ImageCmd procedure, "delete" option} -body { image delete } -result {} test image-2.2 {Tk_ImageCmd procedure, "delete" option} -constraints { testImageType } -setup { imageCleanup set result {} } -body { image create test myimage image create test img2 lappend result [lsort [imageNames]] image d myimage img2 lappend result [imageNames] } -cleanup { imageCleanup } -result {{img2 myimage} {}} test image-2.3 {Tk_ImageCmd procedure, "delete" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage image create test img2 image delete myimage gorp img2 } -cleanup { imageCleanup } -returnCodes error -result {image "gorp" doesn't exist} test image-2.4 {Tk_ImageCmd procedure, "delete" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage image create test img2 catch {image delete myimage gorp img2} imageNames |
︙ | ︙ | |||
186 187 188 189 190 191 192 | test image-3.2 {Tk_ImageCmd procedure, "height" option} -body { image height a b } -returnCodes error -result {wrong # args: should be "image height name"} test image-3.3 {Tk_ImageCmd procedure, "height" option} -body { image height foo } -returnCodes error -result {image "foo" doesn't exist} test image-3.4 {Tk_ImageCmd procedure, "height" option} -constraints { | | | | 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | test image-3.2 {Tk_ImageCmd procedure, "height" option} -body { image height a b } -returnCodes error -result {wrong # args: should be "image height name"} test image-3.3 {Tk_ImageCmd procedure, "height" option} -body { image height foo } -returnCodes error -result {image "foo" doesn't exist} test image-3.4 {Tk_ImageCmd procedure, "height" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage set x [image h myimage] myimage changed 0 0 0 0 60 50 list $x [image height myimage] } -cleanup { imageCleanup } -result {15 50} test image-4.1 {Tk_ImageCmd procedure, "names" option} -body { image names x } -returnCodes error -result {wrong # args: should be "image names"} test image-4.2 {Tk_ImageCmd procedure, "names" option} -constraints { testImageType } -setup { catch {interp delete testinterp} } -body { interp create testinterp load {} Tk testinterp interp eval testinterp { image delete {*}[image names] |
︙ | ︙ | |||
245 246 247 248 249 250 251 | image type a b } -returnCodes error -result {wrong # args: should be "image type name"} test image-5.3 {Tk_ImageCmd procedure, "type" option} -body { image type foo } -returnCodes error -result {image "foo" doesn't exist} test image-5.4 {Tk_ImageCmd procedure, "type" option} -constraints { | | | | | | | | | > > > > > | > > > > > > > | > > > > > > < | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | image type a b } -returnCodes error -result {wrong # args: should be "image type name"} test image-5.3 {Tk_ImageCmd procedure, "type" option} -body { image type foo } -returnCodes error -result {image "foo" doesn't exist} test image-5.4 {Tk_ImageCmd procedure, "type" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage image type myimage } -cleanup { imageCleanup } -result {test} test image-5.5 {Tk_ImageCmd procedure, "type" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage .c create image 50 50 -image myimage image delete myimage image type myimage } -cleanup { imageCleanup } -returnCodes error -result {image "myimage" doesn't exist} test image-5.6 {Tk_ImageCmd procedure, "type" option} -constraints { testOldImageType } -setup { imageCleanup } -body { image create oldtest myimage image type myimage } -cleanup { imageCleanup } -result {oldtest} test image-5.7 {Tk_ImageCmd procedure, "type" option} -constraints { testOldImageType } -setup { .c delete all imageCleanup } -body { image create oldtest myimage .c create image 50 50 -image myimage image delete myimage image type myimage } -cleanup { .c delete all imageCleanup } -returnCodes error -result {image "myimage" doesn't exist} test image-6.1 {Tk_ImageCmd procedure, "types" option} -body { image types x } -returnCodes error -result {wrong # args: should be "image types"} test image-6.2 {Tk_ImageCmd procedure, "types" option} -constraints { testImageType } -body { lsort [image types] } -result {bitmap oldtest photo test} test image-7.1 {Tk_ImageCmd procedure, "width" option} -body { image width } -returnCodes error -result {wrong # args: should be "image width name"} test image-7.2 {Tk_ImageCmd procedure, "width" option} -body { image width a b } -returnCodes error -result {wrong # args: should be "image width name"} test image-7.3 {Tk_ImageCmd procedure, "width" option} -body { image width foo } -returnCodes error -result {image "foo" doesn't exist} test image-7.4 {Tk_ImageCmd procedure, "width" option} -constraints { testImageType } -setup { imageCleanup } -body { image create test myimage set x [image w myimage] myimage changed 0 0 0 0 60 50 list $x [image width myimage] } -cleanup { imageCleanup } -result {30 60} test image-8.1 {Tk_ImageCmd procedure, "inuse" option} -constraints { testImageType } -setup { imageCleanup set res {} destroy .b } -body { image create test myimage2 lappend res [image inuse myimage2] button .b -image myimage2 lappend res [image inuse myimage2] } -cleanup { imageCleanup catch {destroy .b} } -result [list 0 1] if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} { # Aqua >= 10.14 will redraw the entire image in drawRect. set result_9_1 {{foo display 0 0 30 15}} } else { set result_9_1 {{foo display 5 6 7 8}} } test image-9.1 {Tk_ImageChanged procedure} -constraints testImageType -setup { .c delete all imageCleanup update } -body { image create test foo -variable x .c create image 50 50 -image foo update set x {} set timer [after 500 {lappend x "timeout"}] foo changed 5 6 7 8 30 15 update idletasks update # On MacOS we need to wait for the test image display procedure to run. while {"timeout" ni $x && [lindex $x end 1] ne "display"} { vwait x } after cancel timer return $x } -cleanup { .c delete all imageCleanup } -result $result_9_1 if {[tk windowingsystem] == "aqua" && $tcl_platform(osVersion) > 18} { # Aqua >= 10.14 will redraw the entire image. set result_9_2 {{foo display 0 0 30 15} {foo display 0 0 30 15}} } else { set result_9_2 {{foo display 5 6 25 9} {foo display 0 0 12 14}} } test image-9.2 {Tk_ImageChanged procedure} -constraints testImageType -setup { .c delete all imageCleanup update } -body { image create test foo -variable x .c create image 50 50 -image foo .c create image 90 100 -image foo update set x {} foo changed 5 6 7 8 30 15 update return $x } -cleanup { .c delete all imageCleanup } -result $result_9_2 test image-10.1 {Tk_GetImage procedure} -setup { imageCleanup } -body { .c create image 100 10 -image bad_name } -cleanup { imageCleanup |
︙ | ︙ | |||
611 612 613 614 615 616 617 | lappend x [imageNames] image create photo foo -width 20 -height 20 lappend x [.c bbox i1] [imageNames] } -cleanup { .c delete all imageCleanup } -result {10 10 20 20 foo {} {10 10 30 30} foo} | | | 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | lappend x [imageNames] image create photo foo -width 20 -height 20 lappend x [.c bbox i1] [imageNames] } -cleanup { .c delete all imageCleanup } -result {10 10 20 20 foo {} {10 10 30 30} foo} destroy .c imageFinish # cleanup cleanupTests return # Local variables: # mode: tcl # End: |
Added tests/imgListFormat.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | # This file is a Tcl script to test out the default image data format # ("list format") implementend in the file tkImgListFormat.c. # It is organized in the standard fashion for Tcl tests. # # Copyright (c) 2017 Simon Bachmann # All rights reserved. # # Author: Simon Bachmann ([email protected]) package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands imageInit # find the teapot.ppm file for use in these tests set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm] testConstraint hasTeapotPhoto [file exists $teapotPhotoFile] # let's see if we have the semi-transparent one as well set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png] testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile] # --------------------------------------------------------------------- test imgListFormat-1.1 {ParseFormatOptions: default values} -setup { image create photo photo1 } -body { photo1 put {{red green} {blue black}} lindex [photo1 data] 1 1 } -cleanup { imageCleanup } -result {#000000} test imgListFormat-1.2 {ParseFormatOptions: format name as first arg} -setup { image create photo photo1 } -body { photo1 put #1256ef -format {default} -to 0 0 10 10 } -cleanup { imageCleanup } -result {} test imgListFormat-1.3 {ParseFormatOptions: unknown option} -setup { image create photo photo1 } -body { photo1 data -format {default -bogus} } -cleanup { imageCleanup } -returnCodes error -result {bad format option "-bogus": must be -colorformat} test imgListFormat-1.4 {ParseFormatOptions: option not allowed} -setup { image create photo photo1 } -body { photo1 put yellow -format {default -colorformat rgb} } -cleanup { imageCleanup } -returnCodes error -result \ {bad format option "-colorformat": no options allowed} test imgListFormat-1.5 {ParseFormatOptions: no -colorformat value} -setup { image create photo photo1 -data black } -body { photo1 data -format {default -colorformat} } -returnCodes error -result {the "-colorformat" option requires a value} test imgListFormat-1.6 {ParseFormatOptions: bad -colorformat val #1} -setup { image create photo photo1 } -body { photo1 put yellow photo1 data -format {default -colorformat bogus} } -cleanup { imageCleanup } -returnCodes error -result \ {bad color format "bogus": must be rgb, rgba, or list} test imgListFormat-1.7 {ParseFormatOptions: bad -colorformat val #2} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat tkcolor} } -returnCodes error -result \ {bad color format "tkcolor": must be rgb, rgba, or list} test imgListFormat-1.8 {ParseFormatOptions: bad -colorformat #3} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat emptystring} } -returnCodes error -result \ {bad color format "emptystring": must be rgb, rgba, or list} test imgListFormat-1.9 {ParseFormatOptions: bad -colorformat #4} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat rgb-short} } -cleanup { imageCleanup } -returnCodes error -result \ {bad color format "rgb-short": must be rgb, rgba, or list} test imgListFormat-1.10 {ParseFormatOptions: bad -colorformat #5} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat rgba-short} } -returnCodes error -result \ {bad color format "rgba-short": must be rgb, rgba, or list} test imgListFormat-1.11 {valid colorformats} -setup { image create photo photo1 } -body { photo1 put white#78 set result {} lappend result [photo1 data -format {default -colorformat rgb}] lappend result [photo1 data -format {default -colorformat rgba}] lappend result [photo1 data -format {default -colorformat list}] set result } -cleanup { imageCleanup unset result } -result {{{#ffffff}} {{#ffffff78}} {{{255 255 255 120}}}} # GetBadOptMsg: only use case already tested with imgListFormat-1.4 test imgListFormat-3.1 {StringMatchDef: data is not a list} -body { testphotostringmatch {not a " proper list} # " (this comment is here only for editor highlighting) } -returnCodes error -result {unmatched open quote in list} # empty data case tested with imgPhoto-4.95 (imgPhoto.test) test imgListFormat-3.2 {StringMatchDef: \ list element not a proper list} -body { testphotostringmatch {{red white} {not "} {blue green}} # " } -returnCodes error -result {unmatched open quote in list} test imgListFormat-3.3 {StringMatchDef: \ sublists with differen lengths} -body { testphotostringmatch {{#001122 #334455 #667788} {#99AABB #CCDDEE} {#FF0011 #223344 #556677}} } -returnCodes error -result \ {invalid row # 1: all rows must have the same number of elements} test imgListFormat-3.4 {StringMatchDef: base64 data is not parsed as valid \ } -setup { image create photo photo1 } -body { photo1 put { iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCA YAAAEFsT2yAAAABGdBTUEAAYagMeiWXwAA ABdJREFUCJkFwQEBAAAAgiD6P9pACRoqDk fUBvt1wUFKAAAAAElFTkSuQmCC } -format default } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCA"} test imgListFormat-3.5 {StringMatchDef: valid data} -setup { image create photo photo1 } -body { photo1 put {{blue green} {yellow magenta} {#000000 #FFFFFFFF}} list [image width photo1] [image height photo1] \ [photo1 get 0 2 -withalpha] } -cleanup { imageCleanup } -result {2 3 {0 0 0 255}} # ImgStringRead: most of the error cases cannot be tested with current code, # as the errors are detected by StringMatchDef test imgListFormat-4.1 {StringReadDef: use with -format opt} -setup { image create photo photo1 } -body { photo1 put white -format "default" photo1 get 0 0 } -cleanup { imageCleanup } -result {255 255 255} test imgListFormat-4.2 {StringReadDef: suboptions to format} -setup { image create photo photo1 } -body { photo1 put white -format {default -bogus} } -cleanup { imageCleanup } -returnCodes error -result \ {bad format option "-bogus": no options allowed} test imgListFormat-4.3 {StringReadDef: erroneous non-option argument} -setup { image create photo photo1 } -body { photo1 put orange -format {default bogus} } -returnCodes error -result {bad format option "bogus": no options allowed} test imgListFormat-4.4 {StringReadDef: normal use case} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { set imgData [photo1 data] photo2 put $imgData string equal [photo1 data] [photo2 data] } -cleanup { imageCleanup unset imgData } -result {1} test imgListFormat-4.5 {StringReadDef: correct compositing rule} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile image create photo photo2 } -body { photo2 put #FF0000 -to 0 0 50 50 photo2 put [photo1 data -format {default -colorformat rgba}] -to 10 10 40 40 list [photo2 get 0 0 -withalpha] [photo2 get 20 25 -withalpha] \ [photo2 get 49 49 -withalpha] } -cleanup { imageCleanup } -result {{255 0 0 255} {0 78 185 225} {255 0 0 255}} test imgListFormat-5.1 {StringWriteDef: format options not a list} -setup { image create photo photo1 } -body { photo1 data -format {default " bogus} # " } -cleanup { imageCleanup } -returnCodes error -result {unmatched open quote in list} test imgListFormat-5.2 {StringWriteDef: invalid format option} -setup { image create photo photo1 } -body { photo1 data -format {default -bogus} } -cleanup { imageCleanup } -returnCodes error -result {bad format option "-bogus": must be -colorformat} test imgListFormat-5.3 {StringWriteDef: non-option arg in format} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat list bogus} } -cleanup { imageCleanup } -returnCodes error -result {bad format option "bogus": must be -colorformat} test imgListFormat-5.4 {StringWriteDef: empty image} -setup { image create photo photo1 } -body { photo1 data -format {default -colorformat rgba} } -cleanup { imageCleanup } -result {} test imgListFormat-5.5 {StirngWriteDef: size of data} -setup { image create photo photo1 } -body { photo1 put blue -to 0 0 35 64 set imgData [photo1 data] list [llength [lindex $imgData 0]] [llength $imgData] } -cleanup { unset imgData imageCleanup } -result {35 64} test imgListFormat-5.6 {StringWriteDef: test some pixels #1} -constraints { hasTeapotPhoto } -setup { set result {} image create photo photo1 -file $teapotPhotoFile } -body { set imgData [photo1 data] # note: with [lindex], the coords are inverted (y x) lappend result [lindex $imgData 0 0] lappend result [lindex $imgData 3 2] lappend result [lindex $imgData 107 53] lappend result [lindex $imgData 203 157] lappend result [lindex $imgData 255 255] set result } -cleanup { unset result unset imgData imageCleanup } -result {{#135cc0} #135cc0 #a06d52 #e1c8ba #135cc0} test imgListFormat-5.7 {StringWriteDef: test some pixels #2} -constraints { hasTeapotPhoto } -setup { set result {} image create photo photo1 -file $teapotPhotoFile } -body { set imgData [photo1 data -format {default -colorformat rgba}] # note: with [lindex], the coords are inverted (y x) lappend result [lindex $imgData 0 0] lappend result [lindex $imgData 3 2] lappend result [lindex $imgData 107 53] lappend result [lindex $imgData 203 157] lappend result [lindex $imgData 255 255] set result } -cleanup { unset result unset imgData imageCleanup } -result {{#135cc0ff} #135cc0ff #a06d52ff #e1c8baff #135cc0ff} test imgListFormat-5.8 {StringWriteDef: test some pixels #3} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile } -body { set imgData [photo1 data -format {default -colorformat rgb}] set result {} lappend result [lindex $imgData 3 2] lappend result [lindex $imgData 107 53] lappend result [lindex $imgData 203 157] set result } -cleanup { unset result unset imgData imageCleanup } -result {{#004eb9} #a14100 #ffca9f} test imgListFormat-5.9 {StringWriteDef: test some pixels #4} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile } -body { set imgData [photo1 data -format {default -colorformat rgba}] set result [lindex $imgData 3 2] lappend result [lindex $imgData 107 53] lappend result [lindex $imgData 203 157] set result } -cleanup { unset result unset imgData imageCleanup } -result {{#004eb9e1} #a14100aa #ffca9faf} test imgListFormat-5.10 {StringWriteDef: test some pixels #5} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile } -body { set imgData [photo1 data -format {default -colorformat list}] set result {} lappend result [lindex $imgData 3 2] lappend result [lindex $imgData 107 53] lappend result [lindex $imgData 203 157] set result } -cleanup { unset imgData unset result imageCleanup } -result {{0 78 185 225} {161 65 0 170} {255 202 159 175}} test imgListFormat-6.1 {ParseColor: empty string} -setup { image create photo photo1 set result {} } -body { photo1 put {{"" ""} {"" ""}} lappend result [image width photo1] lappend result [image height photo1] lappend result [photo1 get 1 1 -withalpha] set result } -cleanup { unset result imageCleanup } -result {2 2 {0 0 0 0}} test imgListFormat-6.2 {ParseColor: empty string, mixed} -setup { image create photo photo1 } -body { photo1 put {{black white} {{} white}} list [photo1 get 0 0 -withalpha] [photo1 get 0 1 -withalpha] } -cleanup { imageCleanup } -result {{0 0 0 255} {0 0 0 0}} test imgListFormat-6.3 {ParseColor: color name too long} -setup { image create photo photo1 set longstr {} for {set i 1} {$i <= 100} {incr i} { append longstr "z" } } -body { photo1 put [list [list blue] [list $longstr]] } -cleanup { imageCleanup unset longstr } -returnCodes error -result {invalid color} test imgListFormat-6.4 {ParseColor: #XXX color, different forms} -setup { image create photo photo1 } -body { photo1 put {{#A123 #334455} {#012 #fffefd#00}} photo1 data -format {default -colorformat rgba} } -cleanup { imageCleanup } -result {{#aa112233 #334455ff} {#001122ff #fffefd00}} test imgListFormat-6.5 {ParseColor: list format} -setup { image create photo photo1 } -body { photo1 put [list [list [list 255 255 255]]] photo1 get 0 0 -withalpha } -cleanup { imageCleanup } -result {255 255 255 255} test imgListFormat-6.6 {ParseColor: string format} -setup { image create photo photo1 } -body { photo1 put [list [list [list white]]] photo1 get 0 0 -withalpha } -cleanup { imageCleanup } -result {255 255 255 255} test imgListFormat-6.7 {ParseColor: invalid color} -setup { image create photo photo1 } -body { photo1 put {{blue red} {green bogus}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "bogus"} test imgListFormat-6.8 {ParseColor: overall test} -setup { image create photo photo1 set result {} } -body { photo1 put { {[email protected] snow#80 snow#8 #[email protected] #fffffabbfacc#8} {#fffffafffaff#80 #[email protected] #ffffaafaa#8 #ffffaafaa#80 #fee#8} {#fee#80 #[email protected] #[email protected] #fffafa#8 #fffafa#80} {{0xff 250 0xfa 128} {255 250 250} #fee8 #fffafa80 snow}} for {set y 0} {$y < 4} {incr y} { for {set x 0} {$x < 5} {incr x} { lappend result [photo1 get $x $y -withalpha] } } set result } -cleanup { imageCleanup unset result } -result \ {{255 250 250 128} {255 250 250 128} {255 250 250 136} {255 250 250 128}\ {255 250 250 136} {255 250 250 128} {255 250 250 128} {255 250 250 136}\ {255 250 250 128} {255 238 238 136} {255 238 238 128} {255 238 238 128}\ {255 250 250 128} {255 250 250 136} {255 250 250 128} {255 250 250 128}\ {255 250 250 255} {255 238 238 136} {255 250 250 128} {255 250 250 255}} # Note: these tests were written for an earlier implementation of # ParseColorAsList. For this reason, their order and layout do not follow the # current code very well. Test coverage is pretty good, nevertheless. test imgListFormat-7.1 {ParseColorAsList: invalid list} -setup { image create photo photo1 } -body { photo1 put {{{123 45 67 89} {123 45 " 67}}} #" } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "123 45 " 67"} #" test imgListFormat-7.2 {ParseColorAsList: too few elements in list} -setup { image create photo photo1 } -body { photo1 put {{{0 255 0 255} {0 255}}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "0 255"} test imgListFormat-7.3 {ParseColorAsList: too many elements in list} -setup { image create photo photo1 } -body { photo1 put {{{0 100 200 255} {0 100 200 255 0}}} } -returnCodes error -result {invalid color name "0 100 200 255 0"} test imgListFormat-7.4 {ParseColorAsList: not an integer value} -setup { image create photo photo1 } -body { photo1 put {{{9 0xf3 87 65} {43 21 10 1.0}}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "43 21 10 1.0"} test imgListFormat-7.5 {ParseColorAsList: negative value in list} -setup { image create photo photo1 } -body { photo1 put {{{121 121 121} {121 121 -1}}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "121 121 -1"} test imgListFormat-7.6 {ParseColorAsList: value in list too large} -setup { image create photo photo1 } -body { photo1 put {{{0 1 2 3} {254 255 256}}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "254 255 256"} test imgListFormat-7.7 {ParseColorAsList: suffix not allowed} -setup { image create photo photo1 } -body { photo1 put {{{100 100 100} {100 100 100#FE}}} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "100 100 100#FE"} test imgListFormat-7.8 {ParseColorAsList: valid list form} -setup { image create photo photo1 } -body { photo1 put {{{0x0 0x10 0xfe 0xff} {0 100 254}} {{30 30 30 0} {1 1 254 1}}} list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha] \ [photo1 get 0 1 -withalpha] [photo1 get 1 1 -withalpha] } -cleanup { imageCleanup } -result {{0 16 254 255} {0 100 254 255} {30 30 30 0} {1 1 254 1}} test imgListFormat-7.9 {ParseColorAsList: additional spaces in list} -setup { image create photo photo1 } -body { photo1 put { { { 1 2 3} {1 2 3} } { {1 2 3 } { 1 2 3 4 } } } photo1 data -format {default -colorformat rgba} } -cleanup { imageCleanup } -result {{#010203ff #010203ff} {#010203ff #01020304}} test imgListFormat-7.10 {ParseColorAsList: list format, string rep} -setup { image create photo photo1 } -body { photo1 put {{"111 222 33 44"}} photo1 get 0 0 -withalpha } -cleanup { imageCleanup } -result {111 222 33 44} test imgListFormat-8.1 {ParseColorAsHex: RGB format} -setup { image create photo photo1 } -body { photo1 put {{#010 #001100}} photo1 data } -cleanup { imageCleanup } -result {{#001100 #001100}} test imgListFormat-8.2 {ParseColorAsHex: invalid hex digit} -setup { image create photo photo1 } -body { photo1 put {#ABCD #ABCZ} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "#ABCZ"} test imgListFormat-8.3 {ParseColorAsHex: RGB with suffix, 8 chars} -setup { image create photo photo1 } -body { photo1 put {{#FFfFFf #AbCdef#0}} photo1 data } -cleanup { imageCleanup } -result {{#ffffff #abcdef}} test imgListFormat-8.4 {ParseColor: valid #RGBA color} -setup { image create photo photo1 } -body { photo1 put {{#9bd5020d #7acF}} list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha] } -cleanup { imageCleanup } -result {{155 213 2 13} {119 170 204 255}} test imgListFormat-9.1 {ParseColorAsStandard: Tk color, valid suffixes} -setup { image create photo photo1 set result {} } -body { photo1 put {{[email protected] #114433#C} {#8D4#1A magenta}} lappend result [photo1 get 0 0 -withalpha] lappend result [photo1 get 1 0 -withalpha] lappend result [photo1 get 0 1 -withalpha] lappend result [photo1 get 1 1 -withalpha] set result } -cleanup { unset result imageCleanup } -result {{0 0 255 181} {17 68 51 204} {136 221 68 26} {255 0 255 255}} test imgListFormat-9.2 {ParseColorAsStandard: Tk color with and w/o suffixes} -setup { image create photo photo1 set result {} } -body { photo1 put {{#52D8a0 #2B5} {#[email protected] maroon#4}} lappend result [photo1 get 0 0 -withalpha] lappend result [photo1 get 1 0 -withalpha] lappend result [photo1 get 0 1 -withalpha] lappend result [photo1 get 1 1 -withalpha] set result } -cleanup { unset result imageCleanup } -result {{82 216 160 255} {34 187 85 255} {238 68 119 3} {128 0 0 68}} test imgListFormat-9.3 {ParseColorAsStandard: wrong digit count} -setup { image create photo photo1 } -body { photo1 put {{#000 #00}} } -returnCodes error -result {invalid color name "#00"} test imgListFormat-9.4 {ParseColorAsStandard: @A suffix, not a float} -setup { image create photo photo1 } -body { photo1 put {{[email protected] blue@bogus}} } -cleanup { imageCleanup } -returnCodes error -result \ {invalid alpha suffix "@bogus": expected floating-point value} test imgListFormat-9.5 {ParseColorAsStandard: @A, value too low} -setup { image create photo photo1 } -body { photo1 put {[email protected] [email protected]} } -cleanup { imageCleanup } -returnCodes error -result \ {invalid alpha suffix "@-0.1": value must be in the range from 0 to 1} test imgListFormat-9.6 {ParseColorAsStandard: @A, value too high} -setup { image create photo photo1 } -body { photo1 put {#000000@0 #[email protected]} } -cleanup { imageCleanup } -returnCodes error -result \ {invalid alpha suffix "@1.0001": value must be in the range from 0 to 1} test imgListFormat-9.7 {ParseColorAsStandard: @A suffix, edge values} -setup { imageCleanup image create photo photo1 } -body { photo1 put {{yellow@1e-22 [email protected] [email protected] \ [email protected]}} list [photo1 get 0 0 -withalpha] [photo1 get 1 0 -withalpha] \ [photo1 get 2 0 -withalpha] [photo1 get 3 0 -withalpha] } -cleanup { imageCleanup } -result {{255 255 0 0} {255 255 0 31} {255 255 0 32} {255 255 0 255}} test imgListFormat-9.8 {ParseColorAsStandard: # suffix, no hex digits} -setup { image create photo photo1 } -body { photo1 put {{black#f} {black#}} } -cleanup { imageCleanup } -returnCodes error -result {invalid alpha suffix "#"} test imgListFormat-9.9 {ParseColorAsStandard: '#' suffix, too many digits} -setup { image create photo photo1 } -body { photo1 put {{#ABC#12 #ABC#123}} } -cleanup { imageCleanup } -returnCodes error -result {invalid alpha suffix "#123"} test imgListFormat-9.10 {ParseColorAsStandard: invalid digit in #X suffix} -setup { image create photo photo1 } -body { photo1 put {#000#a #000#g} } -cleanup { imageCleanup } -returnCodes error -result {invalid alpha suffix "#g": expected hex digit} test imgListFormat-9.11 {ParseColorAsStandard: invalid digit in #XX suffix} -setup { image create photo photo1 } -body { photo1 put {green#2 green#2W} } -cleanup { imageCleanup } -returnCodes error -result {invalid alpha suffix "#2W": expected hex digit} test imgListFormat-9.12 {ParseColorAsStandard: invalid color: not a hex digit} -setup { image create photo photo1 } -body { photo1 put {#[email protected] #[email protected]} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "#[email protected]"} test imgListFormat-9.13 {ParseColorAsStandard: suffix not allowed #1} -setup { image create photo photo1 } -body { photo1 put {#[email protected] #[email protected]} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "#[email protected]"} test imgListFormat-9.14 {ParseColorAsStandard: suffix not allowed #2} -setup { image create photo photo1 } -body { photo1 put {#1111 #1111#1} } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "#1111#1"} # --------------------------------------------------------------------- imageFinish # cleanup cleanupTests return |
Changes to tests/imgPhoto.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # This file is a Tcl script to test out the "photo" image type and the other # procedures in the file tkImgPhoto.c. It is organized in the standard fashion # for Tcl tests. # # Copyright (c) 1994 The Australian National University # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2002-2008 Donal K. Fellows # All rights reserved. # # Author: Paul Mackerras ([email protected]) package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | < < > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | # This file is a Tcl script to test out the "photo" image type and the other # procedures in the file tkImgPhoto.c. It is organized in the standard fashion # for Tcl tests. # # Copyright (c) 1994 The Australian National University # Copyright (c) 1994-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2002-2008 Donal K. Fellows # All rights reserved. # # Author: Paul Mackerras ([email protected]) # # This file is somewhat caothic: the order of the tests does not # really follow the order of the corresponding functions in # tkImgPhoto.c. Probably, because early versions had only a few tests # and over time test cases were added in bits and pieces. # To be noted, also, that this file is not complete: large portions of # code in tkImgPhoto.c have no test coverage. # # To help keeping the overview, the table below lists where to find # tests for each of the functions in tkImgPhoto.c. The function are # listed in the order as they appear in the source file. # # # Function name Tests for function #-------------------------------------------------------------------------- # PhotoFormatThreadExitProc no tests # Tk_Create*PhotoImageFormat no tests # ImgPhotoCreate imgPhoto-2.* # ImgPhotoCmd imgPhoto-4.*, imgPhoto-17.* # GetExtension: no tests # ParseSubcommandOptions: imgPhoto-1.* # ImgPhotoConfigureMaster: imgPhoto-3.*, imgPhoto-15.* # toggleComplexAlphaIfNeeded: no tests # ImgPhotoDelete: imgPhoto-8.* # ImgPhotoCmdDeleteProc: imgPhoto-9.* # ImgPhotoSetSize: no tests # MatchFileFormat: imgPhoto-18.* # MatchSringFormat: imgPhoto-19.* # Tk_FindPhoto: imgPhoto-11.* # Tk_PhotoPutBlock: imgPhoto-10.*, imgPhoto-16.* # Tk_PhotoPutZoomedBlock: imgPhoto-12.* # Tk_DitherPhoto: no tets # Tk_PhotoBlank: no tests # Tk_PhotoExpand: no tests # Tk_PhotoGetSize: no tests # Tk_PhotoSetSize: no tests # TkGetPhotoValidRegion: no tests # ImgGetPhoto: no tests # Tk_PhotoGetImage no tests # ImgPostscriptPhoto no tests # Tk_PhotoPutBlock_NoComposite no tests, probably none needed # Tk_PhotoPutZoomedBlock_NoComposite no tests, probably none needed # Tk_PhotoExpand_Panic no tests, probably none needed # Tk_PhotoPutBlock_Panic no tests, probably none needed # Tk_PhotoPutZoomedBlock_Panic no tests, probably none needed # Tk_PhotoSetSize_Panic no tests, probably none needed #-------------------------------------------------------------------------- # # # Some tests are not specific to a function in tkImgPhoto.c. They are: # # # Test name(s) Description #-------------------------------------------------------------------------- # imgPhoto-5.* Do not really belong to this file. ImgPhotoGet and # ImgPhotoFree are defined in tkImgPhInstance.c. # imgPhoto-6.* Do not really belong to this file. ImgPhotoDisplay # is defined in tkImgPhInstance.c. # imgPhoto-7.* Do not really belong to this file. ImgPhotoFree is # defined in tkImgPhInstance.c. # imgPhoto-13.* Tests for separation in different interpreters # imgPhoto-14.* Test GIF format. Would belong to imgGIF.test # - which does not exist. # package require tcltest 2.2 namespace import ::tcltest::* tcltest::configure {*}$argv tcltest::loadTestedCommands # # Used for imgPhoto-4.65 - imgPhoto-4.73 # proc foreachPixel {img xVar yVar script} { upvar 1 $xVar x $yVar y set width [image width $img] set height [image height $img] for {set x 0} {$x<$width} {incr x} { for {set y 0} {$y<$height} {incr y} { uplevel 1 $script |
︙ | ︙ | |||
54 55 56 57 58 59 60 | set README [makeFile { README -- Tk test suite design document. } README-imgPhoto] # find the teapot.ppm file for use in these tests set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm] testConstraint hasTeapotPhoto [file exists $teapotPhotoFile] | > > > | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | set README [makeFile { README -- Tk test suite design document. } README-imgPhoto] # find the teapot.ppm file for use in these tests set teapotPhotoFile [file join [file dirname [info script]] teapot.ppm] testConstraint hasTeapotPhoto [file exists $teapotPhotoFile] # let's see if we have the semi-transparent one as well set transpTeapotPhotoFile [file join [file dirname [info script]] teapotTransparent.png] testConstraint hasTranspTeapotPhoto [file exists $transpTeapotPhotoFile] proc base64ok {} { expr { ![catch {package require base64}] } } testConstraint base64PackageNeeded [base64ok] |
︙ | ︙ | |||
111 112 113 114 115 116 117 | } -returnCodes error -result {value for "-format" missing} test imgPhoto-1.10 {options for photo images - error case} -body { image create photo -data } -returnCodes error -result {value for "-data" missing} test imgPhoto-1.11 {options for photo images - error case} -body { image create photo photo1 -format } -returnCodes error -result {value for "-format" missing} | > > > > > > > > > > > > > > > > | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | } -returnCodes error -result {value for "-format" missing} test imgPhoto-1.10 {options for photo images - error case} -body { image create photo -data } -returnCodes error -result {value for "-data" missing} test imgPhoto-1.11 {options for photo images - error case} -body { image create photo photo1 -format } -returnCodes error -result {value for "-format" missing} test imgPhoto-1.12 {option -alpha, normal use} -setup { image create photo photo1 } -body { photo1 put "white" -to 0 0 photo1 transparency get 0 0 -alpha } -cleanup { imageCleanup } -result {255} test imgPhoto-1.13 {option -withalpha, normal use} -setup { image create photo photo1 } -body { photo1 put {{blue green}} photo1 get 1 0 -withalpha } -cleanup { imageCleanup } -result {0 128 0 255} test imgPhoto-2.1 {ImgPhotoCreate procedure} -setup { imageCleanup } -body { catch {image create photo -blah blah} imageNames } -result {} test imgPhoto-2.2 {ImgPhotoCreate procedure} -setup { |
︙ | ︙ | |||
134 135 136 137 138 139 140 | # test imgPhoto-2.3 {ImgPhotoCreate procedure: creation failure} { # image create photo photo1 # image create photo photo2 -width 10 -height 10 # catch {image create photo photo2 -file bogus.img} msg # photo1 copy photo2 # set msg # } {couldn't open "bogus.img": no such file or directory} | | | 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | # test imgPhoto-2.3 {ImgPhotoCreate procedure: creation failure} { # image create photo photo1 # image create photo photo2 -width 10 -height 10 # catch {image create photo photo2 -file bogus.img} msg # photo1 copy photo2 # set msg # } {couldn't open "bogus.img": no such file or directory} test imgPhoto-3.1 {ImgPhotoConfigureMaster procedure} -constraints { hasTeapotPhoto } -body { image create photo photo1 -file $teapotPhotoFile photo1 configure -file $teapotPhotoFile } -cleanup { image delete photo1 |
︙ | ︙ | |||
170 171 172 173 174 175 176 | photo1 configure -file $teapotPhotoFile update list [image width photo1] [image height photo1] [.c bbox photo1.1] [.c bbox photo1.2] } -cleanup { destroy .c image delete photo1 } -result {256 256 {10 10 266 266} {300 10 556 266}} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | photo1 configure -file $teapotPhotoFile update list [image width photo1] [image height photo1] [.c bbox photo1.1] [.c bbox photo1.2] } -cleanup { destroy .c image delete photo1 } -result {256 256 {10 10 266 266} {300 10 556 266}} test imgPhoto-3.4 {ImgPhotoConfigureMaster: -data <ppm>} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { photo2 configure -data [photo1 data -format ppm -from 100 100 120 120] list [image width photo2] [image height photo2] } -cleanup { imageCleanup } -result {20 20} test imgPhoto-3.5 {ImgPhotoConfigureMaster: -data <png>} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { photo2 configure -data [photo1 data -format png -from 120 120 140 140] list [image width photo2] [image height photo2] } -cleanup { imageCleanup } -result {20 20} test imgPhoto-3.6 {ImgPhotoConfigureMaster: -data <default>} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { photo2 configure -data [photo1 data -from 80 90 100 110] list [image width photo2] [image height photo2] } -cleanup { imageCleanup } -result {20 20} test imgPhoto-4.1 {ImgPhotoCmd procedure} -setup { image create photo photo1 } -body { photo1 } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 option ?arg ...?"} |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 | lappend result [image width photo1] [image height photo1] photo1 conf -height 0 photo1 copy photo2 -from 0 0 10 10 -shrink lappend result [image width photo1] [image height photo1] } -cleanup { image delete photo1 photo2 } -result {256 256 49 51 49 51 49 51 10 51 10 10} test imgPhoto-4.22 {ImgPhotoCmd procedure: get option} -constraints { | > | | | > > | | | > > | | > > | > > > > | 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | lappend result [image width photo1] [image height photo1] photo1 conf -height 0 photo1 copy photo2 -from 0 0 10 10 -shrink lappend result [image width photo1] [image height photo1] } -cleanup { image delete photo1 photo2 } -result {256 256 49 51 49 51 49 51 10 51 10 10} # tests for <imageName> data: imgPhoto-4. test imgPhoto-4.22 {ImgPhotoCmd procedure: get option} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 } -body { photo1 read $transpTeapotPhotoFile list [photo1 get 100 100 -withalpha] \ [photo1 get 150 100 -withalpha] \ [photo1 get 100 150] [photo1 get 150 150] } -cleanup { image delete photo1 } -result {{175 71 0 162} {179 73 0 168} {14 8 0} {0 0 0}} test imgPhoto-4.23 {ImgPhotoCmd procedure: get option} -setup { image create photo photo1 } -body { photo1 get 256 0 } -cleanup { image delete photo1 } -returnCodes error -result {photo1 get: coordinates out of range} test imgPhoto-4.24 {ImgPhotoCmd procedure: get option} -setup { image create photo photo1 } -body { photo1 get 0 -1 } -cleanup { image delete photo1 } -returnCodes error -result {photo1 get: coordinates out of range} test imgPhoto-4.25 {ImgPhotoCmd procedure: get option} -setup { image create photo photo1 } -body { photo1 get 0 } -cleanup { image delete photo1 } -returnCodes error -result \ {wrong # args: should be "photo1 get x y ?-withalpha?"} # more test for image get: 4.101-4.102 test imgPhoto-4.26 {ImgPhotoCmd procedure: put option} -setup { image create photo photo1 } -body { photo1 put } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 put data ?-option value ...?"} test imgPhoto-4.27 {ImgPhotoCmd procedure: put option} -setup { image create photo photo1 } -body { photo1 put {{white} {white white}} } -returnCodes error -cleanup { image delete photo1 } -result {invalid row # 1: all rows must have the same number of elements} test imgPhoto-4.28 {ImgPhotoCmd procedure: put option} -setup { image create photo photo1 } -body { photo1 put {{blahgle}} } -cleanup { image delete photo1 } -returnCodes error -result {invalid color name "blahgle"} test imgPhoto-4.29 {ImgPhotoCmd procedure: put option} -setup { image create photo photo1 } -body { # SB: odd thing - this test passed with tk 8.6.6, even if the data # is in the wrong position: #photo1 put -to 10 10 20 20 {{white}} # this is how it's supposed to be: photo1 put {{white}} -to 10 10 20 20 photo1 get 19 19 } -cleanup { image delete photo1 } -result {255 255 255} # more tests for image put: 4.90-4.100 test imgPhoto-4.30 {ImgPhotoCmd procedure: read option} -setup { image create photo photo1 } -body { photo1 read } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 read fileName ?-option value ...?"} |
︙ | ︙ | |||
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | test imgPhoto-4.39 {ImgPhotoCmd procedure: write option} -setup { image create photo photo1 } -body { photo1 write teapot.tmp -format bogus } -cleanup { image delete photo1 } -returnCodes error -result {image file format "bogus" is unknown} test imgPhoto-4.40 {ImgPhotoCmd procedure: transparency option} -setup { image create photo photo1 } -body { photo1 transparency } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 transparency option ?arg ...?"} test imgPhoto-4.41 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 transparency get } -returnCodes error -cleanup { image delete photo1 | > | | | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | test imgPhoto-4.39 {ImgPhotoCmd procedure: write option} -setup { image create photo photo1 } -body { photo1 write teapot.tmp -format bogus } -cleanup { image delete photo1 } -returnCodes error -result {image file format "bogus" is unknown} # more tests on "imageName write": imgPhoto-17.* test imgPhoto-4.40 {ImgPhotoCmd procedure: transparency option} -setup { image create photo photo1 } -body { photo1 transparency } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 transparency option ?arg ...?"} test imgPhoto-4.41 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 transparency get } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 transparency get x y ?-option?"} test imgPhoto-4.42 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 transparency get 0 } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 transparency get x y ?-option?"} test imgPhoto-4.43 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 transparency get 0 0 0 -alpha } -returnCodes error -cleanup { image delete photo1 } -result {wrong # args: should be "photo1 transparency get x y ?-option?"} test imgPhoto-4.44 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 transparency get bogus 0 } -cleanup { image delete photo1 } -returnCodes error -result {expected integer but got "bogus"} |
︙ | ︙ | |||
597 598 599 600 601 602 603 604 605 606 607 608 609 | } -body { photo1 put white photo1 blank photo1 transparency get 0 0 } -cleanup { image delete photo1 } -result 1 test imgPhoto-4.52 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set } -returnCodes error -cleanup { image delete photo1 | > > | > | > | | > | > | 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | } -body { photo1 put white photo1 blank photo1 transparency get 0 0 } -cleanup { image delete photo1 } -result 1 # more tests for transparency get: 4.65, 4.66, 4.76-4.81 test imgPhoto-4.52 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set } -returnCodes error -cleanup { image delete photo1 } -result \ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"} test imgPhoto-4.53 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set 0 } -returnCodes error -cleanup { image delete photo1 } -result \ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"} test imgPhoto-4.54 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set 0 0 } -returnCodes error -cleanup { image delete photo1 } -result \ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"} test imgPhoto-4.55 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set 0 0 0 0 -alpha } -returnCodes error -cleanup { image delete photo1 } -result \ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"} test imgPhoto-4.56 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set bogus 0 0 } -cleanup { image delete photo1 } -returnCodes error -result {expected integer but got "bogus"} test imgPhoto-4.57 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 } -body { photo1 transparency set 0 bogus 0 } -cleanup { image delete photo1 } -returnCodes error -result {expected integer but got "bogus"} test imgPhoto-4.58 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 photo1 put blue } -body { photo1 transparency set 0 0 bogus } -cleanup { image delete photo1 } -returnCodes error -result {expected boolean value but got "bogus"} test imgPhoto-4.59 {ImgPhotoCmd procedure: transparency set option} -setup { image create photo photo1 |
︙ | ︙ | |||
692 693 694 695 696 697 698 699 700 701 702 703 704 705 | } -body { photo1 put white photo1 transparency set 0 0 true photo1 transparency get 0 0 } -cleanup { image delete photo1 } -result 1 # Now for some heftier testing, checking that setting and resetting of pixels' # transparency status doesn't "leak" with any one-off errors. test imgPhoto-4.65 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 3 3 checkImgTrans photo1 | > | 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | } -body { photo1 put white photo1 transparency set 0 0 true photo1 transparency get 0 0 } -cleanup { image delete photo1 } -result 1 # more tests for transparency set: 4.67, 4.68, 4.82-4.89 # Now for some heftier testing, checking that setting and resetting of pixels' # transparency status doesn't "leak" with any one-off errors. test imgPhoto-4.65 {ImgPhotoCmd procedure: transparency get option} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 3 3 checkImgTrans photo1 |
︙ | ︙ | |||
817 818 819 820 821 822 823 | image create photo photo1 photo1 read -teapotPhotoFile } -cleanup { image delete photo1 file delete ./-teapotPhotoFile } -result {} test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints { | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 | image create photo photo1 photo1 read -teapotPhotoFile } -cleanup { image delete photo1 file delete ./-teapotPhotoFile } -result {} test imgPhoto-4.76 {ImgPhotoCmd procedure: copy to same image} -constraints { hasTeapotPhoto } -setup { imageCleanup image create photo photo1 -file $teapotPhotoFile } -body { # non-regression test for bug [5239fd749b] - shall just not crash photo1 copy photo1 -to 0 0 2000 1000 photo1 copy photo1 -subsample 2 2 -shrink } -cleanup { imageCleanup } -result {} test imgPhoto-4.76 {ImgPhotoCmd, transparancy get: too many options} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 1 1 photo1 transparency get 0 0 -alpha -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {wrong # args: should be "photo1 transparency get x y ?-option?"} test imgPhoto-4.77 {ImgPhotoCmd, transparency get: invalid option} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 1 1 photo1 transparency get 0 0 -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-bogus": must be -alpha} test imgPhoto-4.78 {ImgPhotoCmd, transparency get: normal use} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 1 1 set result [photo1 transparency get 0 0] lappend result [photo1 transparency get 0 0 -alpha] } -cleanup { imageCleanup } -result {0 255} test imgPhoto-4.79 {ImgPhotoCmd, transparency get: no option} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile set result {} } -body { set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}} foreach coord $pixelCoords { lappend result [photo1 transparency get {*}$coord] } set result } -cleanup { imageCleanup } -result {0 1 0 0 0} # test imgPhoto-4.80: deleted (was transparency get: -boolean) test imgPhoto-4.81 {ImgPhotoCmd, transparency get: -alpha} -constraints { hasTranspTeapotPhoto } -setup { image create photo photo1 -file $transpTeapotPhotoFile set result {} } -body { set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}} foreach coord $pixelCoords { lappend result [photo1 transparency get {*}$coord -alpha] } set result } -cleanup { imageCleanup } -result {255 0 1 254 206} test imgPhoto-4.82 {ImgPhotoCmd, transparency set: too many opts} -setup { image create photo photo1 } -body { photo1 transparency set 0 0 -alpha -bogus 1 } -cleanup { imageCleanup } -returnCodes error -result \ {wrong # args: should be "photo1 transparency set x y newVal ?-option?"} test imgPhoto-4.83 {ImgPhotoCmd, transparency set: invalid opt} -setup { image create photo photo1 -data black } -body { photo1 transparency set 0 0 0 -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-bogus": must be -alpha} test imgPhoto-4.84 {ImgPhotoCmd, transparency set: invalid newVal} -setup { image create photo photo1 -data white } -body { photo1 transparency set 0 0 bogus -alpha } -cleanup { imageCleanup } -returnCodes error -result {expected integer but got "bogus"} test imgPhoto-4.85 {ImgPhotoCmd, transparency set: invalid newVal} -setup { image create photo photo1 -data red } -body { photo1 transparency set 0 0 -1 -alpha } -returnCodes error -result \ {invalid alpha value "-1": must be integer between 0 and 255} test imgPhoto-4.86 {ImgPhotoCmd, transparency set: invalid newVal} -setup { image create photo photo1 -data green } -body { photo1 transparency set 0 0 256 -alpha } -cleanup { imageCleanup } -returnCodes error -result \ {invalid alpha value "256": must be integer between 0 and 255} test imgPhoto-4.87 {ImgPhotoCmd, transparency set: no opt} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 2 1 photo1 transparency set 0 0 0 photo1 transparency set 1 0 1 list [photo1 transparency get 0 0 -alpha] \ [photo1 transparency get 1 0 -alpha] } -cleanup { imageCleanup } -result {255 0} # deleted: test imgPhoto-4.88 {ImgPhotoCmd, transparency set: -boolean} test imgPhoto-4.89 {ImgPhotoCmd, transparency set: -alpha} -setup { image create photo photo1 } -body { photo1 put white -to 0 0 2 2 photo1 transparency set 0 0 0 -alpha photo1 transparency set 1 0 1 -alpha photo1 transparency set 0 1 254 -alpha photo1 transparency set 1 1 255 -alpha list [photo1 transparency get 0 0] [photo1 transparency get 1 0] \ [photo1 transparency get 0 1] [photo1 transparency get 1 1] } -cleanup { imageCleanup } -result {1 0 0 0} test imgPhoto-4.90 {ImgPhotoCmd put: existing but not allowed opt} -setup { image create photo photo1 } -body { photo1 put yellow -from 0 0 1 1 } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-from": must be -format, or -to} test imgPhoto-4.91 {ImgPhotoCmd put: invalid option} -setup { image create photo photo1 } -body { photo1 put {{0 1 2 3}} -bogus x } -returnCodes error -result \ {unrecognized option "-bogus": must be -format, or -to} test imgPhoto-4.92 {ImgPhotocmd put: missing data} -setup { image create photo photo1 } -body { photo1 put -to 0 0 } -returnCodes error -result \ {wrong # args: should be "photo1 put data ?-option value ...?"} test imgPhoto-4.93 {ImgPhotoCmd put: data in ppm format} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { set imgdata [photo1 data -format ppm] photo2 put $imgdata -format ppm set result {} if {[image width photo1] != [image width photo2] \ || [image height photo1] != [image height photo2]} { lappend result [list [image width photo2] [image height photo2]] } else { lappend result 1 } foreach point {{206 125} {67 12} {13 46} {19 184}} { if {[photo1 get {*}$point] ne [photo2 get {*}$point]} { lappend result [photo2 get {*}$point] } else { lappend result 1 } } set result } -cleanup { imageCleanup } -result {1 1 1 1 1} test imgPhoto-4.94 {ImgPhotoCmd put: unknown format} -setup { image create photo photo1 } -body { photo1 put {no real data} -format bogus } -cleanup { imageCleanup } -returnCodes error -result {image format "bogus" is not supported} test imgPhoto-4.95 {ImgPhotoCmd put: default fmt, invalid data} -setup { image create photo photo1 } -body { photo1 put {{red green blue} {red " blue}} #" } -cleanup { imageCleanup } -returnCodes error -result {unmatched open quote in list} test imgPhoto-4.96 {ImgPhotoCmd put: "default" handler is selected} -setup { image create photo photo1 image create photo photo2 set imgData {{{1 2 3 4} {5 6 7 8} {9 10 11 12}} {{13 14 15 15} {17 18 19 20} {21 22 23 24}}} } -body { photo1 put $imgData photo2 put $imgData -format default set result {} lappend result [list [image width photo1] [image height photo1]] lappend result [list [image width photo2] [image height photo2]] lappend result [string equal \ [photo1 data -format "default -colorformat rgba"] \ [photo2 data -format "default -colorformat rgba"]] set result } -cleanup { imageCleanup unset result unset imgData } -result {{3 2} {3 2} 1} test imgPhoto-4.97 {ImgPhotoCmd put: image size} -setup { image create photo photo1 } -body { photo1 put {{red green blue} {blue red green}} list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {3 2} test imgPhoto-4.98 {ImgPhotoCmd put: -to with 2 coords} -setup { image create photo photo1 } -body { photo1 put {{"alice blue" "blanched almond"} {"deep sky blue" "ghost white"} {#AABBCC #AABBCCDD}} -to 5 6 list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {7 9} test imgPhoto-4.99 {ImgPhotoCmd put: -to with 4 coords} -setup { image create photo photo1 } -body { photo1 put {{#123 #456 #678} {#9AB #CDE #F01}} -to 1 2 20 21 set result {} lappend result [photo1 get 19 20 -withalpha] lappend result [string equal \ [photo1 data -from 1 2 4 4] [photo1 data -from 4 2 7 4]] lappend result [string equal \ [photo1 data -from 10 12 13 14] [photo1 data -from 16 16 19 18]] set result } -cleanup { imageCleanup } -result {{17 34 51 255} 1 1} test imgPhoto-4.100 {ImgPhotoCmd put: no changes on empty data} -setup { image create photo photo1 } -body { photo1 put {{brown blue} {cyan coral}} set imgData [photo1 data] photo1 put {} string equal $imgData [photo1 data] } -cleanup { imageCleanup } -result {1} test imgPhoto-4.101 {ImgPhotoCmd get: too many args} -setup { image create photo photo1 } -body { photo1 get 0 0 -withalpha bogus } -cleanup { imageCleanup } -returnCodes error -result \ {wrong # args: should be "photo1 get x y ?-withalpha?"} test imgPhoto-4.102 {ImgPhotoCmd get: invalid option} -setup { image create photo photo1 } -body { photo1 get 0 0 -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-bogus": must be -withalpha} test imgPhoto-4.103 {ImgPhotoCmd data: accepted opts} -setup { image create photo photo1 -data black } -body { photo1 data -format default -from 0 0 -grayscale -background blue } -cleanup { imageCleanup } -result {{#000000}} test imgPhoto-4.104 {ImgPhotoCmd data: existing but not accepted opt} -setup { image create photo photo1 } -body { photo1 data -to } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-to": must be -background, -format, -from, or -grayscale} test imgPhoto-4.105 {ImgPhotoCmd data: invalid option} -setup { image create photo photo1 } -body { photo1 data -bogus } -cleanup { imageCleanup } -returnCodes error -result \ {unrecognized option "-bogus": must be -background, -format, -from, or -grayscale} test imgPhoto-4.106 {ImgPhotoCmd data: extra arg before options} -setup { image create photo photo1 } -body { photo1 data bogus -grayscale } -cleanup { imageCleanup } -returnCodes error -result \ {wrong # args: should be "photo1 data ?-option value ...?"} test imgPhoto-4.107 {ImgPhotoCmd data: extra arg after options} -setup { image create photo photo1 } -body { photo1 data -format default bogus } -cleanup { imageCleanup } -returnCodes error -result \ {wrong # args: should be "photo1 data ?-option value ...?"} test imgPhoto-4.108 {ImgPhotoCmd data: invalid -from coords #1} -setup { image create photo photo1 -data blue } -body { photo1 data -from 2 0 } -cleanup { imageCleanup } -returnCodes error -result \ {coordinates for -from option extend outside image} test imgPhoto-4.109 {ImgPhotoCmd data: invalid -from coords #2} -setup { image create photo photo1 -data blue } -body { photo1 data -from 0 2 } -cleanup { imageCleanup } -returnCodes error -result \ {coordinates for -from option extend outside image} test imgPhoto-4.110 {ImgPhotoCmd data: invalid -from coords #3} -setup { image create photo photo1 -data blue } -body { photo1 data -from 0 0 2 1 } -cleanup { imageCleanup } -returnCodes error -result \ {coordinates for -from option extend outside image} test imgPhoto-4.111 {ImgPhotoCmd data: invalid -from coords #4} -setup { image create photo photo1 -data blue } -body { photo1 data -from 0 0 1 2 } -cleanup { imageCleanup } -returnCodes error -result \ {coordinates for -from option extend outside image} test imgPhoto-4.112 {ImgPhotoCmd data: -from with 2 coords} -setup { image create photo photo1 -data { {black black black black black} {white white white white white} {green green green green green}} } -body { set imgData [photo1 data -from 2 1] list [llength [lindex $imgData 0]] [llength $imgData] } -cleanup { imageCleanup unset imgData } -result {3 2} test imgPhoto-4.113 {ImgPhotoCmd data: default is rgb format} -setup { image create photo photo1 -data red } -body { photo1 data } -cleanup { imageCleanup } -result {{#ff0000}} test imgPhoto-4.114 {ImgPhotoCmd data: unknown format} -setup { image create photo photo1 } -body { photo1 data -format bogus } -cleanup { imageCleanup } -returnCodes error -result {image string format "bogus" is unknown} test imgPhoto-4.115 {ImgPhotoCmd data: rgb colorformat} -setup { image create photo photo1 -data {{red#a green#b} {blue#c white}} } -body { photo1 data -format {default -colorformat rgb} } -result {{#ff0000 #008000} {#0000ff #ffffff}} test imgPhoto-4.116 {ImgPhotoCmd data: rgba colorformat} -setup { image create photo photo1 -data {{red green} {blue white}} } -body { photo1 data -format {default -colorformat rgba} } -result {{#ff0000ff #008000ff} {#0000ffff #ffffffff}} test imgPhoto-4.117 {ImgPhotoCmd data: list colorformat} -setup { image create photo photo1 -data {{red#a green} {blue#c white#d}} } -body { photo1 data -format {default -colorformat list} } -result {{{255 0 0 170} {0 128 0 255}} {{0 0 255 204} {255 255 255 221}}} test imgPhoto-4.118 {ImgPhotoCmd data: using data for new image results in same image as orignial } -constraints { hasTeapotPhoto hasTranspTeapotPhoto } -setup { image create photo teapot -file $teapotPhotoFile teapot copy teapot -from 50 60 70 80 -shrink image create photo teapotTransp -file $transpTeapotPhotoFile teapotTransp copy teapotTransp -from 100 110 120 130 -shrink image create photo photo1 } -body { set result {} # We don't test gif here, as there seems to be a problem with # <imgName> data and gif format ("too many colors", probably a bug) foreach fmt {ppm png {default -colorformat rgba} \ {default -colorformat list}} { set imgData [teapotTransp data -format $fmt] photo1 blank photo1 put $imgData if { ! [string equal [photo1 data] [teapotTransp data]]} { lappend result $fmt } } set imgData [teapot data -format default] photo1 blank photo1 put $imgData if { ! [string equal [photo1 data] [teapot data]]} { lappend result default } set result } -cleanup { unset imgData unset result imageCleanup } -result {} test imgPhoto-5.1 {ImgPhotoGet/Free procedures, shared instances} -constraints { hasTeapotPhoto } -setup { destroy .c pack [canvas .c] imageCleanup } -body { |
︙ | ︙ | |||
851 852 853 854 855 856 857 | .c delete i1.2 photo1 configure -height 1 update image delete photo1 } -cleanup { destroy .c } -result {} | | | | 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 | .c delete i1.2 photo1 configure -height 1 update image delete photo1 } -cleanup { destroy .c } -result {} test imgPhoto-6.1 {ImgPhotoDisplay procedure, blank display} -setup { destroy .c pack [canvas .c] imageCleanup } -body { image create photo photo1 -width 10 -height 10 photo1 blank .c create image 10 10 -image photo1 update } -cleanup { destroy .c image delete photo1 } -result {} test imgPhoto-7.1 {ImgPhotoFree procedure, resource freeing} -constraints { hasTeapotPhoto } -setup { destroy .c pack [canvas .c] imageCleanup } -body { |
︙ | ︙ | |||
926 927 928 929 930 931 932 | destroy .b1 update .f.b2 configure -image {} update destroy .f image delete photo1 } -result {} | | | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | destroy .b1 update .f.b2 configure -image {} update destroy .f image delete photo1 } -result {} test imgPhoto-8.1 {ImgPhotoDelete procedure} -constraints hasTeapotPhoto -body { image create photo photo2 -file $teapotPhotoFile image delete photo2 } -result {} test imgPhoto-8.2 {ImgPhotoDelete procedure} -constraints { hasTeapotPhoto } -setup { |
︙ | ︙ | |||
950 951 952 953 954 955 956 | image create photo photo1 image create photo photo2 -width 10 -height 10 image delete photo2 photo1 copy photo2 } -returnCodes error -cleanup { imageCleanup } -result {image "photo2" doesn't exist or is not a photo image} | | | | 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | image create photo photo1 image create photo photo2 -width 10 -height 10 image delete photo2 photo1 copy photo2 } -returnCodes error -cleanup { imageCleanup } -result {image "photo2" doesn't exist or is not a photo image} test imgPhoto-9.1 {ImgPhotoCmdDeletedProc procedure} -constraints { hasTeapotPhoto } -body { image create photo photo2 -file $teapotPhotoFile rename photo2 {} list [lsearch -exact [imageNames] photo2] [catch {photo2 foo} msg] $msg } -result {-1 1 {invalid command name "photo2"}} test imgPhoto-10.1 {Tk_ImgPhotoPutBlock procedure} -setup { imageCleanup } -body { image create photo photo1 photo1 put "{#ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000 #ff0000}" -to 0 0 photo1 put "{#00ff00 #00ff00}" -to 2 0 list [photo1 get 2 0] [photo1 get 3 0] [photo1 get 4 0] |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 | image create photo photo1 photo1 copy photo1 -to 0 5 10 20 list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {0 0} | < | | 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 | image create photo photo1 photo1 copy photo1 -to 0 5 10 20 list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {0 0} test imgPhoto-11.1 {Tk_FindPhoto} -setup { imageCleanup } -body { image create bitmap i1 image create photo photo1 photo1 copy i1 } -cleanup { imageCleanup } -returnCodes error -result {image "i1" doesn't exist or is not a photo image} test imgPhoto-12.1 {Tk_PhotoPutZoomedBlock} -constraints hasTeapotPhoto -body { image create photo p3 -file $teapotPhotoFile set result [list [p3 get 50 50] [p3 get 100 100]] p3 copy p3 -zoom 2 lappend result [image width p3] [image height p3] [p3 get 100 100] } -cleanup { image delete p3 |
︙ | ︙ | |||
1104 1105 1106 1107 1108 1109 1110 | } -body { x1 eval [list image create photo T1_data -data $data] x2 eval [list image create photo T1_data -data $data] } -cleanup { interp delete x1 interp delete x2 } -result T1_data | | | 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 | } -body { x1 eval [list image create photo T1_data -data $data] x2 eval [list image create photo T1_data -data $data] } -cleanup { interp delete x1 interp delete x2 } -result T1_data test imgPhoto-14.1 {GIF writes work correctly} -setup { set data { R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM hASs3MTcjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 | # This erroneously produced "malformed image" error. # The animated GIF "deferredClearCode.gif" has two frames, and calling for -index 2 # simply is an easy way to trigger the problem of improper management of a deferred # clear code. The effect was that the GIF decoder bailed out before the end of the # image reading, and produced the inappropriate "malformed image error". image create photo -file $fileName -format "gif -index 2" } -returnCodes error -result {no image data for this index} test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constraints { nonPortable } -body { # This is not portable to very large machines with more than around 3GB of # free memory available... image create photo -width 32000 -height 32000 } -returnCodes error -result {not enough free memory for image buffer} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 | # This erroneously produced "malformed image" error. # The animated GIF "deferredClearCode.gif" has two frames, and calling for -index 2 # simply is an easy way to trigger the problem of improper management of a deferred # clear code. The effect was that the GIF decoder bailed out before the end of the # image reading, and produced the inappropriate "malformed image error". image create photo -file $fileName -format "gif -index 2" } -returnCodes error -result {no image data for this index} test imgPhoto-14.6 {Access Subimage after Subimage with buffer overflow. Ticket 4da2191b} -setup { set data { R0lGODlhYwA5APcAAAAAAIAAAACAAICAAAAAgIAAgACAgICAgAysnGy8hKzM hASs3MTcjAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMDAwP8AAAD/ AP//AAAA//8A/wD//////ywAAAAAYwA5AAAI/wAZCBxIsKDBgwgTKlzIsKHD hxAjSpxIsaLFixgzatzIsaPHjyBDihxJsqTJkyhTqlzJsqXLlzBjypxJs6bN mzhz6tzJs6fPn0CDCh1KtKhRiwoSKEXAtGlTpUqPGkyagOmCq1edNsWalWkC BUSXIuDqFepBqFWtZv3KU+zYrkrBSqT6dgECtjOTbu16NwFHvV3lshRLti/J qlgRCE6ZuO9ik4Dt+k0ZVyZiyVIvXr77ODPEy5g9T4zMWfTEzXdNz1VbWvXn uqldP1TAOrbshqBb314Y2W7n3Qdpv7UNPCHpycUVbv6dnODy5sqzQldIe8H0 hciva9/Ovbv37+BzBgE7ACH5BAFkAAMALAAAAAAEAAQAAAMEKLrckgA7 } } -body { image create photo photo1 -data $data -format "GIF -index 1" } -cleanup { catch {image delete photo1} } -result photo1 test imgPhoto-15.1 {photo images can fail to allocate memory gracefully} -constraints { nonPortable } -body { # This is not portable to very large machines with more than around 3GB of # free memory available... image create photo -width 32000 -height 32000 } -returnCodes error -result {not enough free memory for image buffer} test imgPhoto-16.1 {copying to self doesn't access freed memory} -setup { set i [image create photo] } -body { # Bug 877950 makes this crash when trying to copy out of a deallocated # area. $i put red -to 0 0 1000 1000 $i copy $i -from 0 0 1000 1000 -to 500 0 } -cleanup { image delete $i } -result {} # Check that we can guess our supported output formats [Bug 2983824] test imgPhoto-17.1 {photo write: format guessing from filename} -setup { set i [image create photo -width 3 -height 3] } -body { set f [makeFile {} test.png] $i write $f set fd [open $f] |
︙ | ︙ | |||
1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 | set fd [open $f] read $fd 3 } -cleanup { catch {close $fd} image delete $i catch {removeFile $f} } -result "P6\n" # Reject corrupted or truncated image [Bug b601ce3ab1]. # WARNING - tests 18.1-18.9 will cause a segfault on 8.5.19 and lower, # and on 8.6.6 and lower. test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -constraints { base64PackageNeeded } -setup { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 | set fd [open $f] read $fd 3 } -cleanup { catch {close $fd} image delete $i catch {removeFile $f} } -result "P6\n" test imgPhoto-17.4 {photo write: default format not supported} -setup { image create photo photo1 -data {{blue blue} {red red} {green green}} set f [makeFile {} test.txt] } -body { photo1 write $f -format default } -cleanup { imageCleanup catch {removeFile $f} unset f } -returnCodes error -result \ {image file format "default" has no file writing capability} test imgPhoto-17.5 {photo write: file with extension .default} -setup { image create photo photo1 -data {{black}} set f [makeFile {} test.default] } -body { photo1 write $f } -cleanup { imageCleanup catch {removeFile $f} unset f } -returnCodes error -result \ {image file format "default" has no file writing capability} test imgPhoto-18.1 {MatchFileFormat: "default" format not supported} -setup { image create photo photo1 set f [makeFile {} test.txt] } -body { photo1 read $f -format default } -cleanup { imageCleanup catch {removeFile $f} unset f } -returnCodes error -result {-file option isn't supported for default images} test imgPhoto-19.1 {MatchStringFormat: with "-format default"} -setup { image create photo photo1 } -body { photo1 put {{red blue red} {yellow green yellow}} -format default list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {3 2} test imgPhoto-19.2 {MatchStringFormat: without -format option, default fmt} -body { image create photo photo1 photo1 put {{red} {green}} list [image width photo1] [image height photo1] } -cleanup { imageCleanup } -result {1 2} test imgPhoto-19.3 {MatchStringFormat: "-format ppm"} -setup { image create photo photo1 image create photo photo2 photo2 put {cyan cyan} set imgData [photo2 data -format ppm] } -body { photo1 put $imgData -format ppm list [image width photo1] [image height photo1] } -cleanup { unset imgData imageCleanup } -result {1 2} test imgPhoto-19.4 {MatchStringFormat: ppm fmt, without opt} -constraints { hasTeapotPhoto } -setup { image create photo photo1 -file $teapotPhotoFile image create photo photo2 } -body { set imgData [photo1 data -format ppm] photo2 put $imgData list [image width photo2] [image height photo2] } -cleanup { imageCleanup unset imgData } -result {256 256} test imgPhoto-19.5 {MatchStirngFormat: unknown -format} -setup { image create photo photo1 } -body { photo1 put {} -format bogus } -cleanup { imageCleanup } -returnCodes error -result {image format "bogus" is not supported} test imgPhoto-19.6 {MatchStringFormat: invalid data for default} -setup { image create photo photo1 } -body { photo1 put bogus } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "bogus"} test imgPhoto-19.7 {MatchStringFormat: invalid data for default} -setup { image create photo photo1 } -body { photo1 put bogus -format dEFault } -cleanup { imageCleanup } -returnCodes error -result {invalid color name "bogus"} test imgPhoto-19.8 {MatchStirngFormat: invalid data for gif} -setup { image create photo photo1 } -body { photo1 put bogus -format giF } -cleanup { imageCleanup } -returnCodes error -result {couldn't recognize image data} # Reject corrupted or truncated image [Bug b601ce3ab1]. # WARNING - tests 18.1-18.9 will cause a segfault on 8.5.19 and lower, # and on 8.6.6 and lower. test imgPhoto-18.1 {Reject corrupted GIF (binary string)} -constraints { base64PackageNeeded } -setup { |
︙ | ︙ |
Added tests/imgSVGnano.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # This file is a Tcl script to test out the code in tkImgSVGnano.c, which reads # and write SVG-format image files for photo widgets. The files is organized # in the standard fashion for Tcl tests. # # Copyright (c) 2018 Rene Zaumseil # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands imageInit namespace eval svgnano { variable data set data(plus) {<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"> <path fill="none" stroke="#000000" d="M0 0 h16 v16 h-16 z"/> <path fill="none" stroke="#000000" d="M8 4 v 8 M4 8 h 8"/> <circle fill="yellow" stroke="red" cx="10" cy="80" r="10" /> <ellipse fill="none" stroke="blue" stroke-width="3" cx="60" cy="60" rx="10" ry="20" /> <line x1="10" y1="90" x2="50" y2="99"/> <rect fill="none" stroke="green" x="20" y="20" width="60" height="50" rx="3" ry="3"/> <polyline fill="red" stroke="purple" points="80,10 90,20 85,40"/> <polygon fill ="yellow" points="80,80 70,85 90,90"/> </svg>} set data(bad) {<svg xmlns="http://www.w3.org/2000/svg" width="0" height="0:w "> </svg>} test imgSVGnano-1.1 {reading simple image} -setup { catch {rename foo ""} } -body { image create photo foo -data $data(plus) list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} test imgSVGnano-1.2 {simple image with options} -setup { catch {rename foo ""} } -body { image create photo foo -data $data(plus) -format {svg -dpi 100 -scale 3} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {300 300} # test on crash found by Koen Danckaert test imgSVGnano-1.3 {reformat image options} -setup { catch {rename foo ""} } -body { image create photo foo -data $data(plus) catch {foo configure -format {svg -scale}} list {} } -cleanup { rename foo "" } -result {{}} test imgSVGnano-1.4 {image options} -setup { catch {rename foo ""} } -body { image create photo foo -data $data(plus) foo configure -format {svg -scale 2} foo configure -format {svg -unit pt} foo configure -format {svg -unit mm} foo configure -format {svg -unit cm} foo configure -format {svg -unit in} foo configure -format {svg -unit px} foo configure -format {svg -dpi 600} list [image width foo] [image height foo] } -cleanup { rename foo "" } -result {100 100} test imgSVGnano-2.1 {reading a bad image} -body { image create photo foo -format svg -data $data(bad) } -returnCodes error -result {couldn't recognize image data} test imgSVGnano-2.2 {using bad option} -body { image create photo foo -data $data(plus) -format {svg -scale 0} } -returnCodes error -result {-scale value must be positive} test imgSVGnano-2.3 {using bad option} -body { image create photo foo -data $data(plus) foo configure -format {svg 1.0} } -cleanup { rename foo "" } -returnCodes error -result {bad option "1.0": must be -dpi, -scale, or -unit} };# end of namespace svgnano namespace delete svgnano imageFinish cleanupTests return # Local Variables: # mode: tcl # fill-column: 78 # End: |
Changes to tests/listbox.test.
︙ | ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | destroy .l2 } -result [list [list a b c d] [list a b c d 1 2 3 4]] test listbox-4.12 {ConfigureListbox procedure, listvar -> different listvar} -setup { destroy .l2 } -body { set x [list a b c d] set y [list 1 2 3 4] | | | 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 | destroy .l2 } -result [list [list a b c d] [list a b c d 1 2 3 4]] test listbox-4.12 {ConfigureListbox procedure, listvar -> different listvar} -setup { destroy .l2 } -body { set x [list a b c d] set y [list 1 2 3 4] listbox .l2 .l2 configure -listvar x .l2 configure -listvar y .l2 insert end 5 6 7 8 list $x $y } -cleanup { destroy .l2 } -result [list [list a b c d] [list 1 2 3 4 5 6 7 8]] |
︙ | ︙ | |||
1548 1549 1550 1551 1552 1553 1554 | # If "0" in selected font had 0 width, caused divide-by-zero error. pack [listbox .l -font {{open look glyph}}] update } -cleanup { destroy .l } -result {} | | | 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 | # If "0" in selected font had 0 width, caused divide-by-zero error. pack [listbox .l -font {{open look glyph}}] update } -cleanup { destroy .l } -result {} # Listbox used in 6.*, 7.* tests destroy .l listbox .l -height 2 -xscrollcommand "record x" -yscrollcommand "record y" pack .l update test listbox-6.1 {InsertEls procedure} -body { |
︙ | ︙ | |||
1909 1910 1911 1912 1913 1914 1915 | listbox .l1 rename .l1 {} list [info command .l*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} test listbox-9.2 {ListboxCmdDeletedProc procedure, disabling -setgrid} -constraints { | | | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 | listbox .l1 rename .l1 {} list [info command .l*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} test listbox-9.2 {ListboxCmdDeletedProc procedure, disabling -setgrid} -constraints { fonts } -setup { destroy .top } -body { toplevel .top wm geom .top +0+0 listbox .top.l -setgrid 1 -width 20 -height 10 pack .top.l |
︙ | ︙ | |||
2990 2991 2992 2993 2994 2995 2996 | .l insert end a b c .l itemconfigure 0 -fg red .l insert 0 1 2 3 4 list [.l itemcget 0 -fg] [.l itemcget 4 -fg] } -cleanup { destroy .l } -result {{} red} | | | 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 | .l insert end a b c .l itemconfigure 0 -fg red .l insert 0 1 2 3 4 list [.l itemcget 0 -fg] [.l itemcget 4 -fg] } -cleanup { destroy .l } -result {{} red} # state issues test listbox-26.1 {listbox disabled state disallows inserts} -setup { destroy .l } -body { listbox .l .l insert end a b c |
︙ | ︙ | |||
3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 | event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires selection clear ; # <<ListboxSelect>> fires again update set res } -cleanup { destroy .l } -result {{.l 0} {{} {}}} resetGridInfo deleteWindows option clear # cleanup cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 | event generate .l <1> -x 5 -y 5 ; # <<ListboxSelect>> fires selection clear ; # <<ListboxSelect>> fires again update set res } -cleanup { destroy .l } -result {{.l 0} {{} {}}} test listbox-32.1 {Bug [5d991b822e]} { # Want this not to segfault, or write to variable with empty name set var INIT listbox .b -listvariable var trace add variable var unset {apply {args { .b configure -listvariable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b info exists {} } 0 test listbox-32.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT listbox .b -listvariable var trace add variable var unset {apply {args { .b configure -listvariable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} resetGridInfo deleteWindows option clear # cleanup cleanupTests return |
Changes to tests/main.test.
︙ | ︙ | |||
51 52 53 54 55 56 57 | } -body { read $f } -cleanup { close $f removeFile script } -result "script {} 0\n0\n" | | | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | } -body { read $f } -cleanup { close $f removeFile script } -result "script {} 0\n0\n" # Procedure to simulate interactive typing of commands, line by line, # for test 2.3 proc type {chan script} { foreach line [split $script \n] { if {[catch { puts $chan $line flush $chan }]} { |
︙ | ︙ |
Changes to tests/menu.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | destroy .m1 menu .m1 foo } -returnCodes error -result {unknown option "foo"} test menu-1.4 {Tk_MenuCmd procedure} -body { destroy .m1 menu .m1 } -cleanup { | | | | | | | | | | | | | | | | | | | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | destroy .m1 menu .m1 foo } -returnCodes error -result {unknown option "foo"} test menu-1.4 {Tk_MenuCmd procedure} -body { destroy .m1 menu .m1 } -cleanup { deleteWindows } -result {.m1} test menu-1.5 {Tk_MenuCmd - creating menubar} -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label Test -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-1.6 {Tk_MenuCmd procedure menu ref no cascade} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 menu .m1 } -cleanup { deleteWindows } -result {.m1} test menu-1.7 {Tk_MenuCmd procedure one clone cascade} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 menu .m1 .m1 add cascade -menu .m2 menu .m2 } -cleanup { deleteWindows } -result {.m2} test menu-1.8 {Tk_MenuCmd procedure two clone cascades} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 menu .m2 } -cleanup { deleteWindows } -result {.m2} test menu-1.9 {Tk_MenuCmd procedure two clone cascades different order} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 menu .m1 .m1 add cascade -menu .m2 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [menu .m2] } -cleanup { deleteWindows } -result {.m2} test menu-1.10 {Tk_MenuCmd procedure two clone cascades menus last} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 menu .m1 .m1 add cascade -menu .m2 list [menu .m2] } -cleanup { deleteWindows } -result {.m2} test menu-1.11 {Tk_MenuCmd procedure three clones cascades} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 toplevel .t4 -menu .m1 wm geometry .t4 +0+0 menu .m1 .m1 add cascade -menu .m2 list [menu .m2] } -cleanup { deleteWindows } -result {.m2} test menu-1.12 {Tk_MenuCmd procedure} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 list [menu .m1] } -cleanup { deleteWindows } -result {.m1} test menu-1.13 {Tk_MenuCmd procedure} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [menu .m1] } -cleanup { deleteWindows } -result {.m1} test menu-1.14 {Tk_MenuCmd procedure} -setup { deleteWindows } -body { toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 toplevel .t4 -menu .m1 wm geometry .t4 +0+0 list [menu .m1] } -cleanup { deleteWindows } -result {.m1} # Used for 2.1 - 2.30 tests destroy .m1 menu .m1 test menu-2.1 {configuration options -activebackground #012345} -body { .m1 configure -activebackground #012345 |
︙ | ︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 | .m1 configure -activeforeground #ff0000 .m1 cget -activeforeground } -result {#ff0000} test menu-2.6 {configuration options -activeforeground non-existent} -body { .m1 configure -activeforeground non-existent } -returnCodes error -result {unknown color name "non-existent"} test menu-2.7 {configuration options -background #ff0000} -body { .m1 configure -background #ff0000 .m1 cget -background } -result {#ff0000} test menu-2.8 {configuration options -background non-existent} -body { .m1 configure -background non-existent } -returnCodes error -result {unknown color name "non-existent"} | > > > > > > > > | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | .m1 configure -activeforeground #ff0000 .m1 cget -activeforeground } -result {#ff0000} test menu-2.6 {configuration options -activeforeground non-existent} -body { .m1 configure -activeforeground non-existent } -returnCodes error -result {unknown color name "non-existent"} test menu-2.6a {configuration options -activerelief sunken} -body { .m1 configure -activerelief sunken .m1 cget -activerelief } -result {sunken} test menu-2.6b {configuration options -activerelief badValue} -body { .m1 configure -activerelief badValue } -returnCodes error -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test menu-2.7 {configuration options -background #ff0000} -body { .m1 configure -background #ff0000 .m1 cget -background } -result {#ff0000} test menu-2.8 {configuration options -background non-existent} -body { .m1 configure -background non-existent } -returnCodes error -result {unknown color name "non-existent"} |
︙ | ︙ | |||
272 273 274 275 276 277 278 | .m1 cget -tearoffcommand } -result {any old string} destroy .m1 # We need to test all of the options with all of the different types of # menu entries. The following code sets up .m1 with 6 items. It then # runs through the 2.31 - 2.228 tests below | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | .m1 cget -tearoffcommand } -result {any old string} destroy .m1 # We need to test all of the options with all of the different types of # menu entries. The following code sets up .m1 with 6 items. It then # runs through the 2.31 - 2.228 tests below # index 0 is tearoff, 1 command, 2 cascade, 3 separator, 4 checkbutton, # 5 radiobutton deleteWindows menu .m1 -tearoff 1 .m1 add command -label "command" menu .m2 -tearoff 1 .m2 add command -label "test" .m1 add cascade -label "cascade" -menu .m2 |
︙ | ︙ | |||
767 768 769 770 771 772 773 | } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.132 {entry configuration options 5 -image bogus radiobutton} -body { .m1 entryconfigure 5 -image bogus } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.133 {entry configuration options 0 -image {} tearoff} -body { | | | | | | | | 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 | } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.132 {entry configuration options 5 -image bogus radiobutton} -body { .m1 entryconfigure 5 -image bogus } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.133 {entry configuration options 0 -image {} tearoff} -body { .m1 entryconfigure 0 -image } -returnCodes error -result {unknown option "-image"} test menu-2.134 {entry configuration options 1 -image {} command} -setup { .m1 entryconfigure 1 -image {} } -body { .m1 entryconfigure 1 -image lindex [.m1 entryconfigure 1 -image] 4 } -result {} test menu-2.135 {entry configuration options 2 -image {} cascade} -setup { .m1 entryconfigure 2 -image {} } -body { .m1 entryconfigure 2 -image lindex [.m1 entryconfigure 2 -image] 4 } -result {} test menu-2.136 {entry configuration options 3 -image {} separator} -body { .m1 entryconfigure 3 -image } -returnCodes error -result {unknown option "-image"} test menu-2.137 {entry configuration options 4 -image {} checkbutton} -body { .m1 entryconfigure 4 -image lindex [.m1 entryconfigure 4 -image] 4 } -result {} test menu-2.138 {entry configuration options 5 -image {} radiobutton} -body { .m1 entryconfigure 5 -image lindex [.m1 entryconfigure 5 -image] 4 } -result {} test menu-2.139 {entry configuration options 0 -indicatoron 1 tearoff} -body { .m1 entryconfigure 0 -indicatoron 1 } -returnCodes error -result {unknown option "-indicatoron"} |
︙ | ︙ | |||
1048 1049 1050 1051 1052 1053 1054 | } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.192 {entry configuration options 5 -selectimage bogus radiobutton} -body { .m1 entryconfigure 5 -selectimage bogus } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.193 {entry configuration options 0 -selectimage {} tearoff} -body { | | | | | | | | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.192 {entry configuration options 5 -selectimage bogus radiobutton} -body { .m1 entryconfigure 5 -selectimage bogus } -returnCodes error -result {image "bogus" doesn't exist} test menu-2.193 {entry configuration options 0 -selectimage {} tearoff} -body { .m1 entryconfigure 0 -selectimage } -returnCodes error -result {unknown option "-selectimage"} test menu-2.194 {entry configuration options 1 -selectimage {} command} -body { .m1 entryconfigure 1 -selectimage } -returnCodes error -result {unknown option "-selectimage"} test menu-2.195 {entry configuration options 2 -selectimage {} cascade} -body { .m1 entryconfigure 2 -selectimage } -returnCodes error -result {unknown option "-selectimage"} test menu-2.196 {entry configuration options 3 -selectimage {} separator} -body { .m1 entryconfigure 3 -selectimage } -returnCodes error -result {unknown option "-selectimage"} test menu-2.197 {entry configuration options 4 -selectimage {} checkbutton} -body { .m1 entryconfigure 4 -selectimage lindex [.m1 entryconfigure 4 -selectimage] 4 } -result {} test menu-2.198 {entry configuration options 5 -selectimage {} radiobutton} -body { .m1 entryconfigure 5 -selectimage lindex [.m1 entryconfigure 5 -selectimage] 4 } -result {} test menu-2.199 {entry configuration options 0 -state normal tearoff} -body { .m1 entryconfigure 0 -state normal lindex [.m1 entryconfigure 0 -state] 4 } -result {normal} |
︙ | ︙ | |||
1221 1222 1223 1224 1225 1226 1227 | } -body { menu .m1 .m1 } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 option ?arg ...?"} test menu-3.2 {MenuWidgetCmd, Tcl_Preserve and Tcl_Release} -constraints { | | | | 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 | } -body { menu .m1 .m1 } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 option ?arg ...?"} test menu-3.2 {MenuWidgetCmd, Tcl_Preserve and Tcl_Release} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 -postcommand "destroy .m1" .m1 add command -label "menu-3.2: Hit Escape" .m1 post 40 40 } -cleanup { destroy .m1 } -returnCodes ok -result {} test menu-3.3 {MenuWidgetCmd procedure, "activate" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 activate } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 activate index"} test menu-3.4 {MenuWidgetCmd procedure, "activate" option} -setup { |
︙ | ︙ | |||
1355 1356 1357 1358 1359 1360 1361 | test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 llength [.m1 configure] } -cleanup { destroy .m1 | | | 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | test menu-3.18 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 llength [.m1 configure] } -cleanup { destroy .m1 } -result {21} test menu-3.19 {MenuWidgetCmd procedure, "configure" option} -setup { destroy .m1 } -body { menu .m1 .m1 configure -gorp } -returnCodes error -result {unknown option "-gorp"} test menu-3.20 {MenuWidgetCmd procedure, "configure" option} -setup { |
︙ | ︙ | |||
1410 1411 1412 1413 1414 1415 1416 | destroy .m1 } -result {} test menu-3.26 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "foo" | | | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 | destroy .m1 } -result {} test menu-3.26 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "foo" .m1 delete 1 0 } -cleanup { destroy .m1 } -result {} test menu-3.27 {MenuWidgetCmd procedure, "delete" option} -setup { destroy .m1 } -body { menu .m1 |
︙ | ︙ | |||
1602 1603 1604 1605 1606 1607 1608 | destroy .m1 } -body { menu .m1 .m1 add command -label "On Windows, hit Escape to get this menu to go away" .m1 post } -cleanup { destroy .m1 | | | | | 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 | destroy .m1 } -body { menu .m1 .m1 add command -label "On Windows, hit Escape to get this menu to go away" .m1 post } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 post x y ?index?"} test menu-3.48 {MenuWidgetCmd procedure, "post" option} -setup { destroy .m1 } -body { menu .m1 .m1 post foo 40 } -cleanup { destroy .m1 } -returnCodes error -result {expected integer but got "foo"} test menu-3.49 {MenuWidgetCmd procedure, "post" option} -setup { destroy .m1 } -body { menu .m1 .m1 post 40 bar } -cleanup { destroy .m1 } -returnCodes error -result {expected integer but got "bar"} test menu-3.50 {MenuWidgetCmd procedure, "post" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "menu-3.50: hit Escape" -command "puts hello" .m1 post 40 40 } -cleanup { destroy .m1 } -result {} test menu-3.51 {MenuWidgetCmd procedure, "postcascade" option} -setup { destroy .m1 } -body { |
︙ | ︙ | |||
1650 1651 1652 1653 1654 1655 1656 | } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry index "foo"} test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 .m2 | | | | 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 | } -cleanup { destroy .m1 } -returnCodes error -result {bad menu entry index "foo"} test menu-3.53 {MenuWidgetCmd procedure, "postcascade" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 .m2 } -body { menu .m1 .m1 add command -label "menu-3.53 - hit Escape" menu .m2 .m1 post 40 40 .m1 add cascade -menu .m2 .m1 postcascade 1 } -cleanup { destroy .m1 .m2 } -result {} |
︙ | ︙ | |||
1752 1753 1754 1755 1756 1757 1758 | } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 unpost"} test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 | | | | | 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 | } -cleanup { destroy .m1 } -returnCodes error -result {wrong # args: should be ".m1 unpost"} test menu-3.64 {MenuWidgetCmd procedure, "unpost" option} -constraints { nonUnixUserInteraction } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "menu-3.64 - hit Escape" .m1 post 40 40 .m1 unpost } -cleanup { destroy .m1 } -result {} test menu-3.65 {MenuWidgetCmd procedure, "yposition" option} -setup { destroy .m1 } -body { |
︙ | ︙ | |||
1809 1810 1811 1812 1813 1814 1815 | } -body { menu .m1 .m1 foo } -cleanup { destroy .m1 } -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition} test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup { | | | | 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 | } -body { menu .m1 .m1 foo } -cleanup { destroy .m1 } -returnCodes error -result {bad option "foo": must be activate, add, cget, clone, configure, delete, entrycget, entryconfigure, index, insert, invoke, post, postcascade, type, unpost, xposition, or yposition} test menu-3.68 {MenuWidgetCmd procedure, fix for bug#508988} -setup { deleteWindows } -body { set t .t set m1 .t.m1 set c1 .t.c1 set c2 .t.c2 toplevel .t menu $m1 -tearoff 1 menu $c1 -tearoff 1 $c1 add command -label c1 menu $c2 -tearoff 1 $c2 add command -label c2 $m1 add cascade -label c1 -menu $c1 $t configure -menu $m1 $m1 entryconfigure 1 -menu $c2 -label c2 $t configure -menu "" list [winfo exists $c1] [winfo exists $c2] } -cleanup { deleteWindows } -result {1 1} test menu-3.69 {MenuWidgetCmd procedure, "xposition" option} -setup { destroy .m1 menu .m1 } -body { .m1 xposition } -cleanup { |
︙ | ︙ | |||
1865 1866 1867 1868 1869 1870 1871 | } -result {0 off} test menu-4.2 {TkInvokeMenu: tearoff} -setup { destroy .m1 } -body { menu .m1 catch {.m1 invoke 0} } -cleanup { | | | 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 | } -result {0 off} test menu-4.2 {TkInvokeMenu: tearoff} -setup { destroy .m1 } -body { menu .m1 catch {.m1 invoke 0} } -cleanup { deleteWindows } -result {0} test menu-4.3 {TkInvokeMenu: checkbutton -on} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo -onvalue on -offvalue off |
︙ | ︙ | |||
1894 1895 1896 1897 1898 1899 1900 | destroy .m1 } -result {0 {} 0 off 0 {}} test menu-4.5 {TkInvokeMenu: checkbutton array element} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 | | | 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 | destroy .m1 } -result {0 {} 0 off 0 {}} test menu-4.5 {TkInvokeMenu: checkbutton array element} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -label "test" -variable foo(1) -onvalue on list [catch {.m1 invoke 1} msg] $msg [catch {set foo(1)} msg2] $msg2 [catch {unset foo} msg3] $msg3 } -cleanup { destroy .m1 } -result {0 {} 0 on 0 {}} test menu-4.6 {TkInvokeMenu: radiobutton} -setup { destroy .m1 } -body { |
︙ | ︙ | |||
1962 1963 1964 1965 1966 1967 1968 | destroy .m1 } -result {0 menu-4.8 0 menu-4.8 0 {}} test menu-4.11 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label "test" -menu .m1.m2 | | | 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 | destroy .m1 } -result {0 menu-4.8 0 menu-4.8 0 {}} test menu-4.11 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label "test" -menu .m1.m2 list [catch {.m1 invoke 1} msg] $msg } -cleanup { destroy .m1 } -result {0 {}} test menu-4.12 {TkInvokeMenu} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 |
︙ | ︙ | |||
2022 2023 2024 2025 2026 2027 2028 | menu .m1 menu .m2 .m1 add cascade -menu .m2 . configure -menu .m1 list [destroy .m2] [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1] } -returnCodes ok -result {{} .m2 {} {}} test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} -setup { | | | 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 | menu .m1 menu .m2 .m1 add cascade -menu .m2 . configure -menu .m1 list [destroy .m2] [.m1 entrycget 1 -menu] [. configure -menu ""] [destroy .m1] } -returnCodes ok -result {{} .m2 {} {}} test menu-5.6 {DestroyMenuInstance - cascades of cloned menus} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 menu .m2 . configure -menu .m1 toplevel .t2 wm geometry .t2 +0+0 |
︙ | ︙ | |||
2118 2119 2120 2121 2122 2123 2124 | destroy .m1 .m2 } -body { menu .m1 .m1 clone .m2 .m1 clone .m1.m3 destroy .m1 } -cleanup { | | | | 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 | destroy .m1 .m2 } -body { menu .m1 .m1 clone .m2 .m1 clone .m1.m3 destroy .m1 } -cleanup { deleteWindows } -returnCodes ok test menu-6.5 {TkDestroyMenu} -setup { destroy .m1 .m2 } -body { menu .m1 .m1 clone .m2 destroy .m1 winfo exists .m2 |
︙ | ︙ | |||
2259 2260 2261 2262 2263 2264 2265 | menu .m1 menu .m2 .m1 add cascade -menu .cascade .m2 add cascade -menu .cascade list [destroy .m1] [destroy .m2] } -returnCodes ok -result {{} {}} test menu-7.5 {UnhookCascadeEntry} -setup { | | | | | | 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 | menu .m1 menu .m2 .m1 add cascade -menu .cascade .m2 add cascade -menu .cascade list [destroy .m1] [destroy .m2] } -returnCodes ok -result {{} {}} test menu-7.5 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 menu .m3 .m1 add cascade -menu .cascade .m2 add cascade -menu .cascade .m3 add cascade -menu .cascade list [destroy .m1] [destroy .m2 .m3] } -returnCodes ok -result {{} {}} test menu-7.6 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 menu .m3 .m1 add cascade -menu .cascade .m2 add cascade -menu .cascade .m3 add cascade -menu .cascade list [destroy .m2] [destroy .m1 .m3] } -returnCodes ok -result {{} {}} test menu-7.7 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 menu .m3 .m1 add cascade -menu .cascade .m2 add cascade -menu .cascade .m3 add cascade -menu .cascade list [destroy .m3] [destroy .m1 .m2] } -returnCodes ok -result {{} {}} test menu-7.8 {UnhookCascadeEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 .m1 add cascade -menu .m2 list [destroy .m1] [destroy .m2] } -returnCodes ok -result {{} {}} test menu-7.9 {UnhookCascadeEntry} -setup { |
︙ | ︙ | |||
2346 2347 2348 2349 2350 2351 2352 | } -result {{} {}} test menu-8.4 {DestroyMenuEntry} -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -variable foo list [.m1 delete 1] [destroy .m1] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 | } -result {{} {}} test menu-8.4 {DestroyMenuEntry} -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -variable foo list [.m1 delete 1] [destroy .m1] } -result {{} {}} test menu-8.5 {DestroyMenuEntry} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" list [.m1 delete 1] [destroy .m1] } -result {{} {}} test menu-8.6 {DestroyMenuEntry} -setup { destroy .m1 } -body { menu .m1 -tearoff 1 .m1 add command -label "one" .m1 add command -label "two" list [.m1 delete 1] [.m1 entrycget 1 -label] [destroy .m1] } -result {{} two {}} test menu-8.7 {DestroyMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "one" .m1 clone .m2 tearoff list [.m2 delete 1] [destroy .m1] } -result {{} {}} # test menu-9 - Can only change when fonts change on system, which cannot # be done from tcl. test menu-9.1 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand] } -cleanup { deleteWindows } -result {{} beep} test menu-9.2 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" list [.m1 configure -tearoff 0] [.m1 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} test} test menu-9.3 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 list [.m1 configure -postcommand "beep"] [.m1 cget -postcommand] } -cleanup { deleteWindows } -result {{} beep} test menu-9.4 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 configure -fg red } -cleanup { deleteWindows } -result {} test menu-9.5 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "two" .m1 configure -fg red } -cleanup { deleteWindows } -result {} test menu-9.6 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "two" .m1 add command -label "three" .m1 configure -fg red } -cleanup { deleteWindows } -result {} test menu-9.7 {ConfigureMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 tearoff list [.m1 configure -fg red] [.m2 cget -fg] } -cleanup { deleteWindows } -result {{} red} test menu-9.8 {ConfigureMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 tearoff list [.m2 configure -fg red] [.m1 cget -fg] } -cleanup { deleteWindows } -result {{} red} test menu-9.9 {ConfigureMenu} -setup { destroy .m1 } -body { menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-10.1 {PostProcessEntry: array variable} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 set foo(1) on .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense" set foo(1) } -cleanup { deleteWindows } -result {on} test menu-10.2 {PostProcessEntry: array variable} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -variable foo(1) -onvalue on -offvalue off -label "Nonsense" set foo(1) } -cleanup { deleteWindows } -result {off} test menu-11.1 {ConfigureMenuEntry} -setup { destroy .m1 } -body { catch {unset foo} menu .m1 .m1 add checkbutton -variable foo -onvalue on -offvalue off -label "Nonsense" list [.m1 entryconfigure 1 -variable bar] [.m1 entrycget 1 -variable] } -cleanup { deleteWindows } -result {{} bar} test menu-11.2 {ConfigureMenuEntry} -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" list [.m1 entryconfigure 1 -label ""] [.m1 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} {}} test menu-11.3 {ConfigureMenuEntry} -setup { destroy .m1 } -body { menu .m1 .m1 add command list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} test} test menu-11.4 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command list [.m1 entryconfigure 1 -accel "S"] [.m1 entrycget 1 -accel] } -cleanup { deleteWindows } -result {{} S} test menu-11.5 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command list [.m1 entryconfigure 1 -label "test"] [.m1 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} test} test menu-11.6 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command .m1 entryconfigure 1 -label "test" } -cleanup { deleteWindows } -result {} test menu-11.7 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m2 menu .m1 .m1 add cascade .m1 entryconfigure 1 -label "test" -menu .m2 } -cleanup { deleteWindows } -result {} test menu-11.8 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add cascade .m1 entryconfigure 1 -label "test" -menu .m2 } -cleanup { deleteWindows } -result {} test menu-11.9 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m3 .m1 entryconfigure 1 -label "test" -menu .m2 } -cleanup { deleteWindows } -result {} test menu-11.10 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add cascade .m1 entryconfigure 1 -label "test" -menu .m2 } -cleanup { deleteWindows } -result {} test menu-11.11 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 .m1 entryconfigure 1 -label "test" -menu .m2 } -cleanup { deleteWindows } -result {} test menu-11.12 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 .m2 add cascade -menu .m1 menu .m3 .m3 add cascade -menu .m1 menu .m4 .m4 add cascade -menu .m1 menu .m5 .m5 add cascade .m5 entryconfigure 1 -label "test" -menu .m1 } -cleanup { deleteWindows } -result {} test menu-11.13 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 menu .m2 .m2 add cascade -menu .m1 menu .m3 .m3 add cascade -menu .m1 menu .m4 .m4 add cascade -menu .m1 .m3 entryconfigure 1 -label "test" -menu .m1 } -cleanup { deleteWindows } -result {} test menu-11.14 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add checkbutton list [.m1 entryconfigure 1 -variable "test"] [.m1 entrycget 1 -variable] } -cleanup { deleteWindows } -result {{} test} test menu-11.15 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 list [.m1 add checkbutton -label "test"] [.m1 entrycget 1 -variable] } -cleanup { deleteWindows } -result {{} test} test menu-11.16 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add radiobutton -label "test" } -cleanup { deleteWindows } -result {} test menu-11.17 {ConfigureMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add checkbutton list [.m1 entryconfigure 1 -onvalue "test"] [.m1 entrycget 1 -onvalue] |
︙ | ︙ | |||
2840 2841 2842 2843 2844 2845 2846 | deleteWindows } -body { menu .m1 .m1 add command -label "active" .m1 entrycget -1 -label } -returnCodes error -result {bad menu entry index "-1"} test menu-13.9 {TkGetMenuIndex} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 | deleteWindows } -body { menu .m1 .m1 add command -label "active" .m1 entrycget -1 -label } -returnCodes error -result {bad menu entry index "-1"} test menu-13.9 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" .m1 entrycget 999 -label } -cleanup { deleteWindows } -result {test2} test menu-13.10 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 .m1 insert 999 command -label "test" .m1 entrycget 1 -label } -cleanup { deleteWindows } -result {test} test menu-13.11 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "1test" .m1 entrycget 1test -label } -cleanup { deleteWindows } -result {1test} test menu-13.12 {TkGetMenuIndex} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" -command "beep" .m1 add command -label "test3" .m1 entrycget test2 -command } -cleanup { deleteWindows } -result {beep} test menu-14.1 {MenuCmdDeletedProc} -setup { deleteWindows } -body { menu .m1 destroy .m1 } -cleanup { deleteWindows } -returnCodes ok test menu-14.2 {MenuCmdDeletedProc} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 destroy .m1 } -cleanup { deleteWindows } -returnCodes ok test menu-15.1 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" } -cleanup { deleteWindows } -result {} test menu-15.2 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test3" .m1 insert 2 command -label "test2" } -cleanup { deleteWindows } -result {} test menu-15.3 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" } -cleanup { deleteWindows } -result {} test menu-15.4 {MenuNewEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" } -cleanup { deleteWindows } -result {} test menu-16.1 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 insert foo command -label "test" } -returnCodes error -result {bad menu entry index "foo"} test menu-16.2 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 insert test command -label "foo" } -cleanup { deleteWindows } -result {} test menu-16.3 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 insert -1 command -label "test" } -returnCodes error -result {bad menu entry index "-1"} test menu-16.4 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 -tearoff 1 .m1 add command -label "test" .m1 insert 0 command -label "test2" .m1 entrycget 1 -label } -cleanup { deleteWindows } -result {test2} test menu-16.5 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add cascade } -cleanup { deleteWindows } -result {} test menu-16.6 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add checkbutton } -cleanup { deleteWindows } -result {} test menu-16.7 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {} test menu-16.8 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add radiobutton } -cleanup { deleteWindows } -result {} test menu-16.9 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add separator } -cleanup { deleteWindows } -result {} test menu-16.10 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add blork } -returnCodes error -result {bad menu entry type "blork": must be cascade, checkbutton, command, radiobutton, or separator} test menu-16.11 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {} test menu-16.12 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m2 clone .m3 list [.m2 add command -label "test"] [.m1 entrycget 1 -label] [.m3 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} test test} test menu-16.13 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m2 clone .m3 list [.m3 add command -label "test"] [.m1 entrycget 1 -label] [.m2 entrycget 1 -label] } -cleanup { deleteWindows } -result {{} test test} test menu-16.14 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -blork } -returnCodes error -result {unknown option "-blork"} test menu-16.15 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "File" menu .container . configure -menu .container list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-16.16 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .m2 set tearoff [tk::TearOffMenu .m2] list [.m2 add cascade -menu .m1] [$tearoff unpost] } -cleanup { deleteWindows } -result {{} {}} test menu-16.17 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .container . configure -menu .container set tearoff [tk::TearOffMenu .container] list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-16.18 {MenuAddOrInsert} -setup { deleteWindows } -body { menu .m1 menu .container .container add cascade -menu .m1 . configure -menu .container list [.container add cascade -label "File" -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-16.19 {MenuAddOrInsert - Insert a cascade deep into the tree} -setup { deleteWindows } -body { menu .menubar menu .menubar.test -tearoff 0 .menubar add cascade -label Test -underline 0 -menu .menubar.test menu .menubar.test.cascade -tearoff 0 .menubar.test.cascade add command -label SubItem -command "puts SubItemSelected" . configure -menu .menubar list [catch {.menubar.test add cascade -label SubMenu \ -menu .menubar.test.cascade}] \ [info commands .\#menubar.\#menubar\#test.\#menubar\#test\#cascade] \ [. configure -menu ""] } -cleanup { deleteWindows } -result {0 .#menubar.#menubar#test.#menubar#test#cascade {}} test menu-17.1 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [unset foo] } -cleanup { deleteWindows } -result {{} {}} # menu-17.2 - Don't know how to generate the flags in the if test menu-17.2 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo ""] } -cleanup { deleteWindows } -result {{} {}} test menu-17.3 {MenuVarProc} -setup { deleteWindows } -body { catch {unset foo} menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "hello"] [unset foo] } -cleanup { deleteWindows } -result {{} hello {}} test menu-17.4 {MenuVarProc} -setup { deleteWindows } -body { menu .m1 set foo "goodbye" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "hello"] [unset foo] } -cleanup { deleteWindows } -result {{} hello {}} test menu-17.5 {MenuVarProc} -setup { deleteWindows } -body { menu .m1 set foo "hello" list [.m1 add checkbutton -variable foo -onvalue hello -offvalue goodbye] \ [set foo "goodbye"] [unset foo] } -cleanup { deleteWindows } -result {{} goodbye {}} test menu-17.6 {MenuVarProc [5d991b822e]} -setup { deleteWindows } -body { # Want this not to crash menu .b set var INIT .b add checkbutton -variable var trace add variable var unset {apply {args { .b entryconfigure 1 -variable {} }}} unset var } -cleanup { deleteWindows } -result {} test menu-17.7 {MenuVarProc [5d991b822e]} -setup { deleteWindows } -body { # Want this not to duplicate traces menu .b set var INIT .b add checkbutton -variable var trace add variable var unset {apply {args { .b entryconfigure 1 -variable new }}} unset var } -cleanup { deleteWindows } -result {} test menu-18.1 {TkActivateMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 activate 1 } -cleanup { deleteWindows } -result {} test menu-18.2 {TkActivateMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 activate 0 } -cleanup { deleteWindows } -result {} test menu-18.3 {TkActivateMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" .m1 activate 1 .m1 activate 2 } -cleanup { deleteWindows } -result {} test menu-18.4 {TkActivateMenuEntry} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test2" .m1 activate 1 .m1 activate 1 } -cleanup { deleteWindows } -result {} test menu-19.1 {TkPostCommand} -constraints nonUnixUserInteraction -setup { deleteWindows } -body { menu .m1 -postcommand "set menu_test menu-19.1" .m1 add command -label "menu-19.1 - hit Escape" list [.m1 post 40 40] [.m1 unpost] [set menu_test] } -cleanup { deleteWindows } -result {menu-19.1 {} menu-19.1} test menu-19.2 {TkPostCommand} -constraints nonUnixUserInteraction -setup { deleteWindows } -body { menu .m1 .m1 add command -label "menu-19.2 - hit Escape" list [.m1 post 40 40] [.m1 unpost] } -cleanup { deleteWindows } -result {{} {}} test menu-20.1 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2] } -cleanup { deleteWindows } -result {} test menu-20.2 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 normal deleteWindows } -result {} test menu-20.3 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 tearoff } -cleanup { deleteWindows } -result {} test menu-20.4 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 menubar } -cleanup { deleteWindows } -result {} test menu-20.5 {CloneMenu} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 foo } -returnCodes error -result {bad menu type "foo": must be normal, tearoff, or menubar} test menu-20.6 {CloneMenu - hooking up bookeeping ptrs} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 } -cleanup { deleteWindows } -result {} test menu-20.7 {CloneMenu - hooking up bookeeping ptrs - multiple children} -setup { deleteWindows } -body { menu .m1 .m1 clone .m2 .m1 clone .m3 } -cleanup { deleteWindows } -result {} test menu-20.8 {CloneMenu - cascade entries} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 .m1 clone .foo } -cleanup { deleteWindows } -result {} test menu-20.9 {CloneMenu - cascades entries} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 menu .m2 .m1 clone .foo } -cleanup { deleteWindows } -result {} test menu-20.10 {CloneMenu - tearoff fields} -setup { deleteWindows } -body { menu .m1 -tearoff 1 list [.m1 clone .m2 normal] [.m2 cget -tearoff] } -cleanup { deleteWindows } -result {{} 1} test menu-20.11 {CloneMenu} -setup { deleteWindows } -body { menu .m1 menu .m2 .m1 clone .m2 } -returnCodes error -result {window name "m2" already exists in parent} test menu-21.1 {MenuDoYPosition} -setup { deleteWindows } -body { menu .m1 .m1 yposition glorp } -returnCodes error -result {bad menu entry index "glorp"} test menu-21.2 {MenuDoYPosition} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "Test" .m1 yposition 1 } -cleanup { deleteWindows } -returnCodes ok -match glob -result {*} test menu-22.1 {GetIndexFromCoords} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 .m1 index @5 } -cleanup { deleteWindows } -result {0} test menu-22.2 {GetIndexFromCoords} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 .m1 index @5,5 } -cleanup { deleteWindows } -result {0} test menu-22.3 {GetIndexFromCoords: mapped window, y only} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 .m1 index @5 } -cleanup { deleteWindows } -result {0} test menu-22.4 {GetIndexFromCoords: mapped window x,y} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 update set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}] .m1 index @$x,5 } -cleanup { deleteWindows } -result {0} test menu-22.5 {GetIndexFromCoords: mapped wide window} -setup { deleteWindows } -constraints {x11} -body { menu .m1 .m1 add command -label "test" .m1 configure -tearoff 0 tk_popup .m1 0 0 tkwait visibility .m1 wm geometry .m1 200x100 update set x [expr {[winfo width .m1] - [.m1 cget -borderwidth] - 1}] .m1 index @$x,5 } -cleanup { deleteWindows } -result {0} test menu-23.1 {RecursivelyDeleteMenu} -setup { deleteWindows } -body { menu .m1 . configure -menu .m1 . configure -menu "" } -cleanup { deleteWindows } -result {} test menu-23.2 {RecursivelyDeleteMenu} -setup { deleteWindows } -body { menu .m2 .m2 add command -label "test2" menu .m1 .m1 add cascade -label "test1" -menu .m2 . configure -menu .m1 . configure -menu "" } -cleanup { deleteWindows } -result {} test menu-24.1 {TkNewMenuName} -setup { deleteWindows } -body { menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-24.2 {TkNewMenuName} -setup { deleteWindows } -body { menu .m1 menu .m1\#0 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-24.3 {TkNewMenuName} -setup { deleteWindows } -body { menu .#m rename .#m hideme list [catch {. configure -menu [menu .m]}] [. configure -menu ""] [destroy .#m] \ [destroy .m] [destroy hideme] } -result {0 {} {} {} {}} test menu-25.1 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.2 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.3 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" destroy .m1 menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.4 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 menu .m2 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.5 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 .m1 clone .m2 menu .m3 list [. configure -menu .m3] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.6 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 .m1 clone .m2 . configure -menu .m2 menu .m3 list [. configure -menu .m3] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.7 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 .t2 configure -menu .m1 list [.t2 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.8 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 wm geometry .t2 +0+0 .t2 configure -menu .m1 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.9 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [.t3 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.10 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [.t2 configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.11 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 . configure -menu .m1 toplevel .t2 -menu .m1 wm geometry .t2 +0+0 toplevel .t3 -menu .m1 wm geometry .t3 +0+0 list [. configure -menu .m2] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.12 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.13 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.14 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.15 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-25.16 {TkSetWindowMenuBar} -setup { deleteWindows } -body { . configure -menu "" menu .m1 . configure -menu .m1 list [toplevel .t2 -menu m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {.t2 {}} test menu-26.1 {DestroyMenuHashTable} -setup { catch {interp delete testinterp} deleteWindows } -body { interp create testinterp load {} Tk testinterp interp eval testinterp {menu .m1} interp delete testinterp } -returnCodes ok -result {} test menu-27.1 {GetMenuHashTable} -setup { catch {interp delete testinterp} deleteWindows } -body { interp create testinterp load {} Tk testinterp list [catch {interp eval testinterp {menu .m1}} msg] $msg [interp delete testinterp] } -cleanup { deleteWindows } -result {0 .m1 {}} test menu-28.1 {TkCreateMenuReferences - not there before} -setup { deleteWindows } -body { menu .m1 } -cleanup { deleteWindows } -result {.m1} test menu-28.2 {TkCreateMenuReferences - there already} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m2 menu .m2 } -cleanup { deleteWindows } -result {.m2} test menu-29.1 {TkFindMenuReferences - not there} -setup { deleteWindows } -body { . configure -menu "" menu .m1 .m1 add cascade -menu .m2 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-30.1 {TkFindMenuReferences - there already} -setup { deleteWindows } -body { . configure -menu "" menu .m1 menu .m2 .m1 add cascade -menu .m2 list [. configure -menu .m1] [. configure -menu ""] } -cleanup { deleteWindows } -result {{} {}} test menu-31.1 {TkFreeMenuReferences - menuPtr} -setup { deleteWindows } -body { menu .m1 destroy .m1 } -cleanup { deleteWindows } -result {} test menu-31.2 {TkFreeMenuReferences - cascadePtr} -setup { deleteWindows } -body { . configure -menu "" menu .m1 .m1 add cascade -menu .m2 .m1 entryconfigure 1 -menu .m3 } -cleanup { deleteWindows } -result {} test menu-31.3 {TkFreeMenuReferences - topLevelListPtr} -setup { deleteWindows } -body { . configure -menu .m1 . configure -menu "" } -cleanup { deleteWindows } -returnCodes ok -result {} test menu-31.4 {TkFreeMenuReferences - not empty} -setup { deleteWindows } -body { menu .m1 .m1 add cascade -menu .m3 menu .m2 .m2 add cascade -menu .m3 .m2 entryconfigure 1 -menu ".foo" } -cleanup { deleteWindows } -result {} test menu-32.1 {DeleteMenuCloneEntries} -setup { deleteWindows } -body { menu .m1 .m1 add command -label foo .m1 clone .m2 .m1 delete 1 } -cleanup { deleteWindows } -result {} test menu-32.2 {DeleteMenuCloneEntries} -setup { deleteWindows } -body { menu .m1 .m1 add command -label one .m1 add command -label two .m1 add command -label three .m1 add command -label four .m1 clone .m2 .m1 delete 2 3 } -cleanup { deleteWindows } -result {} test menu-32.3 {DeleteMenuCloneEntries} -setup { deleteWindows } -body { menu .m1 -tearoff 0 .m1 add command -label one .m1 add command -label two .m1 add command -label three .m1 add command -label four .m1 clone .m2 .m2 configure -tearoff 1 .m1 delete 1 2 } -cleanup { deleteWindows } -result {} test menu-32.4 {DeleteMenuCloneEntries} -setup { deleteWindows } -body { menu .m1 .m1 add command -label one .m1 add command -label two .m1 add command -label three .m1 add command -label four .m1 clone .m2 .m2 configure -tearoff 0 .m1 delete 2 3 } -cleanup { deleteWindows } -result {} test menu-32.5 {DeleteMenuCloneEntries} -setup { deleteWindows } -body { menu .m1 .m1 add command -label one .m1 add command -label two .m1 clone .m2 .m1 activate one .m1 delete one } -cleanup { deleteWindows } -result {} test menu-32.6 {DeleteMenuCloneEntries - reentrancy - crashes tk8.0} -setup { deleteWindows } -body { menu .m1 .m1 add command -label test \ -command ".m1 delete test ; .m1 add command -label test -command \".m1 delete test\"; .m1 delete test" .m1 invoke test } -cleanup { deleteWindows } -result {} test menu-32.7 {DeleteMenuCloneEntries - one entry} -setup { deleteWindows } -body { menu .m1 -tearoff 0 .m1 add command -label Hello .m1 delete Hello } -cleanup { deleteWindows } -result {} test menu-32.8 {Ensure all menu clone commands are deleted} -setup { deleteWindows } -body { # SF bug #465324 menu .menubar . configure -menu .menubar menu .menubar.test .menubar.test add command -label "hi" for {set i 0} {$i < 10} {incr i} { .menubar add cascade -menu .menubar.test -label "Test" .menubar delete Test } info commands .#menubar*test* } -cleanup { deleteWindows } -result {} test menu-32.9 {Ensure deleting of clones doesn't corrupt menu refs} -setup { set res {} deleteWindows } -body { menu .menubar . configure -menu .menubar menu .menubar.test .menubar add cascade -menu .menubar.test -label "Test" menu .menubar.cascade .menubar.test add cascade -menu .menubar.cascade -label "Cascade" lappend res [.menubar.test entrycget 1 -menu] lappend res [.#menubar.#menubar#test entrycget 1 -menu] destroy .menubar.test menu .menubar.test .menubar.test add cascade -menu .menubar.cascade -label "Cascade" lappend res [.menubar.test entrycget 1 -menu] lappend res [.#menubar.#menubar#test entrycget 1 -menu] return $res } -cleanup { deleteWindows } -result {.menubar.cascade .#menubar.#menubar#test.#menubar#cascade .menubar.cascade .#menubar.#menubar#test.#menubar#cascade} test menu-33.1 {menu vs command hiding} -setup { deleteWindows } -body { set l [interp hidden] menu .m interp hide {} .m destroy .m set result [list [winfo children .] [interp hidden]] expr {$result eq [list {} $l]} } -result 1 # menu-34 MenuInit only called at boot time # creating menus on two different screens then deleting the # menu from the first screen crashes Tk8.3.1 # test menu-34.1 {menus on multiple screens - crashes tk8.3.1, Bug 5454} -constraints { altDisplay } -setup { deleteWindows } -body { toplevel .one menu .one.m toplevel .two -screen $::env(TK_ALT_DISPLAY) menu .two.m destroy .one destroy .two } -result {} test menu-35.1 {menu -underline string overruns Bug 1599877} -setup { destroy .m } -body { # ensure that -underline does not do string overruns [Bug 1599877] menu .m .m add command -label "File" -underline [expr {1<<30}] . configure -menu .m update tk::TraverseToMenu . "e" } -cleanup { deleteWindows } -result {} test menu-37.1 {menubar menues cannot be posted - bug 2160206} -setup { catch {destroy .m} } -body { # On Linux the following used to panic # It now returns an error (on all platforms) |
︙ | ︙ |
Changes to tests/menuDraw.test.
︙ | ︙ | |||
16 17 18 19 20 21 22 | } -body { menu .m1 } -cleanup { deleteWindows } -result {.m1} | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | } -body { menu .m1 } -cleanup { deleteWindows } -result {.m1} test menuDraw-2.1 {TkInitializeMenuEntryDrawingFields} -setup { deleteWindows } -body { menu .m1 .m1 add command } -cleanup { deleteWindows } -result {} |
︙ | ︙ | |||
72 73 74 75 76 77 78 | } -result {} test menuDraw-5.3 {TkMenuConfigureDrawOptions - no disabledFg} -setup { deleteWindows } -body { menu .m1 -disabledforeground "" } -cleanup { deleteWindows | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | } -result {} test menuDraw-5.3 {TkMenuConfigureDrawOptions - no disabledFg} -setup { deleteWindows } -body { menu .m1 -disabledforeground "" } -cleanup { deleteWindows } -result {.m1} test menuDraw-6.1 {TkMenuConfigureEntryDrawOptions - no tkfont specified} -setup { deleteWindows } -body { menu .m1 .m1 add command -label "foo" |
︙ | ︙ | |||
317 318 319 320 321 322 323 | update idletasks } -cleanup { deleteWindows } -result {} test menuDraw-11.1 {TkMenuSelectImageProc - entry selected; redraw not pending} -constraints { | | | | | 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | update idletasks } -cleanup { deleteWindows } -result {} test menuDraw-11.1 {TkMenuSelectImageProc - entry selected; redraw not pending} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 image create test image2 menu .m1 .m1 add checkbutton -image image1 -selectimage image2 .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] update idletasks list [image delete image2] [destroy .m1] } -cleanup { imageCleanup } -result {{} {}} test menuDraw-11.2 {TkMenuSelectImageProc - entry selected; redraw pending} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 image create test image2 menu .m1 .m1 add checkbutton -image image1 -selectimage image2 .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] list [image delete image2] [destroy .m1] } -cleanup { imageCleanup } -result {{} {}} test menuDraw-11.3 {TkMenuSelectImageProc - entry not selected} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 image create test image2 menu .m1 |
︙ | ︙ | |||
447 448 449 450 451 452 453 | .m1 add command -label "six" set tearoff [tk::TearOffMenu .m1 40 40] update } -cleanup { deleteWindows } -result {} test menuDraw-12.6 {Display menu - testing for extra space and menubars} -constraints { | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | .m1 add command -label "six" set tearoff [tk::TearOffMenu .m1 40 40] update } -cleanup { deleteWindows } -result {} test menuDraw-12.6 {Display menu - testing for extra space and menubars} -constraints { unix } -setup { deleteWindows } -body { menu .m1 .m1 add cascade -label foo . configure -menu .m1 update |
︙ | ︙ | |||
664 665 666 667 668 669 670 | deleteWindows } -body { menu .m1 .m1 add cascade -label test -menu .m2 menu .m2 .m2 add command -label "Hit ESCAPE to get rid of this menu" set tearoff [tk::TearOffMenu .m1 40 40] | | | 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 | deleteWindows } -body { menu .m1 .m1 add cascade -label test -menu .m2 menu .m2 .m2 add command -label "Hit ESCAPE to get rid of this menu" set tearoff [tk::TearOffMenu .m1 40 40] $tearoff postcascade 0 } -cleanup { deleteWindows } -result {} test menuDraw-17.1 {AdjustMenuCoords - menubar} -constraints unix -setup { deleteWindows |
︙ | ︙ |
Changes to tests/menubut.test.
︙ | ︙ | |||
390 391 392 393 394 395 396 | test menubutton-4.1 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -text "Menubutton 1" .mb1 configure -width 1i } -cleanup { deleteWindows | | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | test menubutton-4.1 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -text "Menubutton 1" .mb1 configure -width 1i } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "1i"} test menubutton-4.2 {ConfigureMenuButton procedure} -setup { deleteWindows } -body { button .mb1 -text "Menubutton 1" catch {.mb1 configure -width 1i} return $errorInfo } -cleanup { |
︙ | ︙ | |||
447 448 449 450 451 452 453 | deleteWindows } -result {bad screen distance "abc" (processing -width option) invoked from within ".mb1 configure -width abc"} test menubutton-4.7 {ConfigureMenuButton procedure} -constraints { | | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 | deleteWindows } -result {bad screen distance "abc" (processing -width option) invoked from within ".mb1 configure -width abc"} test menubutton-4.7 {ConfigureMenuButton procedure} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 button .mb1 -image image1 .mb1 configure -height 0.5x } -cleanup { deleteWindows imageCleanup } -returnCodes error -result {bad screen distance "0.5x"} test menubutton-4.8 {ConfigureMenuButton procedure} -constraints { testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 button .mb1 -image image1 catch {.mb1 configure -height 0.5x} |
︙ | ︙ | |||
495 496 497 498 499 500 501 | deleteWindows } -result {102 46 20 12} test menubutton-4.10 {ConfigureMenuButton procedure - bad direction} -setup { deleteWindows } -body { menubutton .mb -text "Test" | | | 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | deleteWindows } -result {102 46 20 12} test menubutton-4.10 {ConfigureMenuButton procedure - bad direction} -setup { deleteWindows } -body { menubutton .mb -text "Test" .mb configure -direction badValue } -cleanup { deleteWindows } -returnCodes error -result {bad direction "badValue": must be above, below, flush, left, or right} test menubutton-4.11 {ConfigureMenuButton procedure - bad direction} -setup { deleteWindows } -body { menubutton .mb -text "Test" |
︙ | ︙ | |||
538 539 540 541 542 543 544 | menubutton .mb1 rename .mb1 {} list [info command .mb*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} | > > > > | | | | | | | | | | | | | | | | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 | menubutton .mb1 rename .mb1 {} list [info command .mb*] [winfo children .] } -cleanup { deleteWindows } -result {{} {}} if {[tk windowingsystem] == "aqua"} { set extraWidth 36 } else { set extraWidth 0 } test menubutton-7.1 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { deleteWindows image create test image1 } -body { menubutton .mb -image image1 -bd 4 -highlightthickness 0 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows imageCleanup } -result [list [expr {38 + $extraWidth}] 23] test menubutton-7.2 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { deleteWindows image create test image1 } -body { menubutton .mb -image image1 -bd 3 -highlightthickness 1 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows imageCleanup } -result [list [expr {38 + $extraWidth}] 23] test menubutton-7.3 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { deleteWindows image create test image1 } -body { menubutton .mb -image image1 -bd 1 -highlightthickness 3 -padx 5 -pady 5 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows imageCleanup } -result [list [expr {38 + $extraWidth}] 23] test menubutton-7.4 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { deleteWindows image create test image1 } -body { menubutton .mb -image image1 -bd 2 -relief raised -width 40 \ -highlightthickness 2 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows imageCleanup } -result [list [expr {48 + $extraWidth}] 23] test menubutton-7.5 {ComputeMenuButtonGeometry procedure} -constraints { testImageType } -setup { deleteWindows image create test image1 } -body { menubutton .mb -image image1 -bd 2 -relief raised -height 30 \ -highlightthickness 2 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows imageCleanup } -result [list [expr {38 + $extraWidth}] 38] test menubutton-7.6 {ComputeMenuButtonGeometry procedure} -setup { deleteWindows } -body { menubutton .mb -bitmap question -bd 2 -relief raised \ -highlightthickness 2 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows } -result [list [expr {25 + $extraWidth}] 35] test menubutton-7.7 {ComputeMenuButtonGeometry procedure} -setup { deleteWindows } -body { menubutton .mb -bitmap question -bd 2 -relief raised -width 40 \ -highlightthickness 1 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows } -result [list [expr {46 + $extraWidth}] 33] test menubutton-7.8 {ComputeMenuButtonGeometry procedure} -setup { deleteWindows } -body { menubutton .mb -bitmap question -bd 2 -relief raised -height 50 \ -highlightthickness 1 pack .mb list [winfo reqwidth .mb] [winfo reqheight .mb] } -cleanup { deleteWindows } -result [list [expr {23 + $extraWidth}] 56] test menubutton-7.9 {ComputeMenuButtonGeometry procedure} -constraints { fonts } -setup { deleteWindows } -body { menubutton .mb -text String -bd 2 -relief raised -padx 0 -pady 0 \ -highlightthickness 1 |
︙ | ︙ | |||
742 743 744 745 746 747 748 749 750 751 752 753 754 755 | menubutton .mb interp hide {} .mb destroy .mb set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 eq $res2} } -result 1 deleteWindows option clear imageFinish | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | menubutton .mb interp hide {} .mb destroy .mb set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 eq $res2} } -result 1 test menubutton-9.1 {Bug [5d991b822e]} { # Want this not to segfault, or write to variable with empty name unset -nocomplain {} set var INIT menubutton .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b info exists {} } 0 test menubutton-9.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT menubutton .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} deleteWindows option clear imageFinish |
︙ | ︙ |
Changes to tests/message.test.
︙ | ︙ | |||
8 9 10 11 12 13 14 | package require tcltest 2.2 namespace import ::tcltest::* tcltest::loadTestedCommands eval tcltest::configure $argv | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | package require tcltest 2.2 namespace import ::tcltest::* tcltest::loadTestedCommands eval tcltest::configure $argv test message-1.1 {configuration option: "anchor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -anchor w .m cget -anchor } -cleanup { destroy .m } -result {w} test message-1.2 {configuration option: "anchor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -anchor bogus } -cleanup { destroy .m } -returnCodes {error} -result {bad anchor "bogus": must be n, ne, e, se, s, sw, w, nw, or center} test message-1.3 {configuration option: "aspect"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -aspect 3 .m cget -aspect } -cleanup { destroy .m } -result {3} test message-1.4 {configuration option: "aspect"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -aspect bogus } -cleanup { destroy .m } -returnCodes {error} -result {expected integer but got "bogus"} test message-1.5 {configuration option: "background"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -background #ff0000 .m cget -background } -cleanup { destroy .m } -result {#ff0000} test message-1.6 {configuration option: "background"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -background non-existent } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "non-existent"} test message-1.7 {configuration option: "bd"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bd 4 .m cget -bd } -cleanup { destroy .m } -result {4} test message-1.8 {configuration option: "bd"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bd badValue } -cleanup { destroy .m } -returnCodes {error} -result {bad screen distance "badValue"} test message-1.9 {configuration option: "bg"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bg #ff0000 .m cget -bg } -cleanup { destroy .m } -result {#ff0000} test message-1.10 {configuration option: "bg"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -bg non-existent } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "non-existent"} test message-1.11 {configuration option: "borderwidth"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -borderwidth 1.3 .m cget -borderwidth } -cleanup { destroy .m } -result {1} test message-1.12 {configuration option: "borderwidth"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -borderwidth badValue } -cleanup { destroy .m } -returnCodes {error} -result {bad screen distance "badValue"} test message-1.13 {configuration option: "cursor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -cursor arrow .m cget -cursor } -cleanup { destroy .m } -result {arrow} test message-1.14 {configuration option: "cursor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -cursor badValue } -cleanup { destroy .m } -returnCodes {error} -result {bad cursor spec "badValue"} test message-1.15 {configuration option: "fg"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -fg #00ff00 .m cget -fg } -cleanup { destroy .m } -result {#00ff00} test message-1.16 {configuration option: "fg"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -fg badValue } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "badValue"} test message-1.17 {configuration option: "font"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -font fixed .m cget -font } -cleanup { destroy .m } -result {fixed} test message-1.18 {configuration option: "font"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -font {} } -cleanup { destroy .m } -returnCodes {error} -result {font "" doesn't exist} test message-1.19 {configuration option: "-foreground"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -foreground green .m cget -foreground } -cleanup { destroy .m } -result {green} test message-1.20 {configuration option: "-foreground"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -foreground badValue } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "badValue"} test message-1.21 {configuration option: "highlightbackground"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightbackground #112233 .m cget -highlightbackground } -cleanup { destroy .m } -result {#112233} test message-1.22 {configuration option: "highlightbackground"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightbackground ugly } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "ugly"} test message-1.23 {configuration option: "highlightcolor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightcolor #123456 .m cget -highlightcolor } -cleanup { destroy .m } -result {#123456} test message-1.24 {configuration option: "highlightcolor"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightcolor non-existent } -cleanup { destroy .m } -returnCodes {error} -result {unknown color name "non-existent"} test message-1.25 {configuration option: "highlightthickness"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightthickness 2 .m cget -highlightthickness } -cleanup { destroy .m } -result {2} test message-1.26 {configuration option: "highlightthickness"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -highlightthickness badValue } -cleanup { destroy .m } -returnCodes {error} -result {bad screen distance "badValue"} test message-1.27 {configuration option: "justify"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -justify right .m cget -justify } -cleanup { destroy .m } -result {right} test message-1.28 {configuration option: "justify"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -justify bogus } -cleanup { destroy .m } -returnCodes {error} -result {bad justification "bogus": must be left, right, or center} test message-1.29 {configuration option: "padx"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -padx 12m .m cget -padx } -cleanup { destroy .m } -result {12m} test message-1.30 {configuration option: "padx"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -padx 420x } -cleanup { destroy .m } -returnCodes {error} -result {bad screen distance "420x"} test message-1.31 {configuration option: "pady"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -pady 12m .m cget -pady } -cleanup { destroy .m } -result {12m} test message-1.32 {configuration option: "pady"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -pady 420x } -cleanup { destroy .m } -returnCodes {error} -result {bad screen distance "420x"} test message-1.33 {configuration option: "relief"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -relief ridge .m cget -relief } -cleanup { destroy .m } -result {ridge} test message-1.34 {configuration option: "relief"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -relief badValue } -cleanup { destroy .m } -returnCodes {error} -result {bad relief "badValue": must be flat, groove, raised, ridge, solid, or sunken} test message-1.35 {configuration options: "text"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -text "Sample text" .m cget -text } -cleanup { destroy .m } -result {Sample text} test message-1.36 {configuration option: "textvariable"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -textvariable i .m cget -textvariable } -cleanup { destroy .m } -result {i} test message-1.37 {configuration option: "width"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update } -body { .m configure -width 2 .m cget -width } -cleanup { destroy .m } -result {2} test message-1.38 {configuration option: "width"} -setup { message .m -borderwidth 2 -highlightthickness 2 -font {Helvetica -12 bold} pack .m update |
︙ | ︙ | |||
399 400 401 402 403 404 405 | message } -returnCodes {error} -result {wrong # args: should be "message pathName ?-option value ...?"} test message-2.2 {Tk_MessageObjCmd procedure} -body { message foo } -returnCodes {error} -result {bad window path name "foo"} test message-2.3 {Tk_MessageObjCmd procedure} -body { | | | | | | 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | message } -returnCodes {error} -result {wrong # args: should be "message pathName ?-option value ...?"} test message-2.2 {Tk_MessageObjCmd procedure} -body { message foo } -returnCodes {error} -result {bad window path name "foo"} test message-2.3 {Tk_MessageObjCmd procedure} -body { catch {message foo} winfo child . } -result {} test message-2.4 {Tk_MessageObjCmd procedure} -body { message .s -gorp dump } -returnCodes {error} -result {unknown option "-gorp"} test message-2.5 {Tk_MessageObjCmd procedure} -body { catch {message .s -gorp dump} winfo child . } -result {} test message-3.1 {MessageWidgetObjCmd procedure} -setup { message .m } -body { .m } -cleanup { destroy .m } -returnCodes error -result {wrong # args: should be ".m option ?arg ...?"} test message-3.2 {MessageWidgetObjCmd procedure, "cget"} -setup { message .m } -body { .m cget |
︙ | ︙ | |||
438 439 440 441 442 443 444 | destroy .m } -returnCodes error -result {unknown option "-gorp"} test message-3.4 {MessageWidgetObjCmd procedure, "configure"} -setup { message .m } -body { .m configure -text foobar | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | destroy .m } -returnCodes error -result {unknown option "-gorp"} test message-3.4 {MessageWidgetObjCmd procedure, "configure"} -setup { message .m } -body { .m configure -text foobar lindex [.m configure -text] 4 } -cleanup { destroy .m } -result {foobar} test message-3.5 {MessageWidgetObjCmd procedure, "configure"} -setup { message .m } -body { llength [.m configure] |
︙ | ︙ | |||
465 466 467 468 469 470 471 472 473 474 | } -body { .m configure -bd 4 .m configure -bg #ffffff lindex [.m configure -bd] 4 } -cleanup { destroy .m } -result {4} cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 | } -body { .m configure -bd 4 .m configure -bg #ffffff lindex [.m configure -bd] 4 } -cleanup { destroy .m } -result {4} test message-4.1 {Bug [5d991b822e]} { # Want this not to segfault, or write to variable with empty name unset -nocomplain {} set var INIT message .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b info exists {} } 0 test message-4.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT message .b -textvariable var trace add variable var unset {apply {args { .b configure -textvariable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} cleanupTests return |
Changes to tests/msgbox.test.
︙ | ︙ | |||
117 118 119 120 121 122 123 | } } # # Try out all combinations of (type) x (default button) and # (type) x (icon). # test msgbox-2.1 {tk_messageBox command} -constraints { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | } } # # Try out all combinations of (type) x (default button) and # (type) x (icon). # test msgbox-2.1 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" -type abortretryignore } -result {abort} test msgbox-2.2 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" \ -type abortretryignore -icon warning } -result {abort} test msgbox-2.3 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" \ -type abortretryignore -icon error } -result {abort} test msgbox-2.4 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" \ -type abortretryignore -icon info } -result {abort} test msgbox-2.5 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" \ -type abortretryignore -icon question } -result {abort} test msgbox-2.6 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . abort tk_messageBox -title Hi -message "Please press abort" \ -type abortretryignore -default abort } -result {abort} test msgbox-2.7 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type abortretryignore -default retry } -result {retry} test msgbox-2.8 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ignore tk_messageBox -title Hi -message "Please press ignore" \ -type abortretryignore -default ignore } -result {ignore} test msgbox-2.9 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" -type ok } -result {ok} test msgbox-2.10 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type ok -icon warning } -result {ok} test msgbox-2.11 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type ok -icon error } -result {ok} test msgbox-2.12 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type ok -icon info } -result {ok} test msgbox-2.13 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type ok -icon question } -result {ok} test msgbox-2.14 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type ok -default ok } -result {ok} test msgbox-2.15 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" -type okcancel } -result {ok} test msgbox-2.16 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type okcancel -icon warning } -result {ok} test msgbox-2.17 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type okcancel -icon error } -result {ok} test msgbox-2.18 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type okcancel -icon info } -result {ok} test msgbox-2.19 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type okcancel -icon question } -result {ok} test msgbox-2.20 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . ok tk_messageBox -title Hi -message "Please press ok" \ -type okcancel -default ok } -result {ok} test msgbox-2.21 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . cancel tk_messageBox -title Hi -message "Please press cancel" \ -type okcancel -default cancel } -result {cancel} test msgbox-2.22 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" -type retrycancel } -result {retry} test msgbox-2.23 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type retrycancel -icon warning } -result {retry} test msgbox-2.24 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type retrycancel -icon error } -result {retry} test msgbox-2.25 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type retrycancel -icon info } -result {retry} test msgbox-2.26 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type retrycancel -icon question } -result {retry} test msgbox-2.27 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . retry tk_messageBox -title Hi -message "Please press retry" \ -type retrycancel -default retry } -result {retry} test msgbox-2.28 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . cancel tk_messageBox -title Hi -message "Please press cancel" \ -type retrycancel -default cancel } -result {cancel} test msgbox-2.29 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" -type yesno } -result {yes} test msgbox-2.30 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesno -icon warning } -result {yes} test msgbox-2.31 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesno -icon error } -result {yes} test msgbox-2.32 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesno -icon info } -result {yes} test msgbox-2.33 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesno -icon question } -result {yes} test msgbox-2.34 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesno -default yes } -result {yes} test msgbox-2.35 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . no tk_messageBox -title Hi -message "Please press no" \ -type yesno -default no } -result {no} test msgbox-2.36 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" -type yesnocancel } -result {yes} test msgbox-2.37 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesnocancel -icon warning } -result {yes} test msgbox-2.38 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesnocancel -icon error } -result {yes} test msgbox-2.39 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesnocancel -icon info } -result {yes} test msgbox-2.40 {tk_messageBox command -icon option} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesnocancel -icon question } -result {yes} test msgbox-2.41 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . yes tk_messageBox -title Hi -message "Please press yes" \ -type yesnocancel -default yes } -result {yes} test msgbox-2.42 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . no tk_messageBox -title Hi -message "Please press no" \ -type yesnocancel -default no } -result {no} test msgbox-2.43 {tk_messageBox command} -constraints { nonUnixUserInteraction } -body { ChooseMsg . cancel tk_messageBox -title Hi -message "Please press cancel" \ -type yesnocancel -default cancel } -result {cancel} # These tests will hang your test suite if they fail. test msgbox-3.1 {tk_messageBox handles withdrawn parent} -constraints { nonUnixUserInteraction } -body { wm withdraw . ChooseMsg . "ok" tk_messageBox -title Hi -message "Please press ok" \ -type ok -default ok } -cleanup { wm deiconify . } -result {ok} test msgbox-3.2 {tk_messageBox handles iconified parent} -constraints { nonUnixUserInteraction } -body { wm iconify . ChooseMsg . "ok" tk_messageBox -title Hi -message "Please press ok" \ -type ok -default ok } -cleanup { wm deiconify . |
︙ | ︙ |
Changes to tests/option.file1.
︙ | ︙ | |||
9 10 11 12 13 14 15 | *\ x3 \ : pur\ ple *x 4: brown # More comments, this time delimited by hash-marks. # Comment-line with space. | | | 9 10 11 12 13 14 15 16 17 18 | *\ x3 \ : pur\ ple *x 4: brown # More comments, this time delimited by hash-marks. # Comment-line with space. *x6: *x9: \ \ \\\101\n # comment line as last line of file. |
Changes to tests/option.file3.
︙ | ︙ | |||
9 10 11 12 13 14 15 | *\ x3 \ : pur\ ple *x 4: brówn # More comments, this time delimited by hash-marks. # Comment-line with space. | | | 9 10 11 12 13 14 15 16 17 18 | *\ x3 \ : pur\ ple *x 4: brówn # More comments, this time delimited by hash-marks. # Comment-line with space. *x6: *x9: \ \ \\\101\n # comment line as last line of file. |
Changes to tests/option.test.
︙ | ︙ | |||
281 282 283 284 285 286 287 | } -result {} test option-12.6 {stack pushing/popping} -body { option get .op1 z Color2 } -result {} # Test the major priority levels (widgetDefault, etc.) | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | } -result {} test option-12.6 {stack pushing/popping} -body { option get .op1 z Color2 } -result {} # Test the major priority levels (widgetDefault, etc.) # Configurations for tests 13.* option clear option add $appName.op1.a 100 100 option add $appName.op1.A interactive interactive option add $appName.op1.b userDefault userDefault option add $appName.op1.B startupFile startupFile option add $appName.op1.c widgetDefault widgetDefault option add $appName.op1.C 0 0 |
︙ | ︙ |
Changes to tests/pack.test.
|
| | | | 1 2 3 4 5 6 7 8 9 | # This file is a Tcl script to test out the "pack" command of Tk. It is # organized in the standard fashion for Tcl tests. # # Copyright (c) 1993 The Regents of the University of California. # Copyright (c) 1994 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 |
︙ | ︙ | |||
24 25 26 27 28 29 30 | label .pack.$i.label -text $i -relief raised place .pack.$i.label -relwidth 1.0 -relheight 1.0 } .pack.a config -width 20 -height 40 .pack.b config -width 50 -height 30 .pack.c config -width 80 -height 80 .pack.d config -width 40 -height 30 | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | label .pack.$i.label -text $i -relief raised place .pack.$i.label -relwidth 1.0 -relheight 1.0 } .pack.a config -width 20 -height 40 .pack.b config -width 50 -height 30 .pack.c config -width 80 -height 80 .pack.d config -width 40 -height 30 test pack-1.1 {-side option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] |
︙ | ︙ | |||
227 228 229 230 231 232 233 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipadx 5 -padx {5 15} -fill x pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] } -result {280x40+5+0 300x160+0+40} | < < | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipadx 5 -padx {5 15} -fill x pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] } -result {280x40+5+0 300x160+0+40} test pack-2.22 {x padding and filling} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -padx 1c set x [pack info .pack.a] set res1 [lindex $x [expr [lsearch -exact $x -padx]+1]] set res2 [winfo pixels .pack 1c] expr {$res1 eq $res2} } -result 1 test pack-2.23 {x padding and filling} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -ipadx 1c set x [pack info .pack.a] set res1 [lindex $x [expr [lsearch -exact $x -ipadx]+1]] set res2 [winfo pixels .pack 1c] expr {$res1 eq $res2} } -result 1 test pack-3.1 {y padding and filling} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side right -pady 20 pack .pack.b -expand yes -fill both update |
︙ | ︙ | |||
416 417 418 419 420 421 422 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipady 5 -pady {1 19} -fill y pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] } -result {20x50+140+1 300x130+0+70} | < < | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipady 5 -pady {1 19} -fill y pack .pack.b -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] } -result {20x50+140+1 300x130+0+70} test pack-3.22 {y padding and filling} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -pady 1c set x [pack info .pack.a] set res1 [lindex $x [expr [lsearch -exact $x -pady]+1]] set res2 [winfo pixels .pack 1c] expr {$res1 eq $res2} } -result 1 test pack-3.23 {y padding and filling} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -ipady 1c set x [pack info .pack.a] set res1 [lindex $x [expr [lsearch -exact $x -ipady]+1]] set res2 [winfo pixels .pack 1c] expr {$res1 eq $res2} } -result 1 test pack-4.1 {anchors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor n update winfo geometry .pack.a |
︙ | ︙ | |||
500 501 502 503 504 505 506 | test pack-4.9 {anchors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center update winfo geometry .pack.a } -result {30x70+135+65} | < | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | test pack-4.9 {anchors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center update winfo geometry .pack.a } -result {30x70+135+65} # Repeat above tests, but with a frame that isn't at (0,0), so that # we can be sure that the frame offset is being added in correctly. test pack-5.1 {more anchors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { |
︙ | ︙ | |||
586 587 588 589 590 591 592 | } -body { pack .pack.a -side top pack .pack.c -side left pack .pack.b -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center update winfo geometry .pack.b } -result {60x60+160+90} | < | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | } -body { pack .pack.a -side top pack .pack.c -side left pack .pack.b -side top -ipadx 5 -padx 10 -ipady 15 -pady 20 -expand y -anchor center update winfo geometry .pack.b } -result {60x60+160+90} test pack-6.1 {-expand option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side left update list [winfo geometry .pack.a] [winfo geometry .pack.b] \ |
︙ | ︙ | |||
693 694 695 696 697 698 699 | pack .pack.b -side top -expand yes -fill both pack .pack.c -side right -expand 1 -fill both pack .pack.d -side bottom -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] \ [winfo geometry .pack.c] [winfo geometry .pack.d] } -result {100x200+0+0 200x100+100+0 160x100+140+100 40x100+100+100} | < | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | pack .pack.b -side top -expand yes -fill both pack .pack.c -side right -expand 1 -fill both pack .pack.d -side bottom -expand yes -fill both update list [winfo geometry .pack.a] [winfo geometry .pack.b] \ [winfo geometry .pack.c] [winfo geometry .pack.d] } -result {100x200+0+0 200x100+100+0 160x100+140+100 40x100+100+100} test pack-6.12 {-expand option} -setup { toplevel .pack2 -height 400 -width 400 wm geometry .pack2 +0+0 pack propagate .pack2 0 foreach i {w1 w2 w3} { frame .pack2.$i -width 30 -height 30 -bd 2 -relief raised label .pack2.$i.l -text $i |
︙ | ︙ | |||
727 728 729 730 731 732 733 | pack .pack2.w1 .pack2.w2 .pack2.w3 -padx 5 -ipadx 4 -pady 2 \ -ipady 6 -expand 1 -side top update list [winfo geometry .pack2.w1] [winfo geometry .pack2.w2] [winfo geometry .pack2.w3] } -cleanup { destroy .pack2 } -result {38x42+181+45 38x42+181+178 38x42+181+312} | < | 720 721 722 723 724 725 726 727 728 729 730 731 732 733 | pack .pack2.w1 .pack2.w2 .pack2.w3 -padx 5 -ipadx 4 -pady 2 \ -ipady 6 -expand 1 -side top update list [winfo geometry .pack2.w1] [winfo geometry .pack2.w2] [winfo geometry .pack2.w3] } -cleanup { destroy .pack2 } -result {38x42+181+45 38x42+181+178 38x42+181+312} wm geometry .pack {} test pack-7.1 {requesting size for parent} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side left -padx 5 -pady 10 update |
︙ | ︙ | |||
786 787 788 789 790 791 792 | } -body { pack .pack.a -side right pack .pack.c -side bottom pack .pack.d -side top update list [winfo reqwidth .pack] [winfo reqheight .pack] } -result {100 110} | < | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | } -body { pack .pack.a -side right pack .pack.c -side bottom pack .pack.d -side top update list [winfo reqwidth .pack] [winfo reqheight .pack] } -result {100 110} # For the tests below, create a couple of "pad" windows to shrink # the available space for the remaining windows. The tests have to # be done this way rather than shrinking the whole window, because # some window managers like mwm won't let a top-level window get # very small. |
︙ | ︙ | |||
868 869 870 871 872 873 874 | test pack-8.9 {insufficient space} -body { list [winfo geometry .pack.a] [winfo ismapped .pack.a] \ [winfo geometry .pack.b] [winfo ismapped .pack.b] \ [winfo geometry .pack.c] [winfo ismapped .pack.c] } -result {20x40+0+20 1 50x30+100+25 1 80x80+20+0 1} pack forget .pack.right .pack.bottom | < | 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | test pack-8.9 {insufficient space} -body { list [winfo geometry .pack.a] [winfo ismapped .pack.a] \ [winfo geometry .pack.b] [winfo ismapped .pack.b] \ [winfo geometry .pack.c] [winfo ismapped .pack.c] } -result {20x40+0+20 1 50x30+100+25 1 80x80+20+0 1} pack forget .pack.right .pack.bottom test pack-9.1 {window ordering} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d -side top pack .pack.a -after .pack.b pack slaves .pack } -result {.pack.b .pack.a .pack.c .pack.d} |
︙ | ︙ | |||
941 942 943 944 945 946 947 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d pack .pack.a .pack.c .pack.d .pack.b -after .pack.a pack slaves .pack } -result {.pack.a .pack.c .pack.d .pack.b} | < | 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a .pack.b .pack.c .pack.d pack .pack.a .pack.c .pack.d .pack.b -after .pack.a pack slaves .pack } -result {.pack.a .pack.c .pack.d .pack.b} test pack-10.1 {retaining/clearing configuration state} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side bottom -anchor n -padx 1 -pady 2 -ipadx 3 -ipady 4 \ -fill both -expand 1 pack forget .pack.a pack .pack.a |
︙ | ︙ | |||
972 973 974 975 976 977 978 | } -result {{} {}} test pack-10.4 {bad -in window does not change master} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { winfo manager .pack.a pack .pack.a -in .pack.a } -returnCodes error -result {can't pack .pack.a inside itself} | | > > > > > > > > > > > > > > > > > > > > | 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | } -result {{} {}} test pack-10.4 {bad -in window does not change master} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { winfo manager .pack.a pack .pack.a -in .pack.a } -returnCodes error -result {can't pack .pack.a inside itself} test pack-10.5 {prevent management loops} -body { frame .f1 frame .f2 pack .f1 -in .f2 pack .f2 -in .f1 } -cleanup { destroy .f1 destroy .f2 } -returnCodes error -result {can't put .f2 inside .f1, would cause management loop} test pack-10.6 {prevent management loops} -body { frame .f1 frame .f2 frame .f3 pack .f1 -in .f2 pack .f2 -in .f3 pack .f3 -in .f1 } -cleanup { destroy .f1 destroy .f2 destroy .f3 } -returnCodes error -result {can't put .f3 inside .f1, would cause management loop} test pack-11.1 {info option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -in .pack set i [pack info .pack.a] lindex $i [expr [lsearch -exact $i -in]+1] |
︙ | ︙ | |||
1107 1108 1109 1110 1111 1112 1113 | test pack-11.19 {info option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side right set i [pack info .pack.a] lindex $i [expr [lsearch -exact $i -side]+1] } -result right | < | 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 | test pack-11.19 {info option} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a -side right set i [pack info .pack.a] lindex $i [expr [lsearch -exact $i -side]+1] } -result right test pack-12.1 {command options and errors} -body { pack } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} test pack-12.2 {command options and errors} -body { pack foo } -returnCodes error -result {wrong # args: should be "pack option arg ?arg ...?"} |
︙ | ︙ | |||
1350 1351 1352 1353 1354 1355 1356 | } -returnCodes ok -result {} test pack-12.46 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack lousy .pack } -returnCodes error -result {bad option "lousy": must be configure, forget, info, propagate, or slaves} | < < | 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 | } -returnCodes ok -result {} test pack-12.46 {command options and errors} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack lousy .pack } -returnCodes error -result {bad option "lousy": must be configure, forget, info, propagate, or slaves} test pack-13.1 {window deletion} -setup { pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom } -body { pack .pack.right -side right pack .pack.bottom -side bottom pack .pack.a .pack.d .pack.b .pack.c -side top update destroy .pack.d update set result [list [pack slaves .pack] [winfo geometry .pack.a] \ [winfo geometry .pack.b] [winfo geometry .pack.c]] } -result {{.pack.right .pack.bottom .pack.a .pack.b .pack.c} 20x40+30+0 50x30+15+40 80x80+0+70} test pack-14.1 {respond to changes in expansion} -setup { pack forget .pack.a .pack.b .pack.c .pack.d .pack.right .pack.bottom } -body { pack .pack.right -side right pack .pack.bottom -side bottom wm geom .pack {} |
︙ | ︙ | |||
1490 1491 1492 1493 1494 1495 1496 | pack .pack.a -before .pack.b -side top update lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b] } -cleanup { destroy .pack.f1 .pack.f2 } -result {50x16+25+22 1 50x16+25+22 0} | < < | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | pack .pack.a -before .pack.b -side top update lappend result [winfo geometry .pack.b] [winfo ismapped .pack.b] } -cleanup { destroy .pack.f1 .pack.f2 } -result {50x16+25+22 1 50x16+25+22 0} test pack-16.1 {geometry manager name} -setup { pack forget .pack.a .pack.b .pack.c .pack.d set result {} } -body { lappend result [winfo manager .pack.a] pack .pack.a lappend result [winfo manager .pack.a] pack forget .pack.a lappend result [winfo manager .pack.a] } -result {{} pack {}} test pack-17.1 {PackLostSlaveProc procedure} -setup { pack forget .pack.a .pack.b .pack.c .pack.d } -body { pack .pack.a update place .pack.a -x 40 -y 10 |
︙ | ︙ | |||
1524 1525 1526 1527 1528 1529 1530 | place .pack.a -x 40 -y 10 update winfo manager .pack.a winfo geometry .pack.a pack info .pack.a } -returnCodes error -result {window ".pack.a" isn't packed} | < < | | 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | place .pack.a -x 40 -y 10 update winfo manager .pack.a winfo geometry .pack.a pack info .pack.a } -returnCodes error -result {window ".pack.a" isn't packed} test pack-18.1 {unmap slaves when master unmapped} -constraints { tempNotPc } -setup { eval destroy [winfo child .pack] } -body { # adjust the position of .pack before test to avoid a screen switch # that occurs with window managers that have desktops four times as big # as the screen (screen switch causes scale and other tests to fail). wm geometry .pack +100+100 # On the PC, when the width/height is configured while the window is # unmapped, the changes don't take effect until the window is remapped. # Who knows why? eval destroy [winfo child .pack] frame .pack.a -width 100 -height 50 -relief raised -bd 2 pack .pack.a update |
︙ | ︙ | |||
1560 1561 1562 1563 1564 1565 1566 | wm deiconify .pack update lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} test pack-18.2 {unmap slaves when master unmapped} -setup { eval destroy [winfo child .pack] } -body { | < | 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | wm deiconify .pack update lappend result [winfo ismapped .pack.a] } -result {1 0 200 75 0 1} test pack-18.2 {unmap slaves when master unmapped} -setup { eval destroy [winfo child .pack] } -body { # adjust the position of .pack before test to avoid a screen switch # that occurs with window managers that have desktops four times as big # as the screen (screen switch causes scale and other tests to fail). wm geometry .pack +100+100 frame .pack.a -relief raised -bd 2 frame .pack.b -width 70 -height 30 -relief sunken -bd 2 |
︙ | ︙ | |||
1583 1584 1585 1586 1587 1588 1589 | update lappend result [winfo width .pack.b ] [winfo height .pack.b] \ [winfo ismapped .pack.b] wm deiconify .pack update lappend result [winfo ismapped .pack.b] } -result {1 0 100 30 0 1} | < | 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 | update lappend result [winfo width .pack.b ] [winfo height .pack.b] \ [winfo ismapped .pack.b] wm deiconify .pack update lappend result [winfo ismapped .pack.b] } -result {1 0 100 30 0 1} test pack-19.1 {test respect for internalborder} -setup { catch {eval pack forget [pack slaves .pack]} destroy .pack.l .pack.lf } -body { wm geometry .pack 200x200 frame .pack.l -width 15 -height 10 |
︙ | ︙ | |||
1622 1623 1624 1625 1626 1627 1628 | .pack.lf configure -labelanchor ws update lappend res [winfo geometry .pack.lf] } -cleanup { destroy .pack.l .pack.lf } -result {162x127+0+0 172x112+0+0} | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > | 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 | .pack.lf configure -labelanchor ws update lappend res [winfo geometry .pack.lf] } -cleanup { destroy .pack.l .pack.lf } -result {162x127+0+0 172x112+0+0} test pack-20.1 {<<NoManagedChild>> fires on last pack forget} -setup { global A unset -nocomplain A } -body { pack [frame .1] update bind . <<NoManagedChild>> {set A 1} pack forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} destroy .1 } -result {1} test pack-20.2 {<<NoManagedChild>> fires on last packed child destruction} -setup { global A unset -nocomplain A } -body { pack [frame .1] update bind . <<NoManagedChild>> {incr A} destroy .1 update set A } -cleanup { bind . <<NoManagedChild>> {} destroy .1 } -result {1} test pack-20.3 {<Configure> does not fire on last pack forget} -setup { global A unset -nocomplain A } -body { pack [frame .1] update bind . <Configure> {set A 1} pack forget .1 update info exists A } -cleanup { bind . <Configure> {} destroy .1 } -result {0} test pack-20.4 {<<NoManagedChild>> does not fire on forelast pack forget} -setup { global A unset -nocomplain A } -body { pack [frame .1] pack [frame .2] update bind . <<NoManagedChild>> {set A 1} pack forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} destroy .1 .2 } -result {0} test pack-20.5 {<Configure> does not fire on last pack forget} -setup { global A unset -nocomplain A } -body { pack [frame .1] pack [frame .2] update bind . <Configure> {set A 1} pack forget .1 update info exists A } -cleanup { bind . <Configure> {} destroy .1 .2 } -result {1} test pack-20.6 {<<NoManagedChild>> does not fire on last pack forget if propagation is off} -setup { global A unset -nocomplain A } -body { pack [frame .1] pack propagate . 0 update bind . <<NoManagedChild>> {set A 1} pack forget .1 update info exists A } -cleanup { bind . <<NoManagedChild>> {} destroy .1 } -result {0} # cleanup cleanupTests return # Local Variables: # mode: tcl # End: |
Changes to tests/panedwindow.test.
︙ | ︙ | |||
494 495 496 497 498 499 500 | deleteWindows } -body { # There are no sashes until you have 2 panes panedwindow .p .p add [frame .p.f] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] $msg \ | | | | 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | deleteWindows } -body { # There are no sashes until you have 2 panes panedwindow .p .p add [frame .p.f] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] $msg \ [catch {.p sash coord 1} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 1 "invalid sash index" 1 "invalid sash index"] test panedwindow-6.10 {sash coord subcommand, errors} -setup { deleteWindows } -body { # There are no sashes until you have 2 panes panedwindow .p .p add [frame .p.f] [frame .p.f2] list [catch {.p sash coord -1} msg] $msg \ [catch {.p sash coord 0} msg] \ [catch {.p sash coord 1} msg] $msg \ [catch {.p sash coord 2} msg] $msg } -cleanup { deleteWindows } -result [list 1 "invalid sash index" 0 1 "invalid sash index" 1 "invalid sash index"] test panedwindow-7.1 {sash mark subcommand, errors} -setup { deleteWindows |
︙ | ︙ | |||
618 619 620 621 622 623 624 | } -body { panedwindow .p .p add [button .b] [button .c] .p sash dragto 0 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} | | | 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 | } -body { panedwindow .p .p add [button .b] [button .c] .p sash dragto 0 0 bar } -cleanup { deleteWindows } -returnCodes error -result {expected integer but got "bar"} test panedwindow-9.1 {sash mark/sash dragto interaction} -setup { deleteWindows } -body { panedwindow .p -borderwidth 0 -sashpad 0 -sashwidth 4 -showhandle false .p add [frame .f -width 20 -height 20] [button .c -text foobar] .p sash mark 0 10 10 |
︙ | ︙ | |||
921 922 923 924 925 926 927 | update .p sash place 1 200 0 update lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result {68 100} | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | update .p sash place 1 200 0 update lappend result [winfo reqwidth .p] } -cleanup { deleteWindows } -result {68 100} test panedwindow-12.1 {horizontal panedwindow lays out widgets properly} -setup { deleteWindows set result {} } -body { panedwindow .p -showhandle false -borderwidth 2 -sashpad 2 -sashwidth 2 foreach win {.p.f .p.f2 .p.f3} {.p add [frame $win -width 20 -height 10]} |
︙ | ︙ | |||
1145 1146 1147 1148 1149 1150 1151 | set result "" } -result {} test panedwindow-13.2 {PanedWindowLostSlaveProc, widget yields management} -setup { deleteWindows } -body { # Check that the paned window correctly yields geometry management of # a slave when some other geometry manager steals the slave from us. | | | 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 | set result "" } -result {} test panedwindow-13.2 {PanedWindowLostSlaveProc, widget yields management} -setup { deleteWindows } -body { # Check that the paned window correctly yields geometry management of # a slave when some other geometry manager steals the slave from us. # This test should not cause a core dump, and it should not cause a # memory leak. panedwindow .p .p add [button .b] pack .p update pack .b |
︙ | ︙ | |||
1514 1515 1516 1517 1518 1519 1520 | panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqwidth .p] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 | panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqwidth .p] .p sash place 0 30 0 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {30 0}] test panedwindow-17.2 {MoveSash, move right (unmapped) clipped by reqwidth} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 100 0 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 40 0] test panedwindow-17.3 {MoveSash, move right (mapped, width < reqwidth) clipped by width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width < reqwidth place .p -x 0 -y 0 -width 32 update .p sash place 0 100 0 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 30 0] test panedwindow-17.4 {MoveSash, move right (mapped, width > reqwidth) clipped by width} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -width 102 update .p sash place 0 200 0 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 100 0] test panedwindow-17.5 {MoveSash, move right respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 30 0] test panedwindow-17.6 {MoveSash, move right respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 0 } -cleanup { deleteWindows } -result [list 40 0] test panedwindow-17.7 {MoveSash, move right pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 62 0] test panedwindow-17.8 {MoveSash, move right pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 52 0] test panedwindow-17.9 {MoveSash, move right respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -padx 5 } .p sash place 0 100 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 50 0] test panedwindow-17.10 {MoveSash, move right, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 0 50 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 50 0] [list 52 0]] test panedwindow-17.11 {MoveSash, move left} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqwidth .p] .p sash place 0 10 0 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqwidth .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {10 0}] test panedwindow-17.12 {MoveSash, move left, can't move outside of window} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 -100 0 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-17.13 {MoveSash, move left respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 10 0] test panedwindow-17.14 {MoveSash, move left respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { deleteWindows } -result [list 22 0] test panedwindow-17.15 {MoveSash, move left pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-17.16 {MoveSash, move left pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 10 0] test panedwindow-17.17 {MoveSash, move left respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -padx 5 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 42 0] test panedwindow-17.18 {MoveSash, move left, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 foreach w {.f1 .f2 .f3} c {red blue green} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 1 10 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 8 0] [list 10 0]] test panedwindow-18.1 {MoveSash, move down} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqheight .p] .p sash place 0 0 30 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {0 30}] test panedwindow-18.2 {MoveSash, move down (unmapped) clipped by reqheight} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 100 # Get the new sash coord; it should be clipped by the reqheight of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 40] test panedwindow-18.3 {MoveSash, move down (mapped, height < reqheight) clipped by height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a height < reqheight place .p -x 0 -y 0 -height 32 update .p sash place 0 0 100 # Get the new sash coord; it should be clipped by the visible height of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 30] test panedwindow-18.4 {MoveSash, move down (mapped, height > reqheight) clipped by height} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Put the panedwindow up on the display and give it a width > reqwidth place .p -x 0 -y 0 -height 102 update .p sash place 0 0 200 # Get the new sash coord; it should be clipped by the visible width of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 100] test panedwindow-18.5 {MoveSash, move down respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 30] test panedwindow-18.6 {MoveSash, move down respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 40] test panedwindow-18.7 {MoveSash, move down pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 62] test panedwindow-18.8 {MoveSash, move down pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 52] test panedwindow-18.9 {MoveSash, move down respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -pady 5 } .p sash place 0 0 100 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 50] test panedwindow-18.10 {MoveSash, move right, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 0 0 50 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 0 50] [list 0 52]] test panedwindow-18.11 {MoveSash, move up} -setup { deleteWindows } -body { set result {} panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } # Get the requested width of the paned window lappend result [winfo reqheight .p] .p sash place 0 0 10 # Get the reqwidth again, to make sure it hasn't changed lappend result [winfo reqheight .p] # Check that the sash moved lappend result [.p sash coord 0] } -cleanup { deleteWindows } -result [list 42 42 {0 10}] test panedwindow-18.12 {MoveSash, move up, can't move outside of window} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 0 0 -100 # Get the new sash coord; it should be clipped by the reqwidth of # the panedwindow. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-18.13 {MoveSash, move up respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 0 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 10] test panedwindow-18.14 {MoveSash, move up respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 22] test panedwindow-18.15 {MoveSash, move up pushes other sashes} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 0] test panedwindow-18.16 {MoveSash, move up pushes other sashes, respects minsize} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew -minsize 10 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible while # respecting minsizes. .p sash coord 0 } -cleanup { deleteWindows } -result [list 0 10] test panedwindow-18.17 {MoveSash, move up respects minsize, exludes pad} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize 10 -pady 5 } .p sash place 1 0 0 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. .p sash coord 1 } -cleanup { deleteWindows } -result [list 0 42] test panedwindow-18.18 {MoveSash, move up, negative minsize becomes 0} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 \ -orient vertical foreach w {.f1 .f2 .f3} c {red blue green} { .p add [frame $w -height 20 -width 20 -bg $c] \ -sticky nsew -minsize -50 } .p sash place 1 0 10 # Get the new sash coord; it should have moved as far as possible, # respecting minsizes. list [.p sash coord 0] [.p sash coord 1] } -cleanup { deleteWindows } -result [list [list 0 8] [list 0 10]] |
︙ | ︙ | |||
4324 4325 4326 4327 4328 4329 4330 | .p add [frame .f -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] destroy .f winfo reqwidth .p } -cleanup { deleteWindows } -result 20 | | | 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 | .p add [frame .f -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] destroy .f winfo reqwidth .p } -cleanup { deleteWindows } -result 20 test panedwindow-21.1 {ArrangePanes, extra space is given to the last pane} -setup { deleteWindows } -body { panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2 .p add [frame .f1 -width 20 -height 20 -bg blue] \ [frame .f2 -width 20 -height 20 -bg red] -sticky nsew |
︙ | ︙ |
Added tests/pkgconfig.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # -*- tcl -*- # Commands covered: pkgconfig # # This file contains a collection of tests for one or more of the Tk # built-in commands. Sourcing this file into Tk runs the tests and # generates output for errors. No output means no errors were found. # # Copyright (c) 1991-1993 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2017 Stuart Cassoff <[email protected]> # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands test pkgconfig-1.1 {query keys} nonwin { lsort [::tk::pkgconfig list] } [list \ 64bit bindir,install bindir,runtime debug demodir,install demodir,runtime \ docdir,install docdir,runtime fontsystem includedir,install includedir,runtime \ libdir,install libdir,runtime mem_debug optimized profiled \ scriptdir,install scriptdir,runtime threaded \ ] test pkgconfig-1.2 {query keys multiple times} { string compare [::tk::pkgconfig list] [::tk::pkgconfig list] } 0 test pkgconfig-1.3 {query value multiple times} { string compare \ [::tk::pkgconfig get 64bit] \ [::tk::pkgconfig get 64bit] } 0 test pkgconfig-2.0 {error: missing subcommand} { catch {::tk::pkgconfig} msg set msg } {wrong # args: should be "::tk::pkgconfig subcommand ?arg?"} test pkgconfig-2.1 {error: illegal subcommand} { catch {::tk::pkgconfig foo} msg set msg } {bad subcommand "foo": must be get or list} test pkgconfig-2.2 {error: list with arguments} { catch {::tk::pkgconfig list foo} msg set msg } {wrong # args: should be "::tk::pkgconfig list"} test pkgconfig-2.3 {error: get without arguments} { catch {::tk::pkgconfig get} msg set msg } {wrong # args: should be "::tk::pkgconfig get key"} test pkgconfig-2.4 {error: query unknown key} { catch {::tk::pkgconfig get foo} msg set msg } {key not known} test pkgconfig-2.5 {error: query with to many arguments} { catch {::tk::pkgconfig get foo bar} msg set msg } {wrong # args: should be "::tk::pkgconfig subcommand ?arg?"} # cleanup cleanupTests return |
Changes to tests/place.test.
︙ | ︙ | |||
114 115 116 117 118 119 120 | place .t.f2 -in .t.f2 } -returnCodes error -result {can't place .t.f2 relative to itself} test place-4.4 {ConfigureSlave procedure, bad -in option} -setup { place forget .t.f2 } -body { place .t.f2 -in . } -returnCodes error -result {can't place .t.f2 relative to .} | | > > > > > > > > > > > > > > > > > > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | place .t.f2 -in .t.f2 } -returnCodes error -result {can't place .t.f2 relative to itself} test place-4.4 {ConfigureSlave procedure, bad -in option} -setup { place forget .t.f2 } -body { place .t.f2 -in . } -returnCodes error -result {can't place .t.f2 relative to .} test place-4.5 {ConfigureSlave procedure, bad -in option} -setup { } -body { frame .t.f1 place .t.f1 -in .t.f1 } -returnCodes error -result {can't place .t.f1 relative to itself} test place-4.6 {prevent management loops} -setup { place forget .t.f1 } -body { place .t.f1 -in .t.f2 place .t.f2 -in .t.f1 } -returnCodes error -result {can't put .t.f2 inside .t.f1, would cause management loop} test place-4.7 {prevent management loops} -setup { place forget .t.f1 place forget .t.f2 } -body { frame .t.f3 place .t.f1 -in .t.f2 place .t.f2 -in .t.f3 place .t.f3 -in .t.f1 } -returnCodes error -result {can't put .t.f3 inside .t.f1, would cause management loop} test place-5.1 {ConfigureSlave procedure, -relwidth option} -body { place .t.f2 -relwidth abcd } -returnCodes error -result {expected floating-point number but got "abcd"} test place-5.2 {ConfigureSlave procedure, -relwidth option} -setup { place forget .t.f2 } -body { |
︙ | ︙ | |||
392 393 394 395 396 397 398 | destroy .foo } -body { frame .foo place configure .foo -x 0 -y } -cleanup { destroy .foo } -returnCodes error -result {value for "-y" missing} | | | 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 | destroy .foo } -body { frame .foo place configure .foo -x 0 -y } -cleanup { destroy .foo } -returnCodes error -result {value for "-y" missing} test place-11.1 {PlaceObjCmd, slaves command} -setup { destroy .foo } -body { frame .foo place slaves .foo } -cleanup { |
︙ | ︙ |
Changes to tests/raise.test.
︙ | ︙ | |||
127 128 129 130 131 132 133 | test raise-3.1 {raise internal windows after creation} -body { raise_setup update raise .raise.a .raise.d raise_getOrder } -result {a d d a c e e e} test raise-3.2 {raise internal windows after creation} -constraints { | | | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | test raise-3.1 {raise internal windows after creation} -body { raise_setup update raise .raise.a .raise.d raise_getOrder } -result {a d d a c e e e} test raise-3.2 {raise internal windows after creation} -constraints { testmakeexist } -body { raise_setup testmakeexist .raise.a .raise.b raise .raise.a .raise.b update raise_getOrder } -result {d d d a c e e e} test raise-3.3 {raise internal windows after creation} -constraints { testmakeexist } -body { raise_setup testmakeexist .raise.a .raise.d raise .raise.a .raise.b update raise_getOrder } -result {d d d a c e e e} test raise-3.4 {raise internal windows after creation} -constraints { testmakeexist } -body { raise_setup testmakeexist .raise.a .raise.c .raise.d raise .raise.a .raise.b update raise_getOrder } -result {d d d a c e e e} |
︙ | ︙ |
Changes to tests/safe.test.
︙ | ︙ | |||
24 25 26 27 28 29 30 | # invoked from within # "uplevel #0 [list source $file]" # # # This probably means that tk wasn't installed properly. ## it indicates that something went wrong sourcing tk.tcl. | | | > > > > > > > > | | > > > > > > > > > > > > | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | # invoked from within # "uplevel #0 [list source $file]" # # # This probably means that tk wasn't installed properly. ## it indicates that something went wrong sourcing tk.tcl. ## Ensure that any changes that occurred to tk.tcl will work or are properly ## prevented in a safe interpreter. -- hobbs # The set of hidden commands is platform dependent: set hidden_cmds {bell cd clipboard encoding exec exit fconfigure} lappend hidden_cmds {*}[apply {{} { if {[package vsatisfies [package provide Tcl] 8.7-]} { lappend result file } lappend result glob grab load menu open pwd selection socket source tcl:encoding:dirs if {[package vsatisfies [package provide Tcl] 8.7-]} { lappend result tcl:encoding:system } lappend result toplevel unload wm foreach cmd { atime attributes copy delete dirname executable exists extension isdirectory isfile link lstat mkdir mtime nativename normalize owned readable readlink rename rootname size stat tail tempdir tempfile type volumes writable } {lappend result tcl:file:$cmd} if {[package vsatisfies [package provide Tcl] 8.7-]} { foreach cmd { cmdtype nameofexecutable } {lappend result tcl:info:$cmd} foreach cmd { autopurge list purge status } {lappend result tcl:process:$cmd} foreach cmd { lmkimg lmkzip mkimg mkkey mkzip mount mount_data unmount } {lappend result tcl:zipfs:$cmd} } return $result }}] if {[tk windowingsystem] ne "x11"} { lappend hidden_cmds tk_chooseColor tk_chooseDirectory tk_getOpenFile \ tk_getSaveFile tk_messageBox } if {[llength [info commands send]]} { lappend hidden_cmds send |
︙ | ︙ |
Changes to tests/scale.test.
︙ | ︙ | |||
320 321 322 323 324 325 326 | destroy .s test scale-2.1 {Tk_ScaleCmd procedure} -body { scale } -returnCodes error -result {wrong # args: should be "scale pathName ?-option value ...?"} test scale-2.2 {Tk_ScaleCmd procedure} -body { | | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | destroy .s test scale-2.1 {Tk_ScaleCmd procedure} -body { scale } -returnCodes error -result {wrong # args: should be "scale pathName ?-option value ...?"} test scale-2.2 {Tk_ScaleCmd procedure} -body { scale foo } -returnCodes error -result {bad window path name "foo"} test scale-2.3 {Tk_ScaleCmd procedure} -body { catch {scale foo} winfo child . } -result {} test scale-2.4 {Tk_ScaleCmd procedure} -body { scale .s -gorp dumb |
︙ | ︙ | |||
1100 1101 1102 1103 1104 1105 1106 | } -result {untouched empty} # Widget used in 14.* tests destroy .s pack [scale .s] update | | | | | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 | } -result {untouched empty} # Widget used in 14.* tests destroy .s pack [scale .s] update test scale-14.1 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 100 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 84 152 } -result 72 test scale-14.2 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 100 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 86 152 } -result 76 test scale-14.3 {RoundValueToResolution procedure} -body { .s configure -from 100 -to 0 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 84 152 } -result 28 test scale-14.4 {RoundValueToResolution procedure} -body { .s configure -from 100 -to 0 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 86 152 } -result 24 test scale-14.5 {RoundValueToResolution procedure} -body { .s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 84 152 } -result {-28} test scale-14.6 {RoundValueToResolution procedure} -body { .s configure -from -100 -to 0 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 86 152 } -result {-24} test scale-14.7 {RoundValueToResolution procedure} -body { .s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 84 152 } -result {-72} test scale-14.8 {RoundValueToResolution procedure} -body { .s configure -from 0 -to -100 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 4.0 update .s get 86 152 } -result {-76} test scale-14.9 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 0 update .s get 84 152 } -result {1.64} test scale-14.10 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 2.25 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 0 update .s get 86 152 } -result {1.69} test scale-14.11 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 225 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 0 -digits 5 update .s get 84 152 } -result {164.25} test scale-14.12 {RoundValueToResolution procedure} -body { .s configure -from 0 -to 225 -sliderlength 10 -length 114 -bd 2 \ -orient horizontal -resolution 0 -digits 5 update .s get 86 152 } -result {168.75} destroy .s test scale-14.13 {RoundValueToResolution procedure, round-off errors} -setup { # see [220665ffff], and duplicates [220265ffff] and [779559ffff] set x NotSet pack [scale .s -orient horizontal -resolution .1 -from -180 -to 180 -command "set x"] update } -body { .s configure -background red update set x } -cleanup { destroy .s } -result {NotSet} test scale-14a.1 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup { pack [scale .s -orient horizontal] update } -body { .s configure -length 400 -bd 0 -from 1 -to 9 -resolution 2 -tickinterval 1 update .s get 200 0 } -cleanup { destroy .s } -result {5} test scale-14a.2 {RoundValueToResolution, RoundIntervalToResolution procedures} -setup { pack [scale .s -orient horizontal] update } -body { .s configure -length 400 -bd 0 -from -1.5 -to 1.5 -resolution 1 \ -tickinterval 1 -digits 2 update .s get 250 0 } -cleanup { destroy .s } -result {0.5} test scale-15.1 {ScaleVarProc procedure} -setup { deleteWindows } -body { set y -130 scale .s -from 0 -to -200 -variable y -orient horizontal -length 150 |
︙ | ︙ | |||
1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 | } -body { pack [scale .s] # non-regression test for bug [55b95f578a] - shall just not crash .s configure -from -6.8e99 -to 8.8e99 } -cleanup { destroy .s } -result {} option clear # cleanup cleanupTests return | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 | } -body { pack [scale .s] # non-regression test for bug [55b95f578a] - shall just not crash .s configure -from -6.8e99 -to 8.8e99 } -cleanup { destroy .s } -result {} test scale-22.1 {Bug [5d991b822e]} { # Want this not to crash set var INIT scale .b -variable var trace add variable var unset {apply {args { .b configure -variable {} }}} pack .b bind .b <Configure> {unset var} update destroy .b } {} test scale-22.2 {Bug [5d991b822e]} { # Want this not to leak traces set var INIT scale .b -variable var trace add variable var unset {apply {args { .b configure -variable new }}} pack .b bind .b <Configure> {unset -nocomplain var} update destroy .b unset new } {} option clear # cleanup cleanupTests return |
Changes to tests/scrollbar.test.
︙ | ︙ | |||
16 17 18 19 20 21 22 | set scrollInfo $args } proc getTroughSize {w} { if {[testConstraint testmetrics]} { # Only Windows has [testmetrics] if [string match v* [$w cget -orient]] { | | | | | | | | | | | | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | set scrollInfo $args } proc getTroughSize {w} { if {[testConstraint testmetrics]} { # Only Windows has [testmetrics] if [string match v* [$w cget -orient]] { return [expr {[winfo height $w] - 2*[testmetrics cyvscroll $w]}] } else { return [expr {[winfo width $w] - 2*[testmetrics cxhscroll $w]}] } } else { if {[tk windowingsystem] eq "x11"} { # Calculations here assume that the arrow area is a square. if [string match v* [$w cget -orient]] { return [expr {[winfo height $w] \ - ([winfo width $w] \ - [$w cget -highlightthickness] \ - [$w cget -bd] + 1)*2}] } else { return [expr {[winfo width $w] \ - ([winfo height $w] \ - [$w cget -highlightthickness] \ - [$w cget -bd] + 1)*2}] } } else { # macOS aqua if [string match v* [$w cget -orient]] { return [expr {[winfo height $w] \ - ([$w cget -highlightthickness] \ +[$w cget -bd])*2}] } else { return [expr {[winfo width $w] \ - ([$w cget -highlightthickness] \ +[$w cget -bd])*2}] } } } } # XXX Note: this test file is woefully incomplete. Right now there are # only bits and pieces of tests. Please make this file more complete # as you fix bugs and add features. foreach {width height} [wm minsize .] { set height [expr {($height < 200) ? 200 : $height}] set width [expr {($width < 1) ? 1 : $width}] } frame .f -height $height -width $width pack .f -side left scrollbar .s pack .s -side right -fill y update set i 1 |
︙ | ︙ | |||
229 230 231 232 233 234 235 | list [catch {.s delta 18 xxyz} msg] $msg } {1 {expected integer but got "xxyz"}} test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} { format {%.6g} [.s delta 20 0] } {0} test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} { format {%.6g} [.s delta 0 20] | | | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | list [catch {.s delta 18 xxyz} msg] $msg } {1 {expected integer but got "xxyz"}} test scrollbar-3.25 {ScrollbarWidgetCmd procedure, "delta" option} { format {%.6g} [.s delta 20 0] } {0} test scrollbar-3.26 {ScrollbarWidgetCmd procedure, "delta" option} { format {%.6g} [.s delta 0 20] } [format %.6g [expr {20.0/([getTroughSize .s]-1)}]] test scrollbar-3.27 {ScrollbarWidgetCmd procedure, "delta" option} { format {%.6g} [.s delta 0 -20] } [format %.6g [expr {-20.0/([getTroughSize .s]-1)}]] test scrollbar-3.28 {ScrollbarWidgetCmd procedure, "delta" option} { toplevel .t -width 250 -height 100 wm geom .t +0+0 scrollbar .t.s -orient horizontal -borderwidth 2 place .t.s -width 201 update set result [list [format {%.6g} [.t.s delta 0 20]] \ [format {%.6g} [.t.s delta [expr {[getTroughSize .t.s] - 1}] 0]]] destroy .t set result } {0 1} test scrollbar-3.29 {ScrollbarWidgetCmd procedure, "fraction" option} { list [catch {.s fraction 24} msg] $msg } {1 {wrong # args: should be ".s fraction x y"}} test scrollbar-3.30 {ScrollbarWidgetCmd procedure, "fraction" option} { |
︙ | ︙ | |||
264 265 266 267 268 269 270 | format {%.6g} [.s fraction 0 0] } {0} test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 0 1000] } {1} test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] | | | | | | | | | | | | 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | format {%.6g} [.s fraction 0 0] } {0} test scrollbar-3.34 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 0 1000] } {1} test scrollbar-3.35 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.s fraction 4 21] } [format %.6g [expr {(21.0 - ([winfo height .s] - [getTroughSize .s])/2.0) \ /([getTroughSize .s] - 1)}]] test scrollbar-3.36 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { format {%.6g} [.s fraction 4 179] } {1} test scrollbar-3.37 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics} { format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s]}]] } {1} test scrollbar-3.38 {ScrollbarWidgetCmd procedure, "fraction" option} x11 { format {%.6g} [.s fraction 4 178] } {0.993711} test scrollbar-3.39 {ScrollbarWidgetCmd procedure, "fraction" option} {testmetrics win} { expr { [format {%.6g} [.s fraction 4 [expr {200 - [testmetrics cyvscroll .s] - 2}]]] == [format %g [expr {(200.0 - [testmetrics cyvscroll .s]*2 - 2) / ($height - 1 - [testmetrics cyvscroll .s]*2)}]]} } 1 toplevel .t -width 250 -height 100 wm geom .t +0+0 scrollbar .t.s -orient horizontal -borderwidth 2 place .t.s -width 201 update test scrollbar-3.41 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.t.s fraction 100 0] } {0.5} if {[testConstraint testmetrics]} { # Only Windows has [testmetrics] place configure .t.s -width [expr {2*[testmetrics cxhscroll .t.s]+1}] } else { if {[tk windowingsystem] eq "x11"} { place configure .t.s -width [expr {[winfo height .t.s] - 2*([.t.s cget -highlightthickness] + [.t.s cget -bd] + 1)}] } else { # macOS aqua place configure .t.s -width [expr {2*([.t.s cget -highlightthickness] + [.t.s cget -bd])}] } } update test scrollbar-3.42 {ScrollbarWidgetCmd procedure, "fraction" option} { format {%.6g} [.t.s fraction 100 0] } {0} destroy .t |
︙ | ︙ | |||
376 377 378 379 380 381 382 | set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result } {0.0 0.3} test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} { | | | | | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | set result {} foreach element [.s get] { lappend result [format %.1f $element] } set result } {0.0 0.3} test scrollbar-3.60 {ScrollbarWidgetCmd procedure, "set" option} { .s set 1.1 .4 .s get } {1.0 1.0} test scrollbar-3.61 {ScrollbarWidgetCmd procedure, "set" option} { .s set .5 -.3 .s get } {0.5 0.5} test scrollbar-3.62 {ScrollbarWidgetCmd procedure, "set" option} { .s set .5 87 .s get } {0.5 1.0} test scrollbar-3.63 {ScrollbarWidgetCmd procedure, "set" option} { .s set .4 .3 set result {} foreach element [.s get] { lappend result [format %.1f $element] |
︙ | ︙ | |||
408 409 410 411 412 413 414 | test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 ghi jkl} msg] $msg } {1 {expected integer but got "ghi"}} test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { | | | | | | | 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | test scrollbar-3.66 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 ghi jkl} msg] $msg } {1 {expected integer but got "ghi"}} test scrollbar-3.67 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 jkl} msg] $msg } {1 {expected integer but got "jkl"}} test scrollbar-3.68 {ScrollbarWidgetCmd procedure, "set" option} { .s set -10 50 20 30 .s get } {0 50 0 0} test scrollbar-3.69 {ScrollbarWidgetCmd procedure, "set" option} { .s set 100 -10 20 30 .s get } {100 0 20 30} test scrollbar-3.70 {ScrollbarWidgetCmd procedure, "set" option} { .s set 100 50 30 20 .s get } {100 50 30 30} test scrollbar-3.71 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3} msg] $msg } {1 {wrong # args: should be ".s set firstFraction lastFraction"}} test scrollbar-3.72 {ScrollbarWidgetCmd procedure, "set" option} { list [catch {.s set 1 2 3 4 5} msg] $msg } {1 {wrong # args: should be ".s set firstFraction lastFraction"}} test scrollbar-3.73 {ScrollbarWidgetCmd procedure} { list [catch {.s bogus} msg] $msg } {1 {bad option "bogus": must be activate, cget, configure, delta, fraction, get, identify, or set}} test scrollbar-3.74 {ScrollbarWidgetCmd procedure} { list [catch {.s c} msg] $msg } {1 {ambiguous option "c": must be activate, cget, configure, delta, fraction, get, identify, or set}} |
︙ | ︙ | |||
469 470 471 472 473 474 475 | test scrollbar-6.4 {ScrollbarPosition procedure} unix { .s identify 3 100 } {} test scrollbar-6.6 {ScrollbarPosition procedure} unix { .s identify 19 100 } {} test scrollbar-6.7 {ScrollbarPosition procedure} { | | | | | | | | | | | | | | | | | | | | | | | | | | | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 | test scrollbar-6.4 {ScrollbarPosition procedure} unix { .s identify 3 100 } {} test scrollbar-6.6 {ScrollbarPosition procedure} unix { .s identify 19 100 } {} test scrollbar-6.7 {ScrollbarPosition procedure} { .s identify [expr {[winfo width .s] / 2}] -1 } {} test scrollbar-6.8 {ScrollbarPosition procedure} { .s identify [expr {[winfo width .s] / 2}] [winfo height .s] } {} test scrollbar-6.9 {ScrollbarPosition procedure} { .s identify -1 [expr {[winfo height .s] / 2}] } {} test scrollbar-6.10 {ScrollbarPosition procedure} { .s identify [winfo width .s] [expr {[winfo height .s] / 2}] } {} test scrollbar-6.11.1 {ScrollbarPosition procedure} x11 { .s identify 8 4 } {arrow1} test scrollbar-6.11.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 4 } {trough1} test scrollbar-6.12.1 {ScrollbarPosition procedure} x11 { .s identify 8 19 } {arrow1} test scrollbar-6.12.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 19 } {trough1} test scrollbar-6.14 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] / 2}] 0 } {arrow1} test scrollbar-6.15 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[testmetrics cyvscroll .s] - 1}] } {arrow1} test scrollbar-6.16 {ScrollbarPosition procedure} unix { .s identify 8 20 } {trough1} test scrollbar-6.17 {ScrollbarPosition procedure} {unix nonPortable} { # Don't know why this is non-portable, but it doesn't work on # some platforms. .s identify 8 51 } {trough1} test scrollbar-6.18 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [testmetrics cyvscroll .s] } {trough1} test scrollbar-6.19 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {int(.2 / [.s delta 0 1]) + [testmetrics cyvscroll .s] - 1}] } {trough1} test scrollbar-6.20 {ScrollbarPosition procedure} unix { .s identify 8 52 } {slider} test scrollbar-6.21 {ScrollbarPosition procedure} {unix nonPortable} { # Don't know why this is non-portable, but it doesn't work on # some platforms. .s identify 8 83 } {slider} test scrollbar-6.22 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] \ [expr {int(.2 / [.s delta 0 1] + 0.5) + [testmetrics cyvscroll .s]}] } {slider} test scrollbar-6.23 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1]) + [testmetrics cyvscroll .s] - 1}] } {slider} test scrollbar-6.24 {ScrollbarPosition procedure} unix { .s identify 8 84 } {trough2} test scrollbar-6.25 {ScrollbarPosition procedure} unix { .s identify 8 179 } {trough2} test scrollbar-6.27 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {int(.4 / [.s delta 0 1]) + [testmetrics cyvscroll .s]}] } {trough2} test scrollbar-6.28 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s] - 1}] } {trough2} test scrollbar-6.29.1 {ScrollbarPosition procedure} x11 { .s identify 8 180 } {arrow2} test scrollbar-6.29.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 180 } {trough2} test scrollbar-6.30.1 {ScrollbarPosition procedure} x11 { .s identify 8 195 } {arrow2} test scrollbar-6.30.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .s identify 8 195 } {trough2} test scrollbar-6.32 {ScrollbarPosition procedure} {testmetrics win} { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - [testmetrics cyvscroll .s]}] } {arrow2} test scrollbar-6.33 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] / 2}] [expr {[winfo height .s] - 1}] } {arrow2} test scrollbar-6.34 {ScrollbarPosition procedure} unix { .s identify 4 100 } {trough2} test scrollbar-6.35 {ScrollbarPosition procedure} unix { .s identify 18 100 } {trough2} test scrollbar-6.37 {ScrollbarPosition procedure} win { .s identify 0 100 } {trough2} test scrollbar-6.38 {ScrollbarPosition procedure} win { .s identify [expr {[winfo width .s] - 1}] 100 } {trough2} catch {destroy .t} toplevel .t -width 250 -height 150 wm geometry .t +0+0 scrollbar .t.s -orient horizontal -relief sunken -bd 2 -highlightthickness 2 place .t.s -width 200 .t.s set .2 .4 update test scrollbar-6.39.1 {ScrollbarPosition procedure} x11 { .t.s identify 4 8 } {arrow1} test scrollbar-6.39.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .t.s identify 4 8 } {trough1} test scrollbar-6.40 {ScrollbarPosition procedure} win { .t.s identify 0 [expr {[winfo height .t.s] / 2}] } {arrow1} test scrollbar-6.41.1 {ScrollbarPosition procedure} x11 { .t.s identify 82 8 } {slider} test scrollbar-6.41.2 {ScrollbarPosition procedure} aqua { # macOS scrollbars have no arrows nowadays .t.s identify 82 8 } {trough2} test scrollbar-6.43 {ScrollbarPosition procedure} {testmetrics win} { .t.s identify [expr {int(.4 / [.t.s delta 1 0]) + [testmetrics cxhscroll .t.s] - 1}] [expr {[winfo height .t.s] / 2}] } {slider} test scrollbar-6.44 {ScrollbarPosition procedure} unix { .t.s identify 100 18 } {trough2} test scrollbar-6.46 {ScrollbarPosition procedure} win { .t.s identify 100 [expr {[winfo height .t.s] - 1}] } {trough2} test scrollbar-7.1 {EventuallyRedraw} { .s configure -orient horizontal update set result [.s cget -orient] .s configure -orient vertical |
︙ | ︙ | |||
641 642 643 644 645 646 647 | scrollbar .t.f.s -command doit pack .t.f -fill both -expand 1 pack .t.f.s -fill y -expand 1 -side right wm geometry .t 100x100 .t.f.s set 0 .5 update set result [winfo exists .t.f.s] | | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 | scrollbar .t.f.s -command doit pack .t.f -fill both -expand 1 pack .t.f.s -fill y -expand 1 -side right wm geometry .t 100x100 .t.f.s set 0 .5 update set result [winfo exists .t.f.s] event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5 event generate .t <ButtonRelease> -button 1 update lappend result [winfo exists .t.f.s] [winfo exists .t.f] rename bgerror {} set result } {1 0 0} test scrollbar-8.2 {TkScrollbarEventProc: recursive deletion} notAqua { # constrained by notAqua because this test clicks on an arrow of the # scrollbar - but macOS has no such arrows in modern scrollbars proc doit {args} { destroy .t.f.s } proc bgerror {args} {} destroy .t.f frame .t.f scrollbar .t.f.s -command doit pack .t.f -fill both -expand 1 pack .t.f.s -fill y -expand 1 -side right wm geometry .t 100x100 .t.f.s set 0 .5 update set result [winfo exists .t.f.s] event generate .t.f.s <ButtonPress> -button 1 -x [expr {[winfo width .t.f.s] / 2}] -y 5 event generate .t.f <ButtonRelease> -button 1 update lappend result [winfo exists .t.f.s] [winfo exists .t.f] rename bgerror {} set result } {1 0 1} |
︙ | ︙ | |||
755 756 757 758 759 760 761 | pack .top.s focus -force .top.s update event generate .top.s <2> update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top | | | | 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 | pack .top.s focus -force .top.s update event generate .top.s <2> update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top } -result {} test scrollbar-11.2 {bug fix: [011706ec42] Scrollbar unsafe wrt widget destruction} -body { proc destroy_scrollbar {{y 0}} { if {[winfo exists .top.s]} { destroy .top.s } } toplevel .top wm minsize .top 50 400 update scrollbar .top.s bind .top.s <2> {after idle destroy_scrollbar} pack .top.s -expand true -fill y focus -force .top.s update event generate .top.s <2> -x 2 -y [expr {[winfo height .top.s] / 2}] update ; # shall not trigger error invalid command name ".top.s" } -cleanup { destroy .top.s .top } -result {} catch {destroy .s} catch {destroy .t} # cleanup cleanupTests return |
Changes to tests/select.test.
︙ | ︙ | |||
32 33 34 35 36 37 38 | proc handler {type offset count} { global selValue selInfo lappend selInfo $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } | | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | proc handler {type offset count} { global selValue selInfo lappend selInfo $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } string range $selValue $offset [expr {$numBytes+$offset}] } proc errIncrHandler {type offset count} { global selValue selInfo pass if {$offset == 4000} { if {$pass == 0} { # Just sizing the selection; don't do anything here. set pass 1 } else { # Fetching the selection; wait long enough to cause a timeout. after 6000 } } lappend selInfo $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } string range $selValue $offset [expr {$numBytes+$offset}] } proc errHandler args { error "selection handler aborted" } proc badHandler {path type offset count} { global selValue selInfo selection handle -type $type $path {} lappend selInfo $path $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } string range $selValue $offset [expr {$numBytes+$offset}] } proc reallyBadHandler {path type offset count} { global selValue selInfo pass if {$offset == 4000} { if {$pass == 0} { set pass 1 } else { selection handle -type $type $path {} } } lappend selInfo $path $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } string range $selValue $offset [expr {$numBytes+$offset}] } # Eliminate any existing selection on the screen. This is needed in case # there is a selection in some other application, in order to prevent races # from causing false errors in the tests below. selection clear . |
︙ | ︙ | |||
948 949 950 951 952 953 954 | } -result {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW {text/x-tk-test;detail="foo bar"}} ############################################################################## # note, we are not testing MULTIPLE style selections # most control paths have been exercised above test select-10.1 {ConvertSelection procedure, race with selection clear} -constraints { | | | 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | } -result {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW {text/x-tk-test;detail="foo bar"}} ############################################################################## # note, we are not testing MULTIPLE style selections # most control paths have been exercised above test select-10.1 {ConvertSelection procedure, race with selection clear} -constraints { x11 } -setup { setup } -body { proc Ready {fd} { variable x lappend x [gets $fd] } |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | set result "" set pass 0 lappend result [dobg {selection get}] cleanupbg lappend result $selInfo } -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}} test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints { | | | | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | set result "" set pass 0 lappend result [dobg {selection get}] cleanupbg lappend result $selInfo } -result {{selection owner didn't respond} {STRING 0 4000 STRING 4000 4000 STRING 8000 4000 STRING 12000 4000 STRING 16000 4000 STRING 0 4000 STRING 4000 4000}} test select-10.5 {ConvertSelection procedure, reentrancy issues} -constraints { x11 } -setup { setup setupbg } -body { set selValue "Test value" set selInfo "" selection handle -type TEST .f1 { handler TEST } selection handle -type STRING .f1 { badHandler .f1 STRING } set result "" lappend result [dobg {selection get}] cleanupbg lappend result $selInfo } -result {{PRIMARY selection doesn't exist or form "STRING" not defined} {.f1 STRING 0 4000}} test select-10.6 {ConvertSelection procedure, reentrancy issues} -constraints { x11 } -setup { setup setupbg } -body { proc weirdHandler {type offset count} { destroy .f1 handler $type $offset $count |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | set selInfo "" set result [list [selection get TARGETS] $selInfo] selection handle .f1 {} TARGETS lappend result [selection get TARGETS] } -result {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}} test select-13.1 {SelectionSize procedure, handler deleted} -constraints { | | | | 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 | set selInfo "" set result [list [selection get TARGETS] $selInfo] selection handle .f1 {} TARGETS lappend result [selection get TARGETS] } -result {{Targets value} {TARGETS.f1 0 4000} {MULTIPLE TARGETS TIMESTAMP TK_APPLICATION TK_WINDOW}} test select-13.1 {SelectionSize procedure, handler deleted} -constraints { x11 } -setup { setup setupbg } -body { proc badHandler {path type offset count} { global selValue selInfo abortCount incr abortCount -1 if {$abortCount == 0} { selection handle -type $type $path {} } lappend selInfo $path $type $offset $count set numBytes [expr {[string length $selValue] - $offset}] if {$numBytes <= 0} { return "" } string range $selValue $offset [expr {$numBytes+$offset}] } set selValue $longValue set selInfo "" selection handle .f1 {badHandler .f1 STRING} set result "" set abortCount 2 lappend result [dobg {selection get}] |
︙ | ︙ |
Changes to tests/send.test.
︙ | ︙ | |||
193 194 195 196 197 198 199 | } "name2 {$commId name2\n}" test send-7.4 {Tk_SetAppName procedure, name in use} {secureserver testsend} { tk appname name1 testsend prop root InterpRegistry "$id foo\n$id foo #2\n$id foo #3\n" list [tk appname foo] [testsend prop root InterpRegistry] } "{foo #4} {$commId foo #4\n$id foo\n$id foo #2\n$id foo #3\n}" | > | | 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | } "name2 {$commId name2\n}" test send-7.4 {Tk_SetAppName procedure, name in use} {secureserver testsend} { tk appname name1 testsend prop root InterpRegistry "$id foo\n$id foo #2\n$id foo #3\n" list [tk appname foo] [testsend prop root InterpRegistry] } "{foo #4} {$commId foo #4\n$id foo\n$id foo #2\n$id foo #3\n}" #macOS does not send to other processes test send-8.1 {Tk_SendCmd procedure, options} {secureserver notAqua} { setupbg set app [dobg {tk appname}] set a 66 send -async $app [list send [tk appname] set a 77] set result $a after 200 set x 40 tkwait variable x |
︙ | ︙ | |||
218 219 220 221 222 223 224 | set a altDisplay tk appname xyzgorp list \[send xyzgorp set a\] \[send -displayof .t xyzgorp set a\] "] cleanupbg set result } {altDisplay homeDisplay} | > | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | set a altDisplay tk appname xyzgorp list \[send xyzgorp set a\] \[send -displayof .t xyzgorp set a\] "] cleanupbg set result } {altDisplay homeDisplay} # Since macOS has no registry of interpreters, 8.3, 8.4 and 8.10 will fail. test send-8.3 {Tk_SendCmd procedure, options} {secureserver notAqua} { list [catch {send -- -async foo bar baz} msg] $msg } {1 {no application named "-async"}} test send-8.4 {Tk_SendCmd procedure, options} {secureserver notAqua} { list [catch {send -gorp foo bar baz} msg] $msg } {1 {no application named "-gorp"}} test send-8.5 {Tk_SendCmd procedure, options} {secureserver} { list [catch {send -async foo} msg] $msg } {1 {wrong # args: should be "send ?-option value ...? interpName arg ?arg ...?"}} test send-8.6 {Tk_SendCmd procedure, options} {secureserver} { list [catch {send foo} msg] $msg |
︙ | ︙ | |||
249 250 251 252 253 254 255 | string tolower [list [catch {send [tk appname] open bad_file} msg] \ $msg $errorInfo $errorCode] } {1 {couldn't open "bad_file": no such file or directory} {couldn't open "bad_file": no such file or directory while executing "open bad_file" invoked from within "send [tk appname] open bad_file"} {posix enoent {no such file or directory}}} | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | string tolower [list [catch {send [tk appname] open bad_file} msg] \ $msg $errorInfo $errorCode] } {1 {couldn't open "bad_file": no such file or directory} {couldn't open "bad_file": no such file or directory while executing "open bad_file" invoked from within "send [tk appname] open bad_file"} {posix enoent {no such file or directory}}} test send-8.10 {Tk_SendCmd procedure, no such interpreter} {secureserver notAqua} { list [catch {send bogus_name bogus_command} msg] $msg } {1 {no application named "bogus_name"}} catch { newApp "" t_s_1 Test t_s_1 eval wm withdraw . } |
︙ | ︙ | |||
538 539 540 541 542 543 544 | test send-12.1 {TimeoutProc procedure} {secureserver testsend} { testsend prop root InterpRegistry "$id dummy\n" list [catch {send dummy foo} msg] $msg } {1 {target application died or uses a Tk version before 4.0}} catch {testsend prop root InterpRegistry ""} | > | > | | | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | test send-12.1 {TimeoutProc procedure} {secureserver testsend} { testsend prop root InterpRegistry "$id dummy\n" list [catch {send dummy foo} msg] $msg } {1 {target application died or uses a Tk version before 4.0}} catch {testsend prop root InterpRegistry ""} #macOS does not send to other processes test send-12.2 {TimeoutProc procedure} {secureserver notAqua} { winfo interps tk appname tktest update setupbg set app [dobg { after 10 {after 10 {after 5000; exit}} tk appname }] after 200 set result [list [catch {send $app foo} msg] $msg] cleanupbg set result } {1 {target application died}} #macOS does not send to other processes winfo interps tk appname tktest test send-13.1 {DeleteProc procedure} {secureserver notAqua} { setupbg set app [dobg {rename send {}; tk appname}] set result [list [catch {send $app foo} msg] $msg [winfo interps]] cleanupbg set result } {1 {no application named "tktest #2"} tktest} test send-13.2 {DeleteProc procedure} {secureserver notAqua} { winfo interps tk appname tktest rename send {} set result {} lappend result [winfo interps] [info commands send] tk appname foo lappend result [winfo interps] [info commands send] |
︙ | ︙ |
Changes to tests/spinbox.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | tcltest::loadTestedCommands # For xscrollcommand proc scroll args { global scrollInfo set scrollInfo $args } | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | tcltest::loadTestedCommands # For xscrollcommand proc scroll args { global scrollInfo set scrollInfo $args } # For trace variable proc override args { global x set x 12345 } # Procedures used in widget VALIDATION tests proc doval {W d i P s S v V} { |
︙ | ︙ | |||
1013 1014 1015 1016 1017 1018 1019 | spinbox .e } -cleanup { destroy .e } -result {.e} test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 | spinbox .e } -cleanup { destroy .e } -result {.e} test spinbox-3.1 {SpinboxWidgetCmd procedure} -setup { spinbox .e pack .e update } -body { .e } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e option ?arg ...?"} test spinbox-3.2 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.3 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e bbox index"} test spinbox-3.4 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { spinbox .e pack .e update } -body { .e bbox bogus } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "bogus"} test spinbox-3.5 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e bbox 0 } -cleanup { destroy .e } -result [list 5 5 0 $cy] # Oryginaly the result was count using measurements # and metrics. It was changed to less verbose solution - the result is the one # that passes fonts constraint (this concerns tests 3.6, 3.7, 3.8, 3.10) test spinbox-3.6 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): no utf chars .e insert 0 "abc" list [.e bbox 3] [.e bbox end] } -cleanup { destroy .e } -result {{19 5 7 13} {19 5 7 13}} test spinbox-3.7 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): utf at end .e insert 0 "ab\u4e4e" .e bbox end } -cleanup { destroy .e } -result {19 5 12 13} test spinbox-3.8 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): utf before index .e insert 0 "ab\u4e4ec" .e bbox 3 } -cleanup { destroy .e } -result {31 5 7 13} test spinbox-3.9 {SpinboxWidgetCmd procedure, "bbox" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { # Tcl_UtfAtIndex(): no chars .e bbox end } -cleanup { destroy .e } -result "5 5 0 $cy" test spinbox-3.10 {SpinboxWidgetCmd procedure, "bbox" widget command} -constraints { fonts } -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert 0 "abcdefghij\u4e4eklmnop" list [.e bbox 0] [.e bbox 1] [.e bbox 10] [.e bbox end] } -cleanup { destroy .e } -result {{5 5 7 13} {12 5 7 13} {75 5 12 13} {122 5 7 13}} test spinbox-3.11 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { spinbox .e } -body { .e cget } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.12 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { spinbox .e } -body { .e cget a b } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e cget option"} test spinbox-3.13 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { spinbox .e } -body { .e cget -gorp } -cleanup { destroy .e } -returnCodes error -result {unknown option "-gorp"} test spinbox-3.14 {SpinboxWidgetCmd procedure, "cget" widget command} -setup { spinbox .e } -body { .e configure -bd 4 .e cget -bd } -cleanup { destroy .e } -result {4} test spinbox-3.15 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { spinbox .e pack .e update } -body { llength [.e configure] } -cleanup { destroy .e } -result {51} test spinbox-3.16 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { spinbox .e } -body { .e configure -foo } -cleanup { destroy .e } -returnCodes error -result {unknown option "-foo"} test spinbox-3.17 {SpinboxWidgetCmd procedure, "configure" widget command} -setup { spinbox .e } -body { .e configure -bd 4 .e configure -bg #ffffff lindex [.e configure -bd] 4 } -cleanup { destroy .e } -result {4} test spinbox-3.18 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e } -body { .e delete } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.19 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e } -body { .e delete a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e delete firstIndex ?lastIndex?"} test spinbox-3.20 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e } -body { .e delete foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.21 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e } -body { .e delete 0 bar } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "bar"} test spinbox-3.22 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e delete 2 4 .e get } -cleanup { destroy .e } -result {014567890} test spinbox-3.23 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e } -body { .e insert end "01234567890" .e delete 6 .e get } -cleanup { destroy .e } -result {0123457890} test spinbox-3.24 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update set x {} } -body { # UTF .e insert end "01234\u4e4e67890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "012345\u4e4e7890" .e delete 6 lappend x [.e get] .e delete 0 end .e insert end "0123456\u4e4e890" .e delete 6 lappend x [.e get] } -cleanup { destroy .e } -result [list "01234\u4e4e7890" "0123457890" "012345\u4e4e890"] test spinbox-3.25 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e delete 6 5 .e get } -cleanup { destroy .e } -result {01234567890} test spinbox-3.26 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e configure -state disabled .e delete 2 8 .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test spinbox-3.26.1 {SpinboxWidgetCmd procedure, "delete" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e configure -state readonly .e delete 2 8 .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test spinbox-3.27 {SpinboxWidgetCmd procedure, "get" widget command} -setup { spinbox .e } -body { .e get foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e get"} test spinbox-3.28 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { spinbox .e } -body { .e icursor } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e icursor pos"} test spinbox-3.29 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { spinbox .e } -body { .e icursor foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.30 {SpinboxWidgetCmd procedure, "icursor" widget command} -setup { spinbox .e } -body { .e insert end "01234567890" .e icursor 4 .e index insert } -cleanup { destroy .e } -result {4} test spinbox-3.31 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e } -body { .e in } -cleanup { destroy .e } -returnCodes error -result {ambiguous option "in": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview} test spinbox-3.32 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e } -body { .e index } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e index string"} test spinbox-3.33 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e } -body { .e index foo } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.34 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e update } -body { .e index 0 } -cleanup { destroy .e } -returnCodes {ok} -match glob -result {*} test spinbox-3.35 {SpinboxWidgetCmd procedure, "index" widget command} -setup { spinbox .e pack .e update } -body { # UTF .e insert 0 abc\u4e4e\u0153def list [.e index 3] [.e index 4] [.e index end] } -cleanup { destroy .e } -result {3 4 8} test spinbox-3.36 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e } -body { .e insert a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.37 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.38 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e } -body { .e insert foo Text } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "foo"} test spinbox-3.39 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e insert 3 xxx .e get } -cleanup { destroy .e } -result {012xxx34567890} test spinbox-3.40 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e configure -state disabled .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test spinbox-3.40.1 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "01234567890" .e configure -state readonly .e insert 3 xxx .e configure -state normal .e get } -cleanup { destroy .e } -result {01234567890} test spinbox-3.41 {SpinboxWidgetCmd procedure, "insert" widget command} -setup { spinbox .e } -body { .e insert a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e insert index text"} test spinbox-3.42 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e update } -body { .e scan a } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test spinbox-3.43 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e update } -body { .e scan a b c } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e scan mark|dragto x"} test spinbox-3.44 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e update } -body { .e scan foobar 20 } -cleanup { destroy .e } -returnCodes error -result {bad scan option "foobar": must be mark or dragto} test spinbox-3.45 {SpinboxWidgetCmd procedure, "scan" widget command} -setup { spinbox .e pack .e update } -body { .e scan mark 20.1 } -cleanup { destroy .e } -returnCodes error -result {expected integer but got "20.1"} # This test is non-portable because character sizes vary. test spinbox-3.46 {SpinboxWidgetCmd procedure, "scan" widget command} -constraints { fonts } -setup { spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long string, in fact a " .e insert end "very very long string" .e scan mark 30 .e scan dragto 28 .e index @0 } -cleanup { destroy .e } -result {2} test spinbox-3.47 {SpinboxWidgetCmd procedure, "select" widget command} -setup { spinbox .e } -body { .e select } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection option ?index?"} test spinbox-3.48 {SpinboxWidgetCmd procedure, "select" widget command} -setup { spinbox .e } -body { .e select foo } -cleanup { destroy .e } -returnCodes error -result {bad selection option "foo": must be adjust, clear, element, from, present, range, or to} test spinbox-3.49 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { spinbox .e } -body { .e select clear gorp } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection clear"} test spinbox-3.50 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { spinbox .e } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test spinbox-3.50.1 {SpinboxWidgetCmd procedure, "select clear" widget command} -setup { spinbox .e pack .e update } -body { .e insert end "0123456789" .e select from 1 .e select to 4 update .e select clear catch {selection get} selection own } -cleanup { destroy .e } -result {.e} test spinbox-3.51 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e } -body { .e selection present foo } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e selection present"} test spinbox-3.52 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e selection present } -cleanup { destroy .e } -result {1} test spinbox-3.53 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e configure -exportselection false .e selection present } -cleanup { destroy .e } -result {1} test spinbox-3.54 {SpinboxWidgetCmd procedure, "selection present" widget command} -setup { spinbox .e pack .e update } -body { .e insert end 0123456789 .e select from 3 .e select to 6 .e delete 0 end .e selection present } -cleanup { |
︙ | ︙ | |||
1695 1696 1697 1698 1699 1700 1701 | .e configure -state normal list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 4} test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { | | | | | | | | | | | | | | | | | | | | | | | 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 | .e configure -state normal list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 4} test spinbox-3.65 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 5 format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.053763 0.268817} test spinbox-3.66 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview gorp } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "gorp"} test spinbox-3.67 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 .e icursor 10 .e xview insert format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.107527 0.322581} test spinbox-3.68 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview moveto foo bar } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview moveto fraction"} test spinbox-3.69 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e xview moveto foo } -cleanup { destroy .e } -returnCodes error -result {expected floating-point number but got "foo"} test spinbox-3.70 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto 0.5 format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.505376 0.720430} test spinbox-3.71 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview scroll 24 } -cleanup { destroy .e } -returnCodes error -result {wrong # args: should be ".e xview scroll number pages|units"} test spinbox-3.72 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll gorp units } -cleanup { destroy .e } -returnCodes error -result {expected integer but got "gorp"} test spinbox-3.73 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview moveto 0 .e xview scroll 1 pages format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.193548 0.408602} test spinbox-3.74 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview moveto .9 update .e xview scroll -2 p format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.397849 0.612903} test spinbox-3.75 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll 2 units .e index @0 } -cleanup { destroy .e } -result {32} test spinbox-3.76 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 30 update .e xview scroll -1 units .e index @0 } -cleanup { destroy .e } -result {29} test spinbox-3.77 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview scroll 23 foobars } -cleanup { destroy .e } -returnCodes error -result {bad argument "foobars": must be pages or units} test spinbox-3.78 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview eat 23 hamburgers } -cleanup { destroy .e } -returnCodes error -result {unknown option "eat": must be moveto or scroll} test spinbox-3.79 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e xview 0 update .e xview -4 .e index @0 } -cleanup { destroy .e } -result {0} test spinbox-3.80 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." update .e xview 300 .e index @0 } -cleanup { destroy .e } -result {73} test spinbox-3.81 {SpinboxWidgetCmd procedure, "xview" widget command} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e insert end "This is quite a long text string, so long that it " .e insert end "runs off the end of the window quite a bit." .e insert 10 \u4e4e update # UTF |
︙ | ︙ | |||
1907 1908 1909 1910 1911 1912 1913 | .e xview moveto .12 lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test spinbox-3.82 {SpinboxWidgetCmd procedure} -setup { | | | 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 | .e xview moveto .12 lappend x [format {%.6f} [lindex [.e xview] 0]] } -cleanup { destroy .e } -result {0.095745 0.106383 0.117021} test spinbox-3.82 {SpinboxWidgetCmd procedure} -setup { spinbox .e -font {Courier -12} -borderwidth 2 -highlightthickness 2 pack .e update } -body { .e gorp } -cleanup { destroy .e } -returnCodes error -result {bad option "gorp": must be bbox, cget, configure, delete, get, icursor, identify, index, insert, invoke, scan, selection, set, validate, or xview} |
︙ | ︙ | |||
1978 1979 1980 1981 1982 1983 1984 | .e1 configure -exportselection 1 lappend x [selection get] set x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test spinbox-5.6 {ConfigureSpinbox procedure} -setup { | | | | | | | 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 | .e1 configure -exportselection 1 lappend x [selection get] set x } -cleanup { destroy .e1 .e2 } -result {{This is so} {This is so} 1234} test spinbox-5.6 {ConfigureSpinbox procedure} -setup { spinbox .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 selection get } -cleanup { destroy .e } -returnCodes error -result {PRIMARY selection doesn't exist or form "STRING" not defined} test spinbox-5.6.1 {ConfigureSpinbox procedure} -setup { spinbox .e pack .e } -body { .e insert end "0123456789" .e select from 1 .e select to 5 .e configure -exportselection 0 catch {selection get} list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5} test spinbox-5.7 {ConfigureSpinbox procedure} -setup { spinbox .e -font {Helvetica -12} -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -width 4 -xscrollcommand scroll .e insert end "01234567890" update .e configure -width 5 format {%.6f %.6f} {*}$scrollInfo } -cleanup { destroy .e } -result {0.000000 0.363636} test spinbox-5.8 {ConfigureSpinbox procedure} -constraints { fonts } -setup { spinbox .e -borderwidth 2 -highlightthickness 2 pack .e } -body { .e configure -width 0 -font {Helvetica -12} .e insert end "0123" update .e configure -font {Helvetica -24} update |
︙ | ︙ | |||
2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 | # If "0" in selected font had 0 width, caused divide-by-zero error. .e configure -font {{open look glyph}} .e scan dragto 30 update } -cleanup { destroy .e } -result {} # No tests for DisplaySpinbox. test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { | > > > > > > > > > > > > > > > | | | | | | | 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 | # If "0" in selected font had 0 width, caused divide-by-zero error. .e configure -font {{open look glyph}} .e scan dragto 30 update } -cleanup { destroy .e } -result {} test spinbox-5.12 {ConfigureSpinbox procedure, -from and -to swapping} -setup { spinbox .e } -body { # this statement used to trigger error "-to value must be greater than -from value" # because default value for -to is zero (bug [841280ffff]) set res [catch {.e configure -from 10}] .e configure -from 1971 -to 2016 ; # standard case lappend res [.e cget -from] [.e cget -to] .e configure -from 2016 -to 1971 ; # auto-swapping happens lappend res [.e cget -from] [.e cget -to] .e configure -to 1971 -from 2016 ; # auto-swapping, order of options does not matter lappend res [.e cget -from] [.e cget -to] } -cleanup { destroy .e } -result {0 1971.0 2016.0 1971.0 2016.0 1971.0 2016.0} # No tests for DisplaySpinbox. test spinbox-6.1 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -highlightthickness 3 .e insert end 012\t45 update list [.e index @61] [.e index @62] } -cleanup { destroy .e } -result {3 4} test spinbox-6.2 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify center \ -highlightthickness 3 .e insert end 012\t45 update list [.e index @96] [.e index @97] } -cleanup { destroy .e } -result {3 4} test spinbox-6.3 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 20 -justify right \ -highlightthickness 3 .e insert end 012\t45 update list [.e index @131] [.e index @132] } -cleanup { destroy .e } -result {3 4} test spinbox-6.4 {SpinboxComputeGeometry procedure} -setup { spinbox .e pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 6 .e index @0 } -cleanup { destroy .e } -result {6} test spinbox-6.5 {SpinboxComputeGeometry procedure} -setup { spinbox .e -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 5 .e insert end "01234567890" update .e xview 7 .e index @0 } -cleanup { destroy .e } -result {6} test spinbox-6.6 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e -highlightthickness 2 pack .e } -body { .e configure -font {Courier -12} -bd 2 -relief raised -width 10 .e insert end "01234\t67890" update .e xview 3 list [.e index @39] [.e index @40] } -cleanup { destroy .e } -result {5 6} |
︙ | ︙ | |||
2182 2183 2184 2185 2186 2187 2188 | } -result {133 39} test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e -highlightthickness 2 pack .e } -body { | | | | | | 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 | } -result {133 39} test spinbox-6.9 {SpinboxComputeGeometry procedure} -constraints { fonts } -setup { spinbox .e -highlightthickness 2 pack .e } -body { .e configure -font {Helvetica -24} -bd 3 -relief raised -width 0 update list [winfo reqwidth .e] [winfo reqheight .e] } -cleanup { destroy .e } -result {42 39} test spinbox-7.1 {InsertChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e insert 2 XXX update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abXXXcde abXXXcde {0.000000 1.000000}} test spinbox-7.2 {InsertChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e insert 500 XXX update |
︙ | ︙ | |||
2276 2277 2278 2279 2280 2281 2282 | set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 6 2 5} test spinbox-7.7 {InsertChars procedure} -setup { | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > > > | > | | | | | | | | | | 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 | set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {2 6 2 5} test spinbox-7.7 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -xscrollcommand scroll .e insert 0 0123456789 .e icursor 4 .e insert 4 XXX .e index insert } -cleanup { destroy .e } -result {7} test spinbox-7.8 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789 .e icursor 4 .e insert 5 XXX .e index insert } -cleanup { destroy .e } -result {4} test spinbox-7.9 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 3 XXX .e index @0 } -cleanup { destroy .e } -result {7} test spinbox-7.10 {InsertChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "This is a very long string" update .e xview 4 .e insert 4 XXX .e index @0 } -cleanup { destroy .e } -result {4} test spinbox-7.11 {InsertChars procedure} -constraints { fonts } -setup { spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 "xyzzy" update .e insert 2 00 winfo reqwidth .e } -cleanup { destroy .e } -result {70} test spinbox-8.1 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete 2 4 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abe abe {0.000000 1.000000}} test spinbox-8.2 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete -2 2 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {cde cde {0.000000 1.000000}} test spinbox-8.3 {DeleteChars procedure} -setup { unset -nocomplain contents spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e configure -textvariable contents -xscrollcommand scroll .e insert 0 abcde .e delete 3 1000 update list [.e get] $contents [format {%.6f %.6f} {*}$scrollInfo] } -cleanup { destroy .e } -result {abc abc {0.000000 1.000000}} test spinbox-8.4 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 3 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6 1 5} test spinbox-8.5 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 4 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 5 1 4} test spinbox-8.6 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 5 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 2 1 5} test spinbox-8.7 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 1 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.8 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 7 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 4 3 8} test spinbox-8.9 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e } -body { .e insert 0 0123456789abcde .e select from 3 .e select to 8 .e delete 3 8 update .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-8.10 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 5 8 update set x "[.e index sel.first] [.e index sel.last]" .e select to 8 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 5 5 8} test spinbox-8.11 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e select from 8 .e select to 3 .e delete 8 10 update set x "[.e index sel.first] [.e index sel.last]" .e select to 4 lappend x [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {3 8 4 8} test spinbox-8.12 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 4 update .e index insert } -cleanup { destroy .e } -result {1} test spinbox-8.13 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 1 5 update .e index insert } -cleanup { destroy .e } -result {1} test spinbox-8.14 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 0123456789abcde .e icursor 4 .e delete 4 6 update .e index insert } -cleanup { destroy .e } -result {4} test spinbox-8.15 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 4 update .e index @0 } -cleanup { destroy .e } -result {1} test spinbox-8.16 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 1 5 update .e index @0 } -cleanup { destroy .e } -result {1} test spinbox-8.17 {DeleteChars procedure} -setup { spinbox .e -width 10 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "This is a very long string" .e xview 4 .e delete 4 6 update .e index @0 } -cleanup { destroy .e } -result {4} test spinbox-8.18 {DeleteChars procedure} -setup { spinbox .e -width 0 -font {Courier -12} -highlightthickness 2 -bd 2 pack .e focus .e } -body { .e insert 0 "xyzzy" update .e delete 2 4 # To check that deletion actually happened we measure the new width # of the widget, based on the measuring width of the remaining text ("xyy") # in the widget. For that purpose we have to mirror the code in tkEntry.c # for computation of the reqwidth # note: XPAD corresponds to the hardcoded #define XPAD 1 set XPAD 1 set buttonWidth [expr { [font measure [.e cget -font] "0"] + 2 * (1 + $XPAD) }] if {$buttonWidth < 11} { set buttonWidth 11 } set expected [expr { [font measure [.e cget -font] "xyy"] \ + 2 * ( [.e cget -borderwidth] + \ [.e cget -highlightthickness] + $XPAD ) \ + $buttonWidth } ] expr {[winfo reqwidth .e] == $expected} } -cleanup { destroy .e unset XPAD buttonWidth expected } -result {1} test spinbox-9.1 {SpinboxValueChanged procedure} -setup { unset -nocomplain x } -body { trace variable x w override spinbox .e -textvariable x -width 0 .e insert 0 foo list $x [.e get] } -cleanup { destroy .e trace vdelete x w override } -result {12345 12345} test spinbox-10.1 {SpinboxSetValue procedure} -constraints fonts -body { set x abcde set y ab spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 -width 0 pack .e .e configure -textvariable x .e configure -textvariable y update list [.e get] [winfo reqwidth .e] } -cleanup { destroy .e } -result {ab 35} test spinbox-10.2 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "a" .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-10.3 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefg" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 7} test spinbox-10.4 {SpinboxSetValue procedure, updating selection} -setup { unset -nocomplain x spinbox .e -font {Helvetica -12} -highlightthickness 2 -bd 2 pack .e } -body { .e configure -textvariable x .e insert 0 "abcdefghjklmnopqrstu" .e selection range 4 10 set x "abcdefghijklmn" list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {4 10} test spinbox-10.5 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "abcdefg" update .e index @0 } -cleanup { destroy .e } -result {0} test spinbox-10.6 {SpinboxSetValue procedure, updating display position} -setup { unset -nocomplain x spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e xview 10 update set x "1234567890123456789012" update .e index @0 } -cleanup { destroy .e } -result {10} test spinbox-10.7 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x spinbox .e -highlightthickness 2 -bd 2 pack .e update } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123" .e index insert } -cleanup { destroy .e } -result {3} test spinbox-10.8 {SpinboxSetValue procedure, updating insertion cursor} -setup { unset -nocomplain x spinbox .e -highlightthickness 2 -bd 2 pack .e } -body { .e configure -width 10 -font {Courier -12} -textvariable x pack .e .e insert 0 "abcdefghjklmnopqrstuvwxyz" .e icursor 5 set x "123456" |
︙ | ︙ | |||
2762 2763 2764 2765 2766 2767 2768 | .e xview 4 update .e index end } -cleanup { destroy .e } -result {21} test spinbox-13.2 {GetSpinboxIndex procedure} -body { | | | 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 | .e xview 4 update .e index end } -cleanup { destroy .e } -result {21} test spinbox-13.2 {GetSpinboxIndex procedure} -body { spinbox .e .e index abogus } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "abogus"} test spinbox-13.3 {GetSpinboxIndex procedure} -setup { spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e |
︙ | ︙ | |||
2848 2849 2850 2851 2852 2853 2854 | .e select to 6 list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6} test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { | | | | | 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 | .e select to 6 list [.e index sel.first] [.e index sel.last] } -cleanup { destroy .e } -result {1 6} test spinbox-13.10 {GetSpinboxIndex procedure} -constraints x11 -body { # On unix, when selection is cleared, spinbox widget's internal # selection range is reset. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e .e index sel.first } -cleanup { destroy .e } -returnCodes error -result {selection isn't in widget .e} test spinbox-13.11 {GetSpinboxIndex procedure} -constraints aquaOrWin32 -body { # On mac and pc, when selection is cleared, spinbox widget remembers # last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sel.first } -cleanup { destroy .e } -result {1} test spinbox-13.12 {GetSpinboxIndex procedure} -constraints x11 -body { # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 |
︙ | ︙ | |||
2940 2941 2942 2943 2944 2945 2946 | .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "sbogus"} test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers | | > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < < < < < < < | | | | | | | | | | | | | 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 | .e index sbogus } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "sbogus"} test spinbox-13.14 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers # last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e selection get } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test spinbox-13.14.1 {GetSpinboxIndex procedure} -constraints win -body { # On mac and pc, when selection is cleared, spinbox widget remembers # last selected range. When selection ownership is restored to # spinbox, the old range will be rehighlighted. # Previous settings: spinbox .e -font {Courier -12} -width 5 -bd 2 -relief sunken pack .e .e insert 0 012345678901234567890 .e xview 4 update .e select from 1 .e select to 6 list [.e index sel.first] [.e index sel.last] # Testing: selection clear .e catch {selection get} .e index sbogus } -cleanup { destroy .e } -returnCodes error -match glob -result {*} test spinbox-13.15 {GetSpinboxIndex procedure} -body { spinbox .e selection clear .e .e index @xyz } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "@xyz"} test spinbox-13.16 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @4 } -cleanup { destroy .e } -result {4} test spinbox-13.17 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @11 } -cleanup { destroy .e } -result {4} test spinbox-13.18 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @12 } -cleanup { destroy .e } -result {5} test spinbox-13.19 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @[expr {[winfo width .e] - 6-11}] } -cleanup { destroy .e } -result {8} test spinbox-13.20 {GetSpinboxIndex procedure} -constraints fonts -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @[expr {[winfo width .e] - 5}] } -cleanup { destroy .e } -result {9} test spinbox-13.21 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index @1000 } -cleanup { destroy .e } -result {9} test spinbox-13.22 {GetSpinboxIndex procedure} -setup { spinbox .e pack .e update } -body { .e index 1xyz } -cleanup { destroy .e } -returnCodes error -result {bad spinbox index "1xyz"} test spinbox-13.23 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index -10 } -cleanup { destroy .e } -result {0} test spinbox-13.24 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index 12 } -cleanup { destroy .e } -result {12} test spinbox-13.25 {GetSpinboxIndex procedure} -body { spinbox .e -width 5 -relief sunken -highlightthickness 2 -bd 2 \ -font {Courier -12} pack .e .e insert 0 012345678901234567890 .e xview 4 update .e index 49 } -cleanup { destroy .e |
︙ | ︙ | |||
3114 3115 3116 3117 3118 3119 3120 | test spinbox-14.3 {SpinboxFetchSelection procedure} -setup { set x {} for {set i 1} {$i <= 500} {incr i} { append x "This is line $i, out of 500\n" } } -body { spinbox .e | | | 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 | test spinbox-14.3 {SpinboxFetchSelection procedure} -setup { set x {} for {set i 1} {$i <= 500} {incr i} { append x "This is line $i, out of 500\n" } } -body { spinbox .e .e insert end $x .e select from 0 .e select to end string compare [selection get] $x } -cleanup { destroy .e } -result {0} |
︙ | ︙ | |||
3141 3142 3143 3144 3145 3146 3147 | } -result {Text Text} test spinbox-16.1 {SpinboxVisibleRange procedure} -constraints fonts -body { spinbox .e -width 10 -font {Helvetica -12} pack .e update | | | 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 | } -result {Text Text} test spinbox-16.1 {SpinboxVisibleRange procedure} -constraints fonts -body { spinbox .e -width 10 -font {Helvetica -12} pack .e update .e insert 0 "............................." format {%.6f %.6f} {*}[.e xview] } -cleanup { destroy .e } -result {0.000000 0.827586} test spinbox-16.2 {SpinboxVisibleRange procedure} -body { spinbox .e format {%.6f %.6f} {*}[.e xview] |
︙ | ︙ | |||
3212 3213 3214 3215 3216 3217 3218 | } -body { set l [interp hidden] interp hide {} .e destroy .e set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} | | | 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 | } -body { set l [interp hidden] interp hide {} .e destroy .e set res1 [list [winfo children .] [interp hidden]] set res2 [list {} $l] expr {$res1 == $res2} } -result {1} ## ## Spinbox widget VALIDATION tests ## # The validation tests build each one upon the previous, so cascading # failures aren't good # |
︙ | ︙ | |||
3566 3567 3568 3569 3570 3571 3572 | spinbox .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings | | | 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 | spinbox .e -validate all \ -validatecommand [list doval3 %W %d %i %P %s %S %v %V] \ -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] .e validate list [.e cget -validate] [.e get] $::vVals } -cleanup { destroy .e } -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}} |
︙ | ︙ | |||
3591 3592 3593 3594 3595 3596 3597 | -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings | | | 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 | -invalidcommand bell \ -textvariable ::e \ -background red -foreground white pack .e set ::e nextdata ;# previous settings .e configure -validatecommand [list doval2 %W %d %i %P %s %S %v %V] ;# prev .e validate ;# previous settings .e configure -validate all set ::e testdata list [.e cget -validate] [.e get] $::e $::vVals } -cleanup { destroy .e } -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}} ## |
︙ | ︙ |
Added tests/teapotTransparent.png.
cannot compute difference between binary files
Changes to tests/text.test.
︙ | ︙ | |||
906 907 908 909 910 911 912 | destroy .t } -result {2 red} test text-2.7 {Tk_TextCmd procedure} -constraints { win } -body { catch {destroy .t} text .t | | | | | 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 | destroy .t } -result {2 red} test text-2.7 {Tk_TextCmd procedure} -constraints { win } -body { catch {destroy .t} text .t .t tag cget sel -relief } -cleanup { destroy .t } -result {flat} test text-2.8 {Tk_TextCmd procedure} -constraints { aqua } -body { catch {destroy .t} text .t .t tag cget sel -relief } -cleanup { destroy .t } -result {flat} test text-2.9 {Tk_TextCmd procedure} -constraints { unix notAqua } -body { catch {destroy .t} text .t .t tag cget sel -relief } -cleanup { destroy .t } -result {raised} test text-2.10 {Tk_TextCmd procedure} -body { list [text .t] [winfo class .t] } -cleanup { destroy .t |
︙ | ︙ | |||
1481 1482 1483 1484 1485 1486 1487 | proc .t {args} { lappend ::res $args ; uplevel 1 test.t $args } .t edit undo return $res } -cleanup { rename .t {} rename test.t .t destroy .t | | > > > > > > > > > > > > | 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 | proc .t {args} { lappend ::res $args ; uplevel 1 test.t $args } .t edit undo return $res } -cleanup { rename .t {} rename test.t .t destroy .t } -result [list {edit undo} {delete 2.1 2.4} {mark set insert 2.1} {see insert} \ {mark set tk::undoMarkL2 2.1} {mark set tk::undoMarkR2 2.4} \ {mark gravity tk::undoMarkL2 left} {mark gravity tk::undoMarkR2 right} \ {insert 2.1 ef} {mark set insert 2.3} {see insert} \ {mark set tk::undoMarkL1 2.1} {mark set tk::undoMarkR1 2.3} \ {mark gravity tk::undoMarkL1 left} {mark gravity tk::undoMarkR1 right} \ {mark names} \ {index tk::undoMarkL1} {index tk::undoMarkR1} \ {mark unset tk::undoMarkL1 tk::undoMarkR1} \ {index tk::undoMarkL2} {index tk::undoMarkR2} \ {mark unset tk::undoMarkL2 tk::undoMarkR2} \ {compare 2.1 > 2.3} {compare 2.6 > 2.3} ] test text-8.23 {TextWidgetCmd procedure, "replace" option with undo} -setup { text .t } -body { .t insert 1.0 "Line 1 aefghijklm 12345 Line 4 |
︙ | ︙ | |||
2031 2032 2033 2034 2035 2036 2037 | Line 4 bOy GIrl .#@? x_yz !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 5.2 5.4 .t window create 5.4 | | | 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 | Line 4 bOy GIrl .#@? x_yz !@#$% Line 7" .t tag configure elide -elide 1 .t tag add elide 5.2 5.4 .t window create 5.4 .t delete 5.4 .t tag add elide 5.5 5.6 .t get -displaychars 5.2 5.8 } -cleanup { destroy .t } -result {Grl} |
︙ | ︙ | |||
2682 2683 2684 2685 2686 2687 2688 | test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup { text .t pack .t update set res {} } -body { for {set i 1} {$i < 5} {incr i} { | | | 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 | test text-9.2.45 {TextWidgetCmd procedure, "count" option} -setup { text .t pack .t update set res {} } -body { for {set i 1} {$i < 5} {incr i} { .t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n" } .t tag configure hidden -elide true .t tag add hidden 2.15 3.10 .t configure -wrap none set res [.t count -displaylines 2.0 3.0] } -cleanup { destroy .t |
︙ | ︙ | |||
2704 2705 2706 2707 2708 2709 2710 | .mytop.t delete 1.0 end update set res {} } -body { for {set i 1} {$i < 5} {incr i} { # 0 1 2 3 4 # 012345 678901234 567890123 456789012 34567890123456789 | | | 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 | .mytop.t delete 1.0 end update set res {} } -body { for {set i 1} {$i < 5} {incr i} { # 0 1 2 3 4 # 012345 678901234 567890123 456789012 34567890123456789 .mytop.t insert end "Line $i+++Line $i---Line $i///Line $i - This is Line [format %c [expr {64+$i}]]\n" } .mytop.t tag configure hidden -elide true .mytop.t tag add hidden 2.30 3.10 lappend res [.mytop.t count -displaylines 2.0 3.0] lappend res [.mytop.t count -displaylines 2.0 3.50] } -cleanup { destroy .mytop |
︙ | ︙ | |||
2913 2914 2915 2916 2917 2918 2919 | lappend res [.t count -displaychars 1.0 end-1c] lappend res [.t count -displaychars 1.0 1.2] lappend res [.t count -displaychars 2.0 end] lappend res [.t count -displaychars 2.0 end-1c] lappend res [.t index "1.0 +1 indices"] lappend res [.t index "1.0 +1 display indices"] lappend res [.t index "1.0 +1 display chars"] | | | 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 | lappend res [.t count -displaychars 1.0 end-1c] lappend res [.t count -displaychars 1.0 1.2] lappend res [.t count -displaychars 2.0 end] lappend res [.t count -displaychars 2.0 end-1c] lappend res [.t index "1.0 +1 indices"] lappend res [.t index "1.0 +1 display indices"] lappend res [.t index "1.0 +1 display chars"] lappend res [.t index end] lappend res [.t index "end -1 indices"] lappend res [.t index "end -1 display indices"] lappend res [.t index "end -1 display chars"] lappend res [.t index "end -2 indices"] lappend res [.t index "end -2 display indices"] lappend res [.t index "end -2 display chars"] } -cleanup { |
︙ | ︙ | |||
3085 3086 3087 3088 3089 3090 3091 | toplevel .top pack [text .top.yt] update set content {} for {set i 1} {$i < 300} {incr i} { append content [string repeat "$i " 50] \n } | | | 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 | toplevel .top pack [text .top.yt] update set content {} for {set i 1} {$i < 300} {incr i} { append content [string repeat "$i " 50] \n } # Sync the widget and process all <<WidgetViewSync>> events before binding. .top.yt sync update bind .top.yt <<WidgetViewSync>> {lappend res Sync:%d} set res {} # The next line triggers <<WidgetViewSync>> with %d==0 i.e. out of sync. .top.yt insert 1.0 $content vwait res |
︙ | ︙ | |||
3116 3117 3118 3119 3120 3121 3122 | destroy .top.t .top } -body { set res {} toplevel .top pack [text .top.t] update for {set i 1} {$i < 10000} {incr i} { | | | 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 | destroy .top.t .top } -body { set res {} toplevel .top pack [text .top.t] update for {set i 1} {$i < 10000} {incr i} { .top.t insert end "Hello world!\n" } bind .top.t <<WidgetViewSync>> {destroy .top.t} .top.t tag add mytag 1.5 8000.8 ; # shall not crash update set res "Still doing fine!" } -cleanup { destroy .top.t .top |
︙ | ︙ | |||
3319 3320 3321 3322 3323 3324 3325 | } -result {1 1 0} test text-14.5 {ConfigureText procedure} -setup { text .t } -body { .t configure -tabs {30 foo} } -cleanup { destroy .t | | | | | 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 | } -result {1 1 0} test text-14.5 {ConfigureText procedure} -setup { text .t } -body { .t configure -tabs {30 foo} } -cleanup { destroy .t } -returnCodes {error} -result {bad tab alignment "foo": must be left, right, center, or numeric} test text-14.6 {ConfigureText procedure} -setup { text .t } -body { catch {.t configure -tabs {30 foo}} .t configure -tabs {10 20 30} return $errorInfo } -cleanup { destroy .t } -result {bad tab alignment "foo": must be left, right, center, or numeric (while processing -tabs option) invoked from within ".t configure -tabs {30 foo}"} test text-14.7 {ConfigureText procedure} -setup { text .t } -body { .t configure -tabs {10 20 30} .t configure -tabs {} .t cget -tabs } -cleanup { destroy .t } -result {} test text-14.8 {ConfigureText procedure} -setup { text .t } -body { .t configure -wrap bogus } -cleanup { destroy .t } -returnCodes {error} -result {bad wrap "bogus": must be char, none, or word} test text-14.9 {ConfigureText procedure} -setup { text .t -font {Courier -12} -borderwidth 2 -highlightthickness 2 |
︙ | ︙ | |||
3368 3369 3370 3371 3372 3373 3374 | } -body { .t configure -selectborderwidth {} .t tag cget sel -borderwidth } -cleanup { destroy .t } -result {} test text-14.11 {ConfigureText procedure} -setup { | | | 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 | } -body { .t configure -selectborderwidth {} .t tag cget sel -borderwidth } -cleanup { destroy .t } -result {} test text-14.11 {ConfigureText procedure} -setup { text .t } -body { .t configure -selectborderwidth foo } -cleanup { destroy .t } -returnCodes {error} -result {bad screen distance "foo"} test text-14.12 {ConfigureText procedure} -body { text .t |
︙ | ︙ | |||
3458 3459 3460 3461 3462 3463 3464 | } -cleanup { destroy .t .t2 } -result {1234} test text-14.18 {ConfigureText procedure} -constraints fonts -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { | | > > > > > > | | > | | | 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 | } -cleanup { destroy .t .t2 } -result {1234} test text-14.18 {ConfigureText procedure} -constraints fonts -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { .top.t configure -width 20 -height 10 pack .top.t update set geom [wm geometry .top] set x [string range $geom 0 [string first + $geom]] } -cleanup { destroy .top } -result {150x140+} # This test was failing Windows because the title bar on .t was a certain # minimum size and it was interfering with the size requested by the -setgrid. # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink # to the appropriate size. # On macOS, however, there is no way to make the window overlap the menubar. if {[tk windowingsystem] == "aqua"} { set minY 23 } else { set minY 0 } test text-14.19 {ConfigureText procedure} -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { .top.t configure -width 20 -height 10 -setgrid 1 wm overrideredirect .top 1 pack .top.t wm geometry .top +0+$minY update wm geometry .top } -cleanup { destroy .top } -result "20x10+0+$minY" # This test was failing on Windows because the title bar on .t was a certain # minimum size and it was interfering with the size requested by the -setgrid. # The "overrideredirect" gets rid of the titlebar so the toplevel can shrink # to the appropriate size. # On macOS we again use minY as a workaround. test text-14.20 {ConfigureText procedure} -setup { toplevel .top text .top.t -font {Courier -12} -borderwidth 2 -highlightthickness 2 } -body { .top.t configure -width 20 -height 10 -setgrid 1 wm overrideredirect .top 1 pack .top.t wm geometry .top +0+$minY update set result [wm geometry .top] wm geometry .top 15x8 update lappend result [wm geometry .top] .top.t configure -wrap word update lappend result [wm geometry .top] } -cleanup { destroy .top } -result "20x10+0+$minY 15x8+0+$minY 15x8+0+$minY" test text-15.1 {TextWorldChanged procedure, spacing options} -constraints { fonts } -body { text .t -width 20 -height 10 -font {Courier -12} -borderwidth 2 -highlightthickness 2 set result [winfo reqheight .t] |
︙ | ︙ | |||
3547 3548 3549 3550 3551 3552 3553 | list [info command .tx*] [winfo exists .tx1] } -cleanup { destroy .txt1 } -result {{} 0} test text-17.2 {TextCmdDeletedProc procedure, disabling -setgrid} -constraints { fonts } -body { | | | 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 | list [info command .tx*] [winfo exists .tx1] } -cleanup { destroy .txt1 } -result {{} 0} test text-17.2 {TextCmdDeletedProc procedure, disabling -setgrid} -constraints { fonts } -body { toplevel .top text .top.t -borderwidth 2 -highlightthickness 2 -font {Courier -12 bold} \ -setgrid 1 -width 20 -height 10 pack .top.t update set geom [wm geometry .top] set x [string range $geom 0 [string first + $geom]] rename .top.t {} |
︙ | ︙ | |||
4939 4940 4941 4942 4943 4944 4945 | .t search -backwards "\n\n" 1.0 } -cleanup { destroy .t } -result {} test text-22.119 {TextSearchCmd, multiline regexp matching} -body { pack [text .t] .t insert 1.0 { Tcl_Obj *objPtr)); | | | | | 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 | .t search -backwards "\n\n" 1.0 } -cleanup { destroy .t } -result {} test text-22.119 {TextSearchCmd, multiline regexp matching} -body { pack [text .t] .t insert 1.0 { Tcl_Obj *objPtr)); static Tcl_Obj* FSNormalizeAbsolutePath _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));} set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?" append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)" append markExpr "\[ \n\t\r\]*\\()" .t search -forwards -regexp $markExpr 1.41 end } -cleanup { destroy .t } -result {} test text-22.120 {TextSearchCmd, multiline regexp matching} -body { # Practical example which used to crash Tk, but only after the # search is complete. This is memory corruption caused by # a bug in Tcl's handling of string objects. # (Tcl bug 635200) pack [text .t] .t insert 1.0 {static int SetFsPathFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); static Tcl_Obj* FSNormalizeAbsolutePath _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));} set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?" append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)" append markExpr "\[ \n\t\r\]*\\()" .t search -forwards -regexp $markExpr 1.41 end } -cleanup { destroy .t } -result {} test text-22.121 {TextSearchCmd, multiline regexp matching} -body { pack [text .t] .t insert 1.0 { static int SetFsPathFromAny _ANSI_ARGS_((Tcl_Interp *interp, Tcl_Obj *objPtr)); static Tcl_Obj* FSNormalizeAbsolutePath _ANSI_ARGS_((Tcl_Interp* interp, Tcl_Obj *pathPtr));} set markExpr "^(\[A-Za-z0-9~_\]+\[ \t\n\r\]*\\(|(\[^ \t\(#\n\r/@:\*\]\[^=\(\r\n\]*\[ \t\]+\\*?)?" append markExpr "(\[A-Za-z0-9~_\]+(<\[^>\]*>)?(::)?(\[A-Za-z0-9~_\]+::)*\[-A-Za-z0-9~_+ <>\|\\*/\]+|\[A-Za-z0-9~_\]+)" append markExpr "\[ \n\t\r\]*\\()" .t search -backwards -all -regexp $markExpr end } -cleanup { destroy .t |
︙ | ︙ | |||
6122 6123 6124 6125 6126 6127 6128 | test text-23.4 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 right 200 left 300 center 400 numeric} update idletasks | | | | | | 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 | test text-23.4 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {100 right 200 left 300 center 400 numeric} update idletasks list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \ [lindex [.t bbox 1.4] 0] \ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \ [lindex [.t bbox 1.10] 0] } -cleanup { destroy .t } -result {100 200 300 400} test text-23.5 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100 pack .t } -body { .t insert end "1\t2\t3\t4\t55.5" .t configure -tabs {105 r 205 l 305 c 405 n} update idletasks list [expr {[lindex [.t bbox 1.2] 0] + [lindex [.t bbox 1.2] 2]}] \ [lindex [.t bbox 1.4] 0] \ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]/2}] \ [lindex [.t bbox 1.10] 0] } -cleanup { destroy .t } -result {105 205 305 405} test text-23.6 {TkTextGetTabs procedure} -setup { text .t -highlightthickness 0 -bd 0 -relief flat -padx 0 -width 100 pack .t |
︙ | ︙ | |||
6166 6167 6168 6169 6170 6171 6172 | destroy .t } -returnCodes {error} -result {bad screen distance "!44"} test text-24.1 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" | | | | | | | 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 | destroy .t } -returnCodes {error} -result {bad screen distance "!44"} test text-24.1 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump } -cleanup { destroy .t } -returnCodes {error} -result {Usage: .t dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?} test text-24.2 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump -all } -cleanup { destroy .t } -returnCodes {error} -result {Usage: .t dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?} test text-24.3 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump -command } -cleanup { destroy .t } -returnCodes {error} -result {Usage: .t dump ?-all -image -text -mark -tag -window? ?-command script? index ?index2?} test text-24.4 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump -bogus } -cleanup { destroy .t } -returnCodes {error} -result {bad option "-bogus": must be -all, -command, -image, -mark, -tag, -text, or -window} test text-24.5 {TextDumpCmd procedure, bad args} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump bogus } -cleanup { destroy .t } -returnCodes {error} -result {bad text index "bogus"} test text-24.6 {TextDumpCmd procedure, one index} -body { pack [text .t] .t insert 1.0 "One Line" |
︙ | ︙ | |||
6235 6236 6237 6238 6239 6240 6241 | .t dump 1.5 1.5 } -cleanup { destroy .t } -result {} test text-24.10 {TextDumpCmd procedure, negative range} -body { pack [text .t] .t insert 1.0 "One Line" | | | 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 | .t dump 1.5 1.5 } -cleanup { destroy .t } -result {} test text-24.10 {TextDumpCmd procedure, negative range} -body { pack [text .t] .t insert 1.0 "One Line" .t mark set insert 1.0 .t dump 1.5 1.0 } -cleanup { destroy .t } -result {} test text-24.11 {TextDumpCmd procedure, stop at begin-line} -body { pack [text .t] .t insert end "Line One\nLine Two\nLine Three\nLine Four" |
︙ | ︙ | |||
6553 6554 6555 6556 6557 6558 6559 6560 6561 6562 6563 6564 6565 6566 | } -result {1} test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup { text .t pack .t # Make sure the Text is mapped before we start update set ::retval {} } -body { bind .t <<Modified>> "lappend ::retval modified" # Shouldn't require [update idle] to trigger event [Bug 1809538] lappend ::retval [.t edit modified] .t edit modified 1 update lappend ::retval [.t edit modified] | > | 6572 6573 6574 6575 6576 6577 6578 6579 6580 6581 6582 6583 6584 6585 6586 | } -result {1} test text-27.11 {TextEditCmd procedure, set modified flag repeat} -setup { text .t pack .t # Make sure the Text is mapped before we start update set ::retval {} update } -body { bind .t <<Modified>> "lappend ::retval modified" # Shouldn't require [update idle] to trigger event [Bug 1809538] lappend ::retval [.t edit modified] .t edit modified 1 update lappend ::retval [.t edit modified] |
︙ | ︙ | |||
6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 | .t edit undo update ; lappend res $nbUS .t edit reset update ; lappend res $nbUS } -cleanup { destroy .t } -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9} test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body { pack [text .t -wrap none] .t insert end [string repeat "\1" 500] } -cleanup { destroy .t | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 6975 6976 6977 6978 6979 6980 6981 6982 6983 6984 6985 6986 6987 6988 6989 6990 6991 6992 6993 6994 6995 6996 6997 6998 6999 7000 7001 7002 7003 7004 7005 7006 7007 7008 7009 7010 7011 7012 7013 7014 7015 7016 7017 7018 7019 7020 7021 7022 7023 7024 7025 7026 7027 7028 7029 7030 7031 7032 7033 7034 7035 7036 7037 7038 7039 7040 7041 7042 7043 7044 7045 7046 7047 7048 | .t edit undo update ; lappend res $nbUS .t edit reset update ; lappend res $nbUS } -cleanup { destroy .t } -result {0 0 1 2 3 4 4 5 6 6 7 8 8 9} test text-27.26 {edit undo and edit redo return ranges} -setup { destroy .t set res {} } -body { text .t -undo true -autoseparators false .t insert end "Hello " .t edit separator .t insert end "World!\n" .t insert 1.6 "GREAT " .t insert end "Another edit here!!" lappend res [.t edit undo] lappend res [.t edit redo] .t edit separator .t delete 1.6 .t delete 1.9 1.10 .t insert 1.9 L lappend res [.t edit undo] lappend res [.t edit redo] .t replace 1.6 1.10 Tcl/Tk .t replace 2.8 2.12 "one bites the dust" lappend res [.t edit undo] lappend res [.t edit redo] } -cleanup { destroy .t } -result [list {1.6 2.0} \ {1.6 2.19} \ {1.6 1.7 1.10 1.12} \ {1.6 1.7 1.9 1.11} \ {1.6 1.16 2.8 2.19} \ {1.6 1.16 2.8 2.30} ] test text-27.27 {edit undo and edit redo return ranges} -setup { destroy .t set res {} } -body { text .t -undo true -autoseparators false for {set i 3} {$i >= 1} {incr i -1} { .t insert 1.0 "Line $i\n" } lappend res [.t edit undo] lappend res [.t edit redo] } -cleanup { destroy .t } -result [list {1.0 2.0} \ {1.0 4.0} ] test text-27.28 {edit undo and edit redo do not leave \ spurious temporary marks behind them} -setup { destroy .t set res {} } -body { pack [text .t -undo true -autoseparators false] .t insert end "Hello World.\n" .t edit separator .t insert end "Again hello.\n" .t edit undo lappend res [lsearch [.t mark names] tk::undoMark*] .t edit redo lappend res [lsearch [.t mark names] tk::undoMark*] } -cleanup { destroy .t } -result [list -1 -1] test text-28.1 {bug fix - 624372, ControlUtfProc long lines} -body { pack [text .t -wrap none] .t insert end [string repeat "\1" 500] } -cleanup { destroy .t |
︙ | ︙ | |||
7225 7226 7227 7228 7229 7230 7231 | test text-31.14 {peer widgets} -setup { pack [text .t] set res {} } -body { for {set i 1} {$i < 20} {incr i} { .t insert end "Line $i\n" } | | | | | 7305 7306 7307 7308 7309 7310 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 | test text-31.14 {peer widgets} -setup { pack [text .t] set res {} } -body { for {set i 1} {$i < 20} {incr i} { .t insert end "Line $i\n" } .t tag add sel 1.0 3.0 5.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0 lappend res [.t tag prevrange sel 1.0] .t configure -start 6 -end 12 lappend res [.t tag ranges sel] lappend res "next" [.t tag nextrange sel 4.0] \ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \ [.t tag nextrange sel 7.0] lappend res "prev" [.t tag prevrange sel 1.0] \ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \ [.t tag prevrange sel 4.0] return $res } -cleanup { destroy .t } -result {{} {1.0 2.0 4.0 6.0} next {4.0 6.0} {} {} {} prev {} {1.0 2.0} {1.0 2.0} {1.0 2.0}} test text-31.15 {peer widgets} -setup { pack [text .t] set res {} } -body { for {set i 1} {$i < 20} {incr i} { .t insert end "Line $i\n" } .t tag add sel 1.0 3.0 9.0 11.0 13.0 15.0 17.0 19.0 .t configure -start 6 -end 12 lappend res [.t tag ranges sel] lappend res "next" [.t tag nextrange sel 4.0] \ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \ [.t tag nextrange sel 7.0] lappend res "prev" [.t tag prevrange sel 1.0] \ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \ [.t tag prevrange sel 4.0] return $res } -cleanup { destroy .t } -result {{4.0 6.0} next {4.0 6.0} {} {} {} prev {} {} {} {}} test text-31.16 {peer widgets} -setup { pack [text .t] set res {} } -body { for {set i 1} {$i < 20} {incr i} { .t insert end "Line $i\n" } .t tag add sel 1.0 7.0 9.0 11.0 13.0 15.0 17.0 19.0 .t configure -start 6 -end 12 lappend res [.t tag ranges sel] lappend res "next" [.t tag nextrange sel 4.0] \ [.t tag nextrange sel 5.0] [.t tag nextrange sel 6.0] \ [.t tag nextrange sel 7.0] lappend res "prev" [.t tag prevrange sel 1.0] \ [.t tag prevrange sel 2.0] [.t tag prevrange sel 3.0] \ |
︙ | ︙ | |||
7311 7312 7313 7314 7315 7316 7317 | } .t tag add sel 1.0 11.0 lappend res [.t index sel.first] lappend res [.t index sel.last] return $res } -cleanup { destroy .t | | | 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 | } .t tag add sel 1.0 11.0 lappend res [.t index sel.first] lappend res [.t index sel.last] return $res } -cleanup { destroy .t } -result {1.0 11.0} test text-31.19 {peer widgets} -body { pack [text .t] for {set i 1} {$i < 20} {incr i} { .t insert end "Line $i\n" } .t tag delete sel .t index sel.first |
︙ | ︙ | |||
7356 7357 7358 7359 7360 7361 7362 | set w [makeText] update ; after 1000 ; update set before [$w count -ypixels 1.0 2.0] $w insert 1.0 "a" update set after [$w count -ypixels 1.0 2.0] destroy .g | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 7524 7525 7526 7527 7528 7529 7530 7531 7532 7533 7534 7535 7536 7537 7538 7539 7540 7541 7542 7543 7544 7545 7546 7547 | set w [makeText] update ; after 1000 ; update set before [$w count -ypixels 1.0 2.0] $w insert 1.0 "a" update set after [$w count -ypixels 1.0 2.0] destroy .g expr {$before eq $after} } -cleanup { destroy .t } -result {1} test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup { destroy .t .pt set res {} } -body { text .t .t peer create .pt for {set i 1} {$i < 100} {incr i} { .t insert end "Line $i\n" } .t configure -startline 5 # none of the following delete shall crash # (all did before fixing bug 1630262) # 1. delete on the same line: line1 == line2 in DeleteIndexRange, # and resetView is true neither for .t not for .pt .pt delete 2.0 2.2 # 2. delete just one line: line1 < line2 in DeleteIndexRange, # and resetView is true only for .t, not for .pt .pt delete 2.0 3.0 # 3. delete several lines: line1 < line2 in DeleteIndexRange, # and resetView is true only for .t, not for .pt .pt delete 2.0 5.0 # 4. delete to the end line: line1 < line2 in DeleteIndexRange, # and resetView is true only for .t, not for .pt .pt delete 2.0 end # this test succeeds provided there is no crash set res 1 } -cleanup { destroy .pt } -result {1} test text-32.3 {peer widget -start, -end and deletion (bug 1630262)} -setup { destroy .t .pt set res {} } -body { text .t .t peer create .pt for {set i 1} {$i < 100} {incr i} { .t insert end "Line $i\n" } .t configure -startline 5 .pt configure -startline 3 # the following delete shall not crash # (it did before fixing bug 1630262) .pt delete 2.0 3.0 # moreover -startline shall be correct # (was wrong before fixing bug 1630262) lappend res [.t cget -start] [.pt cget -start] } -cleanup { destroy .pt } -result {4 3} test text-32.4 {peer widget -start, -end and deletion (bug 1630262)} -setup { destroy .t .pt set res {} } -body { text .t .t peer create .pt for {set i 1} {$i < 100} {incr i} { .t insert end "Line $i\n" } .t configure -startline 5 -endline 15 .pt configure -startline 8 -endline 12 # .pt now shows a range entirely inside the range of .pt # from .t, delete lines located after [.pt cget -end] .t delete 9.0 10.0 # from .t, delete lines straddling [.pt cget -end] .t delete 6.0 9.0 lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end] .t configure -startline 5 -endline 12 .pt configure -startline 8 -endline 12 # .pt now shows again a range entirely inside the range of .pt # from .t, delete lines located before [.pt cget -start] .t delete 2.0 3.0 # from .t, delete lines straddling [.pt cget -start] .t delete 2.0 5.0 lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end] .t configure -startline 22 -endline 31 .pt configure -startline 42 -endline 51 # .t now shows a range entirely before the range of .pt # from .t, delete some lines, then do it from .pt .t delete 2.0 3.0 .t delete 2.0 5.0 .pt delete 2.0 5.0 lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end] .t configure -startline 55 -endline 75 .pt configure -startline 60 -endline 70 # .pt now shows a range entirely inside the range of .t # from .t, delete a range straddling the entire range of .pt .t delete 3.0 18.0 lappend res [.t cget -start] [.t cget -end] [.pt cget -start] [.pt cget -end] } -cleanup { destroy .pt .t } -result {5 11 8 10 5 8 6 8 22 27 38 44 55 60 57 57} test text-32.2 {peer widget -start, -end and deletion (bug 1630262)} -setup { destroy .t .pt set res {} } -body { text .t .t peer create .pt |
︙ | ︙ |
Changes to tests/textBTree.test.
︙ | ︙ | |||
418 419 420 421 422 423 424 | for {set i 0} {$i < 200} {incr i} { append bigText2 "Line $i\n" } } -body { setup .t insert 1.1 $bigText2 for {set i 0} {$i < 100} {incr i} { | | | | | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | for {set i 0} {$i < 200} {incr i} { append bigText2 "Line $i\n" } } -body { setup .t insert 1.1 $bigText2 for {set i 0} {$i < 100} {incr i} { set j [expr {$i+2}] set k [expr {1+2*$i}] .t tag add x $j.1 $j.3 .t tag add y $k.1 $k.6 } .t delete 2.0 200.0 list [.t tag ranges x] [.t tag ranges y] } -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}} test btree-6.6 {very large deletes, with tags} -setup { set bigText2 {} for {set i 0} {$i < 200} {incr i} { append bigText2 "Line $i\n" } } -body { setup .t insert 1.1 $bigText2 for {set i 0} {$i < 100} {incr i} { set j [expr {$i+2}] set k [expr {1+2*$i}] .t tag add x $j.1 $j.3 .t tag add y $k.1 $k.6 } for {set i 199} {$i >= 2} {incr i -1} { .t delete $i.0 [expr {$i+1}].0 } list [.t tag ranges x] [.t tag ranges y] } -result {{3.0 3.1 3.4 3.12 4.2 4.6} {1.1 1.6 3.4 3.5}} test btree-7.1 {tag addition and removal} -setup { .t delete 1.0 end |
︙ | ︙ |
Changes to tests/textDisp.test.
︙ | ︙ | |||
37 38 39 40 41 42 43 | # because some window managers don't allow the overall width of a window # to get very narrow. catch {destroy .f .t} frame .f -width 100 -height 20 pack .f -side left | > > > > > | > > > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | # because some window managers don't allow the overall width of a window # to get very narrow. catch {destroy .f .t} frame .f -width 100 -height 20 pack .f -side left # On macOS the font "Courier New" has different metrics than "Courier", # and this causes tests 20.1 - 20.5 to fail. So we use "Courier" as the # fixed font for testing on Aqua. if {[tk windowingsystem] eq "aqua"} { set fixedFont {Courier -12} } else { set fixedFont {"Courier New" -12} } # 15 on XP, 13 on Solaris 8 set fixedHeight [font metrics $fixedFont -linespace] # 7 on all platforms set fixedWidth [font measure $fixedFont m] # 12 on XP set fixedAscent [font metrics $fixedFont -ascent] set fixedDiff [expr {$fixedHeight - 13}] ;# 2 on XP |
︙ | ︙ | |||
226 227 228 229 230 231 232 | .t tag delete x y test textDisp-2.1 {LayoutDLine, basics} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This is some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] | | | 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | .t tag delete x y test textDisp-2.1 {LayoutDLine, basics} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This is some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list [expr {5 + $fixedWidth * 19}] 5 $fixedWidth $fixedHeight] [list 5 [expr {5 + $fixedHeight}] $fixedWidth $fixedHeight]] test textDisp-2.2 {LayoutDLine, basics} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This isx some sample text for testing." list [.t bbox 1.19] [.t bbox 1.20] } [list [list 138 5 7 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]] test textDisp-2.3 {LayoutDLine, basics} {textfonts} { |
︙ | ︙ | |||
270 271 272 273 274 275 276 | list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11] } [list [list 19 5 7 $fixedHeight] [list 40 5 7 $fixedHeight] [list 82 5 7 $fixedHeight]] foreach m [.t mark names] { catch {.t mark unset $m} } scan [wm geom .] %dx%d width height test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} { | | | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | list [.t bbox 1.2] [.t bbox 1.5] [.t bbox 1.11] } [list [list 19 5 7 $fixedHeight] [list 40 5 7 $fixedHeight] [list 82 5 7 $fixedHeight]] foreach m [.t mark names] { catch {.t mark unset $m} } scan [wm geom .] %dx%d width height test textDisp-2.8 {LayoutDLine, extra chunk at end of dline} {textfonts} { wm geom . [expr {$width+1}]x$height update .t configure -wrap char .t delete 1.0 end .t insert 1.0 "This isxx some sample text for testing." .t mark set foo 1.20 list [.t bbox 1.19] [.t bbox 1.20] } [list [list 138 5 8 $fixedHeight] [list 5 [expr {$fixedDiff + 18}] 7 $fixedHeight]] |
︙ | ︙ | |||
410 411 412 413 414 415 416 | .t configure -wrap word .t delete 1.0 end .t tag delete x y .t insert end "Short line\nLine 2 is long enough " .t insert end "to wrap around a couple of times" .t insert end "\nLine 3\nLine 4" set i [.t dlineinfo 1.0] | | | | | | | | | | | | | | | | | | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | .t configure -wrap word .t delete 1.0 end .t tag delete x y .t insert end "Short line\nLine 2 is long enough " .t insert end "to wrap around a couple of times" .t insert end "\nLine 3\nLine 4" set i [.t dlineinfo 1.0] set b1 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 2.0] set b2 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4]}] .t configure -spacing1 2 -spacing2 1 -spacing3 3 set i [.t dlineinfo 1.0] set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}] set i [.t dlineinfo 2.0] set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}] set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 2 7 10 15] .t configure -spacing1 0 -spacing2 0 -spacing3 0 test textDisp-2.23 {LayoutDLine, spacing options} {textfonts} { .t configure -wrap word .t delete 1.0 end .t tag delete x y .t insert end "Short line\nLine 2 is long enough " .t insert end "to wrap around a couple of times" .t insert end "\nLine 3\nLine 4" set i [.t dlineinfo 1.0] set b1 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 2.0] set b2 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4]}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4]}] .t configure -spacing1 4 -spacing2 4 -spacing3 4 .t tag configure x -spacing1 1 -spacing2 2 -spacing3 3 .t tag add x 1.0 end .t tag configure y -spacing1 0 -spacing2 3 .t tag add y 2.19 end .t tag raise y set i [.t dlineinfo 1.0] set b1 [expr {[lindex $i 1] + [lindex $i 4] - $b1}] set i [.t dlineinfo 2.0] set b2 [expr {[lindex $i 1] + [lindex $i 4] - $b2}] set i [.t dlineinfo 2.end] set b3 [expr {[lindex $i 1] + [lindex $i 4] - $b3}] set i [.t dlineinfo 3.0] set b4 [expr {[lindex $i 1] + [lindex $i 4] - $b4}] list $b1 $b2 $b3 $b4 } [list 1 5 13 16] .t configure -spacing1 0 -spacing2 0 -spacing3 0 test textDisp-2.24 {LayoutDLine, tabs, saving from first chunk} {textfonts} { .t delete 1.0 end .t tag delete x y .t tag configure x -tabs 70 |
︙ | ︙ | |||
586 587 588 589 590 591 592 | } [list [list 5 [expr {$fixedDiff + 18}] 1 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 1 $fixedHeight] {1.0 2.0 3.0}] if {$tcl_platform(platform) == "windows"} { wm overrideredirect . 0 } test textDisp-4.6 {UpdateDisplayInfo, tiny window} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | } [list [list 5 [expr {$fixedDiff + 18}] 1 $fixedHeight] {} [list 5 [expr {2*$fixedDiff + 31}] 1 $fixedHeight] {1.0 2.0 3.0}] if {$tcl_platform(platform) == "windows"} { wm overrideredirect . 0 } test textDisp-4.6 {UpdateDisplayInfo, tiny window} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. if {$tcl_platform(platform) == "windows"} { wm overrideredirect . 1 } |
︙ | ︙ | |||
618 619 620 621 622 623 624 | set bw [.t cget -borderwidth] set px [.t cget -padx] set py [.t cget -pady] set hlth [.t cget -highlightthickness] test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size | | | | 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | set bw [.t cget -borderwidth] set px [.t cget -padx] set py [.t cget -pady] set hlth [.t cget -highlightthickness] test textDisp-4.7 {UpdateDisplayInfo, filling in extra vertical space} { # This test was failing on Windows because the title bar on . # was a certain minimum size and it was interfering with the size # requested. The "overrideredirect" gets rid of the titlebar so # the toplevel can shrink to the appropriate size. On Unix, setting # the overrideredirect on "." confuses the window manager and # causes subsequent tests to fail. if {$tcl_platform(platform) == "windows"} { wm overrideredirect . 1 } .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 1.0 update .t yview 16.0 update set x [list [.t index @0,0] $tk_textRelayout $tk_textRedraw] wm overrideredirect . 0 update set x } {8.0 {16.0 17.0 15.0 14.0 13.0 12.0 11.0 10.0 9.0 8.0} {8.0 9.0 10.0 11.0 12.0 13.0 14.0 15.0 16.0 17.0}} test textDisp-4.8 {UpdateDisplayInfo, filling in extra vertical space} { .t delete 1.0 end .t insert end "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17" .t yview 16.0 update |
︙ | ︙ | |||
1339 1340 1341 1342 1343 1344 1345 | update list $tk_textRelayout $tk_textRedraw } {2.0 {2.0 eof}} test textDisp-9.13 {TkTextRedrawTag} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { | | | 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 | update list $tk_textRelayout $tk_textRedraw } {2.0 {2.0 eof}} test textDisp-9.13 {TkTextRedrawTag} { .t configure -wrap none .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - This is Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 2.8 2.17 .t tag add hidden 6.8 7.17 .t tag configure hidden -background red .t tag configure hidden -elide true update .t tag configure hidden -elide false |
︙ | ︙ | |||
1510 1511 1512 1513 1514 1515 1516 | pack .top.t .top.t insert end "Line 1" for {set i 2} {$i <= 100} {incr i} { .top.t insert end "\nLine $i" } update scan [wm geometry .top] "%dx%d" w2 h2 | | | 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 | pack .top.t .top.t insert end "Line 1" for {set i 2} {$i <= 100} {incr i} { .top.t insert end "\nLine $i" } update scan [wm geometry .top] "%dx%d" w2 h2 wm geometry .top ${w2}x[expr {$h2-2}] update .top.t yview 1.0 update set tk_textRedraw {} .top.t see 5.0 update # Note, with smooth scrolling, the results of this test |
︙ | ︙ | |||
1741 1742 1743 1744 1745 1746 1747 | lappend x [.t bbox 30.60] .t see 30.65 lappend x [.t bbox 30.65] .t see 30.90 lappend x [.t bbox 30.90] } [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]] test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} { | | | 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | lappend x [.t bbox 30.60] .t see 30.65 lappend x [.t bbox 30.65] .t see 30.90 lappend x [.t bbox 30.90] } [list [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 136 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight] [list 73 [expr {9*$fixedDiff/2 + 64}] 7 $fixedHeight]] test textDisp-13.9 {TkTextSeeCmd procedure} {textfonts} { wm geom . [expr {$width-2}]x$height .t xview moveto 0 .t yview moveto 0 .t tag add sel 30.20 .t tag add sel 30.50 update .t see 30.50 set x [list [.t bbox 30.50]] |
︙ | ︙ | |||
1855 1856 1857 1858 1859 1860 1861 | .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview m 1.4 .t xview } [list [expr {9.0/14}] 1.0] test textDisp-14.10 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a} msg] $msg | | | | 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 | .t insert end "xxxxx xxxxxxxxxxx xxxx xxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview m 1.4 .t xview } [list [expr {9.0/14}] 1.0] test textDisp-14.10 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a} msg] $msg } {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.11 {TkTextXviewCmd procedure} { list [catch {.t xview scroll a b c} msg] $msg } {1 {wrong # args: should be ".t xview scroll number pages|pixels|units"}} test textDisp-14.12 {TkTextXviewCmd procedure} { list [catch {.t xview scroll gorp units} msg] $msg } {1 {expected integer but got "gorp"}} test textDisp-14.13 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" |
︙ | ︙ | |||
1881 1882 1883 1884 1885 1886 1887 | } {2.36 2.18 2.0} test textDisp-14.14 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 | | | | 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 | } {2.36 2.18 2.0} test textDisp-14.14 {TkTextXviewCmd procedure} { .t delete 1.0 end .t insert end xxxxxxxxx\n .t insert end "a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9\n" .t insert end "xxxx xxxxxxxxx xxxxxxxxxxxxx" .t xview moveto 0 .t xview scroll 21 u set x [.t index @0,22] .t xview scroll -1 u lappend x [.t index @0,22] .t xview scroll 100 units lappend x [.t index @0,22] .t xview scroll -15 units lappend x [.t index @0,22] } {2.21 2.20 2.99 2.84} test textDisp-14.15 {TkTextXviewCmd procedure} { list [catch {.t xview scroll 14 globs} msg] $msg } {1 {bad argument "globs": must be pages, pixels, or units}} test textDisp-14.16 {TkTextXviewCmd procedure} { list [catch {.t xview flounder} msg] $msg } {1 {bad option "flounder": must be moveto or scroll}} .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 99} {incr i} { |
︙ | ︙ | |||
2074 2075 2076 2077 2078 2079 2080 | .top1.t yview moveto 0.3333 set result [.top1.t yview] destroy .top1 set result } [list [expr {1.0/3}] [expr {5.0/6}]] test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a} msg] $msg | | | | | | 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 | .top1.t yview moveto 0.3333 set result [.top1.t yview] destroy .top1 set result } [list [expr {1.0/3}] [expr {5.0/6}]] test textDisp-16.19 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a} msg] $msg } {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.20 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll a b c} msg] $msg } {1 {wrong # args: should be ".t yview scroll number pages|pixels|units"}} test textDisp-16.21 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll badInt bogus} msg] $msg } {1 {bad argument "bogus": must be pages, pixels, or units}} test textDisp-16.21.2 {TkTextYviewCmd procedure, "scroll" option} { list [catch {.t yview scroll badInt units} msg] $msg } {1 {expected integer but got "badInt"}} test textDisp-16.22 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 50.0 update .t yview scroll -1 pages .t index @0,0 } {42.0} test textDisp-16.22.1 {TkTextYviewCmd procedure, "scroll" option, back pages} { list [catch {.t yview scroll -3 p} res] $res } {1 {ambiguous argument "p": must be pages, pixels, or units}} test textDisp-16.23 {TkTextYviewCmd procedure, "scroll" option, back pages} { .t yview 50.0 update .t yview scroll -3 pa .t index @0,0 } {26.0} test textDisp-16.24 {TkTextYviewCmd procedure, "scroll" option, back pages} { |
︙ | ︙ | |||
2132 2133 2134 2135 2136 2137 2138 | .t yview scroll 2 pages .t index @0,0 } {66.0} test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {textfonts} { .t yview 98.0 update .t yview scroll 1 page | | | 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 | .t yview scroll 2 pages .t index @0,0 } {66.0} test textDisp-16.28 {TkTextYviewCmd procedure, "scroll" option, forward pages} {textfonts} { .t yview 98.0 update .t yview scroll 1 page set res [expr {int([.t index @0,0])}] if {$fixedDiff > 1} { incr res -1 } set res } {102} test textDisp-16.29 {TkTextYviewCmd procedure, "scroll" option, forward pages} { .t configure -height 1 |
︙ | ︙ | |||
2163 2164 2165 2166 2167 2168 2169 | .t yview 149.0 update .t yview scroll 4 units .t index @0,0 } {151.40} test textDisp-16.32 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 12 bogoids} msg] $msg | | | 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 | .t yview 149.0 update .t yview scroll 4 units .t index @0,0 } {151.40} test textDisp-16.32 {TkTextYviewCmd procedure} { list [catch {.t yview scroll 12 bogoids} msg] $msg } {1 {bad argument "bogoids": must be pages, pixels, or units}} test textDisp-16.33 {TkTextYviewCmd procedure} { list [catch {.t yview bad_arg 1 2} msg] $msg } {1 {bad option "bad_arg": must be moveto or scroll}} test textDisp-16.34 {TkTextYviewCmd procedure} { set res {} .t yview 1.0 lappend res [format %.12g [expr {[lindex [.t yview] 0] |
︙ | ︙ | |||
2288 2289 2290 2291 2292 2293 2294 | .t delete 1.0 end foreach x [list 0 1 2 3 4 5 6 7 8 9 0] { .t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6" .t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden } .t tag configure hidden -elide true ; # 5 hidden lines update | | | 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | .t delete 1.0 end foreach x [list 0 1 2 3 4 5 6 7 8 9 0] { .t insert end "$x aaa1\n$x bbb2\n$x ccc3\n$x ddd4\n$x eee5\n$x fff6" .t insert end "$x 1111\n$x 2222\n$x 3333\n$x 4444\n$x 5555\n$x 6666" hidden } .t tag configure hidden -elide true ; # 5 hidden lines update .t see [expr {5 + [winfo height .t] / $fixedHeight + 1}].0 update .t index @0,0 } {2.0} .t delete 1.0 end foreach i {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} { .t insert end "\nLine $i 11111 $i 22222 $i 33333 $i 44444 $i 55555" |
︙ | ︙ | |||
2337 2338 2339 2340 2341 2342 2343 | list $x [.t index @0,0] } {6.12 2.5} test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t yview 1.0 .t xview moveto 0 .t scan mark 0 60 .t scan dragto 30 100 | | | 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 | list $x [.t index @0,0] } {6.12 2.5} test textDisp-17.8 {TkTextScanCmd procedure} {textfonts} { .t yview 1.0 .t xview moveto 0 .t scan mark 0 60 .t scan dragto 30 100 .t scan dragto 25 95 .t index @0,0 } {4.7} test textDisp-17.9 {TkTextScanCmd procedure} {textfonts} { .t yview end .t xview moveto 0 .t xview scroll 100 units .t scan mark 90 60 |
︙ | ︙ | |||
2739 2740 2741 2742 2743 2744 2745 | wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5" # Need to wait for asychronous calculations to complete. update ; after 10 scan [wm geom .top] %dx%d twidth theight | | | | 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 | wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4\nLine 5" # Need to wait for asychronous calculations to complete. update ; after 10 scan [wm geom .top] %dx%d twidth theight wm geom .top ${twidth}x[expr {$theight - 3}] update .top.t yview } [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]] test textDisp-19.13 {GetYView procedure, partially visible last line} {textfonts} { catch {destroy .top} toplevel .top wm geometry .top +0+0 text .top.t -width 40 -height 5 -font $fixedFont pack .top.t -expand yes -fill both .top.t insert end "Line 1\nLine 2\nLine 3\nLine 4 has enough text to wrap around at least once" # Need to wait for asychronous calculations to complete. update ; after 10 scan [wm geom .top] %dx%d twidth theight wm geom .top ${twidth}x[expr {$theight - 3}] update .top.t yview } [list 0.0 [expr {(5.0 * $fixedHeight - 3.0)/ (5.0 * $fixedHeight)}]] catch {destroy .top} test textDisp-19.14 {GetYView procedure} { .t configure -wrap word .t delete 1.0 end |
︙ | ︙ | |||
2896 2897 2898 2899 2900 2901 2902 | .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-20.1 {FindDLine} { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] | | | 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 | .t delete 50.0 51.0 .t insert 50.0 "This is a long line, one that will wrap around twice.\n" test textDisp-20.1 {FindDLine} { .t yview 48.0 list [.t dlineinfo 46.0] [.t dlineinfo 47.0] [.t dlineinfo 49.0] \ [.t dlineinfo 58.0] } [list {} {} [list 3 [expr {$fixedDiff + 16}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] {}] test textDisp-20.2 {FindDLine} { .t yview 100.0 .t yview -pickplace 53.0 list [.t dlineinfo 50.0] [.t dlineinfo 50.14] [.t dlineinfo 50.21] } [list [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {-1 - $fixedDiff/2}] 140 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {12 + $fixedDiff/2}] 133 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] test textDisp-20.3 {FindDLine} { .t yview 100.0 .t yview 49.0 |
︙ | ︙ | |||
2945 2946 2947 2948 2949 2950 2951 | test textDisp-21.4 {count -displaylines regression} { set message { QOTW: "C/C++, which is used by 16% of users, is the most popular programming language, but Tcl, used by 0%, seems to be the language of choice for the highest scoring users." (new line) Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines. Connect with Tkcon. The command | | | 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 | test textDisp-21.4 {count -displaylines regression} { set message { QOTW: "C/C++, which is used by 16% of users, is the most popular programming language, but Tcl, used by 0%, seems to be the language of choice for the highest scoring users." (new line) Use the Up (cursor) key to scroll up one line at a time. At the second press, the cursor either gets locked or jumps several lines. Connect with Tkcon. The command .u count -displaylines \ 3.10 2.173 should give answer -1; it gives me 5. Using 8.5a4 (ActiveState beta 4) under Linux. No problem with ActiveState beta 3. } toplevel .tt |
︙ | ︙ | |||
2988 2989 2990 2991 2992 2993 2994 | .t config -wrap none .t yview 48.0 list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0] } [list [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] {} [list 3 [expr {3+9*$fixedHeight}] 7 $fixedHeight]] test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 | | | | | | 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 | .t config -wrap none .t yview 48.0 list [.t bbox 50.5] [.t bbox 50.40] [.t bbox 57.0] } [list [list 38 [expr {3+2*$fixedHeight}] 7 $fixedHeight] {} [list 3 [expr {3+9*$fixedHeight}] 7 $fixedHeight]] test textDisp-22.3 {TkTextCharBbox, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height-1}] update list [.t bbox 19.1] [.t bbox 20.1] } [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 3]] test textDisp-22.4 {TkTextCharBbox, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height+1}] update list [.t bbox 19.1] [.t bbox 20.1] } [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] [list 10 [expr {3+10*$fixedHeight}] 7 5]] test textDisp-22.5 {TkTextCharBbox, cut-off char} {textfonts} { .t config -wrap none .t yview 10.0 wm geom . [expr {$width-95}]x$height update .t bbox 15.6 } [list 45 [expr {3+5*$fixedHeight}] 7 $fixedHeight] test textDisp-22.6 {TkTextCharBbox, line visible but not char} {textfonts} { .t config -wrap char .t yview 10.0 .t tag add big 20.2 20.5 wm geom . ${width}x[expr {$height+3}] update list [.t bbox 19.1] [.t bbox 20.1] [.t bbox 20.2] } [list [list 10 [expr {3+9*$fixedHeight}] 7 $fixedHeight] {} [list 17 [expr {3+10*$fixedHeight}] 14 7]] wm geom . {} update test textDisp-22.7 {TkTextCharBbox, different character sizes} {textfonts} { .t config -wrap char |
︙ | ︙ | |||
3056 3057 3058 3059 3060 3061 3062 | [.t bbox 1.1] [.t bbox 2.9] } [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]] .t tag delete spacing test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { | | | 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 | [.t bbox 1.1] [.t bbox 2.9] } [list [list 24 11 10 4] [list 55 [expr {$fixedDiff/2 + 15}] 10 4] [list 10 [expr {2*$fixedDiff + 43}] 10 4] [list 76 [expr {2*$fixedDiff + 40}] 10 4] [list 10 11 7 $fixedHeight] [list 69 [expr {$fixedDiff + 34}] 7 $fixedHeight]] .t tag delete spacing test textDisp-22.10 {TkTextCharBbox, handling of elided lines} {textfonts} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 2.8 2.13 .t tag add hidden 6.8 7.13 .t tag configure hidden -elide true update list \ [expr {[lindex [.t bbox 2.9] 0] - [lindex [.t bbox 2.8] 0]}] \ |
︙ | ︙ | |||
3079 3080 3081 3082 3083 3084 3085 | [expr {[lindex [.t bbox 7.1] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}] } [list 0 0 0 0 0 0 0 0 0 0 0] test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfonts} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { | | | 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 | [expr {[lindex [.t bbox 7.1] 0] - [lindex [.t bbox 6.8] 0]}] \ [expr {[lindex [.t bbox 7.12] 0] - [lindex [.t bbox 6.8] 0]}] } [list 0 0 0 0 0 0 0 0 0 0 0] test textDisp-22.11 {TkTextCharBbox, handling of wrapped elided lines} {textfonts} { .t configure -wrap char .t delete 1.0 end for {set i 1} {$i < 10} {incr i} { .t insert end "Line $i - Line _$i - Lines .$i - Line [format %c [expr {64+$i}]]\n" } .t tag add hidden 1.30 2.5 .t tag configure hidden -elide true update list \ [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.4] 0]}] \ [expr {[lindex [.t bbox 1.30] 0] - [lindex [.t bbox 2.5] 0]}] |
︙ | ︙ | |||
3120 3121 3122 3123 3124 3125 3126 | update .t yview 48.0 list [.t dlineinfo 50.40] [.t dlineinfo 57.3] } [list [list 3 [expr {2*$fixedDiff + 29}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 | | | | 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 | update .t yview 48.0 list [.t dlineinfo 50.40] [.t dlineinfo 57.3] } [list [list 3 [expr {2*$fixedDiff + 29}] 371 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]]] test textDisp-23.4 {TkTextDLineInfo, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height-1}] update list [.t dlineinfo 19.0] [.t dlineinfo 20.0] } [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 3 [expr {$fixedDiff + 10}]]] test textDisp-23.5 {TkTextDLineInfo, cut-off lines} {textfonts} { .t config -wrap char .t yview 10.0 wm geom . ${width}x[expr {$height+1}] update list [.t dlineinfo 19.0] [.t dlineinfo 20.0] } [list [list 3 [expr {9*$fixedDiff + 120}] 49 [expr {$fixedDiff + 13}] [expr {$fixedDiff + 10}]] [list 3 [expr {10*$fixedDiff + 133}] 49 5 [expr {$fixedDiff + 10}]]] wm geom . {} update test textDisp-23.6 {TkTextDLineInfo, horizontal scrolling} {textfonts} { .t config -wrap none |
︙ | ︙ | |||
3168 3169 3170 3171 3172 3173 3174 | .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" | | | | 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 | .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.2 {TkTextCharLayoutProc} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width+1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.3 {TkTextCharLayoutProc} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width-1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.4 {TkTextCharLayoutProc, newline not visible} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 01234567890123456789\n012345678901234567890 |
︙ | ︙ | |||
3208 3209 3210 3211 3212 3213 3214 | update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" | | | | | | | 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 | update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.7 {TkTextCharLayoutProc, line ends with space} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width+1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 12 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.8 {TkTextCharLayoutProc, line ends with space} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 10 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.9 {TkTextCharLayoutProc, line ends with space} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-6}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 5 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.10 {TkTextCharLayoutProc, line ends with space} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "a b c d e f g h i j k l m n o p" wm geom . [expr {$width-7}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 4 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.11 {TkTextCharLayoutProc, line ends with space that doesn't quite fit} {textfonts} { .t configure -wrap char .t delete 1.0 end .t insert 1.0 "01234567890123456789 \nabcdefg" wm geom . [expr {$width-2}]x$height update set result {} lappend result [.t bbox 1.21] [.t bbox 2.0] .t mark set insert 1.21 lappend result [.t bbox 1.21] [.t bbox 2.0] } [list [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight] [list 145 3 0 $fixedHeight] [list 3 [expr {$fixedDiff + 16}] 7 $fixedHeight]] test textDisp-24.12 {TkTextCharLayoutProc, tab causes wrap} {textfonts} { |
︙ | ︙ | |||
3267 3268 3269 3270 3271 3272 3273 | update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] {}] test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" | | | | 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 | update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] {}] test textDisp-24.14 {TkTextCharLayoutProc, -wrap none} {textfonts} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width+1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 143 3 5 $fixedHeight]] test textDisp-24.15 {TkTextCharLayoutProc, -wrap none} {textfonts} { .t configure -wrap none .t delete 1.0 end .t insert 1.0 "abcdefghijklmnopqrstuvwxyz" wm geom . [expr {$width-1}]x$height update list [.t bbox 1.19] [.t bbox 1.20] } [list [list 136 3 7 $fixedHeight] [list 143 3 3 $fixedHeight]] test textDisp-24.16 {TkTextCharLayoutProc, no chars fit} {textfonts} { if {$tcl_platform(platform) == "windows"} { wm overrideredirect . 1 } |
︙ | ︙ | |||
3424 3425 3426 3427 3428 3429 3430 | test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} { .t delete 1.0 end .t insert 1.0 a\tb\tc\td\te .t tag delete x .t tag configure x -tabs {40 70 right} .t tag add x 1.0 end list [lindex [.t bbox 1.2] 0] \ | | | | | 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 | test textDisp-26.3 {AdjustForTab procedure, not enough tabs specified} { .t delete 1.0 end .t insert 1.0 a\tb\tc\td\te .t tag delete x .t tag configure x -tabs {40 70 right} .t tag add x 1.0 end list [lindex [.t bbox 1.2] 0] \ [expr {[lindex [.t bbox 1.4] 0] + [lindex [.t bbox 1.4] 2]}] \ [expr {[lindex [.t bbox 1.6] 0] + [lindex [.t bbox 1.6] 2]}] \ [expr {[lindex [.t bbox 1.8] 0] + [lindex [.t bbox 1.8] 2]}] } [list 40 70 100 130] test textDisp-26.4 {AdjustForTab procedure, different alignments} { .t delete 1.0 end .t insert 1.0 a\tbc\tde\tfg\thi .t tag delete x .t tag configure x -tabs {40 center 80 left 130 right} .t tag add x 1.0 end |
︙ | ︙ | |||
3849 3850 3851 3852 3853 3854 3855 | update ; update set xv [.t2.t xview] set xd [expr {[lindex $xv 1] - [lindex $xv 0]}] .t2.t xview moveto [expr {1.0-$xd}] set iWidth [lindex [.t2.t bbox end-2c] 2] .t2.t xview scroll 2 units set iWidth2 [lindex [.t2.t bbox end-2c] 2] | | | 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 | update ; update set xv [.t2.t xview] set xd [expr {[lindex $xv 1] - [lindex $xv 0]}] .t2.t xview moveto [expr {1.0-$xd}] set iWidth [lindex [.t2.t bbox end-2c] 2] .t2.t xview scroll 2 units set iWidth2 [lindex [.t2.t bbox end-2c] 2] if {($iWidth == $iWidth2) && $iWidth >= 2} { set result "correct" } else { set result "last character is not completely visible when it should be" } } {correct} test textDisp-29.3 {miscellaneous: lines wrap but are still too long} {textfonts} { |
︙ | ︙ |
Changes to tests/textImage.test.
︙ | ︙ | |||
70 71 72 73 74 75 76 | } -returnCodes error -result {no embedded image at index "1.1"} test textImage-1.6 {configure argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t | | | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | } -returnCodes error -result {no embedded image at index "1.1"} test textImage-1.6 {configure argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image configure } -cleanup { destroy .t } -returnCodes error -result {wrong # args: should be ".t image configure index ?-option value ...?"} test textImage-1.7 {configure argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image configure blurf } -cleanup { destroy .t } -returnCodes error -result {bad text index "blurf"} test textImage-1.8 {configure argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image configure 1.1 } -cleanup { destroy .t } -returnCodes error -result {no embedded image at index "1.1"} test textImage-1.9 {create argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create } -cleanup { destroy .t } -returnCodes error -result {wrong # args: should be ".t image create index ?-option value ...?"} test textImage-1.10 {create argument checking} -setup { destroy .t } -body { text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create blurf } -cleanup { destroy .t } -returnCodes error -result {bad text index "blurf"} test textImage-1.11 {basic argument checking} -setup { destroy .t } -body { |
︙ | ︙ | |||
217 218 219 220 221 222 223 | small put red -to 0 0 4 4 } text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image small foreach i {align padx pady image name} { lappend result $i:[.t image cget small -$i] | | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | small put red -to 0 0 4 4 } text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image small foreach i {align padx pady image name} { lappend result $i:[.t image cget small -$i] } return $result } -cleanup { destroy .t image delete small } -result {align:center padx:0 pady:0 image:small name:} test textImage-1.18 {basic configure options} -setup { |
︙ | ︙ | |||
239 240 241 242 243 244 245 | large put green -to 0 0 50 50 } text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image small foreach {option value} {align top padx 5 pady 7 image large name none} { .t image configure small -$option $value | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | large put green -to 0 0 50 50 } text .t -font test_font -bd 0 -highlightthickness 0 -padx 0 -pady 0 pack .t .t image create end -image small foreach {option value} {align top padx 5 pady 7 image large name none} { .t image configure small -$option $value } update .t image configure small } -cleanup { destroy .t image delete small large } -result {{-align {} {} center top} {-padx {} {} 0 5} {-pady {} {} 0 7} {-image {} {} {} large} {-name {} {} {} none}} |
︙ | ︙ | |||
305 306 307 308 309 310 311 | .t image create end -image vary -align top update lappend result base:[.t bbox vary] foreach i {10 20 40} { vary configure -width $i -height $i update lappend result $i:[.t bbox vary] | | | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | .t image create end -image vary -align top update lappend result base:[.t bbox vary] foreach i {10 20 40} { vary configure -width $i -height $i update lappend result $i:[.t bbox vary] } return $result } -cleanup { destroy .t image delete vary } -result {{base:0 0 5 5} {10:0 0 10 10} {20:0 0 20 20} {40:0 0 40 40}} test textImage-3.2 {delayed image management, see also bug 1591493} -setup { |
︙ | ︙ |
Changes to tests/textIndex.test.
︙ | ︙ | |||
13 14 15 16 17 18 19 | catch {destroy .t} text .t -font {Courier -12} -width 20 -height 10 pack .t -expand 1 -fill both update .t debug on wm geometry . {} | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | catch {destroy .t} text .t -font {Courier -12} -width 20 -height 10 pack .t -expand 1 -fill both update .t debug on wm geometry . {} # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . |
︙ | ︙ | |||
70 71 72 73 74 75 76 | testtext .t byteindex 1 0 } {1.0 0} test textIndex-1.9 {TkTextMakeByteIndex: shortcut for 0} {testtext} { # not (byteIndex == 0) testtext .t byteindex 3 80 } {3.5 5} test textIndex-1.10 {TkTextMakeByteIndex: verify index is in range} {testtext} { | | | | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | testtext .t byteindex 1 0 } {1.0 0} test textIndex-1.9 {TkTextMakeByteIndex: shortcut for 0} {testtext} { # not (byteIndex == 0) testtext .t byteindex 3 80 } {3.5 5} test textIndex-1.10 {TkTextMakeByteIndex: verify index is in range} {testtext} { # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # one segment testtext .t byteindex 3 5 } {3.5 5} test textIndex-1.11 {TkTextMakeByteIndex: verify index is in range} {testtext} { # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # index += segPtr->size # Multiple segments, make sure add segment size to index. .t mark set foo 3.2 set x [testtext .t byteindex 3 7] .t mark unset foo set x } {3.5 5} test textIndex-1.12 {TkTextMakeByteIndex: verify index is in range} {testtext} { # (segPtr == NULL) testtext .t byteindex 3 7 |
︙ | ︙ | |||
113 114 115 116 117 118 119 | set x } {3.4 4} test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} { testtext .t byteindex 5 100 } {5.18 20} test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ {testtext} { | | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | set x } {3.4 4} test textIndex-1.16 {TkTextMakeByteIndex: UTF-8 characters} {testtext} { testtext .t byteindex 5 100 } {5.18 20} test textIndex-1.17 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ {testtext} { # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) # Wrong answer would be \xb9 (the 2nd byte of UTF rep of 0x4e4f). set x [testtext .t byteindex 5 2] list $x [.t get insert] } {{5.2 4} y} test textIndex-1.18 {TkTextMakeByteIndex: prevent splitting UTF-8 character} \ {testtext} { # ((byteIndex > index) && (segPtr->typePtr == &tkTextCharType)) testtext .t byteindex 5 1 .t get insert } "\u4e4f" test textIndex-2.1 {TkTextMakeCharIndex} { # (lineIndex < 0) .t index -1.3 |
︙ | ︙ | |||
164 165 166 167 168 169 170 | .t index 3.5 } 3.5 test textIndex-2.9 {TkTextMakeCharIndex: verify index is in range} { # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # Multiple segments, make sure add segment size to index. | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | .t index 3.5 } 3.5 test textIndex-2.9 {TkTextMakeCharIndex: verify index is in range} { # for (segPtr = indexPtr->linePtr->segPtr; ; segPtr = segPtr->nextPtr) # Multiple segments, make sure add segment size to index. .t mark set foo 3.2 set x [.t index 3.7] .t mark unset foo set x } 3.5 test textIndex-2.10 {TkTextMakeCharIndex: verify index is in range} { # (segPtr == NULL) .t index 3.7 |
︙ | ︙ | |||
435 436 437 438 439 440 441 | # border condition: last char .t index {2.3 + 10 chars} } 2.13 test textIndex-12.6 {TkTextIndexForwChars: find index} { # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) # border condition: segPtr == NULL -> beginning of next line | | | | 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | # border condition: last char .t index {2.3 + 10 chars} } 2.13 test textIndex-12.6 {TkTextIndexForwChars: find index} { # for ( ; segPtr != NULL; segPtr = segPtr->nextPtr) # border condition: segPtr == NULL -> beginning of next line .t index {2.3 + 11 chars} } 3.0 test textIndex-12.7 {TkTextIndexForwChars: find index} { # (segPtr->typePtr == &tkTextCharType) .t index {2.3 + 2 chars} } 2.5 test textIndex-12.8 {TkTextIndexForwChars: find index} { # (charCount == 0) # No more chars, so we found byte offset. .t index {2.3 + 2 chars} } 2.5 test textIndex-12.9 {TkTextIndexForwChars: find index} { # not (segPtr->typePtr == &tkTextCharType) .t image create 2.4 -image textimage set x [.t get {2.3 + 3 chars}] .t delete 2.4 set x } "f" test textIndex-12.10 {TkTextIndexForwChars: find index} { # dstPtr->byteIndex += segPtr->size - byteOffset # When moving to next segment, account for bytes in last segment. # Wrong answer would be 2.4 .t mark set foo 2.4 |
︙ | ︙ | |||
584 585 586 587 588 589 590 | .t mark set foo 3.4 set x [.t index {3.5 - 10 chars}] .t mark unset foo set x } 2.9 test textIndex-14.12 {TkTextIndexBackChars: move to previous line} { | | | | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | .t mark set foo 3.4 set x [.t index {3.5 - 10 chars}] .t mark unset foo set x } 2.9 test textIndex-14.12 {TkTextIndexBackChars: move to previous line} { # (lineIndex == 0) .t index {1.5 - 10 chars} } 1.0 test textIndex-14.13 {TkTextIndexBackChars: move to previous line} { # not (lineIndex == 0) .t index {2.5 - 10 chars} } 1.2 test textIndex-14.14 {TkTextIndexBackChars: move to previous line} { # for (segPtr = oldPtr; segPtr != NULL; segPtr = segPtr->nextPtr) # Set byteIndex to end of previous line so we can subtract more # bytes from it. Otherwise we get an TkTextIndex with a negative # byteIndex. |
︙ | ︙ |
Changes to tests/textMark.test.
︙ | ︙ | |||
23 24 25 26 27 28 29 | .t insert 1.0 "Line 1 abcdefghijklm 12345 Line 4 bOy GIrl .#@? x_yz !@#$% Line 7" | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | .t insert 1.0 "Line 1 abcdefghijklm 12345 Line 4 bOy GIrl .#@? x_yz !@#$% Line 7" # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . |
︙ | ︙ |
Changes to tests/textTag.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file is a Tcl script to test the code in the file tkTextTag.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands destroy .t text .t -width 20 -height 10 | > > > > > > > > > > > > > > > < < < < | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | # This file is a Tcl script to test the code in the file tkTextTag.c. # This file is organized in the standard fashion for Tcl tests. # # Copyright (c) 1994 The Regents of the University of California. # Copyright (c) 1994-1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands set textWidgetFont {Courier 12} set bigFont {Courier 24} # what is needed is a font that is both fixed-width and featuring a # specific size because in some tests (that will be constrained by # haveFontSizes), a tag applying the $bigFont will be set to some # characters, which action has the effect of changing what character # is under the mouse pointer, which is the purpose of the tests testConstraint haveFontSizes [expr { [font metrics $textWidgetFont -fixed] && [font actual $textWidgetFont -size] == 12 && [font metrics $bigFont -fixed] && [font actual $bigFont -size] == 24 } ] destroy .t text .t -width 20 -height 10 pack .t -expand 1 -fill both update .t debug on wm geometry . {} # The statements below reset the main window; it's needed if the window # manager is mwm, to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . .t insert 1.0 "Line 1 abcdefghijklm 12345 Line 4 bOy GIrl .#@? x_yz !@#$% Line 7" test textTag-1.1 {tag configuration options} -body { .t tag configure x -background #012345 .t tag cget x -background } -cleanup { .t tag configure x -background [lindex [.t tag configure x -background] 3] } -result {#012345} test textTag-1.2 {configuration options} -body { .t tag configure x -background non-existent } -cleanup { .t tag configure x -background [lindex [.t tag configure x -background] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.3 {tag configuration options} -body { .t tag configure x -bgstipple gray50 .t tag cget x -bgstipple } -cleanup { .t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3] } -result {gray50} test textTag-1.4 {configuration options} -body { .t tag configure x -bgstipple badStipple } -cleanup { .t tag configure x -bgstipple [lindex [.t tag configure x -bgstipple] 3] } -returnCodes error -result {bitmap "badStipple" not defined} test textTag-1.5 {tag configuration options} -body { .t tag configure x -borderwidth 2 .t tag cget x -borderwidth } -cleanup { .t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3] } -result {2} test textTag-1.6 {configuration options} -body { .t tag configure x -borderwidth 46q } -cleanup { .t tag configure x -borderwidth [lindex [.t tag configure x -borderwidth] 3] } -returnCodes error -result {bad screen distance "46q"} test textTag-1.7 {tag configuration options} -body { .t tag configure x -fgstipple gray25 .t tag cget x -fgstipple } -cleanup { .t tag configure x -fgstipple [lindex [.t tag configure x -fgstipple] 3] } -result {gray25} test textTag-1.8 {configuration options} -body { .t tag configure x -fgstipple bogus } -cleanup { .t tag configure x -fgstipple [lindex [.t tag configure x -fgstipple] 3] } -returnCodes error -result {bitmap "bogus" not defined} test textTag-1.9 {tag configuration options} -body { .t tag configure x -font fixed .t tag cget x -font } -cleanup { .t tag configure x -font [lindex [.t tag configure x -font] 3] } -result {fixed} test textTag-1.10 {tag configuration options} -body { .t tag configure x -foreground #001122 .t tag cget x -foreground } -cleanup { .t tag configure x -foreground [lindex [.t tag configure x -foreground] 3] } -result {#001122} test textTag-1.11 {configuration options} -body { .t tag configure x -foreground {silly color} } -cleanup { .t tag configure x -foreground [lindex [.t tag configure x -foreground] 3] } -returnCodes error -result {unknown color name "silly color"} test textTag-1.12 {tag configuration options} -body { .t tag configure x -justify left .t tag cget x -justify } -cleanup { .t tag configure x -justify [lindex [.t tag configure x -justify] 3] } -result {left} test textTag-1.13 {configuration options} -body { .t tag configure x -justify middle } -cleanup { .t tag configure x -justify [lindex [.t tag configure x -justify] 3] } -returnCodes error -result {bad justification "middle": must be left, right, or center} test textTag-1.14 {tag configuration options} -body { .t tag configure x -lmargin1 10 .t tag cget x -lmargin1 } -cleanup { .t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3] } -result {10} test textTag-1.15 {configuration options} -body { .t tag configure x -lmargin1 bad } -cleanup { .t tag configure x -lmargin1 [lindex [.t tag configure x -lmargin1] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.16 {tag configuration options} -body { .t tag configure x -lmargin2 10 .t tag cget x -lmargin2 } -cleanup { .t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3] } -result {10} test textTag-1.17 {configuration options} -body { .t tag configure x -lmargin2 bad } -cleanup { .t tag configure x -lmargin2 [lindex [.t tag configure x -lmargin2] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.17a {tag configuration options} -body { .t tag configure x -lmargincolor lightgreen .t tag cget x -lmargincolor } -cleanup { .t tag configure x -lmargincolor [lindex [.t tag configure x -lmargincolor] 3] } -result {lightgreen} test textTag-1.17b {configuration options} -body { .t tag configure x -lmargincolor non-existent } -cleanup { .t tag configure x -lmargincolor [lindex [.t tag configure x -lmargincolor] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.18 {tag configuration options} -body { .t tag configure x -offset 2 .t tag cget x -offset } -cleanup { .t tag configure x -offset [lindex [.t tag configure x -offset] 3] } -result {2} test textTag-1.19 {configuration options} -body { .t tag configure x -offset 100xyz } -cleanup { .t tag configure x -offset [lindex [.t tag configure x -offset] 3] } -returnCodes error -result {bad screen distance "100xyz"} test textTag-1.20 {tag configuration options} -body { .t tag configure x -overstrike on .t tag cget x -overstrike } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -result {on} test textTag-1.21 {configuration options} -body { .t tag configure x -overstrike stupid } -cleanup { .t tag configure x -overstrike [lindex [.t tag configure x -overstrike] 3] } -returnCodes error -result {expected boolean value but got "stupid"} test textTag-1.21a {tag configuration options} -body { .t tag configure x -overstrikefg red .t tag cget x -overstrikefg } -cleanup { .t tag configure x -overstrikefg [lindex [.t tag configure x -overstrikefg] 3] } -result {red} test textTag-1.21b {configuration options} -body { .t tag configure x -overstrikefg stupid } -cleanup { .t tag configure x -overstrikefg [lindex [.t tag configure x -overstrikefg] 3] } -returnCodes error -result {unknown color name "stupid"} test textTag-1.22 {tag configuration options} -body { .t tag configure x -relief raised .t tag cget x -relief } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] } -result {raised} test textTag-1.23 {configuration options} -body { .t tag configure x -relief stupid } -cleanup { .t tag configure x -relief [lindex [.t tag configure x -relief] 3] } -returnCodes error -result {bad relief "stupid": must be flat, groove, raised, ridge, solid, or sunken} test textTag-1.24 {tag configuration options} -body { .t tag configure x -rmargin 10 .t tag cget x -rmargin } -cleanup { .t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3] } -result {10} test textTag-1.25 {configuration options} -body { .t tag configure x -rmargin bad } -cleanup { .t tag configure x -rmargin [lindex [.t tag configure x -rmargin] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.25a {tag configuration options} -body { .t tag configure x -rmargincolor darkblue .t tag cget x -rmargincolor |
︙ | ︙ | |||
279 280 281 282 283 284 285 | .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -result {#012345} test textTag-1.25f {configuration options} -body { .t tag configure x -selectforeground non-existent } -cleanup { .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -returnCodes error -result {unknown color name "non-existent"} | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | | | < < | < < | < < | < < | < < | < < | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 | .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -result {#012345} test textTag-1.25f {configuration options} -body { .t tag configure x -selectforeground non-existent } -cleanup { .t tag configure x -selectforeground [lindex [.t tag configure x -selectforeground] 3] } -returnCodes error -result {unknown color name "non-existent"} test textTag-1.26 {tag configuration options} -body { .t tag configure x -spacing1 10 .t tag cget x -spacing1 } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] } -result {10} test textTag-1.27 {configuration options} -body { .t tag configure x -spacing1 bad } -cleanup { .t tag configure x -spacing1 [lindex [.t tag configure x -spacing1] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.28 {tag configuration options} -body { .t tag configure x -spacing2 10 .t tag cget x -spacing2 } -cleanup { .t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3] } -result {10} test textTag-1.29 {configuration options} -body { .t tag configure x -spacing2 bad } -cleanup { .t tag configure x -spacing2 [lindex [.t tag configure x -spacing2] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.30 {tag configuration options} -body { .t tag configure x -spacing3 10 .t tag cget x -spacing3 } -cleanup { .t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3] } -result {10} test textTag-1.31 {configuration options} -body { .t tag configure x -spacing3 bad } -cleanup { .t tag configure x -spacing3 [lindex [.t tag configure x -spacing3] 3] } -returnCodes error -result {bad screen distance "bad"} test textTag-1.32 {tag configuration options} -body { .t tag configure x -tabs {10 20 30} .t tag cget x -tabs } -cleanup { .t tag configure x -tabs [lindex [.t tag configure x -tabs] 3] } -result {10 20 30} test textTag-1.33 {configuration options} -body { .t tag configure x -tabs {10 fork} } -cleanup { .t tag configure x -tabs [lindex [.t tag configure x -tabs] 3] } -returnCodes error -result {bad tab alignment "fork": must be left, right, center, or numeric} test textTag-1.34 {tag configuration options} -body { .t tag configure x -underline no .t tag cget x -underline } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -result {no} test textTag-1.35 {configuration options} -body { .t tag configure x -underline stupid } -cleanup { .t tag configure x -underline [lindex [.t tag configure x -underline] 3] } -returnCodes error -result {expected boolean value but got "stupid"} test textTag-1.36 {tag configuration options} -body { .t tag configure x -underlinefg red .t tag cget x -underlinefg } -cleanup { .t tag configure x -underlinefg [lindex [.t tag configure x -underlinefg] 3] } -result {red} test textTag-1.37 {configuration options} -body { .t tag configure x -underlinefg stupid } -cleanup { .t tag configure x -underlinefg [lindex [.t tag configure x -underlinefg] 3] } -returnCodes error -result {unknown color name "stupid"} test textTag-2.1 {TkTextTagCmd - "add" option} -body { .t tag } -returnCodes error -result {wrong # args: should be ".t tag option ?arg ...?"} test textTag-2.2 {TkTextTagCmd - "add" option} -body { .t tag gorp } -returnCodes error -result {bad tag option "gorp": must be add, bind, cget, configure, delete, lower, names, nextrange, prevrange, raise, ranges, or remove} test textTag-2.3 {TkTextTagCmd - "add" option} -body { .t tag add foo } -returnCodes error -result {wrong # args: should be ".t tag add tagName index1 ?index2 index1 index2 ...?"} test textTag-2.4 {TkTextTagCmd - "add" option} -body { .t tag add x gorp } -returnCodes error -result {bad text index "gorp"} test textTag-2.5 {TkTextTagCmd - "add" option} -body { .t tag add x 1.2 gorp } -returnCodes error -result {bad text index "gorp"} test textTag-2.6 {TkTextTagCmd - "add" option} -setup { .t tag delete sel } -body { .t tag add sel 3.2 3.4 .t tag add sel 3.2 3.0 .t tag ranges sel } -result {3.2 3.4} test textTag-2.7 {TkTextTagCmd - "add" option} -setup { .t tag delete x } -body { .t tag add x 1.0 1.end .t tag ranges x } -cleanup { .t tag delete x } -result {1.0 1.6} test textTag-2.8 {TkTextTagCmd - "add" option} -setup { .t tag remove x 1.0 end } -body { .t tag add x 1.2 .t tag ranges x } -cleanup { .t tag delete x } -result {1.2 1.3} test textTag-2.9 {TkTextTagCmd - "add" option} -setup { destroy .t.e } -body { entry .t.e .t.e insert 0 "Text" .t.e select from 0 .t.e select to 4 .t tag add sel 3.2 3.4 selection get } -cleanup { destroy .t.e } -result 34 test textTag-2.10 {TkTextTagCmd - "add" option} -setup { destroy .t.e } -body { entry .t.e .t.e insert 0 "Text" .t.e select from 0 .t.e select to 4 .t configure -exportselection 0 .t tag add sel 3.2 3.4 selection get } -cleanup { destroy .t.e } -result {Text} test textTag-2.11 {TkTextTagCmd - "add" option} -body { .t tag remove sel 1.0 end .t tag add sel 1.1 1.5 2.4 3.1 4.2 4.4 .t tag ranges sel } -result {1.1 1.5 2.4 3.1 4.2 4.4} test textTag-2.12 {TkTextTagCmd - "add" option} -body { .t tag remove sel 1.0 end .t tag add sel 1.1 1.5 2.4 .t tag ranges sel } -cleanup { .t tag remove sel 1.0 end } -result {1.1 1.5 2.4 2.5} test textTag-2.14 {tag add before -startline - Bug 1615425} -body { text .tt for {set i 1} {$i <10} {incr i} { .tt insert end "Line $i\n" } .tt tag configure mytag -font {Courier 12 bold} .tt peer create .ptt .ptt configure -startline 3 -endline 7 # the test succeeds if next line does not crash .tt tag add mytag 1.0 1.end destroy .ptt .tt set res 1 } -result {1} test textTag-3.1 {TkTextTagCmd - "bind" option} -body { .t tag bind } -returnCodes error -result {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"} test textTag-3.2 {TkTextTagCmd - "bind" option} -body { .t tag bind 1 2 3 4 } -returnCodes error -result {wrong # args: should be ".t tag bind tagName ?sequence? ?command?"} test textTag-3.3 {TkTextTagCmd - "bind" option} -body { .t tag bind x <Enter> script1 .t tag bind x <Enter> } -cleanup { .t tag delete x } -result {script1} test textTag-3.4 {TkTextTagCmd - "bind" option} -body { .t tag bind x <Gorp> script2 } -returnCodes error -result {bad event type or keysym "Gorp"} test textTag-3.5 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x <Enter> script1 .t tag bind x <FocusIn> script2 } -cleanup { .t tag delete x } -returnCodes error -result {requested illegal events; only key, button, motion, enter, leave, and virtual events may be used} test textTag-3.6 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x <Enter> script1 catch {.t tag bind x <FocusIn> script2} .t tag bind x } -cleanup { .t tag delete x } -result {<Enter>} test textTag-3.7 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x <Enter> script1 .t tag bind x <Leave> script2 .t tag bind x a xyzzy list [lsort [.t tag bind x]] [.t tag bind x <Enter>] [.t tag bind x a] } -cleanup { .t tag delete x } -result {{<Enter> <Leave> a} script1 xyzzy} test textTag-3.8 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x <Enter> script1 .t tag bind x <Enter> +script2 .t tag bind x <Enter> } -cleanup { .t tag delete x } -result {script1 script2} test textTag-3.9 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x <Enter> } -cleanup { .t tag delete x } -returnCodes ok -result {} test textTag-3.10 {TkTextTagCmd - "bind" option} -body { .t tag delete x .t tag bind x < } -cleanup { .t tag delete x } -returnCodes error -result {no event type or button # or keysym} test textTag-4.1 {TkTextTagCmd - "cget" option} -body { .t tag cget a } -returnCodes error -result {wrong # args: should be ".t tag cget tagName option"} test textTag-4.2 {TkTextTagCmd - "cget" option} -body { .t tag cget a b c } -returnCodes error -result {wrong # args: should be ".t tag cget tagName option"} test textTag-4.3 {TkTextTagCmd - "cget" option} -body { .t tag delete foo .t tag cget foo bar } -returnCodes error -result {tag "foo" isn't defined in text widget} test textTag-4.4 {TkTextTagCmd - "cget" option} -body { .t tag cget sel bogus } -returnCodes error -result {unknown option "bogus"} test textTag-4.5 {TkTextTagCmd - "cget" option} -body { .t tag delete x .t tag configure x -background red .t tag cget x -background } -cleanup { .t tag delete x } -result {red} test textTag-5.1 {TkTextTagCmd - "configure" option} -body { .t tag configure } -returnCodes error -result {wrong # args: should be ".t tag configure tagName ?-option? ?value? ?-option value ...?"} test textTag-5.2 {TkTextTagCmd - "configure" option} -body { .t tag configure x -foo } -returnCodes error -result {unknown option "-foo"} test textTag-5.3 {TkTextTagCmd - "configure" option} -body { .t tag configure x -background red -underline } -cleanup { .t tag delete x } -returnCodes error -result {value for "-underline" missing} test textTag-5.4 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline yes .t tag configure x -underline } -cleanup { .t tag delete x } -result {-underline {} {} {} yes} test textTag-5.4a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underlinefg lightgreen .t tag configure x -underlinefg } -cleanup { .t tag delete x } -result {-underlinefg {} {} {} lightgreen} test textTag-5.5 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -overstrike on .t tag cget x -overstrike } -cleanup { .t tag delete x } -result {on} test textTag-5.5a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -overstrikefg lightgreen .t tag configure x -overstrikefg } -cleanup { .t tag delete x } -result {-overstrikefg {} {} {} lightgreen} test textTag-5.6 {TkTextTagCmd - "configure" option} -body { .t tag configure x -overstrike foo } -cleanup { .t tag delete x } -returnCodes error -result {expected boolean value but got "foo"} test textTag-5.7 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -underline stupid } -cleanup { .t tag delete x } -returnCodes error -result {expected boolean value but got "stupid"} test textTag-5.8 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify left .t tag configure x -justify } -cleanup { .t tag delete x } -result {-justify {} {} {} left} test textTag-5.9 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify bogus } -cleanup { .t tag delete x } -returnCodes error -result {bad justification "bogus": must be left, right, or center} test textTag-5.10 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -justify fill } -cleanup { .t tag delete x } -returnCodes error -result {bad justification "fill": must be left, right, or center} test textTag-5.11 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -offset 2 .t tag configure x -offset } -cleanup { .t tag delete x } -result {-offset {} {} {} 2} test textTag-5.12 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -offset 1.0q } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "1.0q"} test textTag-5.13 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin1 2 -lmargin2 4 -rmargin 5 \ -lmargincolor darkblue -rmargincolor lightgreen list [.t tag configure x -lmargin1] [.t tag configure x -lmargin2] \ [.t tag configure x -rmargin] [.t tag configure x -lmargincolor] \ [.t tag configure x -rmargincolor] } -cleanup { .t tag delete x } -result [list {-lmargin1 {} {} {} 2} {-lmargin2 {} {} {} 4} \ {-rmargin {} {} {} 5} \ {-lmargincolor {} {} {} darkblue} {-rmargincolor {} {} {} lightgreen} \ ] test textTag-5.14 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin1 2.0x } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "2.0x"} test textTag-5.15 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargin2 gorp } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "gorp"} test textTag-5.15a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -lmargincolor rainbow } -cleanup { .t tag delete x } -returnCodes error -result {unknown color name "rainbow"} test textTag-5.16 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -rmargin 140.1.1 } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "140.1.1"} test textTag-5.16a {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -rmargincolor rainbow } -cleanup { .t tag delete x } -returnCodes error -result {unknown color name "rainbow"} .t tag delete x test textTag-5.17 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 2 -spacing2 4 -spacing3 6 list [.t tag configure x -spacing1] [.t tag configure x -spacing2] \ [.t tag configure x -spacing3] } -cleanup { .t tag delete x } -result {{-spacing1 {} {} {} 2} {-spacing2 {} {} {} 4} {-spacing3 {} {} {} 6}} test textTag-5.18 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 2.0x } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "2.0x"} test textTag-5.19 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 lousy } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "lousy"} test textTag-5.20 {TkTextTagCmd - "configure" option} -body { .t tag delete x .t tag configure x -spacing1 4.2.3 } -cleanup { .t tag delete x } -returnCodes error -result {bad screen distance "4.2.3"} test textTag-5.21 {TkTextTagCmd - "configure" option} -body { .t configure -selectborderwidth 2 -selectforeground blue \ -selectbackground black .t tag configure sel -borderwidth 4 -foreground green -background yellow set x {} foreach i {-selectborderwidth -selectforeground -selectbackground} { lappend x [lindex [.t configure $i] 4] } return $x } -result {4 green yellow} test textTag-5.22 {TkTextTagCmd - "configure" option} -body { .t configure -selectborderwidth 20 .t tag configure sel -borderwidth {} .t cget -selectborderwidth } -result {} test textTag-5.23 {TkTextTagCmd - "configure" option} -body { set x {} # when [.t tag cget sel -selectbackground] == "", mirroring happens between |
︙ | ︙ | |||
851 852 853 854 855 856 857 | lappend x [.t tag cget sel -selectforeground] .t configure -selectforeground black .t tag configure sel -selectforeground white lappend x [.t cget -selectforeground] return $x } -result {yellow blue red white} | | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | < < | | | | | > | | > > > > > > > > | | | | | > | | 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 | lappend x [.t tag cget sel -selectforeground] .t configure -selectforeground black .t tag configure sel -selectforeground white lappend x [.t cget -selectforeground] return $x } -result {yellow blue red white} test textTag-6.1 {TkTextTagCmd - "delete" option} -body { .t tag delete } -returnCodes error -result {wrong # args: should be ".t tag delete tagName ?tagName ...?"} test textTag-6.2 {TkTextTagCmd - "delete" option} -body { .t tag delete zork } -returnCodes ok -result {} test textTag-6.3 {TkTextTagCmd - "delete" option} -setup { .t tag delete {*}[.t tag names] } -body { .t tag config x -background black .t tag config y -foreground white .t tag config z -background black .t tag delete y z lsort [.t tag names] } -cleanup { .t tag delete x } -result {sel x} test textTag-6.4 {TkTextTagCmd - "delete" option} -setup { .t tag delete {*}[.t tag names] } -body { .t tag config x -background black .t tag config y -foreground white .t tag config z -background black eval .t tag delete [.t tag names] .t tag names } -result {sel} test textTag-6.5 {TkTextTagCmd - "delete" option} -body { .t tag bind x <Enter> foo .t tag delete x .t tag configure x -background black .t tag bind x } -cleanup { .t tag delete x } -result {} test textTag-7.1 {TkTextTagCmd - "lower" option} -body { .t tag lower } -returnCodes error -result {wrong # args: should be ".t tag lower tagName ?belowThis?"} test textTag-7.2 {TkTextTagCmd - "lower" option} -body { .t tag lower foo } -returnCodes error -result {tag "foo" isn't defined in text widget} test textTag-7.3 {TkTextTagCmd - "lower" option} -body { .t tag lower sel bar } -returnCodes error -result {tag "bar" isn't defined in text widget} test textTag-7.4 {TkTextTagCmd - "lower" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag lower c .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {c sel a b d} test textTag-7.5 {TkTextTagCmd - "lower" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag lower d b .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel a d b c} test textTag-7.6 {TkTextTagCmd - "lower" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag lower a c .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel b a c d} test textTag-8.1 {TkTextTagCmd - "names" option} -body { .t tag names a b } -cleanup { .t tag delete {*}[.t tag names] } -returnCodes error -result {wrong # args: should be ".t tag names ?index?"} test textTag-8.2 {TkTextTagCmd - "names" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel a b c d} test textTag-8.3 {TkTextTagCmd - "names" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag add "a b" 2.1 2.6 .t tag add c 2.4 2.7 .t tag names 2.5 } -cleanup { .t tag delete {*}[.t tag names] } -result {c {a b}} test textTag-9.1 {TkTextTagCmd - "nextrange" option} -body { .t tag nextrange x } -returnCodes error -result {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"} test textTag-9.2 {TkTextTagCmd - "nextrange" option} -body { .t tag nextrange x 1 2 3 } -returnCodes error -result {wrong # args: should be ".t tag nextrange tagName index1 ?index2?"} test textTag-9.3 {TkTextTagCmd - "nextrange" option} -body { .t tag nextrange foo 1.0 } -returnCodes ok -result {} test textTag-9.4 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag nextrange x foo } -cleanup { .t tag delete x } -returnCodes error -result {bad text index "foo"} test textTag-9.5 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 1.0 bar } -cleanup { .t tag delete x } -returnCodes error -result {bad text index "bar"} test textTag-9.6 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 1.0 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-9.7 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.2 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-9.8 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.3 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-9.9 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.4 } -cleanup { .t tag delete x } -result {2.9 3.1} test textTag-9.10 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.4 2.9 } -cleanup { .t tag delete x } -result {} test textTag-9.11 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.4 2.10 } -cleanup { .t tag delete x } -result {2.9 3.1} test textTag-9.12 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 2.4 2.11 } -cleanup { .t tag delete x } -result {2.9 3.1} test textTag-9.13 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 7.0 } -cleanup { .t tag delete x } -result {7.2 7.3} test textTag-9.14 {TkTextTagCmd - "nextrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag nextrange x 7.3 } -cleanup { .t tag delete x } -result {} test textTag-10.1 {TkTextTagCmd - "prevrange" option} -body { .t tag prevrange x } -returnCodes error -result {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"} test textTag-10.2 {TkTextTagCmd - "prevrange" option} -body { .t tag prevrange x 1 2 3 } -returnCodes error -result {wrong # args: should be ".t tag prevrange tagName index1 ?index2?"} test textTag-10.3 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag prevrange foo end } -cleanup { .t tag delete x } -returnCodes ok -result {} test textTag-10.4 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x foo } -cleanup { .t tag delete x } -returnCodes error -result {bad text index "foo"} test textTag-10.5 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x end bar } -cleanup { .t tag delete x } -returnCodes error -result {bad text index "bar"} test textTag-10.6 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x end } -cleanup { .t tag delete x } -result {7.2 7.3} test textTag-10.7 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.4 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-10.8 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.5 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-10.9 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.9 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-10.10 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.9 2.6 } -cleanup { .t tag delete x } -result {} test textTag-10.11 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.9 2.5 } -cleanup { .t tag delete x } -result {} test textTag-10.12 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.9 2.3 } -cleanup { .t tag delete x } -result {2.3 2.5} test textTag-10.13 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 7.0 } -cleanup { .t tag delete x } -result {2.9 3.1} test textTag-10.14 {TkTextTagCmd - "prevrange" option} -setup { .t tag delete x } -body { .t tag add x 2.3 2.5 .t tag add x 2.9 3.1 .t tag add x 7.2 .t tag prevrange x 2.3 } -cleanup { .t tag delete x } -result {} test textTag-11.1 {TkTextTagCmd - "raise" option} -body { .t tag raise } -returnCodes error -result {wrong # args: should be ".t tag raise tagName ?aboveThis?"} test textTag-11.2 {TkTextTagCmd - "raise" option} -body { .t tag raise foo } -returnCodes error -result {tag "foo" isn't defined in text widget} test textTag-11.3 {TkTextTagCmd - "raise" option} -body { .t tag raise sel bar } -returnCodes error -result {tag "bar" isn't defined in text widget} test textTag-11.4 {TkTextTagCmd - "raise" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag raise c .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel a b d c} test textTag-11.5 {TkTextTagCmd - "raise" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag raise d b .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel a b d c} test textTag-11.6 {TkTextTagCmd - "raise" option} -setup { .t tag delete {*}[.t tag names] .t tag remove sel 1.0 end foreach i {a b c d} { .t tag configure $i -background black } } -body { .t tag raise a c .t tag names } -cleanup { .t tag delete {*}[.t tag names] } -result {sel b c a d} test textTag-12.1 {TkTextTagCmd - "ranges" option} -body { .t tag ranges } -returnCodes error -result {wrong # args: should be ".t tag ranges tagName"} test textTag-12.2 {TkTextTagCmd - "ranges" option} -body { .t tag delete x .t tag ranges x } -result {} test textTag-12.3 {TkTextTagCmd - "ranges" option} -setup { .t tag delete x } -body { .t tag add x 2.2 .t tag add x 2.7 4.15 .t tag add x 5.2 5.5 .t tag ranges x } -cleanup { .t tag delete x } -result {2.2 2.3 2.7 4.6 5.2 5.5} test textTag-12.4 {TkTextTagCmd - "ranges" option} -setup { .t tag delete x } -body { .t tag add x 1.0 3.0 .t tag add x 4.0 end .t tag ranges x } -cleanup { .t tag delete x } -result {1.0 3.0 4.0 8.0} test textTag-13.1 {TkTextTagCmd - "remove" option} -body { .t tag remove } -returnCodes error -result {wrong # args: should be ".t tag remove tagName index1 ?index2 index1 index2 ...?"} test textTag-13.2 {TkTextTagCmd - "remove" option} -setup { .t tag delete x } -body { .t tag add x 2.2 2.11 .t tag remove x 2.3 2.7 .t tag ranges x } -cleanup { .t tag delete x } -result {2.2 2.3 2.7 2.11} test textTag-13.3 {TkTextTagCmd - "remove" option} -setup { destroy .t.e } -body { entry .t.e .t.e insert 0 "Text" .t configure -exportselection 1 .t tag remove sel 1.0 end .t tag add sel 2.4 3.3 .t.e select to 4 .t tag remove sel 2.7 3.1 selection get } -cleanup { destroy .t.e } -result {Text} test textTag-14.1 {SortTags} -setup { .t tag delete a b c d } -body { foreach i {a b c d} { .t tag add $i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete a b c d } -result {a b c d} .t tag delete a b c d test textTag-14.2 {SortTags} -setup { .t tag delete a b c d } -body { foreach i {a b c d} { .t tag configure $i -background black } foreach i {d c b a} { .t tag add $i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete a b c d } -result {a b c d} test textTag-14.3 {SortTags} -setup { .t tag delete {*}[.t tag names] } -body { for {set i 0} {$i < 30} {incr i} { .t tag add x$i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete {*}[.t tag names] } -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29} test textTag-14.4 {SortTags} -setup { .t tag delete {*}[.t tag names] } -body { for {set i 0} {$i < 30} {incr i} { .t tag configure x$i -background black } for {set i 29} {$i >= 0} {incr i -1} { .t tag add x$i 2.0 2.2 } .t tag names 2.1 } -cleanup { .t tag delete {*}[.t tag names] } -result {x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26 x27 x28 x29} set curFont [.t cget -font] set curWrap [.t cget -wrap] set c [.t bbox 2.1] set x1 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y1 [expr {[lindex $c 1] + [lindex $c 3]/2}] set c [.t bbox 3.2] set x2 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y2 [expr {[lindex $c 1] + [lindex $c 3]/2}] set c [.t bbox 4.3] set x3 [expr {[lindex $c 0] + [lindex $c 2]/2}] set y3 [expr {[lindex $c 1] + [lindex $c 3]/2}] .t configure -font $textWidgetFont -wrap none update set c [.t bbox 2.1] set x4 [expr [lindex $c 0] + [lindex $c 2]/2] set y4 [expr [lindex $c 1] + [lindex $c 3]/2] set c [.t bbox 3.2] set x5 [expr [lindex $c 0] + [lindex $c 2]/2] set y5 [expr [lindex $c 1] + [lindex $c 3]/2] .t configure -font $curFont -wrap $curWrap test textTag-15.1 {TkTextBindProc} -setup { .t tag delete x y event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { bind .t <ButtonRelease> {lappend x up} .t tag bind x <ButtonRelease> {lappend x x-up} .t tag bind y <ButtonRelease> {lappend x y-up} set x {} |
︙ | ︙ | |||
1507 1508 1509 1510 1511 1512 1513 | event gen .t <ButtonRelease> -x $x3 -y $y3 return $x } -cleanup { .t tag delete x y bind .t <ButtonRelease> {} } -result {x-up up up y-up up} | | | 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | event gen .t <ButtonRelease> -x $x3 -y $y3 return $x } -cleanup { .t tag delete x y bind .t <ButtonRelease> {} } -result {x-up up up y-up up} test textTag-15.2 {TkTextBindProc} -setup { .t tag delete x y event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { .t tag bind x <Enter> {lappend x x-enter} .t tag bind x <ButtonPress> {lappend x x-down} .t tag bind x <ButtonRelease> {lappend x x-up} .t tag bind x <Leave> {lappend x x-leave} |
︙ | ︙ | |||
1535 1536 1537 1538 1539 1540 1541 | lappend x | event gen .t <ButtonRelease> -x $x3 -y $y3 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | x-up x-leave y-enter} | | | 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | lappend x | event gen .t <ButtonRelease> -x $x3 -y $y3 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | x-up x-leave y-enter} test textTag-15.3 {TkTextBindProc} -setup { .t tag delete x y event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { .t tag bind x <Enter> {lappend x x-enter} .t tag bind x <Any-ButtonPress-1> {lappend x x-down} .t tag bind x <Any-ButtonRelease-1> {lappend x x-up} .t tag bind x <Leave> {lappend x x-leave} |
︙ | ︙ | |||
1568 1569 1570 1571 1572 1573 1574 | event gen .t <ButtonRelease-2> -x $x3 -y $y3 -state 0x200 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | | x-up | x-leave y-enter} | | < < | > | | > | < < | 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 | event gen .t <ButtonRelease-2> -x $x3 -y $y3 -state 0x200 return $x } -cleanup { .t tag delete x y } -result {x-enter | x-down | | | x-up | x-leave y-enter} test textTag-16.1 {TkTextPickCurrent procedure} -setup { .t tag delete {*}[.t tag names] event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { event gen .t <ButtonRelease-1> -state 0x100 -x $x1 -y $y1 set x [.t index current] event gen .t <Motion> -x $x2 -y $y2 lappend x [.t index current] event gen .t <Button-1> -x $x2 -y $y2 lappend x [.t index current] event gen .t <Motion> -x $x3 -y $y3 -state 0x100 lappend x [.t index current] event gen .t <Button-3> -state 0x100 -x $x3 -y $y3 lappend x [.t index current] event gen .t <ButtonRelease-3> -state 0x300 -x $x3 -y $y3 lappend x [.t index current] event gen .t <ButtonRelease-1> -state 0x100 -x $x3 -y $y3 lappend x [.t index current] } -result {2.1 3.2 3.2 3.2 3.2 3.2 4.3} test textTag-16.2 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { .t tag delete {*}[.t tag names] event generate {} <Motion> -warp 1 -x -1 -y -1; update .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont event gen .t <ButtonRelease-1> -state 0x100 -x $x4 -y $y4 event gen .t <Motion> -x $x5 -y $y5 set x [.t index current] .t tag add big 3.0 update lappend x [.t index current] } -cleanup { .t tag delete big .t configure -font $curFont -wrap $curWrap } -result {3.2 3.1} test textTag-16.3 {TkTextPickCurrent procedure} -setup { foreach i {a b c d} { .t tag remove $i 1.0 end } event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { foreach i {a b c d} { .t tag bind $i <Enter> "lappend x enter-$i" |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | lappend x | event gen .t <Motion> -x $x3 -y $y3 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b | leave-b enter-c | leave-a leave-c} | | < < | 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 | lappend x | event gen .t <Motion> -x $x3 -y $y3 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b | leave-b enter-c | leave-a leave-c} test textTag-16.4 {TkTextPickCurrent procedure} -setup { foreach i {a b c d} { .t tag remove $i 1.0 end } event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { foreach i {a b c d} { .t tag bind $i <Enter> "lappend x enter-$i" |
︙ | ︙ | |||
1665 1666 1667 1668 1669 1670 1671 | event gen .t <Motion> -x $x2 -y $y2 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b enter-c | leave-c leave-b} test textTag-16.5 {TkTextPickCurrent procedure} -constraints { | | > | | > | > | | > | > | | > | 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 | event gen .t <Motion> -x $x2 -y $y2 return $x } -cleanup { .t tag delete {*}[.t tag names] } -result {enter-a enter-b enter-c | leave-c leave-b} test textTag-16.5 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } event generate {} <Motion> -warp 1 -x -1 -y -1; update .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x4 -y $y4 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x5 -y $y5 .t index current } -cleanup { .t tag delete a big .t configure -font $curFont -wrap $curWrap } -result {3.2} test textTag-16.6 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } event generate {} <Motion> -warp 1 -x -1 -y -1; update .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont event gen .t <Motion> -x $x4 -y $y4 .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x5 -y $y5 update .t index current } -cleanup { .t tag delete a big .t configure -font $curFont -wrap $curWrap } -result {3.1} test textTag-16.7 {TkTextPickCurrent procedure} -constraints { haveFontSizes } -setup { foreach i {big a b c d} { .t tag remove $i 1.0 end } event generate {} <Motion> -warp 1 -x -1 -y -1; update .t configure -font $textWidgetFont -wrap none } -body { .t tag configure big -font $bigFont .t tag bind a <Enter> {.t tag add big 3.0 3.2} .t tag add a 3.2 event gen .t <Motion> -x $x4 -y $y4 .t tag bind a <Leave> {.t tag add big 3.0 3.2} .t tag add a 2.1 event gen .t <Motion> -x $x5 -y $y5 update .t index current } -cleanup { .t tag delete a big .t configure -font $curFont -wrap $curWrap } -result {3.1} test textTag-17.1 {insert procedure inserts tags} -setup { .t delete 1.0 end } -body { # Objectification of the text widget had a problem |
︙ | ︙ | |||
1743 1744 1745 1746 1747 1748 1749 | destroy .t event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { text .t -width 30 -height 4 -relief sunken -borderwidth 10 \ -highlightthickness 10 -pady 2 pack .t update ; # map the window, otherwise -warp can't be done | | | 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 | destroy .t event generate {} <Motion> -warp 1 -x -1 -y -1; update } -body { text .t -width 30 -height 4 -relief sunken -borderwidth 10 \ -highlightthickness 10 -pady 2 pack .t update ; # map the window, otherwise -warp can't be done .t insert end " Tag here " TAG " no tag here" .t tag configure TAG -borderwidth 4 -relief raised .t tag bind TAG <Enter> {lappend res "%x %y tag-Enter"} .t tag bind TAG <Leave> {lappend res "%x %y tag-Leave"} bind .t <Enter> {lappend res Enter} bind .t <Leave> {lappend res Leave} |
︙ | ︙ |
Changes to tests/textWind.test.
︙ | ︙ | |||
34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . set bw [.t cget -borderwidth] set px [.t cget -padx] set py [.t cget -pady] set hlth [.t cget -highlightthickness] set padx [expr {$bw+$px+$hlth}] set pady [expr {$bw+$py+$hlth}] | > > > > > | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | # The statements below reset the main window; it's needed if the window # manager is mwm to make mwm forget about a previous minimum size setting. wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . # This update is needed on MacOS to make sure that the window is mapped # when the tests begin. update set bw [.t cget -borderwidth] set px [.t cget -padx] set py [.t cget -pady] set hlth [.t cget -highlightthickness] set padx [expr {$bw+$px+$hlth}] set pady [expr {$bw+$py+$hlth}] |
︙ | ︙ |
Changes to tests/tk.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # This file is a Tcl script to test the tk command. # It is organized in the standard fashion for Tcl tests. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2002 ActiveState Corporation. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test test tk-1.1 {tk command: general} -body { tk } -returnCodes error -result {wrong # args: should be "tk subcommand ?arg ...?"} test tk-1.2 {tk command: general} -body { tk xyz } -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, scaling, useinputmethods, or windowingsystem} | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # This file is a Tcl script to test the tk command. # It is organized in the standard fashion for Tcl tests. # # Copyright (c) 1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # Copyright (c) 2002 ActiveState Corporation. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test testConstraint testprintf [llength [info command testprintf]] test tk-1.1 {tk command: general} -body { tk } -returnCodes error -result {wrong # args: should be "tk subcommand ?arg ...?"} test tk-1.2 {tk command: general} -body { tk xyz } -returnCodes error -result {unknown or ambiguous subcommand "xyz": must be appname, busy, caret, fontchooser, inactive, scaling, useinputmethods, or windowingsystem} |
︙ | ︙ | |||
172 173 174 175 176 177 178 179 180 181 182 183 184 | # tk inactive in safe interpreters safe::interpCreate foo safe::loadTk foo foo eval {tk inactive reset} } -cleanup { ::safe::interpDelete foo } -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter} # tests of [tk busy] in busy.test # cleanup cleanupTests return | > > > > | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | # tk inactive in safe interpreters safe::interpCreate foo safe::loadTk foo foo eval {tk inactive reset} } -cleanup { ::safe::interpDelete foo } -returnCodes 1 -result {resetting the user inactivity timer is not allowed in a safe interpreter} test tk-8.1 {Test for ticket [1cc44617e2], see if TCL_LL_MODIFIER works as expected on all platforms} -constraints testprintf -body { testprintf -21474836480 } -result {-21474836480 18446744052234715136} # tests of [tk busy] in busy.test # cleanup cleanupTests return |
Changes to tests/ttk/combobox.test.
︙ | ︙ | |||
34 35 36 37 38 39 40 | } -result 2 test combobox-2.3 "current -- change value" -body { .cb set "b" .cb current } -result 1 | | > > > > > > > > > > > | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | } -result 2 test combobox-2.3 "current -- change value" -body { .cb set "b" .cb current } -result 1 test combobox-2.4 "current -- value not in list" -body { .cb set "z" .cb current } -result -1 test combobox-2.5 "current -- set to end index" -body { .cb configure -values [list a b c d e thelastone] .cb current end .cb get } -result thelastone test combobox-2.6 "current -- set to unknown index" -body { .cb configure -values [list a b c d e] .cb current notanindex } -returnCodes error -result {Incorrect index notanindex} test combobox-2.end "Cleanup" -body { destroy .cb } test combobox-3 "Read postoffset value dynamically from current style" -body { ttk::combobox .cb -values [list a b c] -style "DerivedStyle.TCombobox" pack .cb -expand true -fill both ttk::style configure DerivedStyle.TCombobox -postoffset [list 25 0 0 0] ttk::combobox::Post .cb expr {[winfo rootx .cb.popdown] - [winfo rootx .cb]} } -result 25 -cleanup { destroy .cb } |
︙ | ︙ |
Changes to tests/ttk/entry.test.
︙ | ︙ | |||
99 100 101 102 103 104 105 | .e delete 0 end .e bbox 0 } -result [list $bd $bd 0 $ch] test entry-3.2 "xview" -body { .e delete 0 end; .e insert end [string repeat "0" 40] | > > | > > > > | | > > > > > > > > > > > > > > > > > > > > > | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | .e delete 0 end .e bbox 0 } -result [list $bd $bd 0 $ch] test entry-3.2 "xview" -body { .e delete 0 end; .e insert end [string repeat "0" 40] set result [.e xview] } -result {0.0 0.5} test entry-3.3 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview end set result [.e index @0] } -result {7} test entry-3.4 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview moveto 1.0 set result [.e index @0] } -result {7} test entry-3.5 "xview" -body { .e delete 0 end; .e insert end abcdefghijklmnopqrstuvwxyz .e xview scroll 5 units set result [.e index @0] } -result {5} test entry-3.6 "xview" -body { .e delete 0 end; .e insert end [string repeat abcdefghijklmnopqrstuvwxyz 5] .e xview scroll 2 pages set result [.e index @0] } -result {40} test entry-3.last "Series 3 cleanup" -body { destroy .e } # Selection tests: |
︙ | ︙ | |||
275 276 277 278 279 280 281 282 283 | .e insert insert d ; lappend result [.e index insert] [.e index end] .e insert insert e ; lappend result [.e index insert] [.e index end] set result } -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup { unset V destroy .e } tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | .e insert insert d ; lappend result [.e index insert] [.e index end] .e insert insert e ; lappend result [.e index insert] [.e index end] set result } -result [list 1 3 2 3 3 3 3 3 3 3] -cleanup { unset V destroy .e } test entry-10.1 {configuration option: "-placeholder"} -setup { pack [ttk::entry .e] } -body { .e configure -placeholder {Some text} .e cget -placeholder } -cleanup { destroy .e } -result {Some text} test entry-10.2 {configuration option: "-placeholderforeground"} -setup { pack [ttk::entry .e] } -body { .e configure -placeholder {Some text} -placeholderforeground red .e cget -placeholderforeground } -cleanup { destroy .e } -result {red} tcltest::cleanupTests |
Changes to tests/ttk/image.test.
︙ | ︙ | |||
19 20 21 22 23 24 25 | pack [set w [ttk::label .ttk_image20 -image test.image]] tkwait visibility $w image delete test.image update } -cleanup { destroy .ttk_image20 } -result {} | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | pack [set w [ttk::label .ttk_image20 -image test.image]] tkwait visibility $w image delete test.image update } -cleanup { destroy .ttk_image20 } -result {} test image-2.1 "Deletion of displayed image (checkbutton)" -setup { image create photo test.image -width 10 -height 10 } -body { pack [set w [ttk::checkbutton .ttk_image21 -image test.image]] tkwait visibility $w image delete test.image update |
︙ | ︙ |
Changes to tests/ttk/labelframe.test.
︙ | ︙ | |||
66 67 68 69 70 71 72 | # Re-run series labelframe-3.x with nonchild slaves. # # @@@ ODDITY, 14 Nov 2005: # @@@ labelframe-4.1 fails if .cb is a [checkbutton], # @@@ but seems to succeed if it's some other widget class. # @@@ I suspect a race condition; unable to track it down ATM. # | | | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | # Re-run series labelframe-3.x with nonchild slaves. # # @@@ ODDITY, 14 Nov 2005: # @@@ labelframe-4.1 fails if .cb is a [checkbutton], # @@@ but seems to succeed if it's some other widget class. # @@@ I suspect a race condition; unable to track it down ATM. # # @@@ FOLLOWUP: This *may* have been caused by a bug in ManagerIdleProc # @@@ (see manager.c r1.11). There's still probably a race condition in here. # test labelframe-4.1 "Add nonchild slave" -body { checkbutton .cb -text "abcde" .lf configure -labelwidget .cb update list [winfo ismapped .cb] [winfo viewable .cb] [winfo manager .cb] |
︙ | ︙ |
Changes to tests/ttk/panedwindow.test.
︙ | ︙ | |||
106 107 108 109 110 111 112 | test panedwindow-2.end "Cleanup" -body { destroy .pw } # # ... # test panedwindow-3.0 "configure pane" -body { ttk::panedwindow .pw | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | test panedwindow-2.end "Cleanup" -body { destroy .pw } # # ... # test panedwindow-3.0 "configure pane" -body { ttk::panedwindow .pw .pw add [listbox .pw.lb1] .pw add [listbox .pw.lb2] .pw pane 1 -weight 2 .pw pane 1 -weight } -result 2 test panedwindow-3.1 "configure pane -- errors" -body { .pw pane 1 -weight -4 } -returnCodes 1 -match glob -result "-weight must be nonnegative" |
︙ | ︙ | |||
249 250 251 252 253 254 255 | wm geometry . {} ttk::panedwindow .pw -orient vertical frame .pw.f1 -width 100 -height 50 frame .pw.f2 -width 100 -height 50 list [winfo reqwidth .pw.f1] [winfo reqheight .pw.f1] | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | wm geometry . {} ttk::panedwindow .pw -orient vertical frame .pw.f1 -width 100 -height 50 frame .pw.f2 -width 100 -height 50 list [winfo reqwidth .pw.f1] [winfo reqheight .pw.f1] } -result [list 100 50] test paned-propagation-1 "Initial request size" -body { .pw add .pw.f1 .pw add .pw.f2 propagate-geometry list [winfo reqwidth .pw] [winfo reqheight .pw] } -result [list 100 105] |
︙ | ︙ |
Changes to tests/ttk/progressbar.test.
︙ | ︙ | |||
78 79 80 81 82 83 84 85 | set PB ;# NOTREACHED } -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!" test progressbar-end "Cleanup" -body { destroy .pb } tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | set PB ;# NOTREACHED } -cleanup { unset PB } -returnCodes 1 -match glob -result "*YIPES!" test progressbar-end "Cleanup" -body { destroy .pb } # check existence and default value of each non-core option of the widget test progressbar-3.1 "progressbar non-core options" -setup { set res {} ttk::progressbar .defaultpb } -body { foreach option {-anchor -foreground -justify -style -text -wraplength \ -length -maximum -mode -orient -phase -value -variable} { lappend res [.defaultpb cget $option] } set res } -cleanup { unset res destroy .defaultpb } -result {w black left {} {} 0 100 100 determinate horizontal 0 0.0 {}} test progressbar-3.2 "TIP #442 options are taken into account" -setup { set res {} pack [ttk::progressbar .p -value 0 -maximum 50 -orient horizontal -mode determinate -length 500] set thefont [font actual {Arial 10}] } -body { .p configure -anchor c -foreground blue -justify right \ -text "TIP #442\noptions are now tested" -wraplength 100 update .p step 10 .p configure -anchor e -font $thefont -foreground green -justify center \ -text "Changing the value of each option\nfrom TIP #442" -wraplength 250 update .p step 20 .p configure -orient vertical -text "Cannot be seen" update foreach option {-anchor -foreground -justify -text -wraplength} { lappend res [list $option [.p cget $option]] } set res } -cleanup { unset res thefont destroy .p } -result {{-anchor e} {-foreground green} {-justify center} {-text {Cannot be seen}} {-wraplength 250}} tcltest::cleanupTests |
Changes to tests/ttk/scrollbar.test.
1 2 3 4 5 6 | package require Tk 8.5 package require tcltest ; namespace import -force tcltest::* loadTestedCommands testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] | > > > > > > > > | > | | | | > | | | > > > | > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | package require Tk 8.5 package require tcltest ; namespace import -force tcltest::* loadTestedCommands testConstraint coreScrollbar [expr {[tk windowingsystem] eq "aqua"}] # Before 2019 the code in library/ttk/scrollbar.tcl would replace the # constructor of ttk::scrollbar with the constructor of tk::scrollbar # unless the -class or -style options were specified.. # Now there is an implementation of ttk::scrollbar for macOS. The # tests are left in place, though, except that scrollbar-swapout-1 # test was changed to expect the class to be TScrollbar instead of # Scrollbar. test scrollbar-swapout-1 "Don't use core scrollbars on OSX..." \ -constraints { coreScrollbar } -body { ttk::scrollbar .sb -command "yadda" list [winfo class .sb] [.sb cget -command] } -result [list TScrollbar yadda] -cleanup { destroy .sb } test scrollbar-swapout-2 "... regardless of whether -style ..." \ -constraints { coreScrollbar } -body { ttk::style layout Vertical.Custom.TScrollbar \ [ttk::style layout Vertical.TScrollbar] ; # See #1833339 ttk::scrollbar .sb -command "yadda" -style Custom.TScrollbar list [winfo class .sb] [.sb cget -command] [.sb cget -style] } -result [list TScrollbar yadda Custom.TScrollbar] -cleanup { destroy .sb } test scrollbar-swapout-3 "... or -class is specified." -constraints { coreScrollbar } -body { ttk::scrollbar .sb -command "yadda" -class Custom.TScrollbar list [winfo class .sb] [.sb cget -command] } -result [list Custom.TScrollbar yadda] -cleanup { destroy .sb } test scrollbar-1.0 "Setup" -body { ttk::scrollbar .tsb } -result .tsb test scrollbar-1.1 "Set method" -body { .tsb set 0.2 0.4 .tsb get } -result [list 0.2 0.4] test scrollbar-1.2 "Set orientation" -body { .tsb configure -orient vertical pack .tsb -side right -anchor e -expand 1 -fill y wm geometry . 200x200 update set w [winfo width .tsb] ; set h [winfo height .tsb] expr {$h > $w} } -result 1 test scrollbar-1.3 "Change orientation" -body { .tsb configure -orient horizontal pack .tsb -side bottom -anchor s -expand 1 -fill x wm geometry . 200x200 update set w [winfo width .tsb] ; set h [winfo height .tsb] expr {$h < $w} } -result 1 # # Scale tests: # |
︙ | ︙ |
Changes to tests/ttk/spinbox.test.
︙ | ︙ | |||
249 250 251 252 253 254 255 | } -cleanup { unset SBV destroy .sb } -result [list 55 55] test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body { set SBV Apr | | | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | } -cleanup { unset SBV destroy .sb } -result [list 55 55] test spinbox-nostomp-4 "don't stomp on -variable (configure; -values)" -body { set SBV Apr ttk::spinbox .sb .sb configure -textvariable SBV -values {Jan Feb Mar Apr May Jun Jul Aug} list $SBV [.sb get] } -cleanup { unset SBV destroy .sb } -result [list Apr Apr] |
︙ | ︙ | |||
274 275 276 277 278 279 280 | event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs set result | | | 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs event generate .sb <<Decrement>>; lappend result $secs set result } -result [list 07 08 09 10 11 10 09 08 07] -cleanup { destroy .sb unset secs } test spinbox-dieoctaldie-2 "Cope with general bad input" -body { set result [list] ttk::spinbox .sb -from 0 -to 100 -format %03.0f |
︙ | ︙ |
Changes to tests/ttk/treetags.test.
︙ | ︙ | |||
101 102 103 104 105 106 107 | } -result [list [list] [list item2] [list]] test treetags-1.8 "tag names" -body { lsort [$tv tag names] } -result [list tag1 tag2 tag3] test treetags-1.9 "tag names - tag added to item" -body { | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | } -result [list [list] [list item2] [list]] test treetags-1.8 "tag names" -body { lsort [$tv tag names] } -result [list tag1 tag2 tag3] test treetags-1.9 "tag names - tag added to item" -body { $tv item item1 -tags tag4 lsort [$tv tag names] } -result [list tag1 tag2 tag3 tag4] test treetags-1.10 "tag names - tag configured" -body { $tv tag configure tag5 lsort [$tv tag names] } -result [list tag1 tag2 tag3 tag4 tag5] |
︙ | ︙ | |||
197 198 199 200 201 202 203 | $tv tag configure tag2 -font {times 20} } test treetags-3.4 "stomp tags in tag binding procedure" -body { set result [list] $tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> } $tv tag bind rm2 <<Remove>> { | | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | $tv tag configure tag2 -font {times 20} } test treetags-3.4 "stomp tags in tag binding procedure" -body { set result [list] $tv tag bind rm1 <<Remove>> { lappend ::result rm1 [%W focus] <<Remove>> } $tv tag bind rm2 <<Remove>> { lappend ::result rm2 [%W focus] <<Remove>> %W item [%W focus] -tags {tag1} } $tv tag bind rm3 <<Remove>> { lappend ::result rm3 [%W focus] <<Remove>> } $tv item item1 -tags {rm1 rm2 rm3} $tv focus item1 event generate $tv <<Remove>> set result } -cleanup { treeConstraints $tv } -result [list rm1 item1 <<Remove>> rm2 item1 <<Remove>> rm3 item1 <<Remove>>] # test treetags-end "Cleanup" -body { destroy $tv } tcltest::cleanupTests |
Changes to tests/ttk/treeview.test.
︙ | ︙ | |||
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | .tv selection set {} .tv selection } -result {} test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo } -returnCodes 1 -match glob -result {bad selection operation "badop": must be *} ### NEED: more tests for see/yview/scrolling proc scrollcallback {args} { set ::scrolldata $args } test treeview-9.0 "scroll callback - empty tree" -body { .tv configure -yscrollcommand scrollcallback .tv delete [.tv children {}] update set ::scrolldata } -result [list 0.0 1.0] ### identify tests: # proc identify* {tv comps args} { foreach {x y} $args { foreach comp $comps { lappend result [$tv identify $comp $x $y] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 | .tv selection set {} .tv selection } -result {} test treeview-8.5 "Selection - bad operation" -body { .tv selection badop foo } -returnCodes 1 -match glob -result {bad selection operation "badop": must be *} test treeview-8.6 "Selection - <<TreeviewSelect>> on selection add" -body { .tv selection set {} bind .tv <<TreeviewSelect>> {set res 1} set res 0 .tv selection add newnode.n1 update set res } -result {1} test treeview-8.7 "<<TreeviewSelect>> on selected item deletion" -body { .tv selection set {} .tv insert "" end -id selectedDoomed -text DeadItem .tv insert "" end -id doomed -text AlsoDead .tv selection add selectedDoomed update bind .tv <<TreeviewSelect>> {lappend res 1} set res 0 .tv delete doomed update set res [expr {$res == 0}] .tv delete selectedDoomed update set res } -result {1 1} ### NEED: more tests for see/yview/scrolling proc scrollcallback {args} { set ::scrolldata $args } test treeview-9.0 "scroll callback - empty tree" -body { .tv configure -yscrollcommand scrollcallback .tv delete [.tv children {}] update set ::scrolldata } -result [list 0.0 1.0] test treeview-9.1 "scrolling" -setup { pack [ttk::treeview .tree -show tree] -fill y for {set i 1} {$i < 100} {incr i} { .tree insert {} end -text $i } } -body { .tree yview scroll 5 units .tree identify item 2 2 } -cleanup { destroy .tree } -result {I006} ### identify tests: # proc identify* {tv comps args} { foreach {x y} $args { foreach comp $comps { lappend result [$tv identify $comp $x $y] |
︙ | ︙ | |||
631 632 633 634 635 636 637 638 639 | } -body { set item [.tv insert {} end] .tv tag remove foo $item .tv item $item -tags } -cleanup { destroy .tv } -result [list] tcltest::cleanupTests | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | } -body { set item [.tv insert {} end] .tv tag remove foo $item .tv item $item -tags } -cleanup { destroy .tv } -result [list] test treeview-368fa4561e "indicators cannot be clicked on leafs" -setup { pack [ttk::treeview .tv] .tv insert {} end -id foo -text "<-- (1) Click the blank space to my left" update } -body { foreach {x y w h} [.tv bbox foo #0] {} set res [.tv item foo -open] # using $h even for x computation is intentional here in order to simulate # a mouse click on the (invisible since we're on a leaf) indicator event generate .tv <ButtonPress-1> \ -x [expr {$x + $h / 2}] \ -y [expr {$y + $h / 2}] lappend res [.tv item foo -open] .tv insert foo end -text "sub" lappend res [.tv item foo -open] } -cleanup { destroy .tv } -result {0 0 0} test treeview-ce470f20fd-1 "dragging further than the right edge of the treeview is forbidden" -setup { pack [ttk::treeview .tv] .tv heading #0 -text "Drag my right edge -->" update } -body { set res [.tv column #0 -width] .tv drag #0 400 lappend res [expr {[.tv column #0 -width] > $res}] } -cleanup { destroy .tv } -result {200 0} proc nostretch {tv} { foreach col [$tv cget -columns] { $tv column $col -stretch 0 } $tv column #0 -stretch 0 update idletasks ; # redisplay $tv } test treeview-ce470f20fd-2 "changing -stretch resizes columns" -setup { pack [ttk::treeview .tv -columns {bar colA colB colC foo}] foreach col [.tv cget -columns] { .tv heading $col -text $col } nostretch .tv .tv column colA -width 50 ; .tv column colB -width 50 ; # slack created update idletasks ; # redisplay treeview } -body { # when no column is stretchable and one of them becomes stretchable # the stretchable column takes the slack and the widget is redisplayed # automatically at idle time set res [.tv column colA -width] .tv column colA -stretch 1 update idletasks ; # no slack anymore, widget redisplayed lappend res [expr {[.tv column colA -width] > $res}] } -cleanup { destroy .tv } -result {50 1} test treeview-ce470f20fd-3 "changing -stretch resizes columns" -setup { pack [ttk::treeview .tv -columns {bar colA colB colC foo}] foreach col [.tv cget -columns] { .tv heading $col -text $col } .tv configure -displaycolumns {colB colA colC} nostretch .tv .tv column colA -width 50 ; .tv column colB -width 50 ; # slack created update idletasks ; # redisplay treeview } -body { # only some columns are displayed (and in a different order than declared # in -columns), a displayed column becomes stretchable --> the stretchable # column expands set res [.tv column colA -width] .tv column colA -stretch 1 update idletasks ; # no slack anymore, widget redisplayed lappend res [expr {[.tv column colA -width] > $res}] } -cleanup { destroy .tv } -result {50 1} test treeview-ce470f20fd-4 "changing -stretch resizes columns" -setup { pack [ttk::treeview .tv -columns {bar colA colB colC foo}] foreach col [.tv cget -columns] { .tv heading $col -text $col } .tv configure -displaycolumns {colB colA colC} nostretch .tv .tv column colA -width 50 ; .tv column bar -width 60 ; # slack created update idletasks ; # redisplay treeview } -body { # only some columns are displayed (and in a different order than declared # in -columns), a non-displayed column becomes stretchable --> nothing # happens set origTreeWidth [winfo width .tv] set res [list [.tv column bar -width] [.tv column colA -width]] .tv column bar -stretch 1 update idletasks ; # no change, widget redisplayed lappend res [.tv column bar -width] [.tv column colA -width] # this column becomes visible --> widget resizes .tv configure -displaycolumns {bar colC colA colB} update idletasks ; # no slack anymore because the widget resizes (shrinks) lappend res [.tv column bar -width] [.tv column colA -width] \ [expr {[winfo width .tv] < $origTreeWidth}] } -cleanup { destroy .tv } -result {60 50 60 50 60 50 1} tcltest::cleanupTests |
Changes to tests/ttk/ttk.test.
︙ | ︙ | |||
130 131 132 133 134 135 136 | .t.b invoke list [winfo exists .t] [winfo exists .t.b] } -result [list 0 0] # # Basic tests. # | | | | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | .t.b invoke list [winfo exists .t] [winfo exists .t.b] } -result [list 0 0] # # Basic tests. # test ttk-1.1 "Create multiline button showing justified text" -body { pack [ttk::button .t -text "Hello\nWorld!!" -justify center] -expand true -fill both update } test ttk-1.2 "Check style" -body { .t cget -style } -result {} |
︙ | ︙ | |||
202 203 204 205 206 207 208 | set x } -result 1 test ttk-2.8 "bug 3223850: button state disabled during click" -setup { destroy .b set ttk28 {} pack [ttk::button .b -command {set ::ttk28 failed}] | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | set x } -result 1 test ttk-2.8 "bug 3223850: button state disabled during click" -setup { destroy .b set ttk28 {} pack [ttk::button .b -command {set ::ttk28 failed}] } -body { bind .b <ButtonPress-1> {after 0 {.b configure -state disabled}} after 1 {event generate .b <ButtonPress-1>} after 20 {event generate .b <ButtonRelease-1>} set aid [after 100 {set ::ttk28 [.b instate {disabled !pressed}]}] vwait ::ttk28 after cancel $aid set ttk28 |
︙ | ︙ | |||
265 266 267 268 269 270 271 | # (@@@ "-font" is a compatibility option now, so tests 4.1-4.3 # don't really test anything useful at the moment.) # test ttk-4.0 "Setup" -body { catch { destroy .t } pack [ttk::label .t -text "Button 1"] | | | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | # (@@@ "-font" is a compatibility option now, so tests 4.1-4.3 # don't really test anything useful at the moment.) # test ttk-4.0 "Setup" -body { catch { destroy .t } pack [ttk::label .t -text "Button 1"] testConstraint fontOption [expr {![catch { set prevFont [.t cget -font] }]}] ok } test ttk-4.1 "Change font" -constraints fontOption -body { .t configure -font "Helvetica 18 bold" } test ttk-4.2 "Check font" -constraints fontOption -body { |
︙ | ︙ |
Changes to tests/ttk/validate.test.
︙ | ︙ | |||
157 158 159 160 161 162 163 | test validate-1.18 {entry widget validation} -constraints coreEntry -body { .e configure -validate all set ::e nextdata list [.e cget -validate] $::vVals } -result {none {.e -1 -1 nextdata newdata {} all forced}} # DIFFERENCE: ttk::entry doesn't validate when setting linked -variable | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | test validate-1.18 {entry widget validation} -constraints coreEntry -body { .e configure -validate all set ::e nextdata list [.e cget -validate] $::vVals } -result {none {.e -1 -1 nextdata newdata {} all forced}} # DIFFERENCE: ttk::entry doesn't validate when setting linked -variable # DIFFERENCE: ttk::entry doesn't disable validation proc doval {W d i P s S v V} { set ::vVals [list $W $d $i $P $s $S $v $V] set ::e mydata return 1 } |
︙ | ︙ |
Changes to tests/unixButton.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 | eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test imageInit # Create entries in the option database to be sure that geometry options # like border width have predictable values. | | > > > > > > > > | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test imageInit # Create entries in the option database to be sure that geometry options # like border width have predictable values. option add *Label.borderWidth 2 option add *Label.highlightThickness 0 option add *Label.font {Helvetica -12 bold} option add *Button.borderWidth 2 option add *Button.highlightThickness 2 option add *Button.font {Helvetica -12 bold} option add *Checkbutton.borderWidth 2 option add *Checkbutton.highlightThickness 2 option add *Checkbutton.font {Helvetica -12 bold} option add *Radiobutton.borderWidth 2 option add *Radiobutton.highlightThickness 2 option add *Radiobutton.font {Helvetica -12 bold} proc bogusTrace args { error "trace aborted" } if {[tk windowingsystem] eq "aqua"} { set smallIndicator 20 set bigIndicator 20 set defaultBorder 10 } else { set smallIndicator 27 set bigIndicator 40 set defaultBorder 20 } test unixbutton-1.1 {TkpComputeButtonGeometry procedure} -constraints { unix testImageType } -setup { deleteWindows imageCleanup } -body { image create test image1 |
︙ | ︙ | |||
53 54 55 56 57 58 59 | list [winfo reqwidth .b1] [winfo reqheight .b1] \ [winfo reqwidth .b2] [winfo reqheight .b2] \ [winfo reqwidth .b3] [winfo reqheight .b3] \ [winfo reqwidth .b4] [winfo reqheight .b4] } -cleanup { deleteWindows image delete image1 | | > > > | | > > > | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | list [winfo reqwidth .b1] [winfo reqheight .b1] \ [winfo reqwidth .b2] [winfo reqheight .b2] \ [winfo reqwidth .b3] [winfo reqheight .b3] \ [winfo reqwidth .b4] [winfo reqheight .b4] } -cleanup { deleteWindows image delete image1 } -result [list 68 48 \ 74 54 \ [expr {72 + $bigIndicator}] 52 \ [expr {72 + $bigIndicator}] 52] test unixbutton-1.2 {TkpComputeButtonGeometry procedure} -constraints { unix } -setup { deleteWindows } -body { label .b1 -bitmap question -bd 3 -padx 0 -pady 2 button .b2 -bitmap question -bd 3 -padx 0 -pady 2 checkbutton .b3 -bitmap question -bd 3 -padx 1 -pady 1 radiobutton .b4 -bitmap question -bd 3 -padx 2 -pady 0 pack .b1 .b2 .b3 .b4 update list [winfo reqwidth .b1] [winfo reqheight .b1] \ [winfo reqwidth .b2] [winfo reqheight .b2] \ [winfo reqwidth .b3] [winfo reqheight .b3] \ [winfo reqwidth .b4] [winfo reqheight .b4] } -cleanup { deleteWindows } -result [list 23 33 \ 29 39 \ [expr {27 + $smallIndicator}] 37 \ [expr {27 + $smallIndicator}] 37] test unixbutton-1.3 {TkpComputeButtonGeometry procedure} -constraints { unix } -setup { deleteWindows } -body { label .b1 -bitmap question -bd 3 -highlightthickness 4 button .b2 -bitmap question -bd 3 -highlightthickness 0 checkbutton .b3 -bitmap question -bd 3 -highlightthickness 1 \ -indicatoron 0 |
︙ | ︙ | |||
174 175 176 177 178 179 180 | [winfo reqwidth .b2] [winfo reqheight .b2] \ [winfo reqwidth .b3] [winfo reqheight .b3] \ [winfo reqwidth .b4] [winfo reqheight .b4] } -cleanup { deleteWindows } -result {62 30 56 24 58 22 62 22} test unixbutton-1.9 {TkpComputeButtonGeometry procedure} -constraints { | | | | | | | | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | [winfo reqwidth .b2] [winfo reqheight .b2] \ [winfo reqwidth .b3] [winfo reqheight .b3] \ [winfo reqwidth .b4] [winfo reqheight .b4] } -cleanup { deleteWindows } -result {62 30 56 24 58 22 62 22} test unixbutton-1.9 {TkpComputeButtonGeometry procedure} -constraints { unix } -setup { deleteWindows } -body { button .b2 -bitmap question -default active list [winfo reqwidth .b2] [winfo reqheight .b2] } -cleanup { deleteWindows } -result [list [expr {17 + $defaultBorder}] [expr {27 + $defaultBorder}]] test unixbutton-1.10 {TkpComputeButtonGeometry procedure} -constraints { unix } -setup { deleteWindows } -body { button .b2 -bitmap question -default normal list [winfo reqwidth .b2] [winfo reqheight .b2] } -cleanup { deleteWindows } -result [list [expr {17 + $defaultBorder}] [expr {27 + $defaultBorder}]] test unixbutton-1.11 {TkpComputeButtonGeometry procedure} -constraints { unix } -setup { deleteWindows } -body { button .b2 -bitmap question -default disabled list [winfo reqwidth .b2] [winfo reqheight .b2] } -cleanup { deleteWindows } -result {27 37} test unixbutton-2.1 {disabled coloring check, bug 669595} -constraints { unix } -setup { deleteWindows catch {unset value} } -body { # this was just a visual bug, but at least this shows the visual set on 1 set off 0 |
︙ | ︙ |
Changes to tests/unixEmbed.test.
|
| | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # This file is a Tcl script to test out the procedures in the file # tkUnixEmbed.c. It is organized in the standard fashion for Tcl # tests. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 eval tcltest::configure $argv tcltest::loadTestedCommands namespace import -force tcltest::test namespace eval ::_test_tmp {} # ------------------------------------------------------------------------------ # Proc ::_test_tmp::testInterp # ------------------------------------------------------------------------------ # Command that creates an unsafe child interpreter and tries to load Tk. # This code is borrowed from safePrimarySelection.test # This is necessary for loading Tktest if the tests are done in the build # directory without installing Tk. In that case the usual auto_path loading # mechanism cannot work because the tk binary is not where pkgIndex.tcl says # it is. # ------------------------------------------------------------------------------ namespace eval ::_test_tmp { variable TkLoadCmd } foreach pkg [info loaded] { if {[lindex $pkg 1] eq "Tk"} { set ::_test_tmp::TkLoadCmd [list load {*}$pkg] break } } proc ::_test_tmp::testInterp {name} { variable TkLoadCmd interp create $name $name eval [list set argv [list -name $name]] catch {{*}$TkLoadCmd $name} } setupbg dobg {wm withdraw .} # eatColors -- # Creates a toplevel window and allocates enough colors in it to # use up all the slots in the colormap. |
︙ | ︙ | |||
51 52 53 54 55 56 57 | proc colorsFree {w {red 31} {green 245} {blue 192}} { set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]] expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \ && ([lindex $vals 2]/256 == $blue) } test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints { | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | proc colorsFree {w {red 31} {green 245} {blue 192}} { set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]] expr ([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) \ && ([lindex $vals 2]/256 == $blue) } test unixEmbed-1.1 {TkpUseWindow procedure, bad window identifier} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -use xyz } -returnCodes error -result {expected integer but got "xyz"} test unixEmbed-1.2 {TkpUseWindow procedure, bad window identifier} -constraints { unix } -setup { deleteWindows } -body { toplevel .t -use 47 } -returnCodes error -result {couldn't create child of window "47"} test unixEmbed-1.3 {TkpUseWindow procedure, inheriting colormap} -constraints { unix nonPortable |
︙ | ︙ | |||
93 94 95 96 97 98 99 | toplevel .x -use [winfo id .t] colorsFree .x } -cleanup { deleteWindows } -result {1} test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints { | | > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | toplevel .x -use [winfo id .t] colorsFree .x } -cleanup { deleteWindows } -result {1} test unixEmbed-1.5 {TkpUseWindow procedure, creating Container records} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 dobg "set w [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t -use $w list [testembed] [expr [lindex [lindex [testembed all] 0] 0] - $w] } } -cleanup { deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.5a {TkpUseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 slave alias w winfo id .f1 slave eval { destroy [winfo child .] toplevel .t -use [w] list [testembed] [expr {[lindex [lindex [testembed all] 0] 0] - [w]}] } } -cleanup { interp delete slave deleteWindows } -result {{{XXX {} {} .t}} 0} test unixEmbed-1.6 {TkpUseWindow procedure, creating Container records} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 dobg "set w1 [winfo id .f1]" dobg "set w2 [winfo id .f2]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 toplevel .t2 -use $w2 testembed } } -cleanup { deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.6a {TkpUseWindow procedure, creating Container records} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -container 1 -width 200 -height 50 pack .f1 .f2 slave alias w1 winfo id .f1 slave alias w2 winfo id .f2 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] toplevel .t2 -use [w2] testembed } } -cleanup { interp delete slave deleteWindows } -result {{XXX {} {} .t2} {XXX {} {} .t1}} test unixEmbed-1.7 {TkpUseWindow procedure, container and embedded in same app} -constraints { unix testembed } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 |
︙ | ︙ | |||
148 149 150 151 152 153 154 | } -result {{XXX .f2 {} .t2} {XXX .f1 {} .t1}} # Can't think of any way to test the procedures TkpMakeWindow, # TkpMakeContainer, or EmbedErrorProc. test unixEmbed-2.1 {EmbeddedEventProc procedure} -constraints { | | > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | | < > < | | > > > > > > > > > > > > > > > > > > > > > | > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | } -result {{XXX .f2 {} .t2} {XXX .f1 {} .t1}} # Can't think of any way to test the procedures TkpMakeWindow, # TkpMakeContainer, or EmbedErrorProc. test unixEmbed-2.1 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 testembed } destroy .f1 update dobg { testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.1a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] testembed } destroy .f1 update slave eval { testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.2 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 testembed destroy .t1 testembed } } -cleanup { deleteWindows } -result {} test unixEmbed-2.2a {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] testembed destroy .t1 testembed } } -cleanup { interp delete slave deleteWindows } -result {} test unixEmbed-2.3 {EmbeddedEventProc procedure} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 toplevel .t1 -use [winfo id .f1] update destroy .f1 testembed } -result {} test unixEmbed-2.4 {EmbeddedEventProc procedure} -constraints { unix testembed } -setup { deleteWindows } -body { pack [frame .f1 -container 1 -width 200 -height 50] toplevel .t1 -use [winfo id .f1] set x [testembed] update destroy .t1 update list $x [winfo exists .t1] [winfo exists .f1] [testembed] } -cleanup { deleteWindows } -result "{{XXX .f1 {} .t1}} 0 0 {}" test unixEmbed-3.1 {ContainerEventProc procedure, detect creation} -constraints { unix testembed nonPortable } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" set x [testembed] dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 wm withdraw .t1 } list $x [testembed] } -cleanup { deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 XXX {}}}} test unixEmbed-3.1a {ContainerEventProc procedure, detect creation} -constraints { unix testembed } -setup { catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 set x [testembed] slave eval { destroy [winfo child .] toplevel .t1 -use [w1] wm withdraw .t1 } list $x [testembed] } -cleanup { interp delete slave deleteWindows } -result {{{XXX .f1 {} {}}} {{XXX .f1 {} {}}}} test unixEmbed-3.2 {ContainerEventProc procedure, set size on creation} -constraints { unix } -setup { deleteWindows update } -body { toplevel .t1 -container 1 wm geometry .t1 +0+0 toplevel .t2 -use [winfo id .t1] -bg red update wm geometry .t2 } -cleanup { deleteWindows } -result {200x200+0+0} test unixEmbed-3.3 {ContainerEventProc procedure, disallow position changes} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 -bd 2 -relief raised update wm geometry .t1 +30+40 } update dobg { wm geometry .t1 } } -cleanup { deleteWindows } -result {200x200+0+0} test unixEmbed-3.3a {ContainerEventProc procedure, disallow position changes} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] -bd 2 -relief raised update wm geometry .t1 +30+40 update wm geometry .t1 } } -cleanup { interp delete slave deleteWindows } -result {200x200+0+0} test unixEmbed-3.4 {ContainerEventProc procedure, disallow position changes} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update wm geometry .t1 300x100+30+40 } update dobg { wm geometry .t1 } } -cleanup { deleteWindows } -result {300x100+0+0} test unixEmbed-3.4a {ContainerEventProc procedure, disallow position changes} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update wm geometry .t1 300x100+30+40 update wm geometry .t1 } } -cleanup { interp delete slave deleteWindows } -result {300x100+0+0} test unixEmbed-3.5 {ContainerEventProc procedure, geometry requests} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { .t1 configure -width 300 -height 80 } update list [winfo width .f1] [winfo height .f1] [dobg {wm geometry .t1}] } -cleanup { deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.5a {ContainerEventProc procedure, geometry requests} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] .t1 configure -width 300 -height 80 update } list [winfo width .f1] [winfo height .f1] [slave eval {wm geometry .t1}] } -cleanup { interp delete slave deleteWindows } -result {300 80 300x80+0+0} test unixEmbed-3.6 {ContainerEventProc procedure, map requests} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 set x unmapped bind .t1 <Map> {set x mapped} } update dobg { after 100 update set x } } -cleanup { deleteWindows } -result {mapped} test unixEmbed-3.6a {ContainerEventProc procedure, map requests} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] set x unmapped bind .t1 <Map> {set x mapped} update after 100 update set x } } -cleanup { interp delete slave deleteWindows } -result {mapped} test unixEmbed-3.7 {ContainerEventProc procedure, destroy events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" bind .f1 <Destroy> {set x dead} |
︙ | ︙ | |||
354 355 356 357 358 359 360 | destroy .t1 } update list $x [winfo exists .f1] } -cleanup { deleteWindows } -result {dead 0} | > > > > > > > > > > > > > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > | | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 | destroy .t1 } update list $x [winfo exists .f1] } -cleanup { deleteWindows } -result {dead 0} test unixEmbed-3.7a {ContainerEventProc procedure, destroy events} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 bind .f1 <Destroy> {set x dead} set x alive slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update destroy .t1 } update list $x [winfo exists .f1] } -cleanup { interp delete slave deleteWindows } -result {dead 0} test unixEmbed-4.1 {EmbedStructureProc procedure, configure events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { .t1 configure -width 180 -height 100 } update dobg { winfo geometry .t1 } } -cleanup { deleteWindows } -result {180x100+0+0} test unixEmbed-4.1a {EmbedStructureProc procedure, configure events} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update .t1 configure -width 180 -height 100 update winfo geometry .t1 } } -cleanup { interp delete slave deleteWindows } -result {180x100+0+0} test unixEmbed-4.2 {EmbedStructureProc procedure, destroy events} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update set x [testembed] destroy .f1 update list $x [testembed] } -cleanup { deleteWindows } -result {{{XXX .f1 XXX {}}} {}} test unixEmbed-4.2a {EmbedStructureProc procedure, destroy events} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] } set x [testembed] destroy .f1 list $x [testembed] } -cleanup { interp delete slave deleteWindows } -result "{{XXX .f1 {} {}}} {}" test unixEmbed-5.1 {EmbedFocusProc procedure, FocusIn events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} set x {} } focus -force .f1 update dobg {set x} } -cleanup { deleteWindows } -result {{focus in .t1}} test unixEmbed-5.1a {EmbedFocusProc procedure, FocusIn events} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} update set x {} } focus -force .f1 update slave eval {set x} } -cleanup { interp delete slave deleteWindows } -result {{focus in .t1}} test unixEmbed-5.2 {EmbedFocusProc procedure, focusing on dead window} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 } update dobg { after 200 {destroy .t1} } after 400 focus -force .f1 update } -cleanup { deleteWindows } -result {} test unixEmbed-5.2a {EmbedFocusProc procedure, focusing on dead window} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update after 200 {destroy .t1} } after 400 focus -force .f1 update } -cleanup { interp delete slave deleteWindows } -result {} test unixEmbed-5.3 {EmbedFocusProc procedure, FocusOut events} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { |
︙ | ︙ | |||
467 468 469 470 471 472 473 | set x [dobg {update; set x}] focus . update list $x [dobg {update; set x}] } -cleanup { deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} | > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > | < | < | | > > > > > > > > > > > > > > > > > > > > > > > > > < < | < | > > > > > > > > > > > > > > > > > > > > > | > > | > > | | 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 | set x [dobg {update; set x}] focus . update list $x [dobg {update; set x}] } -cleanup { deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} test unixEmbed-5.3a {EmbedFocusProc procedure, FocusOut events} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] set x {} bind .t1 <FocusIn> {lappend x "focus in %W"} bind .t1 <FocusOut> {lappend x "focus out %W"} update } focus -force .f1 update set x [slave eval {update; set x }] focus . update list $x [slave eval {update; set x}] } -cleanup { interp delete slave deleteWindows } -result {{{focus in .t1}} {{focus in .t1} {focus out .t1}}} test unixEmbed-6.1 {EmbedGeometryRequest procedure, window changes size} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update bind .t1 <Configure> {lappend x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { deleteWindows } -result {{{configure .t1 300 120}} 300x120+0+0} test unixEmbed-6.1a {EmbedGeometryRequest procedure, window changes size} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update bind .t1 <Configure> {set x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { interp delete slave deleteWindows } -result {{configure .t1 300 120} 300x120+0+0} test unixEmbed-6.2 {EmbedGeometryRequest procedure, window changes size} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 place .f1 -width 200 -height 200 dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 update bind .t1 <Configure> {lappend x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { deleteWindows } -result {{{configure .t1 200 200}} 200x200+0+0} test unixEmbed-6.2a {EmbedGeometryRequest procedure, window changes size} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 place .f1 -width 200 -height 200 update slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] update bind .t1 <Configure> {set x {configure .t1 %w %h}} set x {} .t1 configure -width 300 -height 120 update list $x [winfo geom .t1] } } -cleanup { interp delete slave deleteWindows } -result {{configure .t1 200 200} 200x200+0+0} # Can't think up any tests for TkpGetOtherWindow procedure. test unixEmbed-7.1 {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { unix notAqua } -setup { deleteWindows } -body { deleteWindows frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" |
︙ | ︙ | |||
547 548 549 550 551 552 553 554 555 556 | event generate .t1 <KeyPress> -keysym a set y }] update list $x $y } -cleanup { deleteWindows bind . <KeyPress> {} } -result {{{key a 1}} {}} test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 | event generate .t1 <KeyPress> -keysym a set y }] update list $x $y } -cleanup { deleteWindows bind . <KeyPress> {} } -result {{{key a 1}} {}} # TkpRedirectKeyEvent is not implemented in win or aqua. If someone # implements it they should change the constraints for this test. test unixEmbed-7.1a {TkpRedirectKeyEvent procedure, forward keystroke} -constraints { unix notAqua } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { deleteWindows frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] } focus -force . bind . <KeyPress> {lappend x {key %A %E}} set x {} set y [slave eval { update bind .t1 <KeyPress> {lappend y {key %A}} set y {} event generate .t1 <KeyPress> -keysym a set y }] update list $x $y } -cleanup { interp delete slave deleteWindows bind . <KeyPress> {} } -result {{{key a 1}} {}} test unixEmbed-7.2 {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 dobg "set w1 [winfo id .f1]" dobg { |
︙ | ︙ | |||
579 580 581 582 583 584 585 | }] update list $x $y } -cleanup { deleteWindows bind . <KeyPress> {} } -result {{} {{key b}}} | > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > | > > | 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 | }] update list $x $y } -cleanup { deleteWindows bind . <KeyPress> {} } -result {{} {{key b}}} test unixEmbed-7.2a {TkpRedirectKeyEvent procedure, don't forward keystroke width} -constraints { unix } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] } update focus -force .f1 update bind . <KeyPress> {lappend x {key %A}} set x {} set y [slave eval { update bind .t1 <KeyPress> {lappend y {key %A}} set y {} event generate .t1 <KeyPress> -keysym b set y }] update list $x $y } -cleanup { interp delete slave deleteWindows bind . <KeyPress> {} } -result {{} {{key b}}} test unixEmbed-8.1 {TkpClaimFocus procedure} -constraints { unix notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 dobg "set w1 [winfo id .f1]" dobg { |
︙ | ︙ | |||
604 605 606 607 608 609 610 611 | update after 500 update lappend x [focus] }] [focus] } -cleanup { deleteWindows } -result {{{} .t1} .f1} | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > < | 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 | update after 500 update lappend x [focus] }] [focus] } -cleanup { deleteWindows } -result {{{} .t1} .f1} test unixEmbed-8.1a {TkpClaimFocus procedure} -constraints unix -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 update slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken } # This should clear focus from the application embedded in .f1 focus -force .f2 update list [slave eval { set x [list [focus]] focus .t1 update lappend x [focus] }] [focus] } -cleanup { interp delete slave deleteWindows } -result {{{} .t1} .f1} test unixEmbed-8.2 {TkpClaimFocus procedure} -constraints unix -setup { deleteWindows catch {interp delete child} interp create child } -body { frame .f1 -container 1 -width 200 -height 50 frame .f2 -width 200 -height 50 pack .f1 .f2 update set w1 [winfo id .f1] child eval "set argv {-use [winfo id .f1]}" load {} Tk child child eval { . configure -bd 2 -highlightthickness 2 -relief sunken } focus -force .f2 update list [child eval { focus . set x [list [focus]] update lappend x [focus] }] [focus] } -cleanup { deleteWindows } -result {{{} .} .f1} catch {interp delete child} test unixEmbed-9.1 {EmbedWindowDeleted procedure, check parentPtr} -constraints { unix testembed } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 |
︙ | ︙ | |||
654 655 656 657 658 659 660 | lappend x [testembed] } set x } -cleanup { deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { | | > > > > > > > > > > > > > > > > > > > | > > > > > | > > | < | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 | lappend x [testembed] } set x } -cleanup { deleteWindows } -result {{{XXX .f4 {} {}} {XXX .f3 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f4 {} {}} {XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}} {XXX .f1 {} {}}} {{XXX .f2 {} {}}} {}} test unixEmbed-9.2 {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { unix testembed notAqua } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 update dobg "set w1 [winfo id .f1]" dobg { eval destroy [winfo child .] toplevel .t1 -use $w1 -highlightthickness 2 -bd 2 -relief sunken set x {} lappend x [testembed] destroy .t1 lappend x [testembed] } } -cleanup { deleteWindows } -result {{{XXX {} {} .t1}} {}} test unixEmbed-9.2a {EmbedWindowDeleted procedure, check embeddedPtr} -constraints { unix testembed } -setup { deleteWindows catch {interp delete slave} ::_test_tmp::testInterp slave load {} Tktest slave } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 slave alias w1 winfo id .f1 slave eval { destroy [winfo child .] toplevel .t1 -use [w1] -highlightthickness 2 -bd 2 -relief sunken set x {} lappend x [testembed] destroy .t1 lappend x [testembed] } } -cleanup { interp delete slave deleteWindows } -result {{{XXX {} {} .t1}} {}} test unixEmbed-10.1 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { unix } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 update pack .f1 update toplevel .t1 -use [winfo id .f1] -width 150 -height 80 update wm geometry .t1 +40+50 update wm geometry .t1 } -cleanup { deleteWindows } -result {150x80+0+0} test unixEmbed-10.2 {geometry propagation in tkUnixWm.c/UpdateGeometryInfo} -constraints { unix } -setup { deleteWindows } -body { frame .f1 -container 1 -width 200 -height 50 pack .f1 toplevel .t1 -use [winfo id .f1] -width 150 -height 80 update wm geometry .t1 70x300+10+20 update wm geometry .t1 } -cleanup { deleteWindows } -result {70x300+0+0} # cleanup deleteWindows cleanupbg cleanupTests return |
Changes to tests/unixFont.test.
|
| | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # This file is a Tcl script to test out the procedures in tkUnixFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. Some tests depend on the # fonts having or not having certain properties, which may not be valid # at all sites. # # Copyright (c) 1996 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.1 eval tcltest::configure $argv |
︙ | ︙ | |||
120 121 122 123 124 125 126 | test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { # On Linux, XListFonts() was returning names for fonts that do not # actually exist, causing the subsequent XLoadQueryFont() to fail # unexpectedly. Now falls back to another font if that happens. font actual {-size 14} set x {} | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | test unixfont-2.11 {TkpGetFontFromAttributes: font cannot be loaded} x11 { # On Linux, XListFonts() was returning names for fonts that do not # actually exist, causing the subsequent XLoadQueryFont() to fail # unexpectedly. Now falls back to another font if that happens. font actual {-size 14} set x {} } {} test unixfont-3.1 {TkpDeleteFont procedure} x11 { font actual {-family xyz} set x {} } {} test unixfont-4.1 {TkpGetFontFamilies procedure} x11 { |
︙ | ︙ |
Changes to tests/unixMenu.test.
︙ | ︙ | |||
31 32 33 34 35 36 37 | test unixMenu-2.1 {TkpDestroyMenu - nothing to do} -constraints unix -body {} test unixMenu-3.1 {TkpDestroymenuEntry - nothing to do} -constraints unix -body {} test unixMenu-4.1 {TkpConfigureMenuEntry - non-cascade entry} -constraints { | | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | test unixMenu-2.1 {TkpDestroyMenu - nothing to do} -constraints unix -body {} test unixMenu-3.1 {TkpDestroymenuEntry - nothing to do} -constraints unix -body {} test unixMenu-4.1 {TkpConfigureMenuEntry - non-cascade entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label test list [.m1 entryconfigure test -label foo] [destroy .m1] } -returnCodes ok -result {{} {}} test unixMenu-4.2 {TkpConfigureMenuEntry - cascade entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -menu .m2 -label test menu .m1.foo -tearoff 0 list [.m1 entryconfigure test -menu .m1.foo] [destroy .m1] |
︙ | ︙ | |||
75 76 77 78 79 80 81 | } -returnCodes ok -result {{} {} {}} test unixMenu-7.1 {TkpSetMainMenubar - nothing to do} -constraints unix -body {} test unixMenu-8.1 {GetMenuIndicatorGeometry - indicator off} -constraints { | | | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | } -returnCodes ok -result {{} {} {}} test unixMenu-7.1 {TkpSetMainMenubar - nothing to do} -constraints unix -body {} test unixMenu-8.1 {GetMenuIndicatorGeometry - indicator off} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo -indicatoron 0 tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-8.2 {GetMenuIndicatorGeometry - not checkbutton or radio} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo tk::TearOffMenu .m1 40 40 destroy .m1 |
︙ | ︙ | |||
108 109 110 111 112 113 114 | image create test image1 .m1 add checkbutton -image image1 -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -cleanup { image delete image1 | | | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | image create test image1 .m1 add checkbutton -image image1 -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -cleanup { image delete image1 } -returnCodes ok test unixMenu-8.4 {GetMenuIndicatorGeometry - checkbutton bitmap} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -bitmap questhead -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-8.5 {GetMenuIndicatorGeometry - checkbutton} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 |
︙ | ︙ | |||
146 147 148 149 150 151 152 | .m1 add radiobutton -image image1 -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 image delete image1 } -returnCodes ok test unixMenu-8.7 {GetMenuIndicatorGeometry - radiobutton bitmap} -constraints { | | | | | | | | | | | | | | | | | | | | | | 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | .m1 add radiobutton -image image1 -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 image delete image1 } -returnCodes ok test unixMenu-8.7 {GetMenuIndicatorGeometry - radiobutton bitmap} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -bitmap questhead -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-8.8 {GetMenuIndicatorGeometry - radiobutton} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label foo .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-8.9 {GetMenuIndicatorGeometry - hideMargin} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label foo -hidemargin 1 .m1 invoke foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-9.1 {GetMenuAccelGeometry - cascade entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-9.2 {GetMenuAccelGeometry - non-null label} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -accel "Ctrl+S" tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-9.3 {GetMenuAccelGeometry - null label} -constraints unix -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo tk::TearOffMenu .m1 40 40 destroy .m1 } -returnCodes ok test unixMenu-10.1 {DrawMenuEntryBackground - active menubar} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label foo . configure -menu .m1 .m1 activate 1 list [update] [. configure -menu ""] [destroy .m1] } -returnCodes ok -result {{} {} {}} test unixMenu-10.2 {DrawMenuEntryBackground - active} -constraints unix -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] $tearoff activate 0 list [update] [destroy .m1] } -returnCodes ok -result {{} {}} test unixMenu-10.3 {DrawMenuEntryBackground - non-active} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -returnCodes ok -result {{} {}} test unixMenu-11.1 {DrawMenuEntryAccelerator - menubar} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -accel "Ctrl+U" . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} # drawArrow parameter is never false under Unix test unixMenu-11.2 {DrawMenuEntryAccelerator - cascade entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-11.3 {DrawMenuEntryAccelerator - normal entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -accel "Ctrl+U" set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-11.4 {DrawMenuEntryAccelerator - null entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.1 {DrawMenuEntryIndicator - non-check or radio} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.2 {DrawMenuEntryIndicator - checkbutton - indicator off} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo -indicatoron 0 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.3 {DrawMenuEntryIndicator - checkbutton - not selected} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.4 {DrawMenuEntryIndicator - checkbutton - selected} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.5 {DrawMenuEntryIndicator - radiobutton - indicator off} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label foo -indicatoron 0 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.6 {DrawMenuEntryIndicator - radiobutton - not selected} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-12.7 {DrawMenuEntryIndicator - radiobutton - selected} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add radiobutton -label foo .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] |
︙ | ︙ | |||
442 443 444 445 446 447 448 | list [tk::MbPost .mb] [tk::MenuUnpost .mb.m] [destroy .mb] } -result {{} {} {}} # Don't know how to reproduce the case where the tkwin has been deleted. test unixMenu-19.1 {TkpComputeMenubarGeometry - zero entries} -constraints { | | | | | | | | | | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 | list [tk::MbPost .mb] [tk::MenuUnpost .mb.m] [destroy .mb] } -result {{} {} {}} # Don't know how to reproduce the case where the tkwin has been deleted. test unixMenu-19.1 {TkpComputeMenubarGeometry - zero entries} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} # Don't know how to generate one width windows test unixMenu-19.2 {TkpComputeMenubarGeometry - one entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label File . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.3 {TkpComputeMenubarGeometry - entry with different font} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -font "Courier 24" .m1 add cascade -label File -font "Helvetica 18" . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.4 {TkpComputeMenubarGeometry - separator} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add separator . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.5 {TkpComputeMenubarGeometry - First entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File . configure -menu .m1 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.6 {TkpComputeMenubarGeometry - First entry too wide} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File -font "Times 72" . configure -menu .m1 wm geometry . 10x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.7 {TkpComputeMenubarGeometry - two entries fit} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File .m1 add cascade -label Edit . configure -menu .m1 wm geometry . 200x200 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.8 {TkpComputeMenubarGeometry - two entries; 2nd don't fit} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File .m1 add cascade -label Edit -font "Times 72" . configure -menu .m1 wm geometry . 100x100 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.9 {TkpComputeMenubarGeometry - two entries; 1st dont fit} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File -font "Times 72" .m1 add cascade -label Edit . configure -menu .m1 wm geometry . 100x100 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.10 {TkpComputeMenubarGeometry - two entries; neither fit} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 -font "Times 72" .m1 add cascade -label File .m1 add cascade -label Edit . configure -menu .m1 |
︙ | ︙ | |||
641 642 643 644 645 646 647 | .m1 add cascade -label "B" .m1 add cascade -label "C" . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.19 {TkpComputeMenubarGeometry - help menu in first position} -constraints { | | | | | | | | 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | .m1 add cascade -label "B" .m1 add cascade -label "C" . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.19 {TkpComputeMenubarGeometry - help menu in first position} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label Help -menu .m1.help menu .m1.help -tearoff 0 .m1 add cascade -label File -menu .m1.file menu .m1.file -tearoff 0 .m1 add cascade -label Edit -menu .m1.edit menu .m1.edit -tearoff 0 . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.20 {TkpComputeMenubarGeometry - help menu in middle} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label Edit -menu .m1.edit menu .m1.edit -tearoff 0 .m1 add cascade -label Help -menu .m1.help menu .m1.help -tearoff 0 .m1 add cascade -label File -menu .m1.file menu .m1.file -tearoff 0 . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.21 {TkpComputeMenubarGeometry - help menu in first position} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File -menu .m1.file menu .m1.file -tearoff 0 .m1 add cascade -label Edit -menu .m1.edit menu .m1.edit -tearoff 0 .m1 add cascade -label Help -menu .m1.help menu .m1.help -tearoff 0 . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.22 {TkpComputeMenubarGeometry - help item fits} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File -menu .m1.file menu .m1.file -tearoff 0 .m1 add cascade -label Help -menu .m1.help menu .m1.help -tearoff 0 . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.23 {TkpComputeMenubarGeometry - help item does not fit} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label File -menu .m1.file menu .m1.file -tearoff 0 .m1 add cascade -label Help -menu .m1.help -font "Helvetica 72" menu .m1.help -tearoff 0 . configure -menu .m1 wm geometry . 100x10 list [update] [. configure -menu ""] [destroy .m1] } -result {{} {} {}} test unixMenu-19.24 {TkpComputeMenubarGeometry - help item only one} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add cascade -label Help -menu .m1.help menu .m1.help -tearoff 0 . configure -menu .m1 |
︙ | ︙ | |||
762 763 764 765 766 767 768 | } -body { menu .m1 -tearoff 0 .m1 add cascade -label test -menu .m1.test list [menu .m1.test] [destroy .m1] } -result {.m1.test {}} # Don't know how to automate missing tkwins test unixMenu-22.2 {SetHelpMenu - menubar but no help menu} -constraints { | | | | | | | | | | | | | | | | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | } -body { menu .m1 -tearoff 0 .m1 add cascade -label test -menu .m1.test list [menu .m1.test] [destroy .m1] } -result {.m1.test {}} # Don't know how to automate missing tkwins test unixMenu-22.2 {SetHelpMenu - menubar but no help menu} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 . configure -menu .m1 .m1 add cascade -label .m1.file list [menu .m1.file] [. configure -menu ""] [destroy .m1] } -result {.m1.file {} {}} test unixMenu-22.3 {SetHelpMenu - menubar with help menu} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 . configure -menu .m1 .m1 add cascade -label .m1.help list [menu .m1.help] [. configure -menu ""] [destroy .m1] } -result {.m1.help {} {}} test unixMenu-22.4 {SetHelpMenu - multiple menubars with same help menu} -constraints { unix } -setup { destroy .m1 .t2 } -body { toplevel .t2 wm geometry .t2 +40+40 menu .m1 -tearoff 0 . configure -menu .m1 .t2 configure -menu .m1 .m1 add cascade -label .m1.help list [menu .m1.help] [. configure -menu ""] [destroy .m1] [destroy .t2] } -result {.m1.help {} {} {}} test unixMenu-23.1 {TkpDrawMenuEntry - gc for active and not strict motif} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.2 {TkpDrawMenuEntry - gc for active menu item with its own gc} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -activeforeground red set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.3 {TkpDrawMenuEntry - gc for active and strict motif} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 set tk_strictMotif 1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] [set tk_strictMotif 0] } -result {{} {} 0} test unixMenu-23.4 {TkpDrawMenuEntry - gc for disabled with disabledfg and custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -disabledforeground blue .m1 add command -label foo -state disabled -background red set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.5 {TkpDrawMenuEntry - gc for disabled with disabledFg} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -disabledforeground blue .m1 add command -label foo -state disabled set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.6 {TkpDrawMenuEntry - gc for disabled - no disabledFg} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -disabledforeground "" .m1 add command -label foo -state disabled set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.7 {TkpDrawMenuEntry - gc for normal - custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -foreground red set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.8 {TkpDrawMenuEntry - gc for normal} -constraints unix -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.9 {TkpDrawMenuEntry - gc for indicator - custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo -selectcolor orange .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.10 {TkpDrawMenuEntry - gc for indicator} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label foo .m1 invoke 1 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.11 {TkpDrawMenuEntry - border - custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -activebackground green set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.12 {TkpDrawMenuEntry - border} -constraints unix -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.13 {TkpDrawMenuEntry - active border - strict motif} -constraints { unix } -setup { destroy .m1 } -body { set tk_strictMotif 1 menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] [set tk_strictMotif 0] } -result {{} {} 0} test unixMenu-23.14 {TkpDrawMenuEntry - active border - custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -activeforeground yellow set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.15 {TkpDrawMenuEntry - active border} -constraints unix -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] .m1 entryconfigure 1 -state active list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.16 {TkpDrawMenuEntry - font - custom entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -font "Helvectica 72" set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] |
︙ | ︙ | |||
987 988 989 990 991 992 993 | } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.20 {TkpDrawMenuEntry - disabled cascade item} -constraints { | | | 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 | } -body { menu .m1 .m1 add command -label foo set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test unixMenu-23.20 {TkpDrawMenuEntry - disabled cascade item} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add cascade -label File -menu .m1.file menu .m1.file .m1.file add command -label foo |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 | menu .m1 .m1 add command -label "This is a test." list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.1 {TkpComputeStandardMenuGeometry - no entries} -constraints { | | | | | | | | | | | | | | 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 | menu .m1 .m1 add command -label "This is a test." list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.1 {TkpComputeStandardMenuGeometry - no entries} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.2 {TkpComputeStandardMenuGeometry - one entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "one" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.3 {TkpComputeStandardMenuGeometry - more than one entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "one" .m1 add command -label "two" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.4 {TkpComputeStandardMenuGeometry - separator} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add separator list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.5 {TkpComputeStandardMenuGeometry - tearoff entry} -constraints { unix nonUnixUserInteraction } -setup { destroy .mb } -body { menubutton .mb -text "test" -menu .mb.m menu .mb.m .mb.m add command -label test pack .mb catch {tk::MbPost .mb} list [update] [tk::MenuUnpost .mb.m] [destroy .mb] } -result {{} {} {}} test unixMenu-25.6 {TkpComputeStandardMenuGeometry - standard label geometry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.7 {TkpComputeStandardMenuGeometry - different font for entry} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -font "Helvetica 12" .m1 add command -label "test" -font "Courier 12" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.8 {TkpComputeStandardMenuGeometry - second entry larger} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" .m1 add command -label "test test" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.9 {TkpComputeStandardMenuGeometry - first entry larger} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test test" .m1 add command -label "test" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.10 {TkpComputeStandardMenuGeometry - accelerator} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" -accel "Ctrl+S" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.11 {TkpComputeStandardMenuGeometry - second accel larger} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" -accel "1" .m1 add command -label "test" -accel "1 1" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.12 {TkpComputeStandardMenuGeometry - second accel smaller} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label "test" -accel "1 1" .m1 add command -label "test" -accel "1" list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.13 {TkpComputeStandardMenuGeometry - indicator} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add checkbutton -label test .m1 invoke 1 list [update idletasks] [destroy .m1] |
︙ | ︙ | |||
1207 1208 1209 1210 1211 1212 1213 | .m1 add checkbutton -image image1 .m1 invoke 1 .m1 add checkbutton -label test .m1 invoke 2 list [update idletasks] [destroy .m1] [image delete image1] } -result {{} {} {}} test unixMenu-25.16 {TkpComputeStandardMenuGeometry - zero sized menus} -constraints { | | | | | | | | 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 | .m1 add checkbutton -image image1 .m1 invoke 1 .m1 add checkbutton -label test .m1 invoke 2 list [update idletasks] [destroy .m1] [image delete image1] } -result {{} {} {}} test unixMenu-25.16 {TkpComputeStandardMenuGeometry - zero sized menus} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.17 {TkpComputeStandardMenuGeometry - first column bigger} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 .m1 add command -label one .m1 add command -label two .m1 add command -label three -columnbreak 1 list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.18 {TkpComputeStandardMenuGeometry - second column bigger} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label one .m1 add command -label two -columnbreak 1 .m1 add command -label three list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.19 {TkpComputeStandardMenuGeometry - three columns} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add command -label one .m1 add command -label two -columnbreak 1 .m1 add command -label three .m1 add command -label four .m1 add command -label five -columnbreak 1 .m1 add command -label six list [update idletasks] [destroy .m1] } -result {{} {}} test unixMenu-25.20 {TkpComputeStandardMenuGeometry - hide margin} -constraints { unix } -setup { destroy .m1 } -body { menu .m1 -tearoff 0 .m1 add checkbutton -label one -hidemargin 1 list [update idletasks] [destroy .m1] } -result {{} {}} |
︙ | ︙ |
Changes to tests/unixWm.test.
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 | deleteWindows foreach i {.raise1 .raise2 .raise3} { toplevel $i wm geom $i 150x100+0+0 update } } set i 1 | > > > > > > > > > > > > > > > | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | deleteWindows foreach i {.raise1 .raise2 .raise3} { toplevel $i wm geom $i 150x100+0+0 update } } # On macOS windows are not allowed to overlap the menubar at the top # of the screen. So tests which move a window and then check whether # it got moved to the requested location should use a y coordinate # larger than the height of the menubar (normally 23 pixels). if {[tk windowingsystem] eq "aqua"} { set Y0 23 set Y2 25 set Y5 28 } else { set Y0 0 set Y2 2 set Y5 5 } set i 1 foreach geom "+23+80 +80+23 +0+$Y0" { destroy .t test unixWm-1.$i {initial window position} unix { toplevel .t -width 200 -height 150 wm geom .t $geom update wm geom .t } 200x150$geom |
︙ | ︙ | |||
63 64 65 66 67 68 69 | wm geom .t +200+200 update wm geom .t +150+150 update scan [wm geom .t] %dx%d+%d+%d width height x y set xerr [expr 150-$x] set yerr [expr 150-$y] | | | | | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | wm geom .t +200+200 update wm geom .t +150+150 update scan [wm geom .t] %dx%d+%d+%d width height x y set xerr [expr 150-$x] set yerr [expr 150-$y] foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" { test unixWm-2.$i {moving window while mapped} unix { wm geom .t $geom update scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] } $geom incr i } set i 1 foreach geom "+20+80 +80+23 +0+$Y0 -0-0 +0-0 -0+$Y0 -10-5 -10+$Y5 +10-5" { test unixWm-3.$i {moving window while iconified} unix { wm iconify .t sleep 200 wm geom .t $geom update wm deiconify .t animationDelay scan [wm geom .t] %dx%d%1s%d%1s%d width height xsign x ysign y format "%s%d%s%d" $xsign [eval expr $x$xsign$xerr] $ysign \ [eval expr $y$ysign$yerr] } $geom incr i } set i 1 foreach geom "+20+80 +100+40 +0+$Y0" { test unixWm-4.$i {moving window while withdrawn} unix { wm withdraw .t sleep 200 wm geom .t $geom update wm deiconify .t animationDelay |
︙ | ︙ | |||
175 176 177 178 179 180 181 | wm withdraw .t wm iconify .t list [winfo ismapped .t] [wm state .t] } {0 iconic} destroy .t toplevel .t -width 200 -height 100 | | | | | | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | wm withdraw .t wm iconify .t list [winfo ismapped .t] [wm state .t] } {0 iconic} destroy .t toplevel .t -width 200 -height 100 wm geom .t +10+23 wm minsize .t 1 1 update test unixWm-6.1 {size changes} unix { .t config -width 180 -height 150 update wm geom .t } 180x150+10+23 test unixWm-6.2 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 update wm geom .t } 250x60+10+23 test unixWm-6.3 {size changes} unix { wm geom .t 250x60 .t config -width 170 -height 140 wm geom .t {} update wm geom .t } 170x140+10+23 test unixWm-6.4 {size changes} {unix nonPortable userInteraction} { wm minsize .t 1 1 update puts stdout "Please resize window \"t\" with the mouse (but don't move it!)," puts -nonewline stdout "then hit return: " flush stdout gets stdin |
︙ | ︙ | |||
639 640 641 642 643 644 645 | test unixWm-17.1 {Tk_WmCmd procedure, "focusmodel" option} unix { list [catch {wm focusmodel .t 12 13} msg] $msg } {1 {wrong # args: should be "wm focusmodel window ?active|passive?"}} test unixWm-17.2 {Tk_WmCmd procedure, "focusmodel" option} unix { list [catch {wm focusmodel .t bogus} msg] $msg } {1 {bad argument "bogus": must be active or passive}} test unixWm-17.3 {Tk_WmCmd procedure, "focusmodel" option} unix { | | | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | test unixWm-17.1 {Tk_WmCmd procedure, "focusmodel" option} unix { list [catch {wm focusmodel .t 12 13} msg] $msg } {1 {wrong # args: should be "wm focusmodel window ?active|passive?"}} test unixWm-17.2 {Tk_WmCmd procedure, "focusmodel" option} unix { list [catch {wm focusmodel .t bogus} msg] $msg } {1 {bad argument "bogus": must be active or passive}} test unixWm-17.3 {Tk_WmCmd procedure, "focusmodel" option} unix { set result {} lappend result [wm focusmodel .t] wm focusmodel .t active lappend result [wm focusmodel .t] wm focusmodel .t passive lappend result [wm focusmodel .t] set result } {passive active passive} |
︙ | ︙ | |||
805 806 807 808 809 810 811 | lappend result [wm iconbitmap .t] $bit wm iconbitmap .t {} set bit [format 0x%x [expr 0x4 & [lindex [testprop [testwrapper .t] \ WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} if {[tk windowingsystem] == "aqua"} { | | | 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 | lappend result [wm iconbitmap .t] $bit wm iconbitmap .t {} set bit [format 0x%x [expr 0x4 & [lindex [testprop [testwrapper .t] \ WM_HINTS] 0]]] lappend result [wm iconbitmap .t] $bit } {{} questhead 0x4 {} 0x0} if {[tk windowingsystem] == "aqua"} { set result_22_3 {0 {}} } else { set result_22_3 {1 {bitmap "bad-bitmap" not defined}} } test unixWm-22.3 {Tk_WmCmd procedure, "iconbitmap" option for unix only} \ unix { list [catch {wm iconbitmap .t bad-bitmap} msg] $msg } $result_22_3 |
︙ | ︙ | |||
1345 1346 1347 1348 1349 1350 1351 | destroy .t .icon test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on grid} {unix nonPortable} { destroy .t toplevel .t wm geometry .t 30x10+0+0 | | | | | | 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 | destroy .t .icon test unixWm-40.1 {Tk_SetGrid procedure, set grid dimensions before turning on grid} {unix nonPortable} { destroy .t toplevel .t wm geometry .t 30x10+0+0 listbox .t.l -height 20 -width 20 -setgrid 1 pack .t.l -fill both -expand 1 update wm geometry .t } {30x10+0+0} test unixWm-40.2 {Tk_SetGrid procedure, turning on grid when dimensions already set} unix { destroy .t toplevel .t wm geometry .t 200x100+0+$Y0 listbox .t.l -height 20 -width 20 pack .t.l -fill both -expand 1 update .t.l configure -setgrid 1 update wm geometry .t } "20x20+0+$Y0" test unixWm-41.1 {ConfigureEvent procedure, internally generated size changes} unix { destroy .t toplevel .t -width 400 -height 150 wm geometry .t +0+0 tkwait visibility .t set result {} |
︙ | ︙ | |||
1555 1556 1557 1558 1559 1560 1561 | } [list 5 [expr [winfo screenheight .t] - 70]] destroy .t toplevel .t -width 80 -height 60 test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix { tkwait visibility .t wm overrideredirect .t 1 update | | | | 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 | } [list 5 [expr [winfo screenheight .t] - 70]] destroy .t toplevel .t -width 80 -height 60 test unixWm-44.8 {UpdateGeometryInfo procedure, computing position} unix { tkwait visibility .t wm overrideredirect .t 1 update wm geometry .t -30+$Y2 update list [winfo x .t] [winfo y .t] } [list [expr [winfo screenwidth .t] - 110] $Y2] destroy .t test unixWm-44.9 {UpdateGeometryInfo procedure, updating fixed dimensions} {unix testwrapper} { destroy .t toplevel .t -width 80 -height 60 wm resizable .t 0 0 wm geometry .t +0+0 |
︙ | ︙ | |||
1771 1772 1773 1774 1775 1776 1777 | frame .t.m.f -width 20 -height 10 -bd 2 -relief raised place .t.m.f -x 50 -y 5 frame .t.f -width 20 -height 30 -bd 2 -relief raised place .t.f -x 10 -y 30 testmenubar window .t .t.m update list [expr [winfo rootx .t.m.f] - $x] [expr [winfo rooty .t.m.f] - $y] \ | | | | 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 | frame .t.m.f -width 20 -height 10 -bd 2 -relief raised place .t.m.f -x 50 -y 5 frame .t.f -width 20 -height 30 -bd 2 -relief raised place .t.f -x 10 -y 30 testmenubar window .t .t.m update list [expr [winfo rootx .t.m.f] - $x] [expr [winfo rooty .t.m.f] - $y] \ [expr [winfo rootx .t.f] - $x] [expr [winfo rooty .t.f] - $y] } {52 7 12 62} deleteWindows wm withdraw . if {[tk windowingsystem] == "aqua"} { # Modern mac windows have no border. set result_50_1 {{} {} .t .t .t2 {} .t2 .t .t} } else { # Windows are assumed to have a border (invisible in Gnome 3). set result_50_1 {{} {} .t {} .t2 {} .t2 {} .t} } test unixWm-50.1 {Tk_CoordsToWindow procedure, finding a toplevel, x-coords, title bar} unix { update toplevel .t -width 300 -height 400 -bg green |
︙ | ︙ | |||
1832 1833 1834 1835 1836 1837 1838 | [winfo containing [expr $x +200] [expr $y + 450]] } {{} {} .t .t .t2 .t2 .t {}} test unixWm-50.3 { Tk_CoordsToWindow procedure, finding a toplevel with embedding } tempNotWin { deleteWindows catch {interp delete slave} | | | 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 | [winfo containing [expr $x +200] [expr $y + 450]] } {{} {} .t .t .t2 .t2 .t {}} test unixWm-50.3 { Tk_CoordsToWindow procedure, finding a toplevel with embedding } tempNotWin { deleteWindows catch {interp delete slave} toplevel .t -width 300 -height 400 -bg blue wm geom .t +100+100 frame .t.f -container 1 -bg red place .t.f -x 150 -y 50 tkwait visibility .t.f update interp create slave |
︙ | ︙ |
Changes to tests/util.test.
︙ | ︙ | |||
24 25 26 27 28 29 30 | test util-1.3 {Tk_GetScrollInfo procedure} -body { .l yview 0 .l yview moveto .5 .l yview } -result {0.5 0.75} test util-1.4 {Tk_GetScrollInfo procedure} -body { .l yview scroll a | | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | test util-1.3 {Tk_GetScrollInfo procedure} -body { .l yview 0 .l yview moveto .5 .l yview } -result {0.5 0.75} test util-1.4 {Tk_GetScrollInfo procedure} -body { .l yview scroll a } -returnCodes error -result {wrong # args: should be ".l yview scroll number pages|units"} test util-1.5 {Tk_GetScrollInfo procedure} -body { .l yview scroll a b c } -returnCodes error -result {wrong # args: should be ".l yview scroll number pages|units"} test util-1.6 {Tk_GetScrollInfo procedure} -body { .l yview scroll xyz units } -returnCodes error -result {expected integer but got "xyz"} test util-1.7 {Tk_GetScrollInfo procedure} -body { .l yview 0 .l yview scroll 2 pages .l nearest 0 |
︙ | ︙ | |||
53 54 55 56 57 58 59 | test util-1.10 {Tk_GetScrollInfo procedure} -body { .l yview 15 .l yview scroll -2 units .l nearest 0 } -result {13} test util-1.11 {Tk_GetScrollInfo procedure} -body { .l yview scroll 3 zips | | | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | test util-1.10 {Tk_GetScrollInfo procedure} -body { .l yview 15 .l yview scroll -2 units .l nearest 0 } -result {13} test util-1.11 {Tk_GetScrollInfo procedure} -body { .l yview scroll 3 zips } -returnCodes error -result {bad argument "zips": must be pages or units} test util-1.12 {Tk_GetScrollInfo procedure} -body { .l yview dropdead 3 times } -returnCodes error -result {unknown option "dropdead": must be moveto or scroll} # cleanup cleanupTests return |
Changes to tests/visual.test.
︙ | ︙ | |||
25 26 27 28 29 30 31 | catch {destroy $w} toplevel $w wm geom $w +0+0 canvas $w.c -width 400 -height 200 -bd 0 pack $w.c for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 40} {incr x} { | | | | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | catch {destroy $w} toplevel $w wm geom $w +0+0 canvas $w.c -width 400 -height 200 -bd 0 pack $w.c for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 40} {incr x} { set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0] $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \ -fill $color } } update } # colorsFree -- # # Returns 1 if there appear to be free colormap entries in a window, # 0 otherwise. # # Arguments: # w - Name of window in which to check. # red, green, blue - Intensities to use in a trial color allocation # to see if there are colormap entries free. proc colorsFree {w {red 31} {green 245} {blue 192}} { set vals [winfo rgb $w [format #%02x%02x%02x $red $green $blue]] expr {([lindex $vals 0]/256 == $red) && ([lindex $vals 1]/256 == $green) && ([lindex $vals 2]/256 == $blue)} } # If more than one visual type is available for the screen, pick one # that is *not* the default. set default "[winfo visual .] [winfo depth .]" set avail [winfo visualsavailable .] |
︙ | ︙ |
Changes to tests/visual_bb.test.
︙ | ︙ | |||
48 49 50 51 52 53 54 | # menu bar and a message explaining the basic operation # of the program. #------------------------------------------------------- frame .menu -relief raised -borderwidth 1 message .msg -font {Times 18} -relief raised -width 4i \ -borderwidth 1 -text "This application provides a collection of visual tests for the Tk toolkit. Each menu entry invokes a test, which displays information on the screen. You can then verify visually that the information is being displayed in the correct way. The tests under the \"Postscript\" menu exercise the Postscript-generation capabilities of canvas widgets." | | | | | | | | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # menu bar and a message explaining the basic operation # of the program. #------------------------------------------------------- frame .menu -relief raised -borderwidth 1 message .msg -font {Times 18} -relief raised -width 4i \ -borderwidth 1 -text "This application provides a collection of visual tests for the Tk toolkit. Each menu entry invokes a test, which displays information on the screen. You can then verify visually that the information is being displayed in the correct way. The tests under the \"Postscript\" menu exercise the Postscript-generation capabilities of canvas widgets." pack .menu -side top -fill x pack .msg -side bottom -expand yes -fill both #------------------------------------------------------- # The code below creates all the menus, which invoke procedures # to create particular demonstrations of various widgets. #------------------------------------------------------- menubutton .menu.file -text "File" -menu .menu.file.m menu .menu.file.m .menu.file.m add command -label "Quit" -command end menubutton .menu.group1 -text "Group 1" -menu .menu.group1.m menu .menu.group1.m .menu.group1.m add command -label "Canvas arcs" -command {runTest arc.tcl} .menu.group1.m add command -label "Beveled borders in text widgets" \ -command {runTest bevel.tcl} .menu.group1.m add command -label "Colormap management" \ -command {runTest cmap.tcl} .menu.group1.m add command -label "Label/button geometry" \ -command {runTest butGeom.tcl} .menu.group1.m add command -label "Label/button colors" \ -command {runTest butGeom2.tcl} menubutton .menu.ps -text "Canvas Postscript" -menu .menu.ps.m menu .menu.ps.m .menu.ps.m add command -label "Rectangles and other graphics" \ -command {runTest canvPsGrph.tcl} .menu.ps.m add command -label "Text" \ -command {runTest canvPsText.tcl} .menu.ps.m add command -label "Bitmaps" \ -command {runTest canvPsBmap.tcl} .menu.ps.m add command -label "Images" \ -command {runTest canvPsImg.tcl} .menu.ps.m add command -label "Arcs" \ -command {runTest canvPsArc.tcl} pack .menu.file .menu.group1 .menu.ps -side left -padx 1m # Set up for keyboard-based menu traversal bind . <Any-FocusIn> { if {("%d" == "NotifyVirtual") && ("%m" == "NotifyNormal")} { focus .menu } } tk_menuBar .menu .menu.file .menu.group1 .menu.ps |
︙ | ︙ |
Changes to tests/winDialog.test.
︙ | ︙ | |||
251 252 253 254 255 256 257 | test winDialog-5.5 {GetFileName: Tcl_GetIndexFromObj() == TCL_OK} -constraints { nt testwinevent } -body { start {set x [tk_getOpenFile -title bar]} set y [then { Click cancel }] | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | test winDialog-5.5 {GetFileName: Tcl_GetIndexFromObj() == TCL_OK} -constraints { nt testwinevent } -body { start {set x [tk_getOpenFile -title bar]} set y [then { Click cancel }] # Note this also tests fix for # http://core.tcl.tk/tk/tktview/4a0451f5291b3c9168cc560747dae9264e1d2ef6 # $x is expected to be empty append x $y } -result {0} test winDialog-5.6 {GetFileName: valid option, but missing value} -constraints { nt } -body { |
︙ | ︙ | |||
372 373 374 375 376 377 378 | unset msg } -result bar.c test winDialog-5.7.6 {GetFileName: All/extension } -constraints { nt testwinevent } -body { | | | | | | | | | | | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 | unset msg } -result bar.c test winDialog-5.7.6 {GetFileName: All/extension } -constraints { nt testwinevent } -body { # In 8.6.4 this combination resulted in bar.aaa.aaa which is bad start {set x [tk_getSaveFile -filetypes {{All *}} -defaultextension {aaa} -title Save]} set msg {} then { if {[catch {SetText [vista? 0x47C 0x3e9] bar} msg]} { Click cancel } else { Click ok } } set x "[file tail $x]$msg" } -cleanup { unset msg } -result bar.aaa test winDialog-5.7.7 {tk_getOpenFile: -defaultextension} -constraints { nt testwinevent } -body { unset -nocomplain x tcltest::makeFile "" "5 7 7.aaa" [initialdir] start {set x [tk_getOpenFile \ -defaultextension aaa \ -initialdir [file nativename [initialdir]] \ -initialfile "5 7 7" -title Foo]} then { Click ok } return $x } -result [file join [initialdir] "5 7 7.aaa"] test winDialog-5.7.8 {tk_getOpenFile: -defaultextension} -constraints { nt testwinevent } -body { unset -nocomplain x tcltest::makeFile "" "5 7 8.aaa" [initialdir] start {set x [tk_getOpenFile \ -defaultextension aaa \ -initialdir [file nativename [initialdir]] \ -initialfile "5 7 8.aaa" -title Foo]} then { Click ok } return $x } -result [file join [initialdir] "5 7 8.aaa"] test winDialog-5.8 {GetFileName: extension doesn't begin with .} -constraints { nt testwinevent } -body { start {set x [tk_getSaveFile -defaultextension foo -title Save]} set msg {} then { |
︙ | ︙ | |||
437 438 439 440 441 442 443 | } -cleanup { unset msg } -result bar.foo test winDialog-5.9 {GetFileName: file types} -constraints { nt testwinevent } -body { # case FILE_TYPES: | | | 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | } -cleanup { unset msg } -result bar.foo test winDialog-5.9 {GetFileName: file types} -constraints { nt testwinevent } -body { # case FILE_TYPES: start {tk_getSaveFile -filetypes {{"foo files" .foo FOOF}} -title Foo} # XXX - currently disabled for vista style dialogs because the file # types control has no control ID and we don't have a mechanism to # locate it. if {[vista?]} { then { Click cancel |
︙ | ︙ | |||
500 501 502 503 504 505 506 | } return $x } -result [file normalize [file join ~ "5 12 1"]] test winDialog-5.12.2 {tk_getSaveFile: initial directory: ~user} -constraints { nt testwinevent } -body { | | | 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | } return $x } -result [file normalize [file join ~ "5 12 1"]] test winDialog-5.12.2 {tk_getSaveFile: initial directory: ~user} -constraints { nt testwinevent } -body { # Note: this test will fail on Tcl versions 8.6.4 and earlier due # to a bug in file normalize for names of the form ~xxx that # returns the wrong dir on Windows. In particular (in Win8 at # least) it returned /users/Default instead of /users/USERNAME... unset -nocomplain x start {set x [tk_getSaveFile \ |
︙ | ︙ | |||
727 728 729 730 731 732 733 | } return $x } -result {1} test winDialog-5.17 {GetFileName: title} -constraints { nt testwinevent } -body { # case FILE_TITLE: | | | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | } return $x } -result {1} test winDialog-5.17 {GetFileName: title} -constraints { nt testwinevent } -body { # case FILE_TITLE: start {tk_getOpenFile -title Narf} then { Click cancel } } -result {0} if {[vista?]} { # In the newer file dialogs, the file type widget does not even exist |
︙ | ︙ | |||
790 791 792 793 794 795 796 | destroy .t } } -result {} test winDialog-5.21 {GetFileName: call GetOpenFileName} -constraints { nt testwinevent english } -body { # winCode = GetOpenFileName(&ofn); | | | 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 | destroy .t } } -result {} test winDialog-5.21 {GetFileName: call GetOpenFileName} -constraints { nt testwinevent english } -body { # winCode = GetOpenFileName(&ofn); start {tk_getOpenFile -title Open} then { set x [GetText ok] Click cancel } return $x } -result {&Open} |
︙ | ︙ | |||
923 924 925 926 927 928 929 | string tolower [set x] } -result [string tolower [initialdir]] test winDialog-9.8 {Tk_ChooseDirectoryObjCmd: initial directory: Tcl_TranslateFilename()} -constraints { nt } -body { # if (Tcl_TranslateFileName(interp, string, # &utfDirString) == NULL) | | | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | string tolower [set x] } -result [string tolower [initialdir]] test winDialog-9.8 {Tk_ChooseDirectoryObjCmd: initial directory: Tcl_TranslateFilename()} -constraints { nt } -body { # if (Tcl_TranslateFileName(interp, string, # &utfDirString) == NULL) tk_chooseDirectory -initialdir ~12x/455 } -returnCodes error -result {user "12x" doesn't exist} test winDialog-10.1 {Tk_FontchooserObjCmd: no arguments} -constraints { nt testwinevent } -body { |
︙ | ︙ |
Changes to tests/winFont.test.
1 2 3 4 5 6 | # This file is a Tcl script to test out the procedures in tkWinFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # This file is a Tcl script to test out the procedures in tkWinFont.c. # It is organized in the standard fashion for Tcl tests. # # Many of these tests are visually oriented and cannot be checked # programmatically (such as "does an underlined font appear to be # underlined?"); these tests attempt to exercise the code in question, # but there are no results that can be checked. # # Copyright (c) 1996-1997 Sun Microsystems, Inc. # Copyright (c) 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* |
︙ | ︙ | |||
67 68 69 70 71 72 73 | win } -setup { set x {} } -body { lappend x [font actual {-family "Times"} -family] lappend x [font actual {-family "New York"} -family] lappend x [font actual {-family "Times New Roman"} -family] | | | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | win } -setup { set x {} } -body { lappend x [font actual {-family "Times"} -family] lappend x [font actual {-family "New York"} -family] lappend x [font actual {-family "Times New Roman"} -family] } -result {Times Times {Times New Roman}} test winfont-2.8 {TkpGetFontFromAttributes procedure: Courier fonts} -constraints { win } -setup { set x {} } -body { lappend x [font actual {-family "Courier"} -family] lappend x [font actual {-family "Monaco"} -family] lappend x [font actual {-family "Courier New"} -family] } -match regexp -result {Courier (Courier|Monaco) {Courier New}} test winfont-2.9 {TkpGetFontFromAttributes procedure: Helvetica fonts} -constraints { win } -setup { set x {} } -body { lappend x [font actual {-family "Helvetica"} -family] lappend x [font actual {-family "Geneva"} -family] lappend x [font actual {-family "Arial"} -family] } -match regexp -result {Helvetica (Helvetica|Geneva) Arial} test winfont-2.10 {TkpGetFontFromAttributes procedure: fallback} -constraints { win } -body { # No way to get it to fail! Any font name is acceptable. } -result {} |
︙ | ︙ | |||
137 138 139 140 141 142 143 | } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] | | | | | | | | | | | | | | | | | | | | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap 0 -text "000000" list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \ [expr {[winfo reqheight .t.l] eq $ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.2 {Tk_MeasureChars procedure: static width buffer exceeded} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap 100000 -text "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" list [expr {[winfo reqwidth .t.l] eq 256*$ax}] \ [expr {[winfo reqheight .t.l] eq $ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.3 {Tk_MeasureChars procedure: all chars did fit} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*10}] -text "00000000" list [expr {[winfo reqwidth .t.l] eq 8*$ax}] \ [expr {[winfo reqheight .t.l] eq $ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.4 {Tk_MeasureChars procedure: not all chars fit} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*6}] -text "00000000" list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \ [expr {[winfo reqheight .t.l] eq 2*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.5 {Tk_MeasureChars procedure: include last partial char} -constraints { win } -setup { destroy .t.c } -body { canvas .t.c -closeenough 0 set t [.t.c create text 0 0 -anchor nw -just left -font $courier] pack .t.c update .t.c dchars $t 0 end .t.c insert $t 0 "0000" .t.c index $t @[expr {int($cx*2.5)}],1 } -cleanup { destroy .t.c } -result {2} test winfont-5.6 {Tk_MeasureChars procedure: at least one char on line} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -text "000000" -wrap 1 list [expr {[winfo reqwidth .t.l] eq $ax}] \ [expr {[winfo reqheight .t.l] eq 6*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.7 {Tk_MeasureChars procedure: whole words} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*8}] -text "000000 0000" list [expr {[winfo reqwidth .t.l] eq 6*$ax}] \ [expr {[winfo reqheight .t.l] eq 2*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.8 {Tk_MeasureChars procedure: already saw space in line} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*12}] -text "000000 0000000" list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \ [expr {[winfo reqheight .t.l] eq 2*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.9 {Tk_MeasureChars procedure: internal spaces significant} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*12}] -text "000 00 00000" list [expr {[winfo reqwidth .t.l] eq 7*$ax}] \ [expr {[winfo reqheight .t.l] eq 2*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.10 {Tk_MeasureChars procedure: make first part of word fit} -constraints { win } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set ax [winfo reqwidth .t.l] set ay [winfo reqheight .t.l] .t.l config -wrap [expr {$ax*12}] -text "0000000000000000" list [expr {[winfo reqwidth .t.l] eq 12*$ax}] \ [expr {[winfo reqheight .t.l] eq 2*$ay}] } -cleanup { destroy .t.l } -result {1 1} test winfont-5.11 {Tk_MeasureChars procedure: check for kerning} -constraints { win nonPortable } -setup { destroy .t.l } -body { label .t.l -padx 0 -pady 0 -bd 0 -highlightthickness 0 -justify left \ -text "0" -font systemfixed pack .t.l update set font [.t.l cget -font] .t.l config -font {{MS Sans Serif} 8} -text "W" set width [winfo reqwidth .t.l] .t.l config -text "XaYoYaKaWx" set x [lindex [getsize] 0] .t.l config -font $font expr {$x < ($width*10)} } -cleanup { destroy .t.l } -result {1} test winfont-6.1 {Tk_DrawChars procedure: loop test} -constraints win -setup { destroy .t.l |
︙ | ︙ |
Changes to tests/winMenu.test.
︙ | ︙ | |||
477 478 479 480 481 482 483 | .m1 add command -command {error 1} -label "winMenu-11.2: Please select this menu item." list [.m1 post 40 40] [update] [set foo] [unset foo] [destroy .m1] } -result {{} {} {1 {1 while executing "error 1" (menu invoke)}} {} {}} | | | 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 | .m1 add command -command {error 1} -label "winMenu-11.2: Please select this menu item." list [.m1 post 40 40] [update] [set foo] [unset foo] [destroy .m1] } -result {{} {} {1 {1 while executing "error 1" (menu invoke)}} {} {}} # Can't test WM_MENUCHAR test winMenu-11.4 {TkWinHandleMenuEvent - WM_MEASUREITEM} -constraints { win userInteraction } -setup { destroy .m1 } -body { |
︙ | ︙ | |||
784 785 786 787 788 789 790 | test winMenu-22.1 {DrawMenuUnderline} -constraints win -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -underline 0 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] | | | 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 | test winMenu-22.1 {DrawMenuUnderline} -constraints win -setup { destroy .m1 } -body { menu .m1 .m1 add command -label foo -underline 0 set tearoff [tk::TearOffMenu .m1 40 40] list [update] [destroy .m1] } -result {{} {}} test winMenu-23.1 {Don't know how to test MenuKeyBindProc} -constraints { win emptyTest } -body {} |
︙ | ︙ | |||
1339 1340 1341 1342 1343 1344 1345 | menu .m1 -tearoff 0 .m1 add command -label one .m1 add command -label two -columnbreak 1 .m1 add command -label three .m1 add command -label four .m1 add command -label five -columnbreak 1 .m1 add command -label six | | | 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 | menu .m1 -tearoff 0 .m1 add command -label one .m1 add command -label two -columnbreak 1 .m1 add command -label three .m1 add command -label four .m1 add command -label five -columnbreak 1 .m1 add command -label six list [update idletasks] [destroy .m1] } -result {{} {}} test winMenu-33.1 {TkpNotifyTopLevelCreate - no menu yet} -constraints { win } -setup { destroy .m1 .t2 |
︙ | ︙ |
Changes to tests/winSend.test.
︙ | ︙ | |||
114 115 116 117 118 119 120 | } {a} test winSend-2.3 {Tk_SendObjCmd - sending to ourselves in a different interpreter} winSend { newApp testApp list [catch {send testApp {set foo b}} msg] $msg [interp delete testApp] } {0 b {}} test winSend-2.4 {Tk_SendObjCmd - sending to ourselves in a different interp with errors} winSend { newApp testApp | | | | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | } {a} test winSend-2.3 {Tk_SendObjCmd - sending to ourselves in a different interpreter} winSend { newApp testApp list [catch {send testApp {set foo b}} msg] $msg [interp delete testApp] } {0 b {}} test winSend-2.4 {Tk_SendObjCmd - sending to ourselves in a different interp with errors} winSend { newApp testApp list [catch {send testApp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo [interp delete testApp] } "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr {2 / 0}\"\n invoked from within\n\"send testApp {expr {2 / 0}}\"} {}" test winSend-2.5 {Tk_SendObjCmd - sending to another app async} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } |
︙ | ︙ | |||
141 142 143 144 145 146 147 | test winSend-2.7 {Tk_SendObjCmd - sending to another app - error} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } | | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | test winSend-2.7 {Tk_SendObjCmd - sending to another app - error} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } list [catch {send $interp {expr {2 / 0}}} msg] $msg $errorCode $errorInfo } "1 {divide by zero} {ARITH DIVZERO {divide by zero}} {divide by zero\n while executing\n\"expr {2 / 0}\"\n invoked from within\n\"send \$interp {expr {2 / 0}}\"}" test winSend-3.1 {TkGetInterpNames} winSend { set origLength [llength $currentInterps] set newLength [llength [winfo interps]] expr {($newLength - 2) == $origLength} } {1} |
︙ | ︙ | |||
166 167 168 169 170 171 172 | test winSend-5.1 {ExecuteRemoteObject - no error} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } | | | | 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | test winSend-5.1 {ExecuteRemoteObject - no error} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } list [send $interp {send [tk appname] {expr {2 / 1}}}] } {2} test winSend-5.2 {ExecuteRemoteObject - error} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } list [catch {send $interp {send [tk appname] {expr {2 / 0}}}} msg] $msg } {1 {divide by zero}} test winSend-6.1 {SendDDEServer - XTYP_CONNECT} winSend { set foo "Hello, World" set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { |
︙ | ︙ | |||
242 243 244 245 246 247 248 | set foo 3 set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } | | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | set foo 3 set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } set command "send [tk appname] {expr {$foo + 1}}" list [catch "send \{$interp\} \{$command\}" msg] $msg } {0 4} test winSend-6.7 {SendDDEServer - XTYP_EXECUTE} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break } } set command "send [tk appname] {expr {4 / 2}}" list [catch "send \{$interp\} \{$command\}" msg] $msg } {0 2} test winSend-6.8 {SendDDEServer - XTYP_WILDCONNECT} winSend { set newInterps [winfo interps] foreach interp $newInterps { if {[lsearch $currentInterps $interp] < 0} { break |
︙ | ︙ | |||
382 383 384 385 386 387 388 | } } send $interp {set foo winSend-10.17} list [catch {dde request Tk $interp foo} msg] $msg } {0 winSend-10.17} test winSend-10.18 {Tk_DDEObjCmd - services} winSend { set currentService [list Tk [tk appname]] | | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | } } send $interp {set foo winSend-10.17} list [catch {dde request Tk $interp foo} msg] $msg } {0 winSend-10.17} test winSend-10.18 {Tk_DDEObjCmd - services} winSend { set currentService [list Tk [tk appname]] list [catch {dde services Tk {}} msg] [expr {[lsearch $msg $currentService] >= 0}] } {0 1} # Get rid of the other app and all of its interps set newInterps [winfo interps] while {[llength $newInterps] != [llength $currentInterps]} { foreach interp $newInterps { |
︙ | ︙ |
Changes to tests/winWm.test.
︙ | ︙ | |||
241 242 243 244 245 246 247 | toplevel .t frame .t.f -width 150 -height 50 -background red pack .t.f wm geometry .t -0-0 update set y [winfo rooty .t] lappend result [winfo height .t] | | | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | toplevel .t frame .t.f -width 150 -height 50 -background red pack .t.f wm geometry .t -0-0 update set y [winfo rooty .t] lappend result [winfo height .t] menu .t.m -tearoff 1 .t configure -menu .t.m .t.m add command -label foo .t.m add command -label "thisisreallylong" .t.m add command -label "thisisreallylong" update lappend result [winfo height .t] lappend result [expr {$y - [winfo rooty .t]}] |
︙ | ︙ | |||
470 471 472 473 474 475 476 | toplevel $w pack [button $w.b -text "Do dialog" -command [list winwm90proc2 $w]] bind $w.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}} } global winwm90done set winwm90done wait toplevel .t | | | | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | toplevel $w pack [button $w.b -text "Do dialog" -command [list winwm90proc2 $w]] bind $w.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}} } global winwm90done set winwm90done wait toplevel .t } -body { pack [button .t.b -text "Show" -command {winwm90proc1 .tx}] bind .t.b <Map> {bind %W <Map> {}; after idle {winwm90click %W}} after 5000 {set winwm90done timeout} vwait winwm90done set winwm90done } -cleanup { foreach cmd {proc1 proc2 proc3 click} { rename winwm90$cmd {} } destroy .tx .t .sd } -result {ok} test winWm-9.1 "delayed activation of grabbed destroyed window" -constraints win -setup { proc winwm91click {w} { if {![winfo ismapped $w]} { update } event generate $w <Enter> focus -force $w event generate $w <ButtonPress-1> -x 5 -y 5 |
︙ | ︙ | |||
515 516 517 518 519 520 521 | pack [button $w.b -text "Do dialog" -command [list winwm91proc2 $w]] bind $w.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}} } destroy .t global winwm91done set winwm91done wait toplevel .t | | | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | pack [button $w.b -text "Do dialog" -command [list winwm91proc2 $w]] bind $w.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}} } destroy .t global winwm91done set winwm91done wait toplevel .t } -body { pack [button .t.b -text "Show" -command {winwm91proc1 .tx}] bind .t.b <Map> {bind %W <Map> {}; after idle {winwm91click %W}} after 5000 {set winwm91done timeout} vwait winwm91done set winwm91done } -cleanup { foreach cmd {proc1 proc2 proc3 click} { |
︙ | ︙ |
Changes to tests/winfo.test.
︙ | ︙ | |||
23 24 25 26 27 28 29 | destroy $w eval toplevel $w $options wm geom $w +0+0 canvas $w.c -width 400 -height 200 -bd 0 pack $w.c for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 40} {incr x} { | | | | | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | destroy $w eval toplevel $w $options wm geom $w +0+0 canvas $w.c -width 400 -height 200 -bd 0 pack $w.c for {set y 0} {$y < 8} {incr y} { for {set x 0} {$x < 40} {incr x} { set color [format #%02x%02x%02x [expr {$x*6}] [expr {$y*30}] 0] $w.c create rectangle [expr {10*$x}] [expr {20*$y}] \ [expr {10*$x + 10}] [expr {20*$y + 20}] -outline {} \ -fill $color } } update } # XXX - This test file is woefully incomplete. At present, only a |
︙ | ︙ | |||
152 153 154 155 156 157 158 | } -body { toplevel .t -width 550 -height 400 frame .t.f -width 80 -height 60 -bd 2 -relief raised place .t.f -x 50 -y 50 wm geom .t +0+0 update | | | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | } -body { toplevel .t -width 550 -height 400 frame .t.f -width 80 -height 60 -bd 2 -relief raised place .t.f -x 50 -y 50 wm geom .t +0+0 update winfo containing [expr {[winfo rootx .t.f]-1}] [expr {[winfo rooty .t.f]-1}] } -cleanup { destroy .t } -result .t test winfo-4.7 {"winfo containing" command} -setup { destroy .t } -body { toplevel .t -width 550 -height 400 frame .t.f -width 80 -height 60 -bd 2 -relief raised place .t.f -x 50 -y 50 wm geom .t +0+0 update set x [winfo containing -display .t.f [expr {[winfo rootx .t]+600}] \ [expr {[winfo rooty .t.f]+450}]] expr {($x == ".") || ($x == "")} } -cleanup { destroy .t } -result {1} test winfo-5.1 {"winfo interps" command} -body { |
︙ | ︙ | |||
360 361 362 363 364 365 366 | llength [lindex [winfo visualsa .] 0] } -result {2} test winfo-11.5 {"winfo visualid" command} -body { llength [lindex [winfo visualsa . includeids] 0] } -result {3} test winfo-11.6 {"winfo visualid" command} -body { set x [lindex [lindex [winfo visualsa . includeids] 0] 2] | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | llength [lindex [winfo visualsa .] 0] } -result {2} test winfo-11.5 {"winfo visualid" command} -body { llength [lindex [winfo visualsa . includeids] 0] } -result {3} test winfo-11.6 {"winfo visualid" command} -body { set x [lindex [lindex [winfo visualsa . includeids] 0] 2] expr {$x + 2 - $x} } -result {2} test winfo-12.1 {GetDisplayOf procedure} -body { winfo atom - foo x } -returnCodes error -result {wrong # args: should be "winfo atom ?-displayof window? name"} test winfo-12.2 {GetDisplayOf procedure} -body { |
︙ | ︙ | |||
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | list rootx [expr {[winfo rootx .emb] == [winfo rootx .con]}] \ rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}] } -cleanup { deleteWindows } -result {rootx 1 rooty 1} test winfo-13.2 {destroying embedded toplevel} -setup { deleteWindows } -body { frame .con -container 1 pack .con -expand yes -fill both toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0 button .emb.b pack .emb.b -expand yes -fill both update destroy .emb update list embedded [winfo exists .emb.b] container [winfo exists .con] } -cleanup { deleteWindows | > > > > > > > | | 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | list rootx [expr {[winfo rootx .emb] == [winfo rootx .con]}] \ rooty [expr {[winfo rooty .emb] == [winfo rooty .con]}] } -cleanup { deleteWindows } -result {rootx 1 rooty 1} # Windows does not destroy the container when an embedded window is # destroyed. Unix and macOS do destroy it. See ticket [67384bce7d]. if {[tk windowingsystem] == "win32"} { set result_13_2 {embedded 0 container 1} } else { set result_13_2 {embedded 0 container 0} } test winfo-13.2 {destroying embedded toplevel} -setup { deleteWindows } -body { frame .con -container 1 pack .con -expand yes -fill both toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0 button .emb.b pack .emb.b -expand yes -fill both update destroy .emb update list embedded [winfo exists .emb.b] container [winfo exists .con] } -cleanup { deleteWindows } -result $result_13_2 test winfo-13.3 {destroying container window} -setup { deleteWindows } -body { frame .con -container 1 pack .con -expand yes -fill both toplevel .emb -use [winfo id .con] -bd 0 -highlightthickness 0 |
︙ | ︙ |
Changes to tests/wm.test.
︙ | ︙ | |||
1515 1516 1517 1518 1519 1520 1521 | wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints x11 -body { toplevel .t | | | | | 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | wm stackorder . } -cleanup { destroy .t } -result {.t .} test wm-stackorder-5.2 {A normal toplevel can't be raised above an \ overrideredirect toplevel on unix} -constraints x11 -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 raise . update raiseDelay wm stackorder . isabove .t } -cleanup { destroy .t } -result 0 test wm-stackorder-5.2.1 {A normal toplevel can be raised above an \ overrideredirect toplevel on macOS or win} -constraints aquaOrWin32 -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 raise . update raiseDelay wm stackorder . isabove .t } -cleanup { destroy .t } -result 1 test wm-stackorder-5.3 {An overrideredirect window\ can be explicitly lowered} -body { toplevel .t tkwait visibility .t wm overrideredirect .t 1 lower .t update raiseDelay wm stackorder .t isbelow . } -cleanup { destroy .t |
︙ | ︙ | |||
1636 1637 1638 1639 1640 1641 1642 | deleteWindows } -result {can't make ".icon" a master: it is an icon for .top} test wm-transient-1.7 {usage} -returnCodes error -body { toplevel .master wm transient .master .master } -cleanup { deleteWindows | | > > > > > > > > > > | | 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 | deleteWindows } -result {can't make ".icon" a master: it is an icon for .top} test wm-transient-1.7 {usage} -returnCodes error -body { toplevel .master wm transient .master .master } -cleanup { deleteWindows } -result {setting ".master" as master creates a transient/master cycle} test wm-transient-1.8 {usage} -returnCodes error -body { toplevel .t1 toplevel .t2 toplevel .t3 wm transient .t2 .t1 wm transient .t3 .t2 wm transient .t1 .t3 } -cleanup { deleteWindows } -result {setting ".t3" as master creates a transient/master cycle} test wm-transient-1.9 {usage} -returnCodes error -body { toplevel .master frame .master.f wm transient .master .master.f } -cleanup { deleteWindows } -result {setting ".master" as master creates a transient/master cycle} test wm-transient-2.1 {basic get/set of master} -setup { set results [list] } -body { toplevel .master toplevel .subject lappend results [wm transient .subject] |
︙ | ︙ |
Changes to unix/Makefile.in.
︙ | ︙ | |||
91 92 93 94 95 96 97 | # Directory in which to install html documentation: HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR) # Directory in which to install the configuration file tkConfig.sh: CONFIG_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) # Directory in which to install the demo files: | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # Directory in which to install html documentation: HTML_INSTALL_DIR = $(INSTALL_ROOT)$(HTML_DIR) # Directory in which to install the configuration file tkConfig.sh: CONFIG_INSTALL_DIR = $(INSTALL_ROOT)$(libdir) # Directory in which to install the demo files: DEMO_INSTALL_DIR = $(INSTALL_ROOT)@DEMO_DIR@ # The directory containing the Tcl sources and headers appropriate # for this version of Tk ("srcdir" will be replaced or has already # been replaced by the configure script): TCL_GENERIC_DIR = @TCL_SRC_DIR@/generic # The directory containing the platform specific Tcl sources and headers |
︙ | ︙ | |||
183 184 185 186 187 188 189 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. | | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | # XStringToKeysym is plenty fast, so you needn't define REDO_KEYSYM_LOOKUP. KEYSYM_FLAGS = #KEYSYM_FLAGS = -DREDO_KEYSYM_LOOKUP # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # Some versions of make, like SGI's, use the following variable to # determine which shell to use for executing commands: SHELL = @SHELL@ # BUILD_TCLSH is the fully qualified path name of the tclsh shell # in the Tcl build directory. Test that need to be run in the |
︙ | ︙ | |||
223 224 225 226 227 228 229 | INSTALL = $(SHELL) $(UNIX_DIR)/install-sh -c INSTALL_PROGRAM = ${INSTALL} INSTALL_LIBRARY = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_DATA_DIR = ${INSTALL} -d -m 755 # The symbol below provides support for dynamic loading and shared | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | INSTALL = $(SHELL) $(UNIX_DIR)/install-sh -c INSTALL_PROGRAM = ${INSTALL} INSTALL_LIBRARY = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_DATA_DIR = ${INSTALL} -d -m 755 # The symbol below provides support for dynamic loading and shared # libraries. See configure.ac for a description of what it means. # The value of the symbol is normally set by the configure script. SHLIB_CFLAGS = @SHLIB_CFLAGS@ -DBUILD_tk # To enable support for stubs in Tcl. STUB_LIB_FILE = @TK_STUB_LIB_FILE@ |
︙ | ︙ | |||
262 263 264 265 266 267 268 | # Libraries to use when linking. This definition is determined by the # configure script. LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@ # The symbols below provide support for dynamic loading and shared | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | # Libraries to use when linking. This definition is determined by the # configure script. LIBS = @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ WISH_LIBS = $(TCL_LIB_SPEC) @LIBS@ $(X11_LIB_SWITCHES) @TCL_LIBS@ @EXTRA_WISH_LIBS@ # The symbols below provide support for dynamic loading and shared # libraries. See configure.ac for a description of what the # symbols mean. The values of the symbols are normally set by the # configure script. You shouldn't normally need to modify any of # these definitions by hand. STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ |
︙ | ︙ | |||
352 353 354 355 356 357 358 | tkPanedWindow.o tkScale.o tkScrollbar.o CANV_OBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvImg.o \ tkCanvLine.o tkCanvPoly.o tkCanvPs.o tkCanvText.o \ tkCanvUtil.o tkCanvWind.o tkRectOval.o tkTrig.o IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPNG.o tkImgPPM.o \ | | | | > | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 | tkPanedWindow.o tkScale.o tkScrollbar.o CANV_OBJS = tkCanvas.o tkCanvArc.o tkCanvBmap.o tkCanvImg.o \ tkCanvLine.o tkCanvPoly.o tkCanvPs.o tkCanvText.o \ tkCanvUtil.o tkCanvWind.o tkRectOval.o tkTrig.o IMAGE_OBJS = tkImage.o tkImgBmap.o tkImgGIF.o tkImgPNG.o tkImgPPM.o \ tkImgPhoto.o tkImgPhInstance.o tkImgListFormat.o tkImgSVGnano.o TEXT_OBJS = tkText.o tkTextBTree.o tkTextDisp.o tkTextImage.o tkTextIndex.o \ tkTextMark.o tkTextTag.o tkTextWind.o # either tkUnixFont.o (default) or tkUnixRFont.o (if --enable-xft) # FONT_OBJS = @UNIX_FONT_OBJS@ GENERIC_OBJS = tk3d.o tkArgv.o tkAtom.o tkBind.o tkBitmap.o tkBusy.o \ tkClipboard.o \ tkCmds.o tkColor.o tkConfig.o tkConsole.o tkCursor.o tkError.o \ tkEvent.o tkFocus.o tkFont.o tkGet.o tkGC.o tkGeometry.o tkGrab.o \ tkGrid.o tkMain.o tkObj.o tkOldConfig.o tkOption.o tkPack.o \ tkPkgConfig.o tkPlace.o tkSelect.o tkStyle.o tkUndo.o tkUtil.o \ tkVisual.o tkWindow.o TTK_OBJS = \ ttkBlink.o ttkButton.o ttkCache.o ttkClamTheme.o ttkClassicTheme.o \ ttkDefaultTheme.o ttkElements.o ttkEntry.o ttkFrame.o ttkImage.o \ ttkInit.o ttkLabel.o ttkLayout.o ttkManager.o ttkNotebook.o \ ttkPanedwindow.o ttkProgress.o ttkScale.o ttkScrollbar.o ttkScroll.o \ ttkSeparator.o ttkSquare.o ttkState.o \ |
︙ | ︙ | |||
391 392 393 394 395 396 397 | tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.o AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \ | | > | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | tkUnixMenubu.o tkUnixScale.o tkUnixScrlbr.o tkUnixSelect.o \ tkUnixSend.o tkUnixWm.o tkUnixXId.o AQUA_OBJS = tkMacOSXBitmap.o tkMacOSXButton.o tkMacOSXClipboard.o \ tkMacOSXColor.o tkMacOSXConfig.o tkMacOSXCursor.o tkMacOSXDebug.o \ tkMacOSXDialog.o tkMacOSXDraw.o tkMacOSXEmbed.o tkMacOSXEntry.o \ tkMacOSXEvent.o tkMacOSXFont.o tkMacOSXHLEvents.o tkMacOSXImage.o \ tkMacOSXInit.o tkMacOSXKeyboard.o tkMacOSXKeyEvent.o \ tkMacOSXMenu.o \ tkMacOSXMenubutton.o tkMacOSXMenus.o tkMacOSXMouseEvent.o \ tkMacOSXNotify.o tkMacOSXRegion.o tkMacOSXScrlbr.o tkMacOSXSend.o \ tkMacOSXServices.o tkMacOSXSubwindows.o tkMacOSXWindowEvent.o \ tkMacOSXWm.o tkMacOSXXStubs.o \ tkFileFilter.o tkMacWinMenu.o tkPointer.o tkUnix3d.o tkUnixScale.o \ xcolors.o xdraw.o xgc.o ximage.o xutil.o \ ttkMacOSXTheme.o AQUA_TKTEST_OBJS = tkMacOSXTest.o |
︙ | ︙ | |||
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | $(GENERIC_DIR)/tkError.c $(GENERIC_DIR)/tkEvent.c \ $(GENERIC_DIR)/tkFocus.c $(GENERIC_DIR)/tkFont.c \ $(GENERIC_DIR)/tkGet.c $(GENERIC_DIR)/tkGC.c \ $(GENERIC_DIR)/tkGeometry.c $(GENERIC_DIR)/tkGrab.c \ $(GENERIC_DIR)/tkGrid.c $(GENERIC_DIR)/tkConsole.c \ $(GENERIC_DIR)/tkMain.c $(GENERIC_DIR)/tkOption.c \ $(GENERIC_DIR)/tkPack.c $(GENERIC_DIR)/tkPlace.c \ $(GENERIC_DIR)/tkSelect.c $(GENERIC_DIR)/tkStyle.c \ $(GENERIC_DIR)/tkUndo.c $(GENERIC_DIR)/tkUtil.c \ $(GENERIC_DIR)/tkVisual.c $(GENERIC_DIR)/tkWindow.c \ $(GENERIC_DIR)/tkButton.c $(GENERIC_DIR)/tkObj.c \ $(GENERIC_DIR)/tkEntry.c $(GENERIC_DIR)/tkFrame.c \ $(GENERIC_DIR)/tkListbox.c $(GENERIC_DIR)/tkMenu.c \ $(GENERIC_DIR)/tkMenubutton.c $(GENERIC_DIR)/tkMenuDraw.c \ $(GENERIC_DIR)/tkMessage.c $(GENERIC_DIR)/tkPanedWindow.c \ $(GENERIC_DIR)/tkScale.c $(GENERIC_DIR)/tkScrollbar.c \ $(GENERIC_DIR)/tkCanvas.c $(GENERIC_DIR)/tkCanvArc.c \ $(GENERIC_DIR)/tkCanvBmap.c $(GENERIC_DIR)/tkCanvImg.c \ $(GENERIC_DIR)/tkCanvLine.c $(GENERIC_DIR)/tkCanvPoly.c \ $(GENERIC_DIR)/tkCanvPs.c $(GENERIC_DIR)/tkCanvText.c \ $(GENERIC_DIR)/tkCanvUtil.c \ $(GENERIC_DIR)/tkCanvWind.c $(GENERIC_DIR)/tkRectOval.c \ $(GENERIC_DIR)/tkTrig.c $(GENERIC_DIR)/tkImage.c \ $(GENERIC_DIR)/tkImgBmap.c $(GENERIC_DIR)/tkImgGIF.c \ $(GENERIC_DIR)/tkImgPNG.c $(GENERIC_DIR)/tkImgPPM.c \ $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \ | > > | | 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | $(GENERIC_DIR)/tkError.c $(GENERIC_DIR)/tkEvent.c \ $(GENERIC_DIR)/tkFocus.c $(GENERIC_DIR)/tkFont.c \ $(GENERIC_DIR)/tkGet.c $(GENERIC_DIR)/tkGC.c \ $(GENERIC_DIR)/tkGeometry.c $(GENERIC_DIR)/tkGrab.c \ $(GENERIC_DIR)/tkGrid.c $(GENERIC_DIR)/tkConsole.c \ $(GENERIC_DIR)/tkMain.c $(GENERIC_DIR)/tkOption.c \ $(GENERIC_DIR)/tkPack.c $(GENERIC_DIR)/tkPlace.c \ $(GENERIC_DIR)/tkPkgConfig.c \ $(GENERIC_DIR)/tkSelect.c $(GENERIC_DIR)/tkStyle.c \ $(GENERIC_DIR)/tkUndo.c $(GENERIC_DIR)/tkUtil.c \ $(GENERIC_DIR)/tkVisual.c $(GENERIC_DIR)/tkWindow.c \ $(GENERIC_DIR)/tkButton.c $(GENERIC_DIR)/tkObj.c \ $(GENERIC_DIR)/tkEntry.c $(GENERIC_DIR)/tkFrame.c \ $(GENERIC_DIR)/tkListbox.c $(GENERIC_DIR)/tkMenu.c \ $(GENERIC_DIR)/tkMenubutton.c $(GENERIC_DIR)/tkMenuDraw.c \ $(GENERIC_DIR)/tkMessage.c $(GENERIC_DIR)/tkPanedWindow.c \ $(GENERIC_DIR)/tkScale.c $(GENERIC_DIR)/tkScrollbar.c \ $(GENERIC_DIR)/tkCanvas.c $(GENERIC_DIR)/tkCanvArc.c \ $(GENERIC_DIR)/tkCanvBmap.c $(GENERIC_DIR)/tkCanvImg.c \ $(GENERIC_DIR)/tkCanvLine.c $(GENERIC_DIR)/tkCanvPoly.c \ $(GENERIC_DIR)/tkCanvPs.c $(GENERIC_DIR)/tkCanvText.c \ $(GENERIC_DIR)/tkCanvUtil.c \ $(GENERIC_DIR)/tkCanvWind.c $(GENERIC_DIR)/tkRectOval.c \ $(GENERIC_DIR)/tkTrig.c $(GENERIC_DIR)/tkImage.c \ $(GENERIC_DIR)/tkImgBmap.c $(GENERIC_DIR)/tkImgGIF.c \ $(GENERIC_DIR)/tkImgPNG.c $(GENERIC_DIR)/tkImgPPM.c \ $(GENERIC_DIR)/tkImgSVGnano.c $(GENERIC_DIR)/tkImgSVGnano.c \ $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhInstance.c \ $(GENERIC_DIR)/tkImgListFormat.c $(GENERIC_DIR)/tkText.c \ $(GENERIC_DIR)/tkTextBTree.c $(GENERIC_DIR)/tkTextDisp.c \ $(GENERIC_DIR)/tkTextImage.c \ $(GENERIC_DIR)/tkTextIndex.c $(GENERIC_DIR)/tkTextMark.c \ $(GENERIC_DIR)/tkTextTag.c $(GENERIC_DIR)/tkTextWind.c \ $(GENERIC_DIR)/tkOldConfig.c $(GENERIC_DIR)/tkOldTest.c \ $(GENERIC_DIR)/tkSquare.c $(GENERIC_DIR)/tkTest.c \ $(GENERIC_DIR)/tkStubInit.c |
︙ | ︙ | |||
517 518 519 520 521 522 523 | $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \ $(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \ $(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \ $(MAC_OSX_DIR)/tkMacOSXImage.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ | | > > | 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | $(MAC_OSX_DIR)/tkMacOSXConfig.c $(MAC_OSX_DIR)/tkMacOSXCursor.c \ $(MAC_OSX_DIR)/tkMacOSXDebug.c $(MAC_OSX_DIR)/tkMacOSXDialog.c \ $(MAC_OSX_DIR)/tkMacOSXDraw.c $(MAC_OSX_DIR)/tkMacOSXEmbed.c \ $(MAC_OSX_DIR)/tkMacOSXEntry.c $(MAC_OSX_DIR)/tkMacOSXEvent.c \ $(MAC_OSX_DIR)/tkMacOSXFont.c $(MAC_OSX_DIR)/tkMacOSXHLEvents.c \ $(MAC_OSX_DIR)/tkMacOSXImage.c \ $(MAC_OSX_DIR)/tkMacOSXInit.c $(MAC_OSX_DIR)/tkMacOSXKeyboard.c \ $(MAC_OSX_DIR)/tkMacOSXKeyEvent.c \ $(MAC_OSX_DIR)/tkMacOSXMenu.c \ $(MAC_OSX_DIR)/tkMacOSXMenubutton.c $(MAC_OSX_DIR)/tkMacOSXMenus.c \ $(MAC_OSX_DIR)/tkMacOSXMouseEvent.c $(MAC_OSX_DIR)/tkMacOSXNotify.c \ $(MAC_OSX_DIR)/tkMacOSXRegion.c $(MAC_OSX_DIR)/tkMacOSXScrlbr.c \ $(MAC_OSX_DIR)/tkMacOSXServices.c \ $(MAC_OSX_DIR)/tkMacOSXSend.c $(MAC_OSX_DIR)/tkMacOSXSubwindows.c \ $(MAC_OSX_DIR)/tkMacOSXTest.c $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c \ $(MAC_OSX_DIR)/tkMacOSXWm.c $(MAC_OSX_DIR)/tkMacOSXXStubs.c \ $(GENERIC_DIR)/tkFileFilter.c $(GENERIC_DIR)/tkMacWinMenu.c \ $(GENERIC_DIR)/tkPointer.c $(UNIX_DIR)/tkUnix3d.c \ $(UNIX_DIR)/tkUnixScale.c $(XLIB_DIR)/xcolors.c $(XLIB_DIR)/xdraw.c \ $(XLIB_DIR)/xgc.c $(XLIB_DIR)/ximage.c $(XLIB_DIR)/xutil.c \ |
︙ | ︙ | |||
720 721 722 723 724 725 726 | else true; \ fi; \ done; @if test "x$(TK_SHARED_BUILD)" = "x1"; then \ echo "Creating package index $(PKG_INDEX)"; \ rm -f "$(PKG_INDEX)"; \ (\ | | | 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 | else true; \ fi; \ done; @if test "x$(TK_SHARED_BUILD)" = "x1"; then \ echo "Creating package index $(PKG_INDEX)"; \ rm -f "$(PKG_INDEX)"; \ (\ echo "if {[catch {package present Tcl 8.6-}]} return";\ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\ if test "x$(DLL_INSTALL_DIR)" != "x$(BIN_INSTALL_DIR)"; then \ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}$(TK_LIB_FILE)]] Tk]";\ else \ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ echo " package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir $${relative}.. bin $(TK_LIB_FILE)]] Tk]";\ |
︙ | ︙ | |||
1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 | $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOldConfig.c tkOption.o: $(GENERIC_DIR)/tkOption.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOption.c tkPack.o: $(GENERIC_DIR)/tkPack.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPack.c tkPlace.o: $(GENERIC_DIR)/tkPlace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPlace.c tkSelect.o: $(GENERIC_DIR)/tkSelect.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkSelect.c | > > > > > > > > > > > > > > > > > > > > > > > > > > | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 | $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOldConfig.c tkOption.o: $(GENERIC_DIR)/tkOption.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkOption.c tkPack.o: $(GENERIC_DIR)/tkPack.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPack.c # TIP #59, embedding of configuration information into the binary library. # # Part of Tk's configuration information are the paths where it was installed # and where it will look for its libraries (which can be different). We derive # this information from the variables which can be overridden by the user. As # every path can be configured separately we do not remember one general # prefix/exec_prefix but all the different paths individually. tkPkgConfig.o: $(GENERIC_DIR)/tkPkgConfig.c $(CC) -c $(CC_SWITCHES) \ -DCFG_INSTALL_LIBDIR="\"$(LIB_INSTALL_DIR)\"" \ -DCFG_INSTALL_BINDIR="\"$(BIN_INSTALL_DIR)\"" \ -DCFG_INSTALL_SCRDIR="\"$(SCRIPT_INSTALL_DIR)\"" \ -DCFG_INSTALL_INCDIR="\"$(INCLUDE_INSTALL_DIR)\"" \ -DCFG_INSTALL_DOCDIR="\"$(MAN_INSTALL_DIR)\"" \ -DCFG_INSTALL_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ -DCFG_RUNTIME_LIBDIR="\"$(libdir)\"" \ -DCFG_RUNTIME_BINDIR="\"$(bindir)\"" \ -DCFG_RUNTIME_SCRDIR="\"$(TK_LIBRARY)\"" \ -DCFG_RUNTIME_INCDIR="\"$(includedir)\"" \ -DCFG_RUNTIME_DOCDIR="\"$(mandir)\"" \ -DCFG_RUNTIME_DEMODIR="\"$(DEMO_INSTALL_DIR)\"" \ \ $(GENERIC_DIR)/tkPkgConfig.c tkPlace.o: $(GENERIC_DIR)/tkPlace.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkPlace.c tkSelect.o: $(GENERIC_DIR)/tkSelect.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkSelect.c |
︙ | ︙ | |||
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 | tkImage.o: $(GENERIC_DIR)/tkImage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImage.c tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgBmap.c tkImgGIF.o: $(GENERIC_DIR)/tkImgGIF.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgGIF.c tkImgPNG.o: $(GENERIC_DIR)/tkImgPNG.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPNG.c tkImgPPM.o: $(GENERIC_DIR)/tkImgPPM.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPPM.c tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c | > > > > > > | 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | tkImage.o: $(GENERIC_DIR)/tkImage.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImage.c tkImgBmap.o: $(GENERIC_DIR)/tkImgBmap.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgBmap.c tkImgListFormat.o: $(GENERIC_DIR)/tkImgListFormat.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgListFormat.c tkImgGIF.o: $(GENERIC_DIR)/tkImgGIF.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgGIF.c tkImgPNG.o: $(GENERIC_DIR)/tkImgPNG.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPNG.c tkImgPPM.o: $(GENERIC_DIR)/tkImgPPM.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPPM.c tkImgSVGnano.o: $(GENERIC_DIR)/tkImgSVGnano.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgSVGnano.c tkImgPhoto.o: $(GENERIC_DIR)/tkImgPhoto.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhoto.c tkImgPhInstance.o: $(GENERIC_DIR)/tkImgPhInstance.c $(GENERIC_DIR)/tkImgPhoto.h $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tkImgPhInstance.c tkOldTest.o: $(GENERIC_DIR)/tkOldTest.c |
︙ | ︙ | |||
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 | tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScrlbr.c tkMacOSXSend.o: $(MAC_OSX_DIR)/tkMacOSXSend.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSend.c tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c tkMacOSXTest.o: $(MAC_OSX_DIR)/tkMacOSXTest.c $(CC) -c $(APP_CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c tkMacOSXWindowEvent.o: $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c | > > > | 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | tkMacOSXScrlbr.o: $(MAC_OSX_DIR)/tkMacOSXScrlbr.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXScrlbr.c tkMacOSXSend.o: $(MAC_OSX_DIR)/tkMacOSXSend.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSend.c tkMacOSXServices.o: $(MAC_OSX_DIR)/tkMacOSXServices.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXServices.c tkMacOSXSubwindows.o: $(MAC_OSX_DIR)/tkMacOSXSubwindows.c $(CC) -c $(CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXSubwindows.c tkMacOSXTest.o: $(MAC_OSX_DIR)/tkMacOSXTest.c $(CC) -c $(APP_CC_SWITCHES) $(MAC_OSX_DIR)/tkMacOSXTest.c tkMacOSXWindowEvent.o: $(MAC_OSX_DIR)/tkMacOSXWindowEvent.c |
︙ | ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | @echo "Warning: ttkStubInit.c may be out of date." @echo "Developers may want to run \"make genstubs\" to regenerate." @echo "This warning can be safely ignored, do not report as a bug!" genstubs: $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \ $(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls | | | 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 | @echo "Warning: ttkStubInit.c may be out of date." @echo "Developers may want to run \"make genstubs\" to regenerate." @echo "This warning can be safely ignored, do not report as a bug!" genstubs: $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(GENERIC_DIR) \ $(GENERIC_DIR)/tk.decls $(GENERIC_DIR)/tkInt.decls $(TCL_EXE) $(TOOL_DIR)/genStubs.tcl $(TTK_DIR) $(TTK_DIR)/ttk.decls # # Target to check that all exported functions have an entry in the stubs # tables. # checkstubs: $(TK_LIB_FILE) |
︙ | ︙ | |||
1528 1529 1530 1531 1532 1533 1534 | # DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) TCLDIR = @TCL_SRC_DIR@ | > > > | | | | | < | | | | | | | | | | | | | | | < > | | | | | | | | | | > | | | | | | | < < | | | | | | | | | | | | | | | | | | | | | | | | 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 | # DISTROOT = /tmp/dist DISTNAME = tk${VERSION}${PATCH_LEVEL} ZIPNAME = tk${MAJOR_VERSION}${MINOR_VERSION}${PATCH_LEVEL}-src.zip DISTDIR = $(DISTROOT)/$(DISTNAME) TCLDIR = @TCL_SRC_DIR@ DIST_INSTALL_DATA = CPPROG='cp -p' $(INSTALL) -m 644 DIST_INSTALL_SCRIPT = CPPROG='cp -p' $(INSTALL) -m 755 $(UNIX_DIR)/configure: $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tcl.m4 \ $(UNIX_DIR)/aclocal.m4 cd $(UNIX_DIR); autoconf $(MAC_OSX_DIR)/configure: $(MAC_OSX_DIR)/configure.ac $(UNIX_DIR)/configure cd $(MAC_OSX_DIR); autoconf $(UNIX_DIR)/tkConfig.h.in: $(MAC_OSX_DIR)/configure cd $(MAC_OSX_DIR); autoheader; touch $@ dist: $(UNIX_DIR)/configure $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(MAC_OSX_DIR)/configure genstubs rm -rf $(DISTDIR) $(INSTALL_DATA_DIR) $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(UNIX_DIR)/*.c $(UNIX_DIR)/*.h $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(UNIX_DIR)/Makefile.in $(DISTDIR)/unix $(DIST_INSTALL_DATA) $(UNIX_DIR)/configure.ac $(UNIX_DIR)/tk.spec \ $(UNIX_DIR)/aclocal.m4 $(UNIX_DIR)/tcl.m4 \ $(UNIX_DIR)/tkConfig.sh.in $(TCLDIR)/unix/install-sh \ $(UNIX_DIR)/README $(UNIX_DIR)/installManPage \ $(UNIX_DIR)/tkConfig.h.in $(UNIX_DIR)/tk.pc.in $(DISTDIR)/unix $(DIST_INSTALL_SCRIPT) $(UNIX_DIR)/configure $(DISTDIR)/unix $(INSTALL_DATA_DIR) $(DISTDIR)/bitmaps @(cd $(TOP_DIR); for i in bitmaps/* ; do \ if [ -f $$i ] ; then \ sed -e 's/static char/static unsigned char/' \ $$i > $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.[ch] $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/*.decls $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(GENERIC_DIR)/README $(DISTDIR)/generic $(DIST_INSTALL_DATA) $(TOP_DIR)/changes $(TOP_DIR)/ChangeLog \ $(TOP_DIR)/ChangeLog.2??? $(TOP_DIR)/README.md \ $(TOP_DIR)/license.terms $(DISTDIR) rm -f $(DISTDIR)/generic/blt*.[ch] $(INSTALL_DATA_DIR) $(DISTDIR)/generic/ttk $(DIST_INSTALL_DATA) $(TTK_DIR)/*.[ch] $(TTK_DIR)/ttk.decls \ $(DISTDIR)/generic/ttk $(INSTALL_DATA_DIR) $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/Makefile.in $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/configure.ac \ $(TOP_DIR)/win/tkConfig.sh.in \ $(TOP_DIR)/win/aclocal.m4 $(TOP_DIR)/win/tcl.m4 \ $(DISTDIR)/win $(DIST_INSTALL_SCRIPT) $(TOP_DIR)/win/configure $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.[ch] $(TOP_DIR)/win/*.bat $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/*.vc $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/win/README $(DISTDIR)/win $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/win $(INSTALL_DATA_DIR) $(DISTDIR)/win/rc $(DIST_INSTALL_DATA) $(TOP_DIR)/win/wish.exe.manifest.in $(DISTDIR)/win/ $(DIST_INSTALL_DATA) $(TOP_DIR)/win/rc/*.{rc,cur,ico,bmp} $(DISTDIR)/win/rc $(INSTALL_DATA_DIR) $(DISTDIR)/macosx $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/GNUmakefile $(MAC_OSX_DIR)/README \ $(MAC_OSX_DIR)/*.icns $(MAC_OSX_DIR)/*.tiff \ $(MAC_OSX_DIR)/*.[ch] $(MAC_OSX_DIR)/*.in \ $(MAC_OSX_DIR)/*.ac $(MAC_OSX_DIR)/*.xcconfig \ $(MAC_OSX_DIR)/*.sdef \ $(DISTDIR)/macosx $(DIST_INSTALL_SCRIPT) $(MAC_OSX_DIR)/configure $(DISTDIR)/macosx $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/macosx $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcode $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcode/project.pbxproj \ $(MAC_OSX_DIR)/Tk.xcode/default.pbxuser \ $(DISTDIR)/macosx/Tk.xcode $(INSTALL_DATA_DIR) $(DISTDIR)/macosx/Tk.xcodeproj $(DIST_INSTALL_DATA) $(MAC_OSX_DIR)/Tk.xcodeproj/project.pbxproj \ $(MAC_OSX_DIR)/Tk.xcodeproj/default.pbxuser \ $(DISTDIR)/macosx/Tk.xcodeproj $(INSTALL_DATA_DIR) $(DISTDIR)/compat $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/compat $(INSTALL_DATA_DIR) $(DISTDIR)/xlib $(DIST_INSTALL_DATA) $(XLIB_DIR)/*.[ch] $(DISTDIR)/xlib $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib $(INSTALL_DATA_DIR) $(DISTDIR)/xlib/X11 $(DIST_INSTALL_DATA) $(XLIB_DIR)/X11/*.h $(DISTDIR)/xlib/X11 $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(DISTDIR)/xlib/X11 $(INSTALL_DATA_DIR) $(DISTDIR)/library $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/library/*.tcl \ $(TOP_DIR)/library/tclIndex \ $(DISTDIR)/library $(INSTALL_DATA_DIR) $(DISTDIR)/library/ttk $(DIST_INSTALL_DATA) $(TOP_DIR)/library/ttk/*.tcl $(DISTDIR)/library/ttk $(INSTALL_DATA_DIR) $(DISTDIR)/library/images @(cd $(TOP_DIR); for i in library/images/* ; do \ if [ -f $$i ] ; then \ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/library/msgs @(cd $(TOP_DIR); for i in library/msgs/*.msg ; do \ if [ -f $$i ] ; then \ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/library/demos cp -pr $(TOP_DIR)/library/demos/*.tcl \ $(TOP_DIR)/library/demos/*.msg \ $(TOP_DIR)/library/demos/tclIndex \ $(TOP_DIR)/library/demos/browse \ $(TOP_DIR)/library/demos/hello $(TOP_DIR)/library/demos/ixset \ $(TOP_DIR)/library/demos/rmt $(TOP_DIR)/library/demos/rolodex \ $(TOP_DIR)/library/demos/square \ $(TOP_DIR)/library/demos/tcolor \ $(TOP_DIR)/library/demos/timer \ $(TOP_DIR)/library/demos/widget \ $(TOP_DIR)/library/demos/README \ $(TOP_DIR)/license.terms $(DISTDIR)/library/demos $(INSTALL_DATA_DIR) $(DISTDIR)/library/demos/images @(cd $(TOP_DIR); for i in library/demos/images/* ; do \ if [ -f $$i ] ; then \ $(DIST_INSTALL_DATA) $$i $(DISTDIR)/$$i; \ fi; \ done;) $(INSTALL_DATA_DIR) $(DISTDIR)/doc $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TOP_DIR)/doc/*.[13n] \ $(TCLDIR)/doc/man.macros $(DISTDIR)/doc $(INSTALL_DATA_DIR) $(DISTDIR)/tests $(DIST_INSTALL_DATA) $(TOP_DIR)/license.terms $(TEST_DIR)/*.{test,tcl} \ $(TEST_DIR)/README $(TEST_DIR)/*.{gif,png,ppm,xbm} \ $(TEST_DIR)/option.file* $(DISTDIR)/tests $(INSTALL_DATA_DIR) $(DISTDIR)/tests/ttk $(DIST_INSTALL_DATA) $(TEST_DIR)/ttk/*.{test,tcl} $(DISTDIR)/tests/ttk alldist: dist rm -f $(DISTROOT)/$(DISTNAME)-src.tar.gz $(DISTROOT)/$(ZIPNAME) cd $(DISTROOT); tar cf $(DISTNAME)-src.tar $(DISTNAME); \ gzip -9 $(DISTNAME)-src.tar; zip -qr8 $(ZIPNAME) $(DISTNAME) # |
︙ | ︙ |
Changes to unix/configure.
more than 10,000 changes
Added unix/configure.ac.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | #! /bin/bash -norc dnl This file is an input file used by the GNU "autoconf" program to dnl generate the file "configure", which is run during Tk installation dnl to configure the system for the local environment. AC_INIT([tk],[8.7]) AC_PREREQ(2.69) dnl This is only used when included from macosx/configure.ac m4_ifdef([SC_USE_CONFIG_HEADERS], [ AC_CONFIG_HEADERS([tkConfig.h:../unix/tkConfig.h.in]) AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TK_CONFIG_H -imacros tkConfig.h"]) AH_TOP([ #ifndef _TKCONFIG #define _TKCONFIG]) AH_BOTTOM([ /* Undef unused package specific autoheader defines so that we can * include both tclConfig.h and tkConfig.h at the same time: */ /* override */ #undef PACKAGE_NAME /* override */ #undef PACKAGE_STRING /* override */ #undef PACKAGE_TARNAME #endif /* _TKCONFIG */]) ]) TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a2" VERSION=${TK_VERSION} LOCALES="cs da de el en en_gb eo es fr hu it nl pl pt ru sv" #-------------------------------------------------------------------- # Find and load the tclConfig.sh file #-------------------------------------------------------------------- SC_PATH_TCLCONFIG SC_LOAD_TCLCONFIG if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MAJOR_VERSION}" -ne 8 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ Found config for Tcl ${TCL_VERSION}]) fi if test "${TCL_MINOR_VERSION}" -lt 6 ; then AC_MSG_ERROR([${PACKAGE_NAME} ${PACKAGE_VERSION} requires Tcl 8.6+ Found config for Tcl ${TCL_VERSION}]) fi fi SC_PROG_TCLSH SC_BUILD_TCLSH #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then prefix="$TCL_PREFIX" fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi # Make sure srcdir is fully qualified! srcdir="`cd "$srcdir" ; pwd`" TK_SRC_DIR="`cd "$srcdir"/..; pwd`" #------------------------------------------------------------------------ # Compress and/or soft link the manpages? #------------------------------------------------------------------------ SC_CONFIG_MANPAGES #------------------------------------------------------------------------ # Standard compiler checks #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_C_INLINE #------------------------------------------------------------------------ # If we're using GCC, see if the compiler understands -pipe. If so, use it. # It makes compiling go faster. (This is only a performance feature.) #------------------------------------------------------------------------ if test -z "$no_pipe" && test -n "$GCC"; then AC_CACHE_CHECK([if the compiler understands -pipe], tcl_cv_cc_pipe, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_pipe = yes; then CFLAGS="$CFLAGS -pipe" fi fi #------------------------------------------------------------------------ # Embedded configuration information, encoding to use for the values, TIP #59 #------------------------------------------------------------------------ SC_TCL_CFG_ENCODING SC_ENABLE_SHARED #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- SC_CONFIG_CFLAGS SC_ENABLE_SYMBOLS #-------------------------------------------------------------------- # Detect what compiler flags to set for 64-bit support. #-------------------------------------------------------------------- SC_TCL_EARLY_FLAGS SC_TCL_64BIT_FLAGS #-------------------------------------------------------------------- # Check endianness because we can optimize some operations #-------------------------------------------------------------------- AC_C_BIGENDIAN #------------------------------------------------------------------------ # If Tcl and Tk are installed in different places, adjust the library # search path to reflect this. #------------------------------------------------------------------------ LIB_RUNTIME_DIR='$(libdir)' if test "$TCL_EXEC_PREFIX" != "$exec_prefix"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${TCL_EXEC_PREFIX}/lib" fi if test "$TCL_PREFIX" != "$prefix"; then AC_MSG_WARN([ Different --prefix selected for Tk and Tcl! [[package require Tk]] may not work correctly in tclsh.]) fi #-------------------------------------------------------------------- # Include sys/select.h if it exists and if it supplies things # that appear to be useful and aren't already in sys/types.h. # This appears to be true only on the RS/6000 under AIX. Some # systems like OSF/1 have a sys/select.h that's of no use, and # other systems like SCO UNIX have a sys/select.h that's # pernicious. If "fd_set" isn't defined anywhere then set a # special flag. #-------------------------------------------------------------------- AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [ AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;], tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)]) tk_ok=$tcl_cv_type_fd_set if test $tk_ok = no; then AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [ AC_EGREP_HEADER(fd_mask, sys/select.h, tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)]) if test $tcl_cv_grep_fd_mask = present; then AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?]) tk_ok=yes fi fi if test $tk_ok = no; then AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?]) fi #------------------------------------------------------------------------------ # Find out all about time handling differences. #------------------------------------------------------------------------------ AC_CHECK_HEADERS(sys/time.h) AC_HEADER_TIME #-------------------------------------------------------------------- # Check for various typedefs and provide substitutes if # they don't exist. #-------------------------------------------------------------------- AC_TYPE_MODE_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T AC_CHECK_TYPE([intptr_t], [ AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [ AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [ for tcl_cv_intptr_t in "int" "long" "long long" none; do if test "$tcl_cv_intptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_intptr_t" != none; then AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer type wide enough to hold a pointer.]) fi ]) AC_CHECK_TYPE([uintptr_t], [ AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [ AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [ for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \ none; do if test "$tcl_cv_uintptr_t" != none; then AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT], [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])], [tcl_ok=yes], [tcl_ok=no]) test "$tcl_ok" = yes && break; fi done]) if test "$tcl_cv_uintptr_t" != none; then AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer type wide enough to hold a pointer.]) fi ]) #------------------------------------------- # In OS/390 struct pwd has no pw_gecos field #------------------------------------------- AC_CACHE_CHECK([pw_gecos in struct pwd], tcl_cv_pwd_pw_gecos, [ AC_TRY_COMPILE([#include <pwd.h>], [struct passwd pwd; pwd.pw_gecos;], tcl_cv_pwd_pw_gecos=yes, tcl_cv_pwd_pw_gecos=no)]) if test $tcl_cv_pwd_pw_gecos = yes; then AC_DEFINE(HAVE_PW_GECOS, 1, [Does struct password have a pw_gecos field?]) fi #-------------------------------------------------------------------- # On Mac OS X, we can build either with X11 or with Aqua #-------------------------------------------------------------------- if test "`uname -s`" = "Darwin" ; then AC_MSG_CHECKING([whether to use Aqua]) AC_ARG_ENABLE(aqua, AC_HELP_STRING([--enable-aqua=yes|no], [use Aqua windowingsystem on Mac OS X (default: no)]), [tk_aqua=$enableval], [tk_aqua=no]) if test $tk_aqua = yes -o $tk_aqua = cocoa; then tk_aqua=yes if test $tcl_corefoundation = no; then AC_MSG_WARN([Aqua can only be used when CoreFoundation is available]) tk_aqua=no fi if test ! -d /System/Library/Frameworks/Cocoa.framework; then AC_MSG_WARN([Aqua can only be used when Cocoa is available]) tk_aqua=no fi if test "`uname -r | awk -F. '{print [$]1}'`" -lt 9; then AC_MSG_WARN([Aqua requires Mac OS X 10.5 or later]) tk_aqua=no fi fi AC_MSG_RESULT([$tk_aqua]) if test "$fat_32_64" = yes; then if test $tk_aqua = no; then AC_CACHE_CHECK([for 64-bit X11], tcl_cv_lib_x11_64, [ for v in CFLAGS CPPFLAGS LDFLAGS; do eval 'hold_'$v'="$'$v'";'$v'="`echo "$'$v' "|sed -e "s/-arch ppc / /g" -e "s/-arch i386 / /g"`"' done CPPFLAGS="$CPPFLAGS -I/usr/X11R6/include" LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11" AC_TRY_LINK([#include <X11/Xlib.h>], [XrmInitialize();], tcl_cv_lib_x11_64=yes, tcl_cv_lib_x11_64=no) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="$hold_'$v'"' done]) fi # remove 64-bit arch flags from CFLAGS et al. for combined 32 & 64 bit # fat builds if configuration does not support 64-bit. if test "$tcl_cv_lib_x11_64" = no; then AC_MSG_NOTICE([Removing 64-bit architectures from compiler & linker flags]) for v in CFLAGS CPPFLAGS LDFLAGS; do eval $v'="`echo "$'$v' "|sed -e "s/-arch ppc64 / /g" -e "s/-arch x86_64 / /g"`"' done fi fi if test $tk_aqua = no; then # check if weak linking whole libraries is possible. AC_CACHE_CHECK([if ld accepts -weak-l flag], tcl_cv_ld_weak_l, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-weak-lm" AC_TRY_LINK([#include <math.h>], [double f = sin(1.0);], tcl_cv_ld_weak_l=yes, tcl_cv_ld_weak_l=no) LDFLAGS=$hold_ldflags]) fi AC_CHECK_HEADERS(AvailabilityMacros.h) if test "$ac_cv_header_AvailabilityMacros_h" = yes; then AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_LINK([ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 #endif int rand(void) __attribute__((weak_import)); ], [rand();], tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_weak_import = yes; then AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?]) fi AC_CACHE_CHECK([if Darwin SUSv3 extensions are available], tcl_cv_cc_darwin_c_source, [ hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" AC_TRY_COMPILE([ #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1050 #endif #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #error MAC_OS_X_VERSION_MIN_REQUIRED < 1050 #endif #define _DARWIN_C_SOURCE 1 #include <sys/cdefs.h> ],,tcl_cv_cc_darwin_c_source=yes, tcl_cv_cc_darwin_c_source=no) CFLAGS=$hold_cflags]) if test $tcl_cv_cc_darwin_c_source = yes; then AC_DEFINE(_DARWIN_C_SOURCE, 1, [Are Darwin SUSv3 extensions available?]) fi fi else tk_aqua=no fi if test $tk_aqua = yes; then AC_DEFINE(MAC_OSX_TK, 1, [Are we building TkAqua?]) LIBS="$LIBS -framework Cocoa -framework Carbon -framework IOKit" EXTRA_CC_SWITCHES='-std=gnu99 -x objective-c' TK_WINDOWINGSYSTEM=AQUA if test -n "${enable_symbols}" -a "${enable_symbols}" != no; then AC_DEFINE(TK_MAC_DEBUG, 1, [Are TkAqua debug messages enabled?]) fi else #-------------------------------------------------------------------- # Locate the X11 header files and the X11 library archive. Try # the ac_path_x macro first, but if it doesn't find the X stuff # (e.g. because there's no xmkmf program) then check through # a list of possible directories. Under some conditions the # autoconf macro will return an include directory that contains # no include files, so double-check its result just to be safe. #-------------------------------------------------------------------- SC_PATH_X TK_WINDOWINGSYSTEM=X11 fi #-------------------------------------------------------------------- # Various manipulations on the search path used at runtime to # find shared libraries: # 1. If the X library binaries are in a non-standard directory, # add the X library location into that search path. # 2. On systems such as AIX and Ultrix that use "-L" as the # search path option, colons cannot be used to separate # directories from each other. Change colons to " -L". # 3. Create two sets of search flags, one for use in cc lines # and the other for when the linker is invoked directly. In # the second case, '-Wl,' must be stripped off and commas must # be replaced by spaces. #-------------------------------------------------------------------- if test "x${x_libraries}" != "x"; then if test "x${x_libraries}" != "xNONE"; then LIB_RUNTIME_DIR="${LIB_RUNTIME_DIR}:${x_libraries}" fi fi if test "${TCL_LD_SEARCH_FLAGS}" = '-L${LIB_RUNTIME_DIR}'; then LIB_RUNTIME_DIR=`echo ${LIB_RUNTIME_DIR} |sed -e 's/:/ -L/g'` fi #-------------------------------------------------------------------- # Check for the existence of various libraries. The order here # is important, so that then end up in the right order in the # command line generated by make. The -lsocket and -lnsl libraries # require a couple of special tricks: # 1. Use "connect" and "accept" to check for -lsocket, and # "gethostbyname" to check for -lnsl. # 2. Use each function name only once: can't redo a check because # autoconf caches the results of the last check and won't redo it. # 3. Use -lnsl and -lsocket only if they supply procedures that # aren't already present in the normal libraries. This is because # IRIX 5.2 has libraries, but they aren't needed and they're # bogus: they goof up name resolution if used. # 4. On some SVR4 systems, can't use -lsocket without -lnsl too. # To get around this problem, check for both libraries together # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- if test $tk_aqua = no; then AC_CHECK_LIB(Xbsd, main, [LIBS="$LIBS -lXbsd"]) fi #-------------------------------------------------------------------- # One more check related to the X libraries. The standard releases # of Ultrix don't support the "xauth" mechanism, so send won't work # unless TK_NO_SECURITY is defined. However, there are usually copies # of the MIT X server available as well, which do support xauth. # Check for the MIT stuff and use it if it exists. # # Note: can't use ac_check_lib macro (at least, not in Autoconf 2.1) # because it can't deal with the "-" in the library name. #-------------------------------------------------------------------- if test -d /usr/include/mit -a $tk_aqua = no; then AC_MSG_CHECKING([MIT X libraries]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -I/usr/include/mit" tk_oldLibs=$LIBS LIBS="$LIBS -lX11-mit" AC_TRY_LINK([ #include <X11/Xlib.h> ], [ XOpenDisplay(0); ], [ AC_MSG_RESULT([yes]) XLIBSW="-lX11-mit" XINCLUDES="-I/usr/include/mit" ], AC_MSG_RESULT([no])) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check for freetype / fontconfig / Xft support. #-------------------------------------------------------------------- if test $tk_aqua = no; then AC_MSG_CHECKING([whether to use xft]) AC_ARG_ENABLE(xft, AC_HELP_STRING([--enable-xft], [use freetype/fontconfig/xft (default: on)]), [enable_xft=$enableval], [enable_xft="default"]) XFT_CFLAGS="" XFT_LIBS="" if test "$enable_xft" = "no" ; then AC_MSG_RESULT([$enable_xft]) else found_xft="yes" dnl make sure package configurator (xft-config or pkg-config dnl says that xft is present. XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no" XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no" if test "$found_xft" = "no" ; then found_xft=yes XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no" XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no" fi AC_MSG_RESULT([$found_xft]) dnl make sure that compiling against Xft header file doesn't bomb if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" AC_CHECK_HEADER(X11/Xft/Xft.h, [], [ found_xft=no ],[#include <X11/Xlib.h>]) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi dnl make sure that linking against Xft libraries finds freetype if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW" AC_CHECK_LIB(Xft, XftFontOpen, [], [ found_xft=no ]) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi dnl make sure that linking against fontconfig libraries finds Fc* symbols if test "$found_xft" = "yes" ; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES $XFT_CFLAGS" tk_oldLibs=$LIBS LIBS="$tk_oldLIBS $XFT_LIBS $XLIBSW -lfontconfig" AC_CHECK_LIB(fontconfig, FcFontSort, [ XFT_LIBS="$XFT_LIBS -lfontconfig" ], []) CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi dnl print a warning if xft is unusable and was specifically requested if test "$found_xft" = "no" ; then if test "$enable_xft" = "yes" ; then AC_MSG_WARN([Can't find xft configuration, or xft is unusable]) fi enable_xft=no XFT_CFLAGS="" XFT_LIBS="" else enable_xft=yes fi fi if test $enable_xft = "yes" ; then UNIX_FONT_OBJS=tkUnixRFont.o AC_DEFINE(HAVE_XFT, 1, [Have we turned on XFT (antialiased fonts)?]) else UNIX_FONT_OBJS=tkUnixFont.o fi AC_SUBST(XFT_CFLAGS) AC_SUBST(XFT_LIBS) AC_SUBST(UNIX_FONT_OBJS) fi #-------------------------------------------------------------------- # Check for XkbKeycodeToKeysym. #-------------------------------------------------------------------- if test $tk_aqua = no; then tk_oldCFlags=$CFLAGS tk_oldLibs=$LIBS CFLAGS="$CFLAGS $XINCLUDES" LIBS="$LIBS $XLIBSW" AC_CHECK_HEADER(X11/XKBlib.h, [ xkblib_header_found=yes ], [ xkblib_header_found=no ], [#include <X11/Xlib.h>]) if test $xkblib_header_found = "yes" ; then AC_CHECK_LIB(X11, XkbKeycodeToKeysym, [ xkbkeycodetokeysym_found=yes ], [ xkbkeycodetokeysym_found=no ]) else xkbkeycodetokeysym_found=no fi if test $xkbkeycodetokeysym_found = "yes" ; then AC_DEFINE(HAVE_XKBKEYCODETOKEYSYM, 1, [Do we have XkbKeycodeToKeysym?]) fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Check whether XKeycodeToKeysym is deprecated in X11 headers. #-------------------------------------------------------------------- if test $tk_aqua = no && test "$GCC" = yes; then AC_MSG_CHECKING([whether XKeycodeToKeysym is deprecated]) tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS -Werror" AC_TRY_LINK([ #include <X11/Xlib.h> ], [ XKeycodeToKeysym(0,0,0); ], [ AC_MSG_RESULT([no]) ], [ AC_MSG_RESULT([yes]) AC_DEFINE(XKEYCODETOKEYSYM_IS_DEPRECATED, 1, [Is XKeycodeToKeysym deprecated?]) ]) CFLAGS=$tk_oldCFlags fi #-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # # Check whether the header and library for the XScreenSaver # extension are available, and set HAVE_XSS if so. # XScreenSaver is needed for Tk_GetUserInactiveTime(). #-------------------------------------------------------------------- if test $tk_aqua = no; then tk_oldCFlags=$CFLAGS CFLAGS="$CFLAGS $XINCLUDES" tk_oldLibs=$LIBS LIBS="$tk_oldLibs $XLIBSW" xss_header_found=no xss_lib_found=no AC_MSG_CHECKING([whether to try to use XScreenSaver]) AC_ARG_ENABLE(xss, AC_HELP_STRING([--enable-xss], [use XScreenSaver for activity timer (default: on)]), [enable_xss=$enableval], [enable_xss=yes]) if test "$enable_xss" = "no" ; then AC_MSG_RESULT([$enable_xss]) else AC_MSG_RESULT([$enable_xss]) AC_CHECK_HEADER(X11/extensions/scrnsaver.h, [ xss_header_found=yes ],,[#include <X11/Xlib.h>]) AC_CHECK_FUNC(XScreenSaverQueryInfo,,[ AC_CHECK_LIB(Xext, XScreenSaverQueryInfo, [ XLIBSW="$XLIBSW -lXext" xss_lib_found=yes ], [ AC_CHECK_LIB(Xss, XScreenSaverQueryInfo, [ if test "$tcl_cv_ld_weak_l" = yes; then # On Darwin, weak link libXss if possible, # as it is only available on Tiger or later. XLIBSW="$XLIBSW -Wl,-weak-lXss -lXext" else XLIBSW="$XLIBSW -lXss -lXext" fi xss_lib_found=yes ],, -lXext) ]) ]) fi if test $enable_xss = yes -a $xss_lib_found = yes -a $xss_header_found = yes; then AC_DEFINE(HAVE_XSS, 1, [Is XScreenSaver available?]) fi CFLAGS=$tk_oldCFlags LIBS=$tk_oldLibs fi #-------------------------------------------------------------------- # Figure out whether "char" is unsigned. If so, set a # #define for __CHAR_UNSIGNED__. #-------------------------------------------------------------------- AC_C_CHAR_UNSIGNED #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}" eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}" eval "TK_LIB_FILE=libtk${LIB_SUFFIX}" # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed # since on some platforms TK_LIB_FILE contains shell escapes. eval "TK_LIB_FILE=${TK_LIB_FILE}" if test "${SHARED_BUILD}" = "1" -a "${SHLIB_SUFFIX}" != ""; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TCL_STUB_LIB_SPEC}" TCL_STUB_FLAGS="-DUSE_TCL_STUBS" fi TK_LIBRARY='$(prefix)/lib/tk$(VERSION)' PRIVATE_INCLUDE_DIR='$(includedir)' HTML_DIR='$(DISTDIR)/html' TK_PKG_DIR='tk$(VERSION)' TK_RSRC_FILE='tk$(VERSION).rsrc' WISH_RSRC_FILE='wish$(VERSION).rsrc' # Note: in the following variable, it's important to use the absolute # path name of the Tcl directory rather than "..": this is because # AIX remembers this path and will attempt to use it at run-time to look # up the Tcl library. if test "`uname -s`" = "Darwin" ; then SC_ENABLE_FRAMEWORK TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version ${TK_VERSION}`echo ${TK_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`" TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}/${TK_LIB_FILE}" -unexported_symbols_list $$(f=$(TK_LIB_FILE).E && nm -gp tkMacOSX*.o 2>/dev/null | awk "/^[[0-9a-f]]+ . \.objc/ {print \$$3}" > $$f && nm -gjp "$(TCL_BIN_DIR)"/$(TCL_STUB_LIB_FILE) | grep ^_[[^_]] >> $$f && echo $$f)' echo "$LDFLAGS " | grep -q -- '-prebind ' && TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -seg1addr 0xb000000' TK_SHLIB_LD_EXTRAS="${TK_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tk-Info.plist' EXTRA_WISH_LIBS='-sectcreate __TEXT __info_plist Wish-Info.plist' EXTRA_APP_CC_SWITCHES="${EXTRA_APP_CC_SWITCHES}"' -mdynamic-no-pic' AC_CONFIG_FILES([Tk-Info.plist:../macosx/Tk-Info.plist.in Wish-Info.plist:../macosx/Wish-Info.plist.in]) for l in ${LOCALES}; do CFBUNDLELOCALIZATIONS="${CFBUNDLELOCALIZATIONS}<string>$l</string>"; done TK_YEAR="`date +%Y`" fi if test "$FRAMEWORK_BUILD" = "1" ; then AC_DEFINE(TK_FRAMEWORK, 1, [Is Tk built as a framework?]) # Construct a fake local framework structure to make linking with # '-framework Tk' and running of tktest work AC_CONFIG_COMMANDS([Tk.framework], [n=Tk && f=$n.framework && v=Versions/$VERSION && rm -rf $f && mkdir -p $f/$v/Resources && ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v && ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist && if test $tk_aqua = yes; then ln -s ../../../../$n.rsrc $f/$v/Resources; fi && unset n f v ], VERSION=${TK_VERSION} && tk_aqua=${tk_aqua}) LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" if test "${libdir}" = '${exec_prefix}/lib'; then # override libdir default libdir="/Library/Frameworks" fi TK_LIB_FILE="Tk" TK_LIB_FLAG="-framework Tk" TK_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tk" TK_LIB_SPEC="-F${libdir} -framework Tk" libdir="${libdir}/Tk.framework/Versions/\${VERSION}" TK_LIBRARY="${libdir}/Resources/Scripts" TK_PKG_DIR="Resources/Scripts" TK_RSRC_FILE="Tk.rsrc" WISH_RSRC_FILE="Wish.rsrc" includedir="${libdir}/Headers" PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" HTML_DIR="${libdir}/Resources/Documentation/Reference/Tk" EXTRA_INSTALL="install-private-headers html-tk" EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TkTOC.html' EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tk-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"' if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Images to $(LIB_INSTALL_DIR)/Resources/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)/Resources" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)/Resources"; done' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing wish$(VERSION) script to $(INSTALL_ROOT)/'"${bindir}"'/" && $(INSTALL_DATA_DIR) "$(INSTALL_ROOT)/'"${bindir}"'" && printf > "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)" "#!/bin/sh\n\"\$$(dirname \$$0)'"`eval d="${bindir}"; echo "$d" | sed -e 's#/[^/][^/]*#/..#g'`"'$(bindir)/Wish\" \"\$$@\"" && chmod +x "$(INSTALL_ROOT)/'"${bindir}"'/wish$(VERSION)"' bindir="${libdir}/Resources/Wish.app/Contents/MacOS" EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Info.plist to $(BIN_INSTALL_DIR)/.." && $(INSTALL_DATA) Wish-Info.plist "$(BIN_INSTALL_DIR)/../Info.plist" && mv -f "$(BIN_INSTALL_DIR)/wish$(VERSION)" "$(BIN_INSTALL_DIR)/Wish"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.icns to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA_DIR) "$(BIN_INSTALL_DIR)/../Resources"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Tk.icns" "$(BIN_INSTALL_DIR)/../Resources/Wish.icns"' EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing Wish.sdef to $(BIN_INSTALL_DIR)/../Resources" && $(INSTALL_DATA) "$(MAC_OSX_DIR)/Wish.sdef" "$(BIN_INSTALL_DIR)/../Resources"' fi EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tk.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tkConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."' # Don't use AC_DEFINE for the following as the framework version define # needs to go into the Makefile even when using autoheader, so that we # can pick up a potential make override of VERSION. Also, don't put this # into CFLAGS as it should not go into tkConfig.sh EXTRA_CC_SWITCHES="$EXTRA_CC_SWITCHES"' -DTK_FRAMEWORK_VERSION=\"$(VERSION)\"' else if test $tk_aqua = yes; then EXTRA_INSTALL_BINARIES='@echo "Installing Images to $(LIB_INSTALL_DIR)/" && $(INSTALL_DATA_DIR) "$(LIB_INSTALL_DIR)" && for i in Tk.tiff Tk.icns; do $(INSTALL_DATA) "$(MAC_OSX_DIR)/$$i" "$(LIB_INSTALL_DIR)"; done' fi # libdir must be a fully qualified path and not ${exec_prefix}/lib eval libdir="$libdir" if test "${ac_cv_cygwin}" = "yes" -a "$SHARED_BUILD" = "1"; then TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" TK_BUILD_LIB_SPEC="-L\$(TOP_DIR)/win ${TK_LIB_FLAG}" else if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_LIB_FLAG="-ltk${TK_VERSION}" else TK_LIB_FLAG="-ltk`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_LIB_FLAG}" fi TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" fi #-------------------------------------------------------------------- # The statements below define various symbols relating to Tk # stub support. #-------------------------------------------------------------------- # Replace ${VERSION} with contents of ${TK_VERSION} eval "TK_STUB_LIB_FILE=libtkstub${TK_UNSHARED_LIB_SUFFIX}" eval "TK_STUB_LIB_DIR=${libdir}" if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then TK_STUB_LIB_FLAG="-ltkstub${TK_VERSION}" else TK_STUB_LIB_FLAG="-ltkstub`echo ${TK_VERSION} | tr -d .`" fi TK_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_SPEC="-L${TK_STUB_LIB_DIR} ${TK_STUB_LIB_FLAG}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" TK_STUB_LIB_PATH="${TK_STUB_LIB_DIR}/${TK_STUB_LIB_FILE}" # Install time header dir can be set via --includedir eval "TK_INCLUDE_SPEC=\"-I${includedir}\"" #------------------------------------------------------------------------ # Demo dir #------------------------------------------------------------------------ AS_IF([test x"${DEMO_DIR}" = x], [DEMO_DIR='$(TK_LIBRARY)/demos']) eval "TK_DEMO_DIR=\"`echo ${DEMO_DIR} | tr '()' '{}'`\"" eval "TK_DEMO_DIR=\"`echo ${TK_DEMO_DIR} | tr '()' '{}'`\"" AC_SUBST(DEMO_DIR) AC_SUBST(TK_DEMO_DIR) #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_YEAR) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_PATH) AC_SUBST(TK_INCLUDE_SPEC) AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_BUILD_STUB_LIB_PATH) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LD_LIBRARY_PATH_VAR) AC_SUBST(TK_BUILD_LIB_SPEC) AC_SUBST(TCL_STUB_FLAGS) AC_SUBST(XINCLUDES) AC_SUBST(XLIBSW) AC_SUBST(LOCALES) AC_SUBST(TK_WINDOWINGSYSTEM) AC_SUBST(TK_PKG_DIR) AC_SUBST(TK_LIBRARY) AC_SUBST(LIB_RUNTIME_DIR) AC_SUBST(PRIVATE_INCLUDE_DIR) AC_SUBST(HTML_DIR) AC_SUBST(EXTRA_CC_SWITCHES) AC_SUBST(EXTRA_APP_CC_SWITCHES) AC_SUBST(EXTRA_INSTALL) AC_SUBST(EXTRA_INSTALL_BINARIES) AC_SUBST(EXTRA_BUILD_HTML) AC_SUBST(EXTRA_WISH_LIBS) AC_SUBST(CFBUNDLELOCALIZATIONS) AC_SUBST(TK_RSRC_FILE) AC_SUBST(WISH_RSRC_FILE) AC_SUBST(LIB_RSRC_FILE) AC_SUBST(APP_RSRC_FILE) AC_SUBST(REZ) AC_SUBST(REZ_FLAGS) AC_CONFIG_FILES([ Makefile:../unix/Makefile.in tkConfig.sh:../unix/tkConfig.sh.in tk.pc:../unix/tk.pc.in ]) AC_OUTPUT dnl Local Variables: dnl mode: autoconf dnl End: |
Deleted unix/configure.in.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to unix/tcl.m4.
︙ | ︙ | |||
92 93 94 95 96 97 98 | `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tcl8.7 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tcl8.7 2>/dev/null` \ ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
225 226 227 228 229 230 231 | `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ | | | | 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | `ls -d ${exec_prefix}/lib 2>/dev/null` \ `ls -d ${prefix}/lib 2>/dev/null` \ `ls -d /usr/local/lib 2>/dev/null` \ `ls -d /usr/contrib/lib 2>/dev/null` \ `ls -d /usr/pkg/lib 2>/dev/null` \ `ls -d /usr/lib 2>/dev/null` \ `ls -d /usr/lib64 2>/dev/null` \ `ls -d /usr/local/lib/tk8.7 2>/dev/null` \ `ls -d /usr/local/lib/tcl/tk8.7 2>/dev/null` \ ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig="`(cd $i; pwd)`" break fi done fi |
︙ | ︙ | |||
543 544 545 546 547 548 549 550 551 552 553 554 555 556 | AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi ]) #------------------------------------------------------------------------ # SC_ENABLE_FRAMEWORK -- # # Allows the building of shared libraries into frameworks # | > | 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 | AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi AC_SUBST(SHARED_BUILD) ]) #------------------------------------------------------------------------ # SC_ENABLE_FRAMEWORK -- # # Allows the building of shared libraries into frameworks # |
︙ | ︙ | |||
593 594 595 596 597 598 599 | AC_MSG_RESULT([static library]) fi FRAMEWORK_BUILD=0 fi fi ]) | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | AC_MSG_RESULT([static library]) fi FRAMEWORK_BUILD=0 fi fi ]) #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # # Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging # can also be enabled. # |
︙ | ︙ | |||
892 893 894 895 896 897 898 | ]) #-------------------------------------------------------------------- # SC_CONFIG_SYSTEM # # Determine what the system is (some things cannot be easily checked # on a feature-driven basis, alas). This can usually be done via the | | < < | | < < < < < < | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | ]) #-------------------------------------------------------------------- # SC_CONFIG_SYSTEM # # Determine what the system is (some things cannot be easily checked # on a feature-driven basis, alas). This can usually be done via the # "uname" command. # # Arguments: # none # # Results: # Defines the following var: # # system - System/platform/version identification code. #-------------------------------------------------------------------- AC_DEFUN([SC_CONFIG_SYSTEM], [ AC_CACHE_CHECK([system version], tcl_cv_sys_version, [ if test "${TEA_PLATFORM}" = "windows" ; then tcl_cv_sys_version=windows else tcl_cv_sys_version=`uname -s`-`uname -r` if test "$?" -ne 0 ; then AC_MSG_WARN([can't find uname command]) tcl_cv_sys_version=unknown else if test "`uname -s`" = "AIX" ; then tcl_cv_sys_version=AIX-`uname -v`.`uname -r` fi fi fi ]) system=$tcl_cv_sys_version |
︙ | ︙ | |||
980 981 982 983 984 985 986 | # into a shared library. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build # shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 | # into a shared library. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build # shared libraries. The value of the symbol defaults to # "${LIBS}" if all of the dependent libraries should # be specified when creating a shared library. If # dependent libraries should not be specified (as on some # SunOS systems, where they cause the link to fail, or in # general if Tcl and Tk aren't themselves shared # libraries), then this symbol has an empty string # as its value. # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. # TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS |
︙ | ︙ | |||
1096 1097 1098 1099 1100 1101 1102 | UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 | | | | | 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`' ECHO_VERSION='`echo ${VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g AS_IF([test "$GCC" = yes], [ CFLAGS_OPTIMIZE=-O2 CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" ], [ CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" ]) AC_CHECK_TOOL(AR, ar) STLIB_LD='${AR} cr' LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" PLAT_OBJS="" PLAT_SRCS="" LDAIX_SRC="" AS_IF([test "x${SHLIB_VERSION}" = x], [SHLIB_VERSION="1.0"]) case $system in AIX-*) AS_IF([test "$GCC" != "yes"], [ # AIX requires the _r compiler when gcc isn't being used case "${CC}" in *_r|*_r\ *) # ok ... ;; *) # Make sure only first arg gets _r |
︙ | ︙ | |||
1205 1206 1207 1208 1209 1210 1211 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; | | | 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 | SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="$LDFLAGS -export-dynamic" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; CYGWIN_*) SHLIB_CFLAGS="" SHLIB_LD='${CC} -shared' SHLIB_SUFFIX=".dll" DL_OBJS="tclLoadDl.o" PLAT_OBJS='${CYGWIN_OBJS}' PLAT_SRCS='${CYGWIN_SRCS}' DL_LIBS="-ldl" |
︙ | ︙ | |||
1231 1232 1233 1234 1235 1236 1237 | ], [], ac_cv_cygwin=no, ac_cv_cygwin=yes) ) if test "$ac_cv_cygwin" = "no"; then AC_MSG_ERROR([${CC} is not a cygwin compiler.]) fi | < < < | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 | ], [], ac_cv_cygwin=no, ac_cv_cygwin=yes) ) if test "$ac_cv_cygwin" = "no"; then AC_MSG_ERROR([${CC} is not a cygwin compiler.]) fi do64bit_ok=yes if test "x${SHARED_BUILD}" = "x1"; then echo "running cd ../win; ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args" # The eval makes quoting arguments work. if cd ../win; eval ${CONFIG_SHELL-/bin/sh} ./configure $ac_configure_args; cd ../unix then : else |
︙ | ︙ | |||
1424 1425 1426 1427 1428 1429 1430 | AS_IF([test $tcl_cv_cc_m64 = yes], [ CFLAGS="$CFLAGS -m64" do64bit_ok=yes ]) ]) # The combo of gcc + glibc has a bug related to inlining of | | < < < < < < < < < < < < < < < < < < < < < | < | | | | < < | | | | < < | | | | | 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 | AS_IF([test $tcl_cv_cc_m64 = yes], [ CFLAGS="$CFLAGS -m64" do64bit_ok=yes ]) ]) # The combo of gcc + glibc has a bug related to inlining of # functions like strtol()/strtoul(). The -fno-builtin flag should address # this problem but it does not work. The -fno-inline flag is kind # of overkill but it works. Disable inlining only when one of the # files in compat/*.c is being linked in. AS_IF([test x"${USE_COMPAT}" != x],[CFLAGS="$CFLAGS -fno-inline"]) ;; Lynx*) SHLIB_CFLAGS="-fPIC" SHLIB_SUFFIX=".so" CFLAGS_OPTIMIZE=-02 SHLIB_LD='${CC} -shared' DL_OBJS="tclLoadDl.o" DL_LIBS="-mshared -ldl" LD_FLAGS="-Wl,--export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) ;; OpenBSD-*) arch=`arch -s` case "$arch" in alpha|sparc64) SHLIB_CFLAGS="-fPIC" ;; *) SHLIB_CFLAGS="-fpic" ;; esac SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.${SHLIB_VERSION}' LDFLAGS="-Wl,-export-dynamic" CFLAGS_OPTIMIZE="-O2" # On OpenBSD: Compile with -pthread # Don't link with -lpthread LIBS=`echo $LIBS | sed s/-lpthread//` CFLAGS="$CFLAGS -pthread" # OpenBSD doesn't do version numbers with dots. UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; NetBSD-*) # NetBSD has ELF and can use 'cc -shared' to build shared libs SHLIB_CFLAGS="-fPIC" SHLIB_LD='${CC} ${SHLIB_CFLAGS} -shared' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="$LDFLAGS -export-dynamic" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # The -pthread needs to go in the CFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ;; DragonFly-*|FreeBSD-*) # This configuration from FreeBSD Ports. SHLIB_CFLAGS="-fPIC" SHLIB_LD="${CC} -shared" SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -Wl,-soname,\$[@]" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}']) # The -pthread needs to go in the LDFLAGS, not LIBS LIBS=`echo $LIBS | sed s/-pthread//` CFLAGS="$CFLAGS $PTHREAD_CFLAGS" LDFLAGS="$LDFLAGS $PTHREAD_LIBS" case $system in FreeBSD-3.*) # Version numbers are dot-stripped by system policy. TCL_TRIM_DOTS=`echo ${VERSION} | tr -d .` UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots |
︙ | ︙ | |||
1598 1599 1600 1601 1602 1603 1604 | LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" | < < < < | 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 | LDFLAGS=$hold_ldflags]) AS_IF([test $tcl_cv_ld_single_module = yes], [ SHLIB_LD="${SHLIB_LD} -Wl,-single_module" ]) SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" LDFLAGS="$LDFLAGS -headerpad_max_install_names" AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [ hold_ldflags=$LDFLAGS LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no) |
︙ | ︙ | |||
1677 1678 1679 1680 1681 1682 1683 | AC_DEFINE(NO_COREFOUNDATION_64, 1, [Is Darwin CoreFoundation unavailable for 64-bit?]) LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" ]) ]) ]) ;; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | | | | < | 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 | AC_DEFINE(NO_COREFOUNDATION_64, 1, [Is Darwin CoreFoundation unavailable for 64-bit?]) LDFLAGS="$LDFLAGS -Wl,-no_arch_warnings" ]) ]) ]) ;; OS/390-*) SHLIB_LD_LIBS="" CFLAGS_OPTIMIZE="" # Optimizer is buggy AC_DEFINE(_OE_SOCKETS, 1, # needed in sys/socket.h [Should OS/390 do the right thing with sockets?]) ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" AS_IF([test "$SHARED_BUILD" = 1], [ SHLIB_LD='ld -shared -expect_unresolved "*"' ], [ SHLIB_LD='ld -non_shared -expect_unresolved "*"' ]) SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" AS_IF([test $doRpath = yes], [ CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}']) AS_IF([test "$GCC" = yes], [CFLAGS="$CFLAGS -mieee"], [ CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"]) # see pthread_intro(3) for pthread support on osf1, k.furukawa CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` AS_IF([test "$GCC" = yes], [ LIBS="$LIBS -lpthread -lmach -lexc" ], [ CFLAGS="$CFLAGS -pthread" LDFLAGS="$LDFLAGS -pthread" ]) ;; QNX-6*) # QNX RTP # This may work for all QNX, but it was only reported for v6. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" |
︙ | ︙ | |||
1779 1780 1781 1782 1783 1784 1785 | SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 | SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-5.[[0-6]]) # Careful to not let 5.10+ fall into this case # Note: If _REENTRANT isn't defined, then Solaris # won't define thread-safe library routines. AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?]) |
︙ | ︙ | |||
2006 2007 2008 2009 2010 2011 2012 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; | | | 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 | # libraries to the right flags for gcc, instead of those for the # standard manufacturer compiler. AS_IF([test "$DL_OBJS" != "tclLoadNone.o" -a "$GCC" = yes], [ case $system in AIX-*) ;; BSD/OS*) ;; CYGWIN_*) ;; IRIX*) ;; NetBSD-*|DragonFly-*|FreeBSD-*|OpenBSD-*) ;; Darwin-*) ;; SCO_SV-3.2*) ;; *) SHLIB_CFLAGS="-fPIC" ;; esac]) |
︙ | ︙ | |||
2122 2123 2124 2125 2126 2127 2128 | ]) #-------------------------------------------------------------------- # SC_MISSING_POSIX_HEADERS # # Supply substitutes for missing POSIX header files. Special # notes: | | | < | 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 | ]) #-------------------------------------------------------------------- # SC_MISSING_POSIX_HEADERS # # Supply substitutes for missing POSIX header files. Special # notes: # - stdlib.h doesn't define strtol or strtoul in some # versions of SunOS # - some versions of string.h don't declare procedures such # as strstr # # Arguments: # none # # Results: # # Defines some of the following vars: # NO_DIRENT_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H # HAVE_SYS_PARAM_H # # HAVE_STRING_H ? |
︙ | ︙ | |||
2172 2173 2174 2175 2176 2177 2178 | closedir(d); ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)]) if test $tcl_cv_dirent_h = no; then AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?]) fi | < < < | 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 | closedir(d); ], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no)]) if test $tcl_cv_dirent_h = no; then AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?]) fi AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) if test $tcl_ok = 0; then AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?]) fi AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0) AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0) |
︙ | ︙ | |||
2316 2317 2318 2319 2320 2321 2322 | SC_CONFIG_SYSTEM AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) case $system in OSF*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; | < < < < | 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 | SC_CONFIG_SYSTEM AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O]) case $system in OSF*) AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?]) AC_MSG_RESULT([FIONBIO]) ;; *) AC_MSG_RESULT([O_NONBLOCK]) ;; esac ]) #-------------------------------------------------------------------- |
︙ | ︙ | |||
2398 2399 2400 2401 2402 2403 2404 | ]) #-------------------------------------------------------------------- # SC_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. | | > > > > > > > | 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 | ]) #-------------------------------------------------------------------- # SC_TCL_LINK_LIBS # # Search for the libraries needed to link the Tcl shell. # Things like the math library (-lm) and socket stuff (-lsocket vs. # -lnsl) or thread library (-lpthread) are dealt with here. # # Arguments: # None. # # Results: # # Sets the following vars: # THREADS_LIBS Thread library(s) # # Defines the following vars: # _REENTRANT # _THREAD_SAFE # # Might append to the following vars: # LIBS # MATH_LIBS # # Might define the following vars: # HAVE_NET_ERRNO_H |
︙ | ︙ | |||
2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 | if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"])]) ]) #-------------------------------------------------------------------- # SC_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 | if test "$tcl_checkBoth" = 1; then tk_oldLibs=$LIBS LIBS="$LIBS -lsocket -lnsl" AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) fi AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"])]) AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?]) AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?]) AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then # Check a little harder for __pthread_mutex_init in the same # library, as some systems hide it there until pthread.h is # defined. We could alternatively do an AC_TRY_COMPILE with # pthread.h, but that will work with libpthread really doesn't # exist, like AIX 4.2. [Bug: 4359] AC_CHECK_LIB(pthread, __pthread_mutex_init, tcl_ok=yes, tcl_ok=no) fi if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthread" else AC_CHECK_LIB(pthreads, pthread_mutex_init, _ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -lpthreads" else AC_CHECK_LIB(c, pthread_mutex_init, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "no"; then AC_CHECK_LIB(c_r, pthread_mutex_init, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = "yes"; then # The space is needed THREADS_LIBS=" -pthread" else AC_MSG_WARN([Don't know how to find pthread lib on your system - you must edit the LIBS in the Makefile...]) fi fi fi fi # Does the pthread-implementation provide # 'pthread_attr_setstacksize' ? ac_saved_libs=$LIBS LIBS="$LIBS $THREADS_LIBS" AC_CHECK_FUNCS(pthread_attr_setstacksize pthread_atfork) LIBS=$ac_saved_libs # TIP #509 AC_CHECK_DECLS([PTHREAD_MUTEX_RECURSIVE],tcl_ok=yes,tcl_ok=no, [[#include <pthread.h>]]) ]) #-------------------------------------------------------------------- # SC_TCL_EARLY_FLAGS # # Check for what flags are needed to be passed so the correct OS # features are available. |
︙ | ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") | | | | | 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 | AC_DEFUN([SC_TCL_64BIT_FLAGS], [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ tcl_cv_type_64bit=none # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], tcl_type_64bit=__int64, tcl_type_64bit="long long") # See if we could use long anyway Note that we substitute in the # type that is our current guess for a 64-bit type inside this check # program, so it should be modified only carefully... AC_TRY_COMPILE(,[switch (0) { case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Do 'long' and 'long long' have the same size (64-bit)?]) AC_MSG_RESULT([yes]) else AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}, [What type should be used to define wide integers?]) AC_MSG_RESULT([${tcl_cv_type_64bit}]) # Now check for auxiliary declarations AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[ |
︙ | ︙ | |||
3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 | if test "x$NEED_FAKE_RFC2553" = "x1"; then AC_DEFINE([NEED_FAKE_RFC2553], 1, [Use compat implementation of getaddrinfo() and friends]) AC_LIBOBJ([fake-rfc2553]) AC_CHECK_FUNC(strlcpy) fi ]) # Local Variables: # mode: autoconf # End: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 | if test "x$NEED_FAKE_RFC2553" = "x1"; then AC_DEFINE([NEED_FAKE_RFC2553], 1, [Use compat implementation of getaddrinfo() and friends]) AC_LIBOBJ([fake-rfc2553]) AC_CHECK_FUNC(strlcpy) fi ]) #------------------------------------------------------------------------ # SC_CC_FOR_BUILD # For cross compiles, locate a C compiler that can generate native binaries. # # Arguments: # none # # Results: # Substitutes the following vars: # CC_FOR_BUILD # EXEEXT_FOR_BUILD #------------------------------------------------------------------------ dnl Get a default for CC_FOR_BUILD to put into Makefile. AC_DEFUN([AX_CC_FOR_BUILD],[# Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' else AC_MSG_CHECKING([for gcc]) AC_CACHE_VAL(ac_cv_path_cc, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/gcc 2> /dev/null` \ `ls -r $dir/gcc 2> /dev/null` ; do if test x"$ac_cv_path_cc" = x ; then if test -f "$j" ; then ac_cv_path_cc=$j break fi fi done done ]) fi fi AC_SUBST(CC_FOR_BUILD) # Also set EXEEXT_FOR_BUILD. if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' OBJEXT_FOR_BUILD='$(OBJEXT)' else OBJEXT_FOR_BUILD='.no' AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, [rm -f conftest* echo 'int main () { return 0; }' > conftest.c bfd_cv_build_exeext= ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; esac done rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi AC_SUBST(EXEEXT_FOR_BUILD)])dnl AC_SUBST(OBJEXT_FOR_BUILD)])dnl ]) #------------------------------------------------------------------------ # SC_ZIPFS_SUPPORT # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: # ZIP_PROG # ZIP_PROG_OPTIONS # ZIP_PROG_VFSSEARCH # ZIP_INSTALL_OBJS #------------------------------------------------------------------------ AC_DEFUN([SC_ZIPFS_SUPPORT], [ ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" AC_MSG_CHECKING([for zip]) AC_CACHE_VAL(ac_cv_path_zip, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then if test -f "$j" ; then ac_cv_path_zip=$j break fi fi done done ]) if test -f "$ac_cv_path_zip" ; then ZIP_PROG="$ac_cv_path_zip" AC_MSG_RESULT([$ZIP_PROG]) ZIP_PROG_OPTIONS="-rq" ZIP_PROG_VFSSEARCH="*" AC_MSG_RESULT([Found INFO Zip in environment]) # Use standard arguments for zip else # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH. Building minizip]) fi AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) AC_SUBST(ZIP_INSTALL_OBJS) ]) # Local Variables: # mode: autoconf # End: |
Changes to unix/tk.pc.in.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # tk pkg-config source file prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: The Tk Toolkit Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well. URL: http://www.tcl.tk/ Version: @TK_VERSION@@TK_PATCH_LEVEL@ Requires: tcl >= 8.6 Libs: -L${libdir} @TK_LIB_FLAG@ @TK_STUB_LIB_FLAG@ | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # tk pkg-config source file prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ demodir=@TK_DEMO_DIR@ Name: The Tk Toolkit Description: Tk is a cross-platform graphical user interface toolkit, the standard GUI not only for Tcl, but for many other dynamic languages as well. URL: http://www.tcl.tk/ Version: @TK_VERSION@@TK_PATCH_LEVEL@ Requires: tcl >= 8.6 Libs: -L${libdir} @TK_LIB_FLAG@ @TK_STUB_LIB_FLAG@ |
︙ | ︙ |
Changes to unix/tk.spec.
1 2 3 4 5 6 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # This file is the basis for a binary Tk Linux RPM. %{!?directory:%define directory /usr/local} Name: tk Summary: Tk graphical toolkit for the Tcl scripting language. Version: 8.7a2 Release: 2 License: BSD Group: Development/Languages Source: http://prdownloads.sourceforge.net/tcl/tk%{version}-src.tar.gz URL: http://www.tcl.tk/ Buildroot: /var/tmp/%{name}%{version} Buildrequires: XFree86-devel tcl >= 8.6.0 Requires: tcl >= 8.6.0 %description The Tcl (Tool Command Language) provides a powerful platform for creating integration applications that tie together diverse applications, protocols, devices, and frameworks. When paired with the Tk toolkit, Tcl provides the fastest and most powerful way to create GUI applications that run on PCs, Unix, and Mac OS X. Tcl |
︙ | ︙ |
Changes to unix/tkAppInit.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 76 77 78 79 80 81 82 | int main( int argc, /* Number of command-line arguments. */ char **argv) /* Values of command-line arguments. */ { #ifdef TK_LOCAL_MAIN_HOOK TK_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tk_Main(argc, argv, TK_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } /* | > > > | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | int main( int argc, /* Number of command-line arguments. */ char **argv) /* Values of command-line arguments. */ { #ifdef TK_LOCAL_MAIN_HOOK TK_LOCAL_MAIN_HOOK(&argc, &argv); #elif (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6) /* This doesn't work with Tcl 8.6 */ TclZipfs_AppHook(&argc, &argv); #endif Tk_Main(argc, argv, TK_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } /* |
︙ | ︙ |
Changes to unix/tkConfig.h.in.
︙ | ︙ | |||
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | #undef PACKAGE_VERSION /* Is this a static build? */ #undef STATIC_BUILD /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Is this a 64-bit build? */ #undef TCL_CFG_DO64BIT /* Is this an optimized build? */ #undef TCL_CFG_OPTIMIZED /* Is bytecode debugging enabled? */ #undef TCL_COMPILE_DEBUG /* Are bytecode statistics enabled? */ #undef TCL_COMPILE_STATS /* Is memory debugging enabled? */ #undef TCL_MEM_DEBUG /* What is the default extension for shared libraries? */ #undef TCL_SHLIB_EXT | > > > < < < | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | #undef PACKAGE_VERSION /* Is this a static build? */ #undef STATIC_BUILD /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* What encoding should be used for embedded configuration info? */ #undef TCL_CFGVAL_ENCODING /* Is this a 64-bit build? */ #undef TCL_CFG_DO64BIT /* Is this an optimized build? */ #undef TCL_CFG_OPTIMIZED /* Is bytecode debugging enabled? */ #undef TCL_COMPILE_DEBUG /* Are bytecode statistics enabled? */ #undef TCL_COMPILE_STATS /* Is memory debugging enabled? */ #undef TCL_MEM_DEBUG /* What is the default extension for shared libraries? */ #undef TCL_SHLIB_EXT /* Are wide integers to be implemented with C 'long's? */ #undef TCL_WIDE_INT_IS_LONG /* What type should be used to define wide integers? */ #undef TCL_WIDE_INT_TYPE /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ |
︙ | ︙ |
Changes to unix/tkConfig.sh.in.
︙ | ︙ | |||
91 92 93 94 95 96 97 | TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@' # Path to the Tk stub library in the build directory. TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' # Path to the Tk stub library in the install directory. TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@' | > > > | 91 92 93 94 95 96 97 98 99 100 | TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@' # Path to the Tk stub library in the build directory. TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@' # Path to the Tk stub library in the install directory. TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@' # Top-level directory in which Tk's demo files are installed. TK_DEMO_DIR='@TK_DEMO_DIR@' |
Changes to unix/tkUnix3d.c.
︙ | ︙ | |||
439 440 441 442 443 444 445 | borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor); gcValues.foreground = borderPtr->lightColorPtr->pixel; borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues); return; } if (borderPtr->shadow == None) { | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | borderPtr->lightColorPtr = Tk_GetColorByValue(tkwin, &lightColor); gcValues.foreground = borderPtr->lightColorPtr->pixel; borderPtr->lightGC = Tk_GetGC(tkwin, GCForeground, &gcValues); return; } if (borderPtr->shadow == None) { borderPtr->shadow = Tk_GetBitmap(NULL, tkwin, Tk_GetUid("gray50")); if (borderPtr->shadow == None) { Tcl_Panic("TkpGetShadows couldn't allocate bitmap for border"); } } if (borderPtr->visual->map_entries > 2) { /* |
︙ | ︙ |
Changes to unix/tkUnixButton.c.
︙ | ︙ | |||
392 393 394 395 396 397 398 | } } void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { | | | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | } } void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { register TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ int y, relief; Tk_Window tkwin = butPtr->tkwin; |
︙ | ︙ |
Changes to unix/tkUnixColor.c.
︙ | ︙ | |||
153 154 155 156 157 158 159 | } } } } } if (strlen(name) > 99) { /* Don't bother to parse this. [Bug 2809525]*/ | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | } } } } } if (strlen(name) > 99) { /* Don't bother to parse this. [Bug 2809525]*/ return NULL; } else if (XAllocNamedColor(display, colormap, name, &screen, &color) != 0) { DeleteStressedCmap(display, colormap); } else { /* * Couldn't allocate the color. Try translating the name to a * color value, to see whether the problem is a bad color name or * a full colormap. If the colormap is full, then pick an |
︙ | ︙ |
Changes to unix/tkUnixDefault.h.
︙ | ︙ | |||
27 28 29 30 31 32 33 | #define BLACK "#000000" #define WHITE "#ffffff" #define NORMAL_BG "#d9d9d9" #define ACTIVE_BG "#ececec" #define SELECT_BG "#c3c3c3" #define TROUGH "#b3b3b3" | | < | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #define BLACK "#000000" #define WHITE "#ffffff" #define NORMAL_BG "#d9d9d9" #define ACTIVE_BG "#ececec" #define SELECT_BG "#c3c3c3" #define TROUGH "#b3b3b3" #define INDICATOR WHITE #define DISABLED "#a3a3a3" /* * Defaults for labels, buttons, checkbuttons, and radiobuttons: */ #define DEF_BUTTON_ANCHOR "center" |
︙ | ︙ | |||
60 61 62 63 64 65 66 | #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT BLACK #define DEF_LABEL_HIGHLIGHT_WIDTH "0" #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" | | | | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT BLACK #define DEF_LABEL_HIGHLIGHT_WIDTH "0" #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" #define DEF_BUTTON_IMAGE NULL #define DEF_BUTTON_INDICATOR "1" #define DEF_BUTTON_JUSTIFY "center" #define DEF_BUTTON_OFF_VALUE "0" #define DEF_BUTTON_ON_VALUE "1" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_OVER_RELIEF "" #define DEF_BUTTON_PADX "3m" #define DEF_LABCHKRAD_PADX "1" #define DEF_BUTTON_PADY "1m" #define DEF_LABCHKRAD_PADY "1" #define DEF_BUTTON_RELIEF "raised" #define DEF_LABCHKRAD_RELIEF "flat" #define DEF_BUTTON_REPEAT_DELAY "0" #define DEF_BUTTON_REPEAT_INTERVAL "0" #define DEF_BUTTON_SELECT_COLOR INDICATOR #define DEF_BUTTON_SELECT_MONO BLACK #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_UNDERLINE "-1" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" #define DEF_RADIOBUTTON_VARIABLE "selectedButton" |
︙ | ︙ | |||
118 119 120 121 122 123 124 | #define DEF_CANVAS_SCROLL_REGION "" #define DEF_CANVAS_SELECT_COLOR SELECT_BG #define DEF_CANVAS_SELECT_MONO BLACK #define DEF_CANVAS_SELECT_BD_COLOR "1" #define DEF_CANVAS_SELECT_BD_MONO "0" #define DEF_CANVAS_SELECT_FG_COLOR BLACK #define DEF_CANVAS_SELECT_FG_MONO WHITE | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | #define DEF_CANVAS_SCROLL_REGION "" #define DEF_CANVAS_SELECT_COLOR SELECT_BG #define DEF_CANVAS_SELECT_MONO BLACK #define DEF_CANVAS_SELECT_BD_COLOR "1" #define DEF_CANVAS_SELECT_BD_MONO "0" #define DEF_CANVAS_SELECT_FG_COLOR BLACK #define DEF_CANVAS_SELECT_FG_MONO WHITE #define DEF_CANVAS_TAKE_FOCUS NULL #define DEF_CANVAS_WIDTH "10c" #define DEF_CANVAS_X_SCROLL_CMD "" #define DEF_CANVAS_X_SCROLL_INCREMENT "0" #define DEF_CANVAS_Y_SCROLL_CMD "" #define DEF_CANVAS_Y_SCROLL_INCREMENT "0" /* |
︙ | ︙ | |||
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | #define DEF_ENTRY_INSERT_BG BLACK #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" #define DEF_ENTRY_SELECT_COLOR SELECT_BG #define DEF_ENTRY_SELECT_MONO BLACK #define DEF_ENTRY_SELECT_BD_COLOR "0" #define DEF_ENTRY_SELECT_BD_MONO "0" #define DEF_ENTRY_SELECT_FG_COLOR BLACK #define DEF_ENTRY_SELECT_FG_MONO WHITE | > > | | > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | #define DEF_ENTRY_INSERT_BG BLACK #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" #define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" #define DEF_ENTRY_READONLY_BG_COLOR NORMAL_BG #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" #define DEF_ENTRY_SELECT_COLOR SELECT_BG #define DEF_ENTRY_SELECT_MONO BLACK #define DEF_ENTRY_SELECT_BD_COLOR "0" #define DEF_ENTRY_SELECT_BD_MONO "0" #define DEF_ENTRY_SELECT_FG_COLOR BLACK #define DEF_ENTRY_SELECT_FG_MONO WHITE #define DEF_ENTRY_SHOW NULL #define DEF_ENTRY_STATE "normal" #define DEF_ENTRY_TAKE_FOCUS NULL #define DEF_ENTRY_TEXT_VARIABLE "" #define DEF_ENTRY_WIDTH "20" /* * Defaults for frames: */ #define DEF_FRAME_BG_COLOR NORMAL_BG #define DEF_FRAME_BG_IMAGE NULL #define DEF_FRAME_BG_MONO WHITE #define DEF_FRAME_BG_TILE "0" #define DEF_FRAME_BORDER_WIDTH "0" #define DEF_FRAME_CLASS "Frame" #define DEF_FRAME_COLORMAP "" #define DEF_FRAME_CONTAINER "0" #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG |
︙ | ︙ | |||
229 230 231 232 233 234 235 | #define DEF_LISTBOX_SELECT_MONO BLACK #define DEF_LISTBOX_SELECT_BD "0" #define DEF_LISTBOX_SELECT_FG_COLOR BLACK #define DEF_LISTBOX_SELECT_FG_MONO WHITE #define DEF_LISTBOX_SELECT_MODE "browse" #define DEF_LISTBOX_SET_GRID "0" #define DEF_LISTBOX_STATE "normal" | | | | | | | | | | | | | | | | > | | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | #define DEF_LISTBOX_SELECT_MONO BLACK #define DEF_LISTBOX_SELECT_BD "0" #define DEF_LISTBOX_SELECT_FG_COLOR BLACK #define DEF_LISTBOX_SELECT_FG_MONO WHITE #define DEF_LISTBOX_SELECT_MODE "browse" #define DEF_LISTBOX_SET_GRID "0" #define DEF_LISTBOX_STATE "normal" #define DEF_LISTBOX_TAKE_FOCUS NULL #define DEF_LISTBOX_WIDTH "20" /* * Defaults for individual entries of menus: */ #define DEF_MENU_ENTRY_ACTIVE_BG NULL #define DEF_MENU_ENTRY_ACTIVE_FG NULL #define DEF_MENU_ENTRY_ACCELERATOR NULL #define DEF_MENU_ENTRY_BG NULL #define DEF_MENU_ENTRY_BITMAP NULL #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND NULL #define DEF_MENU_ENTRY_COMPOUND "none" #define DEF_MENU_ENTRY_FG NULL #define DEF_MENU_ENTRY_FONT NULL #define DEF_MENU_ENTRY_HIDE_MARGIN "0" #define DEF_MENU_ENTRY_IMAGE NULL #define DEF_MENU_ENTRY_INDICATOR "1" #define DEF_MENU_ENTRY_LABEL NULL #define DEF_MENU_ENTRY_MENU NULL #define DEF_MENU_ENTRY_OFF_VALUE "0" #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL #define DEF_MENU_ENTRY_UNDERLINE "-1" /* * Defaults for menus overall: */ #define DEF_MENU_ACTIVE_BG_COLOR ACTIVE_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "1" #define DEF_MENU_ACTIVE_FG_COLOR BLACK #define DEF_MENU_ACTIVE_FG_MONO WHITE #define DEF_MENU_ACTIVE_RELIEF "raised" #define DEF_MENU_BG_COLOR NORMAL_BG #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "1" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR DISABLED #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "TkMenuFont" #define DEF_MENU_FG BLACK #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "raised" #define DEF_MENU_SELECT_COLOR BLACK #define DEF_MENU_SELECT_MONO BLACK #define DEF_MENU_TAKE_FOCUS "0" #define DEF_MENU_TEAROFF "0" #define DEF_MENU_TEAROFF_CMD NULL #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* * Defaults for menubuttons: */ |
︙ | ︙ | |||
312 313 314 315 316 317 318 | #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG BLACK #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT BLACK #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG BLACK #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT BLACK #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "0" #define DEF_MENUBUTTON_JUSTIFY "center" #define DEF_MENUBUTTON_MENU "" #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" |
︙ | ︙ | |||
422 423 424 425 426 427 428 | #define DEF_SCALE_RESOLUTION "1" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" | | | 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | #define DEF_SCALE_RESOLUTION "1" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" #define DEF_SCALE_TAKE_FOCUS NULL #define DEF_SCALE_TICK_INTERVAL "0" #define DEF_SCALE_TO "100" #define DEF_SCALE_VARIABLE "" #define DEF_SCALE_WIDTH "15" /* * Defaults for scrollbars: |
︙ | ︙ | |||
449 450 451 452 453 454 455 | #define DEF_SCROLLBAR_HIGHLIGHT BLACK #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" #define DEF_SCROLLBAR_RELIEF "sunken" #define DEF_SCROLLBAR_REPEAT_DELAY "300" #define DEF_SCROLLBAR_REPEAT_INTERVAL "100" | | | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 | #define DEF_SCROLLBAR_HIGHLIGHT BLACK #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" #define DEF_SCROLLBAR_RELIEF "sunken" #define DEF_SCROLLBAR_REPEAT_DELAY "300" #define DEF_SCROLLBAR_REPEAT_INTERVAL "100" #define DEF_SCROLLBAR_TAKE_FOCUS NULL #define DEF_SCROLLBAR_TROUGH_COLOR TROUGH #define DEF_SCROLLBAR_TROUGH_MONO WHITE #define DEF_SCROLLBAR_WIDTH "11" /* * Defaults for texts: */ |
︙ | ︙ | |||
497 498 499 500 501 502 503 | #define DEF_TEXT_SET_GRID "0" #define DEF_TEXT_SPACING1 "0" #define DEF_TEXT_SPACING2 "0" #define DEF_TEXT_SPACING3 "0" #define DEF_TEXT_STATE "normal" #define DEF_TEXT_TABS "" #define DEF_TEXT_TABSTYLE "tabular" | | | 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 | #define DEF_TEXT_SET_GRID "0" #define DEF_TEXT_SPACING1 "0" #define DEF_TEXT_SPACING2 "0" #define DEF_TEXT_SPACING3 "0" #define DEF_TEXT_STATE "normal" #define DEF_TEXT_TABS "" #define DEF_TEXT_TABSTYLE "tabular" #define DEF_TEXT_TAKE_FOCUS NULL #define DEF_TEXT_UNDO "0" #define DEF_TEXT_WIDTH "80" #define DEF_TEXT_WRAP "char" #define DEF_TEXT_XSCROLL_COMMAND "" #define DEF_TEXT_YSCROLL_COMMAND "" /* |
︙ | ︙ |
Changes to unix/tkUnixDraw.c.
︙ | ︙ | |||
204 205 206 207 208 209 210 | { TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } /* *---------------------------------------------------------------------- * | | | > | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | { TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } /* *---------------------------------------------------------------------- * * TkpDrawFrameEx -- * * This function draws the rectangular frame area. * * Results: * None. * * Side effects: * Draws inside the tkwin area. * *---------------------------------------------------------------------- */ void TkpDrawFrameEx( Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) { Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth, highlightWidth, Tk_Width(tkwin) - 2*highlightWidth, Tk_Height(tkwin) - 2*highlightWidth, borderWidth, relief); } /* * Local Variables: * mode: c |
︙ | ︙ |
Changes to unix/tkUnixEmbed.c.
︙ | ︙ | |||
38 39 40 41 42 43 44 | * in this process. Note that this is *not* * the same window as wrapper: wrapper is the * parent of embeddedPtr. */ struct Container *nextPtr; /* Next in list of all containers in this * process. */ } Container; | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | * in this process. Note that this is *not* * the same window as wrapper: wrapper is the * parent of embeddedPtr. */ struct Container *nextPtr; /* Next in list of all containers in this * process. */ } Container; typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* |
︙ | ︙ | |||
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { if (containerPtr->wrapper != None) { /* * Ignore errors, since the embedded application could have * deleted its window. */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, -1, -1, NULL, NULL); | > > > > > > > > | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = clientData; Tk_ErrorHandler errHandler; if (eventPtr->type == ConfigureNotify) { /* * Send a ConfigureNotify to the embedded application. */ if (containerPtr->embeddedPtr != None) { TkDoConfigureNotify(containerPtr->embeddedPtr); } if (containerPtr->wrapper != None) { /* * Ignore errors, since the embedded application could have * deleted its window. */ errHandler = Tk_CreateErrorHandler(eventPtr->xfocus.display, -1, -1, -1, NULL, NULL); |
︙ | ︙ | |||
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; } else { all = 0; } Tcl_DStringInit(&dString); for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { Tcl_DStringStartSublist(&dString); if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { | > > > > > > > > > > > | > | > > | > | > | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument strings. */ { int all; Container *containerPtr; Tcl_DString dString; char buffer[50]; Tcl_Interp *embeddedInterp = NULL, *parentInterp = NULL; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((objc > 1) && (strcmp(Tcl_GetString(objv[1]), "all") == 0)) { all = 1; } else { all = 0; } Tcl_DStringInit(&dString); for (containerPtr = tsdPtr->firstContainerPtr; containerPtr != NULL; containerPtr = containerPtr->nextPtr) { if (containerPtr->embeddedPtr != NULL) { embeddedInterp = containerPtr->embeddedPtr->mainPtr->interp; } if (containerPtr->parentPtr != NULL) { parentInterp = containerPtr->parentPtr->mainPtr->interp; } if (embeddedInterp != interp && parentInterp != interp) { continue; } Tcl_DStringStartSublist(&dString); /* Parent id */ if (containerPtr->parent == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { sprintf(buffer, "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->parent); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* Parent pathName */ if (containerPtr->parentPtr == NULL || parentInterp != interp) { Tcl_DStringAppendElement(&dString, ""); } else { Tcl_DStringAppendElement(&dString, containerPtr->parentPtr->pathName); } /* Wrapper */ if (containerPtr->wrapper == None) { Tcl_DStringAppendElement(&dString, ""); } else if (all) { sprintf(buffer, "0x%" TCL_Z_MODIFIER "x", (size_t) containerPtr->wrapper); Tcl_DStringAppendElement(&dString, buffer); } else { Tcl_DStringAppendElement(&dString, "XXX"); } /* Embedded window pathName */ if (containerPtr->embeddedPtr == NULL || embeddedInterp != interp) { Tcl_DStringAppendElement(&dString, ""); } else { Tcl_DStringAppendElement(&dString, containerPtr->embeddedPtr->pathName); } Tcl_DStringEndSublist(&dString); } |
︙ | ︙ |
Changes to unix/tkUnixEvent.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #endif /* * The following static indicates whether this module has been initialized in * the current thread. */ | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #endif /* * The following static indicates whether this module has been initialized in * the current thread. */ typedef struct { int initialized; } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Prototypes for functions that are referenced only in this file: */ |
︙ | ︙ | |||
127 128 129 130 131 132 133 | int event = 0; int error = 0; int major = 1; int minor = 0; int reason = 0; unsigned int use_xkb = 0; /* Disabled, until we have a better test. See [Bug 3613668] */ | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | int event = 0; int error = 0; int major = 1; int minor = 0; int reason = 0; unsigned int use_xkb = 0; /* Disabled, until we have a better test. See [Bug 3613668] */ #if 0 && defined(XKEYCODETOKEYSYM_IS_DEPRECATED) static int xinited = 0; static Tcl_Mutex xinitMutex = NULL; if (!xinited) { Tcl_MutexLock(&xinitMutex); if (!xinited) { /* Necessary for threaded apps, of no consequence otherwise */ |
︙ | ︙ | |||
464 465 466 467 468 469 470 | */ static void DisplayFileProc( ClientData clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { | | | 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | */ static void DisplayFileProc( ClientData clientData, /* The display pointer. */ int flags) /* Should be TCL_READABLE. */ { TkDisplay *dispPtr = clientData; Display *display = dispPtr->display; int numFound; XFlush(display); numFound = XEventsQueued(display, QueuedAfterReading); if (numFound == 0) { /* |
︙ | ︙ |
Changes to unix/tkUnixFont.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include <netinet/in.h> /* for htons() prototype */ #include <arpa/inet.h> /* inet_ntoa() */ /* * The preferred font encodings. */ | | | | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #include <netinet/in.h> /* for htons() prototype */ #include <arpa/inet.h> /* inet_ntoa() */ /* * The preferred font encodings. */ static const char encodingList[][10] = { "iso8859-1", "jis0208", "jis0212" }; /* * The following structure represents a font family. It is assumed that all * screen fonts constructed from the same "font family" share certain * properties; all screen fonts with the same "font family" point to a shared * instance of this structure. The most important shared property is the * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Unix, there are three attributes that uniquely identify a "font * family": the foundry, face name, and charset. */ #define FONTMAP_SHIFT 12 #define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT)) #define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT) typedef struct FontFamily { struct FontFamily *nextPtr; /* Next in list of all known font families. */ size_t refCount; /* How many SubFonts are referring to this * FontFamily. When the refCount drops to * zero, this FontFamily may be freed. */ /* * Key. */ Tk_Uid foundry; /* Foundry key for this FontFamily. */ |
︙ | ︙ | |||
149 150 151 152 153 154 155 | */ typedef struct FontAttributes { TkFontAttributes fa; TkXLFDAttributes xa; } FontAttributes; | | | < < < < < < < | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | */ typedef struct FontAttributes { TkFontAttributes fa; TkXLFDAttributes xa; } FontAttributes; typedef struct { FontFamily *fontFamilyList; /* The list of font families that are * currently loaded. As screen fonts are * loaded, this list grows to hold information * about what characters exist in each font * family. */ FontFamily controlFamily; /* FontFamily used to handle control character * expansions. The encoding of this FontFamily * converts UTF-8 to backslashed escape * sequences. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * The set of builtin encoding alises to convert the XLFD names for the * encodings into the names expected by the Tcl encoding package. */ static const EncodingAlias encodingAliases[] = { {"gb2312-raw", "gb2312*"}, {"big5", "big5*"}, {"cns11643-1", "cns11643*-1"}, {"cns11643-1", "cns11643*.1-0"}, {"cns11643-2", "cns11643*-2"}, {"cns11643-2", "cns11643*.2-0"}, {"jis0201", "jisx0201*"}, {"jis0201", "jisx0202*"}, {"jis0208", "jisc6226*"}, {"jis0208", "jisx0208*"}, {"jis0212", "jisx0212*"}, {"tis620", "tis620*"}, {"ksc5601", "ksc5601*"}, {"dingbats", "*dingbats"}, {"ucs-2be", "iso10646-1"}, {NULL, NULL} }; /* * Functions used only in this file. */ |
︙ | ︙ | |||
242 243 244 245 246 247 248 | static char ** ListFontOrAlias(Display *display, const char*faceName, int *numNamesPtr); static unsigned RankAttributes(FontAttributes *wantPtr, FontAttributes *gotPtr); static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); | < < | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | static char ** ListFontOrAlias(Display *display, const char*faceName, int *numNamesPtr); static unsigned RankAttributes(FontAttributes *wantPtr, FontAttributes *gotPtr); static void ReleaseFont(UnixFont *fontPtr); static void ReleaseSubFont(Display *display, SubFont *subFontPtr); static int SeenName(const char *name, Tcl_DString *dsPtr); static int Ucs2beToUtfProc(ClientData clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); static int UtfToUcs2beProc(ClientData clientData, const char*src, int srcLen, int flags, Tcl_EncodingState*statePtr, char *dst, int dstLen, int *srcReadPtr, int *dstWrotePtr, int *dstCharsPtr); /* *------------------------------------------------------------------------- * * FontPkgCleanup -- * * This function is called when an application is created. It initializes |
︙ | ︙ | |||
316 317 318 319 320 321 322 | void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | < > < < < < < < > < | | > | < < < < | | > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); SubFont dummy; int i; Tcl_Encoding ucs2; if (tsdPtr->controlFamily.encoding == NULL) { Tcl_EncodingType type = {"X11ControlChars", ControlUtfProc, ControlUtfProc, NULL, NULL, 0}; tsdPtr->controlFamily.refCount = 2; tsdPtr->controlFamily.encoding = Tcl_CreateEncoding(&type); tsdPtr->controlFamily.isTwoByteFont = 0; dummy.familyPtr = &tsdPtr->controlFamily; dummy.fontMap = tsdPtr->controlFamily.fontMap; for (i = 0x00; i < 0x20; i++) { FontMapInsert(&dummy, i); FontMapInsert(&dummy, i + 0x80); } /* * UCS-2BE is unicode (UCS-2) in big-endian format. Define this if * if it doesn't exist yet. It is used in iso10646 fonts. */ ucs2 = Tcl_GetEncoding(NULL, "ucs-2be"); if (ucs2 == NULL) { Tcl_EncodingType ucs2type = {"ucs-2be", Ucs2beToUtfProc, UtfToUcs2beProc, NULL, NULL, 2}; Tcl_CreateEncoding(&ucs2type); } else { Tcl_FreeEncoding(ucs2); } Tcl_CreateThreadExitHandler(FontPkgCleanup, NULL); } } /* *------------------------------------------------------------------------- * |
︙ | ︙ | |||
403 404 405 406 407 408 409 | int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd; char *dstStart, *dstEnd; int ch, result; | | | | 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | int *dstCharsPtr) /* Filled with the number of characters that * correspond to the bytes stored in the * output buffer. */ { const char *srcStart, *srcEnd; char *dstStart, *dstEnd; int ch, result; static const char hexChars[] = "0123456789abcdef"; static const char mapChars[] = { 0, 0, 0, 0, 0, 0, 0, 'a', 'b', 't', 'n', 'v', 'f', 'r' }; result = TCL_OK; srcStart = src; |
︙ | ︙ | |||
455 456 457 458 459 460 461 | } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = dst - dstStart; return result; } | < | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = dst - dstStart; return result; } /* *------------------------------------------------------------------------- * * Ucs2beToUtfProc -- * * Convert from UCS-2BE (big-endian 16-bit Unicode) to UTF-8. * This is only defined on LE machines. |
︙ | ︙ | |||
516 517 518 519 520 521 522 | srcLen--; } srcStart = src; srcEnd = src + srcLen; dstStart = dst; | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | srcLen--; } srcStart = src; srcEnd = src + srcLen; dstStart = dst; dstEnd = dst + dstLen - 4; for (numChars = 0; src < srcEnd; numChars++) { if (dst > dstEnd) { result = TCL_CONVERT_NOSPACE; break; } |
︙ | ︙ | |||
591 592 593 594 595 596 597 | int result, numChars; Tcl_UniChar ch; srcStart = src; srcEnd = src + srcLen; srcClose = srcEnd; if (!(flags & TCL_ENCODING_END)) { | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | int result, numChars; Tcl_UniChar ch; srcStart = src; srcEnd = src + srcLen; srcClose = srcEnd; if (!(flags & TCL_ENCODING_END)) { srcClose -= 4; } dstStart = dst; dstEnd = dst + dstLen - 2 /* sizeof(UCS-2) */; result = TCL_OK; for (numChars = 0; src < srcEnd; numChars++) { |
︙ | ︙ | |||
628 629 630 631 632 633 634 | *dst++ = (ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } | < | 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | *dst++ = (ch & 0xFF); } *srcReadPtr = src - srcStart; *dstWrotePtr = dst - dstStart; *dstCharsPtr = numChars; return result; } /* *--------------------------------------------------------------------------- * * TkpGetNativeFont -- * * Map a platform-specific native font name to a TkFont. |
︙ | ︙ | |||
1913 1914 1915 1916 1917 1918 1919 | ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; if (familyPtr == NULL) { return; } | < | | 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 | ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); int i; if (familyPtr == NULL) { return; } if (familyPtr->refCount-- > 1) { return; } if (familyPtr->encoding) { Tcl_FreeEncoding(familyPtr->encoding); } for (i = 0; i < FONTMAP_PAGES; i++) { if (familyPtr->fontMap[i] != NULL) { |
︙ | ︙ | |||
2685 2686 2687 2688 2689 2690 2691 | } else if (diff < 0) { penalty += 150; diff = -diff; } penalty += diff; } if (gotPtr->xa.charset != wantPtr->xa.charset) { | | | | 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 | } else if (diff < 0) { penalty += 150; diff = -diff; } penalty += diff; } if (gotPtr->xa.charset != wantPtr->xa.charset) { size_t i; const char *gotAlias, *wantAlias; penalty += 65000; gotAlias = GetEncodingAlias(gotPtr->xa.charset); wantAlias = GetEncodingAlias(wantPtr->xa.charset); if (strcmp(gotAlias, wantAlias) != 0) { penalty += 30000; for (i = 0; i < sizeof(encodingList)/sizeof(encodingList[0]); i++) { if (strcmp(gotAlias, encodingList[i]) == 0) { penalty -= 30000; break; } penalty += 20000; } } |
︙ | ︙ | |||
3011 3012 3013 3014 3015 3016 3017 | *--------------------------------------------------------------------------- */ static const char * GetEncodingAlias( const char *name) /* The name to look up. */ { | | | | 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 | *--------------------------------------------------------------------------- */ static const char * GetEncodingAlias( const char *name) /* The name to look up. */ { const EncodingAlias *aliasPtr; for (aliasPtr = encodingAliases; aliasPtr->aliasPattern != NULL; ) { if (Tcl_StringCaseMatch(name, aliasPtr->aliasPattern, 0)) { return aliasPtr->realName; } aliasPtr++; } return name; } |
︙ | ︙ |
Changes to unix/tkUnixKey.c.
︙ | ︙ | |||
106 107 108 109 110 111 112 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { | | | | 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | const char * TkpGetString( TkWindow *winPtr, /* Window where event occurred */ XEvent *eventPtr, /* X keyboard event. */ Tcl_DString *dsPtr) /* Initialized, empty string to hold result. */ { TkSizeT len; Tcl_DString buf; TkKeyEvent *kePtr = (TkKeyEvent *) eventPtr; /* * If we have the value cached already, use it now. [Bug 1373712] */ if (kePtr->charValuePtr != NULL) { Tcl_DStringSetLength(dsPtr, kePtr->charValueLen); memcpy(Tcl_DStringValue(dsPtr), kePtr->charValuePtr, kePtr->charValueLen+1); return Tcl_DStringValue(dsPtr); } /* * Only do this for KeyPress events, otherwise * further Xlib function behavior might be undefined. */ |
︙ | ︙ | |||
227 228 229 230 231 232 233 | * function, we will be able to produce it without asking X. This stops us * from having to reenter the XIM engine. [Bug 1373712] */ done: kePtr->charValuePtr = ckalloc(len + 1); kePtr->charValueLen = len; | | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | * function, we will be able to produce it without asking X. This stops us * from having to reenter the XIM engine. [Bug 1373712] */ done: kePtr->charValuePtr = ckalloc(len + 1); kePtr->charValueLen = len; memcpy(kePtr->charValuePtr, Tcl_DStringValue(dsPtr), len + 1); return Tcl_DStringValue(dsPtr); } /* * When mapping from a keysym to a keycode, need information about the * modifier state to be used so that when they call TkKeycodeToKeysym taking * into account the xkey.state, they will get back the original keysym. |
︙ | ︙ |
Changes to unix/tkUnixMenu.c.
1 2 3 4 5 6 7 8 9 10 11 | /* * tkUnixMenu.c -- * * This module implements the UNIX platform-specific features of menus. * * Copyright (c) 1996-1998 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. */ | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * tkUnixMenu.c -- * * This module implements the UNIX platform-specific features of menus. * * Copyright (c) 1996-1998 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. */ #include "tkUnixInt.h" #include "tkMenu.h" #include "default.h" /* * Constants used for menu drawing. */ #define MENU_MARGIN_WIDTH 2 #define MENU_DIVIDER_HEIGHT 2 |
︙ | ︙ | |||
439 440 441 442 443 444 445 | bgBorder = activeBorder; if ((menuPtr->menuType == MENUBAR) && ((menuPtr->postedCascade == NULL) || (menuPtr->postedCascade != mePtr))) { relief = TK_RELIEF_FLAT; } else { | | < | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | bgBorder = activeBorder; if ((menuPtr->menuType == MENUBAR) && ((menuPtr->postedCascade == NULL) || (menuPtr->postedCascade != mePtr))) { relief = TK_RELIEF_FLAT; } else { Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief); } Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, activeBorderWidth, relief); } else { Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0, TK_RELIEF_FLAT); |
︙ | ︙ | |||
853 854 855 856 857 858 859 | const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, int width, int height) { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; | < < < < | | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | const Tk_FontMetrics *fmPtr,/* The precalculated font metrics */ int x, int y, int width, int height) { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { int activeBorderWidth, leftEdge; const char *label, *start, *end; label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, mePtr->underline); end = Tcl_UtfNext(start); |
︙ | ︙ | |||
885 886 887 888 889 890 891 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * | | > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * * Posts a menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. * If the entry parameter is negative, the upper left corner of the * menu itself is placed at the point. * * Results: * None. * * Side effects: * The menu is posted and handled. * *---------------------------------------------------------------------- */ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index) { return TkpPostTearoffMenu(interp, menuPtr, x, y, index); } /* *---------------------------------------------------------------------- * * TkpPostTearoffMenu -- * * Posts a tearoff menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. * If the index parameter is negative, the upper left corner of the menu * itself is placed at the point. On unix this is called when posting * any menu. Adjusts the menu's position so that it fits on the screen, * and maps and raises the menu. * * Results: * Returns a standard Tcl Error. * * Side effects: * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( Tcl_Interp *interp, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where the * specified entry will be posted */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu * uses override-redirect mode it will be in the *real* root window for * the screen, so we have to map the coordinates from the virtual root * (if any) to the real root. Can't get the virtual root from the menu * itself (it will never be seen by the wm) so use its parent instead * (it would be better to have an an option that names a window to use * for this...). * 2. The menu may not have been mapped yet, so its current size might be * the default 1x1. To compute how much space it needs, use its * requested size, not its actual size. */ Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY, &vRootWidth, &vRootHeight); vRootWidth -= Tk_ReqWidth(menuPtr->tkwin); if (x > vRootX + vRootWidth) { x = vRootX + vRootWidth; } if (x < vRootX) { x = vRootX; } vRootHeight -= Tk_ReqHeight(menuPtr->tkwin); if (y > vRootY + vRootHeight) { y = vRootY + vRootHeight; } if (y < vRootY) { y = vRootY; } Tk_MoveToplevelWindow(menuPtr->tkwin, x, y); if (!Tk_IsMapped(menuPtr->tkwin)) { Tk_MapWindow(menuPtr->tkwin); } TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * GetMenuSeparatorGeometry -- * |
︙ | ︙ | |||
1033 1034 1035 1036 1037 1038 1039 | * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); | | | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | * has a font set, we will measure it as we come to it, and then we * decide which set to give the geometry routines. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); for (i = 0; i < (int)menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; mePtr->entryFlags &= ~ENTRY_LAST_COLUMN; if (mePtr->fontPtr != NULL) { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); fmPtr = &entryMetrics; } else { |
︙ | ︙ | |||
1110 1111 1112 1113 1114 1115 1116 | lastEntry--; } if ((lastEntry >= 0) && (x + menuPtr->entries[lastEntry]->width + borderWidth > maxWidth)) { maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth; } x = borderWidth; | | | 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 | lastEntry--; } if ((lastEntry >= 0) && (x + menuPtr->entries[lastEntry]->width + borderWidth > maxWidth)) { maxWidth = x + menuPtr->entries[lastEntry]->width + borderWidth; } x = borderWidth; for (j = lastRowBreak; j < (int)menuPtr->numEntries; j++) { if (j == helpMenuIndex) { continue; } menuPtr->entries[j]->y = y + currentRowHeight - menuPtr->entries[j]->height; menuPtr->entries[j]->x = x; x += menuPtr->entries[j]->width; |
︙ | ︙ | |||
1612 1613 1614 1615 1616 1617 1618 | * and give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); | | | 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 | * and give all of the geometry/drawing the entry's font and metrics. */ menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); for (i = 0; i < (int)menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->fontPtr == NULL) { tkfont = menuFont; fmPtr = &menuMetrics; } else { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, mePtr->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); |
︙ | ︙ | |||
1707 1708 1709 1710 1711 1712 1713 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } | | < | 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } for (j = lastColumnBreak; j < (int)menuPtr->numEntries; j++) { menuPtr->entries[j]->indicatorSpace = indicatorSpace; menuPtr->entries[j]->labelWidth = labelWidth; menuPtr->entries[j]->width = indicatorSpace + labelWidth + accelWidth + 2 * activeBorderWidth; menuPtr->entries[j]->x = x; menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN; } windowWidth = x + indicatorSpace + labelWidth + accelWidth + 2 * activeBorderWidth + borderWidth; windowHeight += borderWidth; /* * The X server doesn't like zero dimensions, so round up to at least 1 (a * zero-sized menu should never really occur, anyway). */ |
︙ | ︙ |
Changes to unix/tkUnixMenubu.c.
︙ | ︙ | |||
54 55 56 57 58 59 60 | *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | *---------------------------------------------------------------------- */ void TkpDisplayMenuButton( ClientData clientData) /* Information about widget. */ { register TkMenuButton *mbPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization needed only to stop compiler * warning. */ int y = 0; register Tk_Window tkwin = mbPtr->tkwin; |
︙ | ︙ |
Changes to unix/tkUnixPort.h.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include <stdio.h> #include <ctype.h> #include <fcntl.h> #include <limits.h> #include <math.h> #include <pwd.h> | < < < | < > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #include <stdio.h> #include <ctype.h> #include <fcntl.h> #include <limits.h> #include <math.h> #include <pwd.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <sys/types.h> #include <sys/file.h> #ifdef HAVE_SYS_SELECT_H # include <sys/select.h> #endif #include <sys/stat.h> |
︙ | ︙ | |||
47 48 49 50 51 52 53 | # else # include <time.h> # endif #endif #if HAVE_INTTYPES_H # include <inttypes.h> #endif | < | < < < | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | # else # include <time.h> # endif #endif #if HAVE_INTTYPES_H # include <inttypes.h> #endif #include <unistd.h> #include <X11/Xlib.h> #include <X11/cursorfont.h> #include <X11/keysym.h> #include <X11/Xatom.h> #include <X11/Xproto.h> #include <X11/Xresource.h> #include <X11/Xutil.h> |
︙ | ︙ |
Changes to unix/tkUnixRFont.c.
︙ | ︙ | |||
46 47 48 49 50 51 52 | } UnixFtFont; /* * Used to describe the current clipping box. Can't be passed normally because * the information isn't retrievable from the GC. */ | | > > > > > | > | < > > | | | < | | > > > < < < < < < | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | } UnixFtFont; /* * Used to describe the current clipping box. Can't be passed normally because * the information isn't retrievable from the GC. */ typedef struct { Region clipRegion; /* The clipping region, or None. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* *------------------------------------------------------------------------- * * TkpFontPkgInit -- * * This procedure is called when an application is created. It * initializes all the structures that are used by the * platform-dependant code on a per application basis. * Note that this is called before TkpInit() ! * * Results: * None. * * Side effects: * None. * *------------------------------------------------------------------------- */ void TkpFontPkgInit( TkMainInfo *mainPtr) /* The application being created. */ { } static XftFont * GetFont( UnixFtFont *fontPtr, FcChar32 ucs4, double angle) |
︙ | ︙ | |||
614 615 616 617 618 619 620 | *---------------------------------------------------------------------- */ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ | | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | *---------------------------------------------------------------------- */ void TkpGetFontAttrsForChar( Tk_Window tkwin, /* Window on the font's display */ Tk_Font tkfont, /* Font to query */ int c, /* Character of interest */ TkFontAttributes *faPtr) /* Output: Font attributes */ { UnixFtFont *fontPtr = (UnixFtFont *) tkfont; /* Structure describing the logical font */ FcChar32 ucs4 = (FcChar32) c; /* UCS-4 character to map */ XftFont *ftFont = GetFont(fontPtr, ucs4, 0.0); |
︙ | ︙ |
Changes to unix/tkUnixScale.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | /* * Forward declarations for functions defined later in this file: */ static void DisplayHorizontalScale(TkScale *scalePtr, Drawable drawable, XRectangle *drawnAreaPtr); static void DisplayHorizontalValue(TkScale *scalePtr, | | > | > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | /* * Forward declarations for functions defined later in this file: */ static void DisplayHorizontalScale(TkScale *scalePtr, Drawable drawable, XRectangle *drawnAreaPtr); static void DisplayHorizontalValue(TkScale *scalePtr, Drawable drawable, double value, int top, const char *format); static void DisplayVerticalScale(TkScale *scalePtr, Drawable drawable, XRectangle *drawnAreaPtr); static void DisplayVerticalValue(TkScale *scalePtr, Drawable drawable, double value, int rightEdge, const char *format); /* *---------------------------------------------------------------------- * * TkpCreateScale -- * * Allocate a new TkScale structure. |
︙ | ︙ | |||
146 147 148 149 150 151 152 | / (double) scalePtr->fontHeight; if (ticks > maxTicks) { tickInterval *= (ticks / maxTicks); } for (tickValue = scalePtr->fromValue; ; tickValue += tickInterval) { /* | | | | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | / (double) scalePtr->fontHeight; if (ticks > maxTicks) { tickInterval *= (ticks / maxTicks); } for (tickValue = scalePtr->fromValue; ; tickValue += tickInterval) { /* * The TkRoundValueToResolution call gets rid of accumulated * round-off errors, if any. */ tickValue = TkRoundValueToResolution(scalePtr, tickValue); if (scalePtr->toValue >= scalePtr->fromValue) { if (tickValue > scalePtr->toValue) { break; } } else { if (tickValue < scalePtr->toValue) { break; } } DisplayVerticalValue(scalePtr, drawable, tickValue, scalePtr->vertTickRightX, scalePtr->tickFormat); } } } /* * Display the value, if it is desired. */ if (scalePtr->showValue) { DisplayVerticalValue(scalePtr, drawable, scalePtr->value, scalePtr->vertValueRightX, scalePtr->valueFormat); } /* * Display the trough and the slider. */ Tk_Draw3DRectangle(tkwin, drawable, |
︙ | ︙ | |||
224 225 226 227 228 229 230 | if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) { Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC, scalePtr->tkfont, scalePtr->label, | | | | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) { Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC, scalePtr->tkfont, scalePtr->label, scalePtr->labelLength, scalePtr->vertLabelX, scalePtr->inset + (3 * fm.ascent) / 2); } } /* *---------------------------------------------------------------------- * * DisplayVerticalValue -- |
︙ | ︙ | |||
257 258 259 260 261 262 263 | register TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ double value, /* Y-coordinate of number to display, * specified in application coords, not in * pixels (we'll compute pixels). */ | | > | | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | register TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ double value, /* Y-coordinate of number to display, * specified in application coords, not in * pixels (we'll compute pixels). */ int rightEdge, /* X-coordinate of right edge of text, * specified in pixels. */ const char *format) /* Format string to use for the value */ { register Tk_Window tkwin = scalePtr->tkwin; int y, width, length; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = TkScaleValueToPixel(scalePtr, value) + fm.ascent/2; if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } length = (int) strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the y-coordinate if necessary to keep the text entirely inside * the window. */ if (y - fm.ascent < scalePtr->inset + SPACING) { y = scalePtr->inset + SPACING + fm.ascent; } if (y + fm.descent > Tk_Height(tkwin) - scalePtr->inset - SPACING) { y = Tk_Height(tkwin) - scalePtr->inset - SPACING - fm.descent; } Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC, scalePtr->tkfont, valueString, length, rightEdge - width, y); } /* |
︙ | ︙ | |||
320 321 322 323 324 325 326 | XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a * part of the scale is redrawn, gets modified * to reflect the part of the window that was * redrawn. */ { register Tk_Window tkwin = scalePtr->tkwin; int x, y, width, height, shadowWidth; | | | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | XRectangle *drawnAreaPtr) /* Initally contains area of window; if only a * part of the scale is redrawn, gets modified * to reflect the part of the window that was * redrawn. */ { register Tk_Window tkwin = scalePtr->tkwin; int x, y, width, height, shadowWidth; double tickInterval = scalePtr->tickInterval; Tk_3DBorder sliderBorder; /* * Display the information from bottom to top across the window. */ if (!(scalePtr->flags & REDRAW_OTHER)) { |
︙ | ︙ | |||
344 345 346 347 348 349 350 | if (scalePtr->flags & REDRAW_OTHER) { /* * Display the tick marks. */ if (tickInterval != 0) { char valueString[TCL_DOUBLE_SPACE]; | | | | | | | | | | | | > | | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 | if (scalePtr->flags & REDRAW_OTHER) { /* * Display the tick marks. */ if (tickInterval != 0) { char valueString[TCL_DOUBLE_SPACE]; double ticks, maxTicks, tickValue; /* * Ensure that we will only draw enough of the tick values such * that they don't overlap. We base this off the width that * fromValue would take. Not exact, but better than no constraint. */ ticks = fabs((scalePtr->toValue - scalePtr->fromValue) / tickInterval); if (snprintf(valueString, TCL_DOUBLE_SPACE, scalePtr->tickFormat, scalePtr->fromValue) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } maxTicks = (double) Tk_Width(tkwin) / (double) Tk_TextWidth(scalePtr->tkfont, valueString, -1); if (ticks > maxTicks) { tickInterval *= ticks / maxTicks; } tickValue = scalePtr->fromValue; while (1) { /* * The TkRoundValueToResolution call gets rid of accumulated * round-off errors, if any. */ tickValue = TkRoundValueToResolution(scalePtr, tickValue); if (scalePtr->toValue >= scalePtr->fromValue) { if (tickValue > scalePtr->toValue) { break; } } else { if (tickValue < scalePtr->toValue) { break; } } DisplayHorizontalValue(scalePtr, drawable, tickValue, scalePtr->horizTickY, scalePtr->tickFormat); tickValue += tickInterval; } } } /* * Display the value, if it is desired. */ if (scalePtr->showValue) { DisplayHorizontalValue(scalePtr, drawable, scalePtr->value, scalePtr->horizValueY, scalePtr->valueFormat); } /* * Display the trough and the slider. */ y = scalePtr->horizTroughY; |
︙ | ︙ | |||
445 446 447 448 449 450 451 | if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) { Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC, scalePtr->tkfont, scalePtr->label, | | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 | if ((scalePtr->flags & REDRAW_OTHER) && (scalePtr->labelLength != 0)) { Tk_FontMetrics fm; Tk_GetFontMetrics(scalePtr->tkfont, &fm); Tk_DrawChars(scalePtr->display, drawable, scalePtr->textGC, scalePtr->tkfont, scalePtr->label, scalePtr->labelLength, scalePtr->inset + fm.ascent/2, scalePtr->horizLabelY + fm.ascent); } } /* *---------------------------------------------------------------------- * * DisplayHorizontalValue -- |
︙ | ︙ | |||
478 479 480 481 482 483 484 | register TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ double value, /* X-coordinate of number to display, * specified in application coords, not in * pixels (we'll compute pixels). */ | | > | | | | | 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | register TkScale *scalePtr, /* Information about widget in which to * display value. */ Drawable drawable, /* Pixmap or window in which to draw the * value. */ double value, /* X-coordinate of number to display, * specified in application coords, not in * pixels (we'll compute pixels). */ int top, /* Y-coordinate of top edge of text, specified * in pixels. */ const char *format) /* Format string to use for the value */ { register Tk_Window tkwin = scalePtr->tkwin; int x, y, length, width; char valueString[TCL_DOUBLE_SPACE]; Tk_FontMetrics fm; x = TkScaleValueToPixel(scalePtr, value); Tk_GetFontMetrics(scalePtr->tkfont, &fm); y = top + fm.ascent; if (snprintf(valueString, TCL_DOUBLE_SPACE, format, value) < 0) { valueString[TCL_DOUBLE_SPACE - 1] = '\0'; } length = (int) strlen(valueString); width = Tk_TextWidth(scalePtr->tkfont, valueString, length); /* * Adjust the x-coordinate if necessary to keep the text entirely inside * the window. */ x -= width / 2; if (x < scalePtr->inset + SPACING) { x = scalePtr->inset + SPACING; } /* * Check the right border so use starting point +text width for the check. */ |
︙ | ︙ | |||
537 538 539 540 541 542 543 | *---------------------------------------------------------------------- */ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { | | | | | | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 | *---------------------------------------------------------------------- */ void TkpDisplayScale( ClientData clientData) /* Widget record for scale. */ { TkScale *scalePtr = clientData; Tk_Window tkwin = scalePtr->tkwin; Tcl_Interp *interp = scalePtr->interp; Pixmap pixmap; int result; char string[TCL_DOUBLE_SPACE]; XRectangle drawnArea; Tcl_DString buf; scalePtr->flags &= ~REDRAW_PENDING; if ((scalePtr->tkwin == NULL) || !Tk_IsMapped(scalePtr->tkwin)) { goto done; } /* * Invoke the scale's command if needed. */ Tcl_Preserve(scalePtr); if ((scalePtr->flags & INVOKE_COMMAND) && (scalePtr->command != NULL)) { Tcl_Preserve(interp); if (snprintf(string, TCL_DOUBLE_SPACE, scalePtr->valueFormat, scalePtr->value) < 0) { string[TCL_DOUBLE_SPACE - 1] = '\0'; } Tcl_DStringInit(&buf); Tcl_DStringAppend(&buf, scalePtr->command, -1); Tcl_DStringAppend(&buf, " ", -1); Tcl_DStringAppend(&buf, string, -1); result = Tcl_EvalEx(interp, Tcl_DStringValue(&buf), -1, 0); Tcl_DStringFree(&buf); if (result != TCL_OK) { |
︙ | ︙ | |||
630 631 632 633 634 635 636 | if (scalePtr->highlightWidth != 0) { GC gc; if (scalePtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap); } else { gc = Tk_GCForColor( | | | 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 | if (scalePtr->highlightWidth != 0) { GC gc; if (scalePtr->flags & GOT_FOCUS) { gc = Tk_GCForColor(scalePtr->highlightColorPtr, pixmap); } else { gc = Tk_GCForColor( Tk_3DBorderColor(scalePtr->highlightBorder), pixmap); } Tk_DrawFocusHighlight(tkwin, gc, scalePtr->highlightWidth, pixmap); } } #ifndef TK_NO_DOUBLE_BUFFERING /* |
︙ | ︙ | |||
692 693 694 695 696 697 698 | return OTHER; } sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value) - scalePtr->sliderLength/2; if (y < sliderFirst) { return TROUGH1; } | | | | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 | return OTHER; } sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value) - scalePtr->sliderLength/2; if (y < sliderFirst) { return TROUGH1; } if (y < sliderFirst + scalePtr->sliderLength) { return SLIDER; } return TROUGH2; } if ((y < scalePtr->horizTroughY) || (y >= (scalePtr->horizTroughY + 2*scalePtr->borderWidth + scalePtr->width))) { return OTHER; } if ((x < scalePtr->inset) || (x >= (Tk_Width(scalePtr->tkwin) - scalePtr->inset))) { return OTHER; } sliderFirst = TkScaleValueToPixel(scalePtr, scalePtr->value) - scalePtr->sliderLength/2; if (x < sliderFirst) { return TROUGH1; } if (x < sliderFirst + scalePtr->sliderLength) { return SLIDER; } return TROUGH2; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to unix/tkUnixScrlbr.c.
︙ | ︙ | |||
93 94 95 96 97 98 99 | *-------------------------------------------------------------- */ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | *-------------------------------------------------------------- */ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { register TkScrollbar *scrollPtr = clientData; register Tk_Window tkwin = scrollPtr->tkwin; XPoint points[7]; Tk_3DBorder border; int relief, width, elementBorderWidth; Pixmap pixmap; if ((scrollPtr->tkwin == NULL) || !Tk_IsMapped(tkwin)) { |
︙ | ︙ |
Changes to unix/tkUnixSelect.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | * for the next chunk; -1 means all data has * been transferred for this conversion. -2 * means only the final zero-length transfer * still has to be done. Otherwise it is the * offset of the next chunk of data to * transfer. */ Tcl_EncodingState state; /* The encoding state needed across chunks. */ | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | * for the next chunk; -1 means all data has * been transferred for this conversion. -2 * means only the final zero-length transfer * still has to be done. Otherwise it is the * offset of the next chunk of data to * transfer. */ Tcl_EncodingState state; /* The encoding state needed across chunks. */ char buffer[4]; /* A buffer to hold part of a UTF character * that is split across chunks.*/ } ConvertInfo; /* * When handling INCR-style selection retrievals, the selection owner uses the * following data structure to communicate between the ConvertSelection * function and TkSelPropProc. |
︙ | ︙ | |||
64 65 66 67 68 69 70 | Time time; /* Timestamp corresponding to selection at * beginning of request; used to abort * transfer if selection changes. */ struct IncrInfo *nextPtr; /* Next in list of all INCR-style retrievals * currently pending. */ } IncrInfo; | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | Time time; /* Timestamp corresponding to selection at * beginning of request; used to abort * transfer if selection changes. */ struct IncrInfo *nextPtr; /* Next in list of all INCR-style retrievals * currently pending. */ } IncrInfo; typedef struct { IncrInfo *pendingIncrs; /* List of all incr structures currently * active. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Largest property that we'll accept when sending or receiving the selection: |
︙ | ︙ | |||
442 443 444 445 446 447 448 | (unsigned char *) Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); /* * Preserve any left-over bytes. */ | | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 | (unsigned char *) Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); /* * Preserve any left-over bytes. */ if (srcLen > 4) { Tcl_Panic("selection conversion left too many bytes unconverted"); } memcpy(incrPtr->converts[i].buffer, src, srcLen + 1); Tcl_DStringFree(&ds); } else { /* * Set the property to the encoded string value. */ char *propPtr = (char *) SelCvtToX((char *) buffer, |
︙ | ︙ | |||
762 763 764 765 766 767 768 | Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( "selection owner didn't respond", -1)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "IGNORED", NULL); retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, | | | 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 | Tcl_SetObjResult(retrPtr->interp, Tcl_NewStringObj( "selection owner didn't respond", -1)); Tcl_SetErrorCode(retrPtr->interp, "TK", "SELECTION", "IGNORED", NULL); retrPtr->result = TCL_ERROR; } else { retrPtr->timeout = Tcl_CreateTimerHandler(1000, SelTimeoutProc, retrPtr); } } /* *---------------------------------------------------------------------- * * ConvertSelection -- |
︙ | ︙ | |||
915 916 917 918 919 920 921 | } } if (selPtr == NULL) { /* * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | } } if (selPtr == NULL) { /* * Nobody seems to know about this kind of request. If it's of a * sort that we can handle without any help, do it. Otherwise mark * the request as an error. */ numItems = TkSelDefaultSelection(infoPtr, target, (char *) buffer, TK_SEL_BYTES_AT_ONCE, &type); if (numItems < 0) { incr.multAtoms[2*i + 1] = None; continue; |
︙ | ︙ |
Changes to unix/tkUnixSend.c.
︙ | ︙ | |||
93 94 95 96 97 98 99 | int gotResponse; /* 1 means a response has been received, 0 * means the command is still outstanding. */ struct PendingCommand *nextPtr; /* Next in list of all outstanding commands. * NULL means end of list. */ } PendingCommand; | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | int gotResponse; /* 1 means a response has been received, 0 * means the command is still outstanding. */ struct PendingCommand *nextPtr; /* Next in list of all outstanding commands. * NULL means end of list. */ } PendingCommand; typedef struct { PendingCommand *pendingCommands; /* List of all commands currently being waited * for. */ RegisteredInterp *interpListPtr; /* List of all interpreters registered in the * current process. */ } ThreadSpecificData; |
︙ | ︙ | |||
2048 2049 2050 2051 2052 2053 2054 | XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING, 8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp), p-Tcl_DStringValue(&tmp)); Tk_DeleteErrorHandler(handler); Tcl_DStringFree(&tmp); } } else if (index == TESTSEND_SERIAL) { | | | 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 | XChangeProperty(winPtr->dispPtr->display, w, propName, XA_STRING, 8, PropModeReplace, (unsigned char*)Tcl_DStringValue(&tmp), p-Tcl_DStringValue(&tmp)); Tk_DeleteErrorHandler(handler); Tcl_DStringFree(&tmp); } } else if (index == TESTSEND_SERIAL) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(localData.sendSerial+1)); } return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to unix/tkUnixWm.c.
︙ | ︙ | |||
32 33 34 35 36 37 38 | * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ (offsetof(ProtocolHandler, command) + 1 + cmdLength) /* * Data for [wm attributes] command: */ typedef struct { double alpha; /* Transparency; 0.0=transparent, 1.0=opaque */ |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; | | | | | | | | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 | WMOPT_FRAME, WMOPT_GEOMETRY, WMOPT_GRID, WMOPT_GROUP, WMOPT_ICONBITMAP, WMOPT_ICONIFY, WMOPT_ICONMASK, WMOPT_ICONNAME, WMOPT_ICONPHOTO, WMOPT_ICONPOSITION, WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index; const char *argv1; TkWindow *winPtr; Tk_Window targetWin; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc < 2) { wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = Tcl_GetString(objv[1]); if ((argv1[0] == 't') && (strncmp(argv1, "tracing", objv[1]->length) == 0) && (objv[1]->length >= 3)) { int wmTracing; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } if (objc == 2) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (dispPtr->flags & TK_DISPLAY_WM_TRACING) != 0)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) { return TCL_ERROR; } if (wmTracing) { dispPtr->flags |= TK_DISPLAY_WM_TRACING; |
︙ | ︙ | |||
1196 1197 1198 1199 1200 1201 1202 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; | | | | | | 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x); results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y); results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x); results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~PAspect; } else { |
︙ | ︙ | |||
1341 1342 1343 1344 1345 1346 1347 | { WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: return Tcl_NewDoubleObj(wmPtr->attributes.alpha); case WMATT_TOPMOST: | | | | | 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 | { WmInfo *wmPtr = winPtr->wmInfoPtr; switch (attribute) { case WMATT_ALPHA: return Tcl_NewDoubleObj(wmPtr->attributes.alpha); case WMATT_TOPMOST: return Tcl_NewWideIntObj(wmPtr->attributes.topmost != 0); case WMATT_ZOOMED: return Tcl_NewWideIntObj(wmPtr->attributes.zoomed != 0); case WMATT_FULLSCREEN: return Tcl_NewWideIntObj(wmPtr->attributes.fullscreen != 0); case WMATT_TYPE: return GetNetWmType(winPtr); case _WMATT_LAST_ATTRIBUTE: /*NOTREACHED*/ break; } /*NOTREACHED*/ return NULL; |
︙ | ︙ | |||
1453 1454 1455 1456 1457 1458 1459 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | < | | | 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->clientMachine != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->clientMachine, -1)); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); wmPtr->clientMachine = NULL; if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XDeleteProperty(winPtr->display, wmPtr->wrapperPtr->window, Tk_InternAtom((Tk_Window) winPtr, "WM_CLIENT_MACHINE")); } } return TCL_OK; } if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); } wmPtr->clientMachine = ckalloc(objv[3]->length + 1); strcpy(wmPtr->clientMachine, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XTextProperty textProp; Tcl_DString ds; Tcl_UtfToExternalDString(NULL, wmPtr->clientMachine, -1, &ds); if (XStringListToTextProperty(&(Tcl_DStringValue(&ds)), 1, |
︙ | ︙ | |||
1977 1978 1979 1980 1981 1982 1983 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; | | | | | | 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth); results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight); results[2] = Tcl_NewWideIntObj(wmPtr->widthInc); results[3] = Tcl_NewWideIntObj(wmPtr->heightInc); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as |
︙ | ︙ | |||
2068 2069 2070 2071 2072 2073 2074 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; | < | | 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; WmInfo *wmPtr2; const char *argv3; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1)); } return TCL_OK; } argv3 = Tcl_GetString(objv[3]); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } wmPtr->leaderName = NULL; } else { |
︙ | ︙ | |||
2108 2109 2110 2111 2112 2113 2114 | CreateWrapper(wmPtr2); } if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; | | | 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 | CreateWrapper(wmPtr2); } if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } wmPtr->hints.window_group = Tk_WindowId(wmPtr2->wrapperPtr); wmPtr->hints.flags |= WindowGroupHint; wmPtr->leaderName = ckalloc(objv[3]->length + 1); strcpy(wmPtr->leaderName, argv3); } UpdateHints(winPtr); return TCL_OK; } /* |
︙ | ︙ | |||
2330 2331 2332 2333 2334 2335 2336 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | < | | | 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->iconName != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->iconName, -1)); } return TCL_OK; } else { if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } argv3 = Tcl_GetString(objv[3]); wmPtr->iconName = ckalloc(objv[3]->length + 1); strcpy(wmPtr->iconName, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { UpdateTitle(winPtr); } } return TCL_OK; } |
︙ | ︙ | |||
2440 2441 2442 2443 2444 2445 2446 | return TCL_ERROR; } memset(iconPropertyData, 0, sizeof(unsigned long) * size); for (i = 3 + isDefault; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); if (photo == NULL) { | | | 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 | return TCL_ERROR; } memset(iconPropertyData, 0, sizeof(unsigned long) * size); for (i = 3 + isDefault; i < objc; i++) { photo = Tk_FindPhoto(interp, Tcl_GetString(objv[i])); if (photo == NULL) { ckfree((char *) iconPropertyData); return TCL_ERROR; } Tk_PhotoGetSize(photo, &width, &height); Tk_PhotoGetImage(photo, &block); /* * Each image data will be placed as an array of 32bit packed |
︙ | ︙ | |||
2537 2538 2539 2540 2541 2542 2543 | Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; | | | | 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 | Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x); results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); } return TCL_OK; } if (Tcl_GetString(objv[3])[0] == '\0') { wmPtr->hints.flags &= ~IconPositionHint; } else { |
︙ | ︙ | |||
2776 2777 2778 2779 2780 2781 2782 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(wmPtr, &width, &height); | | | | 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
2834 2835 2836 2837 2838 2839 2840 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; | | | | 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(wmPtr->minWidth); results[1] = Tcl_NewWideIntObj(wmPtr->minHeight); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
2884 2885 2886 2887 2888 2889 2890 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (objc == 3) { | | | 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 | if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?boolean?"); return TCL_ERROR; } curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { return TCL_ERROR; } if (curValue != boolean) { /* |
︙ | ︙ | |||
3004 3005 3006 3007 3008 3009 3010 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; | | | 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; TkSizeT cmdLength; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } if (objc == 3) { /* |
︙ | ︙ | |||
3070 3071 3072 3073 3074 3075 3076 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | | 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } cmd = TkGetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { protPtr = ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; protPtr->interp = interp; memcpy(protPtr->command, cmd, cmdLength + 1); |
︙ | ︙ | |||
3120 3121 3122 3123 3124 3125 3126 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; | | | | 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE)); results[1] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE)); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
3328 3329 3330 3331 3332 3333 3334 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } | | | 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result)); return TCL_OK; } return TCL_OK; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
3467 3468 3469 3470 3471 3472 3473 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | < | | | 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->title) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->title, -1)); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj(winPtr->nameUid, -1)); } } else { if (wmPtr->title != NULL) { ckfree(wmPtr->title); } argv3 = Tcl_GetString(objv[3]); wmPtr->title = ckalloc(objv[3]->length + 1); strcpy(wmPtr->title, argv3); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { UpdateTitle(winPtr); } } return TCL_OK; |
︙ | ︙ | |||
3520 3521 3522 3523 3524 3525 3526 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; | | | 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?master?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
3589 3590 3591 3592 3593 3594 3595 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a master: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } | > > | | > | | | > > > | | 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 | Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a master: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->masterPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", Tk_PathName(masterPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } if (masterPtr != wmPtr->masterPtr) { /* * Remove old master map/unmap binding before setting the new * master. The event handler will ensure that transient states * reflect the state of the master. */ if (wmPtr->masterPtr != NULL) { |
︙ | ︙ | |||
5450 5451 5452 5453 5454 5455 5456 | if (objc > 0) { atoms = ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { Tcl_DString ds, dsName; | | | | 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 | if (objc > 0) { atoms = ckalloc(sizeof(Atom) * objc); } for (n = 0; n < objc; ++n) { Tcl_DString ds, dsName; TkSizeT len; char *name = TkGetStringFromObj(objv[n], &len); Tcl_UtfToUpper(name); Tcl_UtfToExternalDString(NULL, name, len, &dsName); Tcl_DStringInit(&ds); Tcl_DStringAppend(&ds, "_NET_WM_WINDOW_TYPE_", 20); Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsName), Tcl_DStringLength(&dsName)); |
︙ | ︙ | |||
6448 6449 6450 6451 6452 6453 6454 | if (XQueryTree(parentPtr->display, vRoot, &dummy1, &dummy2, &children, &numChildren) == 0) { ckfree(windows); windows = NULL; } else { for (i = 0; i < numChildren; i++) { | | | 6450 6451 6452 6453 6454 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 | if (XQueryTree(parentPtr->display, vRoot, &dummy1, &dummy2, &children, &numChildren) == 0) { ckfree(windows); windows = NULL; } else { for (i = 0; i < numChildren; i++) { hPtr = Tcl_FindHashEntry(&table, children[i]); if (hPtr != NULL) { childWinPtr = Tcl_GetHashValue(hPtr); *window_ptr++ = childWinPtr; } } /* |
︙ | ︙ |
Changes to unix/tkUnixXId.c.
1 2 3 4 5 6 7 8 9 10 11 12 | /* * tkUnixXId.c -- * * Copyright (c) 1993 The Regents of the University of California. * 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. */ #include "tkUnixInt.h" | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* * tkUnixXId.c -- * * Copyright (c) 1993 The Regents of the University of California. * 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. */ #include "tkUnixInt.h" /* *---------------------------------------------------------------------- * * Tk_GetPixmap -- * * Same as the XCreatePixmap function except that it manages resource |
︙ | ︙ |
Changes to win/Makefile.in.
︙ | ︙ | |||
203 204 205 206 207 208 209 | COPY = cp BUILD_TCLSH = @BUILD_TCLSH@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. | | | > | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | COPY = cp BUILD_TCLSH = @BUILD_TCLSH@ # Tk does not used deprecated Tcl constructs so it should # compile fine with -DTCL_NO_DEPRECATED. To remove its own # set of deprecated code uncomment the second line. NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED #NO_DEPRECATED_FLAGS = -DTCL_NO_DEPRECATED -DTK_NO_DEPRECATED # TCL_EXE is the name of a tclsh executable that is available *BEFORE* # running make for the first time. Certain build targets (make genstubs) # need it to be available on the PATH. This executable should *NOT* be # required just to do a normal build although it can be required to run # make dist. TCL_EXE = @TCLSH_PROG@ WINE = @WINE@ CC_SWITCHES = ${CFLAGS} ${CFLAGS_WARNING} ${SHLIB_CFLAGS} \ -I"${GENERIC_DIR_NATIVE}" -I"${WIN_DIR_NATIVE}" \ -I"${XLIB_DIR_NATIVE}" -I"${BITMAP_DIR_NATIVE}" \ -I"${TCL_GENERIC_NATIVE}" -I"${TCL_PLATFORM_NATIVE}" \ ${AC_FLAGS} $(NO_DEPRECATED_FLAGS) -DUSE_TCL_STUBS |
︙ | ︙ | |||
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | tkGC.$(OBJEXT) \ tkGeometry.$(OBJEXT) \ tkGet.$(OBJEXT) \ tkGrab.$(OBJEXT) \ tkGrid.$(OBJEXT) \ tkImage.$(OBJEXT) \ tkImgBmap.$(OBJEXT) \ tkImgGIF.$(OBJEXT) \ tkImgPNG.$(OBJEXT) \ tkImgPPM.$(OBJEXT) \ tkImgPhoto.$(OBJEXT) \ tkImgPhInstance.$(OBJEXT) \ tkImgUtil.$(OBJEXT) \ tkListbox.$(OBJEXT) \ tkMacWinMenu.$(OBJEXT) \ tkMain.$(OBJEXT) \ tkMain2.$(OBJEXT) \ tkMenu.$(OBJEXT) \ tkMenubutton.$(OBJEXT) \ tkMenuDraw.$(OBJEXT) \ tkMessage.$(OBJEXT) \ tkPanedWindow.$(OBJEXT) \ tkObj.$(OBJEXT) \ tkOldConfig.$(OBJEXT) \ tkOption.$(OBJEXT) \ tkPack.$(OBJEXT) \ tkPlace.$(OBJEXT) \ tkPointer.$(OBJEXT) \ tkRectOval.$(OBJEXT) \ tkScale.$(OBJEXT) \ tkScrollbar.$(OBJEXT) \ tkSelect.$(OBJEXT) \ tkStyle.$(OBJEXT) \ | > > > | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | tkGC.$(OBJEXT) \ tkGeometry.$(OBJEXT) \ tkGet.$(OBJEXT) \ tkGrab.$(OBJEXT) \ tkGrid.$(OBJEXT) \ tkImage.$(OBJEXT) \ tkImgBmap.$(OBJEXT) \ tkImgListFormat.$(OBJEXT) \ tkImgGIF.$(OBJEXT) \ tkImgPNG.$(OBJEXT) \ tkImgPPM.$(OBJEXT) \ tkImgSVGnano.$(OBJEXT) \ tkImgPhoto.$(OBJEXT) \ tkImgPhInstance.$(OBJEXT) \ tkImgUtil.$(OBJEXT) \ tkListbox.$(OBJEXT) \ tkMacWinMenu.$(OBJEXT) \ tkMain.$(OBJEXT) \ tkMain2.$(OBJEXT) \ tkMenu.$(OBJEXT) \ tkMenubutton.$(OBJEXT) \ tkMenuDraw.$(OBJEXT) \ tkMessage.$(OBJEXT) \ tkPanedWindow.$(OBJEXT) \ tkObj.$(OBJEXT) \ tkOldConfig.$(OBJEXT) \ tkOption.$(OBJEXT) \ tkPack.$(OBJEXT) \ tkPkgConfig.$(OBJEXT) \ tkPlace.$(OBJEXT) \ tkPointer.$(OBJEXT) \ tkRectOval.$(OBJEXT) \ tkScale.$(OBJEXT) \ tkScrollbar.$(OBJEXT) \ tkSelect.$(OBJEXT) \ tkStyle.$(OBJEXT) \ |
︙ | ︙ | |||
435 436 437 438 439 440 441 | # Specifying TESTFLAGS on the command line is the standard way to pass # args to tcltest, ie: # % make test TESTFLAGS="-verbose bps -file fileName.test" test: test-classic test-ttk test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32) | | | | | | | | | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | # Specifying TESTFLAGS on the command line is the standard way to pass # args to tcltest, ie: # % make test TESTFLAGS="-verbose bps -file fileName.test" test: test-classic test-ttk test-classic: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32) $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/all.tcl" \ $(TESTFLAGS) | $(WINE) ./$(CAT32) test-ttk: binaries $(TKTEST) $(TEST_DLL_FILE) $(CAT32) $(SHELL_ENV) $(WINE) ./$(TKTEST) "$(ROOT_DIR_NATIVE)/tests/ttk/all.tcl" \ $(TESTFLAGS) | $(WINE) ./$(CAT32) runtest: binaries $(TKTEST) $(TEST_DLL_FILE) $(SHELL_ENV) $(WINE) ./$(TKTEST) $(TESTFLAGS) $(SCRIPT) # This target can be used to run wish from the build directory # via `make shell` or `make shell SCRIPT=foo.tcl` shell: binaries $(SHELL_ENV) $(WINE) ./$(WISH) $(SCRIPT) demo: $(WISH) $(SHELL_ENV) $(WINE) ./$(WISH) $(ROOT_DIR)/library/demos/widget # This target can be used to run wish inside either gdb or insight gdb: binaries @echo "set env TCL_LIBRARY=$(TCL_SRC_DIR_NATIVE)/library" > gdb.run @echo "set env TK_LIBRARY=$(ROOT_DIR_NATIVE)/library" >> gdb.run PATH="$(TCL_BIN_DIR):$(PATH)"; export PATH; \ gdb ./$(WISH) --command=gdb.run |
︙ | ︙ | |||
483 484 485 486 487 488 489 | echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ | | | 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ $(COPY) $$i "$(BIN_INSTALL_DIR)"; \ fi; \ done @echo "Creating package index $(PKG_INDEX)"; @$(RM) $(PKG_INDEX); @(\ echo "if {[catch {package present Tcl 8.6-}]} return";\ echo "if {(\$$::tcl_platform(platform) eq \"unix\") && ([info exists ::env(DISPLAY)]";\ echo " || ([info exists ::argv] && (\"-display\" in \$$::argv)))} {";\ echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin libtk$(VERSION).dll]] Tk]";\ echo "} else {";\ echo " package ifneeded Tk $(VERSION)$(PATCH_LEVEL) [list load [file normalize [file join \$$dir .. .. bin $(TK_DLL_FILE)]] Tk]";\ echo "}";\ ) > $(PKG_INDEX); |
︙ | ︙ | |||
726 727 728 729 730 731 732 | @echo "This warning can be safely ignored, do not report as a bug!" genstubs: $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ "$(GENERIC_DIR_NATIVE)" \ "$(GENERIC_DIR_NATIVE)/tk.decls" \ "$(GENERIC_DIR_NATIVE)/tkInt.decls" | | | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | @echo "This warning can be safely ignored, do not report as a bug!" genstubs: $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ "$(GENERIC_DIR_NATIVE)" \ "$(GENERIC_DIR_NATIVE)/tk.decls" \ "$(GENERIC_DIR_NATIVE)/tkInt.decls" $(TCL_EXE) "$(TCL_TOOL_DIR)/genStubs.tcl" \ "$(TTK_DIR)" \ "$(TTK_DIR)/ttk.decls" # # The list of all the targets that do not correspond to real files. This stops # 'make' from getting confused when someone makes an error in a rule. # |
︙ | ︙ |
Changes to win/README.
|
| | | 1 2 3 4 5 6 7 8 | Tk 8.7 for Windows Originally by Scott Stanton while at Sun Microsystems Labs This is the directory where you configure and compile the Windows version of Tk. This directory also contains source files for Tk that are specific to Microsoft Windows. The rest of this file contains information specific to the Windows version of Tk. |
︙ | ︙ |
Changes to win/configure.
1 2 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. | | > | > > | | | | > | | > > | > | < < | < < < > | < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > < | | < | | > > > | > > > | | | | > | < < < < < < < < < < < < < | | < | | < < > | > > | < < | < < < > | | < < < < < < | < < < < < < < < > < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | < | | < > > > > | | | > > | > | > | > > | < > | < > < > > < < | | > | > | > | < | > > | < < | | > | > | < < < < < | < < | | < < > > < < < < < < > | | | | | | | | | | | < | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 | #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell [email protected] about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 </dev/null exec 6>&1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="../generic/tk.h" # Factoring default headers for most tests. ac_includes_default="\ #include <stdio.h> #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif #ifdef HAVE_SYS_STAT_H # include <sys/stat.h> #endif #ifdef STDC_HEADERS # include <stdlib.h> # include <stddef.h> #else # ifdef HAVE_STDLIB_H # include <stdlib.h> # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include <memory.h> # endif # include <string.h> #endif #ifdef HAVE_STRINGS_H # include <strings.h> #endif #ifdef HAVE_INTTYPES_H # include <inttypes.h> #endif #ifdef HAVE_STDINT_H # include <stdint.h> #endif #ifdef HAVE_UNISTD_H # include <unistd.h> #endif" ac_subst_vars='LTLIBOBJS LIBOBJS RES RC_DEFINES RC_DEFINE RC_INCLUDE RC_TYPE RC_OUT TK_LD_SEARCH_FLAGS TK_CC_SEARCH_FLAGS TK_BUILD_STUB_LIB_PATH TK_STUB_LIB_PATH TK_STUB_LIB_SPEC TK_BUILD_LIB_SPEC TK_LIB_SPEC TK_LIB_FLAG MAKE_EXE MAKE_DLL POST_MAKE_LIB MAKE_STUB_LIB MAKE_LIB LIBRARIES EXESUFFIX LIBSUFFIX LIBPREFIX DLLSUFFIX LIBS_GUI TK_SHARED_BUILD SHLIB_SUFFIX SHLIB_CFLAGS SHLIB_LD_LIBS SHLIB_LD STLIB_LD TK_RES LDFLAGS_WINDOW LDFLAGS_CONSOLE LDFLAGS_OPTIMIZE LDFLAGS_DEBUG CC_EXENAME CC_OBJNAME DEPARG EXTRA_CFLAGS CFG_TK_EXPORT_FILE_SUFFIX CFG_TK_UNSHARED_LIB_SUFFIX CFG_TK_SHARED_LIB_SUFFIX TCL_DBGX TCL_PATCH_LEVEL TCL_MINOR_VERSION TCL_MAJOR_VERSION TK_BIN_DIR TK_SRC_DIR TK_BUILD_STUB_LIB_SPEC TK_STUB_LIB_FLAG TK_STUB_LIB_FILE TK_DLL_FILE TK_LIB_FILE TK_DBGX TK_PATCH_LEVEL TK_MINOR_VERSION TK_MAJOR_VERSION TK_VERSION MACHINE TK_WIN_VERSION TCLSH_PROG BUILD_TCLSH VC_MANIFEST_EMBED_EXE VC_MANIFEST_EMBED_DLL LDFLAGS_DEFAULT CFLAGS_DEFAULT MAN2TCLFLAGS CFLAGS_WARNING CFLAGS_OPTIMIZE CFLAGS_DEBUG DL_LIBS WINE CYGPATH TCL_DEFS TCL_STUB_LIB_SPEC TCL_STUB_LIB_FLAG TCL_STUB_LIB_FILE TCL_LIB_SPEC TCL_LIB_FLAG TCL_LIB_FILE TCL_ZIP_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_VERSION SHARED_BUILD SET_MAKE RC RANLIB AR EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL OBJEXT_FOR_BUILD' ac_subst_files='' ac_user_opts=' enable_option_checking enable_shared with_tcl enable_64bit enable_symbols enable_embedded_manifest ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE |
︙ | ︙ | |||
333 334 335 336 337 338 339 340 341 342 | x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' | > | > < > | > > > > > > | > | > | > > > | > > | 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 | x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) |
︙ | ︙ | |||
382 383 384 385 386 387 388 | -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; | | | > > > | > > > | | | | > > > > > > > > > > | > > > > | > > > | | | | | | | > | | > > | | 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 | -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ |
︙ | ︙ | |||
434 435 436 437 438 439 440 441 442 443 444 445 446 447 | -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; | > > > > > > | 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; |
︙ | ︙ | |||
458 459 460 461 462 463 464 465 466 | -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | > > > > > | < | < | 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 | -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; |
︙ | ︙ | |||
529 530 531 532 533 534 535 536 537 538 539 540 541 542 | | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; | > > > > > > > > > > | 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 | | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; |
︙ | ︙ | |||
580 581 582 583 584 585 586 | -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) | | | | | | | > | | > > | | | | < > | > > | > > > > > | | < > | | < | | | | | | > | > > > > > > < > | > > > | > < > > | < < < | < < < < | | < > < < > > > > > > > > | | | | | | < | | > > > | > > > | > > > | > > > | | | | < < < | < | > > > > > > > > > > | < < | < < < < < < < < < < < < < | < | < < < < < < < < < < < < | | | | > | 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. |
︙ | ︙ | |||
788 789 790 791 792 793 794 | Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit | | < < < | | | | | < | | | | | | > > | > | > > > > > > < < < > | | > > < > > | | > > | | | > > > > | | | > > | < | < | < | | > | | | < | < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < | | | | | | | < < | < < | | | | > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | > | 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 | Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-shared build and link with shared libraries (default: on) --enable-64bit enable 64bit support (where applicable) --enable-symbols build with debugging symbols (default: off) --enable-embedded-manifest embed manifest if possible (default: yes) Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-tcl directory containing tcl configuration (tclConfig.sh) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a nonstandard directory <lib dir> LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES # --------------------------------------------- # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR # accordingly. ac_fn_c_check_decl () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 $as_echo_n "checking whether $as_decl_name is declared... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { #ifndef $as_decl_name #ifdef __cplusplus (void) $as_decl_use; #else (void) $as_decl_name; #endif #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_decl # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## |
︙ | ︙ | |||
1029 1030 1031 1032 1033 1034 1035 | # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= | < | | | | | < < | | | | < | | < > > > > | > > > > > > > > > > > | | | | | < | | < > > < | | < | > > > | < | | | < | > > > | < | | < | | | | | | | | | | < < < < > > > > | > > | > > > > > > | | > | | > | < | > > | | | | > > > > | | | | | | | | | | < | | | | | | > > > > | | > > > > > > | | | | < < | | > > | | < | < > > > < < < < < < < < < < < < < < < < < | | | | 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 | # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # The following define is needed when building with Cygwin since newer # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a2" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then |
︙ | ︙ | |||
1342 1343 1344 1345 1346 1347 1348 | ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 | | | | | | | | | > | | | | > | | | | | | | | > | | | | > > > > > > > > > | > | | | | | | | | | | > | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < | | | | | | | | > | | | | > | | | | | | | | | > | | | | > | | | | | | | | | > | | | | > > > > > > > > > > | > | | | | < < | | | > | | | | < < | | | < | > > > > > > > | | > | < < < < | | | | > > > > > > > > > > > > > > | > > > > > > | | | < < < | < | | | > | | < < < > > | > | < < > > > | > > > > > > > | | | | | | > > | < > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < | | | > > > > > > | | | | < | | | | < < | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | < < < < | > > > > > > | | | | > | | | | | | < < | | | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | | > > > > > > > > > > > > | > > | > > > | > > > > > | < > | | > > > > > > > > > | > > > | < < < < < < < | < < < < < < < < < < < < < < < < > | | < > | > | | | | | | | | < < < < < | | 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 | ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdio.h> int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdarg.h> #include <stdio.h> struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { |
︙ | ︙ | |||
2039 2040 2041 2042 2043 2044 2045 | va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated | | | > > > > > < < | < < < < | < < < < < < < | < < < < < < < < < < < < < < | < < < < < | > | | | > > > | | | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < | < < < < | > | | < | 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 | va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; |
︙ | ︙ | |||
2341 2342 2343 2344 2345 2346 2347 | esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu | | | | | | < < < < < < < < < < | < < < < < < < < < < < | < < < | | | < < < < < < < < < < | < < < < < < < < < < < < < < | | | | | | < < < < < < < < < < | < < < < < < < < < < < | < < < | | | < < < < < < < < < < | < < < < < < < < < < < < < < | | | | | | | | < | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > | > > > > > > > | > > > > > > > | > > | > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | < < < < | | | < < < < | | | | < < < < > | | < < < < | < < < < < < | < < < < < | | > > | | < | < | | | | | | | | > | | | | > | | | | | | | | > | | | | > > > > > > > > > | > | | | | | | | | > | | | | > | | | | | | | | > | | | | > > > > > > > > > | > | | | | | | | | > | | | | > | | | | | | | | > | | | | > > > > > > > > > | > | | | > | | > | | | < > | < > | < > | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | | < | | > | | | | < | < > | | < | | > | | | | | | < | < | 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 | esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include <limits.h> #else # include <assert.h> #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include <limits.h> #else # include <assert.h> #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ac_nonexistent.h> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <float.h> int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <string.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <ctype.h> #include <stdlib.h> #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_AR" = x; then AR="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi else AR="$ac_cv_prog_AR" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. set dummy ${ac_tool_prefix}windres; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RC"; then ac_cv_prog_RC="$RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RC="${ac_tool_prefix}windres" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RC=$ac_cv_prog_RC if test -n "$RC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RC" >&5 $as_echo "$RC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RC"; then ac_ct_RC=$RC # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RC"; then ac_cv_prog_ac_ct_RC="$ac_ct_RC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RC="windres" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RC=$ac_cv_prog_ac_ct_RC if test -n "$ac_ct_RC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RC" >&5 $as_echo "$ac_ct_RC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RC" = x; then RC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RC=$ac_ct_RC fi else RC="$ac_cv_prog_RC" fi #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5 $as_echo_n "checking how to build libraries... " >&6; } # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; tcl_ok=$enableval else tcl_ok=yes fi if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5 $as_echo "shared" >&6; } SHARED_BUILD=1 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5 $as_echo "static" >&6; } SHARED_BUILD=0 $as_echo "#define STATIC_BUILD 1" >>confdefs.h fi #-------------------------------------------------------------------- # Locate and source the tclConfig.sh file. #-------------------------------------------------------------------- # # Ok, lets find the tcl configuration # First, look for one uninstalled. # the alternative search directory is invoked by --with-tcl # if test x"${no_tcl}" = x ; then # we reset no_tcl in case something fails here no_tcl=true # Check whether --with-tcl was given. if test "${with_tcl+set}" = set; then : withval=$with_tcl; with_tclconfig="${withval}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5 $as_echo_n "checking for Tcl configuration... " >&6; } if ${ac_cv_c_tclconfig+:} false; then : $as_echo_n "(cached) " >&6 else # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then case "${with_tclconfig}" in */tclConfig.sh ) if test -f "${with_tclconfig}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5 $as_echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;} with_tclconfig="`echo "${with_tclconfig}" | sed 's!/tclConfig\.sh$!!'`" fi ;; esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig="`(cd "${with_tclconfig}"; pwd)`" else as_fn_error $? "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5 fi fi # then check for a private Tcl installation if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ |
︙ | ︙ | |||
3214 3215 3216 3217 3218 3219 3220 | fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" | < | < | | | | | | | | | 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 | fi fi if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" as_fn_error $? "Can't find Tcl configuration definitions. Use --with-tcl to specify a directory containing tclConfig.sh" "$LINENO" 5 else no_tcl= TCL_BIN_DIR="${ac_cv_c_tclconfig}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "found ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo_n "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... " >&6; } if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5 $as_echo "loading" >&6; } . "${TCL_BIN_DIR}/tclConfig.sh" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5 $as_echo "could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6; } fi # # If the TCL_BIN_DIR is the build directory (not the install directory), # then set the common variable name to the value of the build variables. # For example, the variable TCL_LIB_SPEC will be set to the value # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC |
︙ | ︙ | |||
3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" | > | 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" |
︙ | ︙ | |||
3280 3281 3282 3283 3284 3285 3286 3287 | if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then | > > < < < | | | < | < < < | | | < > < < < < < < < < < | | < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | < < < < < < | | | | | < | | < < < | < < < < < < < < < < < | < < < < < < < < < < < < < | < | | | | | | | | > | | > > > | | > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | | 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 | if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5 fi if test "${TCL_MINOR_VERSION}" -lt 6; then as_fn_error $? "${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better." "$LINENO" 5 fi fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # Step 0: Enable 64 bit support? { $as_echo "$as_me:${as_lineno-$LINENO}: checking if 64bit support is requested" >&5 $as_echo_n "checking if 64bit support is requested... " >&6; } # Check whether --enable-64bit was given. if test "${enable_64bit+set}" = set; then : enableval=$enable_64bit; do64bit=$enableval else do64bit=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $do64bit" >&5 $as_echo "$do64bit" >&6; } # Set some defaults (may get changed below) EXTRA_CFLAGS="" $as_echo "#define MODULE_SCOPE extern" >>confdefs.h # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CYGPATH+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CYGPATH"; then ac_cv_prog_CYGPATH="$CYGPATH" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CYGPATH="cygpath -m" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_CYGPATH" && ac_cv_prog_CYGPATH="echo" fi fi CYGPATH=$ac_cv_prog_CYGPATH if test -n "$CYGPATH"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CYGPATH" >&5 $as_echo "$CYGPATH" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "wine", so it can be a program name with args. set dummy wine; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_WINE+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$WINE"; then ac_cv_prog_WINE="$WINE" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_WINE="wine" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi WINE=$ac_cv_prog_WINE if test -n "$WINE"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINE" >&5 $as_echo "$WINE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" if test "$GCC" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cross-compile version of gcc" >&5 $as_echo_n "checking for cross-compile version of gcc... " >&6; } if ${ac_cv_cross+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN32 #error cross-compiler #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_cross=no else ac_cv_cross=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cross" >&5 $as_echo "$ac_cv_cross" >&6; } if test "$ac_cv_cross" = "yes"; then case "$do64bit" in amd64|x64|yes) CC="x86_64-w64-mingw32-gcc" LD="x86_64-w64-mingw32-ld" AR="x86_64-w64-mingw32-ar" |
︙ | ︙ | |||
3565 3566 3567 3568 3569 3570 3571 | if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then conftest=/tmp/conftest.rc echo "STRINGTABLE BEGIN" > $conftest echo "101 \"name\"" >> $conftest echo "END" >> $conftest | | | | | | | | | | | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | < | < | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > | > | < < < < < < < < < < < < < < < < < < < < < | < < < | | | | | | | | | | | < < | | < | 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 | if test "$GCC" = "yes" && test "$CYGPATH" != "echo" ; then conftest=/tmp/conftest.rc echo "STRINGTABLE BEGIN" > $conftest echo "101 \"name\"" >> $conftest echo "END" >> $conftest { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Windows native path bug in windres" >&5 $as_echo_n "checking for Windows native path bug in windres... " >&6; } cyg_conftest=`$CYGPATH $conftest` if { ac_try='$RC -o conftest.res.o $cyg_conftest' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; } ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CYGPATH=echo fi conftest= cyg_conftest= fi if test "$CYGPATH" = "echo"; then DEPARG='"$<"' else DEPARG='"$(shell $(CYGPATH) $<)"' fi # set various compiler flags depending on whether we are using gcc or cl if test "${GCC}" = "yes" ; then extra_cflags="-pipe" extra_ldflags="-pipe -static-libgcc" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mingw32 version of gcc" >&5 $as_echo_n "checking for mingw32 version of gcc... " >&6; } if ${ac_cv_win32+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _WIN32 #error win32 #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_win32=no else ac_cv_win32=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_win32" >&5 $as_echo "$ac_cv_win32" >&6; } if test "$ac_cv_win32" != "yes"; then as_fn_error $? "${CC} cannot produce win32 executables." "$LINENO" 5 fi hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -mwindows -municode -Dmain=xxmain" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working -municode linker flag" >&5 $as_echo_n "checking for working -municode linker flag... " >&6; } if ${ac_cv_municode+:} false; then : $as_echo_n "(cached) " >&6 else # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <windows.h> int APIENTRY wWinMain(HINSTANCE a, HINSTANCE b, LPWSTR c, int d) {return 0;} int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_municode=yes else ac_cv_municode=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_municode" >&5 $as_echo "$ac_cv_municode" >&6; } CFLAGS=$hold_cflags if test "$ac_cv_municode" = "yes" ; then extra_ldflags="$extra_ldflags -municode" else extra_cflags="$extra_cflags -DTCL_BROKEN_MAINARGS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler flags" >&5 $as_echo_n "checking compiler flags... " >&6; } if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS='${LIBS}' LIBS="-lnetapi32 -lkernel32 -luser32 -ladvapi32 -luserenv -lws2_32" # mingw needs to link ole32 and oleaut32 for [send], but MSVC doesn't LIBS_GUI="-lgdi32 -lcomdlg32 -limm32 -lcomctl32 -lshell32 -luuid -lole32 -loleaut32" STLIB_LD='${AR} cr' RC_OUT=-o RC_TYPE= RC_INCLUDE=--include RC_DEFINE=--define RES=res.o MAKE_LIB="\${STLIB_LD} \$@" MAKE_STUB_LIB="\${STLIB_LD} \$@" POST_MAKE_LIB="\${RANLIB} \$@" MAKE_EXE="\${CC} -o \$@" LIBPREFIX="lib" if test "${SHARED_BUILD}" = "0" ; then # static { $as_echo "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 $as_echo "using static flags" >&6; } runtime= LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic { $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 $as_echo "using shared flags" >&6; } # ad-hoc check to see if CC supports -shared. if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then as_fn_error $? "${CC} does not support the -shared option. You will need to upgrade to a newer version of the toolchain." "$LINENO" 5 fi runtime= # Add SHLIB_LD_LIBS to the Make rule, not here. EXESUFFIX="\${DBGX}.exe" LIBRARIES="\${SHARED_LIBRARIES}" |
︙ | ︙ | |||
3791 3792 3793 3794 3795 3796 3797 | LIBFLAGSUFFIX="\${DBGX}" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" | | | 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 | LIBFLAGSUFFIX="\${DBGX}" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= # Specify the CC output file names based on the target name CC_OBJNAME="-o \$@" CC_EXENAME="-o \$@" |
︙ | ︙ | |||
3819 3820 3821 3822 3823 3824 3825 | #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build | | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | | | | | | 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 | #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}" LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}" LDFLAGS_WINDOW="-mwindows ${extra_ldflags}" case "$do64bit" in amd64|x64|yes) MACHINE="AMD64" ; # assume AMD64 as default 64-bit build { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } ;; ia64) MACHINE="IA64" { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } ;; *) cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef _WIN64 #error 32-bit #endif int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_win_64bit=yes else tcl_win_64bit=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test "$tcl_win_64bit" = "yes" ; then do64bit=amd64 MACHINE="AMD64" { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } fi ;; esac else if test "${SHARED_BUILD}" = "0" ; then # static { $as_echo "$as_me:${as_lineno-$LINENO}: result: using static flags" >&5 $as_echo "using static flags" >&6; } runtime=-MT LIBRARIES="\${STATIC_LIBRARIES}" EXESUFFIX="s\${DBGX}.exe" else # dynamic { $as_echo "$as_me:${as_lineno-$LINENO}: result: using shared flags" >&5 $as_echo "using shared flags" >&6; } runtime=-MD # Add SHLIB_LD_LIBS to the Make rule, not here. LIBRARIES="\${SHARED_LIBRARIES}" EXESUFFIX="\${DBGX}.exe" case "x`echo \${VisualStudioVersion}`" in x1[4-9]*) lflags="${lflags} -nodefaultlib:libucrt.lib" |
︙ | ︙ | |||
3937 3938 3939 3940 3941 3942 3943 | ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | < < < < < < | | 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 | ;; ia64) MACHINE="IA64" PATH64="${MSSDK}/Bin/Win64" ;; esac if test ! -d "${PATH64}" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not find 64-bit $MACHINE SDK" >&5 $as_echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK" >&2;} fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using 64-bit $MACHINE mode" >&5 $as_echo " Using 64-bit $MACHINE mode" >&6; } fi LIBS="netapi32.lib kernel32.lib user32.lib advapi32.lib userenv.lib ws2_32.lib" case "x`echo \${VisualStudioVersion}`" in x1[4-9]*) LIBS="$LIBS ucrt.lib" ;; *) ;; esac if test "$do64bit" != "no" ; then # The space-based-path will work for the Makefile, but will # not work if AC_TRY_COMPILE is called. TEA has the # TEA_PATH_NOSPACE to avoid this issue. # Check if _WIN64 is already recognized, and if so we don't # need to modify CC. ac_fn_c_check_decl "$LINENO" "_WIN64" "ac_cv_have_decl__WIN64" "$ac_includes_default" if test "x$ac_cv_have_decl__WIN64" = xyes; then : else CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \ -I\"${MSSDK}/Include/crt\" \ -I\"${MSSDK}/Include/crt/sys\"" fi RC="\"${MSSDK}/bin/rc.exe\"" |
︙ | ︙ | |||
4044 4045 4046 4047 4048 4049 4050 | CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 | CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" RC_OUT=-fo RC_TYPE=-r |
︙ | ︙ | |||
4179 4180 4181 4182 4183 4184 4185 | # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\$@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\$@')\"" # Specify linker flags depending on the type of app being # built -- Console vs. Window. | | < | < | | | | | | < < < < < < < < | < < < < < < < < < < < | | > > | | < | < | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | < | < | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | < | < | | | | | < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | < | < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | | | | | < | < < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < | < | | < < < < < < < < < < < | | < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < | < | | | | < | | > < | < | | < | < | | < | < < | < < | < | | | | | | | | | < | > | < < < < | | | | | | | | | | | | | | | | 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 | # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\$@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\$@')\"" # Specify linker flags depending on the type of app being # built -- Console vs. Window. if test "${TARGETCPU}" != "X86"; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi if test "$do64bit" != "no" ; then $as_echo "#define TCL_CFG_DO64BIT 1" >>confdefs.h fi if test "${GCC}" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SEH support in compiler" >&5 $as_echo_n "checking for SEH support in compiler... " >&6; } if ${tcl_cv_seh+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : tcl_cv_seh=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN int main(int argc, char** argv) { int a, b = 0; __try { a = 666 / b; } __except (EXCEPTION_EXECUTE_HANDLER) { return 0; } return 1; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : tcl_cv_seh=yes else tcl_cv_seh=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_seh" >&5 $as_echo "$tcl_cv_seh" >&6; } if test "$tcl_cv_seh" = "no" ; then $as_echo "#define HAVE_NO_SEH 1" >>confdefs.h fi # # Check to see if the excpt.h include file provided contains the # definition for EXCEPTION_DISPOSITION; if not, which is the case # with Cygwin's version as of 2002-04-10, define it to be int, # sufficient for getting the current code to work. # { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EXCEPTION_DISPOSITION support in include files" >&5 $as_echo_n "checking for EXCEPTION_DISPOSITION support in include files... " >&6; } if ${tcl_cv_eh_disposition+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define WIN32_LEAN_AND_MEAN # include <windows.h> # undef WIN32_LEAN_AND_MEAN int main () { EXCEPTION_DISPOSITION x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_eh_disposition=yes else tcl_cv_eh_disposition=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_eh_disposition" >&5 $as_echo "$tcl_cv_eh_disposition" >&6; } if test "$tcl_cv_eh_disposition" = "no" ; then $as_echo "#define EXCEPTION_DISPOSITION int" >>confdefs.h fi # Check to see if winnt.h defines CHAR, SHORT, and LONG # even if VOID has already been #defined. The win32api # used by mingw and cygwin is known to do this. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winnt.h that ignores VOID define" >&5 $as_echo_n "checking for winnt.h that ignores VOID define... " >&6; } if ${tcl_cv_winnt_ignore_void+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define VOID void #define WIN32_LEAN_AND_MEAN #include <windows.h> #undef WIN32_LEAN_AND_MEAN int main () { CHAR c; SHORT s; LONG l; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_winnt_ignore_void=yes else tcl_cv_winnt_ignore_void=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_winnt_ignore_void" >&5 $as_echo "$tcl_cv_winnt_ignore_void" >&6; } if test "$tcl_cv_winnt_ignore_void" = "yes" ; then $as_echo "#define HAVE_WINNT_IGNORE_VOID 1" >>confdefs.h fi # See if the compiler supports casting to a union type. # This is used to stop gcc from printing a compiler # warning when initializing a union member. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cast to union support" >&5 $as_echo_n "checking for cast to union support... " >&6; } if ${tcl_cv_cast_to_union+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { union foo { int i; double d; }; union foo f = (union foo) (int) 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : tcl_cv_cast_to_union=yes else tcl_cv_cast_to_union=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_cast_to_union" >&5 $as_echo "$tcl_cv_cast_to_union" >&6; } if test "$tcl_cv_cast_to_union" = "yes"; then $as_echo "#define HAVE_CAST_TO_UNION 1" >>confdefs.h fi fi # DL_LIBS is empty, but then we match the Unix version #-------------------------------------------------------------------- # man2tcl needs this so that it can use errno.h #-------------------------------------------------------------------- ac_fn_c_check_header_mongrel "$LINENO" "errno.h" "ac_cv_header_errno_h" "$ac_includes_default" if test "x$ac_cv_header_errno_h" = xyes; then : else MAN2TCLFLAGS="-DNO_ERRNO_H" fi #------------------------------------------- # Check for _strtoi64 #------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking availability of _strtoi64" >&5 $as_echo_n "checking availability of _strtoi64... " >&6; } if ${tcl_cv_strtoi64+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <stdlib.h> int main () { _strtoi64(0,0,0) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : tcl_cv_strtoi64=yes else tcl_cv_strtoi64=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $tcl_cv_strtoi64" >&5 $as_echo "$tcl_cv_strtoi64" >&6; } if test $tcl_cv_strtoi64 = no; then $as_echo "#define NO_STRTOI64 1" >>confdefs.h fi #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- ac_fn_c_check_header_compile "$LINENO" "uxtheme.h" "ac_cv_header_uxtheme_h" "#include <windows.h> " if test "x$ac_cv_header_uxtheme_h" = xyes; then : $as_echo "#define HAVE_UXTHEME_H 1" >>confdefs.h else { $as_echo "$as_me:${as_lineno-$LINENO}: xpnative theme will be unavailable" >&5 $as_echo "$as_me: xpnative theme will be unavailable" >&6;} fi ac_fn_c_check_header_compile "$LINENO" "vssym32.h" "ac_cv_header_vssym32_h" "#include <windows.h> #include <uxtheme.h> " if test "x$ac_cv_header_vssym32_h" = xyes; then : $as_echo "#define HAVE_VSSYM32_H 1" >>confdefs.h fi #-------------------------------------------------------------------- # Set the default compiler switches based on the --enable-symbols # option. This macro depends on C flags, and should be called # after SC_CONFIG_CFLAGS macro is called. #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for build with symbols" >&5 $as_echo_n "checking for build with symbols... " >&6; } # Check whether --enable-symbols was given. if test "${enable_symbols+set}" = set; then : enableval=$enable_symbols; tcl_ok=$enableval else tcl_ok=no fi # FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)' LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)' DBGX="" $as_echo "#define NDEBUG 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "#define TCL_CFG_OPTIMIZED 1" >>confdefs.h else CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' DBGX=g if test "$tcl_ok" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes (standard debugging)" >&5 $as_echo "yes (standard debugging)" >&6; } fi fi if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then $as_echo "#define TCL_MEM_DEBUG 1" >>confdefs.h fi if test "$tcl_ok" = "compile" -o "$tcl_ok" = "all"; then $as_echo "#define TCL_COMPILE_DEBUG 1" >>confdefs.h $as_echo "#define TCL_COMPILE_STATS 1" >>confdefs.h fi if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then if test "$tcl_ok" = "all"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled symbols mem compile debugging" >&5 $as_echo "enabled symbols mem compile debugging" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabled $tcl_ok debugging" >&5 $as_echo "enabled $tcl_ok debugging" >&6; } fi fi TK_DBGX=${DBGX} #-------------------------------------------------------------------- # Embed the manifest if we can determine how #-------------------------------------------------------------------- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to embed manifest" >&5 $as_echo_n "checking whether to embed manifest... " >&6; } # Check whether --enable-embedded-manifest was given. if test "${enable_embedded_manifest+set}" = set; then : enableval=$enable_embedded_manifest; embed_ok=$enableval else embed_ok=yes fi VC_MANIFEST_EMBED_DLL= VC_MANIFEST_EMBED_EXE= result=no if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \ -a "$GCC" != "yes" ; then # Add the magic to embed the manifest into the dll/exe cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined(_MSC_VER) && _MSC_VER >= 1400 print("manifest needed") #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "manifest needed" >/dev/null 2>&1; then : # Could do a CHECK_PROG for mt, but should always be with MSVC8+ # Could add 'if test -f' check, but manifest should be created # in this compiler case # Add in a manifest argument that may be specified # XXX Needs improvement so that the test for existence accounts # XXX for a provided (known) manifest VC_MANIFEST_EMBED_DLL="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] wish.exe.manifest -outputresource:\$@\;2 ; fi" VC_MANIFEST_EMBED_EXE="if test -f \[email protected] ; then mt.exe -nologo -manifest \[email protected] wish.exe.manifest -outputresource:\$@\;1 ; fi" result=yes if test "xwish.exe.manifest" != x ; then result="yes (wish.exe.manifest)" fi fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5 $as_echo "$result" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh in Tcl build directory" >&5 $as_echo_n "checking for tclsh in Tcl build directory... " >&6; } BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BUILD_TCLSH" >&5 $as_echo "$BUILD_TCLSH" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tclsh" >&5 $as_echo_n "checking for tclsh... " >&6; } if ${ac_cv_path_tclsh+:} false; then : $as_echo_n "(cached) " >&6 else search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/tclsh[8-9]*.exe 2> /dev/null` \ `ls -r $dir/tclsh* 2> /dev/null` ; do if test x"$ac_cv_path_tclsh" = x ; then if test -f "$j" ; then ac_cv_path_tclsh=$j break fi fi done done fi if test -f "$ac_cv_path_tclsh" ; then TCLSH_PROG="$ac_cv_path_tclsh" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH_PROG" >&5 $as_echo "$TCLSH_PROG" >&6; } else # It is not an error if an installed version of Tcl can't be located. TCLSH_PROG="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: No tclsh found on PATH" >&5 $as_echo "No tclsh found on PATH" >&6; } fi #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ |
︙ | ︙ | |||
5166 5167 5168 5169 5170 5171 5172 |
| | > | > > > > > > > > > > > > > > > > | | | | | | < | | > | > | | | | | | > > > | | > > > > > > > > > > > | < < < < < < < < < < < < < < < | | > > > > > > | | | < > | | | | | > > > > > > | < < < < < < < < > > | < > < | > | > | | | > | | > | > | | | | | | | > | | > > | > | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | | > > > > > > | > | > > > > > > > > > > | > > > > > > | > > > > | > > | > > > < | < | > | | > > | | > > > > > | > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > | > > > > > < | | < | | > > > | > > > | | | | > | | < | > | < < < < < < < < | | < < | < < < < < < < < < < < < < | | > > | < | > | > | > > | > > > > > > > | < < < > > > > > < < < < < < < < | < < | < < < < < < < < < | > > | | | > > > > | > > | < < | | < | < < > | | < < < | < < | > | | < < < | < < < | < < < > > | | | < < < < | | < > > | > > > | < < | < < < < < < < < > | | < < | < | > | < > | > > > > > > > > > | | | | < < | | | < | | | < < < < < < < < | | < | > | < | | < > < < < < < < < | > | | > | | > | | > > | | | | < > | > | | | > > | > | | < > > > > > | | | | < < < < < < | | | < < < < < < < | | | < < > > | | > > < < | | < | > | < | > > > > > | | | > > > > > > > > > | > > | < | | | | | < > | | > > > | > > > | < | | | | < < | < > | | < | > | | > > > > > > > > > > | > > | > > | < < < > > | > | < < | | | | | | | | | | | | < < | > > | | | | | | < < < < < | < > | > > > > | < < | < < < < | > > | | | > > | < < < > | < < > > | | > > > | < < > > < < > > | < < > > | | | < < > > | < > | | | < | > | | | < < > > | | | | | | > > | | | | | | > | < < | > | | | | | | | < > | | | | | | | | > > > | | | | | | | | < > | < > | | > > | < < | | | < < < < < < > > | > > > > > > > | < < < | < < < | | > | | < | | | | | < < < < < < < | < < < > | < | < < | > > > > > | | | | > > > > > > < < > > > > > > | > > > > > > > > > > > | | < | | < < < | > < | | < | | | > > | | < < < < < < < < < < < < < < < < > > | | > > | > > > | < < < < < | | > > | | | > > > > | | | > > | < | < | < | | > | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < | < < < < < < < < < < < < < < < < < < < < | < < > > | > | > | < < | | | | > | < > > > > | > | < > > > > | | < < > > > > > > > > > | < > > > > | | | | > > | | | | | | | > > > > | > > > > > > > > | | | > | | > > | | | > | < < | < > > > | > > > > | 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 | ac_config_files="$ac_config_files Makefile tkConfig.sh wish.exe.manifest" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' :mline /\\$/{ N s,\\\n,, b mline } t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "tkConfig.sh") CONFIG_FILES="$CONFIG_FILES tkConfig.sh" ;; "wish.exe.manifest") CONFIG_FILES="$CONFIG_FILES wish.exe.manifest" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' <conf$$subs.awk | sed ' /^[^""]/{ N s/\n// } ' >>$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" eval set X " :F $CONFIG_FILES " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi |
Added win/configure.ac.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 | #! /bin/bash -norc # This file is an input file used by the GNU "autoconf" program to # generate the file "configure", which is run during Tk installation # to configure the system for the local environment. AC_INIT(../generic/tk.h) AC_PREREQ(2.69) # The following define is needed when building with Cygwin since newer # versions of autoconf incorrectly set SHELL to /bin/bash instead of # /bin/sh. The bash shell seems to suffer from some strange failures. SHELL=/bin/sh TK_VERSION=8.7 TK_MAJOR_VERSION=8 TK_MINOR_VERSION=7 TK_PATCH_LEVEL="a2" VER=$TK_MAJOR_VERSION$TK_MINOR_VERSION #------------------------------------------------------------------------ # Handle the --prefix=... option #------------------------------------------------------------------------ if test "${prefix}" = "NONE"; then prefix=/usr/local fi if test "${exec_prefix}" = "NONE"; then exec_prefix=$prefix fi # libdir must be a fully qualified path (not ${exec_prefix}/lib) eval libdir="$libdir" #------------------------------------------------------------------------ # Standard compiler checks #------------------------------------------------------------------------ # If the user did not set CFLAGS, set it now to keep # the AC_PROG_CC macro from adding "-g -O2". if test "${CFLAGS+set}" != "set" ; then CFLAGS="" fi AC_PROG_CC AC_C_INLINE AC_HEADER_STDC AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(RANLIB, ranlib) AC_CHECK_TOOL(RC, windres) #-------------------------------------------------------------------- # Checks to see if the make program sets the $MAKE variable. #-------------------------------------------------------------------- AC_PROG_MAKE_SET #-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- AC_OBJEXT AC_EXEEXT #-------------------------------------------------------------------- # The statements below define a collection of symbols related to # building libtk as a shared library instead of a static library. #-------------------------------------------------------------------- SC_ENABLE_SHARED #-------------------------------------------------------------------- # Locate and source the tclConfig.sh file. #-------------------------------------------------------------------- SC_PATH_TCLCONFIG($TK_PATCH_LEVEL) SC_LOAD_TCLCONFIG if test "${TCL_MAJOR_VERSION}" -lt 9 ; then if test "${TCL_MAJOR_VERSION}" != "${TK_MAJOR_VERSION}"; then AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.]) fi if test "${TCL_MINOR_VERSION}" -lt 6; then AC_MSG_ERROR([${TCL_BIN_DIR}/tclConfig.sh is for Tcl ${TCL_VERSION}. Tk ${TK_VERSION}${TK_PATCH_LEVEL} needs Tcl 8.6+. Use --with-tcl= option to indicate location of tclConfig.sh file for Tcl 8.6 or better.]) fi fi #-------------------------------------------------------------------- # The statements below define a collection of compile flags. This # macro depends on the value of SHARED_BUILD, and should be called # after SC_ENABLE_SHARED checks the configure switches. #-------------------------------------------------------------------- SC_CONFIG_CFLAGS #-------------------------------------------------------------------- # man2tcl needs this so that it can use errno.h #-------------------------------------------------------------------- AC_CHECK_HEADER(errno.h, , MAN2TCLFLAGS="-DNO_ERRNO_H") AC_SUBST(MAN2TCLFLAGS) #------------------------------------------- # Check for _strtoi64 #------------------------------------------- AC_CACHE_CHECK([availability of _strtoi64], tcl_cv_strtoi64, [ AC_TRY_LINK([#include <stdlib.h>], [_strtoi64(0,0,0)], tcl_cv_strtoi64=yes, tcl_cv_strtoi64=no)]) if test $tcl_cv_strtoi64 = no; then AC_DEFINE(NO_STRTOI64, 1, [Is _strtoi64 function available?]) fi #-------------------------------------------------------------------- # Windows XP theme engine header for Ttk #-------------------------------------------------------------------- AC_CHECK_HEADER([uxtheme.h], [AC_DEFINE(HAVE_UXTHEME_H)], [AC_MSG_NOTICE([xpnative theme will be unavailable])], [#include <windows.h>]) AC_CHECK_HEADER([vssym32.h], [AC_DEFINE(HAVE_VSSYM32_H)], [], [#include <windows.h> #include <uxtheme.h>]) #-------------------------------------------------------------------- # Set the default compiler switches based on the --enable-symbols # option. This macro depends on C flags, and should be called # after SC_CONFIG_CFLAGS macro is called. #-------------------------------------------------------------------- SC_ENABLE_SYMBOLS TK_DBGX=${DBGX} #-------------------------------------------------------------------- # Embed the manifest if we can determine how #-------------------------------------------------------------------- SC_EMBED_MANIFEST(wish.exe.manifest) SC_BUILD_TCLSH SC_PROG_TCLSH #------------------------------------------------------------------------ # tkConfig.sh refers to this by a different name #------------------------------------------------------------------------ TK_SHARED_BUILD=${SHARED_BUILD} #-------------------------------------------------------------------- # Perform final evaluations of variables with possible substitutions. #-------------------------------------------------------------------- TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" eval "TK_LIB_FILE=${LIBPREFIX}tk$VER${LIBSUFFIX}" eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" # FIXME: All of this var junk needs to be done in tcl.m4 !!!! # I left out the other vars that also need to get defined here. # we also need to double check about spaces in path names eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\"" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" TK_BUILD_LIB_SPEC="-L`pwd` ${TK_LIB_FLAG}" eval "TK_STUB_LIB_FLAG=\"-ltkstub${VER}${LIBFLAGSUFFIX}\"" TK_BUILD_STUB_LIB_SPEC="-L`pwd` ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_SPEC="-L${libdir} ${TK_STUB_LIB_FLAG}" TK_STUB_LIB_PATH="${libdir}/${TK_STUB_LIB_FILE}" TK_BUILD_STUB_LIB_PATH="`pwd`/${TK_STUB_LIB_FILE}" eval "DLLSUFFIX=${DLLSUFFIX}" eval "LIBPREFIX=${LIBPREFIX}" eval "LIBSUFFIX=${LIBSUFFIX}" eval "EXESUFFIX=${EXESUFFIX}" CFG_TK_SHARED_LIB_SUFFIX=${TK_SHARED_LIB_SUFFIX} CFG_TK_UNSHARED_LIB_SUFFIX=${TK_UNSHARED_LIB_SUFFIX} CFG_TK_EXPORT_FILE_SUFFIX=${TK_EXPORT_FILE_SUFFIX} #-------------------------------------------------------------------- # Adjust the defines for how the resources are built depending # on symbols and static vs. shared. #-------------------------------------------------------------------- if test ${SHARED_BUILD} = 0 -o "$TCL_NEEDS_EXP_FILE" = 0; then if test "${DBGX}" = "d"; then RC_DEFINES="${RC_DEFINE} STATIC_BUILD ${RC_DEFINE} DEBUG" else RC_DEFINES="${RC_DEFINE} STATIC_BUILD" fi TK_RES="" else if test "${DBGX}" = "d"; then RC_DEFINES="${RC_DEFINE} DEBUG" else RC_DEFINES="" fi TK_RES='tk.$(RES)' fi # The wish.exe.manifest requires these # TK_WIN_VERSION is the 4 dotted pair Windows version format which needs # the release level, and must account for interim release versioning case "$TK_PATCH_LEVEL" in *a*) TK_RELEASE_LEVEL=0 ;; *b*) TK_RELEASE_LEVEL=1 ;; *) TK_RELEASE_LEVEL=2 ;; esac TK_WIN_VERSION="$TK_VERSION.$TK_RELEASE_LEVEL.`echo $TK_PATCH_LEVEL | tr -d ab.`" AC_SUBST(TK_WIN_VERSION) # X86|AMD64|IA64 for manifest AC_SUBST(MACHINE) AC_SUBST(TK_VERSION) AC_SUBST(TK_MAJOR_VERSION) AC_SUBST(TK_MINOR_VERSION) AC_SUBST(TK_PATCH_LEVEL) AC_SUBST(TK_DBGX) AC_SUBST(TK_LIB_FILE) AC_SUBST(TK_DLL_FILE) AC_SUBST(TK_STUB_LIB_FILE) AC_SUBST(TK_STUB_LIB_FLAG) AC_SUBST(TK_BUILD_STUB_LIB_SPEC) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_BIN_DIR) AC_SUBST(TCL_VERSION) AC_SUBST(TCL_MAJOR_VERSION) AC_SUBST(TCL_MINOR_VERSION) AC_SUBST(TCL_PATCH_LEVEL) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_DBGX) AC_SUBST(CFG_TK_SHARED_LIB_SUFFIX) AC_SUBST(CFG_TK_UNSHARED_LIB_SUFFIX) AC_SUBST(CFG_TK_EXPORT_FILE_SUFFIX) AC_SUBST(CFLAGS_DEFAULT) AC_SUBST(EXTRA_CFLAGS) AC_SUBST(CYGPATH) AC_SUBST(DEPARG) AC_SUBST(CC_OBJNAME) AC_SUBST(CC_EXENAME) # win/tcl.m4 doesn't set (LDFLAGS) AC_SUBST(LDFLAGS_DEFAULT) AC_SUBST(LDFLAGS_DEBUG) AC_SUBST(LDFLAGS_OPTIMIZE) AC_SUBST(LDFLAGS_CONSOLE) AC_SUBST(LDFLAGS_WINDOW) AC_SUBST(AR) AC_SUBST(RANLIB) AC_SUBST(TK_RES) AC_SUBST(STLIB_LD) AC_SUBST(SHLIB_LD) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(SHLIB_CFLAGS) AC_SUBST(SHLIB_SUFFIX) AC_SUBST(TK_SHARED_BUILD) AC_SUBST(LIBS) AC_SUBST(LIBS_GUI) AC_SUBST(DLLSUFFIX) AC_SUBST(LIBPREFIX) AC_SUBST(LIBSUFFIX) AC_SUBST(EXESUFFIX) AC_SUBST(LIBRARIES) AC_SUBST(MAKE_LIB) AC_SUBST(MAKE_STUB_LIB) AC_SUBST(POST_MAKE_LIB) AC_SUBST(MAKE_DLL) AC_SUBST(MAKE_EXE) AC_SUBST(TK_LIB_FLAG) AC_SUBST(TK_LIB_SPEC) AC_SUBST(TK_BUILD_LIB_SPEC) AC_SUBST(TK_STUB_LIB_SPEC) AC_SUBST(TK_STUB_LIB_PATH) AC_SUBST(TK_BUILD_STUB_LIB_PATH) # undefined at this point for win AC_SUBST(TK_CC_SEARCH_FLAGS) AC_SUBST(TK_LD_SEARCH_FLAGS) AC_SUBST(RC) AC_SUBST(RC_OUT) AC_SUBST(RC_TYPE) AC_SUBST(RC_INCLUDE) AC_SUBST(RC_DEFINE) AC_SUBST(RC_DEFINES) AC_SUBST(RES) AC_OUTPUT(Makefile tkConfig.sh wish.exe.manifest) dnl Local Variables: dnl mode: autoconf; dnl End: |
Deleted win/configure.in.
|
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to win/makefile.vc.
︙ | ︙ | |||
110 111 112 113 114 115 116 117 118 119 120 121 122 123 | !if [nmakehlp -f "$(OPTS)" "square"] !message *** Include ttk square demo widget TTK_SQUARE_WIDGET = 1 !else TTK_SQUARE_WIDGET = 0 !endif !endif WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe" CAT32 = "$(OUT_DIR)\cat32.exe" WISHOBJS = \ | > > > > > > > | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | !if [nmakehlp -f "$(OPTS)" "square"] !message *** Include ttk square demo widget TTK_SQUARE_WIDGET = 1 !else TTK_SQUARE_WIDGET = 0 !endif !endif TK_NO_DEPRECATED = 0 !if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"] !if [nmakehlp -f $(CHECKS) "nodep"] TK_NO_DEPRECATED = 1 !endif !endif WISHC = "$(OUT_DIR)\$(WISHNAMEPREFIX)c$(VERSION)$(SUFX).exe" TKTEST = "$(OUT_DIR)\$(PROJECT)test.exe" CAT32 = "$(OUT_DIR)\cat32.exe" WISHOBJS = \ |
︙ | ︙ | |||
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | $(TMP_DIR)\tkGC.obj \ $(TMP_DIR)\tkGeometry.obj \ $(TMP_DIR)\tkGet.obj \ $(TMP_DIR)\tkGrab.obj \ $(TMP_DIR)\tkGrid.obj \ $(TMP_DIR)\tkImage.obj \ $(TMP_DIR)\tkImgBmap.obj \ $(TMP_DIR)\tkImgGIF.obj \ $(TMP_DIR)\tkImgPNG.obj \ $(TMP_DIR)\tkImgPPM.obj \ $(TMP_DIR)\tkImgPhoto.obj \ $(TMP_DIR)\tkImgPhInstance.obj \ $(TMP_DIR)\tkImgUtil.obj \ $(TMP_DIR)\tkListbox.obj \ $(TMP_DIR)\tkMacWinMenu.obj \ $(TMP_DIR)\tkMain.obj \ $(TMP_DIR)\tkMain2.obj \ $(TMP_DIR)\tkMenu.obj \ $(TMP_DIR)\tkMenubutton.obj \ $(TMP_DIR)\tkMenuDraw.obj \ $(TMP_DIR)\tkMessage.obj \ $(TMP_DIR)\tkPanedWindow.obj \ $(TMP_DIR)\tkObj.obj \ $(TMP_DIR)\tkOldConfig.obj \ $(TMP_DIR)\tkOption.obj \ $(TMP_DIR)\tkPack.obj \ $(TMP_DIR)\tkPlace.obj \ $(TMP_DIR)\tkPointer.obj \ $(TMP_DIR)\tkRectOval.obj \ $(TMP_DIR)\tkScale.obj \ $(TMP_DIR)\tkScrollbar.obj \ $(TMP_DIR)\tkSelect.obj \ $(TMP_DIR)\tkStyle.obj \ | > > > | 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | $(TMP_DIR)\tkGC.obj \ $(TMP_DIR)\tkGeometry.obj \ $(TMP_DIR)\tkGet.obj \ $(TMP_DIR)\tkGrab.obj \ $(TMP_DIR)\tkGrid.obj \ $(TMP_DIR)\tkImage.obj \ $(TMP_DIR)\tkImgBmap.obj \ $(TMP_DIR)\tkImgListFormat.obj \ $(TMP_DIR)\tkImgGIF.obj \ $(TMP_DIR)\tkImgPNG.obj \ $(TMP_DIR)\tkImgPPM.obj \ $(TMP_DIR)\tkImgSVGnano.obj \ $(TMP_DIR)\tkImgPhoto.obj \ $(TMP_DIR)\tkImgPhInstance.obj \ $(TMP_DIR)\tkImgUtil.obj \ $(TMP_DIR)\tkListbox.obj \ $(TMP_DIR)\tkMacWinMenu.obj \ $(TMP_DIR)\tkMain.obj \ $(TMP_DIR)\tkMain2.obj \ $(TMP_DIR)\tkMenu.obj \ $(TMP_DIR)\tkMenubutton.obj \ $(TMP_DIR)\tkMenuDraw.obj \ $(TMP_DIR)\tkMessage.obj \ $(TMP_DIR)\tkPanedWindow.obj \ $(TMP_DIR)\tkObj.obj \ $(TMP_DIR)\tkOldConfig.obj \ $(TMP_DIR)\tkOption.obj \ $(TMP_DIR)\tkPack.obj \ $(TMP_DIR)\tkPkgConfig.obj \ $(TMP_DIR)\tkPlace.obj \ $(TMP_DIR)\tkPointer.obj \ $(TMP_DIR)\tkRectOval.obj \ $(TMP_DIR)\tkScale.obj \ $(TMP_DIR)\tkScrollbar.obj \ $(TMP_DIR)\tkSelect.obj \ $(TMP_DIR)\tkStyle.obj \ |
︙ | ︙ | |||
299 300 301 302 303 304 305 | BITMAPDIR = $(ROOT)\bitmaps # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ | | > > > | 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | BITMAPDIR = $(ROOT)\bitmaps # Additional include and C macro definitions for the implicit rules # defined in rules.vc PRJ_INCLUDES = -I"$(BITMAPDIR)" -I"$(XLIBDIR)" CONFIG_DEFS =-DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 \ -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 \ -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 \ -DSUPPORT_CONFIG_EMBEDDED \ !if $(HAVE_UXTHEME_H) -DHAVE_UXTHEME_H=1 \ !endif !if $(TTK_SQUARE_WIDGET) -DTTK_SQUARE_WIDGET=1 \ !endif !if $(TK_NO_DEPRECATED) -DTK_NO_DEPRECATED=1 !endif PRJ_DEFINES = -DBUILD_ttk $(CONFIG_DEFS) -Dinline=__inline -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE # Additional Link libraries needed beyond those in rules.vc PRJ_LIBS = netapi32.lib gdi32.lib user32.lib userenv.lib |
︙ | ︙ | |||
332 333 334 335 336 337 338 339 340 341 342 343 344 345 | #--------------------------------------------------------------------- release: setup $(TKSTUBLIB) $(WISH) all: release $(CAT32) core: setup $(TKSTUBLIB) $(TKLIB) cwish: $(WISHC) install: install-binaries install-libraries install-docs tktest: setup $(TKTEST) $(CAT32) setup: default-setup test: test-classic test-ttk test-classic: setup $(TKTEST) $(TKLIB) $(CAT32) | > > > | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | #--------------------------------------------------------------------- release: setup $(TKSTUBLIB) $(WISH) all: release $(CAT32) core: setup $(TKSTUBLIB) $(TKLIB) cwish: $(WISHC) install: install-binaries install-libraries install-docs !if $(SYMBOLS) install: install-pdbs !endif tktest: setup $(TKTEST) $(CAT32) setup: default-setup test: test-classic test-ttk test-classic: setup $(TKTEST) $(TKLIB) $(CAT32) |
︙ | ︙ | |||
512 513 514 515 516 517 518 519 520 521 522 523 524 525 | install-docs: !if exist("$(CHMFILE)") @echo Installing compiled HTML help @$(CPY) "$(CHMFILE)" "$(DOC_INSTALL_DIR)\" !endif # "emacs font-lock highlighting fix #--------------------------------------------------------------------- # Special case object file targets #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c $(cc32) $(appcflags_nostubs) -DTK_TEST \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ | > > > > > | 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | install-docs: !if exist("$(CHMFILE)") @echo Installing compiled HTML help @$(CPY) "$(CHMFILE)" "$(DOC_INSTALL_DIR)\" !endif # "emacs font-lock highlighting fix install-pdbs: @echo Installing debug symbols @$(CPY) "$(OUT_DIR)\*.pdb" "$(BIN_INSTALL_DIR)\" # "emacs font-lock highlighting fix #--------------------------------------------------------------------- # Special case object file targets #--------------------------------------------------------------------- $(TMP_DIR)\testMain.obj: $(WINDIR)\winMain.c $(cc32) $(appcflags_nostubs) -DTK_TEST \ -DTCL_USE_STATIC_PACKAGES=$(TCL_USE_STATIC_PACKAGES) \ |
︙ | ︙ | |||
636 637 638 639 640 641 642 | @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\" !endif @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" !if !$(STATIC_BUILD) @echo creating package index @type << > $(OUT_DIR)\pkgIndex.tcl | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | @$(CPY) "$(TKLIB)" "$(BIN_INSTALL_DIR)\" !endif @$(CPY) "$(TKIMPLIB)" "$(LIB_INSTALL_DIR)\" @$(CPY) "$(TKSTUBLIB)" "$(LIB_INSTALL_DIR)\" !if !$(STATIC_BUILD) @echo creating package index @type << > $(OUT_DIR)\pkgIndex.tcl if {[catch {package present Tcl 8.6-}]} { return } if {($$::tcl_platform(platform) eq "unix") && ([info exists ::env(DISPLAY)] || ([info exists ::argv] && ("-display" in $$::argv)))} { package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin libtk$(DOTVERSION).dll] Tk] } else { package ifneeded Tk $(TK_PATCH_LEVEL) [list load [file join $$dir .. .. bin $(TKLIBNAME)] Tk] } << |
︙ | ︙ |
Deleted win/mkd.bat.
|
| < < < < < < < < < < < < |
Changes to win/rc/tk.rc.
1 2 3 4 5 6 7 8 9 10 | // // Version Resource Script // #include <windows.h> #include <tk.h> // // build-up the name suffix that defines the type of build this is. // | < < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // // Version Resource Script // #include <windows.h> #include <tk.h> // // build-up the name suffix that defines the type of build this is. // #if DEBUG && !UNCHECKED #define SUFFIX_DEBUG "g" #else #define SUFFIX_DEBUG "" #endif #define SUFFIX SUFFIX_DEBUG VS_VERSION_INFO VERSIONINFO FILEVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL PRODUCTVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL FILEFLAGSMASK 0x3fL #ifdef DEBUG |
︙ | ︙ |
Changes to win/rc/wish.rc.
1 2 3 4 5 6 7 8 9 10 | // // Version Resource Script // #include <windows.h> #include <tk.h> // // build-up the name suffix that defines the type of build this is. // | < < < < < < | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | // // Version Resource Script // #include <windows.h> #include <tk.h> // // build-up the name suffix that defines the type of build this is. // #if STATIC_BUILD #define SUFFIX_STATIC "s" #else #define SUFFIX_STATIC "" #endif #if DEBUG && !UNCHECKED #define SUFFIX_DEBUG "g" #else #define SUFFIX_DEBUG "" #endif #define SUFFIX SUFFIX_STATIC SUFFIX_DEBUG VS_VERSION_INFO VERSIONINFO FILEVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL PRODUCTVERSION TK_MAJOR_VERSION,TK_MINOR_VERSION,TK_RELEASE_LEVEL,TK_RELEASE_SERIAL FILEFLAGSMASK 0x3fL #ifdef DEBUG |
︙ | ︙ |
Deleted win/rmd.bat.
|
| < < < < < < < < < < < < < < < < < < < < |
Changes to win/rules-ext.vc.
︙ | ︙ | |||
31 32 33 34 35 36 37 | # We extract version numbers using the nmakehlp program. For now use # the local copy of nmakehlp. Once we locate Tcl, we will use that # one if it is newer. !if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul] !endif # First locate the Tcl directory that we are working with. | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # We extract version numbers using the nmakehlp program. For now use # the local copy of nmakehlp. Once we locate Tcl, we will use that # one if it is newer. !if [$(CC) -nologo "nmakehlp.c" -link -subsystem:console > nul] !endif # First locate the Tcl directory that we are working with. !if "$(TCLDIR)" != "" _RULESDIR = $(TCLDIR:/=\) !else # If an installation path is specified, that is also the Tcl directory. # Also Tk never builds against an installed Tcl, it needs Tcl sources |
︙ | ︙ |
Changes to win/rules.vc.
︙ | ︙ | |||
20 21 22 23 24 25 26 | !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | !ifndef _RULES_VC _RULES_VC = 1 # The following macros define the version of the rules.vc nmake build system # For modifications that are not backward-compatible, you *must* change # the major version. RULES_VERSION_MAJOR = 1 RULES_VERSION_MINOR = 3 # The PROJECT macro must be defined by parent makefile. !if "$(PROJECT)" == "" !error *** Error: Macro PROJECT not defined! Please define it before including rules.vc !endif !if "$(PRJ_PACKAGE_TCLNAME)" == "" |
︙ | ︙ | |||
389 390 391 392 393 394 395 | *** Warning: This extension requires the source distribution of Tk.^ *** Please set the TKDIR macro to point to the Tk sources. !error $(MSG) !endif !endif | | | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | *** Warning: This extension requires the source distribution of Tk.^ *** Please set the TKDIR macro to point to the Tk sources. !error $(MSG) !endif !endif # If INSTALLDIR set to Tcl installation root dir then reset to the # lib dir for installing extensions !if exist("$(_INSTALLDIR)\include\tcl.h") _INSTALLDIR=$(_INSTALLDIR)\lib !endif # END Case 2(c) or (d) - Building an extension !endif # if $(DOING_TCL) |
︙ | ︙ | |||
470 471 472 473 474 475 476 477 478 479 480 481 482 483 | !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else | > > > > > > > > > > > > > > > | 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | !endif !if "$(MACHINE)" != "$(ARCH)" !error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH). !endif !else MACHINE=$(ARCH) !endif #--------------------------------------------------------------- # The PLATFORM_IDENTIFY macro matches the values returned by # the Tcl platform::identify command !if "$(MACHINE)" == "AMD64" PLATFORM_IDENTIFY = win32-x86_64 !else PLATFORM_IDENTIFY = win32-ix86 !endif # The MULTIPLATFORM macro controls whether binary extensions are installed # in platform-specific directories. Intended to be set/used by extensions. !ifndef MULTIPLATFORM_INSTALL MULTIPLATFORM_INSTALL = 0 !endif #------------------------------------------------------------ # Figure out the *host* architecture by reading the registry !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] NATIVE_ARCH=IX86 !else |
︙ | ︙ | |||
726 727 728 729 730 731 732 | !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif | | < < < < < < < | | 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 | !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD) !message *** Doing staticpkg TCL_USE_STATIC_PACKAGES = 1 !else TCL_USE_STATIC_PACKAGES = 0 !endif # Yes, it's weird that the "symbols" option controls DEBUG and # the "pdbs" option controls SYMBOLS. That's historical. !if [nmakehlp -f $(OPTS) "symbols"] !message *** Doing symbols DEBUG = 1 !else DEBUG = 0 !endif |
︙ | ︙ | |||
770 771 772 773 774 775 776 | PGO = 0 !endif !if [nmakehlp -f $(OPTS) "loimpact"] !message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. !endif | < < < < < < | 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | PGO = 0 !endif !if [nmakehlp -f $(OPTS) "loimpact"] !message *** Warning: ignoring option "loimpact" - deprecated on modern Windows. !endif !if [nmakehlp -f $(OPTS) "tclalloc"] USE_THREAD_ALLOC = 0 !endif !if [nmakehlp -f $(OPTS) "unchecked"] !message *** Doing unchecked UNCHECKED = 1 |
︙ | ︙ | |||
966 967 968 969 970 971 972 | ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # # Naming convention (suffixes): | | | 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | ################################################################ # 10. Construct output directory and file paths # Figure-out how to name our intermediate and output directories. # In order to avoid inadvertent mixing of object files built using # different compilers, build configurations etc., # # Naming convention (suffixes): # t = full thread support. (Not used for Tcl >= 8.7) # s = static library (as opposed to an import library) # g = linked to the debug enabled C run-time. # x = special static build when it links to the dynamic C run-time. # # The following macros are set in this section: # SUFX - the suffix to use for binaries based on above naming convention # BUILDDIRTOP - the toplevel default output directory |
︙ | ︙ | |||
1024 1025 1026 1027 1028 1029 1030 | EXT = lib !if !$(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif | | | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 | EXT = lib !if !$(MSVCRT) TMP_DIRFULL = $(TMP_DIRFULL:X=) SUFX = $(SUFX:x=) !endif !endif !if !$(TCL_THREADS) || $(TCL_VERSION) > 86 TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) SUFX = $(SUFX:t=) !endif !ifndef TMP_DIR TMP_DIR = $(TMP_DIRFULL) !ifndef OUT_DIR |
︙ | ︙ | |||
1057 1058 1059 1060 1061 1062 1063 | # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) | | | < < < | | | | < < < | | | | 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 | # The name of the stubs library for the project being built STUBPREFIX = $(PROJECT)stub # Set up paths to various Tcl executables and libraries needed by extensions !if $(DOING_TCL) TCLSHNAME = $(PROJECT)sh$(VERSION)$(SUFX).exe TCLSH = $(OUT_DIR)\$(TCLSHNAME) TCLIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib TCLLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT) TCLLIB = $(OUT_DIR)\$(TCLLIBNAME) TCLSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib TCLSTUBLIB = $(OUT_DIR)\$(TCLSTUBLIBNAME) TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)" !else # ! $(DOING_TCL) !if $(TCLINSTALL) # Building against an installed Tcl # When building extensions, we need to locate tclsh. Depending on version # of Tcl we are building against, this may or may not have a "t" suffix. # Try various possibilities in turn. TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist("$(TCLSH)") TCLSH = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\lib\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\lib TCLREGLIB = $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target TCL_INCLUDES = -I"$(_TCLDIR)\include" !else # Building against Tcl sources TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX:t=).exe !if !exist($(TCLSH)) TCLSH = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX:t=).exe !endif TCLSTUBLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX:t=).lib # When building extensions, may be linking against Tcl that does not add # "t" suffix (e.g. 8.5 or 8.7). If lib not found check for that possibility. !if !exist("$(TCLIMPLIB)") TCLIMPLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)t$(SUFX:t=).lib !endif TCL_LIBRARY = $(_TCLDIR)\library TCLREGLIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib TCLDDELIB = $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib TCLTOOLSDIR = $(_TCLDIR)\tools TCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" |
︙ | ︙ | |||
1179 1180 1181 1182 1183 1184 1185 | !endif # TKINSTALL tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) !endif # $(DOING_TK) || $(NEED_TK) # Various output paths | | | | 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 | !endif # TKINSTALL tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)" !endif # $(DOING_TK) !endif # $(DOING_TK) || $(NEED_TK) # Various output paths PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX:t=).lib PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX:t=).$(EXT) PRJLIB = $(OUT_DIR)\$(PRJLIBNAME) PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME) # If extension parent makefile has not defined a resource definition file, # we will generate one from standard template. |
︙ | ︙ | |||
1205 1206 1207 1208 1209 1210 1211 | # The following macros get defined in this section: # LIB_INSTALL_DIR - where libraries should be installed # BIN_INSTALL_DIR - where the executables should be installed # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed | | > > > > > | | 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | # The following macros get defined in this section: # LIB_INSTALL_DIR - where libraries should be installed # BIN_INSTALL_DIR - where the executables should be installed # DOC_INSTALL_DIR - where documentation should be installed # SCRIPT_INSTALL_DIR - where scripts should be installed # INCLUDE_INSTALL_DIR - where C include files should be installed # DEMO_INSTALL_DIR - where demos should be installed # PRJ_INSTALL_DIR - where package will be installed (not set for Tcl and Tk) !if $(DOING_TCL) || $(DOING_TK) LIB_INSTALL_DIR = $(_INSTALLDIR)\lib BIN_INSTALL_DIR = $(_INSTALLDIR)\bin DOC_INSTALL_DIR = $(_INSTALLDIR)\doc !if $(DOING_TCL) SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION) !else # DOING_TK SCRIPT_INSTALL_DIR = $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) !endif DEMO_INSTALL_DIR = $(SCRIPT_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\include !else # extension other than Tk PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION) !if $(MULTIPLATFORM_INSTALL) LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)\$(PLATFORM_IDENTIFY) !else LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR) BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR) !endif DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR) SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR) DEMO_INSTALL_DIR = $(PRJ_INSTALL_DIR)\demos INCLUDE_INSTALL_DIR = $(_INSTALLDIR)\..\include !endif ################################################################### # 12. Set up actual options to be passed to the compiler and linker # Now we have all the information we need, set up the actual flags and # options that we will pass to the compiler and linker. The main |
︙ | ︙ | |||
1260 1261 1262 1263 1264 1265 1266 | !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif | | | 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | !if $(TCL_MEM_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS !endif !if $(TCL_THREADS) && $(TCL_VERSION) < 86 OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 !if $(USE_THREAD_ALLOC) OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 !endif !endif !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD |
︙ | ︙ | |||
1443 1444 1445 1446 1447 1448 1449 | ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif | < < < < < < < < < < < < | 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 | ### Declarations common to all linker versions lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug) !if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900 lflags = $(lflags) -nodefaultlib:libucrt.lib !endif dlllflags = $(lflags) -dll conlflags = $(lflags) -subsystem:console guilflags = $(lflags) -subsystem:windows # Libraries that are required for every image. # Extensions should define any additional libraries with $(PRJ_LIBS) winlibs = kernel32.lib advapi32.lib |
︙ | ︙ | |||
1499 1500 1501 1502 1503 1504 1505 | GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ | | | | > > > > > > | > | > > > > > > > | | | > | > > > > > > > | 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 | GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs) RESCMD = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \ $(TCL_INCLUDES) \ -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \ -DCOMMAVERSION=$(DOTVERSION:.=,),0 \ -DDOTVERSION=\"$(DOTVERSION)\" \ -DVERSION=\"$(VERSION)\" \ -DSUFX=\"$(SUFX:t=)\" \ -DPROJECT=\"$(PROJECT)\" \ -DPRJLIBNAME=\"$(PRJLIBNAME)\" !ifndef DEFAULT_BUILD_TARGET DEFAULT_BUILD_TARGET = $(PROJECT) !endif default-target: $(DEFAULT_BUILD_TARGET) !if $(MULTIPLATFORM_INSTALL) default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PLATFORM_IDENTIFY) $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl !else default-pkgindex: @echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \ [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl !endif default-pkgindex-tea: @if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl @PACKAGE_VERSION@ $(DOTVERSION) @PACKAGE_NAME@ $(PRJ_PACKAGE_TCLNAME) @PACKAGE_TCLNAME@ $(PRJ_PACKAGE_TCLNAME) @PKG_LIB_FILE@ $(PRJLIBNAME) << default-install: default-install-binaries default-install-libraries !if $(SYMBOLS) default-install: default-install-pdbs !endif # Again to deal with historical brokenness, there is some confusion # in terminlogy. For extensions, the "install-binaries" was used to # locate target directory for *binary shared libraries* and thus # the appropriate macro is LIB_INSTALL_DIR since BIN_INSTALL_DIR is # for executables (exes). On the other hand the "install-libraries" # target is for *scripts* and should have been called "install-scripts". default-install-binaries: $(PRJLIB) @echo Installing binaries to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) $(PRJLIB) "$(LIB_INSTALL_DIR)" >NUL # Alias for default-install-scripts default-install-libraries: default-install-scripts default-install-scripts: $(OUT_DIR)\pkgIndex.tcl @echo Installing libraries to '$(SCRIPT_INSTALL_DIR)' @if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)" @echo Installing package index in '$(SCRIPT_INSTALL_DIR)' @$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR) default-install-stubs: @echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)' @if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)" @$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL default-install-pdbs: @echo Installing PDBs to '$(LIB_INSTALL_DIR)' @if not exist "$(LIB_INSTALL_DIR)" mkdir "$(LIB_INSTALL_DIR)" @$(CPY) "$(OUT_DIR)\*.pdb" "$(LIB_INSTALL_DIR)\" default-install-docs-html: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' @if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)" @if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)" default-install-docs-n: @echo Installing documentation files to '$(DOC_INSTALL_DIR)' |
︙ | ︙ | |||
1716 1717 1718 1719 1720 1721 1722 | !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif | < < < | 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 | !if $(CONFIG_CHECK) !ifdef TCLNMAKECONFIG !include $(TCLNMAKECONFIG) !if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)" !error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)). !endif !if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG) !message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)). !endif !endif !endif # TCLNMAKECONFIG |
︙ | ︙ |
Changes to win/stubs.c.
|
| | | 1 2 3 4 5 6 7 8 | #include "tkInt.h" /* * Undocumented Xlib internal function */ int _XInitImageFuncPtrs( |
︙ | ︙ |
Changes to win/tcl.m4.
︙ | ︙ | |||
247 248 249 250 251 252 253 254 255 256 257 258 259 260 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then | > | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | # # Results: # # Substitutes the following vars: # TCL_BIN_DIR # TCL_SRC_DIR # TCL_LIB_FILE # TCL_ZIP_FILE # #------------------------------------------------------------------------ AC_DEFUN([SC_LOAD_TCLCONFIG], [ AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh]) if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then |
︙ | ︙ | |||
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) | > > | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} fi # # eval is required to do the TCL_DBGX substitution # eval "TCL_ZIP_FILE=\"${TCL_ZIP_FILE}\"" eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) AC_SUBST(TCL_ZIP_FILE) AC_SUBST(TCL_LIB_FILE) AC_SUBST(TCL_LIB_FLAG) AC_SUBST(TCL_LIB_SPEC) AC_SUBST(TCL_STUB_LIB_FILE) AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) |
︙ | ︙ | |||
376 377 378 379 380 381 382 | AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | AC_MSG_RESULT([shared]) SHARED_BUILD=1 else AC_MSG_RESULT([static]) SHARED_BUILD=0 AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?]) fi AC_SUBST(SHARED_BUILD) ]) #------------------------------------------------------------------------ # SC_ENABLE_SYMBOLS -- # # Specify if debugging symbols should be used. # Memory (TCL_MEM_DEBUG) and compile (TCL_COMPILE_DEBUG) debugging |
︙ | ︙ | |||
540 541 542 543 544 545 546 | # Step 0: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT($do64bit) | < < < < < < < < < < < > | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | # Step 0: Enable 64 bit support? AC_MSG_CHECKING([if 64bit support is requested]) AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no]) AC_MSG_RESULT($do64bit) # Set some defaults (may get changed below) EXTRA_CFLAGS="" AC_DEFINE(MODULE_SCOPE, [extern], [No need to mark inidividual symbols as hidden]) AC_CHECK_PROG(CYGPATH, cygpath, cygpath -m, echo) AC_CHECK_PROG(WINE, wine, wine,) SHLIB_SUFFIX=".dll" # MACHINE is IX86 for LINK, but this is used by the manifest, # which requires x86|amd64|ia64. MACHINE="X86" |
︙ | ︙ | |||
723 724 725 726 727 728 729 | LIBFLAGSUFFIX="\${DBGX}" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" | | | 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | LIBFLAGSUFFIX="\${DBGX}" SHLIB_SUFFIX=.dll EXTRA_CFLAGS="${extra_cflags}" CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" CFLAGS_WARNING="-Wall -Wwrite-strings -Wsign-compare -Wdeclaration-after-statement -Wpointer-arith" LDFLAGS_DEBUG= LDFLAGS_OPTIMIZE= # Specify the CC output file names based on the target name CC_OBJNAME="-o \[$]@" CC_EXENAME="-o \[$]@" |
︙ | ︙ | |||
867 868 869 870 871 872 873 | CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 | CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d" # -O2 - create fast code (/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}" lflags="${lflags} -nologo" LINKBIN="link" fi LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib uuid.lib" SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}" SHLIB_LD_LIBS='${LIBS}' # link -lib only works when -lib is the first arg STLIB_LD="${LINKBIN} -lib ${lflags}" RC_OUT=-fo RC_TYPE=-r |
︙ | ︙ | |||
989 990 991 992 993 994 995 | # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\[$]@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" # Specify linker flags depending on the type of app being # built -- Console vs. Window. | | | 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 | # Specify the CC output file names based on the target name CC_OBJNAME="-Fo\[$]@" CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) '\[$]@')\"" # Specify linker flags depending on the type of app being # built -- Console vs. Window. if test "${TARGETCPU}" != "X86"; then LDFLAGS_CONSOLE="-link ${lflags}" LDFLAGS_WINDOW=${LDFLAGS_CONSOLE} else LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}" LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}" fi fi |
︙ | ︙ | |||
1122 1123 1124 1125 1126 1127 1128 | # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the tcl build dir. #------------------------------------------------------------------------ AC_DEFUN([SC_WITH_TCL], [ | | | | | | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 | # --with-tcl=... # # Defines the following vars: # TCL_BIN_DIR Full path to the tcl build dir. #------------------------------------------------------------------------ AC_DEFUN([SC_WITH_TCL], [ if test -d ../../tcl8.7$1/win; then TCL_BIN_DEFAULT=../../tcl8.7$1/win else TCL_BIN_DEFAULT=../../tcl8.7/win fi AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.7 binaries from DIR], TCL_BIN_DIR=$withval, TCL_BIN_DIR=`cd $TCL_BIN_DEFAULT; pwd`) if test ! -d $TCL_BIN_DIR; then AC_MSG_ERROR(Tcl directory $TCL_BIN_DIR does not exist) fi if test ! -f $TCL_BIN_DIR/Makefile; then AC_MSG_ERROR(There is no Makefile in $TCL_BIN_DIR: perhaps you did not specify the Tcl *build* directory (not the toplevel Tcl directory) or you forgot to configure Tcl?) else |
︙ | ︙ | |||
1293 1294 1295 1296 1297 1298 1299 | fi ]) fi AC_MSG_RESULT([$result]) AC_SUBST(VC_MANIFEST_EMBED_DLL) AC_SUBST(VC_MANIFEST_EMBED_EXE) ]) | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 | fi ]) fi AC_MSG_RESULT([$result]) AC_SUBST(VC_MANIFEST_EMBED_DLL) AC_SUBST(VC_MANIFEST_EMBED_EXE) ]) #------------------------------------------------------------------------ # SC_CC_FOR_BUILD # For cross compiles, locate a C compiler that can generate native binaries. # # Arguments: # none # # Results: # Substitutes the following vars: # CC_FOR_BUILD # EXEEXT_FOR_BUILD #------------------------------------------------------------------------ dnl Get a default for CC_FOR_BUILD to put into Makefile. AC_DEFUN([AX_CC_FOR_BUILD], [# Put a plausible default for CC_FOR_BUILD in Makefile. if test -z "$CC_FOR_BUILD"; then if test "x$cross_compiling" = "xno"; then CC_FOR_BUILD='$(CC)' else AC_MSG_CHECKING([for gcc]) AC_CACHE_VAL(ac_cv_path_cc, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/gcc 2> /dev/null` \ `ls -r $dir/gcc 2> /dev/null` ; do if test x"$ac_cv_path_cc" = x ; then if test -f "$j" ; then ac_cv_path_cc=$j break fi fi done done ]) fi fi AC_SUBST(CC_FOR_BUILD) # Also set EXEEXT_FOR_BUILD. if test "x$cross_compiling" = "xno"; then EXEEXT_FOR_BUILD='$(EXEEXT)' OBJEXT_FOR_BUILD='$(OBJEXT)' else OBJEXT_FOR_BUILD='.no' AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext, [rm -f conftest* echo 'int main () { return 0; }' > conftest.c bfd_cv_build_exeext= ${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5 for file in conftest.*; do case $file in *.c | *.o | *.obj | *.ilk | *.pdb) ;; *) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;; esac done rm -f conftest* test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no]) EXEEXT_FOR_BUILD="" test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext} fi AC_SUBST(EXEEXT_FOR_BUILD)])dnl AC_SUBST(OBJEXT_FOR_BUILD)])dnl #------------------------------------------------------------------------ # SC_ZIPFS_SUPPORT # Locate a zip encoder installed on the system path, or none. # # Arguments: # none # # Results: # Substitutes the following vars: # ZIP_PROG # ZIP_PROG_OPTIONS # ZIP_PROG_VFSSEARCH # ZIP_INSTALL_OBJS #------------------------------------------------------------------------ AC_DEFUN([SC_ZIPFS_SUPPORT], [ ZIP_PROG="" ZIP_PROG_OPTIONS="" ZIP_PROG_VFSSEARCH="" ZIP_INSTALL_OBJS="" AC_MSG_CHECKING([for zip]) AC_CACHE_VAL(ac_cv_path_zip, [ search_path=`echo ${PATH} | sed -e 's/:/ /g'` for dir in $search_path ; do for j in `ls -r $dir/zip 2> /dev/null` \ `ls -r $dir/zip 2> /dev/null` ; do if test x"$ac_cv_path_zip" = x ; then if test -f "$j" ; then ac_cv_path_zip=$j break fi fi done done ]) if test -f "$ac_cv_path_zip" ; then ZIP_PROG="$ac_cv_path_zip" AC_MSG_RESULT([$ZIP_PROG]) ZIP_PROG_OPTIONS="-rq" ZIP_PROG_VFSSEARCH="*" AC_MSG_RESULT([Found INFO Zip in environment]) # Use standard arguments for zip else # It is not an error if an installed version of Zip can't be located. # We can use the locally distributed minizip instead ZIP_PROG="./minizip${EXEEXT_FOR_BUILD}" ZIP_PROG_OPTIONS="-o -r" ZIP_PROG_VFSSEARCH="*" ZIP_INSTALL_OBJS="minizip${EXEEXT_FOR_BUILD}" AC_MSG_RESULT([No zip found on PATH building minizip]) fi AC_SUBST(ZIP_PROG) AC_SUBST(ZIP_PROG_OPTIONS) AC_SUBST(ZIP_PROG_VFSSEARCH) AC_SUBST(ZIP_INSTALL_OBJS) ]) |
Changes to win/tkWin.h.
︙ | ︙ | |||
14 15 16 17 18 19 20 | #define _TKWIN /* * We must specify the lower version we intend to support. In particular * the SystemParametersInfo API doesn't like to receive structures that * are larger than it expects which affects the font assignments. * | | > | | > > > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #define _TKWIN /* * We must specify the lower version we intend to support. In particular * the SystemParametersInfo API doesn't like to receive structures that * are larger than it expects which affects the font assignments. * * WINVER = 0x0600 means Windows Vista and above. Even though we still * support Windows XP, but the Vista-specifics are tested at runtime. */ #ifndef WINVER # define WINVER 0x0600 #endif #ifndef _WIN32_WINNT # define _WIN32_WINNT 0x0600 #endif #ifndef _WIN32_IE # define _WIN32_IE 0x0700 #endif #ifndef _TK #include <tk.h> #endif #define WIN32_LEAN_AND_MEAN |
︙ | ︙ |
Changes to win/tkWinButton.c.
︙ | ︙ | |||
59 60 61 62 63 64 65 | /* * Cached information about the boxes bitmap, and the default border width for * a button in string form for use in Tk_OptionSpec for the various button * widget classes. */ | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /* * Cached information about the boxes bitmap, and the default border width for * a button in string form for use in Tk_OptionSpec for the various button * widget classes. */ typedef struct { BITMAPINFOHEADER *boxesPtr; /* Information about the bitmap. */ DWORD *boxesPalette; /* Pointer to color palette. */ LPSTR boxesBits; /* Pointer to bitmap data. */ DWORD boxHeight; /* Height of each sub-image. */ DWORD boxWidth; /* Width of each sub-image. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; |
︙ | ︙ | |||
127 128 129 130 131 132 133 | HRSRC hrsrc; HGLOBAL hblk; LPBITMAPINFOHEADER newBitmap; size_t size; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | HRSRC hrsrc; HGLOBAL hblk; LPBITMAPINFOHEADER newBitmap; size_t size; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); hrsrc = FindResource(module, L"buttons", RT_BITMAP); if (hrsrc == NULL) { Tcl_Panic("FindResource() failed for buttons bitmap resource, " "resources in tk_base.rc must be linked into Tk dll or static executable"); } else { hblk = LoadResource(module, hrsrc); tsdPtr->boxesPtr = (LPBITMAPINFOHEADER)LockResource(hblk); } |
︙ | ︙ | |||
238 239 240 241 242 243 244 | CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ ClientData instanceData) /* Button instance data. */ { Window window; HWND parent; | | | | | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | CreateProc( Tk_Window tkwin, /* Token for window. */ Window parentWin, /* Parent of new window. */ ClientData instanceData) /* Button instance data. */ { Window window; HWND parent; const WCHAR *class; WinButton *butPtr = (WinButton *)instanceData; parent = Tk_GetHWND(parentWin); if (butPtr->info.type == TYPE_LABEL) { class = L"STATIC"; butPtr->style = SS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS; } else { class = L"BUTTON"; butPtr->style = BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS; } butPtr->hwnd = CreateWindow(class, NULL, butPtr->style, Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), parent, NULL, Tk_GetHINSTANCE(), NULL); SetWindowPos(butPtr->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); |
︙ | ︙ | |||
312 313 314 315 316 317 318 | void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { TkWinDCState state; HDC dc; | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | void TkpDisplayButton( ClientData clientData) /* Information about widget. */ { TkWinDCState state; HDC dc; register TkButton *butPtr = clientData; GC gc; Tk_3DBorder border; Pixmap pixmap; int x = 0; /* Initialization only needed to stop compiler * warning. */ int y, relief; register Tk_Window tkwin = butPtr->tkwin; |
︙ | ︙ | |||
401 402 403 404 405 406 407 | } } /* * Compute width of default ring and offset for pushed buttons. */ | | > > > | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | } } /* * Compute width of default ring and offset for pushed buttons. */ if (butPtr->type == TYPE_LABEL) { defaultWidth = butPtr->highlightWidth; offset = 0; } else if (butPtr->type == TYPE_BUTTON) { defaultWidth = ((butPtr->defaultState == DEFAULT_ACTIVE) ? butPtr->highlightWidth : 0); offset = 1; } else { defaultWidth = 0; if ((butPtr->type >= TYPE_CHECK_BUTTON) && !butPtr->indicatorOn) { offset = 1; |
︙ | ︙ | |||
755 756 757 758 759 760 761 762 763 | Tk_Draw3DRectangle(tkwin, pixmap, border, defaultWidth, defaultWidth, Tk_Width(tkwin) - 2*defaultWidth, Tk_Height(tkwin) - 2*defaultWidth, butPtr->borderWidth, relief); } if (defaultWidth != 0) { dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state); TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth, | > > > > > > > | | | | | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 | Tk_Draw3DRectangle(tkwin, pixmap, border, defaultWidth, defaultWidth, Tk_Width(tkwin) - 2*defaultWidth, Tk_Height(tkwin) - 2*defaultWidth, butPtr->borderWidth, relief); } if (defaultWidth != 0) { int highlightColor; dc = TkWinGetDrawableDC(butPtr->display, pixmap, &state); if (butPtr->type == TYPE_LABEL) { highlightColor = (int) Tk_3DBorderColor(butPtr->highlightBorder)->pixel; } else { highlightColor = (int) butPtr->highlightColorPtr->pixel; } TkWinFillRect(dc, 0, 0, Tk_Width(tkwin), defaultWidth, highlightColor); TkWinFillRect(dc, 0, 0, defaultWidth, Tk_Height(tkwin), highlightColor); TkWinFillRect(dc, 0, Tk_Height(tkwin) - defaultWidth, Tk_Width(tkwin), defaultWidth, highlightColor); TkWinFillRect(dc, Tk_Width(tkwin) - defaultWidth, 0, defaultWidth, Tk_Height(tkwin), highlightColor); TkWinReleaseDrawableDC(pixmap, dc, &state); } if (butPtr->flags & GOT_FOCUS) { Tk_SetCaretPos(tkwin, x, y, 0 /* not used */); } |
︙ | ︙ | |||
1250 1251 1252 1253 1254 1255 1256 | case WM_ENABLE: break; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); | | | | | | 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 | case WM_ENABLE: break; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint(hwnd, &ps); EndPaint(hwnd, &ps); TkpDisplayButton(butPtr); /* * Special note: must cancel any existing idle handler for * TkpDisplayButton; it's no longer needed, and TkpDisplayButton * cleared the REDRAW_PENDING flag. */ Tcl_CancelIdleCall(TkpDisplayButton, butPtr); return 0; } case BN_CLICKED: { /* * OOPS: chromium fires WM_NULL regularly to ping if plugin is still * alive. When using an external window (i.e. via the tcl plugin), this * causes all buttons to fire once a second, so we need to make sure * that we are not dealing with the chromium life check. */ if (wParam != 0 || lParam != 0) { int code; Tcl_Interp *interp = butPtr->info.interp; if (butPtr->info.state != STATE_DISABLED) { Tcl_Preserve(interp); code = TkInvokeButton((TkButton*)butPtr); if (code != TCL_OK && code != TCL_CONTINUE && code != TCL_BREAK) { Tcl_AddErrorInfo(interp, "\n (button invoke)"); Tcl_BackgroundException(interp, code); } Tcl_Release(interp); } Tcl_ServiceAll(); return 0; } } default: |
︙ | ︙ |
Changes to win/tkWinClipboard.c.
︙ | ︙ | |||
75 76 77 78 79 80 81 | if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { handle = GetClipboardData(CF_UNICODETEXT); if (!handle) { CloseClipboard(); goto error; } data = GlobalLock(handle); | < | < | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | if (IsClipboardFormatAvailable(CF_UNICODETEXT)) { handle = GetClipboardData(CF_UNICODETEXT); if (!handle) { CloseClipboard(); goto error; } data = GlobalLock(handle); Tcl_WinTCharToUtf((WCHAR *)data, -1, &ds); GlobalUnlock(handle); } else if (IsClipboardFormatAvailable(CF_TEXT)) { /* * Determine the encoding to use to convert this text. */ if (IsClipboardFormatAvailable(CF_LOCALE)) { |
︙ | ︙ | |||
147 148 149 150 151 152 153 | goto error; } Tcl_DStringInit(&ds); drop = (DROPFILES *) GlobalLock(handle); if (drop->fWide) { WCHAR *fname = (WCHAR *) ((char *) drop + drop->pFiles); Tcl_DString dsTmp; | | > | | < | 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | goto error; } Tcl_DStringInit(&ds); drop = (DROPFILES *) GlobalLock(handle); if (drop->fWide) { WCHAR *fname = (WCHAR *) ((char *) drop + drop->pFiles); Tcl_DString dsTmp; int count = 0; size_t len; while (*fname != 0) { if (count) { Tcl_DStringAppend(&ds, "\n", 1); } len = wcslen(fname); Tcl_WinTCharToUtf(fname, len * sizeof(WCHAR), &dsTmp); Tcl_DStringAppend(&ds, Tcl_DStringValue(&dsTmp), Tcl_DStringLength(&dsTmp)); Tcl_DStringFree(&dsTmp); fname += len + 1; count++; } noBackslash = (count > 0); |
︙ | ︙ | |||
330 331 332 333 334 335 336 | *buffer = '\0'; /* * Depending on the platform, turn the data into Unicode or the system * encoding before placing it on the clipboard. */ | < < < < < < < < < < < < < < < < < | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 | *buffer = '\0'; /* * Depending on the platform, turn the data into Unicode or the system * encoding before placing it on the clipboard. */ Tcl_DStringInit(&ds); Tcl_WinUtfToTChar(rawText, -1, &ds); ckfree(rawText); handle = GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, (unsigned) Tcl_DStringLength(&ds) + 2); if (!handle) { Tcl_DStringFree(&ds); return; } buffer = GlobalLock(handle); memcpy(buffer, Tcl_DStringValue(&ds), (unsigned) Tcl_DStringLength(&ds) + 2); GlobalUnlock(handle); Tcl_DStringFree(&ds); SetClipboardData(CF_UNICODETEXT, handle); } /* *---------------------------------------------------------------------- * * TkSelUpdateClipboard -- * |
︙ | ︙ |
Changes to win/tkWinColor.c.
︙ | ︙ | |||
360 361 362 363 364 365 366 | entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(color->pixel), &new); if (new) { refCount = 1; } else { refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1; } | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | entryPtr = Tcl_CreateHashEntry(&cmap->refCounts, INT2PTR(color->pixel), &new); if (new) { refCount = 1; } else { refCount = (size_t)Tcl_GetHashValue(entryPtr) + 1; } Tcl_SetHashValue(entryPtr, INT2PTR(refCount)); } else { /* * Determine what color will actually be used on non-colormap systems. */ color->pixel = GetNearestColor(dc, RGB(entry.peRed, entry.peGreen, entry.peBlue)); |
︙ | ︙ | |||
442 443 444 445 446 447 448 | ckfree(entries); cmap->size--; } else { Tcl_Panic("Tried to free a color that isn't allocated"); } Tcl_DeleteHashEntry(entryPtr); } else { | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | ckfree(entries); cmap->size--; } else { Tcl_Panic("Tried to free a color that isn't allocated"); } Tcl_DeleteHashEntry(entryPtr); } else { Tcl_SetHashValue(entryPtr, INT2PTR(refCount)); } } } ReleaseDC(NULL, dc); return Success; } |
︙ | ︙ |
Changes to win/tkWinCursor.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 | /* * The table below is used to map from the name of a predefined cursor to its * resource identifier. */ static struct CursorName { const char *name; | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | /* * The table below is used to map from the name of a predefined cursor to its * resource identifier. */ static struct CursorName { const char *name; LPCWSTR id; } cursorNames[] = { {"starting", IDC_APPSTARTING}, {"arrow", IDC_ARROW}, {"ibeam", IDC_IBEAM}, {"icon", IDC_ICON}, {"no", IDC_NO}, {"size", IDC_SIZEALL}, |
︙ | ︙ |
Changes to win/tkWinDefault.h.
︙ | ︙ | |||
64 65 66 67 68 69 70 | #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT HIGHLIGHT #define DEF_LABEL_HIGHLIGHT_WIDTH "0" #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" | | | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #define DEF_BUTTON_FONT "TkDefaultFont" #define DEF_BUTTON_HEIGHT "0" #define DEF_BUTTON_HIGHLIGHT_BG_COLOR DEF_BUTTON_BG_COLOR #define DEF_BUTTON_HIGHLIGHT_BG_MONO DEF_BUTTON_BG_MONO #define DEF_BUTTON_HIGHLIGHT HIGHLIGHT #define DEF_LABEL_HIGHLIGHT_WIDTH "0" #define DEF_BUTTON_HIGHLIGHT_WIDTH "1" #define DEF_BUTTON_IMAGE NULL #define DEF_BUTTON_INDICATOR "1" #define DEF_BUTTON_JUSTIFY "center" #define DEF_BUTTON_OFF_VALUE "0" #define DEF_BUTTON_ON_VALUE "1" #define DEF_BUTTON_OVER_RELIEF "" #define DEF_BUTTON_PADX "1" #define DEF_LABCHKRAD_PADX "1" #define DEF_BUTTON_PADY "1" #define DEF_LABCHKRAD_PADY "1" #define DEF_BUTTON_RELIEF "raised" #define DEF_LABCHKRAD_RELIEF "flat" #define DEF_BUTTON_REPEAT_DELAY "0" #define DEF_BUTTON_REPEAT_INTERVAL "0" #define DEF_BUTTON_SELECT_COLOR INDICATOR #define DEF_BUTTON_SELECT_MONO BLACK #define DEF_BUTTON_SELECT_IMAGE NULL #define DEF_BUTTON_STATE "normal" #define DEF_LABEL_TAKE_FOCUS "0" #define DEF_BUTTON_TAKE_FOCUS NULL #define DEF_BUTTON_TEXT "" #define DEF_BUTTON_TEXT_VARIABLE "" #define DEF_BUTTON_TRISTATE_VALUE "" #define DEF_BUTTON_UNDERLINE "-1" #define DEF_BUTTON_VALUE "" #define DEF_BUTTON_WIDTH "0" #define DEF_BUTTON_WRAP_LENGTH "0" |
︙ | ︙ | |||
122 123 124 125 126 127 128 | #define DEF_CANVAS_SCROLL_REGION "" #define DEF_CANVAS_SELECT_COLOR SELECT_BG #define DEF_CANVAS_SELECT_MONO BLACK #define DEF_CANVAS_SELECT_BD_COLOR "1" #define DEF_CANVAS_SELECT_BD_MONO "0" #define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG #define DEF_CANVAS_SELECT_FG_MONO WHITE | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | #define DEF_CANVAS_SCROLL_REGION "" #define DEF_CANVAS_SELECT_COLOR SELECT_BG #define DEF_CANVAS_SELECT_MONO BLACK #define DEF_CANVAS_SELECT_BD_COLOR "1" #define DEF_CANVAS_SELECT_BD_MONO "0" #define DEF_CANVAS_SELECT_FG_COLOR SELECT_FG #define DEF_CANVAS_SELECT_FG_MONO WHITE #define DEF_CANVAS_TAKE_FOCUS NULL #define DEF_CANVAS_WIDTH "10c" #define DEF_CANVAS_X_SCROLL_CMD "" #define DEF_CANVAS_X_SCROLL_INCREMENT "0" #define DEF_CANVAS_Y_SCROLL_CMD "" #define DEF_CANVAS_Y_SCROLL_INCREMENT "0" /* |
︙ | ︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | #define DEF_ENTRY_INSERT_BG TEXT_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace" #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" #define DEF_ENTRY_SELECT_COLOR SELECT_BG #define DEF_ENTRY_SELECT_MONO BLACK #define DEF_ENTRY_SELECT_BD_COLOR "0" #define DEF_ENTRY_SELECT_BD_MONO "0" #define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG #define DEF_ENTRY_SELECT_FG_MONO WHITE | > > | | > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | #define DEF_ENTRY_INSERT_BG TEXT_FG #define DEF_ENTRY_INSERT_BD_COLOR "0" #define DEF_ENTRY_INSERT_BD_MONO "0" #define DEF_ENTRY_INSERT_OFF_TIME "300" #define DEF_ENTRY_INSERT_ON_TIME "600" #define DEF_ENTRY_INSERT_WIDTH "2" #define DEF_ENTRY_JUSTIFY "left" #define DEF_ENTRY_PLACEHOLDER "" #define DEF_ENTRY_PLACEHOLDERFG "#b3b3b3" #define DEF_ENTRY_READONLY_BG_COLOR "SystemButtonFace" #define DEF_ENTRY_READONLY_BG_MONO WHITE #define DEF_ENTRY_RELIEF "sunken" #define DEF_ENTRY_SCROLL_COMMAND "" #define DEF_ENTRY_SELECT_COLOR SELECT_BG #define DEF_ENTRY_SELECT_MONO BLACK #define DEF_ENTRY_SELECT_BD_COLOR "0" #define DEF_ENTRY_SELECT_BD_MONO "0" #define DEF_ENTRY_SELECT_FG_COLOR SELECT_FG #define DEF_ENTRY_SELECT_FG_MONO WHITE #define DEF_ENTRY_SHOW NULL #define DEF_ENTRY_STATE "normal" #define DEF_ENTRY_TAKE_FOCUS NULL #define DEF_ENTRY_TEXT_VARIABLE "" #define DEF_ENTRY_WIDTH "20" /* * Defaults for frames: */ #define DEF_FRAME_BG_COLOR NORMAL_BG #define DEF_FRAME_BG_IMAGE NULL #define DEF_FRAME_BG_MONO WHITE #define DEF_FRAME_BG_TILE "0" #define DEF_FRAME_BORDER_WIDTH "0" #define DEF_FRAME_CLASS "Frame" #define DEF_FRAME_COLORMAP "" #define DEF_FRAME_CONTAINER "0" #define DEF_FRAME_CURSOR "" #define DEF_FRAME_HEIGHT "0" #define DEF_FRAME_HIGHLIGHT_BG NORMAL_BG |
︙ | ︙ | |||
232 233 234 235 236 237 238 | #define DEF_LISTBOX_SELECT_MONO BLACK #define DEF_LISTBOX_SELECT_BD "0" #define DEF_LISTBOX_SELECT_FG_COLOR SELECT_FG #define DEF_LISTBOX_SELECT_FG_MONO WHITE #define DEF_LISTBOX_SELECT_MODE "browse" #define DEF_LISTBOX_SET_GRID "0" #define DEF_LISTBOX_STATE "normal" | | | | | | | | | | | | | | | | > | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | #define DEF_LISTBOX_SELECT_MONO BLACK #define DEF_LISTBOX_SELECT_BD "0" #define DEF_LISTBOX_SELECT_FG_COLOR SELECT_FG #define DEF_LISTBOX_SELECT_FG_MONO WHITE #define DEF_LISTBOX_SELECT_MODE "browse" #define DEF_LISTBOX_SET_GRID "0" #define DEF_LISTBOX_STATE "normal" #define DEF_LISTBOX_TAKE_FOCUS NULL #define DEF_LISTBOX_WIDTH "20" /* * Defaults for individual entries of menus: */ #define DEF_MENU_ENTRY_ACTIVE_BG NULL #define DEF_MENU_ENTRY_ACTIVE_FG NULL #define DEF_MENU_ENTRY_ACCELERATOR NULL #define DEF_MENU_ENTRY_BG NULL #define DEF_MENU_ENTRY_BITMAP NULL #define DEF_MENU_ENTRY_COLUMN_BREAK "0" #define DEF_MENU_ENTRY_COMMAND NULL #define DEF_MENU_ENTRY_COMPOUND "none" #define DEF_MENU_ENTRY_FG NULL #define DEF_MENU_ENTRY_FONT NULL #define DEF_MENU_ENTRY_HIDE_MARGIN "0" #define DEF_MENU_ENTRY_IMAGE NULL #define DEF_MENU_ENTRY_INDICATOR "1" #define DEF_MENU_ENTRY_LABEL NULL #define DEF_MENU_ENTRY_MENU NULL #define DEF_MENU_ENTRY_OFF_VALUE "0" #define DEF_MENU_ENTRY_ON_VALUE "1" #define DEF_MENU_ENTRY_SELECT_IMAGE NULL #define DEF_MENU_ENTRY_STATE "normal" #define DEF_MENU_ENTRY_VALUE NULL #define DEF_MENU_ENTRY_CHECK_VARIABLE NULL #define DEF_MENU_ENTRY_RADIO_VARIABLE "selectedButton" #define DEF_MENU_ENTRY_SELECT NULL #define DEF_MENU_ENTRY_UNDERLINE "-1" /* * Defaults for menus overall: */ #define DEF_MENU_ACTIVE_BG_COLOR SELECT_BG #define DEF_MENU_ACTIVE_BG_MONO BLACK #define DEF_MENU_ACTIVE_BORDER_WIDTH "0" #define DEF_MENU_ACTIVE_FG_COLOR SELECT_FG #define DEF_MENU_ACTIVE_FG_MONO WHITE #define DEF_MENU_ACTIVE_RELIEF "flat" #define DEF_MENU_BG_COLOR MENU_BG #define DEF_MENU_BG_MONO WHITE #define DEF_MENU_BORDER_WIDTH "0" #define DEF_MENU_CURSOR "arrow" #define DEF_MENU_DISABLED_FG_COLOR DISABLED #define DEF_MENU_DISABLED_FG_MONO "" #define DEF_MENU_FONT "TkMenuFont" #define DEF_MENU_FG MENU_FG #define DEF_MENU_POST_COMMAND "" #define DEF_MENU_RELIEF "flat" #define DEF_MENU_SELECT_COLOR MENU_FG #define DEF_MENU_SELECT_MONO BLACK #define DEF_MENU_TAKE_FOCUS "0" #define DEF_MENU_TEAROFF "0" #define DEF_MENU_TEAROFF_CMD NULL #define DEF_MENU_TITLE "" #define DEF_MENU_TYPE "normal" /* * Defaults for menubuttons: */ |
︙ | ︙ | |||
315 316 317 318 319 320 321 | #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG NORMAL_FG #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT HIGHLIGHT #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" | | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | #define DEF_MENUBUTTON_FONT "TkDefaultFont" #define DEF_MENUBUTTON_FG NORMAL_FG #define DEF_MENUBUTTON_HEIGHT "0" #define DEF_MENUBUTTON_HIGHLIGHT_BG_COLOR DEF_MENUBUTTON_BG_COLOR #define DEF_MENUBUTTON_HIGHLIGHT_BG_MONO DEF_MENUBUTTON_BG_MONO #define DEF_MENUBUTTON_HIGHLIGHT HIGHLIGHT #define DEF_MENUBUTTON_HIGHLIGHT_WIDTH "0" #define DEF_MENUBUTTON_IMAGE NULL #define DEF_MENUBUTTON_INDICATOR "0" #define DEF_MENUBUTTON_JUSTIFY "center" #define DEF_MENUBUTTON_MENU "" #define DEF_MENUBUTTON_PADX "4p" #define DEF_MENUBUTTON_PADY "3p" #define DEF_MENUBUTTON_RELIEF "flat" #define DEF_MENUBUTTON_STATE "normal" |
︙ | ︙ | |||
425 426 427 428 429 430 431 | #define DEF_SCALE_RESOLUTION "1" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | #define DEF_SCALE_RESOLUTION "1" #define DEF_SCALE_TROUGH_COLOR TROUGH #define DEF_SCALE_TROUGH_MONO WHITE #define DEF_SCALE_SHOW_VALUE "1" #define DEF_SCALE_SLIDER_LENGTH "30" #define DEF_SCALE_SLIDER_RELIEF "raised" #define DEF_SCALE_STATE "normal" #define DEF_SCALE_TAKE_FOCUS NULL #define DEF_SCALE_TICK_INTERVAL "0" #define DEF_SCALE_TO "100" #define DEF_SCALE_VARIABLE "" #define DEF_SCALE_WIDTH "15" /* * Defaults for scrollbars: |
︙ | ︙ | |||
452 453 454 455 456 457 458 | #define DEF_SCROLLBAR_HIGHLIGHT HIGHLIGHT #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" #define DEF_SCROLLBAR_RELIEF "sunken" #define DEF_SCROLLBAR_REPEAT_DELAY "300" #define DEF_SCROLLBAR_REPEAT_INTERVAL "100" | | | 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 | #define DEF_SCROLLBAR_HIGHLIGHT HIGHLIGHT #define DEF_SCROLLBAR_HIGHLIGHT_WIDTH "0" #define DEF_SCROLLBAR_JUMP "0" #define DEF_SCROLLBAR_ORIENT "vertical" #define DEF_SCROLLBAR_RELIEF "sunken" #define DEF_SCROLLBAR_REPEAT_DELAY "300" #define DEF_SCROLLBAR_REPEAT_INTERVAL "100" #define DEF_SCROLLBAR_TAKE_FOCUS NULL #define DEF_SCROLLBAR_TROUGH_COLOR TROUGH #define DEF_SCROLLBAR_TROUGH_MONO WHITE #define DEF_SCROLLBAR_WIDTH "10" /* * Defaults for texts: */ |
︙ | ︙ | |||
500 501 502 503 504 505 506 | #define DEF_TEXT_SET_GRID "0" #define DEF_TEXT_SPACING1 "0" #define DEF_TEXT_SPACING2 "0" #define DEF_TEXT_SPACING3 "0" #define DEF_TEXT_STATE "normal" #define DEF_TEXT_TABS "" #define DEF_TEXT_TABSTYLE "tabular" | | | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 | #define DEF_TEXT_SET_GRID "0" #define DEF_TEXT_SPACING1 "0" #define DEF_TEXT_SPACING2 "0" #define DEF_TEXT_SPACING3 "0" #define DEF_TEXT_STATE "normal" #define DEF_TEXT_TABS "" #define DEF_TEXT_TABSTYLE "tabular" #define DEF_TEXT_TAKE_FOCUS NULL #define DEF_TEXT_UNDO "0" #define DEF_TEXT_WIDTH "80" #define DEF_TEXT_WRAP "char" #define DEF_TEXT_XSCROLL_COMMAND "" #define DEF_TEXT_YSCROLL_COMMAND "" /* |
︙ | ︙ |
Changes to win/tkWinDialog.c.
︙ | ︙ | |||
37 38 39 40 41 42 43 | /* This "new" dialog style is now actually the "old" dialog style post-Vista */ #ifndef BIF_NEWDIALOGSTYLE #define BIF_NEWDIALOGSTYLE 0x0040 #endif #ifndef BFFM_VALIDATEFAILED | < < < < | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | /* This "new" dialog style is now actually the "old" dialog style post-Vista */ #ifndef BIF_NEWDIALOGSTYLE #define BIF_NEWDIALOGSTYLE 0x0040 #endif #ifndef BFFM_VALIDATEFAILED #define BFFM_VALIDATEFAILED 4 #endif /* BFFM_VALIDATEFAILED */ typedef struct { int debugFlag; /* Flags whether we should output debugging * information while displaying a builtin * dialog. */ Tcl_Interp *debugInterp; /* Interpreter to used for debugging. */ UINT WM_LBSELCHANGED; /* Holds a registered windows event used for * communicating between the Directory Chooser * dialog and its hook proc. */ |
︙ | ︙ | |||
139 140 141 142 143 144 145 | /* * The following structure is used to pass information between the directory * chooser function, Tk_ChooseDirectoryObjCmd(), and its dialog hook proc. */ typedef struct { | | | | | < < < | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | /* * The following structure is used to pass information between the directory * chooser function, Tk_ChooseDirectoryObjCmd(), and its dialog hook proc. */ typedef struct { WCHAR initDir[MAX_PATH]; /* Initial folder to use */ WCHAR retDir[MAX_PATH]; /* Returned folder to use */ Tcl_Interp *interp; int mustExist; /* True if file must exist to return from * callback */ } ChooseDir; /* * The following structure is used to pass information between GetFileName * function and OFN dialog hook procedures. [Bug 2896501, Patch 2898255] */ typedef struct OFNData { Tcl_Interp *interp; /* Interp, used only if debug is turned on, * for setting the "tk_dialog" variable. */ int dynFileBufferSize; /* Dynamic filename buffer size, stored to * avoid shrinking and expanding the buffer * when selection changes */ WCHAR *dynFileBuffer; /* Dynamic filename buffer */ } OFNData; /* * The following structure is used to gather options used by various * file dialogs */ typedef struct OFNOpts { Tk_Window tkwin; /* Owner window for dialog */ Tcl_Obj *extObj; /* Default extension */ Tcl_Obj *titleObj; /* Title for dialog */ Tcl_Obj *filterObj; /* File type filter list */ Tcl_Obj *typeVariableObj; /* Variable in which to store type selected */ Tcl_Obj *initialTypeObj; /* Initial value of above, or NULL */ Tcl_DString utfDirString; /* Initial dir */ int multi; /* Multiple selection enabled */ int confirmOverwrite; /* Confirm before overwriting */ int mustExist; /* Used only for */ int forceXPStyle; /* XXX - Force XP style even on newer systems */ WCHAR file[TK_MULTI_MAX_PATH]; /* File name XXX - fixed size because it was so historically. Why not malloc'ed ? */ } OFNOpts; /* Define the operation for which option parsing is to be done. */ enum OFNOper { OFN_FILE_SAVE, /* tk_getOpenFile */ OFN_FILE_OPEN, /* tk_getSaveFile */ |
︙ | ︙ | |||
592 593 594 595 596 597 598 | static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr, Tcl_DString *dsPtr, Tcl_Obj *initialPtr, int *indexPtr); static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); | | | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | static int MakeFilter(Tcl_Interp *interp, Tcl_Obj *valuePtr, Tcl_DString *dsPtr, Tcl_Obj *initialPtr, int *indexPtr); static UINT APIENTRY OFNHookProc(HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK MsgBoxCBTProc(int nCode, WPARAM wParam, LPARAM lParam); static void SetTkDialog(ClientData clientData); static const char *ConvertExternalFilename(WCHAR *filename, Tcl_DString *dsPtr); static void LoadShellProcs(void); /* Definitions of dynamically loaded Win32 calls */ typedef HRESULT (STDAPICALLTYPE SHCreateItemFromParsingNameProc)( PCWSTR pszPath, IBindCtx *pbc, REFIID riid, void **ppv); |
︙ | ︙ | |||
640 641 642 643 644 645 646 | static void LoadShellProcs() { static HMODULE shell32_handle = NULL; if (shell32_handle != NULL) return; /* We have already been through here. */ | | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | static void LoadShellProcs() { static HMODULE shell32_handle = NULL; if (shell32_handle != NULL) return; /* We have already been through here. */ shell32_handle = GetModuleHandle(L"shell32.dll"); if (shell32_handle == NULL) /* Should never happen but check anyways. */ return; ShellProcs.SHCreateItemFromParsingName = (SHCreateItemFromParsingNameProc*) GetProcAddress(shell32_handle, "SHCreateItemFromParsingName"); } |
︙ | ︙ | |||
793 794 795 796 797 798 799 | chooseColor.hwndOwner = NULL; chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc; | | | 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | chooseColor.hwndOwner = NULL; chooseColor.hInstance = NULL; chooseColor.rgbResult = oldColor; chooseColor.lpCustColors = dwCustColors; chooseColor.Flags = CC_RGBINIT | CC_FULLOPEN | CC_ENABLEHOOK; chooseColor.lCustData = (LPARAM) NULL; chooseColor.lpfnHook = (LPOFNHOOKPROC) ColorDlgHookProc; chooseColor.lpTemplateName = (LPWSTR) interp; for (i = 1; i < objc; i += 2) { int index; const char *string; Tcl_Obj *optionPtr, *valuePtr; optionPtr = objv[i]; |
︙ | ︙ | |||
1375 1376 1377 1378 1379 1380 1381 | if (optsPtr->extObj != NULL) { Tcl_DString ds; const char *src; src = Tcl_GetString(optsPtr->extObj); wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->extObj->length, &ds); | | | 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 | if (optsPtr->extObj != NULL) { Tcl_DString ds; const char *src; src = Tcl_GetString(optsPtr->extObj); wstr = (LPWSTR) Tcl_WinUtfToTChar(src, optsPtr->extObj->length, &ds); if (wstr[0] == '.') ++wstr; hr = fdlgIf->lpVtbl->SetDefaultExtension(fdlgIf, wstr); Tcl_DStringFree(&ds); if (FAILED(hr)) goto vamoose; } |
︙ | ︙ | |||
1621 1622 1623 1624 1625 1626 1627 | /* * Starting buffer size. The buffer will be expanded by the OFN dialog * procedure when necessary */ ofnData.dynFileBufferSize = 512; | | | | | 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 | /* * Starting buffer size. The buffer will be expanded by the OFN dialog * procedure when necessary */ ofnData.dynFileBufferSize = 512; ofnData.dynFileBuffer = ckalloc(512 * sizeof(WCHAR)); } if (optsPtr->extObj != NULL) { str = Tcl_GetString(optsPtr->extObj); if (str[0] == '.') ++str; Tcl_WinUtfToTChar(str, -1, &extString); ofn.lpstrDefExt = (WCHAR *) Tcl_DStringValue(&extString); } Tcl_WinUtfToTChar(Tcl_DStringValue(&utfFilterString), Tcl_DStringLength(&utfFilterString), &filterString); ofn.lpstrFilter = (WCHAR *) Tcl_DStringValue(&filterString); ofn.nFilterIndex = filterIndex; if (Tcl_DStringValue(&optsPtr->utfDirString)[0] != '\0') { Tcl_WinUtfToTChar(Tcl_DStringValue(&optsPtr->utfDirString), Tcl_DStringLength(&optsPtr->utfDirString), &dirString); } else { /* |
︙ | ︙ | |||
1659 1660 1661 1662 1663 1664 1665 | Tcl_ResetResult(interp); } else { Tcl_WinUtfToTChar(Tcl_DStringValue(&cwd), Tcl_DStringLength(&cwd), &dirString); } Tcl_DStringFree(&cwd); } | | | | 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 | Tcl_ResetResult(interp); } else { Tcl_WinUtfToTChar(Tcl_DStringValue(&cwd), Tcl_DStringLength(&cwd), &dirString); } Tcl_DStringFree(&cwd); } ofn.lpstrInitialDir = (WCHAR *) Tcl_DStringValue(&dirString); if (optsPtr->titleObj != NULL) { Tcl_WinUtfToTChar(Tcl_GetString(optsPtr->titleObj), -1, &titleString); ofn.lpstrTitle = (WCHAR *) Tcl_DStringValue(&titleString); } /* * Popup the dialog. */ oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); |
︙ | ︙ | |||
1710 1711 1712 1713 1714 1715 1716 | */ cdlgerr = CommDlgExtendedError(); /* * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The * filename buffer has been dynamically allocated by the OFN dialog | | | | 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 | */ cdlgerr = CommDlgExtendedError(); /* * We now allow FNERR_BUFFERTOOSMALL when multiselection is enabled. The * filename buffer has been dynamically allocated by the OFN dialog * procedure to accommodate all selected files. */ if ((winCode != 0) || ((cdlgerr == FNERR_BUFFERTOOSMALL) && (ofn.Flags & OFN_ALLOWMULTISELECT))) { int gotFilename = 0; /* Flag for tracking whether we have any * filename at all. For details, see * http://stackoverflow.com/q/9227859/301832 */ if (ofn.Flags & OFN_ALLOWMULTISELECT) { /* * The result in dynFileBuffer contains many items, separated by * NUL characters. It is terminated with two nulls in a row. The * first element is the directory path. */ WCHAR *files = ofnData.dynFileBuffer; Tcl_Obj *returnList = Tcl_NewObj(); int count = 0; /* * Get directory. */ |
︙ | ︙ | |||
1940 1941 1942 1943 1944 1945 1946 | * operation so it should not incur any noticeable delay. See [Bug * 2987995] */ if (notifyPtr->hdr.code == CDN_FILEOK || notifyPtr->hdr.code == CDN_SELCHANGE) { int dirsize, selsize; | | | 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 | * operation so it should not incur any noticeable delay. See [Bug * 2987995] */ if (notifyPtr->hdr.code == CDN_FILEOK || notifyPtr->hdr.code == CDN_SELCHANGE) { int dirsize, selsize; WCHAR *buffer; int buffersize; /* * Change of selection. Unscramble the unholy mess that's in the * selection buffer, resizing it if necessary. */ |
︙ | ︙ | |||
1964 1965 1966 1967 1968 1969 1970 | /* * Just empty the buffer if dirsize indicates an error. [Bug * 3071836] */ if ((selsize > 1) && (dirsize > 0)) { if (ofnData->dynFileBufferSize < buffersize) { | | | | 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 | /* * Just empty the buffer if dirsize indicates an error. [Bug * 3071836] */ if ((selsize > 1) && (dirsize > 0)) { if (ofnData->dynFileBufferSize < buffersize) { buffer = ckrealloc(buffer, buffersize * sizeof(WCHAR)); ofnData->dynFileBufferSize = buffersize; ofnData->dynFileBuffer = buffer; } SendMessage(hdlg, CDM_GETFOLDERPATH, dirsize, (LPARAM) buffer); buffer += dirsize; SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); /* * If there are multiple files, delete the quotes and change * every second quote to NULL terminator */ if (buffer[0] == '"') { BOOL findquote = TRUE; WCHAR *tmp = buffer; while (*buffer != '\0') { if (findquote) { if (*buffer == '"') { findquote = FALSE; } buffer++; |
︙ | ︙ | |||
2010 2011 2012 2013 2014 2015 2016 | */ Tcl_DString tmpfile; ConvertExternalFilename(buffer, &tmpfile); if (TCL_PATH_ABSOLUTE == Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { /* re-get the full path to the start of the buffer */ | | | 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 | */ Tcl_DString tmpfile; ConvertExternalFilename(buffer, &tmpfile); if (TCL_PATH_ABSOLUTE == Tcl_GetPathType(Tcl_DStringValue(&tmpfile))) { /* re-get the full path to the start of the buffer */ buffer = (WCHAR *) ofnData->dynFileBuffer; SendMessage(hdlg, CDM_GETSPEC, selsize, (LPARAM) buffer); } else { *(buffer-1) = '\\'; } buffer[selsize] = '\0'; /* Second NULL terminator. */ Tcl_DStringFree(&tmpfile); } |
︙ | ︙ | |||
2110 2111 2112 2113 2114 2115 2116 | *p++ = '.'; *p++ = '*'; *p++ = '\0'; *p++ = '\0'; *p = '\0'; } else { | | | < | 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 | *p++ = '.'; *p++ = '*'; *p++ = '\0'; *p++ = '\0'; *p = '\0'; } else { TkSizeT len; if (valuePtr == NULL) { len = 0; } else { (void) TkGetStringFromObj(valuePtr, &len); } /* * We format the filetype into a string understood by Windows: {"Text * Documents" {.doc .txt} {TEXT}} becomes "Text Documents * (*.doc,*.txt)\0*.doc;*.txt\0" * |
︙ | ︙ | |||
2223 2224 2225 2226 2227 2228 2229 | */ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr) { if (dlgFilterPtr != NULL) { DWORD dw; for (dw = 0; dw < count; ++dw) { if (dlgFilterPtr[dw].pszName != NULL) | | | | 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 | */ static void FreeFilterVista(DWORD count, TCLCOMDLG_FILTERSPEC *dlgFilterPtr) { if (dlgFilterPtr != NULL) { DWORD dw; for (dw = 0; dw < count; ++dw) { if (dlgFilterPtr[dw].pszName != NULL) ckfree((char *)dlgFilterPtr[dw].pszName); if (dlgFilterPtr[dw].pszSpec != NULL) ckfree((char *)dlgFilterPtr[dw].pszSpec); } ckfree(dlgFilterPtr); } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
2291 2292 2293 2294 2295 2296 2297 | Tcl_DStringInit(&ds); Tcl_DStringInit(&patterns); dlgFilterPtr = ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); for (i = 0, filterPtr = flist.filters; filterPtr; filterPtr = filterPtr->next, ++i) { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | > | 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 | Tcl_DStringInit(&ds); Tcl_DStringInit(&patterns); dlgFilterPtr = ckalloc(flist.numFilters * sizeof(*dlgFilterPtr)); for (i = 0, filterPtr = flist.filters; filterPtr; filterPtr = filterPtr->next, ++i) { const char *sep; FileFilterClause *clausePtr; int nbytes; /* Check if this entry should be shown as the default */ if (initial && strcmp(initial, filterPtr->name) == 0) initialIndex = i+1; /* Windows filter indices are 1-based */ /* First stash away the text description of the pattern */ Tcl_WinUtfToTChar(filterPtr->name, -1, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ dlgFilterPtr[i].pszName = ckalloc(nbytes); memmove((void *) dlgFilterPtr[i].pszName, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); /* * Loop through and join patterns with a ";" Each "clause" * corresponds to a single textual description (called typename) * in the tk_getOpenFile docs. Each such typename may occur * multiple times and all these form a single filter entry * with one clause per occurence. Further each clause may specify * multiple patterns. Hence the nested loop here. */ sep = ""; for (clausePtr=filterPtr->clauses ; clausePtr; clausePtr=clausePtr->next) { GlobPattern *globPtr; for (globPtr = clausePtr->patterns; globPtr; globPtr = globPtr->next) { Tcl_DStringAppend(&patterns, sep, -1); Tcl_DStringAppend(&patterns, globPtr->pattern, -1); sep = ";"; } } /* Again we need a Unicode form of the string */ Tcl_WinUtfToTChar(Tcl_DStringValue(&patterns), -1, &ds); nbytes = Tcl_DStringLength(&ds); /* # bytes, not Unicode chars */ nbytes += sizeof(WCHAR); /* Terminating \0 */ dlgFilterPtr[i].pszSpec = ckalloc(nbytes); memmove((void *)dlgFilterPtr[i].pszSpec, Tcl_DStringValue(&ds), nbytes); Tcl_DStringFree(&ds); Tcl_DStringSetLength(&patterns, 0); } Tcl_DStringFree(&patterns); if (initialIndex == 0) { initialIndex = 1; /* If no default, show first entry */ } *initialIndexPtr = initialIndex; *dlgFilterPtrPtr = dlgFilterPtr; *countPtr = flist.numFilters; TkFreeFileFilters(&flist); return TCL_OK; } |
︙ | ︙ | |||
2425 2426 2427 2428 2429 2430 2431 | int Tk_ChooseDirectoryObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { | | | | 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 | int Tk_ChooseDirectoryObjCmd( ClientData clientData, /* Main window associated with interpreter. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { WCHAR path[MAX_PATH]; int oldMode, result; LPCITEMIDLIST pidl; /* Returned by browser */ BROWSEINFO bInfo; /* Used by browser */ ChooseDir cdCBData; /* Structure to pass back and forth */ LPMALLOC pMalloc; /* Used by shell */ HWND hWnd; WCHAR saveDir[MAX_PATH]; Tcl_DString titleString; /* Title */ Tcl_DString tempString; /* temporary */ Tcl_Obj *objPtr; OFNOpts ofnOpts; const char *utfDir; result = ParseOFNOptions(clientData, interp, objc, objv, |
︙ | ︙ | |||
2460 2461 2462 2463 2464 2465 2466 | path[0] = '\0'; ZeroMemory(&cdCBData, sizeof(ChooseDir)); cdCBData.interp = interp; cdCBData.mustExist = ofnOpts.mustExist; utfDir = Tcl_DStringValue(&ofnOpts.utfDirString); if (utfDir[0] != '\0') { | | | | | | | | 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 | path[0] = '\0'; ZeroMemory(&cdCBData, sizeof(ChooseDir)); cdCBData.interp = interp; cdCBData.mustExist = ofnOpts.mustExist; utfDir = Tcl_DStringValue(&ofnOpts.utfDirString); if (utfDir[0] != '\0') { const WCHAR *uniStr; Tcl_WinUtfToTChar(Tcl_DStringValue(&ofnOpts.utfDirString), -1, &tempString); uniStr = (WCHAR *) Tcl_DStringValue(&tempString); /* Convert possible relative path to full path to keep dialog happy. */ GetFullPathName(uniStr, MAX_PATH, saveDir, NULL); wcsncpy(cdCBData.initDir, saveDir, MAX_PATH); } /* XXX - rest of this (original) code has no error checks at all. */ /* * Get ready to call the browser */ Tk_MakeWindowExist(ofnOpts.tkwin); hWnd = Tk_GetHWND(Tk_WindowId(ofnOpts.tkwin)); /* * Setup the parameters used by SHBrowseForFolder */ bInfo.hwndOwner = hWnd; bInfo.pszDisplayName = path; bInfo.pidlRoot = NULL; if (wcslen(cdCBData.initDir) == 0) { GetCurrentDirectory(MAX_PATH, cdCBData.initDir); } bInfo.lParam = (LPARAM) &cdCBData; if (ofnOpts.titleObj != NULL) { Tcl_WinUtfToTChar(Tcl_GetString(ofnOpts.titleObj), -1, &titleString); bInfo.lpszTitle = (LPWSTR) Tcl_DStringValue(&titleString); } else { bInfo.lpszTitle = L"Please choose a directory, then select OK."; } /* * Set flags to add edit box, status text line and use the new ui. Allow * override with magic variable (ignore errors in retrieval). See * http://msdn.microsoft.com/en-us/library/bb773205(VS.85).aspx for * possible flag values. |
︙ | ︙ | |||
2557 2558 2559 2560 2561 2562 2563 | if (pidl != NULL) { if (!SHGetPathFromIDList(pidl, path)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error: not a file system folder", -1)); Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "PSEUDO", NULL); } pMalloc->lpVtbl->Free(pMalloc, (void *) pidl); | | | | 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 | if (pidl != NULL) { if (!SHGetPathFromIDList(pidl, path)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "error: not a file system folder", -1)); Tcl_SetErrorCode(interp, "TK", "DIRDIALOG", "PSEUDO", NULL); } pMalloc->lpVtbl->Free(pMalloc, (void *) pidl); } else if (wcslen(cdCBData.retDir) > 0) { wcscpy(path, cdCBData.retDir); } pMalloc->lpVtbl->Release(pMalloc); } SetCurrentDirectory(saveDir); Tcl_SetServiceMode(oldMode); /* |
︙ | ︙ | |||
2614 2615 2616 2617 2618 2619 2620 | static UINT APIENTRY ChooseDirectoryValidateProc( HWND hwnd, UINT message, LPARAM lParam, LPARAM lpData) { | | | | | | | | 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 | static UINT APIENTRY ChooseDirectoryValidateProc( HWND hwnd, UINT message, LPARAM lParam, LPARAM lpData) { WCHAR selDir[MAX_PATH]; ChooseDir *chooseDirSharedData = (ChooseDir *) lpData; Tcl_DString tempString; Tcl_DString initDirString; WCHAR string[MAX_PATH]; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->debugFlag) { tsdPtr->debugInterp = (Tcl_Interp *) chooseDirSharedData->interp; Tcl_DoWhenIdle(SetTkDialog, hwnd); } chooseDirSharedData->retDir[0] = '\0'; switch (message) { case BFFM_VALIDATEFAILED: /* * First save and check to see if it is a valid path name, if so then * make that path the one shown in the window. Otherwise, it failed * the check and should be treated as such. Use * Set/GetCurrentDirectory which allows relative path names and names * with forward slashes. Use Tcl_TranslateFileName to make sure names * like ~ are converted correctly. */ Tcl_WinTCharToUtf((WCHAR *) lParam, -1, &initDirString); if (Tcl_TranslateFileName(chooseDirSharedData->interp, Tcl_DStringValue(&initDirString), &tempString) == NULL) { /* * Should we expose the error (in the interp result) to the user * at this point? */ chooseDirSharedData->retDir[0] = '\0'; return 1; } Tcl_DStringFree(&initDirString); Tcl_WinUtfToTChar(Tcl_DStringValue(&tempString), -1, &initDirString); Tcl_DStringFree(&tempString); wcsncpy(string, (WCHAR *) Tcl_DStringValue(&initDirString), MAX_PATH); Tcl_DStringFree(&initDirString); if (SetCurrentDirectory(string) == 0) { /* * Get the full path name to the user entry, at this point it does * not exist so see if it is supposed to. Otherwise just return * it. */ GetFullPathName(string, MAX_PATH, chooseDirSharedData->retDir, NULL); if (chooseDirSharedData->mustExist) { /* * User HAS to select a valid directory. */ wsprintf(selDir, L"Directory '%s' does not exist,\n" L"please select or enter an existing directory.", chooseDirSharedData->retDir); MessageBox(NULL, selDir, NULL, MB_ICONEXCLAMATION|MB_OK); chooseDirSharedData->retDir[0] = '\0'; return 1; } } else { /* |
︙ | ︙ | |||
2712 2713 2714 2715 2716 2717 2718 | SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; case BFFM_INITIALIZED: { /* | | | | | 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 | SendMessage(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; case BFFM_INITIALIZED: { /* * Directory browser initializing - tell it where to start from, user * specified parameter. */ WCHAR *initDir = chooseDirSharedData->initDir; SetCurrentDirectory(initDir); if (*initDir == '\\') { /* * BFFM_SETSELECTION only understands UNC paths as pidls, so * convert path to pidl using IShellFolder interface. */ LPMALLOC pMalloc; LPSHELLFOLDER psfFolder; if (SUCCEEDED(SHGetMalloc(&pMalloc))) { if (SUCCEEDED(SHGetDesktopFolder(&psfFolder))) { LPITEMIDLIST pidlMain; ULONG ulCount, ulAttr; if (SUCCEEDED(psfFolder->lpVtbl->ParseDisplayName( psfFolder, hwnd, NULL, (WCHAR *) initDir, &ulCount,&pidlMain,&ulAttr)) && (pidlMain != NULL)) { SendMessage(hwnd, BFFM_SETSELECTION, FALSE, (LPARAM) pidlMain); pMalloc->lpVtbl->Free(pMalloc, pidlMain); } psfFolder->lpVtbl->Release(psfFolder); |
︙ | ︙ | |||
2907 2908 2909 2910 2911 2912 2913 | } } flags = buttonFlagMap[defaultBtnIdx]; } flags |= icon | type | MB_TASKMODAL | MB_SETFOREGROUND; | | < < | < | 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 | } } flags = buttonFlagMap[defaultBtnIdx]; } flags |= icon | type | MB_TASKMODAL | MB_SETFOREGROUND; tmpObj = messageObj ? Tcl_DuplicateObj(messageObj) : Tcl_NewObj(); Tcl_IncrRefCount(tmpObj); if (detailObj) { Tcl_AppendStringsToObj(tmpObj, "\n\n", NULL); Tcl_AppendObjToObj(tmpObj, detailObj); } oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); /* * MessageBoxW exists for all platforms. Use it to allow unicode error |
︙ | ︙ | |||
3018 3019 3020 3021 3022 3023 3024 | SetTkDialog( ClientData clientData) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); char buf[32]; | | | | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | SetTkDialog( ClientData clientData) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); char buf[32]; sprintf(buf, "0x%p", clientData); Tcl_SetVar2(tsdPtr->debugInterp, "tk_dialog", NULL, buf, TCL_GLOBAL_ONLY); } /* * Factored out a common pattern in use in this file. */ static const char * ConvertExternalFilename( WCHAR *filename, Tcl_DString *dsPtr) { char *p; Tcl_WinTCharToUtf(filename, -1, dsPtr); for (p = Tcl_DStringValue(dsPtr); *p != '\0'; p++) { /* |
︙ | ︙ | |||
3075 3076 3077 3078 3079 3080 3081 | resObj = Tcl_NewListObj(0, NULL); Tcl_WinTCharToUtf(plf->lfFaceName, -1, &ds); Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj(Tcl_DStringValue(&ds), -1)); Tcl_DStringFree(&ds); pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); | | | 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 | resObj = Tcl_NewListObj(0, NULL); Tcl_WinTCharToUtf(plf->lfFaceName, -1, &ds); Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj(Tcl_DStringValue(&ds), -1)); Tcl_DStringFree(&ds); pt = -MulDiv(plf->lfHeight, 72, GetDeviceCaps(hdc, LOGPIXELSY)); Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewWideIntObj(pt)); if (plf->lfWeight >= 700) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("bold", -1)); } if (plf->lfItalic) { Tcl_ListObjAppendElement(NULL, resObj, Tcl_NewStringObj("italic", -1)); } |
︙ | ︙ | |||
3158 3159 3160 3161 3162 3163 3164 | Tcl_DoWhenIdle(SetTkDialog, hwndDlg); } if (phd->titleObj != NULL) { Tcl_DString title; Tcl_WinUtfToTChar(Tcl_GetString(phd->titleObj), -1, &title); if (Tcl_DStringLength(&title) > 0) { | | | 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 | Tcl_DoWhenIdle(SetTkDialog, hwndDlg); } if (phd->titleObj != NULL) { Tcl_DString title; Tcl_WinUtfToTChar(Tcl_GetString(phd->titleObj), -1, &title); if (Tcl_DStringLength(&title) > 0) { SetWindowText(hwndDlg, (LPCWSTR) Tcl_DStringValue(&title)); } Tcl_DStringFree(&title); } /* * Disable the colour combobox (0x473) and its label (0x443). */ |
︙ | ︙ | |||
3253 3254 3255 3256 3257 3258 3259 | if (hdPtr->cmdObj) { resObj = hdPtr->cmdObj; } else { resObj = Tcl_NewStringObj("", 0); } break; case FontchooserVisible: | | | 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 | if (hdPtr->cmdObj) { resObj = hdPtr->cmdObj; } else { resObj = Tcl_NewStringObj("", 0); } break; case FontchooserVisible: resObj = Tcl_NewWideIntObj((hdPtr->hwnd != NULL) && IsWindow(hdPtr->hwnd)); break; default: resObj = Tcl_NewStringObj("", 0); } return resObj; } |
︙ | ︙ | |||
3474 3475 3476 3477 3478 3479 3480 | if (f == NULL) { return TCL_ERROR; } fontPtr = (TkFont *) f; cf.Flags |= CF_INITTOLOGFONTSTRUCT; Tcl_WinUtfToTChar(fontPtr->fa.family, -1, &ds); | | | 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 | if (f == NULL) { return TCL_ERROR; } fontPtr = (TkFont *) f; cf.Flags |= CF_INITTOLOGFONTSTRUCT; Tcl_WinUtfToTChar(fontPtr->fa.family, -1, &ds); wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; lf.lfHeight = -MulDiv((int)(TkFontGetPoints(tkwin, fontPtr->fa.size) + 0.5), GetDeviceCaps(hdc, LOGPIXELSY), 72); if (fontPtr->fa.weight == TK_FW_BOLD) { lf.lfWeight = FW_BOLD; |
︙ | ︙ |
Changes to win/tkWinDraw.c.
︙ | ︙ | |||
99 100 101 102 103 104 105 | /* * The followng typedef is used to pass Windows GDI drawing functions. */ typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, const POINT *points, int npoints); | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /* * The followng typedef is used to pass Windows GDI drawing functions. */ typedef BOOL (CALLBACK *WinDrawFunc)(HDC dc, const POINT *points, int npoints); typedef struct { POINT *winPoints; /* Array of points that is reused. */ int nWinPoints; /* Current size of point array. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations for functions defined in this file: |
︙ | ︙ | |||
1484 1485 1486 1487 1488 1489 1490 | { TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } /* *---------------------------------------------------------------------- * | | | > | | 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 | { TkDrawInsetFocusHighlight(tkwin, fgGC, highlightWidth, drawable, 0); } /* *---------------------------------------------------------------------- * * TkpDrawFrameEx -- * * This function draws the rectangular frame area. * * Results: * None. * * Side effects: * Draws inside the tkwin area. * *---------------------------------------------------------------------- */ void TkpDrawFrameEx( Tk_Window tkwin, Drawable drawable, Tk_3DBorder border, int highlightWidth, int borderWidth, int relief) { Tk_Fill3DRectangle(tkwin, drawable, border, highlightWidth, highlightWidth, Tk_Width(tkwin) - 2 * highlightWidth, Tk_Height(tkwin) - 2 * highlightWidth, borderWidth, relief); } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to win/tkWinEmbed.c.
︙ | ︙ | |||
30 31 32 33 34 35 36 | * or NULL if the embedded application isn't * in this process. */ HWND embeddedMenuHWnd; /* Tk's embedded menu window handler. */ struct Container *nextPtr; /* Next in list of all containers in this * process. */ } Container; | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | * or NULL if the embedded application isn't * in this process. */ HWND embeddedMenuHWnd; /* Tk's embedded menu window handler. */ struct Container *nextPtr; /* Next in list of all containers in this * process. */ } Container; typedef struct { Container *firstContainerPtr; /* First in list of all containers managed by * this process. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; static void ContainerEventProc(ClientData clientData, |
︙ | ︙ | |||
169 170 171 172 173 174 175 | while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) { /* empty body */ } TkpWmSetState(winPtr, state); TkWmMapWindow(winPtr); } | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | while (Tcl_DoOneEvent(TCL_IDLE_EVENTS)) { /* empty body */ } TkpWmSetState(winPtr, state); TkWmMapWindow(winPtr); } Tcl_Release(winPtr); } /* *---------------------------------------------------------------------- * * TkpUseWindow -- * |
︙ | ︙ | |||
299 300 301 302 303 304 305 | } else { /* * Proceed if the user decide to do so because it can be a legacy * container application. However we may have to return a TCL_ERROR in * order to avoid bug 1096074 in future. */ | | | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | } else { /* * Proceed if the user decide to do so because it can be a legacy * container application. However we may have to return a TCL_ERROR in * order to avoid bug 1096074 in future. */ WCHAR msg[256]; wsprintf(msg, L"Unable to get information of window \"%.40hs\". Attach to this\nwindow may have unpredictable results if it is not a valid container.\n\nPress Ok to proceed or Cancel to abort attaching.", string); if (IDCANCEL == MessageBox(hwnd, msg, L"Tk Warning", MB_OKCANCEL | MB_ICONWARNING)) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "Operation has been canceled", -1)); Tcl_SetErrorCode(interp, "TK", "EMBED", "CANCEL", NULL); return TCL_ERROR; } } |
︙ | ︙ | |||
327 328 329 330 331 332 333 | winPtr->flags &= ~(TK_MAPPED); /* * Preserve the winPtr and create an idle handler to map the embedded * window. */ | | | | 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | winPtr->flags &= ~(TK_MAPPED); /* * Preserve the winPtr and create an idle handler to map the embedded * window. */ Tcl_Preserve(winPtr); Tcl_DoWhenIdle((Tcl_IdleProc*) Tk_MapEmbeddedWindow, winPtr); return TCL_OK; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
388 389 390 391 392 393 394 | * that will be done by sending to the container window a WM_USER message, * which will be intercepted by TkWinContainerProc. * * We need to get structure events of the container itself, though. */ Tk_CreateEventHandler(tkwin, StructureNotifyMask, | | | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | * that will be done by sending to the container window a WM_USER message, * which will be intercepted by TkWinContainerProc. * * We need to get structure events of the container itself, though. */ Tk_CreateEventHandler(tkwin, StructureNotifyMask, ContainerEventProc, containerPtr); } /* *---------------------------------------------------------------------- * * TkWinEmbeddedEventProc -- * |
︙ | ︙ | |||
852 853 854 855 856 857 858 859 860 861 862 863 864 865 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_Window tkwin = (Tk_Window)containerPtr->parentPtr; if (eventPtr->type == ConfigureNotify) { /* * Resize the embedded window, if there is any. */ if (containerPtr->embeddedHWnd) { SetWindowPos(containerPtr->embeddedHWnd, NULL, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), SWP_NOZORDER); | > > > > > > > > > | 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 | ClientData clientData, /* Token for container window. */ XEvent *eventPtr) /* ResizeRequest event. */ { Container *containerPtr = (Container *)clientData; Tk_Window tkwin = (Tk_Window)containerPtr->parentPtr; if (eventPtr->type == ConfigureNotify) { /* * Send a ConfigureNotify to the embedded application. */ if (containerPtr->embeddedPtr != NULL) { TkDoConfigureNotify(containerPtr->embeddedPtr); } /* * Resize the embedded window, if there is any. */ if (containerPtr->embeddedHWnd) { SetWindowPos(containerPtr->embeddedHWnd, NULL, 0, 0, Tk_Width(tkwin), Tk_Height(tkwin), SWP_NOZORDER); |
︙ | ︙ |
Changes to win/tkWinFont.c.
1 2 3 | /* * tkWinFont.c -- * | | | 1 2 3 4 5 6 7 8 9 10 11 | /* * tkWinFont.c -- * * Contains the Windows implementation of the platform-independent font * package interface. * * Copyright (c) 1994 Software Research Associates, Inc. * Copyright (c) 1995-1997 Sun Microsystems, Inc. * Copyright (c) 1998-1999 by Scriptics Corporation. * * See the file "license.terms" for information on usage and redistribution of |
︙ | ︙ | |||
22 23 24 25 26 27 28 | * instance of this structure. The most important shared property is the * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Windows, a "font family" is uniquely identified by its face name. */ | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * instance of this structure. The most important shared property is the * character existence metrics, used to determine if a screen font can display * a given Unicode character. * * Under Windows, a "font family" is uniquely identified by its face name. */ #define FONTMAP_SHIFT 12 #define FONTMAP_PAGES (1 << (21 - FONTMAP_SHIFT)) #define FONTMAP_BITSPERPAGE (1 << FONTMAP_SHIFT) typedef struct FontFamily { struct FontFamily *nextPtr; /* Next in list of all known font families. */ size_t refCount; /* How many SubFonts are referring to this * FontFamily. When the refCount drops to * zero, this FontFamily may be freed. */ |
︙ | ︙ | |||
46 47 48 49 50 51 52 | * Derived properties. */ Tcl_Encoding encoding; /* Encoding for this font family. */ int isSymbolFont; /* Non-zero if this is a symbol font. */ int isWideFont; /* 1 if this is a double-byte font, 0 * otherwise. */ | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | * Derived properties. */ Tcl_Encoding encoding; /* Encoding for this font family. */ int isSymbolFont; /* Non-zero if this is a symbol font. */ int isWideFont; /* 1 if this is a double-byte font, 0 * otherwise. */ BOOL (WINAPI *textOutProc)(HDC hdc, int x, int y, WCHAR *str, int len); /* The procedure to use to draw text after it * has been converted from UTF-8 to the * encoding of this font. */ BOOL (WINAPI *getTextExtentPoint32Proc)(HDC, WCHAR *, int, LPSIZE); /* The procedure to use to measure text after * it has been converted from UTF-8 to the * encoding of this font. */ char *fontMap[FONTMAP_PAGES]; /* Two-level sparse table used to determine * quickly if the specified character exists. |
︙ | ︙ | |||
164 165 166 167 168 169 170 | {DEFAULT_GUI_FONT, "defaultgui"}, {OEM_FIXED_FONT, "oemfixed"}, {SYSTEM_FIXED_FONT, "systemfixed"}, {SYSTEM_FONT, "system"}, {-1, NULL} }; | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | {DEFAULT_GUI_FONT, "defaultgui"}, {OEM_FIXED_FONT, "oemfixed"}, {SYSTEM_FIXED_FONT, "systemfixed"}, {SYSTEM_FONT, "system"}, {-1, NULL} }; typedef struct { FontFamily *fontFamilyList; /* The list of font families that are * currently loaded. As screen fonts are * loaded, this list grows to hold information * about what characters exist in each font * family. */ Tcl_HashTable uidTable; } ThreadSpecificData; |
︙ | ︙ | |||
442 443 444 445 446 447 448 | * Identify an available fixed font. Equivalent to ANSI_FIXED_FONT but * more reliable on Russian Windows. */ { LOGFONT lfFixed = { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, | | | 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | * Identify an available fixed font. Equivalent to ANSI_FIXED_FONT but * more reliable on Russian Windows. */ { LOGFONT lfFixed = { 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, L"" }; long pointSize, dpi; HDC hdc = GetDC(NULL); dpi = GetDeviceCaps(hdc, LOGPIXELSY); pointSize = -MulDiv(ncMetrics.lfMessageFont.lfHeight, 72, dpi); lfFixed.lfHeight = -MulDiv(pointSize+1, dpi, 72); ReleaseDC(NULL, hdc); |
︙ | ︙ | |||
854 855 856 857 858 859 860 | thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, start, (int) (p - start), &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 | thisSubFontPtr = FindSubFontForChar(fontPtr, ch, &lastSubFontPtr); if (thisSubFontPtr != lastSubFontPtr) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, start, (int) (p - start), &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { moretomeasure = 1; break; } |
︙ | ︙ | |||
881 882 883 884 885 886 887 | * without a break. Just measure the last run and that's it. */ familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, start, (int) (p - start), &runString); size.cx = 0; | | | 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | * without a break. Just measure the last run and that's it. */ familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, start, (int) (p - start), &runString); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); Tcl_DStringFree(&runString); if (maxLength >= 0 && (curX+size.cx) > maxLength) { moretomeasure = 1; } else { curX += size.cx; |
︙ | ︙ | |||
915 916 917 918 919 920 921 | next = p + TkUtfToUniChar(p, &ch); Tcl_UtfToExternal(NULL, familyPtr->encoding, p, (int) (next - p), 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL); Tcl_DStringAppend(&runString,buf,dstWrote); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, | | | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | next = p + TkUtfToUniChar(p, &ch); Tcl_UtfToExternal(NULL, familyPtr->encoding, p, (int) (next - p), 0, NULL, buf, sizeof(buf), NULL, &dstWrote, NULL); Tcl_DStringAppend(&runString,buf,dstWrote); size.cx = 0; familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *) Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); if ((curX+size.cx) > maxLength) { break; } lastSize = size.cx; p = next; |
︙ | ︙ | |||
1465 1466 1467 1468 1469 1470 1471 | if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) { if (p > source) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, | | | | | 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 | if ((thisSubFontPtr != lastSubFontPtr) || (p-source > 200)) { if (p > source) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString)>>familyPtr->isWideFont); familyPtr->getTextExtentPoint32Proc(hdc, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont, &size); x += size.cx; Tcl_DStringFree(&runString); } lastSubFontPtr = thisSubFontPtr; source = p; SelectFont(hdc, fontPtr, lastSubFontPtr, angle); GetTextMetrics(hdc, &tm); } p = next; } if (p > source) { familyPtr = lastSubFontPtr->familyPtr; Tcl_UtfToExternalDString(familyPtr->encoding, source, (int) (p - source), &runString); familyPtr->textOutProc(hdc, x-(tm.tmOverhang/2), y, (WCHAR *)Tcl_DStringValue(&runString), Tcl_DStringLength(&runString) >> familyPtr->isWideFont); Tcl_DStringFree(&runString); } SelectObject(hdc, oldFont); } static inline HFONT |
︙ | ︙ | |||
1561 1562 1563 1564 1565 1566 1567 | HFONT oldFont; TEXTMETRIC tm; Window window; TkFontMetrics *fmPtr; Tcl_Encoding encoding; Tcl_DString faceString; TkFontAttributes *faPtr; | | | 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 | HFONT oldFont; TEXTMETRIC tm; Window window; TkFontMetrics *fmPtr; Tcl_Encoding encoding; Tcl_DString faceString; TkFontAttributes *faPtr; WCHAR buf[LF_FACESIZE]; window = Tk_WindowId(tkwin); hwnd = (window == None) ? NULL : TkWinGetHWND(window); hdc = GetDC(hwnd); oldFont = SelectObject(hdc, hFont); GetTextMetrics(hdc, &tm); |
︙ | ︙ | |||
1757 1758 1759 1760 1761 1762 1763 | int base) /* Non-zero if this font family is to be used * in the base font of a font object. */ { Tk_Uid faceName; FontFamily *familyPtr; Tcl_DString faceString; Tcl_Encoding encoding; | | | 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 | int base) /* Non-zero if this font family is to be used * in the base font of a font object. */ { Tk_Uid faceName; FontFamily *familyPtr; Tcl_DString faceString; Tcl_Encoding encoding; WCHAR buf[LF_FACESIZE]; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); hFont = SelectObject(hdc, hFont); GetTextFace(hdc, LF_FACESIZE, buf); Tcl_ExternalToUtfDString(systemEncoding, (char *) buf, -1, &faceString); faceName = Tk_GetUid(Tcl_DStringValue(&faceString)); |
︙ | ︙ | |||
1819 1820 1821 1822 1823 1824 1825 | * some other location. */ encoding = Tcl_GetEncoding(NULL, faceName); } if (encoding == NULL) { | | | | | | | 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 | * some other location. */ encoding = Tcl_GetEncoding(NULL, faceName); } if (encoding == NULL) { encoding = TkWinGetUnicodeEncoding(); familyPtr->textOutProc = (BOOL (WINAPI *)(HDC, int, int, WCHAR *, int)) TextOutW; familyPtr->getTextExtentPoint32Proc = (BOOL (WINAPI *)(HDC, WCHAR *, int, LPSIZE)) GetTextExtentPoint32W; familyPtr->isWideFont = 1; } else { familyPtr->textOutProc = (BOOL (WINAPI *)(HDC, int, int, WCHAR *, int)) TextOutA; familyPtr->getTextExtentPoint32Proc = (BOOL (WINAPI *)(HDC, WCHAR *, int, LPSIZE)) GetTextExtentPoint32A; familyPtr->isWideFont = 0; } familyPtr->encoding = encoding; return familyPtr; } |
︙ | ︙ | |||
1939 1940 1941 1942 1943 1944 1945 | const char *const *aliases; const char *const *anyFallbacks; const char *const *const *fontFallbacks; const char *fallbackName; SubFont *subFontPtr; Tcl_DString ds; | < | | 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 | const char *const *aliases; const char *const *anyFallbacks; const char *const *const *fontFallbacks; const char *fallbackName; SubFont *subFontPtr; Tcl_DString ds; if (ch < BASE_CHARS) { return &fontPtr->subFontArray[0]; } for (i = 0; i < fontPtr->numSubFonts; i++) { if (FontMapLookup(&fontPtr->subFontArray[i], ch)) { return &fontPtr->subFontArray[i]; } |
︙ | ︙ | |||
2174 2175 2176 2177 2178 2179 2180 | * the associated HFONT can (1) or cannot (0) display the characters on * the page. * * Results: * None. * * Side effects: | | | 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 | * the associated HFONT can (1) or cannot (0) display the characters on * the page. * * Results: * None. * * Side effects: * Memory allocated. * *------------------------------------------------------------------------- */ static void FontMapLoadPage( SubFont *subFontPtr, /* Contains font mapping cache to be |
︙ | ︙ | |||
2491 2492 2493 2494 2495 2496 2497 | lf.lfCharSet = DEFAULT_CHARSET; lf.lfOutPrecision = OUT_TT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds); | | | 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 | lf.lfCharSet = DEFAULT_CHARSET; lf.lfOutPrecision = OUT_TT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &ds); wcsncpy(lf.lfFaceName, (WCHAR *)Tcl_DStringValue(&ds), LF_FACESIZE-1); Tcl_DStringFree(&ds); lf.lfFaceName[LF_FACESIZE-1] = 0; hFont = CreateFontIndirect(&lf); return hFont; } /* |
︙ | ︙ | |||
2525 2526 2527 2528 2529 2530 2531 | FamilyExists( HDC hdc, /* HDC in which font family will be used. */ const char *faceName) /* Font family to query. */ { int result; Tcl_DString faceString; | < < < < < < < < < < < < < < < < | | 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 | FamilyExists( HDC hdc, /* HDC in which font family will be used. */ const char *faceName) /* Font family to query. */ { int result; Tcl_DString faceString; Tcl_UtfToExternalDString(systemEncoding, faceName, -1, &faceString); /* * If the family exists, WinFontExistProc() will be called and * EnumFontFamilies() will return whatever WinFontExistProc() returns. If * the family doesn't exist, EnumFontFamilies() will just return a * non-zero value. */ result = EnumFontFamilies(hdc, (WCHAR*) Tcl_DStringValue(&faceString), (FONTENUMPROC) WinFontExistProc, 0); Tcl_DStringFree(&faceString); return (result == 0); } static const char * FamilyOrAliasExists( |
︙ | ︙ |
Changes to win/tkWinInit.c.
︙ | ︙ | |||
133 134 135 136 137 138 139 | return; } } #endif /* !STATIC_BUILD */ len = MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN); msgString = &titleString[len + 1]; | | | | | | | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | return; } } #endif /* !STATIC_BUILD */ len = MultiByteToWideChar(CP_UTF8, 0, title, -1, titleString, TK_MAX_WARN_LEN); msgString = &titleString[len + 1]; titleString[TK_MAX_WARN_LEN - 1] = '\0'; MultiByteToWideChar(CP_UTF8, 0, msg, -1, msgString, (TK_MAX_WARN_LEN - 1) - len); /* * Truncate MessageBox string if it is too long to not overflow the screen * and cause possible oversized window error. */ if (titleString[TK_MAX_WARN_LEN - 1] != '\0') { memcpy(titleString + (TK_MAX_WARN_LEN - 5), L" ...", 5 * sizeof(WCHAR)); } if (IsDebuggerPresent()) { titleString[len - 1] = ':'; titleString[len] = ' '; OutputDebugStringW(titleString); } else { titleString[len - 1] = '\0'; MessageBoxW(NULL, msgString, titleString, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL | MB_SETFOREGROUND | MB_TOPMOST); } } /* |
︙ | ︙ | |||
174 175 176 177 178 179 180 | * ---------------------------------------------------------------------- */ Tcl_Obj* TkWin32ErrorObj( HRESULT hrError) { | | | < < | | | | < | < < < < | 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | * ---------------------------------------------------------------------- */ Tcl_Obj* TkWin32ErrorObj( HRESULT hrError) { LPWSTR lpBuffer = NULL, p = NULL; WCHAR sBuffer[30]; Tcl_Obj* errPtr = NULL; Tcl_DString ds; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, (DWORD)hrError, LANG_NEUTRAL, (LPWSTR)&lpBuffer, 0, NULL); if (lpBuffer == NULL) { lpBuffer = sBuffer; wsprintf(sBuffer, L"Error Code: %08lX", hrError); } if ((p = wcsrchr(lpBuffer, '\r')) != NULL) { *p = '\0'; } Tcl_WinTCharToUtf(lpBuffer, -1, &ds); errPtr = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); if (lpBuffer != sBuffer) { LocalFree((HLOCAL)lpBuffer); } return errPtr; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to win/tkWinInt.h.
︙ | ︙ | |||
113 114 115 116 117 118 119 | #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette) /* * The following macros define the class names for Tk Window types. */ | | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | #define TkWinGetPalette(colormap) (((TkWinColormap *) colormap)->palette) /* * The following macros define the class names for Tk Window types. */ #define TK_WIN_TOPLEVEL_CLASS_NAME L"TkTopLevel" #define TK_WIN_CHILD_CLASS_NAME L"TkChild" /* * The following variable is a translation table between X gc functions and * Win32 raster and BitBlt op modes. */ MODULE_SCOPE const int tkpWinRopModes[]; |
︙ | ︙ | |||
213 214 215 216 217 218 219 | */ #ifndef GetClassLongPtr # define GetClassLongPtrA GetClassLongA # define GetClassLongPtrW GetClassLongW # define SetClassLongPtrA SetClassLongA # define SetClassLongPtrW SetClassLongW | < < < < < < < < < < | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | */ #ifndef GetClassLongPtr # define GetClassLongPtrA GetClassLongA # define GetClassLongPtrW GetClassLongW # define SetClassLongPtrA SetClassLongA # define SetClassLongPtrW SetClassLongW # define GetClassLongPtr GetClassLongPtrW # define SetClassLongPtr SetClassLongPtrW #endif /* !GetClassLongPtr */ #ifndef GCLP_HICON # define GCLP_HICON GCL_HICON #endif /* !GCLP_HICON */ #ifndef GCLP_HICONSM # define GCLP_HICONSM (-34) #endif /* !GCLP_HICONSM */ #ifndef GetWindowLongPtr # define GetWindowLongPtrA GetWindowLongA # define GetWindowLongPtrW GetWindowLongW # define SetWindowLongPtrA SetWindowLongA # define SetWindowLongPtrW SetWindowLongW # define GetWindowLongPtr GetWindowLongPtrW # define SetWindowLongPtr SetWindowLongPtrW #endif /* !GetWindowLongPtr */ #ifndef GWLP_WNDPROC #define GWLP_WNDPROC GWL_WNDPROC #define GWLP_HINSTANCE GWL_HINSTANCE #define GWLP_HWNDPARENT GWL_HWNDPARENT #define GWLP_USERDATA GWL_USERDATA #define GWLP_ID GWL_ID #endif /* !GWLP_WNDPROC */ #endif /* _TKWININT */ |
Changes to win/tkWinKey.c.
︙ | ︙ | |||
118 119 120 121 122 123 124 | * trans_chars members. */ KeySym keysym = KeycodeToKeysym(keyEv->keycode, keyEv->state, 0); if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256)) || (keysym == XK_Return) || (keysym == XK_Tab)) { | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | * trans_chars members. */ KeySym keysym = KeycodeToKeysym(keyEv->keycode, keyEv->state, 0); if (((keysym != NoSymbol) && (keysym > 0) && (keysym < 256)) || (keysym == XK_Return) || (keysym == XK_Tab)) { len = Tcl_UniCharToUtf(keysym & 255, buf); Tcl_DStringAppend(dsPtr, buf, len); } } return Tcl_DStringValue(dsPtr); } /* |
︙ | ︙ | |||
182 183 184 185 186 187 188 | KeycodeToKeysym( unsigned int keycode, int state, int noascii) { BYTE keys[256]; int result, deadkey, shift; | | | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | KeycodeToKeysym( unsigned int keycode, int state, int noascii) { BYTE keys[256]; int result, deadkey, shift; WCHAR buf[4]; unsigned int scancode = MapVirtualKey(keycode, 0); /* * Do not run keycodes of lock keys through ToUnicode(). One of ToUnicode()'s * side effects is to handle the lights on the keyboard, and we don't want * to mess that up. */ |
︙ | ︙ | |||
568 569 570 571 572 573 574 | for (i = 0; i <= MAX_KEYCODE; i++) { if (keymap[i] == keySym) { eventPtr->xkey.keycode = i; return; } } if (keySym >= 0x20) { | | | 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | for (i = 0; i <= MAX_KEYCODE; i++) { if (keymap[i] == keySym) { eventPtr->xkey.keycode = i; return; } } if (keySym >= 0x20) { result = VkKeyScan((WCHAR) keySym); if (result != -1) { shift = result >> 8; if (shift & 1) eventPtr->xkey.state |= ShiftMask; if (shift & 2) eventPtr->xkey.state |= ControlMask; if (shift & 4) |
︙ | ︙ | |||
621 622 623 624 625 626 627 | } for (i = 0; i <= MAX_KEYCODE; i++) { if (keymap[i] == keysym) { return ((KeyCode) i); } } if (keysym >= 0x20) { | | | 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 | } for (i = 0; i <= MAX_KEYCODE; i++) { if (keymap[i] == keysym) { return ((KeyCode) i); } } if (keysym >= 0x20) { result = VkKeyScan((WCHAR) keysym); if (result != -1) { return (KeyCode) (result & 0xff); } } return 0; } |
︙ | ︙ |
Changes to win/tkWinMenu.c.
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include "tkWinInt.h" #include "tkMenu.h" /* * The class of the window for popup menus. */ | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "tkWinInt.h" #include "tkMenu.h" /* * The class of the window for popup menus. */ #define MENU_CLASS_NAME L"MenuWindowClass" #define EMBEDDED_MENU_CLASS_NAME L"EmbeddedMenuWindowClass" /* * Used to align a windows bitmap inside a rectangle */ #define ALIGN_BITMAP_LEFT 0x00000001 #define ALIGN_BITMAP_RIGHT 0x00000002 |
︙ | ︙ | |||
81 82 83 84 85 86 87 | static int indicatorDimensions[2]; /* The dimensions of the indicator space in a * menu entry. Calculated at init time to save * time. */ static BOOL showMenuAccelerators; | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | static int indicatorDimensions[2]; /* The dimensions of the indicator space in a * menu entry. Calculated at init time to save * time. */ static BOOL showMenuAccelerators; typedef struct { int inPostMenu; /* We cannot be re-entrant like X Windows. */ WORD lastCommandID; /* The last command ID we allocated. */ HWND menuHWND; /* A window to service popup-menu messages * in. */ HWND embeddedMenuHWND; /* A window to service embedded menu * messages */ int oldServiceMode; /* Used while processing a menu; we need to |
︙ | ︙ | |||
416 417 418 419 420 421 422 | /* * Remove the menu from the menu hash table, then destroy the handle. * If the menuHWND is NULL, this table has been finalized already. */ if (tsdPtr->menuHWND != NULL) { Tcl_HashEntry *hashEntryPtr = | | | 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 | /* * Remove the menu from the menu hash table, then destroy the handle. * If the menuHWND is NULL, this table has been finalized already. */ if (tsdPtr->menuHWND != NULL) { Tcl_HashEntry *hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, winMenuHdl); if (hashEntryPtr != NULL) { Tcl_DeleteHashEntry(hashEntryPtr); } } DestroyMenu(winMenuHdl); } |
︙ | ︙ | |||
569 570 571 572 573 574 575 | ReconfigureWindowsMenu( ClientData clientData) /* The menu we are rebuilding */ { TkMenu *menuPtr = clientData; TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; | | | 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 | ReconfigureWindowsMenu( ClientData clientData) /* The menu we are rebuilding */ { TkMenu *menuPtr = clientData; TkMenuEntry *mePtr; HMENU winMenuHdl = (HMENU) menuPtr->platformData; char *itemText = NULL; const WCHAR *lpNewItem; UINT flags; UINT itemID; int i, count, systemMenu = 0, base; Tcl_DString translatedText; if (NULL == winMenuHdl) { return; |
︙ | ︙ | |||
606 607 608 609 610 611 612 | continue; } itemText = GetEntryText(menuPtr, mePtr); if ((menuPtr->menuType == MENUBAR) || (menuPtr->menuFlags & MENU_SYSTEM_MENU)) { Tcl_WinUtfToTChar(itemText, -1, &translatedText); | | | | 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | continue; } itemText = GetEntryText(menuPtr, mePtr); if ((menuPtr->menuType == MENUBAR) || (menuPtr->menuFlags & MENU_SYSTEM_MENU)) { Tcl_WinUtfToTChar(itemText, -1, &translatedText); lpNewItem = (const WCHAR *) Tcl_DStringValue(&translatedText); flags |= MF_STRING; } else { lpNewItem = (LPCWSTR) mePtr; flags |= MF_OWNERDRAW; } /* * Set enabling and disabling correctly. */ |
︙ | ︙ | |||
739 740 741 742 743 744 745 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * | | > > > | < > > > > > > > | 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 | } /* *---------------------------------------------------------------------- * * TkpPostMenu -- * * Posts a menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. * If the entry parameter is negative, the upper left corner of the * menu itself is placed at the point. * * Results: * None. * * Side effects: * The menu is posted and handled. * *---------------------------------------------------------------------- */ int TkpPostMenu( Tcl_Interp *interp, TkMenu *menuPtr, int x, int y, int index) { HMENU winMenuHdl = (HMENU) menuPtr->platformData; int result, flags; RECT noGoawayRect; POINT point; Tk_Window parentWindow = Tk_Parent(menuPtr->tkwin); int oldServiceMode = Tcl_GetServiceMode(); ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->inPostMenu++; CallPendingReconfigureImmediately(menuPtr); result = TkPreprocessMenu(menuPtr); if (result != TCL_OK) { tsdPtr->inPostMenu--; return result; } if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } /* * The post commands could have deleted the menu, which means * we are dead and should go away. */ if (menuPtr->tkwin == NULL) { |
︙ | ︙ | |||
833 834 835 836 837 838 839 840 841 842 843 844 845 846 | Tk_PointerEvent(NULL, point.x, point.y); if (tsdPtr->inPostMenu) { tsdPtr->inPostMenu = 0; } return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpMenuNewEntry -- * * Adds a pointer to a new menu entry structure with the platform- | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 | Tk_PointerEvent(NULL, point.x, point.y); if (tsdPtr->inPostMenu) { tsdPtr->inPostMenu = 0; } return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpPostTearoffMenu -- * * Posts a tearoff menu on the screen so that the top left corner of the * specified entry is located at the point (x, y) in screen coordinates. * If the index parameter is negative, the upper left corner of the menu * itself is placed at the point. Adjusts the menu's position so that it * fits on the screen, and maps and raises the menu. * * Results: * Returns a standard Tcl Error. * * Side effects: * The menu is posted. * *---------------------------------------------------------------------- */ int TkpPostTearoffMenu( Tcl_Interp *interp, /* The interpreter of the menu */ TkMenu *menuPtr, /* The menu we are posting */ int x, int y, int index) /* The root X,Y coordinates where we are * posting */ { int vRootX, vRootY, vRootWidth, vRootHeight; int result; if (index >= (int)menuPtr->numEntries) { index = menuPtr->numEntries - 1; } if (index >= 0) { y -= menuPtr->entries[index]->y; } TkActivateMenuEntry(menuPtr, -1); TkRecomputeMenu(menuPtr); result = TkPostCommand(menuPtr); if (result != TCL_OK) { return result; } /* * The post commands could have deleted the menu, which means we are dead * and should go away. */ if (menuPtr->tkwin == NULL) { return TCL_OK; } /* * Adjust the position of the menu if necessary to keep it visible on the * screen. There are two special tricks to make this work right: * * 1. If a virtual root window manager is being used then the coordinates * are in the virtual root window of menuPtr's parent; since the menu * uses override-redirect mode it will be in the *real* root window for * the screen, so we have to map the coordinates from the virtual root * (if any) to the real root. Can't get the virtual root from the menu * itself (it will never be seen by the wm) so use its parent instead * (it would be better to have an an option that names a window to use * for this...). * 2. The menu may not have been mapped yet, so its current size might be * the default 1x1. To compute how much space it needs, use its * requested size, not its actual size. */ Tk_GetVRootGeometry(Tk_Parent(menuPtr->tkwin), &vRootX, &vRootY, &vRootWidth, &vRootHeight); vRootWidth -= Tk_ReqWidth(menuPtr->tkwin); if (x > vRootX + vRootWidth) { x = vRootX + vRootWidth; } if (x < vRootX) { x = vRootX; } vRootHeight -= Tk_ReqHeight(menuPtr->tkwin); if (y > vRootY + vRootHeight) { y = vRootY + vRootHeight; } if (y < vRootY) { y = vRootY; } Tk_MoveToplevelWindow(menuPtr->tkwin, x, y); if (!Tk_IsMapped(menuPtr->tkwin)) { Tk_MapWindow(menuPtr->tkwin); } TkWmRestackToplevel((TkWindow *) menuPtr->tkwin, Above, NULL); return TCL_OK; } /* *---------------------------------------------------------------------- * * TkpMenuNewEntry -- * * Adds a pointer to a new menu entry structure with the platform- |
︙ | ︙ | |||
1039 1040 1041 1042 1043 1044 1045 | TkMenuEntry *mePtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, | | | | 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | TkMenuEntry *mePtr; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); switch (*pMessage) { case WM_UNINITMENUPOPUP: hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *pwParam); if (hashEntryPtr != NULL) { menuPtr = Tcl_GetHashValue(hashEntryPtr); if ((menuPtr->menuRefPtr != NULL) && (menuPtr->menuRefPtr->parentEntryPtr != NULL)) { TkPostSubmenu(menuPtr->interp, menuPtr->menuRefPtr->parentEntryPtr->menuPtr, NULL); } } break; case WM_INITMENU: TkMenuInit(); hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *pwParam); if (hashEntryPtr != NULL) { tsdPtr->oldServiceMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); menuPtr = Tcl_GetHashValue(hashEntryPtr); tsdPtr->modalMenuPtr = menuPtr; CallPendingReconfigureImmediately(menuPtr); RecursivelyClearActiveMenu(menuPtr); if (!tsdPtr->inPostMenu) { |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | *plResult = 0; returnResult = 1; } break; case WM_MENUCHAR: { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, | | | > | > | > | | > > > | > | 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | *plResult = 0; returnResult = 1; } break; case WM_MENUCHAR: { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { TkSizeT i, len, underline; Tcl_Obj *labelPtr; WCHAR *wlabel; int menuChar; Tcl_DString ds; *plResult = 0; menuPtr = Tcl_GetHashValue(hashEntryPtr); /* * Assume we have something directly convertable to Tcl_UniChar. * True at least for wide systems. */ menuChar = Tcl_UniCharToUpper(LOWORD(*pwParam)); Tcl_DStringInit(&ds); for (i = 0; i < menuPtr->numEntries; i++) { underline = menuPtr->entries[i]->underline; labelPtr = menuPtr->entries[i]->labelPtr; if ((underline != TCL_AUTO_LENGTH) && (labelPtr != NULL)) { /* * Ensure we don't exceed the label length, then check */ const char *src = TkGetStringFromObj(labelPtr, &len); Tcl_DStringFree(&ds); wlabel = (WCHAR *) Tcl_WinUtfToTChar(src, len, &ds); if ((underline + 1 < len + 1) && (menuChar == Tcl_UniCharToUpper(wlabel[underline]))) { *plResult = (2 << 16) | i; returnResult = 1; break; } } } Tcl_DStringFree(&ds); } break; } case WM_MEASUREITEM: { LPMEASUREITEMSTRUCT itemPtr = (LPMEASUREITEMSTRUCT) *plParam; |
︙ | ︙ | |||
1275 1276 1277 1278 1279 1280 1281 | Tcl_SetServiceMode(tsdPtr->oldServiceMode); RecursivelyClearActiveMenu(tsdPtr->modalMenuPtr); } } else { menuPtr = NULL; if (*plParam != 0) { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, | | | | | 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | Tcl_SetServiceMode(tsdPtr->oldServiceMode); RecursivelyClearActiveMenu(tsdPtr->modalMenuPtr); } } else { menuPtr = NULL; if (*plParam != 0) { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, *plParam); if (hashEntryPtr != NULL) { menuPtr = Tcl_GetHashValue(hashEntryPtr); } } if (menuPtr != NULL) { long entryIndex = LOWORD(*pwParam); if ((menuPtr->menuType == MENUBAR) && menuPtr->tearoff) { /* * Windows passes the entry index starting at 0 for * the first menu entry. However this entry #0 is the * tearoff entry for Tk (the menu has -tearoff 1), * which is ignored for MENUBAR menues on Windows. */ entryIndex++; } mePtr = NULL; if (flags != 0xFFFF) { if ((flags&MF_POPUP) && (entryIndex < (int)menuPtr->numEntries)) { mePtr = menuPtr->entries[entryIndex]; } else { hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->commandTable, INT2PTR(entryIndex)); if (hashEntryPtr != NULL) { mePtr = Tcl_GetHashValue(hashEntryPtr); } } } if ((mePtr == NULL) || (mePtr->state == ENTRY_DISABLED)) { TkActivateMenuEntry(menuPtr, -1); } else { if (mePtr->index >= (int)menuPtr->numEntries) { Tcl_Panic("Trying to activate an entry which doesn't exist"); } TkActivateMenuEntry(menuPtr, mePtr->index); } MenuSelectEvent(menuPtr); Tcl_ServiceAll(); *plResult = 0; |
︙ | ︙ | |||
1347 1348 1349 1350 1351 1352 1353 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { | | | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | *---------------------------------------------------------------------- */ void RecursivelyClearActiveMenu( TkMenu *menuPtr) /* The menu to reset. */ { TkSizeT i; TkMenuEntry *mePtr; TkActivateMenuEntry(menuPtr, -1); MenuSelectEvent(menuPtr); for (i = 0; i < menuPtr->numEntries; i++) { mePtr = menuPtr->entries[i]; if (mePtr->state == ENTRY_ACTIVE) { |
︙ | ︙ | |||
1400 1401 1402 1403 1404 1405 1406 | if (menuPtr != NULL) { Tcl_HashEntry *hashEntryPtr; int newEntry; winMenuHdl = (HMENU) menuPtr->platformData; hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, | | | 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 | if (menuPtr != NULL) { Tcl_HashEntry *hashEntryPtr; int newEntry; winMenuHdl = (HMENU) menuPtr->platformData; hashEntryPtr = Tcl_FindHashEntry(&tsdPtr->winMenuTable, winMenuHdl); Tcl_DeleteHashEntry(hashEntryPtr); DestroyMenu(winMenuHdl); winMenuHdl = CreateMenu(); hashEntryPtr = Tcl_CreateHashEntry(&tsdPtr->winMenuTable, (char *) winMenuHdl, &newEntry); Tcl_SetHashValue(hashEntryPtr, menuPtr); menuPtr->platformData = (TkMenuPlatformData) winMenuHdl; |
︙ | ︙ | |||
1963 1964 1965 1966 1967 1968 1969 | int y, /* Top Edge */ int width, /* Width of entry */ int height) /* Height of entry */ { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; | < | | 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 | int y, /* Top Edge */ int width, /* Width of entry */ int height) /* Height of entry */ { if ((mePtr->underline >= 0) && (mePtr->labelPtr != NULL)) { int len; len = Tcl_GetCharLength(mePtr->labelPtr); if (mePtr->underline < len) { const char *label, *start, *end; label = Tcl_GetString(mePtr->labelPtr); start = Tcl_UtfAtIndex(label, mePtr->underline); end = Tcl_UtfNext(start); Tk_UnderlineChars(menuPtr->display, d, |
︙ | ︙ | |||
2144 2145 2146 2147 2148 2149 2150 | * windows events, so we need to invoke C code to generate the * WM_SYSKEYDOWNS and WM_SYSKEYUPs appropriately. Trick is, we can't * create a C level binding directly since we may want to modify the * binding in Tcl code. */ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey", | | < | 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 | * windows events, so we need to invoke C code to generate the * WM_SYSKEYDOWNS and WM_SYSKEYUPs appropriately. Trick is, we can't * create a C level binding directly since we may want to modify the * binding in Tcl code. */ (void) Tcl_CreateObjCommand(interp, "tk::WinMenuKey", TkWinMenuKeyObjCmd, Tk_MainWindow(interp), NULL); (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid, "<Alt_L>", "tk::WinMenuKey %W %N", 0); (void) Tk_CreateBinding(interp, bindingTable, (ClientData) uid, "<KeyRelease-Alt_L>", "tk::WinMenuKey %W %N", 0); |
︙ | ︙ | |||
2360 2361 2362 2363 2364 2365 2366 | } if (mePtr->state == ENTRY_DISABLED) { if (menuPtr->disabledFgPtr == NULL) { XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) | | | 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 | } if (mePtr->state == ENTRY_DISABLED) { if (menuPtr->disabledFgPtr == NULL) { XFillRectangle(menuPtr->display, d, menuPtr->disabledGC, x, y, (unsigned) width, (unsigned) height); } else if ((mePtr->image != NULL) && menuPtr->disabledImageGC) { XFillRectangle(menuPtr->display, d, menuPtr->disabledImageGC, leftEdge + imageXOffset, (int) (y + (mePtr->height - imageHeight)/2 + imageYOffset), (unsigned) imageWidth, (unsigned) imageHeight); } } } |
︙ | ︙ | |||
2795 2796 2797 2798 2799 2800 2801 2802 | int x, /* left edge */ int y, /* top edge */ int width, /* width of rectangle to draw */ int height) /* height of rectangle to draw */ { if (mePtr->state == ENTRY_ACTIVE || (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) { bgBorder = activeBorder; | > > > | > > > > > > > > > > > > | | > | 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 | int x, /* left edge */ int y, /* top edge */ int width, /* width of rectangle to draw */ int height) /* height of rectangle to draw */ { if (mePtr->state == ENTRY_ACTIVE || (mePtr->entryFlags & ENTRY_PLATFORM_FLAG1)!=0 ) { int relief; int activeBorderWidth; bgBorder = activeBorder; if ((menuPtr->menuType == MENUBAR) && ((menuPtr->postedCascade == NULL) || (menuPtr->postedCascade != mePtr))) { relief = TK_RELIEF_FLAT; } else { Tk_GetReliefFromObj(NULL, menuPtr->activeReliefPtr, &relief); } Tk_GetPixelsFromObj(NULL, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, activeBorderWidth, relief); } else { Tk_Fill3DRectangle(menuPtr->tkwin, d, bgBorder, x, y, width, height, 0, TK_RELIEF_FLAT); } } /* *-------------------------------------------------------------- * * TkpComputeStandardMenuGeometry -- * |
︙ | ︙ | |||
2856 2857 2858 2859 2860 2861 2862 | menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); | | | 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 | menuFont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->fontPtr); Tk_GetFontMetrics(menuFont, &menuMetrics); accelSpace = Tk_TextWidth(menuFont, "M", 1); Tk_GetPixelsFromObj(menuPtr->interp, menuPtr->tkwin, menuPtr->activeBorderWidthPtr, &activeBorderWidth); for (i = 0; i < (int)menuPtr->numEntries; i++) { if (menuPtr->entries[i]->fontPtr == NULL) { tkfont = menuFont; fmPtr = &menuMetrics; } else { tkfont = Tk_GetFontFromObj(menuPtr->tkwin, menuPtr->entries[i]->fontPtr); Tk_GetFontMetrics(tkfont, &entryMetrics); |
︙ | ︙ | |||
2893 2894 2895 2896 2897 2898 2899 | GetMenuSeparatorGeometry(menuPtr, menuPtr->entries[i], tkfont, fmPtr, &width, &height); menuPtr->entries[i]->height = height; } else if (menuPtr->entries[i]->type == TEAROFF_ENTRY) { GetTearoffEntryGeometry(menuPtr, menuPtr->entries[i], tkfont, fmPtr, &width, &height); menuPtr->entries[i]->height = height; | < | 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 | GetMenuSeparatorGeometry(menuPtr, menuPtr->entries[i], tkfont, fmPtr, &width, &height); menuPtr->entries[i]->height = height; } else if (menuPtr->entries[i]->type == TEAROFF_ENTRY) { GetTearoffEntryGeometry(menuPtr, menuPtr->entries[i], tkfont, fmPtr, &width, &height); menuPtr->entries[i]->height = height; } else { /* * For each entry, compute the height required by that particular * entry, plus three widths: the width of the label, the width to * allow for an indicator to be displayed to the left of the label * (if any), and the width of the accelerator to be displayed to * the right of the label (if any). These sizes depend, of course, |
︙ | ︙ | |||
2941 2942 2943 2944 2945 2946 2947 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } | | < < | 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 | windowHeight = y; } } if (accelWidth != 0) { labelWidth += accelSpace; } for (j = lastColumnBreak; j < (int)menuPtr->numEntries; j++) { menuPtr->entries[j]->indicatorSpace = indicatorSpace; menuPtr->entries[j]->labelWidth = labelWidth; menuPtr->entries[j]->width = indicatorSpace + labelWidth + accelWidth + 2 * activeBorderWidth; menuPtr->entries[j]->x = x; menuPtr->entries[j]->entryFlags |= ENTRY_LAST_COLUMN; } windowWidth = x + indicatorSpace + labelWidth + accelWidth + 2 * activeBorderWidth + borderWidth; windowHeight += borderWidth; /* * The X server doesn't like zero dimensions, so round up to at least 1 (a * zero-sized menu should never really occur, anyway). */ |
︙ | ︙ | |||
3169 3170 3171 3172 3173 3174 3175 | const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { Tcl_Obj *valuePtr = NULL; if ((strcmp(dbName, "activeBorderWidth") == 0) || (strcmp(dbName, "borderWidth") == 0)) { | | | 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 | const char *dbName, /* The option database name. */ const char *className) /* The name of the option class. */ { Tcl_Obj *valuePtr = NULL; if ((strcmp(dbName, "activeBorderWidth") == 0) || (strcmp(dbName, "borderWidth") == 0)) { valuePtr = Tcl_NewWideIntObj(defaultBorderWidth); } else if (strcmp(dbName, "font") == 0) { valuePtr = Tcl_NewStringObj(Tcl_DStringValue(&menuFontDString), -1); } return valuePtr; } |
︙ | ︙ | |||
3208 3209 3210 3211 3212 3213 3214 | HDC scratchDC; int bold = 0; int italic = 0; TEXTMETRIC tm; int pointSize; HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ | < | < < < < | | | | | | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 | HDC scratchDC; int bold = 0; int italic = 0; TEXTMETRIC tm; int pointSize; HFONT menuFont; /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ NONCLIENTMETRICS metrics; OSVERSIONINFOW os; /* * Set all of the default options. The loop will terminate when we run out * of options via a break statement. */ defaultBorderWidth = GetSystemMetrics(SM_CXBORDER); if (GetSystemMetrics(SM_CYBORDER) > defaultBorderWidth) { defaultBorderWidth = GetSystemMetrics(SM_CYBORDER); } scratchDC = CreateDCA("DISPLAY", NULL, NULL, NULL); if (!firstTime) { Tcl_DStringFree(&menuFontDString); } Tcl_DStringInit(&menuFontDString); metrics.cbSize = sizeof(metrics); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); if (os.dwMajorVersion < 6) { metrics.cbSize -= sizeof(int); } SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0); menuFont = CreateFontIndirect(&metrics.lfMenuFont); SelectObject(scratchDC, menuFont); GetTextMetrics(scratchDC, &tm); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); pointSize = MulDiv(tm.tmHeight - tm.tmInternalLeading, 72, GetDeviceCaps(scratchDC, LOGPIXELSY)); if (tm.tmWeight >= 700) { bold = 1; |
︙ | ︙ | |||
3372 3373 3374 3375 3376 3377 3378 | void TkpMenuThreadInit(void) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | | 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 | void TkpMenuThreadInit(void) { ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); tsdPtr->menuHWND = CreateWindow(MENU_CLASS_NAME, L"MenuWindow", WS_POPUP, 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL); if (!tsdPtr->menuHWND) { Tcl_Panic("Failed to create the menu window"); } tsdPtr->embeddedMenuHWND = CreateWindow(EMBEDDED_MENU_CLASS_NAME, L"EmbeddedMenuWindow", WS_POPUP, 0, 0, 10, 10, NULL, NULL, Tk_GetHINSTANCE(), NULL); if (!tsdPtr->embeddedMenuHWND) { Tcl_Panic("Failed to create the embedded menu window"); } Tcl_InitHashTable(&tsdPtr->winMenuTable, TCL_ONE_WORD_KEYS); |
︙ | ︙ |
Changes to win/tkWinPixmap.c.
︙ | ︙ | |||
100 101 102 103 104 105 106 | LPVOID lpMsgBuf; repeatError = 1; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), | | | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | LPVOID lpMsgBuf; repeatError = 1; if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&lpMsgBuf, 0, NULL)) { MessageBox(NULL, (LPWSTR) lpMsgBuf, L"Tk_GetPixmap: Error from CreateDIBSection", MB_OK | MB_ICONINFORMATION); LocalFree(lpMsgBuf); } } } if (newTwdPtr->bitmap.handle == NULL) { |
︙ | ︙ |
Changes to win/tkWinPointer.c.
︙ | ︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 | state |= Button1Mask; } if (GetKeyState(VK_MBUTTON) & 0x8000) { state |= Button2Mask; } if (GetKeyState(VK_RBUTTON) & 0x8000) { state |= Button3Mask; } return state; } /* *---------------------------------------------------------------------- * | > > > > > > | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | state |= Button1Mask; } if (GetKeyState(VK_MBUTTON) & 0x8000) { state |= Button2Mask; } if (GetKeyState(VK_RBUTTON) & 0x8000) { state |= Button3Mask; } if (GetKeyState(VK_XBUTTON1) & 0x8000) { state |= Button4Mask; } if (GetKeyState(VK_XBUTTON2) & 0x8000) { state |= Button5Mask; } return state; } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
Changes to win/tkWinPort.h.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* *--------------------------------------------------------------------------- * The following sets of #includes and #ifdefs are required to get Tcl to * compile under the windows compilers. *--------------------------------------------------------------------------- */ #include <wchar.h> #include <io.h> #include <stdlib.h> #include <errno.h> #include <fcntl.h> #include <malloc.h> #include <ctype.h> #include <math.h> #include <string.h> #include <limits.h> | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | /* *--------------------------------------------------------------------------- * The following sets of #includes and #ifdefs are required to get Tcl to * compile under the windows compilers. *--------------------------------------------------------------------------- */ #include <stdio.h> #include <wchar.h> #include <io.h> #include <stdlib.h> #include <assert.h> #include <errno.h> #include <fcntl.h> #include <malloc.h> #include <ctype.h> #include <math.h> #include <string.h> #include <limits.h> |
︙ | ︙ |
Changes to win/tkWinScrlbr.c.
︙ | ︙ | |||
219 220 221 222 223 224 225 | style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBS_VERT; } else { style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBS_HORZ; } | | | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBS_VERT; } else { style = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBS_HORZ; } scrollPtr->hwnd = CreateWindow(L"SCROLLBAR", NULL, style, Tk_X(tkwin), Tk_Y(tkwin), Tk_Width(tkwin), Tk_Height(tkwin), parent, NULL, Tk_GetHINSTANCE(), NULL); /* * Ensure new window is inserted into the stacking order at the correct * place. */ |
︙ | ︙ | |||
271 272 273 274 275 276 277 | *-------------------------------------------------------------- */ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { | | | | 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | *-------------------------------------------------------------- */ void TkpDisplayScrollbar( ClientData clientData) /* Information about window. */ { WinScrollbar *scrollPtr = clientData; Tk_Window tkwin = scrollPtr->info.tkwin; scrollPtr->info.flags &= ~REDRAW_PENDING; if ((tkwin == NULL) || !Tk_IsMapped(tkwin)) { return; } /* * Destroy and recreate the scrollbar control if the orientation has * changed. */ if (scrollPtr->lastVertical != scrollPtr->info.vertical) { HWND hwnd = Tk_GetHWND(Tk_WindowId(tkwin)); SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR) scrollPtr->oldProc); DestroyWindow(hwnd); CreateProc(tkwin, Tk_WindowId(Tk_Parent(tkwin)), scrollPtr); } else { UpdateScrollbar(scrollPtr); } } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
613 614 615 616 617 618 619 | ModalLoop( WinScrollbar *scrollPtr, XEvent *eventPtr) { int oldMode; if (scrollPtr->hwnd) { | | | | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | ModalLoop( WinScrollbar *scrollPtr, XEvent *eventPtr) { int oldMode; if (scrollPtr->hwnd) { Tcl_Preserve(scrollPtr); scrollPtr->winFlags |= IN_MODAL_LOOP; oldMode = Tcl_SetServiceMode(TCL_SERVICE_ALL); TkWinResendEvent(scrollPtr->oldProc, scrollPtr->hwnd, eventPtr); (void) Tcl_SetServiceMode(oldMode); scrollPtr->winFlags &= ~IN_MODAL_LOOP; if (scrollPtr->hwnd && scrollPtr->winFlags & ALREADY_DEAD) { DestroyWindow(scrollPtr->hwnd); } Tcl_Release(scrollPtr); } } /* *-------------------------------------------------------------- * * TkpScrollbarPosition -- |
︙ | ︙ |
Changes to win/tkWinTest.c.
︙ | ︙ | |||
63 64 65 66 67 68 69 | Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd, | | | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | Tcl_Interp *interp) /* Interpreter to add commands to. */ { /* * Add commands for platform specific tests on MacOS here. */ Tcl_CreateObjCommand(interp, "testclipboard", TestclipboardObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwinevent", TestwineventObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testfindwindow", TestfindwindowObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testgetwindowinfo", TestgetwindowinfoObjCmd, Tk_MainWindow(interp), NULL); Tcl_CreateObjCommand(interp, "testwinlocale", TestwinlocaleObjCmd, Tk_MainWindow(interp), NULL); return TCL_OK; } struct TestFindControlState { int id; HWND control; }; |
︙ | ︙ | |||
171 172 173 174 175 176 177 | if (error == ERROR_CALL_NOT_IMPLEMENTED) { strcpy(msgBuf, "function not supported under Win32s"); } else { sprintf(msgBuf, "unknown error: %ld", error); } msg = msgBuf; } else { | < < | < | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if (error == ERROR_CALL_NOT_IMPLEMENTED) { strcpy(msgBuf, "function not supported under Win32s"); } else { sprintf(msgBuf, "unknown error: %ld", error); } msg = msgBuf; } else { char *msgPtr; Tcl_WinTCharToUtf(wMsgPtr, -1, &ds); LocalFree(wMsgPtr); msgPtr = Tcl_DStringValue(&ds); length = Tcl_DStringLength(&ds); /* * Trim the trailing CR/LF from the system message. |
︙ | ︙ | |||
240 241 242 243 244 245 246 | static int TestclipboardObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | static int TestclipboardObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { Tk_Window tkwin = clientData; if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } return TkSelGetSelection(interp, tkwin, Tk_InternAtom(tkwin, "CLIPBOARD"), XA_STRING, SetSelectionResult, NULL); |
︙ | ︙ | |||
286 287 288 289 290 291 292 293 294 295 296 297 298 299 | UINT message; WPARAM wParam; LPARAM lParam; LRESULT result; static const TkStateMap messageMap[] = { {WM_LBUTTONDOWN, "WM_LBUTTONDOWN"}, {WM_LBUTTONUP, "WM_LBUTTONUP"}, {WM_CHAR, "WM_CHAR"}, {WM_GETTEXT, "WM_GETTEXT"}, {WM_SETTEXT, "WM_SETTEXT"}, {WM_COMMAND, "WM_COMMAND"}, {-1, NULL} }; | > > > > > > > > > > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | UINT message; WPARAM wParam; LPARAM lParam; LRESULT result; static const TkStateMap messageMap[] = { {WM_LBUTTONDOWN, "WM_LBUTTONDOWN"}, {WM_LBUTTONUP, "WM_LBUTTONUP"}, {WM_LBUTTONDBLCLK, "WM_LBUTTONDBLCLK"}, {WM_MBUTTONDOWN, "WM_MBUTTONDOWN"}, {WM_MBUTTONUP, "WM_MBUTTONUP"}, {WM_MBUTTONDBLCLK, "WM_MBUTTONDBLCLK"}, {WM_RBUTTONDOWN, "WM_RBUTTONDOWN"}, {WM_RBUTTONUP, "WM_RBUTTONUP"}, {WM_RBUTTONDBLCLK, "WM_RBUTTONDBLCLK"}, {WM_XBUTTONDOWN, "WM_XBUTTONDOWN"}, {WM_XBUTTONUP, "WM_XBUTTONUP"}, {WM_XBUTTONDBLCLK, "WM_XBUTTONDBLCLK"}, {WM_CHAR, "WM_CHAR"}, {WM_GETTEXT, "WM_GETTEXT"}, {WM_SETTEXT, "WM_SETTEXT"}, {WM_COMMAND, "WM_COMMAND"}, {-1, NULL} }; |
︙ | ︙ | |||
431 432 433 434 435 436 437 | static int TestfindwindowObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { | | | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 | static int TestfindwindowObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { const WCHAR *title = NULL, *class = NULL; Tcl_DString titleString, classString; HWND hwnd = NULL; int r = TCL_OK; DWORD myPid; Tcl_DStringInit(&classString); Tcl_DStringInit(&titleString); |
︙ | ︙ | |||
479 480 481 482 483 484 485 | #endif if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1)); AppendSystemError(interp, GetLastError()); r = TCL_ERROR; } else { | | | | | | | | | | | | | 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | #endif if (hwnd == NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to find window: ", -1)); AppendSystemError(interp, GetLastError()); r = TCL_ERROR; } else { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(PTR2INT(hwnd))); } Tcl_DStringFree(&titleString); Tcl_DStringFree(&classString); return r; } static BOOL CALLBACK EnumChildrenProc( HWND hwnd, LPARAM lParam) { Tcl_Obj *listObj = (Tcl_Obj *) lParam; Tcl_ListObjAppendElement(NULL, listObj, Tcl_NewWideIntObj(PTR2INT(hwnd))); return TRUE; } static int TestgetwindowinfoObjCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_WideInt hwnd; Tcl_Obj *dictObj = NULL, *classObj = NULL, *textObj = NULL; Tcl_Obj *childrenObj = NULL; WCHAR buf[512]; int cch, cchBuf = 256; Tcl_DString ds; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "hwnd"); return TCL_ERROR; } if (Tcl_GetWideIntFromObj(interp, objv[1], &hwnd) != TCL_OK) return TCL_ERROR; cch = GetClassName((HWND)(size_t)hwnd, buf, cchBuf); if (cch == 0) { Tcl_SetObjResult(interp, Tcl_NewStringObj("failed to get class name: ", -1)); AppendSystemError(interp, GetLastError()); return TCL_ERROR; } else { Tcl_DString ds; Tcl_WinTCharToUtf(buf, -1, &ds); classObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); } dictObj = Tcl_NewDictObj(); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("class", 5), classObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("id", 2), Tcl_NewWideIntObj(GetWindowLongPtr((HWND)(size_t)hwnd, GWL_ID))); cch = GetWindowText((HWND)(size_t)hwnd, buf, cchBuf); Tcl_WinTCharToUtf(buf, cch * sizeof (WCHAR), &ds); textObj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); Tcl_DStringFree(&ds); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("text", 4), textObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("parent", 6), Tcl_NewWideIntObj(PTR2INT(GetParent((HWND)(size_t)hwnd)))); childrenObj = Tcl_NewListObj(0, NULL); EnumChildWindows((HWND)(size_t)hwnd, EnumChildrenProc, (LPARAM)childrenObj); Tcl_DictObjPut(interp, dictObj, Tcl_NewStringObj("children", -1), childrenObj); Tcl_SetObjResult(interp, dictObj); return TCL_OK; } static int TestwinlocaleObjCmd( ClientData clientData, /* Main window for application. */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument values. */ { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(GetThreadLocale())); return TCL_OK; } /* * Local Variables: * mode: c * c-basic-offset: 4 * fill-column: 78 * End: */ |
Changes to win/tkWinWindow.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkBusy.h" | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include "tkBusy.h" typedef struct { int initialized; /* 0 means table below needs initializing. */ Tcl_HashTable windowTable; /* The windowTable maps from HWND to Tk_Window * handles. */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* |
︙ | ︙ | |||
67 68 69 70 71 72 73 | if (twdPtr == NULL) { twdPtr = ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = (TkWindow *) tkwin; } else if (twdPtr->window.handle != NULL) { entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | if (twdPtr == NULL) { twdPtr = ckalloc(sizeof(TkWinDrawable)); twdPtr->type = TWD_WINDOW; twdPtr->window.winPtr = (TkWindow *) tkwin; } else if (twdPtr->window.handle != NULL) { entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, twdPtr->window.handle); Tcl_DeleteHashEntry(entryPtr); } /* * Insert the new HWND into the window table. */ |
︙ | ︙ | |||
111 112 113 114 115 116 117 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS); tsdPtr->initialized = 1; } | | | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (!tsdPtr->initialized) { Tcl_InitHashTable(&tsdPtr->windowTable, TCL_ONE_WORD_KEYS); tsdPtr->initialized = 1; } entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { return (Tk_Window) Tcl_GetHashValue(entryPtr); } return NULL; } /* |
︙ | ︙ | |||
319 320 321 322 323 324 325 | /* * Remove references to the window in the pointer module then release the * drawable. */ TkPointerDeadWindow(winPtr); | | | 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | /* * Remove references to the window in the pointer module then release the * drawable. */ TkPointerDeadWindow(winPtr); entryPtr = Tcl_FindHashEntry(&tsdPtr->windowTable, hwnd); if (entryPtr != NULL) { Tcl_DeleteHashEntry(entryPtr); } ckfree(twdPtr); /* |
︙ | ︙ |
Changes to win/tkWinWm.c.
︙ | ︙ | |||
62 63 64 65 66 67 68 | * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ | | | 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | * for this protocol arrives. The actual size * of the structure varies to accommodate the * needs of the actual command. THIS MUST BE * THE LAST FIELD OF THE STRUCTURE. */ } ProtocolHandler; #define HANDLER_SIZE(cmdLength) \ (offsetof(ProtocolHandler, command) + 1 + cmdLength) /* * Helper type passed via lParam to TkWmStackorderToplevelEnumProc */ typedef struct TkWmStackorderToplevelPair { Tcl_HashTable *table; |
︙ | ︙ | |||
363 364 365 366 367 368 369 | static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ NULL, /* lostSlaveProc */ }; | | | 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | static const Tk_GeomMgr wmMgrType = { "wm", /* name */ TopLevelReqProc, /* requestProc */ NULL, /* lostSlaveProc */ }; typedef struct { HPALETTE systemPalette; /* System palette; refers to the currently * installed foreground logical palette. */ TkWindow *createWindow; /* Window that is being constructed. This * value is set immediately before a call to * CreateWindowEx, and is used by SetLimits. * This is a gross hack needed to work around * Windows brain damage where it sends the |
︙ | ︙ | |||
879 880 881 882 883 884 885 | ZeroMemory(&class, sizeof(WNDCLASS)); class.style = CS_HREDRAW | CS_VREDRAW; class.hInstance = Tk_GetHINSTANCE(); class.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME; class.lpfnWndProc = WmProc; if (titlebaricon == NULL) { | | | 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | ZeroMemory(&class, sizeof(WNDCLASS)); class.style = CS_HREDRAW | CS_VREDRAW; class.hInstance = Tk_GetHINSTANCE(); class.lpszClassName = TK_WIN_TOPLEVEL_CLASS_NAME; class.lpfnWndProc = WmProc; if (titlebaricon == NULL) { class.hIcon = LoadIcon(Tk_GetHINSTANCE(), L"tk"); } else { class.hIcon = GetIcon(titlebaricon, ICON_BIG); if (class.hIcon == NULL) { return TCL_ERROR; } /* |
︙ | ︙ | |||
1244 1245 1246 1247 1248 1249 1250 | file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds); if (file == NULL) { return NULL; } Tcl_WinUtfToTChar(file, -1, &ds2); Tcl_DStringFree(&ds); | | | | 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | file = Tcl_TranslateFileName(interp, Tcl_GetString(fileName), &ds); if (file == NULL) { return NULL; } Tcl_WinUtfToTChar(file, -1, &ds2); Tcl_DStringFree(&ds); res = (DWORD *)SHGetFileInfo((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfiSM, sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_ICON); if (res != 0) { SHFILEINFO sfi; unsigned size; Tcl_ResetResult(interp); res = (DWORD *)SHGetFileInfo((WCHAR *)Tcl_DStringValue(&ds2), 0, &sfi, sizeof(SHFILEINFO), SHGFI_ICON); /* * Account for extra icon, if necessary. */ size = sizeof(BlockOfIconImages) |
︙ | ︙ | |||
2127 2128 2129 2130 2131 2132 2133 | tsdPtr->createWindow = winPtr; Tcl_WinUtfToTChar(((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), -1, &titleString); wmPtr->wrapper = CreateWindowEx(wmPtr->exStyle, TK_WIN_TOPLEVEL_CLASS_NAME, | | | 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 | tsdPtr->createWindow = winPtr; Tcl_WinUtfToTChar(((wmPtr->title != NULL) ? wmPtr->title : winPtr->nameUid), -1, &titleString); wmPtr->wrapper = CreateWindowEx(wmPtr->exStyle, TK_WIN_TOPLEVEL_CLASS_NAME, (LPCWSTR) Tcl_DStringValue(&titleString), wmPtr->style, x, y, width, height, parentHWND, NULL, Tk_GetHINSTANCE(), NULL); Tcl_DStringFree(&titleString); SetWindowLongPtr(wmPtr->wrapper, GWLP_USERDATA, (LONG_PTR) winPtr); tsdPtr->createWindow = NULL; if (wmPtr->exStyleConfig & WS_EX_LAYERED) { |
︙ | ︙ | |||
2797 2798 2799 2800 2801 2802 2803 | WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index; | | | < | | | 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 | WMOPT_ICONWINDOW, WMOPT_MANAGE, WMOPT_MAXSIZE, WMOPT_MINSIZE, WMOPT_OVERRIDEREDIRECT, WMOPT_POSITIONFROM, WMOPT_PROTOCOL, WMOPT_RESIZABLE, WMOPT_SIZEFROM, WMOPT_STACKORDER, WMOPT_STATE, WMOPT_TITLE, WMOPT_TRANSIENT, WMOPT_WITHDRAW }; int index; TkSizeT length; const char *argv1; TkWindow *winPtr, **winPtrPtr = &winPtr; TkDisplay *dispPtr = ((TkWindow *) tkwin)->dispPtr; if (objc < 2) { wrongNumArgs: Tcl_WrongNumArgs(interp, 1, objv, "option window ?arg ...?"); return TCL_ERROR; } argv1 = TkGetStringFromObj(objv[1], &length); if ((argv1[0] == 't') && !strncmp(argv1, "tracing", length) && (length >= 3)) { int wmTracing; if ((objc != 2) && (objc != 3)) { Tcl_WrongNumArgs(interp, 2, objv, "?boolean?"); return TCL_ERROR; } if (objc == 2) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (dispPtr->flags & TK_DISPLAY_WM_TRACING) != 0)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[2], &wmTracing) != TCL_OK) { return TCL_ERROR; } if (wmTracing) { dispPtr->flags |= TK_DISPLAY_WM_TRACING; |
︙ | ︙ | |||
2964 2965 2966 2967 2968 2969 2970 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; | | | | | | 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 | "window ?minNumer minDenom maxNumer maxDenom?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PAspect) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->minAspect.x); results[1] = Tcl_NewWideIntObj(wmPtr->minAspect.y); results[2] = Tcl_NewWideIntObj(wmPtr->maxAspect.x); results[3] = Tcl_NewWideIntObj(wmPtr->maxAspect.y); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->sizeHintsFlags &= ~PAspect; } else { |
︙ | ︙ | |||
3026 3027 3028 3029 3030 3031 3032 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; int i, boolean; | | | 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; LONG style, exStyle, styleBit, *stylePtr = NULL; const char *string; int i, boolean; TkSizeT length; int config_fullscreen = 0, updatewrapper = 0; int fullscreen_attr_changed = 0, fullscreen_attr = 0; if ((objc < 3) || ((objc > 5) && ((objc%2) == 0))) { configArgs: Tcl_WrongNumArgs(interp, 2, objv, "window" |
︙ | ︙ | |||
3056 3057 3058 3059 3060 3061 3062 | Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-transparentcolor", -1)); Tcl_ListObjAppendElement(NULL, objPtr, wmPtr->crefObj ? wmPtr->crefObj : Tcl_NewObj()); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-disabled", -1)); Tcl_ListObjAppendElement(NULL, objPtr, | | | | | | < | 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 | Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-transparentcolor", -1)); Tcl_ListObjAppendElement(NULL, objPtr, wmPtr->crefObj ? wmPtr->crefObj : Tcl_NewObj()); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-disabled", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((style & WS_DISABLED) != 0)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-fullscreen", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((wmPtr->flags & WM_FULLSCREEN) != 0)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-toolwindow", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((exStyle & WS_EX_TOOLWINDOW) != 0)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewStringObj("-topmost", -1)); Tcl_ListObjAppendElement(NULL, objPtr, Tcl_NewWideIntObj((exStyle & WS_EX_TOPMOST) != 0)); Tcl_SetObjResult(interp, objPtr); return TCL_OK; } for (i = 3; i < objc; i += 2) { string = TkGetStringFromObj(objv[i], &length); if ((length < 2) || (string[0] != '-')) { goto configArgs; } if (strncmp(string, "-disabled", length) == 0) { stylePtr = &style; styleBit = WS_DISABLED; } else if ((strncmp(string, "-alpha", length) == 0) |
︙ | ︙ | |||
3142 3143 3144 3145 3146 3147 3148 | if (dval < 0.0) { dval = 0; } else if (dval > 1.0) { dval = 1; } wmPtr->alpha = dval; } else { /* -transparentcolor */ | | < | 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 | if (dval < 0.0) { dval = 0; } else if (dval > 1.0) { dval = 1; } wmPtr->alpha = dval; } else { /* -transparentcolor */ const char *crefstr = TkGetStringFromObj(objv[i+1], &length); if (length == 0) { /* reset to no transparent color */ if (wmPtr->crefObj) { Tcl_DecrRefCount(wmPtr->crefObj); wmPtr->crefObj = NULL; } } else { |
︙ | ︙ | |||
3206 3207 3208 3209 3210 3211 3212 | if ((i < objc-1) && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) != TCL_OK) { return TCL_ERROR; } if (config_fullscreen) { if (objc == 4) { | | | | | 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 | if ((i < objc-1) && Tcl_GetBooleanFromObj(interp, objv[i+1], &boolean) != TCL_OK) { return TCL_ERROR; } if (config_fullscreen) { if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj( (wmPtr->flags & WM_FULLSCREEN) != 0)); } else { fullscreen_attr_changed = 1; fullscreen_attr = boolean; } config_fullscreen = 0; } else if (objc == 4) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj((*stylePtr & styleBit) != 0)); } else if (boolean) { *stylePtr |= styleBit; } else { *stylePtr &= ~styleBit; } } if ((styleBit == WS_EX_TOPMOST) && (wmPtr->wrapper != NULL)) { |
︙ | ︙ | |||
3322 3323 3324 3325 3326 3327 3328 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | | | < | 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->clientMachine != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->clientMachine, -1)); } return TCL_OK; } argv3 = TkGetStringFromObj(objv[3], &length); if (argv3[0] == 0) { if (wmPtr->clientMachine != NULL) { ckfree(wmPtr->clientMachine); wmPtr->clientMachine = NULL; if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XDeleteProperty(winPtr->display, winPtr->window, Tk_InternAtom((Tk_Window) winPtr,"WM_CLIENT_MACHINE")); |
︙ | ︙ | |||
3724 3725 3726 3727 3728 3729 3730 | if (Tk_WindowId((Tk_Window) winPtr) == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } hwnd = wmPtr->wrapper; if (hwnd == NULL) { hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr)); } | | | 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 | if (Tk_WindowId((Tk_Window) winPtr) == None) { Tk_MakeWindowExist((Tk_Window) winPtr); } hwnd = wmPtr->wrapper; if (hwnd == NULL) { hwnd = Tk_GetHWND(Tk_WindowId((Tk_Window) winPtr)); } Tcl_SetObjResult(interp, Tcl_ObjPrintf("0x%" TCL_Z_MODIFIER "x", (size_t)PTR2INT(hwnd))); return TCL_OK; } /* *---------------------------------------------------------------------- * * WmGeometryCmd -- |
︙ | ︙ | |||
3833 3834 3835 3836 3837 3838 3839 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; | | | | | | 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 | "window ?baseWidth baseHeight widthInc heightInc?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->sizeHintsFlags & PBaseSize) { Tcl_Obj *results[4]; results[0] = Tcl_NewWideIntObj(wmPtr->reqGridWidth); results[1] = Tcl_NewWideIntObj(wmPtr->reqGridHeight); results[2] = Tcl_NewWideIntObj(wmPtr->widthInc); results[3] = Tcl_NewWideIntObj(wmPtr->heightInc); Tcl_SetObjResult(interp, Tcl_NewListObj(4, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { /* * Turn off gridding and reset the width and height to make sense as |
︙ | ︙ | |||
3922 3923 3924 3925 3926 3927 3928 | Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; const char *argv3; | | | < | 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 | Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; Tk_Window tkwin2; const char *argv3; TkSizeT length; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?pathName?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & WindowGroupHint) { Tcl_SetObjResult(interp, Tcl_NewStringObj(wmPtr->leaderName, -1)); } return TCL_OK; } argv3 = TkGetStringFromObj(objv[3], &length); if (*argv3 == '\0') { wmPtr->hints.flags &= ~WindowGroupHint; if (wmPtr->leaderName != NULL) { ckfree(wmPtr->leaderName); } wmPtr->leaderName = NULL; } else { |
︙ | ︙ | |||
4244 4245 4246 4247 4248 4249 4250 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | | | < | 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newName?"); return TCL_ERROR; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->iconName ? wmPtr->iconName : ""), -1)); return TCL_OK; } else { if (wmPtr->iconName != NULL) { ckfree(wmPtr->iconName); } argv3 = TkGetStringFromObj(objv[3], &length); wmPtr->iconName = ckalloc(length + 1); memcpy(wmPtr->iconName, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED)) { XSetIconName(winPtr->display, winPtr->window, wmPtr->iconName); } } return TCL_OK; |
︙ | ︙ | |||
4367 4368 4369 4370 4371 4372 4373 | * converts them as required. Initialise icon info structure. */ ZeroMemory(&iconInfo, sizeof(iconInfo)); iconInfo.fIcon = TRUE; /* | | | 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 | * converts them as required. Initialise icon info structure. */ ZeroMemory(&iconInfo, sizeof(iconInfo)); iconInfo.fIcon = TRUE; /* * Create device-independent color bitmap. */ ZeroMemory(&bmInfo, sizeof bmInfo); bmInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmInfo.bmiHeader.biWidth = width; bmInfo.bmiHeader.biHeight = -height; bmInfo.bmiHeader.biPlanes = 1; |
︙ | ︙ | |||
4498 4499 4500 4501 4502 4503 4504 | Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; | | | | 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 | Tcl_WrongNumArgs(interp, 2, objv, "window ?x y?"); return TCL_ERROR; } if (objc == 3) { if (wmPtr->hints.flags & IconPositionHint) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(wmPtr->hints.icon_x); results[1] = Tcl_NewWideIntObj(wmPtr->hints.icon_y); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); } return TCL_OK; } if (*Tcl_GetString(objv[3]) == '\0') { wmPtr->hints.flags &= ~IconPositionHint; } else { |
︙ | ︙ | |||
4718 4719 4720 4721 4722 4723 4724 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(wmPtr, &width, &height); | | | | 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMaxSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
4769 4770 4771 4772 4773 4774 4775 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMinSize(wmPtr, &width, &height); | | | | 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 | Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; GetMinSize(wmPtr, &width, &height); results[0] = Tcl_NewWideIntObj(width); results[1] = Tcl_NewWideIntObj(height); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetIntFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetIntFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
4829 4830 4831 4832 4833 4834 4835 | Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } } else { curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; } if (objc == 3) { | | | 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 | Tcl_SetErrorCode(interp, "TK", "WM", "COMMUNICATION", NULL); return TCL_ERROR; } } else { curValue = Tk_Attributes((Tk_Window) winPtr)->override_redirect; } if (objc == 3) { Tcl_SetObjResult(interp, Tcl_NewWideIntObj(curValue != 0)); return TCL_OK; } if (Tcl_GetBooleanFromObj(interp, objv[3], &boolean) != TCL_OK) { return TCL_ERROR; } if (curValue != boolean) { if (winPtr->flags & TK_EMBEDDED) { |
︙ | ︙ | |||
4953 4954 4955 4956 4957 4958 4959 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; | | | 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 | int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; register ProtocolHandler *protPtr, *prevPtr; Atom protocol; const char *cmd; TkSizeT cmdLength; Tcl_Obj *resultObj; if ((objc < 3) || (objc > 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?name? ?command?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
5008 5009 5010 5011 5012 5013 5014 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } | | < | 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 | } else { prevPtr->nextPtr = protPtr->nextPtr; } Tcl_EventuallyFree(protPtr, TCL_DYNAMIC); break; } } cmd = TkGetStringFromObj(objv[4], &cmdLength); if (cmdLength > 0) { protPtr = ckalloc(HANDLER_SIZE(cmdLength)); protPtr->protocol = protocol; protPtr->nextPtr = wmPtr->protPtr; wmPtr->protPtr = protPtr; protPtr->interp = interp; memcpy(protPtr->command, cmd, cmdLength + 1); |
︙ | ︙ | |||
5056 5057 5058 5059 5060 5061 5062 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; | | | | 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 | if ((objc != 3) && (objc != 5)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?width height?"); return TCL_ERROR; } if (objc == 3) { Tcl_Obj *results[2]; results[0] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_WIDTH_NOT_RESIZABLE)); results[1] = Tcl_NewWideIntObj(!(wmPtr->flags&WM_HEIGHT_NOT_RESIZABLE)); Tcl_SetObjResult(interp, Tcl_NewListObj(2, results)); return TCL_OK; } if ((Tcl_GetBooleanFromObj(interp, objv[3], &width) != TCL_OK) || (Tcl_GetBooleanFromObj(interp, objv[4], &height) != TCL_OK)) { return TCL_ERROR; } |
︙ | ︙ | |||
5275 5276 5277 5278 5279 5280 5281 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } | | | 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 | return TCL_ERROR; } if (index == OPT_ISABOVE) { result = index1 > index2; } else { /* OPT_ISBELOW */ result = index1 < index2; } Tcl_SetObjResult(interp, Tcl_NewWideIntObj(result)); return TCL_OK; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
5447 5448 5449 5450 5451 5452 5453 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; | | | | < | | 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 | TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; const char *argv3; TkSizeT length; HWND wrapper; if (objc > 4) { Tcl_WrongNumArgs(interp, 2, objv, "window ?newTitle?"); return TCL_ERROR; } if (winPtr->flags & TK_EMBEDDED) { wrapper = (HWND) SendMessage(wmPtr->wrapper, TK_GETFRAMEWID, 0, 0); } else { wrapper = wmPtr->wrapper; } if (objc == 3) { if (wrapper) { WCHAR buf[256]; Tcl_DString titleString; int size = 256; GetWindowText(wrapper, buf, size); Tcl_WinTCharToUtf(buf, -1, &titleString); Tcl_SetObjResult(interp, Tcl_NewStringObj( Tcl_DStringValue(&titleString), Tcl_DStringLength(&titleString))); Tcl_DStringFree(&titleString); } else { Tcl_SetObjResult(interp, Tcl_NewStringObj( (wmPtr->title ? wmPtr->title : winPtr->nameUid), -1)); } } else { if (wmPtr->title != NULL) { ckfree(wmPtr->title); } argv3 = TkGetStringFromObj(objv[3], &length); wmPtr->title = ckalloc(length + 1); memcpy(wmPtr->title, argv3, length + 1); if (!(wmPtr->flags & WM_NEVER_MAPPED) && wmPtr->wrapper != NULL) { Tcl_DString titleString; Tcl_WinUtfToTChar(wmPtr->title, -1, &titleString); SetWindowText(wrapper, (LPCWSTR) Tcl_DStringValue(&titleString)); Tcl_DStringFree(&titleString); } } return TCL_OK; } /* |
︙ | ︙ | |||
5522 5523 5524 5525 5526 5527 5528 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; | | | 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 | Tk_Window tkwin, /* Main window of the application. */ TkWindow *winPtr, /* Toplevel to work with */ Tcl_Interp *interp, /* Current interpreter. */ int objc, /* Number of arguments. */ Tcl_Obj *const objv[]) /* Argument objects. */ { register WmInfo *wmPtr = winPtr->wmInfoPtr; TkWindow *masterPtr = wmPtr->masterPtr, **masterPtrPtr = &masterPtr, *w; WmInfo *wmPtr2; if ((objc != 3) && (objc != 4)) { Tcl_WrongNumArgs(interp, 2, objv, "window ?master?"); return TCL_ERROR; } if (objc == 3) { |
︙ | ︙ | |||
5580 5581 5582 5583 5584 5585 5586 | if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a master: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } | | > | | > | | | > > | | 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 | if (wmPtr2->iconFor != NULL) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "can't make \"%s\" a master: it is an icon for %s", Tcl_GetString(objv[3]), Tk_PathName(wmPtr2->iconFor))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "ICON", NULL); return TCL_ERROR; } for (w = masterPtr; w != NULL && w->wmInfoPtr != NULL; w = (TkWindow *)w->wmInfoPtr->masterPtr) { if (w == winPtr) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "setting \"%s\" as master creates a transient/master cycle", Tk_PathName(masterPtr))); Tcl_SetErrorCode(interp, "TK", "WM", "TRANSIENT", "SELF", NULL); return TCL_ERROR; } } if (masterPtr != wmPtr->masterPtr) { /* * Remove old master map/unmap binding before setting the new * master. The event handler will ensure that transient states * reflect the state of the master. */ if (wmPtr->masterPtr != NULL) { |
︙ | ︙ | |||
6673 6674 6675 6676 6677 6678 6679 | TkWindow *childWinPtr; TkWmStackorderToplevelPair *pair = (TkWmStackorderToplevelPair *) lParam; /*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/ | | | 6669 6670 6671 6672 6673 6674 6675 6676 6677 6678 6679 6680 6681 6682 6683 | TkWindow *childWinPtr; TkWmStackorderToplevelPair *pair = (TkWmStackorderToplevelPair *) lParam; /*fprintf(stderr, "Looking up HWND %d\n", hwnd);*/ hPtr = Tcl_FindHashEntry(pair->table, hwnd); if (hPtr != NULL) { childWinPtr = Tcl_GetHashValue(hPtr); /* * Double check that same HWND does not get passed twice. */ |
︙ | ︙ |
Changes to win/tkWinX.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" | < < < < < < < < < < > > > > > > > > > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ #include "tkWinInt.h" #include <commctrl.h> #ifdef _MSC_VER # pragma comment (lib, "comctl32.lib") # pragma comment (lib, "advapi32.lib") #endif /* * The zmouse.h file includes the definition for WM_MOUSEWHEEL. */ #include <zmouse.h> /* * WM_MOUSEHWHEEL is normally defined by Winuser.h for Vista/2008 or later, * but is also usable on 2000/XP if IntelliPoint drivers are installed. */ #ifndef WM_MOUSEHWHEEL #define WM_MOUSEHWHEEL 0x020E #endif /* * imm.h is needed by HandleIMEComposition */ #include <imm.h> #ifdef _MSC_VER # pragma comment (lib, "imm32.lib") |
︙ | ︙ | |||
57 58 59 60 61 62 63 | * Declarations of static variables used in this file. */ static const char winScreenName[] = ":0"; /* Default name of windows display. */ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ static int childClassInitialized; /* Registered child class? */ static WNDCLASS childClass; /* Window class for child windows. */ | < | | > | > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | * Declarations of static variables used in this file. */ static const char winScreenName[] = ":0"; /* Default name of windows display. */ static HINSTANCE tkInstance = NULL; /* Application instance handle. */ static int childClassInitialized; /* Registered child class? */ static WNDCLASS childClass; /* Window class for child windows. */ static int tkWinTheme = 0; /* See TkWinGetPlatformTheme */ static Tcl_Encoding keyInputEncoding = NULL; /* The current character encoding for * keyboard input */ static int keyInputCharset = -1; /* The Win32 CHARSET for the keyboard * encoding */ static Tcl_Encoding unicodeEncoding = NULL; /* The UNICODE encoding */ /* * Thread local storage. Notice that now each thread must have its own * TkDisplay structure, since this structure contains most of the thread- * specific date for threads. */ typedef struct { TkDisplay *winDisplay; /* TkDisplay structure that represents Windows * screen. */ int updatingClipboard; /* If 1, we are updating the clipboard. */ int surrogateBuffer; /* Buffer for first of surrogate pair. */ DWORD vWheelTickPrev; /* For high resolution wheels (vertical). */ DWORD hWheelTickPrev; /* For high resolution wheels (horizontal). */ short vWheelAcc; /* For high resolution wheels (vertical). */ short hWheelAcc; /* For high resolution wheels (horizontal). */ } ThreadSpecificData; static Tcl_ThreadDataKey dataKey; /* * Forward declarations of functions used in this file. */ |
︙ | ︙ | |||
123 124 125 126 127 128 129 | Tk_Window tkwin) /* Token for window; this selects a particular * display and server. */ { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; if (!buffer[0]) { | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | Tk_Window tkwin) /* Token for window; this selects a particular * display and server. */ { static char buffer[32]; /* Empty string means not initialized yet. */ OSVERSIONINFOW os; if (!buffer[0]) { HANDLE handle = GetModuleHandle(L"NTDLL"); int(__stdcall *getversion)(void *) = (int(__stdcall *)(void *))GetProcAddress(handle, "RtlGetVersion"); os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); if (!getversion || getversion(&os)) { GetVersionExW(&os); } /* Write the first character last, preventing multi-thread issues. */ |
︙ | ︙ | |||
254 255 256 257 258 259 260 | /* * Initialize input language info */ if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, | | | | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | /* * Initialize input language info */ if (GetLocaleInfo(LANGIDFROMLCID(PTR2INT(GetKeyboardLayout(0))), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (LPWSTR) &lpCP, sizeof(lpCP)/sizeof(WCHAR)) && TranslateCharsetInfo(INT2PTR(lpCP), &lpCs, TCI_SRCCODEPAGE)) { UpdateInputLanguage((int) lpCs.ciCharset); } /* * Make sure we cleanup on finalize. */ TkCreateExitHandler(TkWinXCleanup, hInstance); } /* *---------------------------------------------------------------------- * * TkWinXCleanup -- * |
︙ | ︙ | |||
286 287 288 289 290 291 292 | *---------------------------------------------------------------------- */ void TkWinXCleanup( ClientData clientData) { | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | *---------------------------------------------------------------------- */ void TkWinXCleanup( ClientData clientData) { HINSTANCE hInstance = clientData; /* * Clean up our own class. */ if (childClassInitialized) { childClassInitialized = 0; |
︙ | ︙ | |||
313 314 315 316 317 318 319 | TkWinWmCleanup(hInstance); TkWinCleanupContainerList(); } /* *---------------------------------------------------------------------- * | | | < | | < < < < < | | < < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < | 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | TkWinWmCleanup(hInstance); TkWinCleanupContainerList(); } /* *---------------------------------------------------------------------- * * TkWinGetPlatformTheme -- * * Return the Windows drawing style we should be using. * * Results: * The return value is one of: * TK_THEME_WIN_CLASSIC 95/98/NT or XP in classic mode * TK_THEME_WIN_XP XP not in classic mode * *---------------------------------------------------------------------- */ int TkWinGetPlatformTheme(void) { if (tkWinTheme == 0) { OSVERSIONINFOW os; os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); GetVersionExW(&os); /* * Set tkWinTheme to be TK_THEME_WIN_XP or TK_THEME_WIN_CLASSIC. The * TK_THEME_WIN_CLASSIC could be set even when running under XP if the * windows classic theme was selected. */ if ((os.dwMajorVersion == 5 && os.dwMinorVersion == 1)) { HKEY hKey; LPCWSTR szSubKey = L"Control Panel\\Appearance"; LPCWSTR szCurrent = L"Current"; DWORD dwSize = 200; char pBuffer[200]; memset(pBuffer, 0, dwSize); if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0L, KEY_READ, &hKey) != ERROR_SUCCESS) { tkWinTheme = TK_THEME_WIN_XP; } else { RegQueryValueEx(hKey, szCurrent, NULL, NULL, (LPBYTE) pBuffer, &dwSize); RegCloseKey(hKey); if (strcmp(pBuffer, "Windows Standard") == 0) { tkWinTheme = TK_THEME_WIN_CLASSIC; } else { tkWinTheme = TK_THEME_WIN_XP; } } } else { tkWinTheme = TK_THEME_WIN_CLASSIC; } } return tkWinTheme; } /* *---------------------------------------------------------------------- * * TkGetDefaultScreenName -- |
︙ | ︙ | |||
551 552 553 554 555 556 557 558 559 560 561 562 563 564 | const char *display_name) { Screen *screen; TkWinDrawable *twdPtr; Display *display; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if (tsdPtr->winDisplay != NULL) { if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) { return tsdPtr->winDisplay; } else { return NULL; } | > | 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | const char *display_name) { Screen *screen; TkWinDrawable *twdPtr; Display *display; ThreadSpecificData *tsdPtr = Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); DWORD initialWheelTick; if (tsdPtr->winDisplay != NULL) { if (!strcmp(tsdPtr->winDisplay->display->display_name, display_name)) { return tsdPtr->winDisplay; } else { return NULL; } |
︙ | ︙ | |||
606 607 608 609 610 611 612 | TkWinDisplayChanged(display); tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; | | > > | > > > > > > | 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | TkWinDisplayChanged(display); tsdPtr->winDisplay = ckalloc(sizeof(TkDisplay)); ZeroMemory(tsdPtr->winDisplay, sizeof(TkDisplay)); tsdPtr->winDisplay->display = display; tsdPtr->updatingClipboard = FALSE; initialWheelTick = GetTickCount(); tsdPtr->vWheelTickPrev = initialWheelTick; tsdPtr->hWheelTickPrev = initialWheelTick; tsdPtr->vWheelAcc = 0; tsdPtr->hWheelAcc = 0; /* * Key map info must be available immediately, because of "send event". */ TkpInitKeymapInfo(tsdPtr->winDisplay); /* * Key map info must be available immediately, because of "send event". */ TkpInitKeymapInfo(tsdPtr->winDisplay); return tsdPtr->winDisplay; |
︙ | ︙ | |||
657 658 659 660 661 662 663 | ckfree(display->display_name); } if (display->screens != NULL) { if (display->screens->root_visual != NULL) { ckfree(display->screens->root_visual); } if (display->screens->root != None) { | | | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | ckfree(display->display_name); } if (display->screens != NULL) { if (display->screens->root_visual != NULL) { ckfree(display->screens->root_visual); } if (display->screens->root != None) { ckfree((char *)display->screens->root); } if (display->screens->cmap != None) { XFreeColormap(display, display->screens->cmap); } ckfree(display->screens); } ckfree(display); |
︙ | ︙ | |||
697 698 699 700 701 702 703 | if (dispPtr->clipWindow != NULL) { Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, dispPtr->applicationAtom); Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, dispPtr->windowAtom); Tk_DestroyWindow(dispPtr->clipWindow); | | | 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 | if (dispPtr->clipWindow != NULL) { Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, dispPtr->applicationAtom); Tk_DeleteSelHandler(dispPtr->clipWindow, dispPtr->clipboardAtom, dispPtr->windowAtom); Tk_DestroyWindow(dispPtr->clipWindow); Tcl_Release(dispPtr->clipWindow); dispPtr->clipWindow = NULL; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 | case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: case WM_MOUSEMOVE: Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam)); return 1; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (wParam == VK_PACKET) { | > > > | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 | case WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK: case WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK: case WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK: case WM_XBUTTONDOWN: case WM_XBUTTONDBLCLK: case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: case WM_XBUTTONUP: case WM_MOUSEMOVE: Tk_PointerEvent(hwnd, (short) LOWORD(lParam), (short) HIWORD(lParam)); return 1; case WM_SYSKEYDOWN: case WM_KEYDOWN: if (wParam == VK_PACKET) { |
︙ | ︙ | |||
938 939 940 941 942 943 944 945 946 947 948 949 950 951 | case WM_KILLFOCUS: case WM_DESTROYCLIPBOARD: case WM_UNICHAR: case WM_CHAR: case WM_SYSKEYUP: case WM_KEYUP: case WM_MOUSEWHEEL: GenerateXEvent(hwnd, message, wParam, lParam); return 1; case WM_MENUCHAR: GenerateXEvent(hwnd, message, wParam, lParam); /* * MNC_CLOSE is the only one that looks right. This is a hack. | > | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 | case WM_KILLFOCUS: case WM_DESTROYCLIPBOARD: case WM_UNICHAR: case WM_CHAR: case WM_SYSKEYUP: case WM_KEYUP: case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: GenerateXEvent(hwnd, message, wParam, lParam); return 1; case WM_MENUCHAR: GenerateXEvent(hwnd, message, wParam, lParam); /* * MNC_CLOSE is the only one that looks right. This is a hack. |
︙ | ︙ | |||
982 983 984 985 986 987 988 | LPARAM lParam) { XEvent event; TkWindow *winPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); | | | 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 | LPARAM lParam) { XEvent event; TkWindow *winPtr; ThreadSpecificData *tsdPtr = (ThreadSpecificData *) Tcl_GetThreadData(&dataKey, sizeof(ThreadSpecificData)); if ((message == WM_MOUSEWHEEL) || (message == WM_MOUSEHWHEEL)) { union {LPARAM lParam; POINTS point;} root; POINT pos; root.lParam = lParam; /* * Redirect mousewheel events to the window containing the cursor. * That feels much less strange to users, and is how all the other |
︙ | ︙ | |||
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 | event.type = SelectionClear; event.xselectionclear.selection = Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD"); event.xselectionclear.time = TkpGetMS(); break; case WM_MOUSEWHEEL: case WM_CHAR: case WM_UNICHAR: case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_KEYDOWN: case WM_KEYUP: { unsigned int state = GetState(message, wParam, lParam); | > | 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | event.type = SelectionClear; event.xselectionclear.selection = Tk_InternAtom((Tk_Window)winPtr, "CLIPBOARD"); event.xselectionclear.time = TkpGetMS(); break; case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: case WM_CHAR: case WM_UNICHAR: case WM_SYSKEYDOWN: case WM_SYSKEYUP: case WM_KEYDOWN: case WM_KEYUP: { unsigned int state = GetState(message, wParam, lParam); |
︙ | ︙ | |||
1138 1139 1140 1141 1142 1143 1144 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { /* | | | | | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 | /* * Now set up event specific fields. */ switch (message) { case WM_MOUSEWHEEL: { /* * Support for high resolution wheels (vertical). */ DWORD wheelTick = GetTickCount(); if (wheelTick - tsdPtr->vWheelTickPrev < 1500) { tsdPtr->vWheelAcc += (short) HIWORD(wParam); } else { tsdPtr->vWheelAcc = (short) HIWORD(wParam); } tsdPtr->vWheelTickPrev = wheelTick; if (abs(tsdPtr->vWheelAcc) < WHEEL_DELTA) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ event.type = MouseWheelEvent; event.xany.send_event = -1; event.xkey.nbytes = 0; event.xkey.keycode = tsdPtr->vWheelAcc / WHEEL_DELTA * WHEEL_DELTA; tsdPtr->vWheelAcc = tsdPtr->vWheelAcc % WHEEL_DELTA; break; } case WM_MOUSEHWHEEL: { /* * Support for high resolution wheels (horizontal). */ DWORD wheelTick = GetTickCount(); if (wheelTick - tsdPtr->hWheelTickPrev < 1500) { tsdPtr->hWheelAcc -= (short) HIWORD(wParam); } else { tsdPtr->hWheelAcc = -((short) HIWORD(wParam)); } tsdPtr->hWheelTickPrev = wheelTick; if (abs(tsdPtr->hWheelAcc) < WHEEL_DELTA) { return; } /* * We have invented a new X event type to handle this event. It * still uses the KeyPress struct. However, the keycode field has * been overloaded to hold the zDelta of the wheel. Set nbytes to * 0 to prevent conversion of the keycode to a keysym in * TkpGetString. [Bug 1118340]. */ event.type = MouseWheelEvent; event.xany.send_event = -1; event.xkey.nbytes = 0; event.xkey.state |= ShiftMask; event.xkey.keycode = tsdPtr->hWheelAcc / WHEEL_DELTA * WHEEL_DELTA; tsdPtr->hWheelAcc = tsdPtr->hWheelAcc % WHEEL_DELTA; break; } case WM_SYSKEYDOWN: case WM_KEYDOWN: /* * Check for translated characters in the event queue. Setting * xany.send_event to -1 indicates to the Windows implementation |
︙ | ︙ | |||
1303 1304 1305 1306 1307 1308 1309 | /* *---------------------------------------------------------------------- * * GetState -- * * This function constructs a state mask for the mouse buttons and | | | 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | /* *---------------------------------------------------------------------- * * GetState -- * * This function constructs a state mask for the mouse buttons and * modifier keys as they were before the event occurred. * * Results: * Returns a composite value of all the modifier and button state flags * that were set at the time the event occurred. * * Side effects: * None. |
︙ | ︙ | |||
1540 1541 1542 1543 1544 1545 1546 | *---------------------------------------------------------------------- */ Tcl_Encoding TkWinGetUnicodeEncoding(void) { if (unicodeEncoding == NULL) { | > > | > | 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 | *---------------------------------------------------------------------- */ Tcl_Encoding TkWinGetUnicodeEncoding(void) { if (unicodeEncoding == NULL) { unicodeEncoding = Tcl_GetEncoding(NULL, "utf-16"); if (unicodeEncoding == NULL) { unicodeEncoding = Tcl_GetEncoding(NULL, "unicode"); } } return unicodeEncoding; } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
1661 1662 1663 1664 1665 1666 1667 | ImmReleaseContext(hwnd, hIMC); return 1; } /* *---------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < | | 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | ImmReleaseContext(hwnd, hIMC); return 1; } /* *---------------------------------------------------------------------- * * TkWinResendEvent -- * * This function converts an X event into a Windows event and invokes the * specified window function. * * Results: * A standard Windows result. * * Side effects: * Invokes the window function * |
︙ | ︙ | |||
1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 | msg = WM_MBUTTONDOWN; wparam = MK_MBUTTON; break; case Button3: msg = WM_RBUTTONDOWN; wparam = MK_RBUTTON; break; default: return 0; } if (eventPtr->xbutton.state & Button1Mask) { wparam |= MK_LBUTTON; } if (eventPtr->xbutton.state & Button2Mask) { wparam |= MK_MBUTTON; } if (eventPtr->xbutton.state & Button3Mask) { wparam |= MK_RBUTTON; } if (eventPtr->xbutton.state & ShiftMask) { wparam |= MK_SHIFT; } if (eventPtr->xbutton.state & ControlMask) { wparam |= MK_CONTROL; } | > > > > > > > > > > > > > > | 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 | msg = WM_MBUTTONDOWN; wparam = MK_MBUTTON; break; case Button3: msg = WM_RBUTTONDOWN; wparam = MK_RBUTTON; break; case Button4: msg = WM_XBUTTONDOWN; wparam = MAKEWPARAM(MK_XBUTTON1, XBUTTON1); break; case Button5: msg = WM_XBUTTONDOWN; wparam = MAKEWPARAM(MK_XBUTTON2, XBUTTON2); break; default: return 0; } if (eventPtr->xbutton.state & Button1Mask) { wparam |= MK_LBUTTON; } if (eventPtr->xbutton.state & Button2Mask) { wparam |= MK_MBUTTON; } if (eventPtr->xbutton.state & Button3Mask) { wparam |= MK_RBUTTON; } if (eventPtr->xbutton.state & Button4Mask) { wparam |= MK_XBUTTON1; } if (eventPtr->xbutton.state & Button5Mask) { wparam |= MK_XBUTTON2; } if (eventPtr->xbutton.state & ShiftMask) { wparam |= MK_SHIFT; } if (eventPtr->xbutton.state & ControlMask) { wparam |= MK_CONTROL; } |
︙ | ︙ | |||
1908 1909 1910 1911 1912 1913 1914 | *---------------------------------------------------------------------- * * Tk_GetUserInactiveTime -- * * Return the number of milliseconds the user was inactive. * * Results: | | | | | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 | *---------------------------------------------------------------------- * * Tk_GetUserInactiveTime -- * * Return the number of milliseconds the user was inactive. * * Results: * Milliseconds of user inactive time or -1 if GetLastInputInfo * returns an error. * * Side effects: * None. * *---------------------------------------------------------------------- */ long Tk_GetUserInactiveTime( Display *dpy) /* Ignored on Windows */ { LASTINPUTINFO li; li.cbSize = sizeof(li); if (!GetLastInputInfo(&li)) { return -1; } /* * Last input info is in milliseconds, since restart time. */ |
︙ | ︙ | |||
1946 1947 1948 1949 1950 1951 1952 | * * Reset the user inactivity timer * * Results: * none * * Side effects: | | | 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 | * * Reset the user inactivity timer * * Results: * none * * Side effects: * The user inactivity timer of the underlying windowing system is reset * to zero. * *---------------------------------------------------------------------- */ void Tk_ResetUserInactiveTime( |
︙ | ︙ |
Changes to win/ttkWinMonitor.c.
︙ | ︙ | |||
68 69 70 71 72 73 74 | } static HWND CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) { WNDCLASSEX wc; HWND hwnd = NULL; | | | | 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | } static HWND CreateThemeMonitorWindow(HINSTANCE hinst, Tcl_Interp *interp) { WNDCLASSEX wc; HWND hwnd = NULL; WCHAR title[32] = L"TtkMonitorWindow"; WCHAR name[32] = L"TtkMonitorClass"; wc.cbSize = sizeof(WNDCLASSEX); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = (WNDPROC)WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hinst; |
︙ | ︙ | |||
148 149 150 151 152 153 154 | MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); | | | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *, HWND hwnd); MODULE_SCOPE int Ttk_WinPlatformInit(Tcl_Interp *interp) { HWND hwnd; hwnd = CreateThemeMonitorWindow(Tk_GetHINSTANCE(), interp); Ttk_RegisterCleanup(interp, hwnd, DestroyThemeMonitorWindow); TtkWinTheme_Init(interp, hwnd); TtkXPTheme_Init(interp, hwnd); return TCL_OK; } |
Changes to win/ttkWinTheme.c.
︙ | ︙ | |||
184 185 186 187 188 189 190 | */ typedef struct { Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { | | | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | */ typedef struct { Tcl_Obj *reliefObj; } BorderElement; static Ttk_ElementOptionSpec BorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(BorderElement,reliefObj), "flat" }, {NULL, 0, 0, NULL} }; static void BorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
235 236 237 238 239 240 241 | typedef struct { Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, | | | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | typedef struct { Tcl_Obj *backgroundObj; } FieldElement; static Ttk_ElementOptionSpec FieldElementOptions[] = { { "-fieldbackground", TK_OPTION_BORDER, offsetof(FieldElement,backgroundObj), "white" }, { NULL, 0, 0, NULL } }; static void FieldElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
286 287 288 289 290 291 292 | Tcl_Obj *reliefObj; Tcl_Obj *highlightColorObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, | | | | | 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | Tcl_Obj *reliefObj; Tcl_Obj *highlightColorObj; Tcl_Obj *defaultStateObj; } ButtonBorderElement; static Ttk_ElementOptionSpec ButtonBorderElementOptions[] = { { "-relief",TK_OPTION_RELIEF, offsetof(ButtonBorderElement,reliefObj), "flat" }, { "-highlightcolor",TK_OPTION_COLOR, offsetof(ButtonBorderElement,highlightColorObj), "black" }, { "-default", TK_OPTION_ANY, offsetof(ButtonBorderElement,defaultStateObj), "disabled" }, {NULL, 0, 0, NULL} }; static void ButtonBorderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
414 415 416 417 418 419 420 | typedef struct { Tcl_Obj *fillColorObj; } FillFocusElement; static Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, | | | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | typedef struct { Tcl_Obj *fillColorObj; } FillFocusElement; static Ttk_ElementOptionSpec FillFocusElementOptions[] = { { "-focusfill", TK_OPTION_COLOR, offsetof(FillFocusElement,fillColorObj), "white" }, {NULL, 0, 0, NULL} }; /* @@@ FIX THIS */ static void FillFocusElementDraw( void *clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) |
︙ | ︙ | |||
538 539 540 541 542 543 544 | */ typedef struct { Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { | | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | */ typedef struct { Tcl_Obj *orientObj; } ThumbElement; static Ttk_ElementOptionSpec ThumbElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(ThumbElement,orientObj),"horizontal"}, { NULL, 0, 0, NULL } }; static void ThumbElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { |
︙ | ︙ | |||
594 595 596 597 598 599 600 | */ typedef struct { Tcl_Obj *orientObj; /* orientation of the slider widget */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | */ typedef struct { Tcl_Obj *orientObj; /* orientation of the slider widget */ } SliderElement; static Ttk_ElementOptionSpec SliderElementOptions[] = { { "-orient", TK_OPTION_ANY, offsetof(SliderElement,orientObj), "horizontal" }, { NULL, 0, 0, NULL } }; static void SliderElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) |
︙ | ︙ |
Changes to win/ttkWinXPTheme.c.
︙ | ︙ | |||
11 12 13 14 15 16 17 18 19 | * * See also: * * <URL: http://msdn.microsoft.com/library/en-us/ * shellcc/platform/commctls/userex/refentry.asp > */ #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ | > < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | * * See also: * * <URL: http://msdn.microsoft.com/library/en-us/ * shellcc/platform/commctls/userex/refentry.asp > */ #include <tkWinInt.h> #ifndef HAVE_UXTHEME_H /* Stub for platforms that lack the XP theme API headers: */ int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) { return TCL_OK; } #else #include <windows.h> #include <uxtheme.h> #if defined(HAVE_VSSYM32_H) || _MSC_VER > 1500 # include <vssym32.h> #else # include <tmschema.h> #endif #include "ttk/ttkTheme.h" typedef HTHEME (STDAPICALLTYPE OpenThemeDataProc)(HWND hwnd, LPCWSTR pszClassList); typedef HRESULT (STDAPICALLTYPE CloseThemeDataProc)(HTHEME hTheme); typedef HRESULT (STDAPICALLTYPE DrawThemeBackgroundProc)(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, |
︙ | ︙ | |||
95 96 97 98 99 100 101 | { /* * Load the library "uxtheme.dll", where the native widget * drawing routines are implemented. This will only succeed * if we are running at least on Windows XP. */ HINSTANCE handle; | | | 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | { /* * Load the library "uxtheme.dll", where the native widget * drawing routines are implemented. This will only succeed * if we are running at least on Windows XP. */ HINSTANCE handle; *phlib = handle = LoadLibrary(L"uxtheme.dll"); if (handle != 0) { /* * We have successfully loaded the library. Proceed in storing the * addresses of the functions we want to use. */ XPThemeProcs *procs = ckalloc(sizeof(XPThemeProcs)); |
︙ | ︙ | |||
428 429 430 431 432 433 434 | * static data from the C object and only the ElementData needs freeing. */ static void DestroyElementData(void *clientData) { ElementData *elementData = clientData; if (elementData->info->flags & HEAP_ELEMENT) { ckfree(elementData->info->statemap); | | | | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | * static data from the C object and only the ElementData needs freeing. */ static void DestroyElementData(void *clientData) { ElementData *elementData = clientData; if (elementData->info->flags & HEAP_ELEMENT) { ckfree(elementData->info->statemap); ckfree((char *)elementData->info->className); ckfree((char *)elementData->info->elementName); ckfree(elementData->info); } ckfree(clientData); } /* * InitElementData -- |
︙ | ︙ | |||
451 452 453 454 455 456 457 | */ static int InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); | | | 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | */ static int InitElementData(ElementData *elementData, Tk_Window tkwin, Drawable d) { Window win = Tk_WindowId(tkwin); if (win) { elementData->hwnd = Tk_GetHWND(win); } else { elementData->hwnd = elementData->procs->stubWindow; } elementData->hTheme = elementData->procs->OpenThemeData( elementData->hwnd, elementData->info->className); |
︙ | ︙ | |||
811 812 813 814 815 816 817 | Tcl_Obj *textObj; Tcl_Obj *fontObj; } TextElement; static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, | | | > > > > > | > > > > > > | > > | 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 | Tcl_Obj *textObj; Tcl_Obj *fontObj; } TextElement; static Ttk_ElementOptionSpec TextElementOptions[] = { { "-text", TK_OPTION_STRING, offsetof(TextElement,textObj), "" }, { "-font", TK_OPTION_FONT, offsetof(TextElement,fontObj), DEFAULT_FONT }, { NULL } }; static void TextElementSize( void *clientData, void *elementRecord, Tk_Window tkwin, int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = {0, 0}; HRESULT hr = S_OK; const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, 0)) return; src = TkGetStringFromObj(element->textObj, &len); Tcl_WinUtfToTChar(src, len, &ds); hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), (WCHAR *) Tcl_DStringValue(&ds), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, NULL, &rc); if (SUCCEEDED(hr)) { *widthPtr = rc.right - rc.left; *heightPtr = rc.bottom - rc.top; } if (*widthPtr < 80) *widthPtr = 80; if (*heightPtr < 20) *heightPtr = 20; Tcl_DStringFree(&ds); FreeElementData(elementData); } static void TextElementDraw( ClientData clientData, void *elementRecord, Tk_Window tkwin, Drawable d, Ttk_Box b, unsigned int state) { TextElement *element = elementRecord; ElementData *elementData = clientData; RECT rc = BoxToRect(b); HRESULT hr = S_OK; const char *src; TkSizeT len; Tcl_DString ds; if (!InitElementData(elementData, tkwin, d)) return; src = TkGetStringFromObj(element->textObj, &len); Tcl_WinUtfToTChar(src, len, &ds); hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), (WCHAR *) Tcl_DStringValue(&ds), -1, DT_LEFT,// | DT_BOTTOM | DT_NOPREFIX, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); Tcl_DStringFree(&ds); FreeElementData(elementData); } static Ttk_ElementSpec TextElementSpec = { TK_STYLE_VERSION_2, sizeof(TextElement), |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | static int GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { static const char *names[] = { "SM_CXBORDER", "SM_CYBORDER", "SM_CXVSCROLL", "SM_CYVSCROLL", "SM_CXHSCROLL", "SM_CYHSCROLL", "SM_CXMENUCHECK", "SM_CYMENUCHECK", "SM_CXMENUSIZE", "SM_CYMENUSIZE", "SM_CXSIZE", "SM_CYSIZE", "SM_CXSMSIZE", | | | 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 | static int GetSysFlagFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *resultPtr) { static const char *names[] = { "SM_CXBORDER", "SM_CYBORDER", "SM_CXVSCROLL", "SM_CYVSCROLL", "SM_CXHSCROLL", "SM_CYHSCROLL", "SM_CXMENUCHECK", "SM_CYMENUCHECK", "SM_CXMENUSIZE", "SM_CYMENUSIZE", "SM_CXSIZE", "SM_CYSIZE", "SM_CXSMSIZE", "SM_CYSMSIZE", NULL }; int flags[] = { SM_CXBORDER, SM_CYBORDER, SM_CXVSCROLL, SM_CYVSCROLL, SM_CXHSCROLL, SM_CYHSCROLL, SM_CXMENUCHECK, SM_CYMENUCHECK, SM_CXMENUSIZE, SM_CYMENUSIZE, SM_CXSIZE, SM_CYSIZE, SM_CXSMSIZE, SM_CYSMSIZE }; |
︙ | ︙ | |||
1098 1099 1100 1101 1102 1103 1104 | const char *elementName, int objc, Tcl_Obj *const objv[]) { XPThemeData *themeData = clientData; ElementInfo *elementPtr = NULL; ClientData elementData; | | | > | | > | | | | | | | | | | > | > > > > > | 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 | const char *elementName, int objc, Tcl_Obj *const objv[]) { XPThemeData *themeData = clientData; ElementInfo *elementPtr = NULL; ClientData elementData; WCHAR *className; int partId = 0; Ttk_StateTable *stateTable; Ttk_Padding pad = {0, 0, 0, 0}; int flags = 0; TkSizeT length = 0; char *name; LPWSTR wname; Ttk_ElementSpec *elementSpec = &GenericElementSpec; Tcl_DString classBuf; static const char *const optionStrings[] = { "-padding","-width","-height","-margins", "-syssize", "-halfheight", "-halfwidth", NULL }; enum { O_PADDING, O_WIDTH, O_HEIGHT, O_MARGINS, O_SYSSIZE, O_HALFHEIGHT, O_HALFWIDTH }; if (objc < 2) { Tcl_SetObjResult(interp, Tcl_NewStringObj( "missing required arguments 'class' and/or 'partId'", -1)); Tcl_SetErrorCode(interp, "TTK", "VSAPI", "REQUIRED", NULL); return TCL_ERROR; } if (Tcl_GetIntFromObj(interp, objv[1], &partId) != TCL_OK) { return TCL_ERROR; } name = TkGetStringFromObj(objv[0], &length); className = (WCHAR *) Tcl_WinUtfToTChar(name, length, &classBuf); /* flags or padding */ if (objc > 3) { int i = 3, option = 0; for (i = 3; i < objc; i += 2) { int tmp = 0; if (i == objc -1) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( "Missing value for \"%s\".", Tcl_GetString(objv[i]))); Tcl_SetErrorCode(interp, "TTK", "VSAPI", "MISSING", NULL); goto retErr; } if (Tcl_GetIndexFromObjStruct(interp, objv[i], optionStrings, sizeof(char *), "option", 0, &option) != TCL_OK) goto retErr; switch (option) { case O_PADDING: if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) { goto retErr; } break; case O_MARGINS: if (Ttk_GetBorderFromObj(interp, objv[i+1], &pad) != TCL_OK) { goto retErr; } flags |= PAD_MARGINS; break; case O_WIDTH: if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { goto retErr; } pad.left = pad.right = tmp; flags |= IGNORE_THEMESIZE; break; case O_HEIGHT: if (Tcl_GetIntFromObj(interp, objv[i+1], &tmp) != TCL_OK) { goto retErr; } pad.top = pad.bottom = tmp; flags |= IGNORE_THEMESIZE; break; case O_SYSSIZE: if (GetSysFlagFromObj(interp, objv[i+1], &tmp) != TCL_OK) { goto retErr; } elementSpec = &GenericSizedElementSpec; flags |= (tmp & 0xFFFF); break; case O_HALFHEIGHT: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) { goto retErr; } if (tmp) flags |= HALF_HEIGHT; break; case O_HALFWIDTH: if (Tcl_GetBooleanFromObj(interp, objv[i+1], &tmp) != TCL_OK) { goto retErr; } if (tmp) flags |= HALF_WIDTH; break; } } } /* convert a statemap into a state table */ if (objc > 2) { Tcl_Obj **specs; int n,j,count, status = TCL_OK; if (Tcl_ListObjGetElements(interp, objv[2], &count, &specs) != TCL_OK) goto retErr; /* we over-allocate to ensure there is a terminating entry */ stateTable = ckalloc(sizeof(Ttk_StateTable) * (count + 1)); memset(stateTable, 0, sizeof(Ttk_StateTable) * (count + 1)); for (n = 0, j = 0; status == TCL_OK && n < count; n += 2, ++j) { Ttk_StateSpec spec = {0,0}; status = Ttk_GetStateSpecFromObj(interp, specs[n], &spec); if (status == TCL_OK) { stateTable[j].onBits = spec.onbits; stateTable[j].offBits = spec.offbits; status = Tcl_GetIntFromObj(interp, specs[n+1], &stateTable[j].index); } } if (status != TCL_OK) { ckfree(stateTable); Tcl_DStringFree(&classBuf); return status; } } else { stateTable = ckalloc(sizeof(Ttk_StateTable)); memset(stateTable, 0, sizeof(Ttk_StateTable)); } elementPtr = ckalloc(sizeof(ElementInfo)); elementPtr->elementSpec = elementSpec; elementPtr->partId = partId; elementPtr->statemap = stateTable; elementPtr->padding = pad; elementPtr->flags = HEAP_ELEMENT | flags; /* set the element name to an allocated copy */ name = ckalloc(strlen(elementName) + 1); strcpy(name, elementName); elementPtr->elementName = name; /* set the class name to an allocated copy */ wname = ckalloc(Tcl_DStringLength(&classBuf) + sizeof(WCHAR)); wcscpy(wname, className); elementPtr->className = wname; elementData = NewElementData(themeData->procs, elementPtr); Ttk_RegisterElementSpec( theme, elementName, elementPtr->elementSpec, elementData); Ttk_RegisterCleanup(interp, elementData, DestroyElementData); Tcl_SetObjResult(interp, Tcl_NewStringObj(elementName, -1)); Tcl_DStringFree(&classBuf); return TCL_OK; retErr: Tcl_DStringFree(&classBuf); return TCL_ERROR; } /*---------------------------------------------------------------------- * +++ Initialization routine: */ MODULE_SCOPE int TtkXPTheme_Init(Tcl_Interp *interp, HWND hwnd) |
︙ | ︙ |
Changes to win/winMain.c.
︙ | ︙ | |||
141 142 143 144 145 146 147 148 149 150 151 152 153 154 | if (*p == '\\') { *p = '/'; } } #ifdef TK_LOCAL_MAIN_HOOK TK_LOCAL_MAIN_HOOK(&argc, &argv); #endif Tk_Main(argc, argv, TK_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } /* | > > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | if (*p == '\\') { *p = '/'; } } #ifdef TK_LOCAL_MAIN_HOOK TK_LOCAL_MAIN_HOOK(&argc, &argv); #elif defined(UNICODE) && ((TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION > 6)) /* This doesn't work on Windows without UNICODE, neither does it work with Tcl 8.6 */ TclZipfs_AppHook(&argc, &argv); #endif Tk_Main(argc, argv, TK_LOCAL_APPINIT); return 0; /* Needed only to prevent compiler warning. */ } /* |
︙ | ︙ |
Changes to xlib/X11/X.h.
︙ | ︙ | |||
69 70 71 72 73 74 75 | * defined as a short, which wouldn't be big * enough. */ /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ | < | < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | * defined as a short, which wouldn't be big * enough. */ /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ /* #define None 0L See bug [9e31fd9449] and below */ #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window |
︙ | ︙ | |||
177 178 179 180 181 182 183 | /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) | < | < < < | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) /* #define ControlMask (1<<2) See bug [9e31fd9449] and below */ #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* See bug [9e31fd9449], this way prevents conflicts with Win32 headers */ enum _Bug9e31fd9449 { None = 0, ControlMask = (1<<2) }; /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 |
︙ | ︙ |
Changes to xlib/X11/Xlib.h.
︙ | ︙ | |||
41 42 43 44 45 46 47 | #ifndef X_WCHAR #ifdef X_NOT_STDC_ENV #define X_WCHAR #endif #endif | < < < < < < < | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #ifndef X_WCHAR #ifdef X_NOT_STDC_ENV #define X_WCHAR #endif #endif typedef char *XPointer; #define Bool int #if defined(MAC_OSX_TK) /* Use define rather than typedef, since may need to undefine this later */ #define Status int #else |
︙ | ︙ | |||
537 538 539 540 541 542 543 | */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ | | | | | | 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | */ typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int keycode; /* detail */ Bool same_screen; /* same screen flag */ char trans_chars[XMaxTransChars]; /* translated characters */ int nbytes; } XKeyEvent; typedef XKeyEvent XKeyPressedEvent; typedef XKeyEvent XKeyReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window it is reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ unsigned int button; /* detail */ Bool same_screen; /* same screen flag */ } XButtonEvent; typedef XButtonEvent XButtonPressedEvent; typedef XButtonEvent XButtonReleasedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ unsigned int state; /* key or button mask */ char is_hint; /* detail */ Bool same_screen; /* same screen flag */ } XMotionEvent; typedef XMotionEvent XPointerMovedEvent; typedef struct { int type; /* of event */ unsigned long serial; /* # of last request processed by server */ Bool send_event; /* true if this came from a SendEvent request */ Display *display; /* Display the event was read from */ Window window; /* "event" window reported relative to */ Window root; /* root window that the event occurred on */ Window subwindow; /* child window */ Time time; /* milliseconds */ int x, y; /* pointer x, y coordinates in event window */ int x_root, y_root; /* coordinates relative to root */ int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ int detail; /* |
︙ | ︙ | |||
1045 1046 1047 1048 1049 1050 1051 | typedef struct { char *chars; int nchars; int delta; XFontSet font_set; } XmbTextItem; | < < < < < < < | 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 | typedef struct { char *chars; int nchars; int delta; XFontSet font_set; } XmbTextItem; typedef void (*XIMProc)(); typedef struct _XIM *XIM; typedef struct _XIC *XIC; typedef unsigned long XIMStyle; |
︙ | ︙ | |||
1135 1136 1137 1138 1139 1140 1141 | typedef struct _XIMText { unsigned short length; XIMFeedback *feedback; Bool encoding_is_wchar; union { char *multi_byte; | < | 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | typedef struct _XIMText { unsigned short length; XIMFeedback *feedback; Bool encoding_is_wchar; union { char *multi_byte; } string; } XIMText; typedef struct _XIMPreeditDrawCallbackStruct { int caret; /* Cursor offset within pre-edit string */ int chg_first; /* Starting change position */ int chg_length; /* Length of the change in character count */ |
︙ | ︙ |
Changes to xlib/X11/Xutil.h.
︙ | ︙ | |||
539 540 541 542 543 544 545 | #if NeedFunctionPrototypes Region /* r */, int /* dx */, int /* dy */ #endif ); | < < < < < < < < < < < < < < < < | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | #if NeedFunctionPrototypes Region /* r */, int /* dx */, int /* dy */ #endif ); extern int XRectInRegion( #if NeedFunctionPrototypes Region /* r */, int /* x */, int /* y */, unsigned int /* width */, unsigned int /* height */ |
︙ | ︙ | |||
760 761 762 763 764 765 766 | char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ #endif ); | < < < < < < < < < < < < < < < < < < < < < < < < < | 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | char** /* list */, int /* count */, XICCEncodingStyle /* style */, XTextProperty* /* text_prop_return */ #endif ); extern Status XTextPropertyToStringList( #if NeedFunctionPrototypes XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ #endif ); extern int XmbTextPropertyToTextList( #if NeedFunctionPrototypes Display* /* display */, XTextProperty* /* text_prop */, char*** /* list_return */, int* /* count_return */ #endif ); extern void XUnionRectWithRegion( #if NeedFunctionPrototypes XRectangle* /* rectangle */, Region /* src_region */, Region /* dest_region_return */ #endif ); |
︙ | ︙ |
Changes to xlib/xcolors.c.
︙ | ︙ | |||
343 344 345 346 347 348 349 | { if (spec[0] == '#') { char *p; Tcl_WideInt value = parseHex64bit(++spec, &p); /* * If *p does not point to the end of the string, there were invalid | | | 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | { if (spec[0] == '#') { char *p; Tcl_WideInt value = parseHex64bit(++spec, &p); /* * If *p does not point to the end of the string, there were invalid * digits in the spec. Ergo, it is not a valid color string. * (Bug f0188aca9e) */ if (*p != '\0') { return 0; } |
︙ | ︙ |
Changes to xlib/xgc.c.
︙ | ︙ | |||
80 81 82 83 84 85 86 | static void FreeClipMask(GC gc) { if (gc->clip_mask != None) { #ifdef MAC_OSX_TK if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) { TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region); } #endif | | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | static void FreeClipMask(GC gc) { if (gc->clip_mask != None) { #ifdef MAC_OSX_TK if (((TkpClipMask*) gc->clip_mask)->type == TKP_CLIP_REGION) { TkpReleaseRegion(((TkpClipMask*) gc->clip_mask)->value.region); } #endif ckfree((char *) gc->clip_mask); gc->clip_mask = None; } } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
113 114 115 116 117 118 119 | XGCValues *values) { GC gp; /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars * are defined, which is invisible from the outside. The list is assumed | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | XGCValues *values) { GC gp; /* * In order to have room for a dash list, MAX_DASH_LIST_SIZE extra chars * are defined, which is invisible from the outside. The list is assumed * to end with a 0-char, so this must be set explicitly during * initialization. */ #define MAX_DASH_LIST_SIZE 10 gp = ckalloc(sizeof(XGCValues) + MAX_DASH_LIST_SIZE + gcCacheSize); if (!gp) { |
︙ | ︙ | |||
449 450 451 452 453 454 455 | * uses of TkSetRegion are currently in DisplayFrame and in * ImgPhotoDisplay, which use the GC immediately. * * Results: * None. * * Side effects: | | | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 | * uses of TkSetRegion are currently in DisplayFrame and in * ImgPhotoDisplay, which use the GC immediately. * * Results: * None. * * Side effects: * Allocates or deallocates a TkpClipMask. * *---------------------------------------------------------------------- */ void TkSetRegion( Display *display, |
︙ | ︙ |